diff --git a/Editor/Editor_VS2005.vcproj b/Editor/Editor_VS2005.vcproj index 92bb418d..3fcf3ae1 100644 --- a/Editor/Editor_VS2005.vcproj +++ b/Editor/Editor_VS2005.vcproj @@ -552,6 +552,10 @@ RelativePath=".\Smoothing Utils.cpp" > + + diff --git a/Editor/Editor_VS2008.vcproj b/Editor/Editor_VS2008.vcproj index efd16c40..b4befac9 100644 --- a/Editor/Editor_VS2008.vcproj +++ b/Editor/Editor_VS2008.vcproj @@ -551,6 +551,10 @@ RelativePath="Smoothing Utils.cpp" > + + diff --git a/Editor/Editor_VS2010.vcxproj b/Editor/Editor_VS2010.vcxproj index 28a36a00..19d9aa89 100644 --- a/Editor/Editor_VS2010.vcxproj +++ b/Editor/Editor_VS2010.vcxproj @@ -77,6 +77,7 @@ + {23EA0500-038A-4EB8-B753-0C709B25470D} diff --git a/Editor/Editor_VS2010.vcxproj.filters b/Editor/Editor_VS2010.vcxproj.filters index ca9d84a6..547bab05 100644 --- a/Editor/Editor_VS2010.vcxproj.filters +++ b/Editor/Editor_VS2010.vcxproj.filters @@ -167,5 +167,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/Editor/Item Statistics.cpp b/Editor/Item Statistics.cpp index b014390b..c2b09431 100644 --- a/Editor/Item Statistics.cpp +++ b/Editor/Item Statistics.cpp @@ -34,12 +34,15 @@ #endif #include "soldier profile type.h" +#include "LuaInitNPCs.h" INT32 giBothCheckboxButton = -1; INT32 giRealisticCheckboxButton = -1; INT32 giSciFiCheckboxButton = -1; INT32 giAlarmTriggerButton = -1; INT32 giOwnershipGroupButton = -1; + +CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ]; /* CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] = { @@ -77,14 +80,93 @@ CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] = L"Museum alarm", L"Bloodcat alarm", L"Big teargas", +#ifdef JA2UB + L"BIGGENS BOMBS", + L"ABIGGENS WARNING", + L"SEE FORTIFIED DOOR", + L"OPEN FORTIFED DOOR", + L"SEE POWER GEN FAN", +#endif }; */ const STR16 GetActionItemName( OBJECTTYPE *pItem ) { +UINT32 i,o; +CHAR16 temp[30]; + if( !pItem || pItem->usItem != ACTION_ITEM ) return NULL; + + +if( (*pItem)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP ) + { + for (i= ACTIONITEM_TRIP_KLAXON; i<=ACTIONITEM_NEW; i++ ) + { + if ( ActionItemsValues[ i ].BlowUp == 0 ) + { + if ( (*pItem)[0]->data.misc.bActionValue == ActionItemsValues[ i ].ActionID ) + { + wcscpy(temp, gszActionItemDesc[i]); + o = i; + } + } + } + return ActionItemsValues[ o ].szName; + } + else + { + for (i= ACTIONITEM_TRIP_KLAXON; i<=ACTIONITEM_NEW; i++ ) + { + if ( ActionItemsValues[ i ].BlowUp == 1 ) + { + if ( (*pItem)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP ) + { + if ( (*pItem)[0]->data.misc.usBombItem == ActionItemsValues[ i ].BombItem ) + o = i; + } + } + } + return ActionItemsValues[ o ].szName; + /* + + + + if ( (*pItem)[0]->data.misc.usBombItem == STUN_GRENADE ) + o = ACTIONITEM_STUN; + else if ( (*pItem)[0]->data.misc.usBombItem == SMOKE_GRENADE ) + o = ACTIONITEM_SMOKE; + else if ( (*pItem)[0]->data.misc.usBombItem == TEARGAS_GRENADE ) + o = ACTIONITEM_TEARGAS; + else if ( (*pItem)[0]->data.misc.usBombItem == MUSTARD_GRENADE ) + o = ACTIONITEM_MUSTARD; + else if ( (*pItem)[0]->data.misc.usBombItem == HAND_GRENADE ) + o = ACTIONITEM_SMALL; + else if ( (*pItem)[0]->data.misc.usBombItem == TNT ) + o = ACTIONITEM_MEDIUM; + else if ( (*pItem)[0]->data.misc.usBombItem == C4 ) + o = ACTIONITEM_LARGE; + else if ( (*pItem)[0]->data.misc.usBombItem == MINE ) + o = ACTIONITEM_MINE; + else if ( (*pItem)[0]->data.misc.usBombItem == TRIP_FLARE ) + o = ACTIONITEM_FLARE; + else if ( (*pItem)[0]->data.misc.usBombItem == TRIP_KLAXON ) + o = ACTIONITEM_TRIP_KLAXON; + else if ( (*pItem)[0]->data.misc.usBombItem == BIG_TEAR_GAS ) + o = ACTIONITEM_BIG_TEAR_GAS; + + return ActionItemsValues[ o ].szName; + + */ + } + +/* + if( !pItem || pItem->usItem != ACTION_ITEM ) + return NULL; + if( (*pItem)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP ) { + + switch( (*pItem)[0]->data.misc.bActionValue ) { case ACTION_ITEM_OPEN_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN ]; @@ -110,6 +192,13 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem ) case ACTION_ITEM_TOGGLE_PRESSURE_ITEMS: return gszActionItemDesc[ ACTIONITEM_TOGGLE_PRESSURE_ITEMS ]; case ACTION_ITEM_MUSEUM_ALARM: return gszActionItemDesc[ ACTIONITEM_MUSEUM_ALARM ]; case ACTION_ITEM_BLOODCAT_ALARM: return gszActionItemDesc[ ACTIONITEM_BLOODCAT_ALARM ]; +#ifdef JA2UB + case ACTION_ITEM_BIGGENS_BOMBS: return gszActionItemDesc[ ACTIONITEM_BIGGENS_BOMBS ]; + case ACTION_ITEM_BIGGENS_WARNING: return gszActionItemDesc[ ACTIONITEM_BIGGENS_WARNING ]; + case ACTION_ITEM_SEE_FORTIFIED_DOOR: return gszActionItemDesc[ ACTIONITEM_SEE_FORTIFIED_DOOR ]; + case ACTION_ITEM_OPEN_FORTIFED_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN_FORTIFED_DOOR ]; + case ACTION_ITEM_SEE_POWER_GEN_FAN: return gszActionItemDesc[ ACTIONITEM_SEE_POWER_GEN_FAN ]; +#endif default: return NULL; } } @@ -128,6 +217,8 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem ) case BIG_TEAR_GAS: return gszActionItemDesc[ ACTIONITEM_BIG_TEAR_GAS ]; default: return NULL; } + +*/ } enum @@ -1412,6 +1503,26 @@ void ActionItemCallback( GUI_BUTTON *btn, INT32 reason ) void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex ) { +UINT32 i; +pItem->usItem = ACTION_ITEM; +//(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP; + + for (i= ACTIONITEM_TRIP_KLAXON; i<=ACTIONITEM_NEW; i++ ) + { + if ( bActionItemIndex == i && ActionItemsValues[ i ].BlowUp == 1 ) + { + (*pItem)[0]->data.misc.usBombItem = ActionItemsValues[ i ].BombItem; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP; + } + else if ( bActionItemIndex == i && ActionItemsValues[ i ].BlowUp == 0 ) + { + (*pItem)[0]->data.misc.usBombItem = ActionItemsValues[ i ].BombItem; + (*pItem)[0]->data.misc.bActionValue = ActionItemsValues[ i ].ActionID; + } + } + + +/* pItem->usItem = ACTION_ITEM; (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP; switch( bActionItemIndex ) @@ -1541,8 +1652,31 @@ void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex ) case ACTIONITEM_BIG_TEAR_GAS: (*pItem)[0]->data.misc.usBombItem = BIG_TEAR_GAS; break; - +#ifdef JA2UB + case ACTIONITEM_BIGGENS_BOMBS: + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BIGGENS_BOMBS; + break; + case ACTIONITEM_BIGGENS_WARNING: + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BIGGENS_WARNING; + break; + case ACTIONITEM_SEE_FORTIFIED_DOOR: + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_SEE_FORTIFIED_DOOR; + break; + case ACTIONITEM_OPEN_FORTIFED_DOOR: + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_OPEN_FORTIFED_DOOR; + break; + case ACTIONITEM_SEE_POWER_GEN_FAN: + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_SEE_POWER_GEN_FAN; + break; +#endif } + + */ } void UpdateActionItem( INT8 bActionItemIndex ) diff --git a/Editor/Item Statistics.h b/Editor/Item Statistics.h index e87a5f7e..cb836f94 100644 --- a/Editor/Item Statistics.h +++ b/Editor/Item Statistics.h @@ -84,6 +84,18 @@ enum ACTIONITEM_MUSEUM_ALARM, ACTIONITEM_BLOODCAT_ALARM, ACTIONITEM_BIG_TEAR_GAS, + +#ifdef JA2UB + ACTIONITEM_BIGGENS_BOMBS, + ACTIONITEM_BIGGENS_WARNING, + ACTIONITEM_SEE_FORTIFIED_DOOR, + ACTIONITEM_OPEN_FORTIFED_DOOR, + ACTIONITEM_SEE_POWER_GEN_FAN, + ACTIONITEM_NEW = ACTIONITEM_SEE_POWER_GEN_FAN + 215, +#else + ACTIONITEM_NEW = ACTIONITEM_BIG_TEAR_GAS + 220, +#endif + NUM_ACTIONITEMS }; extern CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ]; @@ -98,5 +110,7 @@ extern INT8 gbDefaultBombTrapLevel; extern void SetOwnershipGroup( UINT8 ubNewGroup ); +//extern CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ]; + #endif #endif diff --git a/Editor/XML_ActionItems.cpp b/Editor/XML_ActionItems.cpp new file mode 100644 index 00000000..eca5543e --- /dev/null +++ b/Editor/XML_ActionItems.cpp @@ -0,0 +1,252 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" + #include "Editor All.h" + #include "LuaInitNPCs.h" +#else + #include "Editor All.h" + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Item Statistics.h" + #include "LuaInitNPCs.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + ACTION_ITEM_VALUES curActionItems; + ACTION_ITEM_VALUES * curArray; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; + //CHAR16 gzEnemyNames[MAX_ENEMY_NAMES_CHARS]; +} +typedef actionItemsParseData; + +BOOLEAN ActionItems_TextOnly; + +static void XMLCALL +actionItemsStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + actionItemsParseData * pData = (actionItemsParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "ACTION_ITEM_LIST") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "ACTION_ITEM") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "ActionID") == 0 || + strcmp(name, "Name") == 0 || + strcmp(name, "BombItem") == 0 || + strcmp(name, "Blow_up") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +actionItemsCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + actionItemsParseData * pData = (actionItemsParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +actionItemsEndElementHandle(void *userData, const XML_Char *name) +{ + actionItemsParseData * pData = (actionItemsParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "ACTION_ITEM_LIST") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "ACTION_ITEM") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!ActionItems_TextOnly) + { + //if ( ActionItemsValues[pData->curActionItems.uiIndex].ActionID > 0 ) + wcscpy(ActionItemsValues[pData->curActionItems.uiIndex].szName, pData->curActionItems.szName); + + #ifdef JA2EDITOR + //if ( ActionItemsValues[pData->curActionItems.uiIndex].ActionID > 0 ) + wcscpy(gszActionItemDesc[pData->curActionItems.uiIndex], pData->curActionItems.szName); + #endif + + ActionItemsValues[pData->curActionItems.uiIndex].ActionID = pData->curActionItems.ActionID; + ActionItemsValues[pData->curActionItems.uiIndex].BlowUp = pData->curActionItems.BlowUp; + ActionItemsValues[pData->curActionItems.uiIndex].BombItem = pData->curActionItems.BombItem; + + } + else + { + //if ( ActionItemsValues[pData->curActionItems.uiIndex].ActionID > 0 ) + wcscpy(ActionItemsValues[pData->curActionItems.uiIndex].szName, pData->curActionItems.szName); + + #ifdef JA2EDITOR + //if ( ActionItemsValues[pData->curActionItems.uiIndex].ActionID > 0 ) + wcscpy(gszActionItemDesc[pData->curActionItems.uiIndex], pData->curActionItems.szName); + #endif + } + + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curActionItems.uiIndex = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "Name") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curActionItems.szName, sizeof(pData->curActionItems.szName)/sizeof(pData->curActionItems.szName[0]) ); + pData->curActionItems.szName[sizeof(pData->curActionItems.szName)/sizeof(pData->curActionItems.szName[0]) - 1] = '\0'; + } + else if(strcmp(name, "ActionID") == 0) + { + pData->curElement = ELEMENT; + pData->curActionItems.ActionID = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "Blow_up") == 0) + { + pData->curElement = ELEMENT; + pData->curActionItems.BlowUp = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "BombItem") == 0) + { + pData->curElement = ELEMENT; + pData->curActionItems.BombItem = (UINT32) atol(pData->szCharData); + } + pData->maxReadDepth--; + } + pData->currentDepth--; +} + + + + +BOOLEAN ReadInActionItems(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + actionItemsParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading ActionItems.xml" ); + + ActionItems_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, actionItemsStartElementHandle, actionItemsEndElementHandle); + XML_SetCharacterDataHandler(parser, actionItemsCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in ActionItems.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} + +BOOLEAN WriteInActionItems( STR fileName) +{ + HWFILE hFile; + + //Debug code; make sure that what we got from the file is the same as what's there + // Open a new file + hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if ( !hFile ) + return( FALSE ); + + { + UINT32 cnt; + + FilePrintf(hFile,"\r\n"); + for(cnt = 0;cnt < 501;cnt++) + { + FilePrintf(hFile,"\t\r\n"); + FilePrintf(hFile,"\t\t%d\r\n", cnt); + FilePrintf(hFile,"\t\tEmpty action\r\n"); + FilePrintf(hFile,"\t\t%d\r\n", ActionItemsValues[cnt].ActionID); + FilePrintf(hFile,"\t\t%d\r\n", ActionItemsValues[cnt].BlowUp); + FilePrintf(hFile,"\t\r\n"); + } + FilePrintf(hFile,"\r\n"); + } + FileClose( hFile ); + + return( TRUE ); +} diff --git a/GameInitOptionsScreen.cpp b/GameInitOptionsScreen.cpp index 041c5ce7..14b366c0 100644 --- a/GameInitOptionsScreen.cpp +++ b/GameInitOptionsScreen.cpp @@ -28,11 +28,21 @@ #include "connect.h" #include "saveloadscreen.h" +#ifdef JA2UB + #include "ub_config.h" +#endif + #include #include #include #include +#ifdef JA2UB + +// ********************************* +// Unfinished Business: Initial Game Screen +// ********************************* + ////////////////////////////////////////////////////////////// // SANDRO - the start-new-game screen has been changed a lot ////////////////////////////////////////////////////////////// @@ -91,6 +101,7 @@ #define GIO_IRON_MAN_SETTING_Y GIO_GAME_SETTING_Y + 67 #define GIO_IRON_MAN_SETTING_WIDTH GIO_DIF_SETTING_WIDTH +// Tex and Jon #define GIO_TERRORISTS_SETTING_X GIO_TRAITS_SETTING_X #define GIO_TERRORISTS_SETTING_Y GIO_IRON_MAN_SETTING_Y + 67 #define GIO_TERRORISTS_SETTING_WIDTH GIO_DIF_SETTING_WIDTH @@ -99,12 +110,12 @@ #define GIO_BR_SETTING_Y GIO_DIF_SETTING_Y #define GIO_BR_SETTING_WIDTH GIO_DIF_SETTING_WIDTH -#define GIO_PROGRESS_SETTING_X GIO_BR_SETTING_X -#define GIO_PROGRESS_SETTING_Y GIO_BR_SETTING_Y + 63 -#define GIO_PROGRESS_SETTING_WIDTH GIO_DIF_SETTING_WIDTH +#define GIO_SQUAD_SIZE_SETTING_X GIO_BR_SETTING_X +#define GIO_SQUAD_SIZE_SETTING_Y GIO_BR_SETTING_Y + 63 +#define GIO_SQUAD_SIZE_SETTING_WIDTH GIO_DIF_SETTING_WIDTH -#define GIO_INV_SETTING_X GIO_PROGRESS_SETTING_X -#define GIO_INV_SETTING_Y GIO_PROGRESS_SETTING_Y + 63 +#define GIO_INV_SETTING_X GIO_SQUAD_SIZE_SETTING_X +#define GIO_INV_SETTING_Y GIO_SQUAD_SIZE_SETTING_Y + 63 #define GIO_INV_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_DROPALL_SETTING_X GIO_INV_SETTING_X + 36 @@ -123,6 +134,11 @@ #define GIO_TIMED_TURN_SETTING_Y GIO_IRON_MAN_SETTING_Y #define GIO_TIMED_TURN_SETTING_WIDTH GIO_DIF_SETTING_WIDTH +#define GIO_PROGRESS_SETTING_X GIO_SQUAD_SIZE_SETTING_X +#define GIO_PROGRESS_SETTING_Y GIO_TERRORISTS_SETTING_Y + 13 +#define GIO_PROGRESS_SETTING_WIDTH GIO_DIF_SETTING_WIDTH + + // INI File #define JA2SP_INI_FILENAME "ja2_sp.ini" @@ -142,7 +158,2446 @@ #define JA2SP_AVAILABLE_ARSENAL "AVAILABLE_ARSENAL" #define JA2SP_NUMBER_OF_TERRORISTS "NUMBER_OF_TERRORISTS" #define JA2SP_SECRET_WEAPON_CACHES "SECRET_WEAPON_CACHES" +#define JA2SP_SQUAD_SIZE "SQUAD_SIZE" +// Exclusive UB +#define JA2SP_UB_RPC_TEX_AND_JOHN "RPC_TEX_AND_JOHN" +#define JA2SP_UB_RANDOM_MANUEL_TEXT "RANDOM_MANUEL_TEXT" + + +//Difficulty settings +enum +{ + GIO_DIFF_EASY, + GIO_DIFF_MED, + GIO_DIFF_HARD, + GIO_DIFF_INSANE, + + NUM_DIFF_SETTINGS, +}; + +enum +{ + GIO_TRAITS_OLD, + GIO_TRAITS_NEW, + + NUM_TRAIT_OPTIONS, +}; + +// Game Settings options +enum +{ + GIO_TEXT_OFF, + GIO_TEXT_ON, + + NUM_TEXT_STYLES, +}; + +enum +{ + GIO_REALISTIC, + GIO_SCI_FI, + + NUM_GAME_STYLES, +}; + + +// Iron man mode +enum +{ + GIO_CAN_SAVE, + GIO_IRON_MAN, + + NUM_SAVE_OPTIONS, +}; + +enum +{ + GIO_TEX_JOHN_RANDOM, + GIO_TEX_AND_JOHN, + + NUM_RPC_UB_OPTIONS, +}; + +// BR options +enum +{ + GIO_BR_GOOD, + GIO_BR_GREAT, + GIO_BR_EXCELLENT, + GIO_BR_AWESOME, + + NUM_BR_OPTIONS, +}; + +enum +{ + GIO_PROGRESS_VERY_SLOW, + GIO_PROGRESS_SLOW, + GIO_PROGRESS_NORMAL, + GIO_PROGRESS_FAST, + GIO_PROGRESS_VERY_FAST, + + NUM_PROGRESS_OPTIONS, +}; + +// New inventory options +enum +{ + GIO_INV_OLD, + GIO_INV_NEW, + GIO_INV_NEW_NAS, // WANNE: Added NAS to the start new game screen + + NUM_INV_OPTIONS, +}; + +enum +{ + GIO_SQUAD_SIZE_6, + GIO_SQUAD_SIZE_8, + GIO_SQUAD_SIZE_10, + + NUM_SQUAD_SIZE_OPTIONS, +}; + +enum +{ + GIO_DROPALL_OFF, + GIO_DROPALL_ON, + + NUM_DROPALL_OPTIONS, +}; + +// Gun options +enum +{ + GIO_REDUCED_GUNS, + GIO_GUN_NUT, + + NUM_GUN_OPTIONS, +}; + +enum +{ + GIO_CACHES_RANDOM, + GIO_CACHES_ALL, + + NUM_CACHES_OPTIONS, +}; + + +// Timed turns setting (Multiplayer exclusive) +enum +{ + GIO_NO_TIMED_TURNS, + GIO_TIMED_TURNS, + + GIO_NUM_TIMED_TURN_OPTIONS, +}; + + +//enum for different states of game +enum +{ + GIO_NOTHING, + GIO_CANCEL, + GIO_EXIT, + GIO_IRON_MAN_MODE, + MP_LOAD +}; + +//////////////////////////////////////////// +// +// Global Variables +// +/////////////////////////////////////////// + +BOOLEAN gfGIOScreenEntry = TRUE; +BOOLEAN gfGIOScreenExit = FALSE; +BOOLEAN gfReRenderGIOScreen=TRUE; +BOOLEAN gfGIOButtonsAllocated = FALSE; + +UINT8 gubGameOptionScreenHandler=GIO_NOTHING; + +UINT32 gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; + +UINT32 guiGIOMainBackGroundImage; + +INT32 giGioMessageBox = -1; + +INT8 iCurrentDifficulty; +INT8 iCurrentBRSetting; +INT8 iCurrentIMPNumberSetting; +INT8 iCurrentProgressSetting; +INT8 iCurrentInventorySetting; +INT8 iCurrentSquadSize; + + +UINT32 guiGIOSMALLFRAME; + +// Done Button +void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiGIODoneButton; +INT32 giGIODoneBtnImage; + +// Cancel Button +void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiGIOCancelButton; +INT32 giGIOCancelBtnImage; + +// MP LOAD Button +void MPBtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 MPguiGIOCancelButton; +INT32 MPgiGIOCancelBtnImage; + +UINT32 giGIODifficultyButton[ 2 ]; +INT32 giGIODifficultyButtonImage[ 2 ]; +void BtnGIODifficultySelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ); + +UINT32 giGIOIMPNumberButton[ 2 ]; +INT32 giGIOIMPNumberButtonImage[ 2 ]; +void BtnGIOIMPNumberSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ); + +UINT32 giGIOBRSettingButton[ 2 ]; +INT32 giGIOBRSettingButtonImage[ 2 ]; +void BtnGIOBRSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIOBRSettingRightCallback( GUI_BUTTON *btn,INT32 reason ); + +UINT32 giGIOProgressSettingButton[ 2 ]; +INT32 giGIOProgressSettingButtonImage[ 2 ]; +void BtnGIOProgressSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIOProgressSettingRightCallback( GUI_BUTTON *btn,INT32 reason ); + +UINT32 giGIOInventorySettingButton [ 2 ]; +INT32 giGIOInventorySettingButtonImage [ 2 ]; +void BtnGIOInventorySettingLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIOInventorySettingRightCallback( GUI_BUTTON *btn,INT32 reason ); + +UINT32 guiTraitsOptionTogglesImage[ NUM_TRAIT_OPTIONS ]; +UINT32 guiTraitsOptionToggles[ NUM_TRAIT_OPTIONS ]; +void BtnGIOOldTraitsCallback(GUI_BUTTON *btn,INT32 reason); +void BtnGIONewTraitsCallback(GUI_BUTTON *btn,INT32 reason); +void NewTraitsNotPossibleMessageBoxCallBack( UINT8 bExitValue ); + +//checkbox to toggle Game style +UINT32 guiGameTextTogglesImage[ NUM_TEXT_STYLES ]; +UINT32 guiGameTextToggles[ NUM_TEXT_STYLES ]; + +UINT32 guiGameStyleTogglesImage[ NUM_GAME_STYLES ]; +UINT32 guiGameStyleToggles[ NUM_GAME_STYLES ]; + +void BtnGIOOffStyleCallback(GUI_BUTTON *btn,INT32 reason); +void BtnGIOOnStyleCallback(GUI_BUTTON *btn,INT32 reason); + +//checkbox to toggle Save style +UINT32 guiGameSaveTogglesImage[ NUM_SAVE_OPTIONS ]; +UINT32 guiGameSaveToggles[ NUM_SAVE_OPTIONS ]; +void BtnGIOIronManOffCallback(GUI_BUTTON *btn,INT32 reason); +void BtnGIOIronManOnCallback(GUI_BUTTON *btn,INT32 reason); + +UINT32 guiRpcOptionTogglesImage[ NUM_RPC_UB_OPTIONS ]; +UINT32 guiRpcOptionToggles[ NUM_RPC_UB_OPTIONS ]; + +void BtnGIORpcRandomCallback(GUI_BUTTON *btn,INT32 reason); +void BtnGIORpcAllCallback(GUI_BUTTON *btn,INT32 reason); + +UINT32 guiDropAllOptionTogglesImage[ NUM_DROPALL_OPTIONS ]; +UINT32 guiDropAllOptionToggles[ NUM_DROPALL_OPTIONS ]; +void BtnGIODropAllOffCallback(GUI_BUTTON *btn,INT32 reason); +void BtnGIODropAllOnCallback(GUI_BUTTON *btn,INT32 reason); + +//checkbox to toggle Gun options +UINT32 guiGunOptionTogglesImage[ NUM_GUN_OPTIONS ]; +UINT32 guiGunOptionToggles[ NUM_GUN_OPTIONS ]; +void BtnGIOGunSettingReducedCallback(GUI_BUTTON *btn,INT32 reason); +void BtnGIOGunSettingToGCallback(GUI_BUTTON *btn,INT32 reason); + + +UINT32 giGIOSquadSizeButton[ 2 ]; +INT32 giGIOSquadSizeButtonImage[ 2 ]; +void BtnGIOSquadSizeSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ); + + +UINT32 guiTimedTurnToggles[ GIO_NUM_TIMED_TURN_OPTIONS ]; +void BtnTimedTurnsTogglesCallback(GUI_BUTTON *btn,INT32 reason); + +void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY); + +//////////////////////////////////////////// +// +// Local Function Prototypes +// +/////////////////////////////////////////// + +extern void ClearMainMenu(); + +BOOLEAN EnterGIOScreen(); +BOOLEAN ExitGIOScreen(); +void HandleGIOScreen(); +BOOLEAN RenderGIOScreen(); +void GetGIOScreenUserInput(); +UINT8 GetCurrentGunButtonSetting(); +// JA2Gold: added save (iron man) button setting +UINT8 GetCurrentGameSaveButtonSetting(); + +UINT8 GetCurrentTextStyleButtonSetting(); + +// SANDRO - added following +UINT8 GetCurrentTraitsOptionButtonSetting(); +UINT8 GetCurrentDropAllButtonSetting(); +UINT8 GetCurrentTexAndJohnButtonSetting(); + +void DoneFadeOutForExitGameInitOptionScreen( void ); +void DoneFadeInForExitGameInitOptionScreen( void ); +UINT8 GetCurrentTimedTurnsButtonSetting(); +BOOLEAN DoGioMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); +void DisplayMessageToUserAboutGameDifficulty(); +void ConfirmGioDifSettingMessageBoxCallBack( UINT8 bExitValue ); +BOOLEAN DisplayMessageToUserAboutIronManMode(); +BOOLEAN DisplayMessageToUserAboutOIVandNASincompatibility(); +void ConfirmGioIronManMessageBoxCallBack( UINT8 bExitValue ); + +BOOLEAN SpIniExists() +{ + BOOLEAN exists = TRUE; + + if(!getVFS()->fileExists(JA2SP_INI_FILENAME)) + exists = FALSE; + + return exists; +} + +UINT32 GameInitOptionsScreenInit( void ) +{ + memset( &gGameOptions, 0, sizeof( GAME_OPTIONS ) ); + + // WANNE: Read initial game settings from ja2_sp.ini + vfs::PropertyContainer props; + + if (SpIniExists()) + props.initFromIniFile(JA2SP_INI_FILENAME); + + // Difficulty Level (Default: Experienced = 1) + gGameOptions.ubDifficultyLevel = ((UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_DIFFICULTY_LEVEL, 1)) + 1; + + // Bobby Ray's Selection (Default: Great = 1) + UINT8 ubBobbyRay = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_BOBBY_RAY_SELECTION, 1); + switch (ubBobbyRay) + { + // Normal + case 0: + gGameOptions.ubBobbyRay = BR_GOOD; + break; + // Great + case 1: + gGameOptions.ubBobbyRay = BR_GREAT; + break; + // Excellent + case 2: + gGameOptions.ubBobbyRay = BR_EXCELLENT; + break; + // Awesome + case 3: + gGameOptions.ubBobbyRay = BR_AWESOME; + break; + } + + // Max. IMP Characters + UINT8 maxIMPCharacterCount = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_MAX_IMP_CHARACTERS, 1); + gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, maxIMPCharacterCount) )); + + // Progress Speed of Item Choices (Default: Normal) + gGameOptions.ubProgressSpeedOfItemsChoices = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_PROGRESS_SPEED_OF_ITEM_CHOICES, ITEM_PROGRESS_NORMAL); + + // Skill Traits + UINT8 ubTraitSystem = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SKILL_TRAITS, 0); + if (!gGameExternalOptions.fReadProfileDataFromXML) + ubTraitSystem = 0; + + gGameOptions.fNewTraitSystem = ubTraitSystem; + + // Inventory Attachments (Default: New/New = 2) + UINT8 ubInventoryAttachmentSystem = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_INVENTORY_ATTACHMENTS, 0); + + // NIV is not allowed + if (!IsNIVModeValid(true)) + ubInventoryAttachmentSystem = 0; + + switch (ubInventoryAttachmentSystem) + { + // Old / Old + case 0: + gGameOptions.ubInventorySystem = INVENTORY_OLD; + gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; + break; + // New / Old + case 1: + gGameOptions.ubInventorySystem = INVENTORY_NEW; + gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; + break; + // New / New + case 2: + gGameOptions.ubInventorySystem = INVENTORY_NEW; + gGameOptions.ubAttachmentSystem = ATTACHMENT_NEW; + break; + } + + // Game Style (Default: Realistic = 0) + gGameOptions.ubGameStyle = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_GAME_STYLE, STYLE_REALISTIC); + + // Enemies Drop All Items (Default: Off = 0) + gGameOptions.fEnemiesDropAllItems = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_ENEMIES_DROP_ALL_ITEMS, 0); + + // Extra Difficulty (Default: Save Anytime = 0) + gGameOptions.fIronManMode = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_EXTRA_DIFFICULTY, 0); + + + // Available Arsenal (Default: Tons of Guns = 1) + gGameOptions.fGunNut = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_AVAILABLE_ARSENAL, 1); + + // tex and john + gGameUBOptions.fTexAndJohn = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_UB_RPC_TEX_AND_JOHN, 0); + + // Random Manuel Text + gGameUBOptions.fRandomManuelText = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_UB_RANDOM_MANUEL_TEXT, 0); + + // Squad size (Default: 6) + UINT8 ubSquadSize = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SQUAD_SIZE, 6); + + if (iResolution == 0) + ubSquadSize = 6; + + gGameOptions.ubSquadSize = ubSquadSize; + + // Secret Weapon Caches (Default: Random = 0) + gGameOptions.fEnableAllWeaponCaches = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SECRET_WEAPON_CACHES, 0); + + gGameOptions.fAirStrikes = FALSE; + gGameOptions.fTurnTimeLimit = FALSE; + + return (1); +} + +UINT32 GameInitOptionsScreenHandle( void ) +{ + StartFrameBufferRender(); + + if( gfGIOScreenEntry ) + { + GameInitOptionsScreenInit(); + + EnterGIOScreen(); + gfGIOScreenEntry = FALSE; + gfGIOScreenExit = FALSE; + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + GetGIOScreenUserInput(); + + HandleGIOScreen(); + + // render buttons marked dirty + MarkButtonsDirty( ); + RenderButtons( ); + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + if ( HandleFadeOutCallback( ) ) + { + ClearMainMenu(); + return( gubGIOExitScreen ); + } + + if ( HandleBeginFadeOut( gubGIOExitScreen ) ) + { + return( gubGIOExitScreen ); + } + + if( gfGIOScreenExit ) + { + ExitGIOScreen(); + } + + if ( HandleFadeInCallback( ) ) + { + // Re-render the scene! + RenderGIOScreen(); + } + + if ( HandleBeginFadeIn( gubGIOExitScreen ) ) + { + } + + return( gubGIOExitScreen ); +} + + +UINT32 GameInitOptionsScreenShutdown( void ) +{ + return( 1 ); +} + + +BOOLEAN EnterGIOScreen() +{ + VOBJECT_DESC VObjectDesc, VObjectDesc2; + + if( gfGIOButtonsAllocated ) + return( TRUE ); + + SetCurrentCursorFromDatabase( CURSOR_NORMAL ); + + // load the Main trade screen backgroiund image + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + if (iResolution == 0) + { + FilenameForBPP("INTERFACE\\OptionsScreenBackGround.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 1) + { + FilenameForBPP("INTERFACE\\OptionsScreenBackGround_800x600.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 2) + { + FilenameForBPP("INTERFACE\\OptionsScreenBackGround_1024x768.sti", VObjectDesc.ImageFile); + } + + CHECKF(AddVideoObject(&VObjectDesc, &guiGIOMainBackGroundImage )); + + VObjectDesc2.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\GIOSmallFrame.sti", VObjectDesc2.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc2, &guiGIOSMALLFRAME)); + + //Ok button + giGIODoneBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 ); + guiGIODoneButton = CreateIconAndTextButton( giGIODoneBtnImage, gzGIOScreenText[GIO_START_TEXT], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + GIO_BTN_START_X, GIO_BTN_START_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIODoneCallback); + + SpecifyButtonSoundScheme( guiGIODoneButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyDisabledButtonStyle( guiGIODoneButton, DISABLED_STYLE_NONE ); + + //Cancel button + giGIOCancelBtnImage = UseLoadedButtonImage( giGIODoneBtnImage, -1,1,-1,3,-1 ); + guiGIOCancelButton = CreateIconAndTextButton( giGIOCancelBtnImage, gzGIOScreenText[GIO_CANCEL_TEXT], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + GIO_CANCEL_X, GIO_BTN_START_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOCancelCallback ); + SpecifyButtonSoundScheme( guiGIOCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // DIFFICULTY SETTING + + giGIODifficultyButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,0,-1,1,-1 ); + giGIODifficultyButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,2,-1,3,-1 ); + + // left button - decrement difficulty level + giGIODifficultyButton[ 0 ] = QuickCreateButton( giGIODifficultyButtonImage[ 0 ], GIO_DIF_SETTING_X + 39, GIO_DIF_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIODifficultySelectionLeftCallback ); + + // right button - increment difficulty level + giGIODifficultyButton[ 1 ] = QuickCreateButton( giGIODifficultyButtonImage[ 1 ], GIO_DIF_SETTING_X + 158, GIO_DIF_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIODifficultySelectionRightCallback ); + + // set user data + MSYS_SetBtnUserData(giGIODifficultyButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIODifficultyButton[1],0, 1 ); + + iCurrentDifficulty = max( 0, gGameOptions.ubDifficultyLevel - 1); + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // MAX IMP NUMBER SETTING + + giGIOIMPNumberButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ],-1,0,-1,1,-1 ); + giGIOIMPNumberButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ],-1,2,-1,3,-1 ); + + // left button - decrement difficulty level + giGIOIMPNumberButton[ 0 ] = QuickCreateButton( giGIOIMPNumberButtonImage[ 0 ], GIO_IMP_SETTING_X + 39, GIO_IMP_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOIMPNumberSelectionLeftCallback ); + + // right button - increment difficulty level + giGIOIMPNumberButton[ 1 ] = QuickCreateButton( giGIOIMPNumberButtonImage[ 1 ], GIO_IMP_SETTING_X + 158, GIO_IMP_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOIMPNumberSelectionRightCallback ); + + // set user data + MSYS_SetBtnUserData(giGIOIMPNumberButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIOIMPNumberButton[1],0, 1 ); + + iCurrentIMPNumberSetting = gGameOptions.ubMaxIMPCharacters; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // OLD/NEW TARITS SETTING + + guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ] = LoadButtonImage( "INTERFACE\\GIOCheckButton.sti" ,-1,0,-1,2,-1 ); + guiTraitsOptionToggles[ GIO_TRAITS_OLD ] = CreateIconAndTextButton( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], gzGIOScreenText[ GIO_TRAITS_OLD_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_TRAITS_SETTING_X + 74), (GIO_TRAITS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOOldTraitsCallback); + + guiTraitsOptionTogglesImage[ GIO_TRAITS_NEW ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiTraitsOptionToggles[ GIO_TRAITS_NEW ] = CreateIconAndTextButton( guiTraitsOptionTogglesImage[ GIO_TRAITS_NEW ], gzGIOScreenText[ GIO_TRAITS_NEW_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_TRAITS_SETTING_X), (GIO_TRAITS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIONewTraitsCallback ); + + SpecifyButtonSoundScheme( guiTraitsOptionToggles[ GIO_TRAITS_OLD ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyButtonSoundScheme( guiTraitsOptionToggles[ GIO_TRAITS_NEW ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + MSYS_SetBtnUserData(guiTraitsOptionToggles[ GIO_TRAITS_OLD ],0, 0 ); + MSYS_SetBtnUserData(guiTraitsOptionToggles[ GIO_TRAITS_NEW ],0, 1 ); + + if( gGameOptions.fNewTraitSystem ) + ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_NEW ] ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_OLD ] ]->uiFlags |= BUTTON_CLICKED_ON; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // GAME SETTING ( realistic, sci fi ) + + + guiGameTextTogglesImage[ GIO_TEXT_OFF ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiGameTextToggles[ GIO_TEXT_OFF ] = CreateIconAndTextButton( guiGameTextTogglesImage[ GIO_TEXT_OFF ], gzGIOScreenText[ GIO_REALISTIC_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_GAME_SETTING_X + 74), (GIO_GAME_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOOffStyleCallback); + + guiGameTextTogglesImage[ GIO_TEXT_ON ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiGameTextToggles[ GIO_TEXT_ON ] = CreateIconAndTextButton( guiGameTextTogglesImage[ GIO_TEXT_ON ], gzGIOScreenText[ GIO_SCI_FI_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOOnStyleCallback ); + + SpecifyButtonSoundScheme( guiGameTextToggles[ GIO_TEXT_OFF ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyButtonSoundScheme( guiGameTextToggles[ GIO_TEXT_ON ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + MSYS_SetBtnUserData(guiGameTextToggles[ GIO_TEXT_OFF ],0, 0 ); + MSYS_SetBtnUserData(guiGameTextToggles[ GIO_TEXT_ON ],0, 1 ); + + if( gGameUBOptions.fRandomManuelText ) + ButtonList[ guiGameTextToggles[ GIO_TEXT_ON ] ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiGameTextToggles[ GIO_TEXT_OFF ] ]->uiFlags |= BUTTON_CLICKED_ON; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // IRON MAN SETTING + + guiGameSaveTogglesImage[ GIO_CAN_SAVE ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiGameSaveToggles[ GIO_CAN_SAVE ] = CreateIconAndTextButton( guiGameSaveTogglesImage[ GIO_CAN_SAVE ], gzGIOScreenText[ GIO_SAVE_ANYWHERE_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_IRON_MAN_SETTING_X), (GIO_IRON_MAN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOIronManOffCallback); + + guiGameSaveTogglesImage[ GIO_IRON_MAN ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiGameSaveToggles[ GIO_IRON_MAN ] = CreateIconAndTextButton( guiGameSaveTogglesImage[ GIO_IRON_MAN ], gzGIOScreenText[ GIO_IRON_MAN_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_IRON_MAN_SETTING_X + 74), (GIO_IRON_MAN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOIronManOnCallback ); + + SpecifyButtonSoundScheme( guiGameSaveToggles[ GIO_CAN_SAVE ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyButtonSoundScheme( guiGameSaveToggles[ GIO_IRON_MAN ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + MSYS_SetBtnUserData(guiGameSaveToggles[ GIO_CAN_SAVE ],0, 0 ); + MSYS_SetBtnUserData(guiGameSaveToggles[ GIO_IRON_MAN ],0, 1 ); + + if( gGameOptions.fIronManMode ) + ButtonList[ guiGameSaveToggles[ GIO_IRON_MAN ] ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags |= BUTTON_CLICKED_ON; + + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // NUMBER OF TERRORISTS SETTING + + guiRpcOptionTogglesImage[ GIO_TEX_JOHN_RANDOM ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ] = CreateIconAndTextButton( guiRpcOptionTogglesImage[ GIO_TEX_JOHN_RANDOM ], gzGIOScreenText[ GIO_TERRORISTS_RANDOM_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIORpcRandomCallback); + + guiRpcOptionTogglesImage[ GIO_TEX_AND_JOHN ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiRpcOptionToggles[ GIO_TEX_AND_JOHN ] = CreateIconAndTextButton( guiRpcOptionTogglesImage[ GIO_TEX_AND_JOHN ], gzGIOScreenText[ GIO_TERRORISTS_ALL_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_TERRORISTS_SETTING_X + 74), (GIO_TERRORISTS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIORpcAllCallback ); + + SpecifyButtonSoundScheme( guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyButtonSoundScheme( guiRpcOptionToggles[ GIO_TEX_AND_JOHN ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + MSYS_SetBtnUserData(guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ],0, 0 ); + MSYS_SetBtnUserData(guiRpcOptionToggles[ GIO_TEX_AND_JOHN ],0, 1 ); + + if( gGameUBOptions.fTexAndJohn ) + ButtonList[ guiRpcOptionToggles[ GIO_TEX_AND_JOHN ] ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ] ]->uiFlags |= BUTTON_CLICKED_ON; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // BOBBY RAY SETTING + + giGIOBRSettingButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ], -1,0,-1,1,-1 ); + giGIOBRSettingButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ], -1,2,-1,3,-1 ); + + // left button - decrement BR level + giGIOBRSettingButton[ 0 ] = QuickCreateButton( giGIOBRSettingButtonImage[ 0 ], GIO_BR_SETTING_X + 39, GIO_BR_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOBRSettingLeftCallback ); + + // right button - increment BR level + giGIOBRSettingButton[ 1 ] = QuickCreateButton( giGIOBRSettingButtonImage[ 1 ], GIO_BR_SETTING_X + 158, GIO_BR_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOBRSettingRightCallback ); + + // set user data + MSYS_SetBtnUserData(giGIOBRSettingButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIOBRSettingButton[1],0, 1 ); + + // set initial value + switch ( gGameOptions.ubBobbyRay ) + { + case BR_GOOD: + iCurrentBRSetting = GIO_BR_GOOD; + break; + case BR_GREAT: + iCurrentBRSetting = GIO_BR_GREAT; + break; + case BR_EXCELLENT: + iCurrentBRSetting = GIO_BR_EXCELLENT; + break; + case BR_AWESOME: + iCurrentBRSetting = GIO_BR_AWESOME; + break; + default: + iCurrentBRSetting = GIO_BR_GOOD; // optimistically assume, we have selected the normal one + break; + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // ITEM PROGRESS SETTING + + giGIOProgressSettingButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ], -1,0,-1,1,-1 ); + giGIOProgressSettingButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ], -1,2,-1,3,-1 ); + + // left button - decrement BR level + giGIOProgressSettingButton[ 0 ] = QuickCreateButton( giGIOProgressSettingButtonImage[ 0 ], GIO_PROGRESS_SETTING_X + 39, GIO_PROGRESS_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOProgressSettingLeftCallback ); + + // right button - increment BR level + giGIOProgressSettingButton[ 1 ] = QuickCreateButton( giGIOProgressSettingButtonImage[ 1 ], GIO_PROGRESS_SETTING_X + 158, GIO_PROGRESS_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOProgressSettingRightCallback ); + + // set user data + MSYS_SetBtnUserData(giGIOProgressSettingButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIOProgressSettingButton[1],0, 1 ); + + // set initial value + iCurrentProgressSetting = gGameOptions.ubProgressSpeedOfItemsChoices; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // OLD/NEW INVENTORY SETTING + + if (IsNIVModeValid(true) == TRUE ) + { + giGIOInventorySettingButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ],-1,0,-1,1,-1 ); + giGIOInventorySettingButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ],-1,2,-1,3,-1 ); + + // left button - decrement difficulty level + giGIOInventorySettingButton[ 0 ] = QuickCreateButton( giGIOInventorySettingButtonImage[ 0 ], GIO_INV_SETTING_X + 39, GIO_INV_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOInventorySettingLeftCallback ); + + // right button - increment difficulty level + giGIOInventorySettingButton[ 1 ] = QuickCreateButton( giGIOInventorySettingButtonImage[ 1 ], GIO_INV_SETTING_X + 158, GIO_INV_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOInventorySettingRightCallback ); + + + // set user data + MSYS_SetBtnUserData(giGIOInventorySettingButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIOInventorySettingButton[1],0, 1 ); + + if (UsingNewInventorySystem()==true && + UsingNewAttachmentSystem()==true) + { + iCurrentInventorySetting = GIO_INV_NEW_NAS; + } + else + { + // set initial value + switch ( gGameOptions.ubInventorySystem ) + { + case INVENTORY_OLD: + iCurrentInventorySetting = GIO_INV_OLD; + break; + case INVENTORY_NEW: + iCurrentInventorySetting = GIO_INV_NEW; + break; + } + } + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // DROP ALL ON/OFF SETTING + + guiDropAllOptionTogglesImage[ GIO_DROPALL_OFF ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiDropAllOptionToggles[ GIO_DROPALL_OFF ] = CreateIconAndTextButton( guiDropAllOptionTogglesImage[ GIO_DROPALL_OFF ], gzGIOScreenText[ GIO_DROPALL_OFF_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_DROPALL_SETTING_X), (GIO_DROPALL_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIODropAllOffCallback); + + guiDropAllOptionTogglesImage[ GIO_DROPALL_ON ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiDropAllOptionToggles[ GIO_DROPALL_ON ] = CreateIconAndTextButton( guiDropAllOptionTogglesImage[ GIO_DROPALL_ON ], gzGIOScreenText[ GIO_DROPALL_ON_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_DROPALL_SETTING_X + 74), (GIO_DROPALL_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIODropAllOnCallback ); + + SpecifyButtonSoundScheme( guiDropAllOptionToggles[ GIO_DROPALL_OFF ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyButtonSoundScheme( guiDropAllOptionToggles[ GIO_DROPALL_ON ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + MSYS_SetBtnUserData(guiDropAllOptionToggles[ GIO_DROPALL_OFF ],0, 0 ); + MSYS_SetBtnUserData(guiDropAllOptionToggles[ GIO_DROPALL_ON ],0, 1 ); + + if( gGameOptions.fEnemiesDropAllItems ) + ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_ON ] ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_OFF ] ]->uiFlags |= BUTTON_CLICKED_ON; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // GUN SETTING + + guiGunOptionTogglesImage[ GIO_REDUCED_GUNS ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiGunOptionToggles[ GIO_REDUCED_GUNS ] = CreateIconAndTextButton( guiGunOptionTogglesImage[ GIO_REDUCED_GUNS ], gzGIOScreenText[ GIO_REDUCED_GUNS_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_GUN_SETTING_X + 74), (GIO_GUN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOGunSettingReducedCallback); + + guiGunOptionTogglesImage[ GIO_GUN_NUT ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); + guiGunOptionToggles[ GIO_GUN_NUT ] = CreateIconAndTextButton( guiGunOptionTogglesImage[ GIO_GUN_NUT ], gzGIOScreenText[ GIO_GUN_NUT_TEXT ], GIO_TOGGLE_TEXT_FONT, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, + (GIO_GUN_SETTING_X), (GIO_GUN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOGunSettingToGCallback ); + + SpecifyButtonSoundScheme( guiGunOptionToggles[ GIO_REDUCED_GUNS ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyButtonSoundScheme( guiGunOptionToggles[ GIO_GUN_NUT ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + MSYS_SetBtnUserData(guiGunOptionToggles[ GIO_REDUCED_GUNS ],0, 0 ); + MSYS_SetBtnUserData(guiGunOptionToggles[ GIO_GUN_NUT ],0, 1 ); + + if( gGameOptions.fGunNut ) + ButtonList[ guiGunOptionToggles[ GIO_GUN_NUT ] ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiGunOptionToggles[ GIO_REDUCED_GUNS ] ]->uiFlags |= BUTTON_CLICKED_ON; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // SQUAD SIZE + if (iResolution > 0) + { + giGIOSquadSizeButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,0,-1,1,-1 ); + giGIOSquadSizeButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,2,-1,3,-1 ); + + // left button - decrement difficulty level + giGIOSquadSizeButton[ 0 ] = QuickCreateButton( giGIOSquadSizeButtonImage[ 0 ], GIO_SQUAD_SIZE_SETTING_X + 39, GIO_SQUAD_SIZE_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOSquadSizeSelectionLeftCallback ); + + // right button - increment difficulty level + giGIOSquadSizeButton[ 1 ] = QuickCreateButton( giGIOSquadSizeButtonImage[ 1 ], GIO_SQUAD_SIZE_SETTING_X + 158, GIO_SQUAD_SIZE_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOSquadSizeSelectionRightCallback ); + + // set user data + MSYS_SetBtnUserData(giGIOSquadSizeButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIOSquadSizeButton[1],0, 1 ); + + switch (gGameOptions.ubSquadSize) + { + case 6: + iCurrentSquadSize = GIO_SQUAD_SIZE_6; + break; + case 8: + iCurrentSquadSize = GIO_SQUAD_SIZE_8; + break; + case 10: + iCurrentSquadSize = GIO_SQUAD_SIZE_10; + break; + } + } + + + //Reset the exit screen + gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; + + //REnder the screen once so we can blt ot to ths save buffer + RenderGIOScreen(); + + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + gfGIOButtonsAllocated = TRUE; + + return( TRUE ); +} + +void BtnGIODifficultySelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentDifficulty > 0 ) + { + PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentDifficulty--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentDifficulty > 0 ) + { + PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentDifficulty--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentDifficulty < 2 ) + { + PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentDifficulty++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentDifficulty < 2 ) + { + PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentDifficulty++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOBRSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentBRSetting > 0 ) + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentBRSetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentBRSetting > 0 ) + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentBRSetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOBRSettingRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentBRSetting < 3 ) + { + PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentBRSetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentBRSetting < 3 ) + { + PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentBRSetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOIMPNumberSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentIMPNumberSetting > 1 ) + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentIMPNumberSetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentIMPNumberSetting > 1 ) + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentIMPNumberSetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) + { + PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentIMPNumberSetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) + { + PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentIMPNumberSetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOInventorySettingLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentInventorySetting > GIO_INV_OLD ) + { + PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentInventorySetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentInventorySetting > GIO_INV_OLD ) + { + PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentInventorySetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOInventorySettingRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentInventorySetting < GIO_INV_NEW_NAS ) + { + PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentInventorySetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOInventorySettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentInventorySetting < GIO_INV_NEW_NAS ) + { + PlayButtonSound( giGIOInventorySettingButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentInventorySetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOInventorySettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOProgressSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentProgressSetting > 0 ) + { + PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentProgressSetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentProgressSetting > 0 ) + { + PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentProgressSetting--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOProgressSettingRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentProgressSetting < GIO_PROGRESS_VERY_FAST ) + { + PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentProgressSetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentProgressSetting < GIO_PROGRESS_VERY_FAST ) + { + PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentProgressSetting++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOOldTraitsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_TRAITS_SETTING_X), (GIO_TRAITS_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_NEW ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiTraitsOptionToggles[ GIO_TRAITS_OLD ], BUTTON_SOUND_CLICKED_ON ); + } +} +void BtnGIONewTraitsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if (!gGameExternalOptions.fReadProfileDataFromXML) + { + PlayButtonSound( guiTraitsOptionToggles[ GIO_TRAITS_NEW ], BUTTON_SOUND_DISABLED_CLICK ); + + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioNewTraitsImpossibleText[0], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_OK, NewTraitsNotPossibleMessageBoxCallBack ); + } + else + { + RestoreExternBackgroundRect( (GIO_TRAITS_SETTING_X), (GIO_TRAITS_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_OLD ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiTraitsOptionToggles[ GIO_TRAITS_NEW ], BUTTON_SOUND_CLICKED_ON ); + } + } +} + +void NewTraitsNotPossibleMessageBoxCallBack( UINT8 bExitValue ) +{ + /*if( bExitValue == MSG_BOX_RETURN_YES ) + { + gubGameOptionScreenHandler = GIO_NOTHING; + }*/ +} + +void BtnGIOOffStyleCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiGameTextToggles[ GIO_TEXT_ON ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiGameTextToggles[ GIO_TEXT_OFF ], BUTTON_SOUND_CLICKED_ON ); + } +} +void BtnGIOOnStyleCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiGameTextToggles[ GIO_TEXT_OFF ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiGameTextToggles[ GIO_TEXT_ON ], BUTTON_SOUND_CLICKED_ON ); + } +} + +void BtnGIOIronManOffCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_IRON_MAN_SETTING_X), (GIO_IRON_MAN_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiGameSaveToggles[ GIO_IRON_MAN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiGameStyleToggles[ GIO_CAN_SAVE ], BUTTON_SOUND_CLICKED_ON ); + } +} +void BtnGIOIronManOnCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_IRON_MAN_SETTING_X), (GIO_IRON_MAN_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiGameStyleToggles[ GIO_IRON_MAN ], BUTTON_SOUND_CLICKED_ON ); + } +} + +void BtnGIORpcRandomCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiRpcOptionToggles[ GIO_TEX_AND_JOHN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ], BUTTON_SOUND_CLICKED_ON ); + } +} +void BtnGIORpcAllCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiRpcOptionToggles[ GIO_TEX_AND_JOHN ], BUTTON_SOUND_CLICKED_ON ); + } +} + +void BtnGIODropAllOffCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_DROPALL_SETTING_X), (GIO_DROPALL_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_ON ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiDropAllOptionToggles[ GIO_DROPALL_OFF ], BUTTON_SOUND_CLICKED_ON ); + } +} +void BtnGIODropAllOnCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_DROPALL_SETTING_X), (GIO_DROPALL_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_OFF ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiDropAllOptionToggles[ GIO_DROPALL_ON ], BUTTON_SOUND_CLICKED_ON ); + } +} + +void BtnGIOGunSettingReducedCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_GUN_SETTING_X), (GIO_GUN_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiGunOptionToggles[ GIO_GUN_NUT ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiGunOptionToggles[ GIO_REDUCED_GUNS ], BUTTON_SOUND_CLICKED_ON ); + } +} +void BtnGIOGunSettingToGCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RestoreExternBackgroundRect( (GIO_GUN_SETTING_X), (GIO_GUN_SETTING_Y + 10), 230, 40 ); + + ButtonList[ guiGunOptionToggles[ GIO_REDUCED_GUNS ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + PlayButtonSound( guiGunOptionToggles[ GIO_GUN_NUT ], BUTTON_SOUND_CLICKED_ON ); + } +} + +void BtnGIOSquadSizeSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentSquadSize > GIO_SQUAD_SIZE_6 ) + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentSquadSize > GIO_SQUAD_SIZE_6 ) + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; + if (iResolution == 1) + maxSquadSize = GIO_SQUAD_SIZE_8; + + if ( iCurrentSquadSize < maxSquadSize ) + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; + if (iResolution == 1) + maxSquadSize = GIO_SQUAD_SIZE_8; + + if ( iCurrentSquadSize < maxSquadSize ) + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +BOOLEAN ExitGIOScreen() +{ + UINT16 cnt; + + if( !gfGIOButtonsAllocated ) + return( TRUE ); + + //Delete the main options screen background + DeleteVideoObjectFromIndex( guiGIOMainBackGroundImage ); + + DeleteVideoObjectFromIndex( guiGIOSMALLFRAME ); + + // Destroy Basic buttons + RemoveButton( guiGIOCancelButton ); + RemoveButton( guiGIODoneButton ); + UnloadButtonImage( giGIOCancelBtnImage ); + UnloadButtonImage( giGIODoneBtnImage ); + + // Destroy Difficulty setting buttons + RemoveButton( giGIODifficultyButton[0] ); + RemoveButton( giGIODifficultyButton[1] ); + UnloadButtonImage( giGIODifficultyButtonImage[0] ); + UnloadButtonImage( giGIODifficultyButtonImage[1] ); + + // Destroy IMP Number setting buttons + RemoveButton( giGIOIMPNumberButton[0] ); + RemoveButton( giGIOIMPNumberButton[1] ); + UnloadButtonImage( giGIOIMPNumberButtonImage[0] ); + UnloadButtonImage( giGIOIMPNumberButtonImage[1] ); + + // Destroy BR setting buttons + RemoveButton( giGIOBRSettingButton[0] ); + RemoveButton( giGIOBRSettingButton[1] ); + UnloadButtonImage( giGIOBRSettingButtonImage[0] ); + UnloadButtonImage( giGIOBRSettingButtonImage[1] ); + + // Destroy Progress setting buttons + RemoveButton( giGIOProgressSettingButton[0] ); + RemoveButton( giGIOProgressSettingButton[1] ); + UnloadButtonImage( giGIOProgressSettingButtonImage[0] ); + UnloadButtonImage( giGIOProgressSettingButtonImage[1] ); + + // Destroy Traits setting buttons + for( cnt=0; cnt 0) + { + RemoveButton( giGIOSquadSizeButton[0] ); + RemoveButton( giGIOSquadSizeButton[1] ); + UnloadButtonImage( giGIOSquadSizeButtonImage[0] ); + UnloadButtonImage( giGIOSquadSizeButtonImage[1] ); + } + + gfGIOButtonsAllocated = FALSE; + + //If we are starting the game stop playing the music + if( gubGameOptionScreenHandler == GIO_EXIT ) + SetMusicMode( MUSIC_NONE ); + + gfGIOScreenExit = FALSE; + gfGIOScreenEntry = TRUE; + + return( TRUE ); +} + + +void HandleGIOScreen() +{ + if( gubGameOptionScreenHandler != GIO_NOTHING ) + { + switch( gubGameOptionScreenHandler ) + { + case GIO_CANCEL: + gubGIOExitScreen = MAINMENU_SCREEN; + gfGIOScreenExit = TRUE; + break; + + case MP_LOAD: + gubGIOExitScreen = SAVE_LOAD_SCREEN; + gfSaveGame = FALSE; + gfGIOScreenExit = TRUE; + guiPreviousOptionScreen = GAME_INIT_OPTIONS_SCREEN; + break; + + case GIO_EXIT: + { + //if we are already fading out, get out of here + if( gFadeOutDoneCallback != DoneFadeOutForExitGameInitOptionScreen ) + { + //Disable the ok button + DisableButton( guiGIODoneButton ); + + gFadeOutDoneCallback = DoneFadeOutForExitGameInitOptionScreen; + + FadeOutNextFrame( ); + } + break; + } + + case GIO_IRON_MAN_MODE: + DisplayMessageToUserAboutGameDifficulty(); + break; + } + + gubGameOptionScreenHandler = GIO_NOTHING; + } + + + if( gfReRenderGIOScreen ) + { + RenderGIOScreen(); + gfReRenderGIOScreen = FALSE; + } +} + + +BOOLEAN RenderGIOScreen() +{ + HVOBJECT hPixHandle; + + RestoreExternBackgroundRect( GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_DIF_SETTING_Y-3, 120, 20 ); + RestoreExternBackgroundRect( GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_IMP_SETTING_Y-3, 120, 20 ); + RestoreExternBackgroundRect( GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_BR_SETTING_Y-3, 120, 20 ); + RestoreExternBackgroundRect( GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_PROGRESS_SETTING_Y-3, 120, 20 ); + RestoreExternBackgroundRect( GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_INV_SETTING_Y-3, 120, 20 ); + RestoreExternBackgroundRect( GIO_SQUAD_SIZE_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_SQUAD_SIZE_SETTING_Y-3, 120, 20 ); + + //Get the main background screen graphic and blt it + GetVideoObject(&hPixHandle, guiGIOMainBackGroundImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,0,0, VO_BLT_SRCTRANSPARENCY,NULL); + + //Shade the background + ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 ); + + //Display the title + DrawTextToScreen( gzGIOScreenText[ GIO_INITIAL_GAME_SETTINGS ], GIO_MAIN_TITLE_X, GIO_MAIN_TITLE_Y, GIO_MAIN_TITLE_WIDTH, GIO_TITLE_FONT, GIO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Dif Settings Title Text + RenderGIOSmallSelectionFrame( (GIO_DIF_SETTING_X + 36), (GIO_DIF_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_DIF_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_DIF_SETTING_Y+6), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentDifficulty + 9 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the IMP number Title Text + RenderGIOSmallSelectionFrame( (GIO_IMP_SETTING_X + 36), (GIO_IMP_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_IMP_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_IMP_NUMBER_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + if ( iCurrentIMPNumberSetting <= 6 ) + { + DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_IMP_SETTING_Y+6), GIO_IMP_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentIMPNumberSetting + 32 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else + { + CHAR16 sStartLevelString[16]; + swprintf(sStartLevelString, L"%i", iCurrentIMPNumberSetting ); + DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_IMP_SETTING_Y+6), GIO_IMP_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, sStartLevelString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + // Display BR Setting texts + RenderGIOSmallSelectionFrame( (GIO_BR_SETTING_X + 36), (GIO_BR_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_BR_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_BR_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_BR_QUALITY_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_BR_SETTING_Y+6), GIO_BR_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentBRSetting + 20 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + // Display Progress Setting texts + RenderGIOSmallSelectionFrame( (GIO_PROGRESS_SETTING_X + 36), (GIO_PROGRESS_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT - 6), (UINT16)(GIO_PROGRESS_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_PROGRESS_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_PROGRESS_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_PROGRESS_SETTING_Y+6), GIO_PROGRESS_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentProgressSetting + 49 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + // Old/new traits system + DisplayWrappedString( (GIO_TRAITS_SETTING_X - 6), (UINT16)(GIO_TRAITS_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_TRAITS_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_TRAITS_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Game Settings Title Text + DisplayWrappedString( (GIO_GAME_SETTING_X - 6), (UINT16)(GIO_GAME_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_GAME_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_GAME_STYLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + // JA2Gold: Display the iron man Settings Title Text + DisplayWrappedString( (GIO_IRON_MAN_SETTING_X - 6), (UINT16)(GIO_IRON_MAN_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_IRON_MAN_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_GAME_SAVE_STYLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Terrorists Settings Title Text + DisplayWrappedString( (GIO_TERRORISTS_SETTING_X - 6), (UINT16)(GIO_TERRORISTS_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_TERRORISTS_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_TERRORISTS_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + // Display Inventory Settings text + RenderGIOSmallSelectionFrame( (GIO_INV_SETTING_X + 36), (GIO_INV_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_INV_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_INV_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_INV_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_INV_SETTING_Y+5), GIO_INV_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentInventorySetting + 54 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Drop All Settings Title Text + DisplayWrappedString( (GIO_DROPALL_SETTING_X - 6), (UINT16)(GIO_DROPALL_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_DROPALL_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DROPALL_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Gun Settings Title Text + DisplayWrappedString( (GIO_GUN_SETTING_X - 6), (UINT16)(GIO_GUN_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_GUN_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Squad size Title Text + RenderGIOSmallSelectionFrame( (GIO_SQUAD_SIZE_SETTING_X + 36), (GIO_SQUAD_SIZE_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_SQUAD_SIZE_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_SQUAD_SIZE_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_SQUAD_SIZE_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_SQUAD_SIZE_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(GIO_SQUAD_SIZE_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_SQUAD_SIZE_SETTING_Y+6), GIO_SQUAD_SIZE_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentSquadSize + (GIO_SQUAD_SIZE_TITLE_TEXT + 1) ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + return( TRUE ); +} + + +void GetGIOScreenUserInput() +{ + InputAtom Event; + + while( DequeueEvent( &Event ) ) + { + if( Event.usEvent == KEY_DOWN ) + { + switch( Event.usParam ) + { + + case ESC: + //Exit out of the screen + gubGameOptionScreenHandler = GIO_CANCEL; + break; + +#ifdef JA2TESTVERSION + case 'r': + gfReRenderGIOScreen=TRUE; + break; + + case 'i': + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + break; +#endif + + case ENTER: + gubGameOptionScreenHandler = GIO_EXIT; + break; + } + } + } +} + + +void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //if the user doesnt have IRON MAN mode selected + if( !DisplayMessageToUserAboutIronManMode() ) + { + //Confirm the difficulty setting + DisplayMessageToUserAboutGameDifficulty(); + } + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + gubGameOptionScreenHandler = GIO_CANCEL; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void MPBtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + gubGameOptionScreenHandler = MP_LOAD; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +UINT8 GetCurrentTraitsOptionButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentTextStyleButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentGameSaveButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentTexAndJohnButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentDropAllButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentGunButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentTimedTurnsButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +void DoneFadeOutForExitGameInitOptionScreen( void ) +{ + // loop through and get the status of all the buttons + gGameOptions.fGunNut = GetCurrentGunButtonSetting(); + + gGameOptions.ubGameStyle = FALSE; + gGameUBOptions.fRandomManuelText = GetCurrentTextStyleButtonSetting(); + + gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS-1, ( max( 1, (iCurrentDifficulty + 1)) )); + + gGameOptions.fTurnTimeLimit = FALSE; + + // iron man + gGameOptions.fIronManMode = GetCurrentGameSaveButtonSetting(); + + switch ( iCurrentBRSetting ) + { + case GIO_BR_GOOD: + gGameOptions.ubBobbyRay = BR_GOOD; + break; + case GIO_BR_GREAT: + gGameOptions.ubBobbyRay = BR_GREAT; + break; + case GIO_BR_EXCELLENT: + gGameOptions.ubBobbyRay = BR_EXCELLENT; + break; + case GIO_BR_AWESOME: + gGameOptions.ubBobbyRay = BR_AWESOME; + break; + } + + // CHRISL: + if(IsNIVModeValid(true) == TRUE) + { + switch ( iCurrentInventorySetting) + { + case GIO_INV_OLD: + gGameOptions.ubInventorySystem = INVENTORY_OLD; + gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; + break; + case GIO_INV_NEW: + gGameOptions.ubInventorySystem = INVENTORY_NEW; + gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; + break; + case GIO_INV_NEW_NAS: + gGameOptions.ubInventorySystem = INVENTORY_NEW; + gGameOptions.ubAttachmentSystem = ATTACHMENT_NEW; + } + } + + // Squad size + switch (iCurrentSquadSize) + { + case GIO_SQUAD_SIZE_6: + gGameOptions.ubSquadSize = 6; + break; + case GIO_SQUAD_SIZE_8: + gGameOptions.ubSquadSize = 8; + break; + case GIO_SQUAD_SIZE_10: + gGameOptions.ubSquadSize = 10; + break; + } + + + // WANNE: Not needed + /*if (gGameOptions.ubSquadSize > 6) + gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs = gGameOptions.ubSquadSize;*/ + + // SANDRO - added following: + gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, iCurrentIMPNumberSetting) )); + gGameOptions.fNewTraitSystem = GetCurrentTraitsOptionButtonSetting(); + + gGameUBOptions.fTexAndJohn = GetCurrentTexAndJohnButtonSetting(); + + gGameOptions.fEnemiesDropAllItems = GetCurrentDropAllButtonSetting(); + gGameOptions.fEnableAllWeaponCaches = FALSE; + gGameOptions.ubProgressSpeedOfItemsChoices = min( GIO_PROGRESS_VERY_FAST, iCurrentProgressSetting ); + + gubGIOExitScreen = INIT_SCREEN; + + //set the fact that we should do the intro videos +// gbIntroScreenMode = INTRO_BEGINNING; +#ifdef JA2TESTVERSION + if( gfKeyState[ ALT ] ) + { + if( gfKeyState[ CTRL ] ) + { + gMercProfiles[ MIGUEL ].bMercStatus = MERC_IS_DEAD; + gMercProfiles[ SKYRIDER ].bMercStatus = MERC_IS_DEAD; + } + + SetIntroType( INTRO_ENDING ); + } + else +#endif + + ExitGIOScreen(); + + gFadeInDoneCallback = DoneFadeInForExitGameInitOptionScreen; + FadeInNextFrame( ); + + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); +} + +void DoneFadeInForExitGameInitOptionScreen( void ) +{ + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); +} + +BOOLEAN DoGioMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; + + // do message box and return + giGioMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + + // send back return state + return( ( giGioMessageBox != -1 ) ); +} + +void DisplayMessageToUserAboutGameDifficulty() +{ + UINT8 ubDiffLevel = iCurrentDifficulty; + + switch( ubDiffLevel ) + { + case 0: + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_NOVICE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); + break; + case 1: + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERIENCED], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); + break; + case 2: + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERT], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); + break; + case 3: + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_INSANE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); + break; + } +} + + +void ConfirmGioDifSettingMessageBoxCallBack( UINT8 bExitValue ) +{ + if( bExitValue == MSG_BOX_RETURN_YES ) + { + gubGameOptionScreenHandler = GIO_EXIT; + } +} + +BOOLEAN DisplayMessageToUserAboutIronManMode() +{ + // Madd + UINT8 ubIronManMode = GetCurrentGameSaveButtonSetting(); //FALSE; + + //if the user has selected IRON MAN mode + if( ubIronManMode ) + { + DoGioMessageBox( MSG_BOX_BASIC_STYLE, gzIronManModeWarningText[ IMM__IRON_MAN_MODE_WARNING_TEXT ], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioIronManMessageBoxCallBack ); + + return( TRUE ); + } + + return( FALSE ); +} + +void ConfirmGioIronManMessageBoxCallBack( UINT8 bExitValue ) +{ + if( bExitValue == MSG_BOX_RETURN_YES ) + { + gubGameOptionScreenHandler = GIO_IRON_MAN_MODE; + } + else + { + ButtonList[ guiGameSaveToggles[ GIO_IRON_MAN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiGIOSMALLFRAME); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, sX, sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +#else + +// ********************************* +// JA2 - 1.13: Initial Game Screen +// ********************************* + +////////////////////////////////////////////////////////////// +// SANDRO - the start-new-game screen has been changed a lot +////////////////////////////////////////////////////////////// + +//////////////////////////////////////////// +// +// Global Defines +// +/////////////////////////////////////////// + +#define GIO_TITLE_FONT FONT14ARIAL +#define GIO_TITLE_COLOR FONT_MCOLOR_WHITE + +#define GIO_TOGGLE_TEXT_FONT FONT10ARIAL +#define GIO_TOGGLE_TEXT_COLOR FONT_MCOLOR_WHITE + +//buttons +#define GIO_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2) + +#define GIO_BTN_START_X iScreenWidthOffset + 320 + 105 +#define GIO_BTN_START_Y iScreenHeightOffset + 435 + + +//main title +#define GIO_MAIN_TITLE_X 0 +#define GIO_MAIN_TITLE_Y iScreenHeightOffset + 10 +#define GIO_MAIN_TITLE_WIDTH SCREEN_WIDTH + +//radio box locations +#define GIO_GAP_BN_SETTINGS 35 +#define GIO_OFFSET_TO_TEXT 36 +#define GIO_OFFSET_TO_TOGGLE_BOX 180 +#define GIO_OFFSET_TO_TOGGLE_BOX_Y 9 + +#define GIO_TITLE_DISTANCE 30 // higher means closer + +#define GIO_OFFSET_TO_TEXT 36 +#define GIO_OFFSET_TO_TOGGLE_BOX 180 + +// --------------------------------- +// Y-Offset for Combo-Controls +#define COMBO_Y_OFFSET 63 +// Y-Offset for Check-Controls +#define CHECK_Y_OFFSET 50 + +#define CORRECTION_Y_OFFSET (COMBO_Y_OFFSET - CHECK_Y_OFFSET) + +// X-Offset for Checkbox-Controls +#define CHECK_X_OFFSET 36 +#define COMBO_X_OFFSET 0 + +#define CHECK_WIDTH (GIO_OFFSET_TO_TOGGLE_BOX - GIO_OFFSET_TO_TEXT) +#define COMBO_WIDTH (GIO_OFFSET_TO_TOGGLE_BOX - GIO_OFFSET_TO_TEXT) + + +/********************************* + FIRST COLUMN +**********************************/ + +#define FIRST_COLUMN_X iScreenWidthOffset + 10 +#define FIRST_COLUMN_Y iScreenHeightOffset + 75 + +#define GIO_DIF_SETTING_X FIRST_COLUMN_X + COMBO_X_OFFSET +#define GIO_DIF_SETTING_Y FIRST_COLUMN_Y +#define GIO_DIF_SETTING_WIDTH COMBO_WIDTH + +#define GIO_IMP_SETTING_X FIRST_COLUMN_X + COMBO_X_OFFSET +#define GIO_IMP_SETTING_Y GIO_DIF_SETTING_Y + COMBO_Y_OFFSET +#define GIO_IMP_SETTING_WIDTH COMBO_WIDTH + +#define GIO_TRAITS_SETTING_X FIRST_COLUMN_X + CHECK_X_OFFSET +#define GIO_TRAITS_SETTING_Y GIO_IMP_SETTING_Y + CHECK_Y_OFFSET +#define GIO_TRAITS_SETTING_WIDTH CHECK_WIDTH + +#define GIO_GAME_SETTING_X FIRST_COLUMN_X + CHECK_X_OFFSET +#define GIO_GAME_SETTING_Y GIO_TRAITS_SETTING_Y + CHECK_Y_OFFSET + CORRECTION_Y_OFFSET +#define GIO_GAME_SETTING_WIDTH CHECK_WIDTH + +#define GIO_IRON_MAN_SETTING_X FIRST_COLUMN_X + CHECK_X_OFFSET +#define GIO_IRON_MAN_SETTING_Y GIO_GAME_SETTING_Y + CHECK_Y_OFFSET + CORRECTION_Y_OFFSET +#define GIO_IRON_MAN_SETTING_WIDTH CHECK_WIDTH + +#define GIO_TERRORISTS_SETTING_X FIRST_COLUMN_X + CHECK_X_OFFSET +#define GIO_TERRORISTS_SETTING_Y GIO_IRON_MAN_SETTING_Y + CHECK_Y_OFFSET + CORRECTION_Y_OFFSET +#define GIO_TERRORISTS_SETTING_WIDTH CHECK_WIDTH + + +/********************************* + SECOND COLUMN +**********************************/ + +#define SECOND_COLUMN_X iScreenWidthOffset + 210 +#define SECOND_COLUMN_Y FIRST_COLUMN_Y + +#define GIO_BR_SETTING_X SECOND_COLUMN_X + COMBO_X_OFFSET +#define GIO_BR_SETTING_Y SECOND_COLUMN_Y +#define GIO_BR_SETTING_WIDTH COMBO_WIDTH + +#define GIO_PROGRESS_SETTING_X SECOND_COLUMN_X + COMBO_X_OFFSET +#define GIO_PROGRESS_SETTING_Y GIO_BR_SETTING_Y + COMBO_Y_OFFSET +#define GIO_PROGRESS_SETTING_WIDTH COMBO_WIDTH + +#define GIO_INV_SETTING_X SECOND_COLUMN_X + COMBO_X_OFFSET +#define GIO_INV_SETTING_Y GIO_PROGRESS_SETTING_Y + COMBO_Y_OFFSET +#define GIO_INV_SETTING_WIDTH COMBO_WIDTH + +#define GIO_DROPALL_SETTING_X SECOND_COLUMN_X + CHECK_X_OFFSET +#define GIO_DROPALL_SETTING_Y GIO_INV_SETTING_Y + CHECK_Y_OFFSET +#define GIO_DROPALL_SETTING_WIDTH CHECK_WIDTH + +#define GIO_GUN_SETTING_X SECOND_COLUMN_X + CHECK_X_OFFSET +#define GIO_GUN_SETTING_Y GIO_DROPALL_SETTING_Y + CHECK_Y_OFFSET + CORRECTION_Y_OFFSET +#define GIO_GUN_SETTING_WIDTH CHECK_WIDTH + +#define GIO_CACHES_SETTING_X SECOND_COLUMN_X + CHECK_X_OFFSET +#define GIO_CACHES_SETTING_Y GIO_GUN_SETTING_Y + CHECK_Y_OFFSET + CORRECTION_Y_OFFSET +#define GIO_CACHES_SETTING_WIDTH CHECK_WIDTH + +/********************************* + THIRD COLUMN +**********************************/ + +#define THIRD_COLUMN_X iScreenWidthOffset + 413 +#define THIRD_COLUMN_Y FIRST_COLUMN_Y + +#define GIO_SQUAD_SIZE_SETTING_X THIRD_COLUMN_X + COMBO_X_OFFSET +#define GIO_SQUAD_SIZE_SETTING_Y THIRD_COLUMN_Y +#define GIO_SQUAD_SIZE_SETTING_WIDTH COMBO_WIDTH + + + + + +// INI File +#define JA2SP_INI_FILENAME "ja2_sp.ini" + +// INI Section +#define JA2SP_INI_INITIAL_SECTION "JA2 Singleplayer Initial Settings" + +// INI Properties +#define JA2SP_DIFFICULTY_LEVEL "DIFFICULTY_LEVEL" +#define JA2SP_BOBBY_RAY_SELECTION "BOBBY_RAY_SELECTION" +#define JA2SP_MAX_IMP_CHARACTERS "MAX_IMP_CHARACTERS" +#define JA2SP_PROGRESS_SPEED_OF_ITEM_CHOICES "PROGRESS_SPEED_OF_ITEM_CHOICES" +#define JA2SP_SKILL_TRAITS "SKILL_TRAITS" +#define JA2SP_INVENTORY_ATTACHMENTS "INVENTORY_ATTACHMENTS" +#define JA2SP_GAME_STYLE "GAME_STYLE" +#define JA2SP_ENEMIES_DROP_ALL_ITEMS "ENEMIES_DROP_ALL_ITEMS" +#define JA2SP_EXTRA_DIFFICULTY "EXTRA_DIFFICULTY" +#define JA2SP_AVAILABLE_ARSENAL "AVAILABLE_ARSENAL" +#define JA2SP_NUMBER_OF_TERRORISTS "NUMBER_OF_TERRORISTS" +#define JA2SP_SECRET_WEAPON_CACHES "SECRET_WEAPON_CACHES" +#define JA2SP_SQUAD_SIZE "SQUAD_SIZE" //Difficulty settings @@ -222,6 +2677,15 @@ enum NUM_INV_OPTIONS, }; +enum +{ + GIO_SQUAD_SIZE_6, + GIO_SQUAD_SIZE_8, + GIO_SQUAD_SIZE_10, + + NUM_SQUAD_SIZE_OPTIONS, +}; + enum { GIO_DROPALL_OFF, @@ -292,6 +2756,7 @@ INT8 iCurrentBRSetting; INT8 iCurrentIMPNumberSetting; INT8 iCurrentProgressSetting; INT8 iCurrentInventorySetting; +INT8 iCurrentSquadSize; UINT32 guiGIOSMALLFRAME; @@ -375,6 +2840,12 @@ UINT32 guiWeaponCachesOptionToggles[ NUM_CACHES_OPTIONS ]; void BtnGIOWeaponCachesRandomCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOWeaponCachesAllCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 giGIOSquadSizeButton[ 2 ]; +INT32 giGIOSquadSizeButtonImage[ 2 ]; +void BtnGIOSquadSizeSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ); +void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ); + + UINT32 guiTimedTurnToggles[ GIO_NUM_TIMED_TURN_OPTIONS ]; void BtnTimedTurnsTogglesCallback(GUI_BUTTON *btn,INT32 reason); @@ -518,7 +2989,18 @@ UINT32 GameInitOptionsScreenInit( void ) // Secret Weapon Caches (Default: Random = 0) gGameOptions.fEnableAllWeaponCaches = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SECRET_WEAPON_CACHES, 0); + // Squad size (Default: 8) + UINT8 ubSquadSize = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SQUAD_SIZE, 8); + + if (iResolution == 0) + ubSquadSize = 6; + + gGameOptions.ubSquadSize = ubSquadSize; + + // Air strikes gGameOptions.fAirStrikes = FALSE; + + // Turn limit gGameOptions.fTurnTimeLimit = FALSE; return (1); @@ -994,6 +3476,41 @@ BOOLEAN EnterGIOScreen() ButtonList[ guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ] ]->uiFlags |= BUTTON_CLICKED_ON; + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // SQUAD SIZE + if (iResolution > 0) + { + giGIOSquadSizeButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,0,-1,1,-1 ); + giGIOSquadSizeButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,2,-1,3,-1 ); + + // left button - decrement difficulty level + giGIOSquadSizeButton[ 0 ] = QuickCreateButton( giGIOSquadSizeButtonImage[ 0 ], GIO_SQUAD_SIZE_SETTING_X + 39, GIO_SQUAD_SIZE_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOSquadSizeSelectionLeftCallback ); + + // right button - increment difficulty level + giGIOSquadSizeButton[ 1 ] = QuickCreateButton( giGIOSquadSizeButtonImage[ 1 ], GIO_SQUAD_SIZE_SETTING_X + 158, GIO_SQUAD_SIZE_SETTING_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOSquadSizeSelectionRightCallback ); + + // set user data + MSYS_SetBtnUserData(giGIOSquadSizeButton[0],0, 0 ); + MSYS_SetBtnUserData(giGIOSquadSizeButton[1],0, 1 ); + + switch (gGameOptions.ubSquadSize) + { + case 6: + iCurrentSquadSize = GIO_SQUAD_SIZE_6; + break; + case 8: + iCurrentSquadSize = GIO_SQUAD_SIZE_8; + break; + case 10: + iCurrentSquadSize = GIO_SQUAD_SIZE_10; + break; + } + } + //Reset the exit screen gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; @@ -1681,6 +4198,102 @@ void BtnGIOWeaponCachesAllCallback(GUI_BUTTON *btn,INT32 reason) } } +void BtnGIOSquadSizeSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if ( iCurrentSquadSize > GIO_SQUAD_SIZE_6 ) + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if ( iCurrentSquadSize > GIO_SQUAD_SIZE_6 ) + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize--; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[0], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; + if (iResolution == 1) + maxSquadSize = GIO_SQUAD_SIZE_8; + + if ( iCurrentSquadSize < maxSquadSize ) + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; + if (iResolution == 1) + maxSquadSize = GIO_SQUAD_SIZE_8; + + if ( iCurrentSquadSize < maxSquadSize ) + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_CLICKED_ON ); + + iCurrentSquadSize++; + gfReRenderGIOScreen =TRUE; + } + else + { + PlayButtonSound( giGIOSquadSizeButton[1], BUTTON_SOUND_DISABLED_CLICK ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + BOOLEAN ExitGIOScreen() { UINT16 cnt; @@ -1782,6 +4395,15 @@ BOOLEAN ExitGIOScreen() UnloadButtonImage( guiWeaponCachesOptionTogglesImage[ cnt ] ); } + // Destroy Squad size setting buttons + if (iResolution > 0) + { + RemoveButton( giGIOSquadSizeButton[0] ); + RemoveButton( giGIOSquadSizeButton[1] ); + UnloadButtonImage( giGIOSquadSizeButtonImage[0] ); + UnloadButtonImage( giGIOSquadSizeButtonImage[1] ); + } + gfGIOButtonsAllocated = FALSE; //If we are starting the game stop playing the music @@ -1852,9 +4474,9 @@ BOOLEAN RenderGIOScreen() RestoreExternBackgroundRect( GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_DIF_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_IMP_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_BR_SETTING_Y-3, 120, 20 ); - RestoreExternBackgroundRect( GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_PROGRESS_SETTING_Y-3, 120, 20 ); - + RestoreExternBackgroundRect( GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_PROGRESS_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_INV_SETTING_Y-3, 120, 20 ); + RestoreExternBackgroundRect( GIO_SQUAD_SIZE_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_SQUAD_SIZE_SETTING_Y-3, 120, 20 ); //Get the main background screen graphic and blt it GetVideoObject(&hPixHandle, guiGIOMainBackGroundImage ); @@ -1920,6 +4542,11 @@ BOOLEAN RenderGIOScreen() //Display the Weapon Caches Settings Title Text DisplayWrappedString( (GIO_CACHES_SETTING_X - 6), (UINT16)(GIO_CACHES_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_CACHES_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_CACHES_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + //Display the Squad size Title Text + RenderGIOSmallSelectionFrame( (GIO_SQUAD_SIZE_SETTING_X + 36), (GIO_SQUAD_SIZE_SETTING_Y - 3) ); + DisplayWrappedString( (UINT16)(GIO_SQUAD_SIZE_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_SQUAD_SIZE_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_SQUAD_SIZE_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_SQUAD_SIZE_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(GIO_SQUAD_SIZE_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_SQUAD_SIZE_SETTING_Y+6), GIO_SQUAD_SIZE_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentSquadSize + (GIO_SQUAD_SIZE_TITLE_TEXT + 1) ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + return( TRUE ); } @@ -2174,6 +4801,21 @@ void DoneFadeOutForExitGameInitOptionScreen( void ) } } + // Squad size + switch (iCurrentSquadSize) + { + case GIO_SQUAD_SIZE_6: + gGameOptions.ubSquadSize = 6; + break; + case GIO_SQUAD_SIZE_8: + gGameOptions.ubSquadSize = 8; + break; + case GIO_SQUAD_SIZE_10: + gGameOptions.ubSquadSize = 10; + break; + } + + // SANDRO - added following: gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, iCurrentIMPNumberSetting) )); gGameOptions.fNewTraitSystem = GetCurrentTraitsOptionButtonSetting(); @@ -2292,4 +4934,7 @@ void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY) BltVideoObject(FRAME_BUFFER, hHandle, 0, sX, sY , VO_BLT_SRCTRANSPARENCY,NULL); return; -} \ No newline at end of file +} + +#endif + diff --git a/GameSettings.cpp b/GameSettings.cpp index 2ec5900f..9730a535 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -49,8 +49,6 @@ #define GAME_SETTINGS_FILE "Ja2_Settings.INI" -#define GAME_INI_FILE "..\\Ja2.ini" - #define GAME_EXTERNAL_OPTIONS_FILE "Ja2_Options.ini" #define AP_BP_CONSTANTS_FILE "APBPConstants.ini" @@ -75,7 +73,6 @@ extern INT16 APBPConstants[TOTAL_APBP_VALUES]; void InitGameSettings(); - BOOLEAN GetCdromLocationFromIniFile( STR pRootOfCdromDrive ); extern BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation ); @@ -136,7 +133,7 @@ BOOLEAN LoadGameSettings() { CIniReader iniReader(GAME_SETTINGS_FILE, TRUE); // force path even for non existing files - gGameSettings.bLastSavedGameSlot = iniReader.ReadInteger("JA2 Game Settings","bLastSavedGameSlot" , -1 , -1 , NUM_SLOT ); + gGameSettings.bLastSavedGameSlot = iniReader.ReadInteger("JA2 Game Settings","bLastSavedGameSlot" , -1 , -1 , 255 ); gGameSettings.ubMusicVolumeSetting = iniReader.ReadInteger("JA2 Game Settings","ubMusicVolumeSetting" , MIDVOLUME , 0 , HIGHVOLUME ); gGameSettings.ubSoundEffectsVolume = iniReader.ReadInteger("JA2 Game Settings","ubSoundEffectsVolume" , MIDVOLUME , 0 , HIGHVOLUME ); gGameSettings.ubSpeechVolume = iniReader.ReadInteger("JA2 Game Settings","ubSpeechVolume" , MIDVOLUME , 0 , HIGHVOLUME ); @@ -296,137 +293,137 @@ BOOLEAN SaveGameSettings() { if (!is_networked) { - //Record the current settings into the game settins structure - gGameSettings.ubSoundEffectsVolume = (UINT8)GetSoundEffectsVolume( ); - gGameSettings.ubSpeechVolume = (UINT8)GetSpeechVolume( ); - gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( ); + //Record the current settings into the game settins structure + gGameSettings.ubSoundEffectsVolume = (UINT8)GetSoundEffectsVolume( ); + gGameSettings.ubSpeechVolume = (UINT8)GetSpeechVolume( ); + gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( ); - std::stringstream settings; - const char endl[] = "\r\n"; - settings << ";******************************************************************************************************************************" << endl; - settings << ";******************************************************************************************************************************" << endl; - settings << "; Jagged Alliance 2 --Settings File-- " << endl; - settings << "; " << endl; - settings << "; Please note that this file is automatically generated by the game. " << endl; - settings << "; " << endl; - settings << "; While it is safe to change things from within this file, not all values are acceptable. Some may break the game, " << endl; - settings << "; some may be ignored, but most likely they will be acceptable or reset to a default value. " << endl; - settings << "; " << endl; - settings << "; Please note, This file and its contents are in a beta phase. Expect changes, however they should be minimal and automated." << endl; - settings << "; " << endl; - settings << ";******************************************************************************************************************************" << endl; - settings << endl; - settings << ";******************************************************************************************************************************" << endl; - settings << endl; - settings << "; The Current Game Setting Struct is defined as : " << endl; - settings << ";" << endl; - settings << "; typedef struct" << endl; - settings << "; {" << endl; - settings << "; INT8 bLastSavedGameSlot; // The last saved game number goes in here" << endl; - settings << "; UINT8 ubMusicVolumeSetting; // Volume Setting" << endl; - settings << "; UINT8 ubSoundEffectsVolume; // Volume Setting" << endl; - settings << "; UINT8 ubSpeechVolume; // Volume Setting" << endl; - settings << "; UINT8 fOptions[ NUM_ALL_GAME_OPTIONS ]; // Toggle Options (Speech, Subtitles, Show Tree Tops, etc.. )" << endl; - settings << "; UINT32 uiMeanwhileScenesSeenFlags; // Bit Vector describing seen 'mean whiles..'" << endl; - settings << "; BOOLEAN fHideHelpInAllScreens; // Controls Help \"do not show help again\" checkbox" << endl; - //settings << "; UINT8 ubSizeOfDisplayCover; // The number of grids the player designates thru [Delete + ( = or - )]" << endl; - //settings << "; UINT8 ubSizeOfLOS; // The number of grids the player designates thru [End + ( = or - )]" << endl; - settings << "; } GAME_SETTINGS" << endl; - settings << ";" << endl; - settings << ";******************************************************************************************************************************" << endl; - settings << endl << endl; - settings << "[JA2 Game Settings]" << endl; + std::stringstream settings; + const char endl[] = "\r\n"; + settings << ";******************************************************************************************************************************" << endl; + settings << ";******************************************************************************************************************************" << endl; + settings << "; Jagged Alliance 2 --Settings File-- " << endl; + settings << "; " << endl; + settings << "; Please note that this file is automatically generated by the game. " << endl; + settings << "; " << endl; + settings << "; While it is safe to change things from within this file, not all values are acceptable. Some may break the game, " << endl; + settings << "; some may be ignored, but most likely they will be acceptable or reset to a default value. " << endl; + settings << "; " << endl; + settings << "; Please note, This file and its contents are in a beta phase. Expect changes, however they should be minimal and automated." << endl; + settings << "; " << endl; + settings << ";******************************************************************************************************************************" << endl; + settings << endl; + settings << ";******************************************************************************************************************************" << endl; + settings << endl; + settings << "; The Current Game Setting Struct is defined as : " << endl; + settings << ";" << endl; + settings << "; typedef struct" << endl; + settings << "; {" << endl; + settings << "; INT8 bLastSavedGameSlot; // The last saved game number goes in here" << endl; + settings << "; UINT8 ubMusicVolumeSetting; // Volume Setting" << endl; + settings << "; UINT8 ubSoundEffectsVolume; // Volume Setting" << endl; + settings << "; UINT8 ubSpeechVolume; // Volume Setting" << endl; + settings << "; UINT8 fOptions[ NUM_ALL_GAME_OPTIONS ]; // Toggle Options (Speech, Subtitles, Show Tree Tops, etc.. )" << endl; + settings << "; UINT32 uiMeanwhileScenesSeenFlags; // Bit Vector describing seen 'mean whiles..'" << endl; + settings << "; BOOLEAN fHideHelpInAllScreens; // Controls Help \"do not show help again\" checkbox" << endl; + //settings << "; UINT8 ubSizeOfDisplayCover; // The number of grids the player designates thru [Delete + ( = or - )]" << endl; + //settings << "; UINT8 ubSizeOfLOS; // The number of grids the player designates thru [End + ( = or - )]" << endl; + settings << "; } GAME_SETTINGS" << endl; + settings << ";" << endl; + settings << ";******************************************************************************************************************************" << endl; + settings << endl << endl; + settings << "[JA2 Game Settings]" << endl; - settings << "bLastSavedGameSlot = " << (int)gGameSettings.bLastSavedGameSlot << endl; - settings << "ubMusicVolumeSetting = " << (int)gGameSettings.ubMusicVolumeSetting << endl; - settings << "ubSoundEffectsVolume = " << (int)gGameSettings.ubSoundEffectsVolume << endl; - settings << "ubSpeechVolume = " << (int)gGameSettings.ubSpeechVolume << endl; - settings << "uiMeanwhileScenesSeenFlags = " << gGameSettings.uiMeanwhileScenesSeenFlags << endl; - settings << "fHideHelpInAllScreens = " << (gGameSettings.fHideHelpInAllScreens ? "TRUE" : "FALSE" ) << endl; - //settings << "ubSizeOfDisplayCover = " << (int)gGameSettings.ubSizeOfDisplayCover << endl; - //settings << "ubSizeOfLOS = " << (int)gGameSettings.ubSizeOfLOS << endl; - settings << "TOPTION_SPEECH = " << (gGameSettings.fOptions[TOPTION_SPEECH] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_MUTE_CONFIRMATIONS = " << (gGameSettings.fOptions[TOPTION_MUTE_CONFIRMATIONS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SUBTITLES = " << (gGameSettings.fOptions[TOPTION_SUBTITLES] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_KEY_ADVANCE_SPEECH = " << (gGameSettings.fOptions[TOPTION_KEY_ADVANCE_SPEECH] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ANIMATE_SMOKE = " << (gGameSettings.fOptions[TOPTION_ANIMATE_SMOKE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_BLOOD_N_GORE = " << (gGameSettings.fOptions[TOPTION_BLOOD_N_GORE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_DONT_MOVE_MOUSE = " << (gGameSettings.fOptions[TOPTION_DONT_MOVE_MOUSE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_OLD_SELECTION_METHOD = " << (gGameSettings.fOptions[TOPTION_OLD_SELECTION_METHOD] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ALWAYS_SHOW_MOVEMENT_PATH = " << (gGameSettings.fOptions[TOPTION_ALWAYS_SHOW_MOVEMENT_PATH] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SHOW_MISSES = " << (gGameSettings.fOptions[TOPTION_SHOW_MISSES] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_RTCONFIRM = " << (gGameSettings.fOptions[TOPTION_RTCONFIRM] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SLEEPWAKE_NOTIFICATION = " << (gGameSettings.fOptions[TOPTION_SLEEPWAKE_NOTIFICATION] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_USE_METRIC_SYSTEM = " << (gGameSettings.fOptions[TOPTION_USE_METRIC_SYSTEM] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_MERC_ALWAYS_LIGHT_UP = " << (gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SMART_CURSOR = " << (gGameSettings.fOptions[TOPTION_SMART_CURSOR] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SNAP_CURSOR_TO_DOOR = " << (gGameSettings.fOptions[TOPTION_SNAP_CURSOR_TO_DOOR] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_GLOW_ITEMS = " << (gGameSettings.fOptions[TOPTION_GLOW_ITEMS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_TOGGLE_TREE_TOPS = " << (gGameSettings.fOptions[TOPTION_TOGGLE_TREE_TOPS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_TOGGLE_WIREFRAME = " << (gGameSettings.fOptions[TOPTION_TOGGLE_WIREFRAME] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_3D_CURSOR = " << (gGameSettings.fOptions[TOPTION_3D_CURSOR] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_CTH_CURSOR = " << (gGameSettings.fOptions[TOPTION_CTH_CURSOR] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_GL_BURST_CURSOR = " << (gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ALLOW_TAUNTS = " << (gGameSettings.fOptions[TOPTION_ALLOW_TAUNTS] ? "TRUE" : "FALSE" ) << endl; // changed from drop all - SANDRO - settings << "TOPTION_GL_HIGH_ANGLE = " << (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ALLOW_REAL_TIME_SNEAK = " << (gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] ? "TRUE" : "FALSE" ) << endl; // changed from restrict aim levels - SANDRO - settings << "TOPTION_SPACE_SELECTS_NEXT_SQUAD = " << (gGameSettings.fOptions[TOPTION_SPACE_SELECTS_NEXT_SQUAD] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SHOW_ITEM_SHADOW = " << (gGameSettings.fOptions[TOPTION_SHOW_ITEM_SHADOW] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SHOW_WEAPON_RANGE_IN_TILES = " << (gGameSettings.fOptions[TOPTION_SHOW_WEAPON_RANGE_IN_TILES] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_TRACERS_FOR_SINGLE_FIRE = " << (gGameSettings.fOptions[TOPTION_TRACERS_FOR_SINGLE_FIRE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_RAIN_SOUND = " << (gGameSettings.fOptions[TOPTION_RAIN_SOUND] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ALLOW_CROWS = " << (gGameSettings.fOptions[TOPTION_ALLOW_CROWS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ALLOW_SOLDIER_TOOLTIPS = " << (gGameSettings.fOptions[TOPTION_ALLOW_SOLDIER_TOOLTIPS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_USE_AUTO_SAVE = " << (gGameSettings.fOptions[TOPTION_USE_AUTO_SAVE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SILENT_SKYRIDER = " << (gGameSettings.fOptions[TOPTION_SILENT_SKYRIDER] ? "TRUE" : "FALSE" ) << endl; - //settings << "TOPTION_LOW_CPU_USAGE = " << (gGameSettings.fOptions[TOPTION_LOW_CPU_USAGE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_ENHANCED_DESC_BOX = " << (gGameSettings.fOptions[TOPTION_ENHANCED_DESC_BOX] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_TOGGLE_TURN_MODE = " << (gGameSettings.fOptions[TOPTION_TOGGLE_TURN_MODE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_STAT_PROGRESS_BARS = " << (gGameSettings.fOptions[TOPTION_STAT_PROGRESS_BARS] ? "TRUE" : "FALSE" ) << endl; // HEADROCK HAM 3.6: Progress Bars - settings << "TOPTION_ALT_MAP_COLOR = " << (gGameSettings.fOptions[TOPTION_ALT_MAP_COLOR] ? "TRUE" : "FALSE" ) << endl; // HEADROCK HAM 4: Alt Map Colors - settings << "TOPTION_ALTERNATE_BULLET_GRAPHICS = " << (gGameSettings.fOptions[TOPTION_ALTERNATE_BULLET_GRAPHICS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_USE_NCTH = " << (gGameSettings.fOptions[TOPTION_USE_NCTH] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SHOW_TACTICAL_FACE_GEAR = " << (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_GEAR] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_SHOW_TACTICAL_FACE_ICONS = " << (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_ICONS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_DISABLE_CURSOR_SWAP = " << (gGameSettings.fOptions[TOPTION_DISABLE_CURSOR_SWAP] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_CHEAT_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_FORCE_BOBBY_RAY_SHIPMENTS = " << (gGameSettings.fOptions[TOPTION_FORCE_BOBBY_RAY_SHIPMENTS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_CHEAT_MODE_OPTIONS_END = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_DEBUG_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_REPORT_MISS_MARGIN = " << (gGameSettings.fOptions[TOPTION_REPORT_MISS_MARGIN] ? "TRUE" : "FALSE" ) << endl; // HEADROCK HAM 4: Shot offset report - settings << "TOPTION_SHOW_RESET_ALL_OPTIONS = " << (gGameSettings.fOptions[TOPTION_SHOW_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_RESET_ALL_OPTIONS = " << (gGameSettings.fOptions[TOPTION_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE = " << (gGameSettings.fOptions[TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_RENDER_MOUSE_REGIONS = " << (gGameSettings.fOptions[TOPTION_RENDER_MOUSE_REGIONS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_DEBUG_MODE_OPTIONS_END = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) << endl; - settings << ";******************************************************************************************************************************" << endl; - settings << "; Options beyond this point are Code derived options, DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOUR ARE DOING." << endl; - settings << "; They are only included here for complete transparency for all GameSettings content. " << endl; - settings << ";******************************************************************************************************************************" << endl; - settings << "TOPTION_LAST_OPTION = " << (gGameSettings.fOptions[TOPTION_LAST_OPTION] ? "TRUE" : "FALSE" ) << endl; - settings << "NUM_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_MERC_CASTS_LIGHT = " << (gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_HIDE_BULLETS = " << (gGameSettings.fOptions[TOPTION_HIDE_BULLETS] ? "TRUE" : "FALSE" ) << endl; - settings << "TOPTION_TRACKING_MODE = " << (gGameSettings.fOptions[TOPTION_TRACKING_MODE] ? "TRUE" : "FALSE" ) << endl; - settings << "NUM_ALL_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_ALL_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl; + settings << "bLastSavedGameSlot = " << (int)gGameSettings.bLastSavedGameSlot << endl; + settings << "ubMusicVolumeSetting = " << (int)gGameSettings.ubMusicVolumeSetting << endl; + settings << "ubSoundEffectsVolume = " << (int)gGameSettings.ubSoundEffectsVolume << endl; + settings << "ubSpeechVolume = " << (int)gGameSettings.ubSpeechVolume << endl; + settings << "uiMeanwhileScenesSeenFlags = " << gGameSettings.uiMeanwhileScenesSeenFlags << endl; + settings << "fHideHelpInAllScreens = " << (gGameSettings.fHideHelpInAllScreens ? "TRUE" : "FALSE" ) << endl; + //settings << "ubSizeOfDisplayCover = " << (int)gGameSettings.ubSizeOfDisplayCover << endl; + //settings << "ubSizeOfLOS = " << (int)gGameSettings.ubSizeOfLOS << endl; + settings << "TOPTION_SPEECH = " << (gGameSettings.fOptions[TOPTION_SPEECH] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_MUTE_CONFIRMATIONS = " << (gGameSettings.fOptions[TOPTION_MUTE_CONFIRMATIONS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SUBTITLES = " << (gGameSettings.fOptions[TOPTION_SUBTITLES] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_KEY_ADVANCE_SPEECH = " << (gGameSettings.fOptions[TOPTION_KEY_ADVANCE_SPEECH] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ANIMATE_SMOKE = " << (gGameSettings.fOptions[TOPTION_ANIMATE_SMOKE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_BLOOD_N_GORE = " << (gGameSettings.fOptions[TOPTION_BLOOD_N_GORE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_DONT_MOVE_MOUSE = " << (gGameSettings.fOptions[TOPTION_DONT_MOVE_MOUSE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_OLD_SELECTION_METHOD = " << (gGameSettings.fOptions[TOPTION_OLD_SELECTION_METHOD] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ALWAYS_SHOW_MOVEMENT_PATH = " << (gGameSettings.fOptions[TOPTION_ALWAYS_SHOW_MOVEMENT_PATH] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SHOW_MISSES = " << (gGameSettings.fOptions[TOPTION_SHOW_MISSES] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_RTCONFIRM = " << (gGameSettings.fOptions[TOPTION_RTCONFIRM] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SLEEPWAKE_NOTIFICATION = " << (gGameSettings.fOptions[TOPTION_SLEEPWAKE_NOTIFICATION] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_USE_METRIC_SYSTEM = " << (gGameSettings.fOptions[TOPTION_USE_METRIC_SYSTEM] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_MERC_ALWAYS_LIGHT_UP = " << (gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SMART_CURSOR = " << (gGameSettings.fOptions[TOPTION_SMART_CURSOR] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SNAP_CURSOR_TO_DOOR = " << (gGameSettings.fOptions[TOPTION_SNAP_CURSOR_TO_DOOR] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_GLOW_ITEMS = " << (gGameSettings.fOptions[TOPTION_GLOW_ITEMS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_TOGGLE_TREE_TOPS = " << (gGameSettings.fOptions[TOPTION_TOGGLE_TREE_TOPS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_TOGGLE_WIREFRAME = " << (gGameSettings.fOptions[TOPTION_TOGGLE_WIREFRAME] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_3D_CURSOR = " << (gGameSettings.fOptions[TOPTION_3D_CURSOR] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_CTH_CURSOR = " << (gGameSettings.fOptions[TOPTION_CTH_CURSOR] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_GL_BURST_CURSOR = " << (gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ALLOW_TAUNTS = " << (gGameSettings.fOptions[TOPTION_ALLOW_TAUNTS] ? "TRUE" : "FALSE" ) << endl; // changed from drop all - SANDRO + settings << "TOPTION_GL_HIGH_ANGLE = " << (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ALLOW_REAL_TIME_SNEAK = " << (gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] ? "TRUE" : "FALSE" ) << endl; // changed from restrict aim levels - SANDRO + settings << "TOPTION_SPACE_SELECTS_NEXT_SQUAD = " << (gGameSettings.fOptions[TOPTION_SPACE_SELECTS_NEXT_SQUAD] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SHOW_ITEM_SHADOW = " << (gGameSettings.fOptions[TOPTION_SHOW_ITEM_SHADOW] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SHOW_WEAPON_RANGE_IN_TILES = " << (gGameSettings.fOptions[TOPTION_SHOW_WEAPON_RANGE_IN_TILES] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_TRACERS_FOR_SINGLE_FIRE = " << (gGameSettings.fOptions[TOPTION_TRACERS_FOR_SINGLE_FIRE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_RAIN_SOUND = " << (gGameSettings.fOptions[TOPTION_RAIN_SOUND] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ALLOW_CROWS = " << (gGameSettings.fOptions[TOPTION_ALLOW_CROWS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ALLOW_SOLDIER_TOOLTIPS = " << (gGameSettings.fOptions[TOPTION_ALLOW_SOLDIER_TOOLTIPS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_USE_AUTO_SAVE = " << (gGameSettings.fOptions[TOPTION_USE_AUTO_SAVE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SILENT_SKYRIDER = " << (gGameSettings.fOptions[TOPTION_SILENT_SKYRIDER] ? "TRUE" : "FALSE" ) << endl; + //settings << "TOPTION_LOW_CPU_USAGE = " << (gGameSettings.fOptions[TOPTION_LOW_CPU_USAGE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_ENHANCED_DESC_BOX = " << (gGameSettings.fOptions[TOPTION_ENHANCED_DESC_BOX] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_TOGGLE_TURN_MODE = " << (gGameSettings.fOptions[TOPTION_TOGGLE_TURN_MODE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_STAT_PROGRESS_BARS = " << (gGameSettings.fOptions[TOPTION_STAT_PROGRESS_BARS] ? "TRUE" : "FALSE" ) << endl; // HEADROCK HAM 3.6: Progress Bars + settings << "TOPTION_ALT_MAP_COLOR = " << (gGameSettings.fOptions[TOPTION_ALT_MAP_COLOR] ? "TRUE" : "FALSE" ) << endl; // HEADROCK HAM 4: Alt Map Colors + settings << "TOPTION_ALTERNATE_BULLET_GRAPHICS = " << (gGameSettings.fOptions[TOPTION_ALTERNATE_BULLET_GRAPHICS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_USE_NCTH = " << (gGameSettings.fOptions[TOPTION_USE_NCTH] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SHOW_TACTICAL_FACE_GEAR = " << (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_GEAR] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_SHOW_TACTICAL_FACE_ICONS = " << (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_ICONS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_DISABLE_CURSOR_SWAP = " << (gGameSettings.fOptions[TOPTION_DISABLE_CURSOR_SWAP] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_CHEAT_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_FORCE_BOBBY_RAY_SHIPMENTS = " << (gGameSettings.fOptions[TOPTION_FORCE_BOBBY_RAY_SHIPMENTS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_CHEAT_MODE_OPTIONS_END = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_DEBUG_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_REPORT_MISS_MARGIN = " << (gGameSettings.fOptions[TOPTION_REPORT_MISS_MARGIN] ? "TRUE" : "FALSE" ) << endl; // HEADROCK HAM 4: Shot offset report + settings << "TOPTION_SHOW_RESET_ALL_OPTIONS = " << (gGameSettings.fOptions[TOPTION_SHOW_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_RESET_ALL_OPTIONS = " << (gGameSettings.fOptions[TOPTION_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE = " << (gGameSettings.fOptions[TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_RENDER_MOUSE_REGIONS = " << (gGameSettings.fOptions[TOPTION_RENDER_MOUSE_REGIONS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_DEBUG_MODE_OPTIONS_END = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) << endl; + settings << ";******************************************************************************************************************************" << endl; + settings << "; Options beyond this point are Code derived options, DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOUR ARE DOING." << endl; + settings << "; They are only included here for complete transparency for all GameSettings content. " << endl; + settings << ";******************************************************************************************************************************" << endl; + settings << "TOPTION_LAST_OPTION = " << (gGameSettings.fOptions[TOPTION_LAST_OPTION] ? "TRUE" : "FALSE" ) << endl; + settings << "NUM_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_MERC_CASTS_LIGHT = " << (gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_HIDE_BULLETS = " << (gGameSettings.fOptions[TOPTION_HIDE_BULLETS] ? "TRUE" : "FALSE" ) << endl; + settings << "TOPTION_TRACKING_MODE = " << (gGameSettings.fOptions[TOPTION_TRACKING_MODE] ? "TRUE" : "FALSE" ) << endl; + settings << "NUM_ALL_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_ALL_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl; - try + try + { + vfs::COpenWriteFile wfile(GAME_SETTINGS_FILE,true,true); + wfile->write(settings.str().c_str(), settings.str().length()); + } + catch(vfs::Exception& ex) + { + SGP_WARNING(ex.what()); + vfs::CFile file(GAME_SETTINGS_FILE); + if(file.openWrite(true,true)) { - vfs::COpenWriteFile wfile(GAME_SETTINGS_FILE,true,true); - wfile->write(settings.str().c_str(), settings.str().length()); - } - catch(vfs::Exception& ex) - { - SGP_WARNING(ex.what()); - vfs::CFile file(GAME_SETTINGS_FILE); - if(file.openWrite(true,true)) - { - vfs::COpenWriteFile wfile( vfs::tWritableFile::cast(&file)); - SGP_TRYCATCH_RETHROW(file.write(settings.str().c_str(), settings.str().length()),L""); - } + vfs::COpenWriteFile wfile( vfs::tWritableFile::cast(&file)); + SGP_TRYCATCH_RETHROW(file.write(settings.str().c_str(), settings.str().length()),L""); } } + } return( TRUE ); } @@ -900,16 +897,17 @@ void LoadGameExternalOptions() break; } - // WANNE: Moved to options screen - //legion by Jazz - /*gGameExternalOptions.fShowTacticalFaceGear = iniReader.ReadBoolean("Tactical Interface Settings","SHOW_TACTICAL_FACE_GEAR",FALSE); - gGameExternalOptions.fShowTacticalFaceIcons = iniReader.ReadBoolean("Tactical Interface Settings","SHOW_TACTICAL_FACE_ICONS",FALSE);*/ - gGameExternalOptions.bTacticalFaceIconStyle = iniReader.ReadInteger("Tactical Interface Settings","TACTICAL_FACE_ICON_STYLE", 0, 0, 3); // Camo portraits by Jazz gGameExternalOptions.fShowCamouflageFaces = iniReader.ReadBoolean("Tactical Interface Settings","SHOW_CAMOUFLAGE_FACES", FALSE); + // WANNE: Hide the health text when hovering over a enemy + gGameExternalOptions.fHideEnemyHealthText = iniReader.ReadBoolean("Tactical Interface Settings","HIDE_ENEMY_HEALTH_TEXT", FALSE); + + // WANNE: Hide the hit count when enemy gets hit + gGameExternalOptions.ubEnemyHitCount = iniReader.ReadInteger("Tactical Interface Settings","ENEMY_HIT_COUNT", 0, 0, 2); + //################# Tactical Difficulty Settings ################# // Enemy AP settings @@ -1037,6 +1035,8 @@ void LoadGameExternalOptions() //################# Tactical Gameplay Settings ################## + gGameExternalOptions.fAllowWalkingWithWeaponRaised = iniReader.ReadBoolean("Tactical Gameplay Settings","ALLOW_WALKING_WITH_WEAPON_RAISED", TRUE); + // WANNE: Externalized grid number of new merc when they arrive with the helicopter (by Jazz) gGameExternalOptions.iInitialMercArrivalLocation = iniReader.ReadInteger("Tactical Gameplay Settings","INITIAL_MERC_ARRIVAL_LOCATION", 4870 ); @@ -1134,7 +1134,7 @@ void LoadGameExternalOptions() gGameExternalOptions.bAimedBurstEnabled = iniReader.ReadBoolean("Tactical Interface Settings","USE_AIMED_BURST",FALSE); // Penalcy for aimed burst - gGameExternalOptions.uAimedBurstPenalty = iniReader.ReadInteger("Tactical Interface Settings","AIMING_BURST_PENALTY",2); + gGameExternalOptions.uAimedBurstPenalty = iniReader.ReadInteger("Tactical Interface Settings","AIMING_BURST_PENALTY",2, 0, 10); // We could see all what can see militia gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa = iniReader.ReadBoolean("Tactical Interface Settings","WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA",TRUE); @@ -1168,7 +1168,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fCamoRemoving = iniReader.ReadBoolean("Tactical Gameplay Settings", "CAMO_REMOVING", TRUE); // SANDRO - Enhanced close combat system - gGameExternalOptions.fEnhancedCloseCombatSystem = iniReader.ReadBoolean("Tactical Gameplay Settings", "ENHANCED_CLOSE_COMBAT_SYSTEM", FALSE); + gGameExternalOptions.fEnhancedCloseCombatSystem = iniReader.ReadBoolean("Tactical Gameplay Settings", "ENHANCED_CLOSE_COMBAT_SYSTEM", TRUE); // SANDRO - give special Exp for completing quests gGameExternalOptions.usAwardSpecialExpForQuests = iniReader.ReadInteger("Tactical Gameplay Settings", "AWARD_SPECIAL_EXP_POINTS_FOR_COMPLETING_QUESTS", 100, 0, 5000); @@ -1176,6 +1176,14 @@ void LoadGameExternalOptions() //tais: soldiers always wear any armour.. gGameExternalOptions.fSoldiersWearAnyArmour = iniReader.ReadBoolean("Tactical Gameplay Settings", "SOLDIERS_ALWAYS_WEAR_ANY_ARMOR", FALSE); + // improved Interrupt System (info: multiplayer game ALWAYS use the old interrupt system, because the new one causes crashes, no problem so far) + gGameExternalOptions.fImprovedInterruptSystem = iniReader.ReadBoolean("Tactical Gameplay Settings", "IMPROVED_INTERRUPT_SYSTEM", TRUE); + gGameExternalOptions.ubBasicPercentRegisterValueIIS = iniReader.ReadInteger("Tactical Gameplay Settings", "BASIC_PERCENTAGE_APS_REGISTERED", 60, 0, 250); + gGameExternalOptions.ubPercentRegisterValuePerLevelIIS = iniReader.ReadInteger("Tactical Gameplay Settings", "PERCENTAGE_APS_REGISTERED_PER_EXP_LEVEL", 4, 0, 100); + gGameExternalOptions.ubBasicReactionTimeLengthIIS = iniReader.ReadInteger("Tactical Gameplay Settings", "BASIC_REACTION_TIME_LENGTH", 25, 5, 100); + gGameExternalOptions.fAllowCollectiveInterrupts = iniReader.ReadBoolean("Tactical Gameplay Settings", "ALLOW_COLLECTIVE_INTERRUPTS", TRUE); + gGameExternalOptions.fAllowInstantInterruptsOnSight = iniReader.ReadBoolean("Tactical Gameplay Settings", "ALLOW_INSTANT_INTERRUPTS_ON_SPOTTING", FALSE); + //################# Tactical Cover System Settings ################## // CPT: Cover System Settings @@ -1394,11 +1402,12 @@ void LoadGameExternalOptions() //################# Laptop Settings ################## + gGameExternalOptions.gBriefingRoom = iniReader.ReadBoolean("Laptop Settings", "BRIEFING_ROOM", FALSE); + gGameExternalOptions.gEncyclopedia = iniReader.ReadBoolean("Laptop Settings", "ENCYCLOPEDIA", FALSE); gGameExternalOptions.fDisableLaptopTransition = iniReader.ReadBoolean("Laptop Settings", "DISABLE_LAPTOP_TRANSITION", FALSE); gGameExternalOptions.fFastWWWSitesLoading = iniReader.ReadBoolean("Laptop Settings", "FAST_WWW_SITES_LOADING", FALSE); - //################# Bobby Ray Settings ################## @@ -1676,7 +1685,8 @@ void LoadGameExternalOptions() //SaveGame slot by Jazz // WANNE: No need to make it external to switch between old/new. We always use the new save/load screen with more save slots //gGameExternalOptions.fSaveGameSlot = iniReader.ReadBoolean("Extension","SAVE_GAMES_SLOT",FALSE); - gGameExternalOptions.fSaveGameSlot = TRUE; + gGameExternalOptions.fSaveGameSlot = TRUE; + // WANNE: This is just a debug setting. Only in debug version we set that property to TRUE. // In Release version this should always be set to FALSE @@ -1697,6 +1707,12 @@ void LoadSkillTraitsExternalSettings() gSkillTraitValues.ubMaxNumberOfTraits = iniReader.ReadInteger("Generic Traits Settings","MAX_NUMBER_OF_TRAITS", 3, 2, 30); gSkillTraitValues.ubNumberOfMajorTraitsAllowed = iniReader.ReadInteger("Generic Traits Settings","NUMBER_OF_MAJOR_TRAITS_ALLOWED", 2, 2, 20); + // Allow an exception in number of traits for Dr.Q? + gSkillTraitValues.fAllowDrQTraitsException = iniReader.ReadBoolean("Generic Traits Settings","ALLOW_EXCEPTION_FOR_DR_Q", TRUE); + + // Allow traits prerequisities for attributes? + gSkillTraitValues.fAllowAttributePrereq = iniReader.ReadBoolean("Generic Traits Settings","SET_MINIMUM_ATTRIBUTES_FOR_TRAITS", TRUE); + // GENERIC SETTINGS gSkillTraitValues.bCtHModifierAssaultRifles = iniReader.ReadInteger("Generic Traits Settings","ASSAULT_RIFLES_CTH_MODIFIER", -5, -100, 100); gSkillTraitValues.bCtHModifierSniperRifles = iniReader.ReadInteger("Generic Traits Settings","SNIPER_RIFLES_CTH_MODIFIER", -10, -100, 100); @@ -1805,6 +1821,7 @@ void LoadSkillTraitsExternalSettings() gSkillTraitValues.ubMAAPsChangeStanceReduction = iniReader.ReadInteger("Martial Arts","APS_CHANGE_STANCE_REDUCTION", 25, 0, 100); gSkillTraitValues.ubMAApsTurnAroundReduction = iniReader.ReadInteger("Martial Arts","APS_TURN_AROUND_REDUCTION", 25, 0, 100); gSkillTraitValues.ubMAAPsClimbOrJumpReduction = iniReader.ReadInteger("Martial Arts","APS_CLIMB_OR_JUMP_REDUCTION", 25, 0, 100); + gSkillTraitValues.ubMAReducedAPsRegisteredWhenMoving = iniReader.ReadInteger("Martial Arts","REDUCED_CHANCE_TO_BE_INTERRUPTED_WHEN_MOVING", 35, 0, 100); gSkillTraitValues.ubMAChanceToCkickDoors = iniReader.ReadInteger("Martial Arts","CHANCE_KICK_DOORS_BONUS", 25, 0, 250); gSkillTraitValues.fPermitExtraAnimationsOnlyToMA = iniReader.ReadBoolean("Martial Arts","PERMIT_EXTRA_ANIMATIONS_TO_EXPERT_MARTIAL_ARTS_ONLY", TRUE); @@ -1815,7 +1832,8 @@ void LoadSkillTraitsExternalSettings() gSkillTraitValues.ubSLMaxBonuses = iniReader.ReadInteger("Squadleader","MAX_STACKABLE_BONUSES", 3, 1, 30); gSkillTraitValues.ubSLBonusAPsPercent = iniReader.ReadInteger("Squadleader","BONUS_APS_PERCENT_IN_RADIUS", 5, 0, 100); gSkillTraitValues.ubSLEffectiveLevelInRadius = iniReader.ReadInteger("Squadleader","EFFECTIVE_LEVEL_OF_OTHERS_IN_RADIUS", 1, 0, 10); - gSkillTraitValues.ubSLEffectiveLevelAsStandby = iniReader.ReadInteger("Squadleader","EFFECTIVE_LEVEL_AS_STANDBY", 1, 0, 10); + gSkillTraitValues.ubSLEffectiveLevelAsStandby = iniReader.ReadInteger("Squadleader","EFFECTIVE_LEVEL_AS_STANDBY", 1, 0, 10); + gSkillTraitValues.ubSLCollectiveInterruptsBonus = iniReader.ReadInteger("Squadleader","TRIGGER_COLLECTIVE_INTERRUPTS_BONUS", 20, 0, 100); gSkillTraitValues.ubSLOverallSuppresionBonusPercent = iniReader.ReadInteger("Squadleader","OVERALL_SUPRESSION_BONUS_PERCENT", 20, 0, 100); gSkillTraitValues.ubSLMoraleGainBonus = iniReader.ReadInteger("Squadleader","MORALE_GAIN_BONUS", 1, 0, 20); gSkillTraitValues.ubSLMoraleLossReduction = iniReader.ReadInteger("Squadleader","MORALE_LOSS_REDUCTION", 1, 0, 20); @@ -1895,6 +1913,7 @@ void LoadSkillTraitsExternalSettings() gSkillTraitValues.ubSTStealthModeSpeedBonus = iniReader.ReadInteger("Stealthy","STEALTH_MODE_SPEED_BONUS", 50, 0, 100); gSkillTraitValues.ubSTBonusToMoveQuietly = iniReader.ReadInteger("Stealthy","BONUS_TO_MOVE_STEALTHILY", 40, 0, 250); gSkillTraitValues.ubSTStealthBonus = iniReader.ReadInteger("Stealthy","STEALTH_BONUS", 25, 0, 200); + gSkillTraitValues.ubSTReducedAPsRegistered = iniReader.ReadInteger("Stealthy","REDUCED_CHANCE_TO_BE_INTERRUPTED", 30, 0, 100); gSkillTraitValues.ubSTStealthPenaltyForMovingReduction = iniReader.ReadInteger("Stealthy","CHANCE_TO_BE_SPOTTED_FOR_MOVING_REDUCTION", 25, 0, 100); // ATHLETICS @@ -2001,6 +2020,7 @@ void LoadGameAPBPConstants() APBPConstants[AP_MODIFIER_SWAT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MODIFIER_SWAT",0),0); APBPConstants[AP_MODIFIER_CRAWL] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MODIFIER_CRAWL",4),4); APBPConstants[AP_MODIFIER_PACK] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MODIFIER_PACK",4),4); + APBPConstants[AP_MODIFIER_READY] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_MODIFIER_WEAPON_READY",1),4); APBPConstants[AP_CHANGE_FACING] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_CHANGE_FACING",4),4); APBPConstants[AP_CHANGE_TARGET] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_CHANGE_TARGET",2),2); APBPConstants[AP_TOSS_ITEM] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_TOSS_ITEM",32),32); @@ -2101,6 +2121,7 @@ void LoadGameAPBPConstants() APBPConstants[BP_MOVEMENT_SHORE] = iniReader.ReadInteger("BPConstants","BP_MOVEMENT_SHORE",50); APBPConstants[BP_MOVEMENT_LAKE] = iniReader.ReadInteger("BPConstants","BP_MOVEMENT_LAKE",75); APBPConstants[BP_MOVEMENT_OCEAN] = iniReader.ReadInteger("BPConstants","BP_MOVEMENT_OCEAN",100); + APBPConstants[BP_MOVEMENT_READY] = iniReader.ReadInteger("BPConstants","BP_MODIFIER_WEAPON_READY",30); APBPConstants[BP_CROUCH] = iniReader.ReadInteger("BPConstants","BP_CROUCH",10); APBPConstants[BP_PRONE] = iniReader.ReadInteger("BPConstants","BP_PRONE",10); APBPConstants[BP_CLIMBROOF] = iniReader.ReadInteger("BPConstants","BP_CLIMBROOF",500); @@ -2295,9 +2316,13 @@ BOOLEAN GetCDLocation( ) CHAR8 zCdLocation[ SGPFILENAME_LEN ]; UINT32 uiRetVal=0; - //Do a crude check to make sure the Ja2.ini file is the right on + //Do a crude check to make sure the GAME_INI_FILE file is the right on - uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE ); + STRING512 ja2INIfile; + strcat(ja2INIfile, "..\\"); + strcat(ja2INIfile, GAME_INI_FILE); + + uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, ja2INIfile ); if( uiRetVal == 0 || !IsDriveLetterACDromDrive( zCdLocation ) ) { // the user most likely doesnt have the file, or the user has messed with the file @@ -2322,10 +2347,10 @@ BOOLEAN GetCDLocation( ) sprintf( zCdLocation, "c" ); } - //Now create a new file - WritePrivateProfileString( "Ja2 Settings", "CD", zCdLocation, GAME_INI_FILE ); + //Now create a new file + WritePrivateProfileString( "Ja2 Settings", "CD", zCdLocation, ja2INIfile ); - GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE ); + GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, ja2INIfile ); } uiStrngLength = strlen( zCdLocation ); @@ -2518,9 +2543,13 @@ BOOLEAN GetCdromLocationFromIniFile( STR pRootOfCdromDrive ) { UINT32 uiRetVal=0; - //Do a crude check to make sure the Ja2.ini file is the right on + //Do a crude check to make sure the GAME_INI_FILE file is the right on - uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", pRootOfCdromDrive, SGPFILENAME_LEN, GAME_INI_FILE ); + STRING512 ja2INIfile; + strcat(ja2INIfile, "..\\"); + strcat(ja2INIfile, GAME_INI_FILE); + + uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", pRootOfCdromDrive, SGPFILENAME_LEN, ja2INIfile ); if( uiRetVal == 0 ) { pRootOfCdromDrive[0] = '\0'; diff --git a/GameSettings.h b/GameSettings.h index 71686728..57a7c0b1 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -3,6 +3,12 @@ #include "Types.h" +#ifdef JA2UB + #define GAME_INI_FILE "Ja2_UB.ini" +#else + #define GAME_INI_FILE "Ja2.ini" +#endif + //If you add any options, MAKE sure you add the corresponding string to the Options Screen string array. // look up : zOptionsScreenHelpText , zOptionsToggleText @@ -125,9 +131,17 @@ typedef struct BOOLEAN fHideHelpInAllScreens; // Controls Help "do not show help again" checkbox +#ifdef JA2UB + //JA25UB + BOOLEAN fPlayerFinishedTheGame; +#endif + UINT8 ubSizeOfDisplayCover; // The number of grids the player designates thru "Delete + '=' or '-'" UINT8 ubSizeOfLOS; // The number of grids the player designates thru "End + '=' or '-'" - + // The number of grids the player designates thru "End + '=' or '-'" +#ifdef JA2UB + UINT8 ubFiller[17]; +#endif } GAME_SETTINGS; // CHRISL: New Enums to track inventory system @@ -192,6 +206,7 @@ typedef struct UINT8 ubBobbyRay; UINT8 ubInventorySystem; UINT8 ubAttachmentSystem; + UINT8 ubSquadSize; // SANDRO - added variables UINT8 ubMaxIMPCharacters; BOOLEAN fNewTraitSystem; @@ -199,7 +214,8 @@ typedef struct BOOLEAN fEnemiesDropAllItems; UINT8 ubProgressSpeedOfItemsChoices; BOOLEAN fEnableAllWeaponCaches; - //UINT8 ubFiller[]; + + UINT8 ubFiller[500]; // WANNE: Decrease this filler by 1, for each new UINT8 variable! } GAME_OPTIONS; @@ -302,7 +318,16 @@ typedef struct BOOLEAN fCamoRemoving; BOOLEAN fEnhancedCloseCombatSystem; + BOOLEAN fImprovedInterruptSystem; + UINT8 ubBasicPercentRegisterValueIIS; + UINT8 ubPercentRegisterValuePerLevelIIS; + UINT8 ubBasicReactionTimeLengthIIS; + BOOLEAN fAllowCollectiveInterrupts; + BOOLEAN fAllowInstantInterruptsOnSight; + UINT16 usAwardSpecialExpForQuests; + + BOOLEAN fAllowWalkingWithWeaponRaised; //////////////////////////////////// // Kaiden: Vehicle Inventory change - Added for INI Option @@ -997,6 +1022,10 @@ typedef struct BOOLEAN fShowCamouflageFaces; + BOOLEAN fHideEnemyHealthText; + + UINT8 ubEnemyHitCount; + FLOAT gMercLevelUpSalaryIncreasePercentage; UINT8 ubChanceTonyAvailable; // silversurfer/SANDRO @@ -1005,6 +1034,11 @@ typedef struct INT32 iInitialMercArrivalLocation; + BOOLEAN gBriefingRoom; + BOOLEAN gEncyclopedia; + + + } GAME_EXTERNAL_OPTIONS; typedef struct @@ -1012,6 +1046,10 @@ typedef struct UINT8 ubMaxNumberOfTraits; UINT8 ubNumberOfMajorTraitsAllowed; + BOOLEAN fAllowDrQTraitsException; + + BOOLEAN fAllowAttributePrereq; + // GENERIC SETTINGS INT8 bCtHModifierAssaultRifles; INT8 bCtHModifierSniperRifles; @@ -1120,6 +1158,7 @@ typedef struct UINT8 ubMAAPsChangeStanceReduction; UINT8 ubMAApsTurnAroundReduction; UINT8 ubMAAPsClimbOrJumpReduction; + UINT8 ubMAReducedAPsRegisteredWhenMoving; UINT8 ubMAChanceToCkickDoors; BOOLEAN fPermitExtraAnimationsOnlyToMA; @@ -1130,6 +1169,7 @@ typedef struct UINT8 ubSLBonusAPsPercent; UINT8 ubSLEffectiveLevelInRadius; UINT8 ubSLEffectiveLevelAsStandby; + UINT8 ubSLCollectiveInterruptsBonus; UINT8 ubSLOverallSuppresionBonusPercent; UINT8 ubSLMoraleGainBonus; UINT8 ubSLMoraleLossReduction; @@ -1208,6 +1248,7 @@ typedef struct UINT8 ubSTStealthModeSpeedBonus; UINT8 ubSTBonusToMoveQuietly; UINT8 ubSTStealthBonus; + UINT8 ubSTReducedAPsRegistered; UINT8 ubSTStealthPenaltyForMovingReduction; // ATHLETICS diff --git a/GameVersion.cpp b/GameVersion.cpp index 5ffb9dde..90304a23 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -13,11 +13,15 @@ #ifdef JA2EDITOR //MAP EDITOR BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.4870 (Official Release)" }; +#ifdef JA2UB +CHAR16 zVersionLabel[256] = { L"Unfinished Business Map Editor v1.13.4882 (Official Release)" }; +#else +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.4882 (Official Release)" }; +#endif #elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Debug v1.13.4870 (Official Release)" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.4882 (Official Release)" }; #elif defined CRIPPLED_VERSION //RELEASE BUILD VERSION s @@ -26,10 +30,15 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.4870 (Official Release)" }; + #ifdef JA2UB + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business v1.13.4882 (Official Release)" }; + #else + CHAR16 zVersionLabel[256] = { L"Release v1.13.4882 (Official Release)" }; + #endif + #endif -CHAR8 czVersionNumber[16] = { "Build 11.12.28" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 12.01.18" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; diff --git a/GameVersion.h b/GameVersion.h index 970b00d7..5b7e232d 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -20,10 +20,16 @@ extern CHAR16 zTrackingNumber[16]; // // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file -#define SAVE_GAME_VERSION 123 //114 //113 //112 //111 //110 //109 //108 //107 //106 //105 //104 //103 //102 //101 //100 // 99 - -#define CURRENT_SAVEGAME_DATATYPE_VERSION 123 +#define SAVE_GAME_VERSION 131 //125 //124 //114 //113 //112 //111 //110 //109 //108 //107 //106 //105 //104 //103 //102 //101 //100 // 99 +#define JA25_UB_INTEGRATION 131 // Before this, the JA25 Unfinished Business code was not integrated (see "Builddefines.h" JA2UB) +#define IMPROVED_INTERRUPT_SYSTEM 130 +#define ENCYCLOPEDIA_SAVEGAME_CHANGE 129 // Added encyclopedia +#define HIDDENTOWN_DATATYPE_CHANGE 128 +#define NEW_EMAIL_SAVE_GAME 127 +#define NEW_SAVE_GAME_GENERAL_SAVE_INFO_DATA 126 +#define QUESTS_DATATYPE_CHANGE 125 // Before this, we had a maximum number of 30 quests (JA2 default) (by Jazz) +#define VEHICLES_DATATYPE_CHANGE 124 // Before this, vehicles were not externalized (by Jazz) #define FIXED_MERC_NOT_AVAILABLE_ON_MERC_WEBSITE 123 // Before this, only Bubba was available on MERC website #define FIXED_CREPITUS_IN_REALISTIC_GAME_MODE 122 // Before this, there was an initializing problem in GameInit.lua on startup, in which we could meet crepitus in Tixa underground map #define FIXED_NPC_QUOTE_BUG 121 // Before this, we need to reload all npc quote information because it was not being saved and loaded correctly. diff --git a/Init.cpp b/Init.cpp index 6c928610..1f1369ab 100644 --- a/Init.cpp +++ b/Init.cpp @@ -71,10 +71,21 @@ #include "Strategic Town Loyalty.h" #include "Soldier Profile.h" #include "aim.h" +#include "mainmenuscreen.h" +#include "email.h" + +#ifdef JA2UB +#include "Ja25_Tactical.h" +#endif + +#include "ub_config.h" + #include "Civ Quotes.h" #include "Sector Summary.h" #include "LuaInitNPCs.h" +#include "Encyclopedia_Data.h" +#include "Encyclopedia.h" extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0}; extern INT16 gubMaxActionPoints[28];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08 @@ -389,11 +400,21 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) } #endif +#ifdef JA2UB + + strcpy(fileName, directoryName); + strcat(fileName, MERCSTARTINGGEAR25FILENAME); + SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName),MERCSTARTINGGEAR25FILENAME); + +#else + // CHRISL: strcpy(fileName, directoryName); strcat(fileName, MERCSTARTINGGEARFILENAME); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName),MERCSTARTINGGEARFILENAME); +#endif + strcpy(fileName, directoryName); strcat(fileName, WEAPONSFILENAME); SGP_THROW_IFFALSE(ReadInWeaponStats(fileName),WEAPONSFILENAME); @@ -427,10 +448,29 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, TONYINVENTORYFILENAME); SGP_THROW_IFFALSE(ReadInInventoryStats(gTonyInventory,fileName),TONYINVENTORYFILENAME); +#ifdef JA2UB +//ja25 ub Biggins + + strcpy(fileName, directoryName); + strcat(fileName, BETTYINVENTORYFILENAME); + SGP_THROW_IFFALSE(ReadInInventoryStats(gBettyInventory,fileName),BETTYINVENTORYFILENAME); + + //UB + strcpy(fileName, directoryName); + strcat(fileName, RAULINVENTORYFILENAME); + SGP_THROW_IFFALSE(ReadInInventoryStats(gRaulInventory,fileName),RAULINVENTORYFILENAME); + +#else strcpy(fileName, directoryName); strcat(fileName, DEVININVENTORYFILENAME); SGP_THROW_IFFALSE(ReadInInventoryStats(gDevinInventory,fileName),DEVININVENTORYFILENAME); + strcpy(fileName, directoryName); + strcat(fileName, PERKOINVENTORYFILENAME); + SGP_THROW_IFFALSE(ReadInInventoryStats(gPerkoInventory,fileName),PERKOINVENTORYFILENAME); + +#endif + strcpy(fileName, directoryName); strcat(fileName, FRANZINVENTORYFILENAME); SGP_THROW_IFFALSE(ReadInInventoryStats(gFranzInventory,fileName),FRANZINVENTORYFILENAME); @@ -491,10 +531,6 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, ARNIEINVENTORYFILENAME); SGP_THROW_IFFALSE(ReadInInventoryStats(gArnieInventory,fileName),ARNIEINVENTORYFILENAME); - strcpy(fileName, directoryName); - strcat(fileName, PERKOINVENTORYFILENAME); - SGP_THROW_IFFALSE(ReadInInventoryStats(gPerkoInventory,fileName),PERKOINVENTORYFILENAME); - strcpy(fileName, directoryName); strcat(fileName, FREDOINVENTORYFILENAME); SGP_THROW_IFFALSE(ReadInInventoryStats(gFredoInventory,fileName),FREDOINVENTORYFILENAME); @@ -527,14 +563,21 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, SAMSITESFILENAME); SGP_THROW_IFFALSE(ReadInSAMInfo(fileName),SAMSITESFILENAME); - // Lesh: army externalization - strcpy(fileName, directoryName); - strcat(fileName, GARRISONFILENAME); - SGP_THROW_IFFALSE(ReadInGarrisonInfo(fileName),GARRISONFILENAME); +#ifdef JA2UB + if ( gGameUBOptions.EnemyXML == TRUE ) + { +#endif + // Lesh: army externalization + strcpy(fileName, directoryName); + strcat(fileName, GARRISONFILENAME); + SGP_THROW_IFFALSE(ReadInGarrisonInfo(fileName),GARRISONFILENAME); - strcpy(fileName, directoryName); - strcat(fileName, PATROLFILENAME); - SGP_THROW_IFFALSE(ReadInPatrolInfo(fileName),PATROLFILENAME); + strcpy(fileName, directoryName); + strcat(fileName, PATROLFILENAME); + SGP_THROW_IFFALSE(ReadInPatrolInfo(fileName),PATROLFILENAME); +#ifdef JA2UB + } +#endif strcpy(fileName, directoryName); strcat(fileName, COMPOSITIONFILENAME); @@ -616,6 +659,36 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) // SANDRO - always initialize those files, we need it on game start if (gGameExternalOptions.fReadProfileDataFromXML) { +#ifdef JA2UB + // UB25 + strcpy(fileName, directoryName); + strcat(fileName, MERCPROFILESFILENAME25); + + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25); + + #ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInMercProfiles(fileName,TRUE)) + return FALSE; + } + #endif + } + + strcpy(fileName, directoryName); + strcat(fileName, MERCOPINIONSFILENAME25); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInMercOpinions(fileName), MERCOPINIONSFILENAME25); + } +#else + // HEADROCK PROFEX: Read in Merc Profile data to replace PROF.DAT data strcpy(fileName, directoryName); strcat(fileName, MERCPROFILESFILENAME); @@ -636,8 +709,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, MERCOPINIONSFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercOpinions(fileName), MERCOPINIONSFILENAME); +#endif } - + // HEADROCK HAM 3.6: Read in customized Bloodcat Placements strcpy(fileName, directoryName); strcat(fileName, BLOODCATPLACEMENTSFILENAME); @@ -710,9 +784,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) // Sender Name List by Jazz strcpy(fileName, directoryName); - strcat(fileName, SENDERNAMELISTFILENAME); + strcat(fileName, EMAILSENDERNAMELIST); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); - SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), SENDERNAMELISTFILENAME); + SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST); #ifndef ENGLISH AddLanguagePrefix(fileName); @@ -811,6 +885,186 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) } #endif + //Main Menu by Jazz + strcpy(fileName, directoryName); + strcat(fileName, LAYOUTMAINMENU); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInMainMenu(gMainMenulayout,fileName), LAYOUTMAINMENU); + + strcpy(fileName, directoryName); + strcat(fileName, ACTIONITEMSFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInActionItems(fileName,FALSE), ACTIONITEMSFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInActionItems(fileName,TRUE)) + return FALSE; + } +#endif + +if ( ReadXMLEmail == TRUE ) +{ + // EMAIL MERC AVAILABLE by Jazz + strcpy(fileName, directoryName); + strcat(fileName, EMAILMERCAVAILABLE); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEmailMercAvailable(fileName,FALSE), EMAILMERCAVAILABLE); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInEmailMercAvailable(fileName,TRUE)) + return FALSE; + } +#endif + + // EMAIL MERC LEVEL UP by Jazz + strcpy(fileName, directoryName); + strcat(fileName, EMAILMERCLEVELUP); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEmailMercLevelUp(fileName,FALSE), EMAILMERCLEVELUP); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInEmailMercLevelUp(fileName,TRUE)) + return FALSE; + } +#endif +} +/* + // EMAIL OTHER by Jazz + strcpy(fileName, directoryName); + strcat(fileName, EMAILOTHER); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEmailOther(fileName,FALSE), EMAILOTHER); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInEmailOther(fileName,TRUE)) + return FALSE; + } +#endif +*/ + //new vehicles by Jazz + + InitNewVehicles (); + + strcpy(fileName, directoryName); + strcat(fileName, VEHICLESFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInNewVehicles(fileName,FALSE), VEHICLESFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInNewVehicles(fileName,TRUE)) + return FALSE; + } +#endif + +// WANNE: The file "TableData/Text/TacticalMessages.xml" is not yet used +#if 0 + strcpy(fileName, directoryName); + strcat(fileName, TEXTFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInLanguageLocation(fileName,FALSE,zlanguageText,0), TEXTFILENAME); +#endif + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInLanguageLocation(fileName,TRUE,zlanguageText,0)) + return FALSE; + } +#endif + + //encyklopedia + strcpy(fileName, directoryName); + strcat(fileName, ENCYCLOPEDIALOCATIONFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,FALSE,gEncyclopediaLocationData, 0), ENCYCLOPEDIALOCATIONFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,TRUE,gEncyclopediaLocationData, 0), fileName); + } +#endif + + strcpy(fileName, directoryName); + strcat(fileName, ENCYCLOPEDIAPROFILEFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,FALSE,gEncyclopediaProfilesData, 1), ENCYCLOPEDIAPROFILEFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,TRUE,gEncyclopediaProfilesData, 1), fileName); + } +#endif + + strcpy(fileName, directoryName); + strcat(fileName, ENCYCLOPEDIAINVENTORYFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,FALSE,gEncyclopediaInventoryData, 2), ENCYCLOPEDIAINVENTORYFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,TRUE,gEncyclopediaInventoryData, 2), ENCYCLOPEDIAINVENTORYFILENAME); + } +#endif + + strcpy(fileName, directoryName); + strcat(fileName, ENCYCLOPEDIAQUESTSFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,FALSE,gEncyclopediaQuestsData, 3), ENCYCLOPEDIAQUESTSFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,TRUE,gEncyclopediaQuestsData, 3), fileName); + } +#endif + + strcpy(fileName, directoryName); + strcat(fileName, BRIEFINGROOMFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,FALSE,gBriefingRoomData, 4), BRIEFINGROOMFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInEncyclopediaLocation(fileName,TRUE,gBriefingRoomData, 4), fileName); + } +#endif + LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true); g_luaUnderground.LoadScript(GetLanguagePrefix()); // load Lua for Strategic Mines initialization @@ -830,6 +1084,10 @@ UINT32 InitializeJA2(void) HandleJA2CDCheck( ); gfWorldLoaded = FALSE; + +#ifdef JA2UB + useOldJA2Inventory = FALSE; +#endif //Load external game mechanic data //if ( !LoadExternalGameplayData(TABLEDATA_DIRECTORY)) @@ -961,8 +1219,40 @@ UINT32 InitializeJA2(void) } #endif +#ifdef JA2UB + // run old UB inventory Data-UB\Addons\Data-Old-UB-Inventory + if( _stricmp( gzCommandLine, "-OLDUBINVENTORY" ) ) + { + useOldJA2Inventory = TRUE; + } + + // Ignore the old UB Inventory, because it is not working + useOldJA2Inventory = FALSE; + +#endif + #ifdef JA2BETAVERSION #ifdef JA2EDITOR + #ifdef JA2UB + // CHECK COMMANDLINE FOR SPECIAL UTILITY + if( !strcmp( gzCommandLine, "-OLDUBINVENTORYEDITORAUTO" ) ) + { + OutputDebugString( "Beginning JA2 using -EDITORAUTO commandline argument...\n" ); + //For editor purposes, need to know the default map file. + sprintf( gubFilename, "none"); + //also set the sector + gWorldSectorX = 0; + gWorldSectorY = 0; + gfAutoLoadA9 = FALSE; + gfIntendOnEnteringEditor = TRUE; + gGameOptions.fGunNut = TRUE; + gGameOptions.fAirStrikes = FALSE; + + useOldJA2Inventory = TRUE; + return( GAME_SCREEN ); + } + #endif + // CHECK COMMANDLINE FOR SPECIAL UTILITY if( !strcmp( gzCommandLine, "-EDITORAUTO" ) ) { @@ -1012,6 +1302,17 @@ UINT32 InitializeJA2(void) #endif #endif +#ifdef JA2UB + InitGridNoUB(); +#endif + +#ifdef JA2UB + if ( useOldJA2Inventory == TRUE ) + Old_UB_Inventory (); + else + New_UB_Inventory (); +#endif + //Lua IniLuaGlobal(); diff --git a/Init.h b/Init.h index d4053278..e3121a09 100644 --- a/Init.h +++ b/Init.h @@ -38,6 +38,7 @@ AP_MODIFIER_WALK, AP_MODIFIER_SWAT, AP_MODIFIER_CRAWL, AP_MODIFIER_PACK, +AP_MODIFIER_READY, AP_CHANGE_FACING, AP_CHANGE_TARGET, AP_TOSS_ITEM, @@ -134,6 +135,7 @@ BP_MOVEMENT_RUBBLE, BP_MOVEMENT_SHORE, BP_MOVEMENT_LAKE, BP_MOVEMENT_OCEAN, +BP_MOVEMENT_READY, BP_CROUCH, BP_PRONE, BP_CLIMBROOF, diff --git a/Intro.cpp b/Intro.cpp index da095c97..11d33b37 100644 --- a/Intro.cpp +++ b/Intro.cpp @@ -38,13 +38,23 @@ #include #include "Luaglobal.h" +#ifdef JA2UB +#include "strategicmap.h" +#include "Map Screen Interface Map.h" +#include "Map Screen Interface.h" +#include "End Game.h" +#include "Cinematics Bink.h" +#endif + #include "LuaInitNPCs.h" #include "XML.h" BOOLEAN Style_JA = TRUE; extern INT8 Test = 0; +INTRO_NAMES_VALUES zVideoFile[255]; UINT32 iStringToUseLua = -1; + // BF class VideoPlayer { @@ -241,6 +251,13 @@ enum EGameVideos INTRO_SPLASH_SCREEN, INTRO_SPLASH_TALONSOFT, +#ifdef JA2UB + + INTRO_HELI_CRASH_SCENE_1, + INTRO_END_SCENE_1, + +#endif + //there are no more videos shown for the endgame INTRO_LAST_END_GAME, @@ -317,6 +334,13 @@ UINT32 IntroScreenInit( void ) s_VFN[INTRO_SPLASH_SCREEN] = inireader.ReadString("INTRO_SPLASH","INTRO_SPLASH_SCREEN", no_defaults ? "" : "INTRO\\SplashScreen"); s_VFN[INTRO_SPLASH_TALONSOFT] = inireader.ReadString("INTRO_SPLASH","INTRO_SPLASH_TALONSOFT", no_defaults ? "" : "INTRO\\TalonSoftid_endhold"); + //UB +#ifdef JA2UB + s_VFN[INTRO_HELI_CRASH_SCENE_1] = inireader.ReadString("INTRO_BEGINNING","INTRO_HELI_CRASH_SCENE", no_defaults ? "" : "INTRO\\Intro"); + s_VFN[INTRO_END_SCENE_1] = inireader.ReadString("INTRO_ENDING","INTRO_END_SCENE", no_defaults ? "" : "INTRO\\MissileEnding"); +#endif + + //there are no more videos shown for the endgame return( 1 ); diff --git a/Intro.h b/Intro.h index 26afc036..27c51ca7 100644 --- a/Intro.h +++ b/Intro.h @@ -12,6 +12,9 @@ void StopIntroVideo(); //enums used for when the intro screen can come up, used with 'gbIntroScreenMode' enum EIntroType { +#ifdef JA2UB + INTRO_HELI_CRASH, +#endif INTRO_BEGINNING, //set when viewing the intro at the begining of the game INTRO_ENDING, //set when viewing the end game video. @@ -28,4 +31,15 @@ extern UINT32 guiIntroExitScreen; extern BOOLEAN gfIntroScreenExit; extern INT8 gbIntroScreenMode; +#define MAX_VIDEO_NAMES_CHARS 128 + +typedef struct +{ + UINT16 uiIndex; + CHAR16 szFile[MAX_VIDEO_NAMES_CHARS]; + +} INTRO_NAMES_VALUES; + +extern INTRO_NAMES_VALUES zVideoFile[255]; + #endif \ No newline at end of file diff --git a/Ja25Update.cpp b/Ja25Update.cpp new file mode 100644 index 00000000..94c676e2 --- /dev/null +++ b/Ja25Update.cpp @@ -0,0 +1,131 @@ +#ifdef PRECOMPILEDHEADERS +#include "Tactical All.h" +#else +#include "builddefines.h" +#include +#include +#include +#include "wcheck.h" +#include "Render Fun.h" +#include "stdlib.h" +#include "debug.h" +#include "MemMan.h" +#include "Overhead Types.h" +//#include "Soldier Control.h" +#include "Animation Cache.h" +#include "Animation Data.h" +#include "Animation Control.h" +#include "container.h" +#include +#include "pathai.h" +#include "Random.h" +#include "worldman.h" +#include "Isometric Utils.h" +#include "Render Dirty.h" +#include "renderworld.h" +#include "sys globals.h" +#include "video.h" +#include "points.h" +#include "Win util.h" +#include "Sound Control.h" +#include "weapons.h" +#include "vobject_blitters.h" +#include "Handle UI.h" +#include "soldier ani.h" +#include "Event pump.h" +#include "opplist.h" +#include "ai.h" +#include "interface.h" +#include "lighting.h" +#include "faces.h" +#include "Soldier Profile.h" +#include "gap.h" +#include "interface panels.h" +#include "campaign.h" +#include "soldier macros.h" +#include "english.h" +#include "Squads.h" + +#ifdef NETWORKED +#include "Networking.h" +#include "NetworkEvent.h" +#endif +#include "structure wrap.h" +#include "items.h" +#include "Soundman.h" +#include "utilities.h" +#include "Strategic.h" +#include "soldier tile.h" +#include "Smell.h" +#include "Keys.h" +#include "dialogue control.h" +#include "soldier functions.h" +#include "rt time defines.h" +#include "Exit Grids.h" +#include "gamescreen.h" +#include "Quests.h" +#include "message.h" +#include "NPC.h" +#include "SkillCheck.h" +#include "handle doors.h" +#include "interface dialogue.h" +#include "smokeeffects.h" +#include "GameSettings.h" +#include "tile animation.h" +#include "ShopKeeper Interface.h" +#include "Arms Dealer Init.h" +#include "vehicles.h" +#include "rotting corpses.h" +#include "Interface Control.h" +#include "strategicmap.h" +#include "morale.h" +#include "meanwhile.h" +#include "drugs and alcohol.h" +#include "SkillCheck.h" +#include "boxing.h" +#include "overhead map.h" +#include "Map Information.h" +#include "environment.h" +#include "Game Clock.h" +#include "Explosion Control.h" +#include "Buildings.h" +#include "Text.h" +#include "Strategic Merc Handler.h" +#include "Campaign Types.h" +#include "Strategic Status.h" +#include "civ quotes.h" +#include "Strategic Pathing.h" +#include "Debug Control.h" +#endif + +#ifdef JA2UB + +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" + +INT16 JA2_5_START_SECTOR_X; +INT16 JA2_5_START_SECTOR_Y; + +//** Defines ******************************************************************* + +//Starting money +#define JA2_5_STARTING_MONEY_EASY 40000 +#define JA2_5_STARTING_MONEY_MEDIUM 35000 +#define JA2_5_STARTING_MONEY_HARD 30000 + + +#define JA2SAVE_CONV_FILENAME "..\\SavedGames\\Ja2.dts" + +typedef struct +{ + INT8 bMercID; + INT8 bPercentStatIncrease; +} STAT_CHANGE; + +#define NUM_MERCS_TO_USE_IN_PERCENT_STAT_INCREASE 6 + +#define MAX_STAT_INCREASE 30 + +#endif + +//****************************************************************************** \ No newline at end of file diff --git a/Ja25Update.h b/Ja25Update.h new file mode 100644 index 00000000..a2edef1c --- /dev/null +++ b/Ja25Update.h @@ -0,0 +1,34 @@ +#ifndef JA25UPDATE__C_ +#define JA25UPDATE__C_ + +#include "Types.h" + +#ifdef JA2UB + +//Used in the editor to compensate for the 2_ +#define JA25_EXP_MAP_NAME_PREFIX L"" +#define JA25_EXP_MAP_NAME_SIZE_OFFSET 0 + + +//The starting sector of the Expanion pack +extern INT16 JA2_5_START_SECTOR_X; +extern INT16 JA2_5_START_SECTOR_Y; +//#define JA2_5_START_SECTOR_X 7 +//#define JA2_5_START_SECTOR_Y 8 + +#define JA25_PROF_DAT "BINARYDATA\\Ja25Prof.dat" + +/* +BOOLEAN ConvertJa2SaveToJa2_5(); + +BOOLEAN ImportOldProfilesAndProcessThem(); + +void GivePlayerStartingJa25Money(); + +UINT32 HandleDifficultyModifierForImportedGames(); + +BOOLEAN DoesJa25ImportSaveExistAndSeemValid(); +*/ +#endif + +#endif diff --git a/Laptop/AimLinks.cpp b/Laptop/AimLinks.cpp index 52f5f2d3..c333d4e1 100644 --- a/Laptop/AimLinks.cpp +++ b/Laptop/AimLinks.cpp @@ -11,6 +11,10 @@ #include "Multi Language Graphic Utils.h" #endif +#ifdef JA2UB +#include "ub_config.h" +#endif + #define AIM_LINK_TITLE_FONT FONT14ARIAL #define AIM_LINK_TITLE_COLOR AIM_GREEN @@ -42,7 +46,9 @@ #define AIM_LINK_LINK_TEXT_3_Y AIM_LINK_INSURANCE_LINK_Y + 45 - + #ifdef JA2UB + INT16 LinkID = 3; + #endif @@ -67,29 +73,81 @@ void GameInitAimLinks() BOOLEAN EnterAimLinks() { VOBJECT_DESC VObjectDesc; - UINT16 usPosY; - INT16 i; - + UINT16 usPosY; + InitAimDefaults(); InitAimMenuBar(); + #ifdef JA2UB + if (gGameUBOptions.LaptopLinkBobby == TRUE ) + { + #endif // load the Bobby link graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_BOBBYRAYLINK ); CHECKF(AddVideoObject(&VObjectDesc, &guiBobbyLink)); - + #ifdef JA2UB + } + #endif + + #ifdef JA2UB + if (gGameUBOptions.LaptopLinkFuneral == TRUE ) + { + #endif // load the Funeral graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_MORTUARYLINK ); CHECKF(AddVideoObject(&VObjectDesc, &guiFuneralLink)); - + #ifdef JA2UB + } + #endif + + #ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + { + #endif // load the Insurance graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_INSURANCELINK ); CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceLink)); - + #ifdef JA2UB + } + #endif + + #ifdef JA2UB + usPosY = AIM_LINK_BOBBY_LINK_Y; + if (gGameUBOptions.LaptopLinkBobby == TRUE ) + { + MSYS_DefineRegion( &gSelectedLinkRegion[0], AIM_LINK_BOBBY_LINK_X, usPosY , AIM_LINK_BOBBY_LINK_X + AIM_LINK_LINK_WIDTH, (UINT16)(usPosY + AIM_LINK_LINK_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedLinkRegion[0]); + MSYS_SetRegionUserData( &gSelectedLinkRegion[0], 0, gubLinkPages[0]); + //usPosY += AIM_LINK_LINK_OFFSET_Y; + } + + usPosY = AIM_LINK_FUNERAL_LINK_Y; + if (gGameUBOptions.LaptopLinkFuneral == TRUE ) + { + MSYS_DefineRegion( &gSelectedLinkRegion[1], AIM_LINK_FUNERAL_LINK_X, usPosY , AIM_LINK_FUNERAL_LINK_X + AIM_LINK_LINK_WIDTH, (UINT16)(usPosY + AIM_LINK_LINK_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedLinkRegion[1]); + MSYS_SetRegionUserData( &gSelectedLinkRegion[1], 0, gubLinkPages[1]); + //usPosY += AIM_LINK_LINK_OFFSET_Y; + } + + usPosY = AIM_LINK_INSURANCE_LINK_Y; + if (gGameUBOptions.LaptopLinkInsurance== TRUE ) + { + MSYS_DefineRegion( &gSelectedLinkRegion[2], AIM_LINK_INSURANCE_LINK_X, usPosY , AIM_LINK_INSURANCE_LINK_X + AIM_LINK_LINK_WIDTH, (UINT16)(usPosY + AIM_LINK_LINK_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedLinkRegion[2]); + MSYS_SetRegionUserData( &gSelectedLinkRegion[2], 0, gubLinkPages[2]); + usPosY += AIM_LINK_LINK_OFFSET_Y; + } + + #else usPosY = AIM_LINK_BOBBY_LINK_Y; - for(i=0; i 64) + { + iStringBriefingRoomPos = 64; + } + + // restore background + //RenderActivationIndent( 257, 328 ); + // get the video object + GetVideoObject(&hHandle, guiBRIEFINGROOMACTIVATIONINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + 200, LAPTOP_SCREEN_WEB_UL_Y + 260 , VO_BLT_SRCTRANSPARENCY,NULL); + + // setup the font stuff + SetFont( FONT14ARIAL ); + SetFontForeground( 184 ); + SetFontBackground(FONT_BLACK); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerBriefingRoomActivationString); + + + fNewCharInActivationBriefingRoomString = FALSE; + fReDrawScreenFlag = TRUE; + return; +} + +void DisplayActivationBriefingRoomStringCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + UINT8 *pDestBuf; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + + // draw line in current state + LineDraw(TRUE, (UINT16) uiCursorBriefingRoomPosition, CURSOR_Y, (UINT16)uiCursorBriefingRoomPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( BriefingRoomGlowColorsList[ iCurrentState ][ 0 ], BriefingRoomGlowColorsList[ iCurrentState ][ 1 ], BriefingRoomGlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf ); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + + InvalidateRegion((UINT16) uiCursorBriefingRoomPosition , CURSOR_Y , (UINT16)uiCursorBriefingRoomPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1); + + + return; +} + + + +void GetPlayerKeyBoardInputForBriefingRoomHomePage( void ) +{ + InputAtom InputEvent; + POINT MousePos; + + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + + while (DequeueEvent(&InputEvent) == TRUE) + { + // HOOK INTO MOUSE HOOKS + /* + switch(InputEvent.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } +*/ + if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) ) + { + switch( InputEvent.usParam ) + { + case (( ENTER ) ): + if(( InputEvent.usEvent == KEY_UP ) ) + { + // return hit, check to see if current player activation string is a valid one + ProcessPlayerInputActivationBriefingRoomString( ); + + fNewCharInActivationBriefingRoomString = TRUE; + } + break; + case (( ESC )): + HandleLapTopESCKey(); // WANNE: Fix for proper closing of the IMP laptop page + LeaveLapTopScreen( ); + break; + default: + if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT ) + { + HandleBriefingRoomTextEvent( InputEvent.usParam ); + } + break; + } + } + } + + return; +} + + +void HandleBriefingRoomTextEvent( UINT32 uiKey ) +{ + // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen + // or delete it + switch( uiKey ) + { + case ( BACKSPACE ): + + if( iStringBriefingRoomPos >= 0 ) + { + + if( iStringBriefingRoomPos > 0 ) + { + // decrement iStringBriefingRoomPosition + iStringBriefingRoomPos-=1; + } + + // null out char + pPlayerBriefingRoomActivationString[iStringBriefingRoomPos ] = 0; + + // move back cursor + uiCursorBriefingRoomPosition = StringPixLength( pPlayerBriefingRoomActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + + + // string has been altered, redisplay + fNewCharInActivationBriefingRoomString = TRUE; + + } + + break; + + default: + if( uiKey >= 'A' && uiKey <= 'Z' || + uiKey >= 'a' && uiKey <= 'z' || + uiKey >= '0' && uiKey <= '9' || + uiKey == '_' || uiKey == '.' || uiKey ==' ') + { + // if the current string position is at max or great, do nothing + if( iStringBriefingRoomPos >= 8 ) + { + break; + } + else + { + if(iStringBriefingRoomPos < 0 ) + { + iStringBriefingRoomPos = 0; + } + // valid char, capture and convert to CHAR16 + pPlayerBriefingRoomActivationString[iStringBriefingRoomPos] = ( CHAR16 )uiKey; + + // null out next char position + pPlayerBriefingRoomActivationString[iStringBriefingRoomPos + 1] = 0; + + // move cursor position ahead + uiCursorBriefingRoomPosition = StringPixLength( pPlayerBriefingRoomActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + // increment string position + iStringBriefingRoomPos +=1; + + // string has been altered, redisplay + fNewCharInActivationBriefingRoomString = TRUE; + + } + + } + + break; + + } + + + return; +} + +void ProcessPlayerInputActivationBriefingRoomString( void ) +{ + // prcess string to see if it matches activation string + char charPlayerActivationString[32]; + wcstombs(charPlayerActivationString,pPlayerBriefingRoomActivationString,32); + + if( ( ( wcscmp(pPlayerBriefingRoomActivationString, L"SN5631") == 0 ) || ( wcscmp(pPlayerBriefingRoomActivationString, L"sn5631") == 0 ) ) ) //&&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) + { + + //bEncyclopediaLocation = FALSE; + //bEncyclopediaCharacter = FALSE; + //bEncyclopediaInventory = FALSE; + //bEncyclopediaQuests = FALSE; + //bBriefingRoom = FALSE; + //bBriefingRoomSpecialMission = TRUE; + + ResetTemp(); + CopyToTemp (gBriefingRoomData, TRUE, 0 , -1, FALSE ); + + if(!fFirstTimeInBriefingRoom) guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; + + // DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_MAX_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + + return; +} + +void ResetActivationBriefingRoomStringTextBox(void) +{ + // Reset activation text box + for (int i = 0; i < iStringBriefingRoomPos; i++) + { + pPlayerBriefingRoomActivationString[i] = 0; + } + + iStringBriefingRoomPos = 0; + + uiCursorBriefingRoomPosition = StringPixLength( pPlayerBriefingRoomActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + DisplayPlayerActivationBriefingRoomString(); + DisplayActivationBriefingRoomStringCursor(); +} \ No newline at end of file diff --git a/Laptop/BriefingRoom.h b/Laptop/BriefingRoom.h new file mode 100644 index 00000000..b64ea822 --- /dev/null +++ b/Laptop/BriefingRoom.h @@ -0,0 +1,20 @@ +#ifndef __BRIEFINGROOM_H +#define __BRIEFINGROOM_H + +#include "Cursors.h" +#include "soldier profile type.h" + +void GameInitBriefingRoom(); +BOOLEAN EnterBriefingRoom(); +void ExitBriefingRoom(); +void HandleBriefingRoom(); +void RenderBriefingRoom(); + +BOOLEAN RemoveBriefingRoomDefaults(); +BOOLEAN InitBriefingRoomDefaults(); +BOOLEAN DrawBriefingRoomDefaults(); + +BOOLEAN DisplayBriefingRoomSlogan(); +BOOLEAN DisplayBriefingRoomCopyright(); + +#endif \ No newline at end of file diff --git a/Laptop/BriefingRoomM.cpp b/Laptop/BriefingRoomM.cpp new file mode 100644 index 00000000..45b87f8d --- /dev/null +++ b/Laptop/BriefingRoomM.cpp @@ -0,0 +1,665 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "Laptop All.h" + #include "Utilities.h" + #include "WCheck.h" + #include "timer control.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Encrypted File.h" + #include "email.h" + #include "Game Clock.h" + #include "Text.h" + #include "LaptopSave.h" + #include "Multi Language Graphic Utils.h" + #include "soldier profile type.h" +#endif + +#include "Encyclopedia_Data.h" +#include "Encyclopedia.h" +#include "BriefingRoomM.h" + +// Link Images +#define BRIEFINGROOM_MISSION_BUTTON_SIZE_X 121 +#define BRIEFINGROOM_MISSION_BUTTON_SIZE_Y 42 + +#define BRIEFINGROOM_MISSION_COPYRIGHT_X iScreenWidthOffset + 160 +#define BRIEFINGROOM_MISSION_COPYRIGHT_Y iScreenHeightOffset + 415 // + LAPTOP_SCREEN_WEB_DELTA_Y +#define BRIEFINGROOM_MISSION_COPYRIGHT_WIDTH 400 +#define BRIEFINGROOM_MISSION_COPYRIGHT_GAP 9 + +#define IMAGE_OFFSET_X LAPTOP_SCREEN_UL_X +#define IMAGE_OFFSET_Y LAPTOP_SCREEN_WEB_UL_Y + + +//262, 28 + +// RustBackGround +#define RUSTBACKGROUND_SIZE_X 125 +#define RUSTBACKGROUND_SIZE_Y 100 + +#define RUSTBACKGROUND_1_X IMAGE_OFFSET_X +#define RUSTBACKGROUND_1_Y IMAGE_OFFSET_Y + +#define BRIEFINGROOM_MISSION_FONT12ARIAL FONT12ARIAL +#define BRIEFINGROOM_MISSION_FONT_MCOLOR_WHITE FONT_MCOLOR_WHITE + +#define BRIEFINGROOM_MISSION_BUTTONS_DEF 1 +#define BRIEFINGROOM_MISSION_SUBTITLE_Y iScreenHeightOffset + 150 + LAPTOP_SCREEN_WEB_DELTA_Y +#define BRIEFINGROOM_MISSION_CONTENTBUTTON_X iScreenWidthOffset + 259 +#define BRIEFINGROOM_MISSION_CONTENTBUTTON_Y BRIEFINGROOM_MISSION_SUBTITLE_Y +#define BRIEFINGROOM_MISSION_TOC_X BRIEFINGROOM_MISSION_CONTENTBUTTON_X +#define BRIEFINGROOM_MISSION_TOC_Y 5 +#define BRIEFINGROOM_MISSION_TOC_GAP_Y 25 + +#define BRIEFINGROOM_MISSION_LOCATION_BOX_X LAPTOP_SCREEN_UL_X + (500-BRIEFINGROOM_MISSION_LOCATION_BOX_WIDTH)/2 +#define BRIEFINGROOM_MISSION_LOCATION_BOX_Y iScreenHeightOffset + 260 + LAPTOP_SCREEN_WEB_DELTA_Y +#define EBRIEFINGROOM_MISSION_LOCATION_BOX_SHADOW_GAP 4 +#define BRIEFINGROOM_MISSION_LOCATION_BOX_WIDTH 400//309 +#define BRIEFINGROOM_MISSION_LOCATION_BOX_SHADOW_GAP 4 + +#define BRIEFINGROOM_MISSION_BOX_FONT FONT10ARIAL +#define BRIEFINGROOM_MISSION_BOX_COLOR FONT_MCOLOR_WHITE +#define BRIEFINGROOM_MISSION_PAGE_FONT FONT10ARIAL +#define BRIEFINGROOM_MISSION_BOX_X LAPTOP_SCREEN_UL_X + (500-BRIEFINGROOM_MISSION_BOX_WIDTH)/2 +#define BRIEFINGROOM_MISSION_BOX_Y iScreenHeightOffset + 260 + LAPTOP_SCREEN_WEB_DELTA_Y +#define BRIEFINGROOM_MISSION_BOX_WIDTH 400 +#define BRIEFINGROOM_MISSION_BOX_TEXT_WIDTH 250 +#define BRIEFINGROOM_MISSION_BOX_DESC_X BRIEFINGROOM_MISSION_BOX_X + 8 +#define BRIEFINGROOM_MISSION_BOX_DESC_Y BRIEFINGROOM_MISSION_PANEL_Y + BRIEFINGROOM_MISSION_PANEL_HEIGHT + 5 +#define BRIEFINGROOM_MISSION_PANEL_HEIGHT 0 +#define BRIEFINGROOM_MISSION_PANEL_Y BRIEFINGROOM_MISSION_BOX_Y + 6 + +UINT32 guiRustBriefingRoomEnterBackGround; +UINT32 guiRustBriefingRoomEnterLogoAim; + +MOUSE_REGION gSelectedBriefingRoomEnterTocMenuRegion[ 6 ]; +UINT32 guiContentButtonBriefingRoomEnter; + +UINT32 guiBRIEFINGROOM_MISSIONACTIVATIONINDENT; + +void SelectBriefingRoomEnterLocationButton(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectBriefingRoomEnterCharacterButton(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectBriefingRoomEnterQuestsButton(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectBriefingRoomEnterInentoryButton(MOUSE_REGION * pRegion, INT32 iReason ); + +void LaptopInitBriefingRoomEnter(); + +BOOLEAN fFirstTimeInBriefingRoomEnter = TRUE; + +BOOLEAN DrawBriefingRoomEnterLogoAim(); + +//------------ +void DisplayPlayerActivationBriefingRoomEnterString( void ); +void ProcessPlayerInputActivationBriefingRoomEnterString( void ); +void GetPlayerKeyBoardInputForBriefingRoomEnterHomePage( void ); +void HandleBriefingRoomEnterTextEvent( UINT32 uiKey ); +void DisplayActivationBriefingRoomEnterStringCursor( void ); + +INT32 BriefingRoomEnterGlowColorsList[][3] ={ + { 0,0,0 }, + { 0,25,0 }, + { 0,50,0 }, + { 0,75,0 }, + { 0,100,0 }, + { 0,125,0 }, + { 0,150,0 }, + { 0,175,0 }, + { 0,200,0 }, + { 0,225,0 }, + { 0,255,0 }, +}; + +// btn callbacks +void BtnBriefingRoomEnterAboutUsCallback(GUI_BUTTON *btn,INT32 reason); + +void ResetActivationBriefingRoomEnterStringTextBox(void); + +// position defines +#define IMP_PLAYER_ACTIVATION_STRING_X LAPTOP_SCREEN_UL_X + 103//261 +#define IMP_PLAYER_ACTIVATION_STRING_Y LAPTOP_SCREEN_WEB_UL_Y + 246 //336 +#define CURSOR_Y IMP_PLAYER_ACTIVATION_STRING_Y - 5 +#define CURSOR_HEIGHT GetFontHeight( FONT14ARIAL ) + 6 + + +// the player activation string +CHAR16 pPlayerBriefingRoomEnterActivationString[32]; + +// position within player activation string +INT32 iStringBriefingRoomEnterPos = 0; +UINT16 uiCursorBriefingRoomEnterPosition = IMP_PLAYER_ACTIVATION_STRING_X; + + +// has a new char been added or deleted? +BOOLEAN fNewCharInActivationBriefingRoomEnterString = FALSE; +//------------ + +void GameInitBriefingRoomEnter() +{ + LaptopInitBriefingRoomEnter(); +} + +BOOLEAN EnterBriefingRoomEnter() +{ + VOBJECT_DESC VObjectDesc; + UINT16 i, usPosY; + + //----------------------------------------- + // upon entry to Imp home page + memset(pPlayerBriefingRoomEnterActivationString, 0, sizeof(pPlayerBriefingRoomEnterActivationString)); + + // reset string position + iStringBriefingRoomEnterPos =0; + + // reset activation cursor position + uiCursorBriefingRoomEnterPosition = IMP_PLAYER_ACTIVATION_STRING_X; + + // we have now vsisited IMP, reset fact we haven't + fNotVistedImpYet = FALSE; + //------------------------ + + LaptopInitBriefingRoomEnter(); + + InitBriefingRoomEnterDefaults(); + + // load the Rust bacground graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("LAPTOP\\rustbackground.sti", VObjectDesc.ImageFile); + FilenameForBPP("BriefingRoom\\aimlogo.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiRustBriefingRoomEnterLogoAim)); + + // load the MemberShipcard graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("BriefingRoom\\BUTTONS.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiContentButtonBriefingRoomEnter)); + + // this procedure will load the activation indent into memory + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ActivationIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBRIEFINGROOM_MISSIONACTIVATIONINDENT)); + + //** Mouse Regions ** + + usPosY = BRIEFINGROOM_MISSION_CONTENTBUTTON_Y + 120; + for(i=0; i 64) + { + iStringBriefingRoomEnterPos = 64; + } + + // restore background + //RenderActivationIndent( 257, 328 ); + // get the video object + GetVideoObject(&hHandle, guiBRIEFINGROOM_MISSIONACTIVATIONINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + 100, LAPTOP_SCREEN_WEB_UL_Y + 240 , VO_BLT_SRCTRANSPARENCY,NULL); + + // setup the font stuff + SetFont( FONT14ARIAL ); + SetFontForeground( 184 ); + SetFontBackground(FONT_BLACK); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerBriefingRoomEnterActivationString); + + + fNewCharInActivationBriefingRoomEnterString = FALSE; + fReDrawScreenFlag = TRUE; + return; +} + +void DisplayActivationBriefingRoomEnterStringCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + UINT8 *pDestBuf; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + + // draw line in current state + LineDraw(TRUE, (UINT16) uiCursorBriefingRoomEnterPosition, CURSOR_Y, (UINT16)uiCursorBriefingRoomEnterPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( BriefingRoomEnterGlowColorsList[ iCurrentState ][ 0 ], BriefingRoomEnterGlowColorsList[ iCurrentState ][ 1 ], BriefingRoomEnterGlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf ); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + + InvalidateRegion((UINT16) uiCursorBriefingRoomEnterPosition , CURSOR_Y , (UINT16)uiCursorBriefingRoomEnterPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1); + + + return; +} + + + +void GetPlayerKeyBoardInputForBriefingRoomEnterHomePage( void ) +{ + InputAtom InputEvent; + POINT MousePos; + + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + + while (DequeueEvent(&InputEvent) == TRUE) + { + // HOOK INTO MOUSE HOOKS + /* + switch(InputEvent.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } +*/ + if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) ) + { + switch( InputEvent.usParam ) + { + case (( ENTER ) ): + if(( InputEvent.usEvent == KEY_UP ) ) + { + // return hit, check to see if current player activation string is a valid one + ProcessPlayerInputActivationBriefingRoomEnterString( ); + + fNewCharInActivationBriefingRoomEnterString = TRUE; + } + break; + case (( ESC )): + HandleLapTopESCKey(); // WANNE: Fix for proper closing of the IMP laptop page + LeaveLapTopScreen( ); + break; + default: + if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT ) + { + HandleBriefingRoomEnterTextEvent( InputEvent.usParam ); + } + break; + } + } + } + + return; +} + + +void HandleBriefingRoomEnterTextEvent( UINT32 uiKey ) +{ + // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen + // or delete it + switch( uiKey ) + { + case ( BACKSPACE ): + + if( iStringBriefingRoomEnterPos >= 0 ) + { + + if( iStringBriefingRoomEnterPos > 0 ) + { + // decrement iStringBriefingRoomEnterPosition + iStringBriefingRoomEnterPos-=1; + } + + // null out char + pPlayerBriefingRoomEnterActivationString[iStringBriefingRoomEnterPos ] = 0; + + // move back cursor + uiCursorBriefingRoomEnterPosition = StringPixLength( pPlayerBriefingRoomEnterActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + + + // string has been altered, redisplay + fNewCharInActivationBriefingRoomEnterString = TRUE; + + } + + break; + + default: + if( uiKey >= 'A' && uiKey <= 'Z' || + uiKey >= 'a' && uiKey <= 'z' || + uiKey >= '0' && uiKey <= '9' || + uiKey == '_' || uiKey == '.' || uiKey ==' ') + { + // if the current string position is at max or great, do nothing + if( iStringBriefingRoomEnterPos >= 8 ) + { + break; + } + else + { + if(iStringBriefingRoomEnterPos < 0 ) + { + iStringBriefingRoomEnterPos = 0; + } + // valid char, capture and convert to CHAR16 + pPlayerBriefingRoomEnterActivationString[iStringBriefingRoomEnterPos] = ( CHAR16 )uiKey; + + // null out next char position + pPlayerBriefingRoomEnterActivationString[iStringBriefingRoomEnterPos + 1] = 0; + + // move cursor position ahead + uiCursorBriefingRoomEnterPosition = StringPixLength( pPlayerBriefingRoomEnterActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + // increment string position + iStringBriefingRoomEnterPos +=1; + + // string has been altered, redisplay + fNewCharInActivationBriefingRoomEnterString = TRUE; + + } + + } + + break; + + } + + + return; +} + +void ProcessPlayerInputActivationBriefingRoomEnterString( void ) +{ + // prcess string to see if it matches activation string + char charPlayerActivationString[32]; + wcstombs(charPlayerActivationString,pPlayerBriefingRoomEnterActivationString,32); + + if( ( ( wcscmp(pPlayerBriefingRoomEnterActivationString, L"SN5631") == 0 ) || ( wcscmp(pPlayerBriefingRoomEnterActivationString, L"sn5631") == 0 ) ) ) //&&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) + { + + /* + bEncyclopediaLocation = FALSE; + bEncyclopediaCharacter = FALSE; + bEncyclopediaInventory = FALSE; + bEncyclopediaQuests = FALSE; + bBriefingRoom = FALSE; + bBriefingRoomSpecialMission = TRUE; + + ResetVal = FALSE; + + IDPageEncyData = PAGEBRIEFINGROOMSPECIALMISSION; + + if(!fFirstTimeInBriefingRoomEnter) guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM; + */ + } + + + return; +} + +void ResetActivationBriefingRoomEnterStringTextBox(void) +{ + // Reset activation text box + for (int i = 0; i < iStringBriefingRoomEnterPos; i++) + { + pPlayerBriefingRoomEnterActivationString[i] = 0; + } + + iStringBriefingRoomEnterPos = 0; + + uiCursorBriefingRoomEnterPosition = StringPixLength( pPlayerBriefingRoomEnterActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + DisplayPlayerActivationBriefingRoomEnterString(); + DisplayActivationBriefingRoomEnterStringCursor(); +} \ No newline at end of file diff --git a/Laptop/BriefingRoomM.h b/Laptop/BriefingRoomM.h new file mode 100644 index 00000000..d223a89a --- /dev/null +++ b/Laptop/BriefingRoomM.h @@ -0,0 +1,20 @@ +#ifndef __BRIEFINGROOMM_H +#define __BRIEFINGROOMM_H + +#include "Cursors.h" +#include "soldier profile type.h" + +void GameInitBriefingRoomEnter(); +BOOLEAN EnterBriefingRoomEnter(); +void ExitBriefingRoomEnter(); +void HandleBriefingRoomEnter(); +void RenderBriefingRoomEnter(); + +BOOLEAN RemoveBriefingRoomEnterDefaults(); +BOOLEAN InitBriefingRoomEnterDefaults(); +BOOLEAN DrawBriefingRoomEnterDefaults(); + +BOOLEAN DisplayBriefingRoomEnterSlogan(); +BOOLEAN DisplayBriefingRoomEnterCopyright(); + +#endif \ No newline at end of file diff --git a/Laptop/Encyclopedia.cpp b/Laptop/Encyclopedia.cpp new file mode 100644 index 00000000..79c3183f --- /dev/null +++ b/Laptop/Encyclopedia.cpp @@ -0,0 +1,390 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "Laptop All.h" + #include "Utilities.h" + #include "WCheck.h" + #include "timer control.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Encrypted File.h" + #include "email.h" + #include "Game Clock.h" + #include "Text.h" + #include "LaptopSave.h" + #include "Multi Language Graphic Utils.h" + #include "soldier profile type.h" +#endif + +#include "Encyclopedia_Data.h" +#include "Encyclopedia.h" + +// Link Images +#define ENCYCLOPEDIA_BUTTON_SIZE_X 205 +#define ENCYCLOPEDIA_BUTTON_SIZE_Y 19 + +#define ENCYCLOPEDIA_COPYRIGHT_X iScreenWidthOffset + 160 +#define ENCYCLOPEDIA_COPYRIGHT_Y iScreenHeightOffset + 415 // + LAPTOP_SCREEN_WEB_DELTA_Y +#define ENCYCLOPEDIA_COPYRIGHT_WIDTH 400 +#define ENCYCLOPEDIA_COPYRIGHT_GAP 9 + +#define IMAGE_OFFSET_X LAPTOP_SCREEN_UL_X +#define IMAGE_OFFSET_Y LAPTOP_SCREEN_WEB_UL_Y + + +//262, 28 + +// RustBackGround +#define RUSTBACKGROUND_SIZE_X 125 +#define RUSTBACKGROUND_SIZE_Y 100 + +#define RUSTBACKGROUND_1_X IMAGE_OFFSET_X +#define RUSTBACKGROUND_1_Y IMAGE_OFFSET_Y + +#define ENCYCLOPEDIA_FONT12ARIAL FONT12ARIAL +#define ENCYCLOPEDIA_FONT_MCOLOR_WHITE FONT_MCOLOR_WHITE + +#define ENCYCLOPEDIA_BUTTONS_DEF 4 +#define ENCYCLOPEDIA_SUBTITLE_Y iScreenHeightOffset + 150 + LAPTOP_SCREEN_WEB_DELTA_Y +#define ENCYCLOPEDIA_CONTENTBUTTON_X iScreenWidthOffset + 259 +#define ENCYCLOPEDIA_CONTENTBUTTON_Y ENCYCLOPEDIA_SUBTITLE_Y +#define ENCYCLOPEDIA_TOC_X ENCYCLOPEDIA_CONTENTBUTTON_X +#define ENCYCLOPEDIA_TOC_Y 5 +#define ENCYCLOPEDIA_TOC_GAP_Y 25 + +UINT32 guiRustEncyclopediaBackGround; +UINT32 guiRustEncyclopediaLogoAim; + +MOUSE_REGION gSelectedEncyclopediaTocMenuRegion[ 6 ]; +UINT32 guiContentButtonEncy; + +void SelectEncyclopediaLocationButton(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectEncyclopediaCharacterButton(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectEncyclopediaQuestsButton(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectEncyclopediaInentoryButton(MOUSE_REGION * pRegion, INT32 iReason ); + +void LaptopInitEncyclopedia(); +void InitEncyklopediaBool(); + +BOOLEAN fFirstTimeInEncyclopedia = TRUE; + +BOOLEAN DrawEncyclopediaLogoAim(); + +ENCYCLOPEDIA_LOCATION gEncyclopediaLocationData[ NUM_SECTOR ]; +ENCYCLOPEDIA_LOCATION gEncyclopediaDataTemp[ NUM_MAX_TEMP ]; +ENCYCLOPEDIA_LOCATION gEncyclopediaProfilesData[ NUM_PROFILES ]; +ENCYCLOPEDIA_LOCATION gEncyclopediaInventoryData[ MAXITEMS ]; +ENCYCLOPEDIA_LOCATION gEncyclopediaOldProfilesData[ NUM_PROFILES ]; +ENCYCLOPEDIA_LOCATION gEncyclopediaQuestsData[ MAX_QUESTS ]; +ENCYCLOPEDIA_LOCATION gBriefingRoomData[ NUM_SECTOR ]; +ENCYCLOPEDIA_LOCATION gBriefingRoomSpecialMissionData[ NUM_SECTOR ]; + +BOOLEAN saveEncyclopediaLocationData[ NUM_SECTOR ]; +ENCYCLOPEDIA_PROF_SAVE saveEncyclopediaProfilesData[ NUM_PROFILES ]; +BOOLEAN saveEncyclopediaInventoryData[ MAXITEMS ]; +BOOLEAN saveEncyclopediaOldProfilesData[ NUM_PROFILES ]; +BOOLEAN saveEncyclopediaQuestsData[ MAX_QUESTS ]; +MISSION_SAVE saveBriefingRoomData[ NUM_SECTOR ]; +MISSION_SAVE saveBriefingRoomSpecialMissionData[ NUM_SECTOR ]; + +MISSION_SAVE saveMissionData[ NUM_SECTOR ]; + +void GameInitEncyclopedia() +{ + LaptopInitEncyclopedia(); +} + +BOOLEAN EnterEncyclopedia() +{ + VOBJECT_DESC VObjectDesc; + UINT16 i, usPosY; + + LaptopInitEncyclopedia(); + + InitEncyclopediaDefaults(); + + // load the Rust bacground graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("LAPTOP\\rustbackground.sti", VObjectDesc.ImageFile); + FilenameForBPP("ENCYCLOPEDIA\\encyclopedialogoaim.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiRustEncyclopediaLogoAim)); + + // load the MemberShipcard graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Encyclopedia\\CONTENTBUTTON.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiContentButtonEncy)); + + //** Mouse Regions ** + + usPosY = ENCYCLOPEDIA_CONTENTBUTTON_Y + 120; + for(i=0; i NPC + + Ency[i].subGroup1 = 0; // set none + + if ( CheckNPCIsEPC ( Ency[i].IDProfile ) == TRUE || Ency[i].bvisible == TRUE && gProfilesNPC[ Ency[i].IDProfile ].ProfilId == Ency[i].IDProfile ) + { + Ency[i].subGroup1 = 1; //set EPC + Ency[i].bvisible = TRUE; + } + else if ( CheckNPCIsRPC ( Ency[i].IDProfile ) == TRUE || Ency[i].bvisible == TRUE && gProfilesRPC[ Ency[i].IDProfile ].ProfilId == Ency[i].IDProfile ) + { + Ency[i].subGroup1 = 3; // set RPC + Ency[i].bvisible = TRUE; + } + + /* + else if ( Ency[i].bvisible == FALSE ) + { + Ency[i].subGroup1 = 0; // set none + Ency[i].bvisible = TRUE; + } + */ + + gEncyclopediaDataTemp[MaxLocation].subGroup1 = Ency[i].subGroup1; + } + else if ( bEncyclopediaInventory == TRUE ) + { + gEncyclopediaDataTemp[MaxLocation].subGroup1 = -1; + gEncyclopediaDataTemp[MaxLocation].SectorX = -1; + gEncyclopediaDataTemp[MaxLocation].SectorY = -1; + gEncyclopediaDataTemp[MaxLocation].SectorZ = -1; + Ency[i].SectorX = -1; + Ency[i].SectorY = -1; + Ency[i].SectorZ = -1; + Ency[i].subGroup1 = -1; + Ency[i].IDProfile = -1; + + //Quests + Ency[i].QuestID = -1; + Ency[i].pQuests = -1; + Ency[i].SpecialQuestImage = FALSE; + Ency[i].ImagePositionQX[0] = 0; + Ency[i].ImagePositionQY[0] = 0; + Ency[i].ImagePositionQX[1] = 0; + Ency[i].ImagePositionQY[1] = 0; + + if ( Item[i].usItemClass == IC_GUN ) + { + if (Item[i].newinv && UsingNewInventorySystem() == true ) + { + IDClass = Item[i].ubClassIndex; + Ency[i].LocType = Weapon[IDClass].ubWeaponType; + Ency[i].InventoryClass = Item[i].usItemClass; + } + else + { + IDClass = Item[i].ubClassIndex; + Ency[i].LocType = Weapon[IDClass].ubWeaponType; + Ency[i].InventoryClass = Item[i].usItemClass; + } + } + else if ( Item[i].usItemClass == IC_ARMOUR ) + { + if (Item[i].newinv && UsingNewInventorySystem() == true ) + { + IDClass = Item[i].ubClassIndex; + Ency[i].InventoryClass = Item[i].usItemClass; + Ency[i].LocType = Armour[IDClass].ubArmourClass; + } + else + { + IDClass = Item[i].ubClassIndex; + Ency[i].InventoryClass = Item[i].usItemClass; + Ency[i].LocType = Armour[IDClass].ubArmourClass; + } + } + else if ( Item[i].usItemClass == IC_BLADE || Item[i].usItemClass == IC_THROWING_KNIFE || Item[i].usItemClass == IC_PUNCH || + Item[i].usItemClass == IC_BOMB || Item[i].usItemClass == IC_GRENADE || Item[i].usItemClass == IC_MEDKIT || + Item[i].usItemClass == IC_KIT || Item[i].usItemClass == IC_FACE || Item[i].usItemClass == IC_LBEGEAR || + Item[i].usItemClass == IC_MISC ) + { + if (Item[i].newinv && UsingNewInventorySystem() == true ) + { + //IDClass = Item[i].ubClassIndex; + Ency[i].LocType = Item[i].usItemClass; + Ency[i].InventoryClass = TypFiltr; + } + else + { + //IDClass = Item[i].ubClassIndex; + Ency[i].LocType = Item[i].usItemClass; + Ency[i].InventoryClass = TypFiltr; + } + } + else if ( Item[i].usItemClass == IC_AMMO ) + { + if (Item[i].newinv && UsingNewInventorySystem() == true ) + { + IDClass = Item[i].ubClassIndex; + //Ency[i].LocType = Weapon[IDClass].ubWeaponType; + //Ency[i].InventoryClass = Item[i].usItemClass; + + // Weapon has the correct filter ammo weapon type + // if (Magazine[ Item[ i ].ubClassIndex ].ubCalibre == Weapon[i].ubCalibre) + //{ + //if (Weapon[IDClass].ubWeaponType == sort) + //{ + //Weapon has correct magazine size + //if(Weapon[Item[i].ubClassIndex].ubMagSize == Magazine[Item[i].ubClassIndex].ubMagSize ) + //{ + Ency[i].LocType = Item[i].usItemClass; //Weapon[IDClass].ubWeaponType; + Ency[i].InventoryClass = Item[i].usItemClass; + //} + // } + //} + // IDClass = Item[i].ubClassIndex; + // Ency[i].InventoryClass = Item[i].usItemClass; + // Ency[i].LocType = Magazine[IDClass].ubCalibre; //Armour[IDClass].ubArmourClass; + } + else + { + IDClass = Item[i].ubClassIndex; + Ency[i].LocType = Item[i].usItemClass; //Weapon[IDClass].ubWeaponType; + Ency[i].InventoryClass = Item[i].usItemClass; + } + } + } + + if ( Item[i].usItemClass == IC_NONE || Item[i].usItemClass == IC_TENTACLES ) Ency[i].Hidden = FALSE; + + //if ( Ency[i].Hidden == TRUE && Ency[i].LocType == sort && !bFiltr ) Ency[i].Filtr = FALSE; + //if ( Ency[i].Hidden == TRUE && bFiltr == TRUE && Ency[i].LocType == sort ) Ency[i].Filtr = TRUE; + //if ( Ency[i].LocType == 0 ) Ency[i].Filtr = TRUE; + + if ( Ency[i].Hidden == TRUE ) gEncyclopediaDataTemp[MaxLocation].LocType = Ency[i].LocType; + + if ( Ency[i].Hidden == TRUE && ( Ency[i].LocType == sort || bFiltr == TRUE ) && ( Ency[i].subGroup1 == TypFiltr || Ency[i].InventoryClass == TypFiltr || TypFiltr == NO_FILTR )) //&& Ency[i].Filtr != FALSE ) + { + + bBoxShow = FALSE; + + gEncyclopediaDataTemp[MaxLocation].InventoryClass = Ency[i].InventoryClass; + + gEncyclopediaDataTemp[MaxLocation].enableDesc = Ency[i].enableDesc; + + strncpy(gEncyclopediaDataTemp[MaxLocation].szFile, Ency[i].szFile,MAX_ENCYCLOPEDIA_CHARS); + strncpy(gEncyclopediaDataTemp[MaxLocation].szFile2, Ency[i].szFile2,MAX_ENCYCLOPEDIA_CHARS); + strncpy(gEncyclopediaDataTemp[MaxLocation].szFile3, Ency[i].szFile3,MAX_ENCYCLOPEDIA_CHARS); + strncpy(gEncyclopediaDataTemp[MaxLocation].szFile4, Ency[i].szFile4,MAX_ENCYCLOPEDIA_CHARS); + + strncpy(gEncyclopediaDataTemp[MaxLocation].BeforeImage, Ency[i].BeforeImage,MAX_ENCYCLOPEDIA_CHARS); + strncpy(gEncyclopediaDataTemp[MaxLocation].AfterImage, Ency[i].AfterImage,MAX_ENCYCLOPEDIA_CHARS); + + strncpy(gEncyclopediaDataTemp[MaxLocation].sSounds, Ency[i].sSounds,MAX_ENCYCLOPEDIA_CHARS); + + wcscpy(gEncyclopediaDataTemp[MaxLocation].ImageDescBefore, Ency[i].ImageDescBefore); + wcscpy(gEncyclopediaDataTemp[MaxLocation].ImageDescAfter, Ency[i].ImageDescAfter); + + wcscpy(gEncyclopediaDataTemp[MaxLocation].Name, Ency[i].Name); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc1, Ency[i].sDesc1); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc2, Ency[i].sDesc2); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc3, Ency[i].sDesc3); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc4, Ency[i].sDesc4); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc5, Ency[i].sDesc5); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc6, Ency[i].sDesc6); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc7, Ency[i].sDesc7); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc8, Ency[i].sDesc8); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc9, Ency[i].sDesc9); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc10, Ency[i].sDesc10); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc11, Ency[i].sDesc11); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc12, Ency[i].sDesc12); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc13, Ency[i].sDesc13); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc14, Ency[i].sDesc14); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc15, Ency[i].sDesc15); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc16, Ency[i].sDesc16); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc17, Ency[i].sDesc17); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc18, Ency[i].sDesc18); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc19, Ency[i].sDesc19); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sDesc20, Ency[i].sDesc20); + + wcscpy(gEncyclopediaDataTemp[MaxLocation].sImageDesc1, Ency[i].sImageDesc1); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sImageDesc2, Ency[i].sImageDesc2); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sImageDesc3, Ency[i].sImageDesc3); + wcscpy(gEncyclopediaDataTemp[MaxLocation].sImageDesc4, Ency[i].sImageDesc4); + + gEncyclopediaDataTemp[MaxLocation].sImagePositionX[0] = Ency[i].sImagePositionX[0]; + gEncyclopediaDataTemp[MaxLocation].sImagePositionY[0] = Ency[i].sImagePositionY[0]; + + gEncyclopediaDataTemp[MaxLocation].sImagePositionX[1] = Ency[i].sImagePositionX[1]; + gEncyclopediaDataTemp[MaxLocation].sImagePositionY[1] = Ency[i].sImagePositionY[1]; + + gEncyclopediaDataTemp[MaxLocation].sImagePositionX[2] = Ency[i].sImagePositionX[2]; + gEncyclopediaDataTemp[MaxLocation].sImagePositionY[2] = Ency[i].sImagePositionY[2]; + + gEncyclopediaDataTemp[MaxLocation].sImagePositionX[3] = Ency[i].sImagePositionX[3]; + gEncyclopediaDataTemp[MaxLocation].sImagePositionY[3] = Ency[i].sImagePositionY[3]; + + gEncyclopediaDataTemp[MaxLocation].Filtr = Ency[i].Filtr; + // Ency[i].Filtr = FALSE; + + //if ( bEncyclopediaCharacter == FALSE ) + + gEncyclopediaDataTemp[MaxLocation].bvisible = Ency[i].bvisible; + gEncyclopediaDataTemp[MaxLocation].Hidden = Ency[i].Hidden; + + //Quests + gEncyclopediaDataTemp[MaxLocation].QuestID = Ency[i].QuestID; + gEncyclopediaDataTemp[MaxLocation].pQuests = Ency[i].pQuests; + gEncyclopediaDataTemp[MaxLocation].SpecialQuestImage = Ency[i].SpecialQuestImage; + gEncyclopediaDataTemp[MaxLocation].ImagePositionQX[0] = Ency[i].ImagePositionQX[0]; + gEncyclopediaDataTemp[MaxLocation].ImagePositionQY[0] = Ency[i].ImagePositionQY[0]; + gEncyclopediaDataTemp[MaxLocation].ImagePositionQX[1] = Ency[i].ImagePositionQX[1]; + gEncyclopediaDataTemp[MaxLocation].ImagePositionQY[1] = Ency[i].ImagePositionQY[1]; + + if ( gEncyclopediaDataTemp[MaxLocation].SpecialQuestImage == TRUE ) + gEncyclopediaDataTemp[MaxLocation].MaxImages = 0; + else + gEncyclopediaDataTemp[MaxLocation].MaxImages = Ency[i].MaxImages; + + gEncyclopediaDataTemp[MaxLocation].MaxPages = Ency[i].MaxPages; + + //Profiles + if ( bEncyclopediaLocation == TRUE ) + { + gEncyclopediaDataTemp[MaxLocation].SectorX = Ency[i].SectorX; + gEncyclopediaDataTemp[MaxLocation].SectorY = Ency[i].SectorY; + gEncyclopediaDataTemp[MaxLocation].SectorZ = Ency[i].SectorZ; + } + else if ( bEncyclopediaCharacter == TRUE ) + { + gEncyclopediaDataTemp[MaxLocation].IDProfile = Ency[i].IDProfile; //Ency[i].uiIndex; + } + MaxLocation++; + + } + } + + if ( bBoxShow == TRUE && ShowBox == TRUE ) + { + ResetVal = TRUE; + //DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, pSectorPageText[ 4 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } +} +/* +void InitLocationFiltrButtons() +{ + guiEncyclopediaToggles[ 0 ] = CreateCheckBoxButton( LAPTOP_SCREEN_UL_X + 15, LAPTOP_SCREEN_WEB_UL_Y + 250, + "INTERFACE\\OptionsCheckBoxes_12x12.sti", + MSYS_PRIORITY_HIGH+10, + BtnEncyclopediaTogglesCallback ); + MSYS_SetBtnUserData( guiEncyclopediaToggles[ 0 ], 0, 0 ); + + guiEncyclopediaToggles[ 1 ] = CreateCheckBoxButton( LAPTOP_SCREEN_UL_X + 30, LAPTOP_SCREEN_WEB_UL_Y + 250, + "INTERFACE\\OptionsCheckBoxes_12x12.sti", + MSYS_PRIORITY_HIGH+10, + BtnEncyclopediaTogglesCallback ); + MSYS_SetBtnUserData( guiEncyclopediaToggles[ 1 ], 0, 1 ); + + guiEncyclopediaToggles[ 2 ] = CreateCheckBoxButton( LAPTOP_SCREEN_UL_X + 15, LAPTOP_SCREEN_WEB_UL_Y + 264, + "INTERFACE\\OptionsCheckBoxes_12x12.sti", + MSYS_PRIORITY_HIGH+10, + BtnEncyclopediaTogglesCallback ); + MSYS_SetBtnUserData( guiEncyclopediaToggles[ 2 ], 0, 2 ); + + guiEncyclopediaToggles[ 3 ] = CreateCheckBoxButton( LAPTOP_SCREEN_UL_X + 30, LAPTOP_SCREEN_WEB_UL_Y + 264, + "INTERFACE\\OptionsCheckBoxes_12x12.sti", + MSYS_PRIORITY_HIGH+10, + BtnEncyclopediaTogglesCallback ); + MSYS_SetBtnUserData( guiEncyclopediaToggles[ 3 ], 0, 3 ); + + SetRegionFastHelpText( &gSelectedEncyclopediaTextRegion[ 0 ], pEncyclopediaHelpText[LOCATION_CITIES] ); + SetButtonFastHelpText( guiEncyclopediaToggles[ 0 ], pEncyclopediaHelpText[LOCATION_CITIES] ); + + SetRegionFastHelpText( &gSelectedEncyclopediaTextRegion[ 1 ], pEncyclopediaHelpText[LOCATION_SAM] ); + SetButtonFastHelpText( guiEncyclopediaToggles[ 1 ], pEncyclopediaHelpText[LOCATION_SAM] ); + + SetRegionFastHelpText( &gSelectedEncyclopediaTextRegion[ 2 ], pEncyclopediaHelpText[LOCATION_OTHER] ); + SetButtonFastHelpText( guiEncyclopediaToggles[ 2 ], pEncyclopediaHelpText[LOCATION_OTHER] ); + + SetRegionFastHelpText( &gSelectedEncyclopediaTextRegion[ 3 ], pEncyclopediaHelpText[LOCATION_MINES] ); + SetButtonFastHelpText( guiEncyclopediaToggles[ 3 ], pEncyclopediaHelpText[LOCATION_MINES] ); + +} +*/ + +void InitSoundButtons() +{ + UINT16 usPosY, i; + guiSoundButtonsImage = LoadButtonImage("BriefingRoom\\BUTTONF.sti", -1,0,-1,1,-1 ); + + usPosY = ENCYCLOPEDIA_LOCATION_PAGE1_X+15; + for(i=0; i 4 ) + strcpy(fileName, gEncyclopediaDataTemp[LocationID].szFile); + + if (IDimage == -1 || IDimage > 4 ) IDimage = 1; + + if ( IDimage > 0 && gEncyclopediaDataTemp[LocationID].MaxImages != -1 && (bEncyclopediaLocation == TRUE || bEncyclopediaCharacter == TRUE || bEncyclopediaInventory == TRUE || bEncyclopediaQuests == TRUE || bBriefingRoom == TRUE || bBriefingRoomSpecialMission == TRUE ) ) + { + strcpy(VObjectDesc.ImageFile, fileName); + CHECKF(AddVideoObject(&VObjectDesc,&gEncyclopediaDataTemp[LocationID].uiIndex)); + //BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_LOCATION_BOX_X + 50 , ENCYCLOPEDIA_LOCATION_BOX_Y - 210, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_IMAGE_X + gEncyclopediaDataTemp[LocationID].sImagePositionX[IDimage-1] , ENCYCLOPEDIA_IMAGE_Y + gEncyclopediaDataTemp[LocationID].sImagePositionY[IDimage-1], VO_BLT_SRCTRANSPARENCY, NULL ); + } + + } + + if ( gEncyclopediaDataTemp[LocationID].SpecialQuestImage == TRUE && bEncyclopediaQuests == TRUE && gubQuest[ gEncyclopediaDataTemp[ LocationID ].QuestID ] == QUESTINPROGRESS ) + { + strcpy(fileName, gEncyclopediaDataTemp[LocationID].BeforeImage); + strcpy(VObjectDesc.ImageFile, fileName); + CHECKF(AddVideoObject(&VObjectDesc,&gEncyclopediaDataTemp[LocationID].uiIndex)); + //BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_LOCATION_BOX_X + 50 , ENCYCLOPEDIA_LOCATION_BOX_Y - 210, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_IMAGE_X + gEncyclopediaDataTemp[LocationID].ImagePositionQX[0] , ENCYCLOPEDIA_IMAGE_Y + gEncyclopediaDataTemp[LocationID].ImagePositionQY[0], VO_BLT_SRCTRANSPARENCY, NULL ); + } + else if ( gEncyclopediaDataTemp[LocationID].SpecialQuestImage == TRUE && gubQuest[ gEncyclopediaDataTemp[ LocationID ].QuestID ] == QUESTDONE ) + { + strcpy(fileName, gEncyclopediaDataTemp[LocationID].AfterImage); + strcpy(VObjectDesc.ImageFile, fileName); + CHECKF(AddVideoObject(&VObjectDesc,&gEncyclopediaDataTemp[LocationID].uiIndex)); + //BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_LOCATION_BOX_X + 50 , ENCYCLOPEDIA_LOCATION_BOX_Y - 210, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_IMAGE_X + gEncyclopediaDataTemp[LocationID].ImagePositionQX[1] , ENCYCLOPEDIA_IMAGE_Y + gEncyclopediaDataTemp[LocationID].ImagePositionQY[1], VO_BLT_SRCTRANSPARENCY, NULL ); + } + /* + else if ( gEncyclopediaDataTemp[LocationID].MaxImages != -10 && bEncyclopediaCharacter == TRUE ) + { + strcpy(VObjectDesc.ImageFile, fileName); + CHECKF(AddVideoObject(&VObjectDesc,&gEncyclopediaDataTemp[LocationID].uiIndex)); + BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_IMAGE_X + gEncyclopediaDataTemp[LocationID].sImagePositionX[IDimage] , ENCYCLOPEDIA_IMAGE_Y + gEncyclopediaDataTemp[LocationID].sImagePositionY[IDimage], VO_BLT_SRCTRANSPARENCY, NULL ); + // BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_LOCATION_BOX_X + 150 , ENCYCLOPEDIA_LOCATION_BOX_Y - 190, VO_BLT_SRCTRANSPARENCY, NULL ); + } + else if ( gEncyclopediaDataTemp[LocationID].MaxImages != -10 && bEncyclopediaInventory == TRUE ) + { + strcpy(VObjectDesc.ImageFile, fileName); + CHECKF(AddVideoObject(&VObjectDesc,&gEncyclopediaDataTemp[LocationID].uiIndex)); + BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_IMAGE_X + gEncyclopediaDataTemp[LocationID].sImagePositionX[IDimage] , ENCYCLOPEDIA_IMAGE_Y + gEncyclopediaDataTemp[LocationID].sImagePositionY[IDimage], VO_BLT_SRCTRANSPARENCY, NULL ); + // BltVideoObjectFromIndex( FRAME_BUFFER, gEncyclopediaDataTemp[LocationID].uiIndex, 0 , ENCYCLOPEDIA_LOCATION_BOX_X + 150 , ENCYCLOPEDIA_LOCATION_BOX_Y - 190, VO_BLT_SRCTRANSPARENCY, NULL ); + } + */ + return(TRUE); +} + +void RenderEncyclopediaLocation( BOOLEAN bHidden ) +{ + UINT16 i; + UINT8 ubNumLines=11; + UINT16 usPosY; + //UINT8 ubFontHeight; + UINT16 usStringPixLength; + CHAR16 zString[512]; + CHAR16 zString2[512]; + + DrawEncyclopediaDefaults(); + + DisplayEncyclopediaLocationText(); + + //ubFontHeight = (UINT8)GetFontHeight(ENCYCLOPEDIA_LOCATION_BOX_FONT); + + ENCYCLOPEDIA_PAGE = gEncyclopediaDataTemp[LocationID].MaxPages-1; + + MaxImages = gEncyclopediaDataTemp[LocationID].MaxImages;//-1; + + //Location name + if (bEncyclopediaLocation == TRUE && ResetVal == FALSE)//&& gEncyclopediaDataTemp[LocationID].SectorY != -1 || gEncyclopediaDataTemp[LocationID].SectorX != -1 || gEncyclopediaDataTemp[LocationID].SectorZ != -1 ) + { + swprintf( zString, L" ( %c%d )", 'A' + gEncyclopediaDataTemp[LocationID].SectorY - 1, gEncyclopediaDataTemp[LocationID].SectorX ); + wcscpy( zString2,gEncyclopediaDataTemp[LocationID].Name ); + wcscat( zString2,zString ); + } + + //Profile name + if (bEncyclopediaCharacter == TRUE && gEncyclopediaDataTemp[LocationID].IDProfile != -1 && ResetVal == FALSE) + { + // if ( gEncyclopediaDataTemp[gEncyclopediaDataTemp[LocationID].IDProfile].Name[0] != 0 ) + ///swprintf( zString, L"%s ( %s )", gMercProfiles[gEncyclopediaDataTemp[LocationID].IDProfile].zName, gMercProfiles[ gEncyclopediaDataTemp[LocationID].IDProfile ].zNickname ); + // swprintf( zString, gEncyclopediaDataTemp[gEncyclopediaDataTemp[LocationID].IDProfile].Name ); + /// else + swprintf( zString, gMercProfiles[gEncyclopediaDataTemp[LocationID].IDProfile].zName ); + wcscpy( zString2,zString ); + } + + //Inventory name + if ( bEncyclopediaInventory == TRUE || bBriefingRoom == TRUE || bEncyclopediaQuests == TRUE || bBriefingRoomSpecialMission == TRUE && ResetVal == FALSE ) + { + swprintf( zString, gEncyclopediaDataTemp[LocationID].Name ); + wcscpy( zString2,zString ); + } + + ShadowVideoSurfaceRect( FRAME_BUFFER, ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, ENCYCLOPEDIA_LOCATION_BOX_Y + 13 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 227 , ENCYCLOPEDIA_LOCATION_BOX_X + ENCYCLOPEDIA_LOCATION_BOX_WIDTH + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, ENCYCLOPEDIA_LOCATION_BOX_Y + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP-42); + + ShadowVideoSurfaceRect( FRAME_BUFFER, ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, ENCYCLOPEDIA_LOCATION_BOX_Y + 13 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50 , ENCYCLOPEDIA_LOCATION_BOX_X + ENCYCLOPEDIA_LOCATION_BOX_WIDTH + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, ENCYCLOPEDIA_LOCATION_BOX_Y + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP-20); + + + //Location name + if (bEncyclopediaLocation == TRUE && ResetVal == FALSE) //&& gEncyclopediaDataTemp[LocationID].IDProfile != -1 ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X, ENCYCLOPEDIA_LOCATION_BOX_Y-225, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, FONT14ARIAL, ENCYCLOPEDIA_LOCATION_BOX_COLOR, zString2, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Inventory name + if (bEncyclopediaInventory == TRUE || bBriefingRoom == TRUE || bEncyclopediaQuests == TRUE && ResetVal == FALSE ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X, ENCYCLOPEDIA_LOCATION_BOX_Y-225, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, FONT14ARIAL, ENCYCLOPEDIA_LOCATION_BOX_COLOR, zString2, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Profile name + if ( bEncyclopediaCharacter == TRUE && ResetVal == FALSE ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X, ENCYCLOPEDIA_LOCATION_BOX_Y-225, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, FONT14ARIAL, ENCYCLOPEDIA_LOCATION_BOX_COLOR, zString2, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Reset + if ( ResetVal == TRUE ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X, ENCYCLOPEDIA_LOCATION_BOX_Y-225, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, FONT14ARIAL, ENCYCLOPEDIA_LOCATION_BOX_COLOR, pSectorPageText[ 4 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + /* + //Type + if ( bEncyclopediaInventory == TRUE && bEncyclopediaLocation == FALSE ) + { + //Guns + if ( gEncyclopediaDataTemp[LocationID].LocType == NOT_GUN ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[0] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_PISTOL ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[1] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_M_PISTOL ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[2] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_SMG ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[3] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_RIFLE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[4] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_SN_RIFLE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[5] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_AS_RIFLE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[6] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_LMG ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[7] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == GUN_SHOTGUN ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[8] ); + //Armour + else if ( gEncyclopediaDataTemp[LocationID].LocType == ARMOURCLASS_HELMET ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[21] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == ARMOURCLASS_VEST ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[22] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == ARMOURCLASS_LEGGINGS ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[23] ); + else if ( gEncyclopediaDataTemp[LocationID].LocType == ARMOURCLASS_PLATE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[24] ); + //Misc + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_BLADE && gEncyclopediaDataTemp[LocationID].LocType == IC_BLADE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[25] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_THROWING_KNIFE && gEncyclopediaDataTemp[LocationID].LocType == IC_THROWING_KNIFE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[26] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_PUNCH ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[27] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_GRENADE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[28] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_BOMB ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[29] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_MEDKIT ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[30] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_KIT ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[31] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_FACE ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[32] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_LBEGEAR ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[33] ); + else if ( gEncyclopediaDataTemp[LocationID].InventoryClass == IC_MISC ) swprintf( zString, L"%s %s", pSectorPageText[3],BobbyRFilter[34] ); + else swprintf( zString, L"%s ---", pSectorPageText[3] ); + + wcscpy( zString2,zString ); + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 65, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, zString2, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + } + */ + + if ( bEncyclopediaLocation == TRUE && ResetVal == FALSE) + { + swprintf( zString, L"%s %s", pSectorPageText[3],pEncyclopediaTypeText[gEncyclopediaDataTemp[LocationID].LocType] ); + wcscpy( zString2,zString ); + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 65, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, zString2, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + } + + //Reset + if ( ResetVal == TRUE ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 65, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, L"", FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + + if ( gEncyclopediaDataTemp[LocationID].SpecialQuestImage == FALSE && ResetVal == FALSE) + { + + if ( IDimage == 1 ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sImageDesc1, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if (IDimage == 2 && gEncyclopediaDataTemp[LocationID].sImageDesc2 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sImageDesc2, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if (IDimage == 3 && gEncyclopediaDataTemp[LocationID].sImageDesc3 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sImageDesc3, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if (IDimage == 4 && gEncyclopediaDataTemp[LocationID].sImageDesc4 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sImageDesc4, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + } + + if ( ResetVal == FALSE && gEncyclopediaDataTemp[LocationID].SpecialQuestImage == TRUE && gubQuest[ gEncyclopediaDataTemp[ LocationID ].QuestID ] == QUESTINPROGRESS ) + { + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].ImageDescBefore, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + else if ( gEncyclopediaDataTemp[LocationID].SpecialQuestImage == TRUE && gubQuest[ gEncyclopediaDataTemp[ LocationID ].QuestID ] == QUESTDONE ) + { + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].ImageDescAfter, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + //Reset + if ( ResetVal == TRUE ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP + 3, ENCYCLOPEDIA_LOCATION_BOX_Y + 18 + ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP - 50, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, L"", FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + if ( ID == 0 ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc1, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 1 && gEncyclopediaDataTemp[LocationID].sDesc2 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc2, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 2 && gEncyclopediaDataTemp[LocationID].sDesc3 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc3, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 3 && gEncyclopediaDataTemp[LocationID].sDesc4 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc4, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 4 && gEncyclopediaDataTemp[LocationID].sDesc5 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc5, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 5 && gEncyclopediaDataTemp[LocationID].sDesc6 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc6, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 6 && gEncyclopediaDataTemp[LocationID].sDesc7 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc7, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 7 && gEncyclopediaDataTemp[LocationID].sDesc8 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc8, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 8 && gEncyclopediaDataTemp[LocationID].sDesc9 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc9, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 9 && gEncyclopediaDataTemp[LocationID].sDesc10 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc10, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 10 && gEncyclopediaDataTemp[LocationID].sDesc11 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc11, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 11 && gEncyclopediaDataTemp[LocationID].sDesc12 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc12, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 12 && gEncyclopediaDataTemp[LocationID].sDesc13 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc13, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 13 && gEncyclopediaDataTemp[LocationID].sDesc14 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc14, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 14 && gEncyclopediaDataTemp[LocationID].sDesc15 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc15, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 15 && gEncyclopediaDataTemp[LocationID].sDesc16 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc16, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 16 && gEncyclopediaDataTemp[LocationID].sDesc17 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc17, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 17 && gEncyclopediaDataTemp[LocationID].sDesc18 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc18, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 18 && gEncyclopediaDataTemp[LocationID].sDesc19 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc19, ENCYCLOPEDIA_LOCATION_BOX_FONT); + else if (ID == 19 && gEncyclopediaDataTemp[LocationID].sDesc20 != '\0' ) + usStringPixLength = StringPixLength( gEncyclopediaDataTemp[LocationID].sDesc20, ENCYCLOPEDIA_LOCATION_BOX_FONT); + + //reset + if ( ResetVal == TRUE ) + usStringPixLength = StringPixLength( L"", ENCYCLOPEDIA_LOCATION_BOX_FONT); + + usPosY = ENCYCLOPEDIA_LOCATION_BOX_Y + 13; + + //draw top line of the popup background + ShadowVideoSurfaceRect( FRAME_BUFFER, ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, usPosY+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, ENCYCLOPEDIA_LOCATION_BOX_X + ENCYCLOPEDIA_LOCATION_BOX_WIDTH+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, usPosY + ENCYCLOPEDIA_LOCATION_BOX_SECTION_HEIGHT+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP-1); + + //draw mid section of the popup background + usPosY += ENCYCLOPEDIA_LOCATION_BOX_SECTION_HEIGHT; + for(i=0; i< 10; i++) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, ENCYCLOPEDIA_LOCATION_BOX_X+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, usPosY+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, ENCYCLOPEDIA_LOCATION_BOX_X + ENCYCLOPEDIA_LOCATION_BOX_WIDTH+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP, usPosY + ENCYCLOPEDIA_LOCATION_BOX_SECTION_HEIGHT+ENCYCLOPEDIA_LOCATION_BOX_SHADOW_GAP-1); + usPosY += ENCYCLOPEDIA_LOCATION_BOX_SECTION_HEIGHT; + } + + if ( ResetVal == FALSE ) { + if (ID == 0 ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc1, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 1 && gEncyclopediaDataTemp[LocationID].sDesc2 != '\0') + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc2, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 2 && gEncyclopediaDataTemp[LocationID].sDesc3 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc3, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 3 && gEncyclopediaDataTemp[LocationID].sDesc4 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc4, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 4 && gEncyclopediaDataTemp[LocationID].sDesc5 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc5, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 5 && gEncyclopediaDataTemp[LocationID].sDesc6 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc6, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 6 && gEncyclopediaDataTemp[LocationID].sDesc7 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc7, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 7 && gEncyclopediaDataTemp[LocationID].sDesc8 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc8, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 8 && gEncyclopediaDataTemp[LocationID].sDesc9 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc9, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 9 && gEncyclopediaDataTemp[LocationID].sDesc10 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc10, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 10 && gEncyclopediaDataTemp[LocationID].sDesc11 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc11, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 11 && gEncyclopediaDataTemp[LocationID].sDesc12 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc12, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 12 && gEncyclopediaDataTemp[LocationID].sDesc13 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc13, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 13 && gEncyclopediaDataTemp[LocationID].sDesc14 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc14, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 14 && gEncyclopediaDataTemp[LocationID].sDesc15 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc15, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 15 && gEncyclopediaDataTemp[LocationID].sDesc16 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc16, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 16 && gEncyclopediaDataTemp[LocationID].sDesc17 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc17, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 17 && gEncyclopediaDataTemp[LocationID].sDesc18 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc18, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 18 && gEncyclopediaDataTemp[LocationID].sDesc19 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc19, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else if ( ID == 19 && gEncyclopediaDataTemp[LocationID].sDesc20 != '\0' ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, gEncyclopediaDataTemp[LocationID].sDesc20, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + //Reset + if ( ResetVal == TRUE ) + DisplayWrappedString(ENCYCLOPEDIA_LOCATION_BOX_DESC_X, ENCYCLOPEDIA_LOCATION_BOX_DESC_Y + 13, ENCYCLOPEDIA_LOCATION_BOX_TEXT_WIDTH, 6, ENCYCLOPEDIA_LOCATION_BOX_FONT, ENCYCLOPEDIA_LOCATION_BOX_COLOR, L"", FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + + if ( ENCYCLOPEDIA_PAGE == -1 || ENCYCLOPEDIA_PAGE == 0 ) + RenderButtonDisabled4(); + + if ( bHidden == TRUE && ( MaxImages == 0 || MaxImages == -1 || MaxImages == 1 ) ) //|| gEncyclopediaDataTemp[0].MaxImages == 1 ) ) + DisableButton( guiEncyclopediaPageButton[1] ); + else if ( bHidden == FALSE && MaxImages > 1 ) + EnableButton( guiEncyclopediaPageButton[1] ); + + //Reset + if ( ResetVal == TRUE ) + DisableButton( guiEncyclopediaPageButton[1] ); + + if ( gEncyclopediaDataTemp[LocationID].CheckMission == MISSIONSTART || gEncyclopediaDataTemp[LocationID].CheckMission == MISSIONEND ) + DisableButton ( guiSoundButtons[1] ); + else if ( gEncyclopediaDataTemp[LocationID].CheckMission == MISSIONNOSTARTED ) + EnableButton ( guiSoundButtons[1] ); + + //if ( bRenderFiltrBox == TRUE ) RenderFiltrBox(); + + //if ( ResetVal == TRUE ) + //DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, pSectorPageText[ 4 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + +} + +void SelectEncyclopediaLocationPageRegionCallBack(GUI_BUTTON * btn, INT32 reason ) +{ + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if ( ubRetValue == 2 ) + { + ID++; + + if ( ID == ENCYCLOPEDIA_PAGE || ID > ENCYCLOPEDIA_PAGE ) DisableButton( guiEncyclopediaPageButton[2] ); + if ( ID > 0 ) EnableButton( guiEncyclopediaPageButton[0] ); + + RenderEncyclopediaLocation(FALSE); + RenderMap(); + } + else if ( ubRetValue == 0 ) + { + ID--; + //if ( ID < 0 ) ID = 0; + if ( ID == 0 ) DisableButton( guiEncyclopediaPageButton[0] ); + if ( ID < ENCYCLOPEDIA_PAGE ) EnableButton( guiEncyclopediaPageButton[2] ); + RenderEncyclopediaLocation(FALSE); + RenderMap(); + } + else if ( ubRetValue == 1 ) + { + IDimage++; + + if ( IDimage > MaxImages || IDimage == -1 ) IDimage = 1; + + RenderEncyclopediaLocation(FALSE); + RenderMap(); + } + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + } +} + +void SelectEncyclopediaLocationRegionCallBack(GUI_BUTTON * btn, INT32 reason ) +{ + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + if ( ubRetValue == 2 ) + { + IDNewLocation++; + ID = 0; + + LocationID = IDNewLocation; + + if ( IDNewLocation == MaxLocation - 1 || IDNewLocation == -1 ) DisableButton( guiEncyclopediaLocationPageButton[2] ); + if ( IDNewLocation > 0 ) EnableButton( guiEncyclopediaLocationPageButton[0] ); + + IDimage = 1; + + RenderEncyclopediaLocation(FALSE); + RenderButtonDisabled2(); + + if ( ENCYCLOPEDIA_PAGE == -1 || ENCYCLOPEDIA_PAGE == 0 ) + RenderButtonDisabled4(); + + if ( MaxImages == -1 || MaxImages == 0 || MaxImages == 1 ) + DisableButton( guiEncyclopediaPageButton[1] ); + else + EnableButton( guiEncyclopediaPageButton[1] ); + + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } + + RenderMap(); + + } + else if ( ubRetValue == 0 ) + { + ID = 0; + + IDNewLocation--; + + LocationID = IDNewLocation; + + if ( IDNewLocation == 0 || IDNewLocation == -1 ) DisableButton( guiEncyclopediaLocationPageButton[0] ); + if ( IDNewLocation < MaxLocation-1) EnableButton( guiEncyclopediaLocationPageButton[2] ); + + IDimage = 1; + + RenderEncyclopediaLocation(FALSE); + RenderButtonDisabled2(); + + if ( ENCYCLOPEDIA_PAGE == -1 || ENCYCLOPEDIA_PAGE == 0 ) + RenderButtonDisabled4(); + + if ( MaxImages == -1 || MaxImages == 0 || MaxImages == 1 ) + DisableButton( guiEncyclopediaPageButton[1] ); + else + EnableButton( guiEncyclopediaPageButton[1] ); + + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } + + RenderMap(); + + } + else if ( ubRetValue == 1 ) + { + //ExitEncyclopediaLocation(); + + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } + + if ( bBriefingRoom == TRUE || bBriefingRoomSpecialMission == TRUE ) + { + if(!fFirstTimeInEncyclopediaLocation) guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; + } + else + { + if(!fFirstTimeInEncyclopediaLocation) guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; + } + } + + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + } +} + +void SelectFiltrButtonsRegionCallBack(GUI_BUTTON * btn, INT32 reason ) +{ + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + ResetTemp(); + + if ( bEncyclopediaLocation == TRUE ) + { + if ( ubRetValue == 0 ) + { + CopyToTemp ( gEncyclopediaLocationData, TRUE, NO_FILTR , NO_FILTR, TRUE ); + DisableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 1 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_CITIES , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + DisableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 2 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_SAM , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + DisableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 3 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_OTHER , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + DisableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 4 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_MINES , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + DisableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 5 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_MILITARY , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + DisableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 6 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_LABORATORY , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + DisableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 7 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_FACTORY , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + DisableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 8 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_HOSPITAL , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + DisableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 9 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_PRISON , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + DisableButton( guiFiltrPageButton[9] ); + EnableButton( guiFiltrPageButton[10] ); + } + else if ( ubRetValue == 10 ) + { + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_AIRPORT , NO_FILTR, TRUE ); + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + EnableButton( guiFiltrPageButton[8] ); + EnableButton( guiFiltrPageButton[9] ); + DisableButton( guiFiltrPageButton[10] ); + } + } + else if ( bEncyclopediaCharacter == TRUE ) + { + if ( ubRetValue == 0 ) + { + CopyToTemp ( gEncyclopediaProfilesData, TRUE, NO_FILTR , NO_FILTR, TRUE ); //0 + DisableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 1 ) + { + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_AIM , NO_FILTR, TRUE ); //1 + EnableButton( guiFiltrPageButton[0] ); + DisableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 2 ) + { + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_MERC , NO_FILTR, TRUE ); //2 + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + DisableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 3 ) //NPC - RPC + { + //CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_RPC , NO_FILTR, TRUE ); //3 + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_NPC , PROFIL_RPC, TRUE ); //3 + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + DisableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 4 ) //NPC + { + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_NPC , NO_FILTR, TRUE ); //4 + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + DisableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 5 ) + { + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_VEHICLES , NO_FILTR, TRUE ); //5 + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + DisableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 6 ) + { + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_IMP , NO_FILTR, TRUE ); //5 + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + DisableButton( guiFiltrPageButton[6] ); + EnableButton( guiFiltrPageButton[7] ); + } + else if ( ubRetValue == 7 ) //NPC - EPC + { + CopyToTemp ( gEncyclopediaProfilesData, FALSE, PROFIL_NPC , PROFIL_EPC, TRUE ); //4/1 + EnableButton( guiFiltrPageButton[0] ); + EnableButton( guiFiltrPageButton[1] ); + EnableButton( guiFiltrPageButton[2] ); + EnableButton( guiFiltrPageButton[3] ); + EnableButton( guiFiltrPageButton[4] ); + EnableButton( guiFiltrPageButton[5] ); + EnableButton( guiFiltrPageButton[6] ); + DisableButton( guiFiltrPageButton[7] ); + } + + } + else if ( bEncyclopediaInventory == TRUE ) + { + if ( ubRetValue == 0 ) + { + CopyToTemp ( gEncyclopediaInventoryData, TRUE, NO_FILTR,NO_FILTR, TRUE ); + + + + bRenderFiltrBox[0] = TRUE; + bRenderFiltrBox[1] = TRUE; + bRenderFiltrBox[2] = TRUE; + bRenderFiltrBox[3] = TRUE; + + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + bRenderFiltrBox[0] = FALSE; + bRenderFiltrBox[1] = FALSE; + bRenderFiltrBox[2] = FALSE; + bRenderFiltrBox[3] = FALSE; + + SetFiltrButtons(); + + //RenderFiltrBox(); + //RenderBoxDisabledButton(); + //InitAddInventoryFiltrButtons( 9,0, bRenderFiltrBox[0] ); + + } + else if ( ubRetValue == 1 ) + { + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + bRenderFiltrBox[0] = TRUE; + bRenderFiltrBox[1] = FALSE; + bRenderFiltrBox[2] = FALSE; + bRenderFiltrBox[3] = FALSE; + + SetFiltrButtons(); + + RenderFiltrBox(); + InitAddInventoryFiltrButtons( 9,0, bRenderFiltrBox[0] ); + } + //Ammo + else if ( ubRetValue == 2 ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_AMMO, IC_AMMO, TRUE ); + + bRenderFiltrBox[0] = TRUE; + bRenderFiltrBox[1] = TRUE; + bRenderFiltrBox[2] = TRUE; + bRenderFiltrBox[3] = TRUE; + + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + bRenderFiltrBox[0] = FALSE; + bRenderFiltrBox[1] = FALSE; + bRenderFiltrBox[2] = FALSE; + bRenderFiltrBox[3] = FALSE; + + SetFiltrButtons(); + + /* + bRenderFiltrBox[0] = FALSE; + bRenderFiltrBox[1] = TRUE; + bRenderFiltrBox[2] = FALSE; + bRenderFiltrBox[3] = FALSE; + + RenderFiltrBox(); + InitAddInventoryFiltrButtons(8,9, FALSE); + */ + } + else if ( ubRetValue == 3 ) + { + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + bRenderFiltrBox[0] = FALSE; + bRenderFiltrBox[1] = FALSE; + bRenderFiltrBox[2] = TRUE; + bRenderFiltrBox[3] = FALSE; + + SetFiltrButtons(); + + RenderFiltrBox(); + InitAddInventoryFiltrButtons(4,21, FALSE); + } + else if ( ubRetValue == 4 ) + { + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + bRenderFiltrBox[0] = FALSE; + bRenderFiltrBox[1] = FALSE; + bRenderFiltrBox[2] = FALSE; + bRenderFiltrBox[3] = TRUE; + + SetFiltrButtons(); + + RenderFiltrBox(); + InitAddInventoryFiltrButtons(10,25, FALSE); + } + } + else if ( bEncyclopediaQuests == TRUE ) + { + + } + else if ( bBriefingRoom == TRUE ) + { + + } + else if ( bBriefingRoomSpecialMission == TRUE ) + { + + + } + + RenderEncyclopediaLocation(TRUE); + RenderMap(); + RenderButtonDisabled3(); + + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + } +} + +void SelectInventoryFiltrButtonsRegionCallBack(GUI_BUTTON * btn, INT32 reason ) +{ + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + ResetTemp(); + + if ( bBriefingRoomSpecialMission == TRUE ) + { + + } + else if ( bBriefingRoom == TRUE ) + { + + } + else if ( bEncyclopediaQuests == TRUE ) + { + + } + else if ( bEncyclopediaLocation == TRUE ) + { + + } + else if ( bEncyclopediaCharacter == TRUE ) + { + + } + else if ( bEncyclopediaInventory == TRUE ) + { + //Guns + if ( ubRetValue == 0 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, NOT_GUN, IC_GUN, TRUE ); + + + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 1 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_PISTOL, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 2 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_M_PISTOL, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 3 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_SMG, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 4 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_RIFLE, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 5 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_SN_RIFLE, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 6 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_AS_RIFLE, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 7 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_LMG, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 8 && bRenderFiltrBox[0] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_SHOTGUN, IC_GUN, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[0] = FALSE; + SetFiltrButtons(); + } + //AMMO + if ( ubRetValue == 0 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_PISTOL, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[1] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 1 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_M_PISTOL, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 2 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_SMG, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[1] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 3 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_RIFLE, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 4 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_SN_RIFLE, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 5 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_AS_RIFLE, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[1] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 6 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_LMG, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[0] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 7 && bRenderFiltrBox[1] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, GUN_SHOTGUN, IC_AMMO, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[1] == TRUE ) bRenderFiltrBox[1] = FALSE; + SetFiltrButtons(); + } + + //ARMOUR + if ( ubRetValue == 0 && bRenderFiltrBox[2] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, ARMOURCLASS_HELMET, IC_ARMOUR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[2] == TRUE ) bRenderFiltrBox[2] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 1 && bRenderFiltrBox[2] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, ARMOURCLASS_VEST, IC_ARMOUR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[2] == TRUE ) bRenderFiltrBox[2] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 2 && bRenderFiltrBox[2] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, ARMOURCLASS_LEGGINGS, IC_ARMOUR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[2] == TRUE ) bRenderFiltrBox[2] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 3 && bRenderFiltrBox[2] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, ARMOURCLASS_PLATE, IC_ARMOUR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[2] == TRUE ) bRenderFiltrBox[2] = FALSE; + SetFiltrButtons(); + } + /* + else if ( ubRetValue == 4 && bRenderFiltrBox[2] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, ARMOURCLASS_MONST, IC_ARMOUR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[2] == TRUE ) bRenderFiltrBox[2] == FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 5 && bRenderFiltrBox[2] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, ARMOURCLASS_VEHICLE, IC_ARMOUR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[2] == TRUE ) bRenderFiltrBox[2] == FALSE; + SetFiltrButtons(); + } + */ + //misc + if ( ubRetValue == 0 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_BLADE, IC_BLADE, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 1 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_THROWING_KNIFE, IC_THROWING_KNIFE, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 2 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_PUNCH, IC_PUNCH, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 3 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_GRENADE, IC_GRENADE, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 4 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_BOMB, IC_BOMB, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 5 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_MEDKIT, IC_MEDKIT, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 6 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_KIT, IC_KIT, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 7 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_FACE, IC_FACE, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 8 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_LBEGEAR, IC_LBEGEAR, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + else if ( ubRetValue == 9 && bRenderFiltrBox[3] == TRUE ) + { + CopyToTemp ( gEncyclopediaInventoryData, FALSE, IC_MISC, IC_MISC, TRUE ); + if ( bRenderFiltrBox[0] == TRUE ) UnloadInventoryFilterBox(9); + if ( bRenderFiltrBox[1] == TRUE ) UnloadInventoryFilterBox(8); + if ( bRenderFiltrBox[2] == TRUE ) UnloadInventoryFilterBox(4); + if ( bRenderFiltrBox[3] == TRUE ) UnloadInventoryFilterBox(10); + + if ( bRenderFiltrBox[3] == TRUE ) bRenderFiltrBox[3] = FALSE; + SetFiltrButtons(); + } + } + RenderEncyclopediaLocation(FALSE); + RenderMap(); + RenderButtonDisabled3(); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + } +} + + +void SelectSoundButtonsRegionCallBack(GUI_BUTTON * btn, INT32 reason ) +{ + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + CHAR8 str[MAX_ENCYCLOPEDIA_CHARS]; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if ( bEncyclopediaLocation == TRUE ) + { + + if ( ubRetValue == 0 ) + { + + } + + } + else if ( bEncyclopediaCharacter == TRUE ) + { + + if ( ubRetValue == 0 ) + { + + } + + } + else if ( bEncyclopediaInventory == TRUE ) + { + if ( ubRetValue == 0 ) + { + + } + } + else if ( bEncyclopediaQuests == TRUE ) + { + + if ( ubRetValue == 0 ) + { + + } + + } + else if ( bBriefingRoom == TRUE ) + { + + if ( ubRetValue == 0 ) + { + + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } + + sprintf(str, gEncyclopediaDataTemp[LocationID].sSounds); + uiSoundSampleBR = PlayJA2SampleFromFile( str, RATE_11025, HIGHVOLUME, 1, MIDDLE ); + + } + + if ( ubRetValue == 1 ) + { + if ( gBriefingRoomData[gEncyclopediaDataTemp[LocationID].MissionID].CheckMission == MISSIONNOSTARTED ) + { + + gEncyclopediaDataTemp[LocationID].CheckMission = MISSIONSTART; + gBriefingRoomData[gEncyclopediaDataTemp[LocationID].MissionID].CheckMission = MISSIONSTART; + + DisableButton ( guiSoundButtons[1] ); + } + } + + } + else if ( bBriefingRoomSpecialMission == TRUE ) + { + + if ( ubRetValue == 0 ) + { + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } + + sprintf(str, gEncyclopediaDataTemp[LocationID].sSounds); + uiSoundSampleBR = PlayJA2SampleFromFile( str, RATE_11025, HIGHVOLUME, 1, MIDDLE ); + + } + + } + + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + } +} + +//-------------------------------------------------------------- + + +BOOLEAN SaveEncyclopediaToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + UINT32 i; + + + //Briefing room + for(i=0; iuiFlags & BUTTON_CLICKED_ON ) + { + if ( ubRetValue == 0 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_CITIES); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_CITIES, TRUE ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 1 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_SAM); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_SAM, TRUE ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 2 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_OTHER ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 3 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_MINES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + + if ( ubRetValue == 0 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_CITIES); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_CITIES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 1 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_SAM); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_SAM ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 2 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_OTHER ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 3 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToTrue( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_MINES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + /* + btn->uiFlags &= ~BUTTON_CLICKED_ON; + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + if ( ubRetValue == 0 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_CITIES); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_CITIES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 1 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_SAM); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_SAM ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 2 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_OTHER ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 3 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, TRUE, LOCATION_MINES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + + if ( ubRetValue == 0 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_CITIES); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_CITIES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 1 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_SAM); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_SAM ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 2 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_OTHER ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + + if ( ubRetValue == 3 && bEncyclopediaLocation == TRUE ) + { + // ResetTemp(); + //FiltrToFalse( gEncyclopediaLocationData,LOCATION_OTHER); + CopyToTemp ( gEncyclopediaLocationData, FALSE, LOCATION_MINES ); + RenderEncyclopediaLocation(); + RenderMap(); + RenderButtonDisabled3(); + } + btn->uiFlags &= ~BUTTON_CLICKED_ON; + } + } +} +*/ \ No newline at end of file diff --git a/Laptop/Encyclopedia_Data.h b/Laptop/Encyclopedia_Data.h new file mode 100644 index 00000000..b6e10888 --- /dev/null +++ b/Laptop/Encyclopedia_Data.h @@ -0,0 +1,40 @@ +#ifndef __Encyclopedia_Data_H +#define __Encyclopedia_Data_H + +#include "Encyclopedia.h" +#include "Encyclopedia_Data.h" + +void GameInitEncyclopediaLocation(); +BOOLEAN EnterEncyclopediaLocation(); +void ExitEncyclopediaLocation(); +void HandleEncyclopediaLocation(); +void RenderEncyclopediaLocation(BOOLEAN bHidden); + +extern BOOLEAN bEncyclopediaLocation; +extern BOOLEAN bEncyclopediaCharacter; +extern BOOLEAN bEncyclopediaInventory; +extern BOOLEAN bEncyclopediaQuests; +extern BOOLEAN bBriefingRoom; +extern BOOLEAN bBriefingRoomSpecialMission; + +extern UINT32 IDPageEncyData; +extern void InitData ( BOOLEAN bInit); +extern void UnLoadMenuButtons (); +extern BOOLEAN ResetVal; + +extern void CopyToTemp ( ENCYCLOPEDIA_LOCATION *Ency, BOOLEAN bFiltr, INT32 sort, INT32 TypFiltr, BOOLEAN ShowBox ); +extern void ResetTemp(); + +extern BOOLEAN LoadEncyclopediaFromLoadGameFile( HWFILE hFile ); +extern BOOLEAN SaveEncyclopediaToSaveGameFile( HWFILE hFile ); + +#define PAGENONE 0 +#define PAGEENCYCLOPEDIALOCATION 1 +#define PAGEENCYCLOPEDIACHARACTER 2 +#define PAGEENCYCLOPEDIAINVENTORY 3 +#define PAGEENCYCLOPEDIAQUESTS 4 +#define PAGEBRIEFINGROOM 5 +#define PAGEBRIEFINGROOMSPECIALMISSION 6 + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Attribute Selection.cpp b/Laptop/IMP Attribute Selection.cpp index a9e09ff4..012d354e 100644 --- a/Laptop/IMP Attribute Selection.cpp +++ b/Laptop/IMP Attribute Selection.cpp @@ -613,79 +613,79 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) switch( iStatToIncrement ) { case( STRENGTH_ATTRIBUTE ): - if( iCurrentStrength > iMaxAttribute -1 ) + if( iCurrentStrength > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentStrength++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; - case( DEXTERITY_ATTRIBUTE ): - if( iCurrentDexterity > iMaxAttribute -1 ) + case( DEXTERITY_ATTRIBUTE ): + if( iCurrentDexterity > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentDexterity++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( AGILITY_ATTRIBUTE ): - if( iCurrentAgility > iMaxAttribute -1 ) + if( iCurrentAgility > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentAgility++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( WISDOM_ATTRIBUTE ): - if( iCurrentWisdom > iMaxAttribute -1 ) + if( iCurrentWisdom > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentWisdom++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; - case( HEALTH_ATTRIBUTE ): - if( iCurrentHealth > iMaxAttribute -1 ) + case( HEALTH_ATTRIBUTE ): + if( iCurrentHealth > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentHealth++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( LEADERSHIP_ATTRIBUTE ): - if( iCurrentLeaderShip > iMaxAttribute -1 ) + if( iCurrentLeaderShip > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); } - else + else { if( iCurrentLeaderShip == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentLeaderShip+=iLeaderShipMinimum; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentLeaderShip+=iLeaderShipMinimum; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -695,25 +695,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentLeaderShip++; - iCurrentBonusPoints--; + iCurrentLeaderShip++; + iCurrentBonusPoints--; } } break; case( MARKSMANSHIP_SKILL ): - if( iCurrentMarkmanship > iMaxAttribute -1 ) + if( iCurrentMarkmanship > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentMarkmanship == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentMarkmanship+=iMarkmanshipMinimum; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentMarkmanship+=iMarkmanshipMinimum; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -723,25 +723,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentMarkmanship++; - iCurrentBonusPoints--; + iCurrentMarkmanship++; + iCurrentBonusPoints--; } } break; case( MECHANICAL_SKILL ): - if( iCurrentMechanical > iMaxAttribute -1 ) + if( iCurrentMechanical > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentMechanical == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentMechanical+=iMechanicalMinimum; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentMechanical+=iMechanicalMinimum; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -751,25 +751,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentMechanical++; - iCurrentBonusPoints--; + iCurrentMechanical++; + iCurrentBonusPoints--; } } break; case( MEDICAL_SKILL ): - if( iCurrentMedical > iMaxAttribute -1 ) + if( iCurrentMedical > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { - if( iCurrentMedical == 0) + if( iCurrentMedical == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentMedical+=iMedicalMinimum; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentMedical+=iMedicalMinimum; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -779,25 +779,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentMedical++; - iCurrentBonusPoints--; + iCurrentMedical++; + iCurrentBonusPoints--; } } break; case( EXPLOSIVE_SKILL ): - if( iCurrentExplosives > iMaxAttribute -1 ) + if( iCurrentExplosives > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentExplosives == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentExplosives+=iExplosivesMinimum; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentExplosives+=iExplosivesMinimum; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -807,8 +807,8 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentExplosives++; - iCurrentBonusPoints--; + iCurrentExplosives++; + iCurrentBonusPoints--; } } break; @@ -1916,7 +1916,7 @@ INT32 GetCurrentAttributeValue( INT32 iAttribute ) void SetAttributes( void ) { INT32 iExtraPoints = 0; - + // added externilized multiplier for starting level - SADNRO iLevelCostMultiplier = gGameExternalOptions.iIMPStartingLevelCostMultiplier; diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index aa5f21ce..58094185 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -114,9 +114,6 @@ void RenderGender( void ); void DecrementTextEnterMode( void ); void Print8CharacterOnlyString( void ); BOOLEAN CheckCharacterInputForEgg( void ); -UINT32 GetCyrillicUnicodeChar( UINT32 uiKey ); -UINT32 TranslateKey( UINT32 uiKey, unsigned char* translationTable ); -BOOLEAN CheckIsKeyValid( UINT32 uiKey ); // mouse region callbacks void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -589,29 +586,18 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) break; default: //Heinz (18.01.2009): Russian layout - // ViSoR (07.01.2012) : Russian and Belarussian layouts // -#if defined(RUSSIAN) || defined(BELARUSSIAN) - if( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x419) // Russian +#if defined(RUSSIAN) + if( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x419) { - unsigned char TranslationTable[] = - " #Ý####ý####á-þ.0123456789ÆæÁ#Þ##ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨"; - - uiKey = TranslateKey( uiKey, TranslationTable ); - uiKey = GetCyrillicUnicodeChar( uiKey ); + unsigned char RussianTranslationTable[] = + " #Ý####ý####á-þ.0123456789ÆæÁ#Þ##ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨"; + if(uiKey >= ' ' && uiKey <= '~') uiKey = RussianTranslationTable[uiKey-' ']; + else uiKey = '#'; } - else if ( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x423) // Belarussian - { - unsigned char TranslationTable[] = - " #Ý####ý####á-þ.0123456789ÆæÁ#Þ##Ô²ÑÂÓÀÏÐØÎËÄÜÒ¡ÇÉÊÛÅÃÌÖ×Íßõ#'#_¸ô³ñâóàïðøîëäüò¢çéêûåãìö÷íÿÕ#'¨"; - - uiKey = TranslateKey( uiKey, TranslationTable ); - uiKey = GetCyrillicUnicodeChar( uiKey ); - } - else if( !CheckIsKeyValid( uiKey ) ) - uiKey = '#'; - - if( uiKey != '#') + else if( !(uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || + uiKey == '_' || uiKey == '.' || uiKey == ' ') ) uiKey = '#'; + if(uiKey != '#') #else #ifndef USE_CODE_PAGE if( uiKey >= 'A' && uiKey <= 'Z' || @@ -702,64 +688,10 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) return; } -UINT32 GetCyrillicUnicodeChar( UINT32 uiKey ) -{ - // À - ÿ - if (uiKey >= 192 && uiKey <= 255) - uiKey += 0x0350; - // ¨ - if (uiKey == 168) - uiKey = 0x0401; - - // ¸ - if (uiKey == 184) - uiKey = 0x0451; - - // ¡ - if (uiKey == 161) - uiKey = 0x040E; - - // ¢ - if (uiKey == 162) - uiKey = 0x045E; - - // ² - if (uiKey == 178) - uiKey = 0x0406; - - // ³ - if (uiKey == 179) - uiKey = 0x0456; - - return uiKey; -} - -BOOLEAN CheckIsKeyValid( UINT32 uiKey ) -{ - if( uiKey >= 'A' && uiKey <= 'Z' || - uiKey >= 'a' && uiKey <= 'z' || - uiKey >= '0' && uiKey <= '9' || - uiKey == '_' || - uiKey == '.' || - uiKey == ' ') - return TRUE; - else - return FALSE; -} - -UINT32 TranslateKey( UINT32 uiKey, unsigned char* translationTable ) -{ - if( uiKey >= ' ' && uiKey <= '~' ) - uiKey = translationTable[uiKey-' ']; - else - uiKey = '#'; - - return uiKey; -} void DisplayFullNameStringCursor( void ) -{ +{ // this procdure will draw the activation string cursor on the screen at position cursorx cursory UINT32 uiDestPitchBYTES; static UINT32 uiBaseTime = 0; diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index 8ce4798f..1eca1cea 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -364,13 +364,13 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) //Kaiden: Below is the Imp personality E-mail as it was. /* // send email notice - //AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ) ); + //AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ),TYPE_EMAIL_NONE ); AddFutureDayStrategicEvent( EVENT_DAY2_ADD_EMAIL_FROM_IMP, 60 * 7, 0, 2 ); */ //Kaiden: And here is my Answer to the IMP E-mails only // profiling the last IMP made. You get the results immediately - AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex, -1 ); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex, -1, TYPE_EMAIL_EMAIL_EDT); //RenderCharProfile( ); diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp index 0c0d8ed0..2984f25b 100644 --- a/Laptop/IMP HomePage.cpp +++ b/Laptop/IMP HomePage.cpp @@ -30,6 +30,10 @@ #include "Squads.h" #endif +#ifdef JA2UB +#include "ub_config.h" +#endif + void GetPlayerKeyBoardInputForIMPHomePage( void ); void DisplayPlayerActivationString( void ); void ProcessPlayerInputActivationString( void ); @@ -403,9 +407,12 @@ void ProcessPlayerInputActivationString( void ) { freeMercSlot = FALSE; } - +#ifdef JA2UB + if( ( ( gGameUBOptions.LaptopIMPPassJA2 == TRUE && wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( gGameUBOptions.LaptopIMPPassJA2 == TRUE && wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) || ( ( gGameUBOptions.LaptopIMPPassUB == TRUE && wcscmp(pPlayerActivationString, L"GP97SL") == 0 ) || ( gGameUBOptions.LaptopIMPPassUB == TRUE && wcscmp(pPlayerActivationString, L"gp97sl") == 0 ) ) && ( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) +#else //Madd multiple imps if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) )&&( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) +#endif { // WANNE: Check total number of hired mercs if( freeMercSlot == FALSE ) @@ -444,7 +451,7 @@ void ProcessPlayerInputActivationString( void ) ResetActivationStringTextBox(); //DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 11 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); - AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex, -1 ); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex, -1 , TYPE_EMAIL_EMAIL_EDT); } } else @@ -470,7 +477,7 @@ void ProcessPlayerInputActivationString( void ) ResetActivationStringTextBox(); //DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 11 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); - AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex, -1 ); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex, -1 , TYPE_EMAIL_EMAIL_EDT); } } else @@ -480,7 +487,11 @@ void ProcessPlayerInputActivationString( void ) } else { +#ifdef JA2UB + if( ( ( gGameUBOptions.LaptopIMPPassJA2 == TRUE && wcscmp(pPlayerActivationString, L"XEP624") != 0 ) && ( gGameUBOptions.LaptopIMPPassJA2 == TRUE && wcscmp(pPlayerActivationString, L"xep624") != 0 ) ) || ( ( gGameUBOptions.LaptopIMPPassUB == TRUE && wcscmp(pPlayerActivationString, L"GP97SL") != 0 ) && ( gGameUBOptions.LaptopIMPPassUB == TRUE && wcscmp(pPlayerActivationString, L"gp97sl") != 0 ) ) ) +#else if( ( ( wcscmp(pPlayerActivationString, L"XEP624") != 0 ) && ( wcscmp(pPlayerActivationString, L"xep624") != 0 ) ) ) +#endif { DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 0 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); } diff --git a/Laptop/IMP Minor Trait.cpp b/Laptop/IMP Minor Trait.cpp index 4b459acb..b117c8e6 100644 --- a/Laptop/IMP Minor Trait.cpp +++ b/Laptop/IMP Minor Trait.cpp @@ -775,7 +775,7 @@ INT8 GetLastSelectedMinorTrait( void ) UINT8 StrengthRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -799,7 +799,7 @@ UINT8 StrengthRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) UINT8 DexterityRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -852,7 +852,7 @@ UINT8 DexterityRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) UINT8 AgilityRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -905,7 +905,7 @@ UINT8 AgilityRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) UINT8 HealthRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -930,7 +930,7 @@ UINT8 HealthRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) UINT8 WisdomRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -983,7 +983,7 @@ UINT8 WisdomRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) UINT8 LeaderShipRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1022,6 +1022,12 @@ UINT8 MedicalRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) } UINT8 ExplosivesRequiredAdjustmentForMinorTraits( INT32 iInitialValue ) { + // Only for new trait system + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) + { + return 0; + } + if ( gfMinorTraitQuestions[ IMP_SKILL_TRAITS_NEW_DEMOLITIONS ] ) { // 60 is minimum, +10 is addition to other preset requirements @@ -1249,6 +1255,11 @@ void AssignMinorTraitHelpText( UINT8 ubNumber ) swprintf( atStr, gzIMPMinorTraitsHelpTextsStealthy[2], gSkillTraitValues.ubSTStealthBonus, L"%"); wcscat( apStr, atStr ); } + if( gSkillTraitValues.ubSTReducedAPsRegistered != 0 && gGameExternalOptions.fImprovedInterruptSystem ) + { + swprintf( atStr, gzIMPMinorTraitsHelpTextsStealthy[4], gSkillTraitValues.ubSTReducedAPsRegistered, L"%"); + wcscat( apStr, atStr ); + } if( gSkillTraitValues.ubSTStealthPenaltyForMovingReduction != 0 ) { swprintf( atStr, gzIMPMinorTraitsHelpTextsStealthy[3], gSkillTraitValues.ubSTStealthPenaltyForMovingReduction, L"%"); diff --git a/Laptop/IMP Skill Trait.cpp b/Laptop/IMP Skill Trait.cpp index 59c9f3d2..c6451a8a 100644 --- a/Laptop/IMP Skill Trait.cpp +++ b/Laptop/IMP Skill Trait.cpp @@ -1312,7 +1312,7 @@ INT8 GetLastSelectedSkill( void ) INT32 StrengthRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1358,7 +1358,7 @@ INT32 StrengthRequiredDueToMajorSkills( void ) INT32 AgilityRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1404,7 +1404,7 @@ INT32 AgilityRequiredDueToMajorSkills( void ) INT32 DexterityRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1494,7 +1494,7 @@ INT32 DexterityRequiredDueToMajorSkills( void ) INT32 HealthRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1540,7 +1540,7 @@ INT32 HealthRequiredDueToMajorSkills( void ) INT32 LeadershipRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1575,7 +1575,7 @@ INT32 LeadershipRequiredDueToMajorSkills( void ) INT32 WisdomRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1643,7 +1643,7 @@ INT32 WisdomRequiredDueToMajorSkills( void ) INT32 MarksmanshipRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1700,7 +1700,7 @@ INT32 MarksmanshipRequiredDueToMajorSkills( void ) INT32 MechanicalRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1724,7 +1724,7 @@ INT32 MechanicalRequiredDueToMajorSkills( void ) INT32 MedicalRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -1748,7 +1748,7 @@ INT32 MedicalRequiredDueToMajorSkills( void ) INT32 ExplosivesRequiredDueToMajorSkills( void ) { // Only for new trait system - if (!gGameOptions.fNewTraitSystem) + if (!gGameOptions.fNewTraitSystem || !gSkillTraitValues.fAllowAttributePrereq) { return 0; } @@ -2148,6 +2148,11 @@ void AssignSkillTraitHelpText( UINT8 ubTraitNumber, BOOLEAN fExpertLevel ) wcscat( apStr, atStr ); } } + if( gSkillTraitValues.ubMAReducedAPsRegisteredWhenMoving != 0 && gGameExternalOptions.fImprovedInterruptSystem ) + { + swprintf( atStr, gzIMPMajorTraitsHelpTextsMartialArts[27], ( gSkillTraitValues.ubMAReducedAPsRegisteredWhenMoving * (fExpertLevel ? 2 : 1)), L"%"); + wcscat( apStr, atStr ); + } if( gSkillTraitValues.ubMAChanceToCkickDoors != 0 ) { swprintf( atStr, gzIMPMajorTraitsHelpTextsMartialArts[25], ( gSkillTraitValues.ubMAChanceToCkickDoors * (fExpertLevel ? 2 : 1)), L"%"); @@ -2180,6 +2185,11 @@ void AssignSkillTraitHelpText( UINT8 ubTraitNumber, BOOLEAN fExpertLevel ) swprintf( atStr, gzIMPMajorTraitsHelpTextsSquadleader[2], ( gSkillTraitValues.ubSLEffectiveLevelAsStandby * (fExpertLevel ? 2 : 1))); wcscat( apStr, atStr ); } + if( gSkillTraitValues.ubSLCollectiveInterruptsBonus != 0 && gGameExternalOptions.fImprovedInterruptSystem ) + { + swprintf( atStr, gzIMPMajorTraitsHelpTextsSquadleader[11], ( gSkillTraitValues.ubSLCollectiveInterruptsBonus * (fExpertLevel ? 2 : 1)), L"%"); + wcscat( apStr, atStr ); + } if( gSkillTraitValues.ubSLOverallSuppresionBonusPercent != 0 ) { swprintf( atStr, gzIMPMajorTraitsHelpTextsSquadleader[3], ( gSkillTraitValues.ubSLOverallSuppresionBonusPercent * (fExpertLevel ? 2 : 1)), L"%", (fExpertLevel ? gzIMPSkillTraitsTextNewMajor[ubTraitNumber + 11] : gzIMPSkillTraitsTextNewMajor[ubTraitNumber])); diff --git a/Laptop/IMP Text System.cpp b/Laptop/IMP Text System.cpp index a5686932..4eb01c61 100644 --- a/Laptop/IMP Text System.cpp +++ b/Laptop/IMP Text System.cpp @@ -17,6 +17,32 @@ #include "GameSettings.h" #include "Text.h" #include "_Ja25Englishtext.h" +#ifdef JA2UB + #include "laptop.h" + #include "email.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "soldier profile.h" + #include "IMP Compile Character.h" + #include "IMP Voices.h" + #include "IMP Portraits.h" + #include "Game Clock.h" + #include "environment.h" + #include "AimMembers.h" + #include "Random.h" + #include "Text.h" + #include "LaptopSave.h" + #include "finances.h" + #include "PostalService.h" + #include "faces.h" + #include "GameSettings.h" +#endif + #endif #define IMP_SEEK_AMOUNT 5 * 80 * 2 @@ -46,8 +72,10 @@ void OffSetQuestionForFemaleSpecificQuestions( INT32 *iCurrentOffset ); #define QTN_FIRST_COLUMN_X iScreenWidthOffset + 80 #define QTN_SECOND_COLUMN_X iScreenWidthOffset + 320 - - +#ifdef JA2UB +#define IMPTEXT_EDT_FILE_JA25 "BINARYDATA\\IMPText25.edt" +#define IMPTEXT_EDT_FILE_JA2 "BINARYDATA\\IMPText.edt" +#endif void LoadAndDisplayIMPText( INT16 sStartX, INT16 sStartY, INT16 sLineLength, INT16 sIMPTextRecordNumber, UINT32 uiFont, UINT8 ubColor, BOOLEAN fShadow, UINT32 uiFlags) { @@ -62,7 +90,18 @@ void LoadAndDisplayIMPText( INT16 sStartX, INT16 sStartY, INT16 sLineLength, INT } // load the string +#ifdef JA2UB + if (FileExists(IMPTEXT_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile(IMPTEXT_EDT_FILE_JA25, sString, ( UINT32 ) ( ( sIMPTextRecordNumber ) * IMP_SEEK_AMOUNT ), IMP_SEEK_AMOUNT); + } + else + { + LoadEncryptedDataFromFile(IMPTEXT_EDT_FILE_JA2, sString, ( UINT32 ) ( ( sIMPTextRecordNumber ) * IMP_SEEK_AMOUNT ), IMP_SEEK_AMOUNT); + } +#else LoadEncryptedDataFromFile("BINARYDATA\\IMPText.EDT", sString, ( UINT32 ) ( ( sIMPTextRecordNumber ) * IMP_SEEK_AMOUNT ), IMP_SEEK_AMOUNT); +#endif // null put last char sString[ wcslen( sString) ] = 0; diff --git a/Laptop/Laptop_VS2005.vcproj b/Laptop/Laptop_VS2005.vcproj index e2fac04b..16487660 100644 --- a/Laptop/Laptop_VS2005.vcproj +++ b/Laptop/Laptop_VS2005.vcproj @@ -402,6 +402,14 @@ RelativePath=".\BobbyRUsed.h" > + + + + @@ -414,6 +422,14 @@ RelativePath=".\email.h" > + + + + @@ -680,6 +696,14 @@ RelativePath=".\BobbyRUsed.cpp" > + + + + @@ -692,6 +716,14 @@ RelativePath=".\email.cpp" > + + + + @@ -880,6 +912,22 @@ RelativePath=".\XML_DeliveryMethods.cpp" > + + + + + + + + diff --git a/Laptop/Laptop_VS2008.vcproj b/Laptop/Laptop_VS2008.vcproj index f1651a76..135fcb15 100644 --- a/Laptop/Laptop_VS2008.vcproj +++ b/Laptop/Laptop_VS2008.vcproj @@ -403,6 +403,14 @@ RelativePath="BobbyRUsed.h" > + + + + @@ -415,6 +423,14 @@ RelativePath="email.h" > + + + + @@ -679,6 +695,14 @@ RelativePath="BobbyRUsed.cpp" > + + + + @@ -691,6 +715,14 @@ RelativePath="email.cpp" > + + + + @@ -883,6 +915,22 @@ RelativePath=".\XML_DeliveryMethods.cpp" > + + + + + + + + diff --git a/Laptop/Laptop_VS2010.vcxproj b/Laptop/Laptop_VS2010.vcxproj index d2144bc7..0f45283d 100644 --- a/Laptop/Laptop_VS2010.vcxproj +++ b/Laptop/Laptop_VS2010.vcxproj @@ -39,9 +39,13 @@ + + + + @@ -109,9 +113,13 @@ + + + + @@ -160,6 +168,10 @@ + + + + diff --git a/Laptop/Laptop_VS2010.vcxproj.filters b/Laptop/Laptop_VS2010.vcxproj.filters index ac5f0a25..68e66e5b 100644 --- a/Laptop/Laptop_VS2010.vcxproj.filters +++ b/Laptop/Laptop_VS2010.vcxproj.filters @@ -213,6 +213,18 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + @@ -422,5 +434,29 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Laptop/PostalService.cpp b/Laptop/PostalService.cpp index 424887cf..ff162729 100644 --- a/Laptop/PostalService.cpp +++ b/Laptop/PostalService.cpp @@ -19,6 +19,10 @@ #include "connect.h" #include "Strategic Event Handler.h" +#ifdef JA2UB +#include "ub_config.h" +#endif + using namespace std; /************************************************************************************/ @@ -526,14 +530,29 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID) // WANNE - MP: Do not send email notification from Bobby Ray in a multiplayer game if (!is_networked) { - StopTimeCompression(); + + StopTimeCompression(); +#ifdef JA2UB + +//no UB + if ( gGameUBOptions.fBobbyRSite == TRUE ) + { + // Shipment from Bobby Ray + if (shs.sSenderID == BOBBYR_SENDER_ID) + AddBobbyREmailJA2( 198, 4, BOBBY_R, GetWorldTotalMin(), -1, gusCurShipmentDestinationID, TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT); + // Shipment from John Kulba + //else + // AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, gusCurShipmentDestinationID, TYPE_EMAIL_EMAIL_EDT); + } +#else // Shipment from Bobby Ray if (shs.sSenderID == BOBBYR_SENDER_ID) - AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, gusCurShipmentDestinationID); + AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, gusCurShipmentDestinationID, TYPE_EMAIL_EMAIL_EDT); // Shipment from John Kulba else - AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, gusCurShipmentDestinationID); + AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, gusCurShipmentDestinationID, TYPE_EMAIL_EMAIL_EDT); +#endif } shs.ShipmentPackages.clear(); diff --git a/Laptop/Speck Quotes.h b/Laptop/Speck Quotes.h index 27e6613d..092fff3c 100644 --- a/Laptop/Speck Quotes.h +++ b/Laptop/Speck Quotes.h @@ -2,6 +2,156 @@ #define _SPECK_QUOTES_H_ //Enum,s for all of specks quotes +#ifdef JA2UB +enum +{ +/* +Ja25: no longer in game + SPECK_QUOTE_FIRST_TIME_IN_0, //0 + SPECK_QUOTE_FIRST_TIME_IN_1, + SPECK_QUOTE_FIRST_TIME_IN_2, + SPECK_QUOTE_FIRST_TIME_IN_3, + SPECK_QUOTE_FIRST_TIME_IN_4, + SPECK_QUOTE_FIRST_TIME_IN_5, + SPECK_QUOTE_FIRST_TIME_IN_6, + SPECK_QUOTE_FIRST_TIME_IN_7, + SPECK_QUOTE_FIRST_TIME_IN_8, + SPECK_QUOTE_THANK_PLAYER_FOR_OPENING_ACCOUNT, + + SPECK_QUOTE_ALTERNATE_OPENING_1_TOUGH_START, //10 + SPECK_QUOTE_ALTERNATE_OPENING_2_BUSINESS_BAD, + SPECK_QUOTE_ALTERNATE_OPENING_3_BUSINESS_GOOD, + SPECK_QUOTE_ALTERNATE_OPENING_4_TRYING_TO_RECRUIT, + SPECK_QUOTE_ALTERNATE_OPENING_5_PLAYER_OWES_SPECK_ACCOUNT_SUSPENDED, + SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_1, + SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_2, + SPECK_QUOTE_ALTERNATE_OPENING_7_PLAYER_ACCOUNT_OK, + SPECK_QUOTE_ALTERNATE_OPENING_8_MADE_PARTIAL_PAYMENT, + SPECK_QUOTE_ALTERNATE_OPENING_9_FIRST_VISIT_SINCE_SERVER_WENT_DOWN, + + SPECK_QUOTE_ALTERNATE_OPENING_10_GENERIC_OPENING, //20 + SPECK_QUOTE_ALTERNATE_OPENING_10_TAG_FOR_20, + SPECK_QUOTE_ALTERNATE_OPENING_11_NEW_MERCS_AVAILABLE, +*/ + SPECK_QUOTE_ALTERNATE_OPENING_12_PLAYERS_LOST_MERCS =23, +/* +Ja25: no longer in game + SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_OWES_MONEY, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_CLEARED_DEBT, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_CLEARED_OVERDUE_ACCOUNT, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FIRST_MERC_DIES, +*/ + SPECK_QUOTE_ALTERNATE_OPENING_TAG_BIFF_IS_DEAD =28, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_HAYWIRE_IS_DEAD, + + SPECK_QUOTE_ALTERNATE_OPENING_TAG_GASKET_IS_DEAD, //30 + SPECK_QUOTE_ALTERNATE_OPENING_TAG_RAZOR_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FLO_IS_DEAD_BIFF_ALIVE, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FLO_IS_DEAD_BIFF_IS_DEAD, +/* +Ja25: no longer in game + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FLO_MARRIED_A_COUSIN_BIFF_IS_ALIVE, +*/ + SPECK_QUOTE_ALTERNATE_OPENING_TAG_GUMPY_IS_DEAD =35, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_LARRY_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_LARRY_RELAPSED, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_COUGER_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_NUMB_IS_DEAD, + + SPECK_QUOTE_ALTERNATE_OPENING_TAG_BUBBA_IS_DEAD, //40 + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_1, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_2, +/* +Ja25: no longer in game + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_3, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_4, + SPECK_QUOTE_PLAYER_MAKES_FULL_PAYMENT, + SPECK_QUOTE_PLAYER_MAKES_PARTIAL_PAYMENT, +*/ + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BIFF =47, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_HAYWIRE, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GASKET, + + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_RAZOR, //50 + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_FLO, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GUMPY, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_LARRY, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_COUGER, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_NUMB, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BUBBA, +/* +Ja25: no longer in game + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_TAG_GETTING_MORE_MERCS, +*/ + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_1=58, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_2, + + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_3, //60 + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_4, + SPECK_QUOTE_BIFF_UNAVALIABLE, + SPECK_QUOTE_PLAYERS_HIRES_BIFF_SPECK_PLUGS_LARRY, + SPECK_QUOTE_PLAYERS_HIRES_BIFF_SPECK_PLUGS_FLO, + SPECK_QUOTE_PLAYERS_HIRES_HAYWIRE_SPECK_PLUGS_RAZOR, + SPECK_QUOTE_PLAYERS_HIRES_RAZOR_SPECK_PLUGS_HAYWIRE, + SPECK_QUOTE_PLAYERS_HIRES_FLO_SPECK_PLUGS_BIFF, + SPECK_QUOTE_PLAYERS_HIRES_LARRY_SPECK_PLUGS_BIFF, + SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_1, + + SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_2, //70 + SPECK_QUOTE_PLAYER_TRIES_TO_HIRE_ALREADY_HIRED_MERC, + SPECK_QUOTE_GOOD_BYE_1, + SPECK_QUOTE_GOOD_BYE_2, + SPECK_QUOTE_GOOD_BYE_3, +/* +Ja25: no longer in game + SPECK_QUOTE_GOOD_BYE_TAG_PLAYER_OWES_MONEY, +*/ + +//New Quotes + + SPECK_QUOTE_NEW_INTRO_1=76, + SPECK_QUOTE_NEW_INTRO_2, + SPECK_QUOTE_NEW_INTRO_3, + SPECK_QUOTE_NEW_INTRO_4, + + SPECK_QUOTE_NEW_INTRO_5,//80 + SPECK_QUOTE_NEW_INTRO_6, + SPECK_QUOTE_NEW_INTRO_7, + SPECK_QUOTE_DEFAULT_INTRO_HAVENT_HIRED_MERCS, + SPECK_QUOTE_DEFAULT_INTRO_HAVE_HIRED_MERCS, + SPECK_QUOTE_BETTER_STARTING_EQPMNT_TAG_ON, + SPECK_QUOTE_PLAYER_CANT_AFFORD_TO_HIRE_MERC, + SPECK_QUOTE_ENCOURAGE_SHOP_TAG_ON, + SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_1, + SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_2, + + SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_3, //90 + SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_4, + SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_5, + SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_6, + SPECK_QUOTE_ADVERTISE_GASTON, + SPECK_QUOTE_ADVERTISE_STOGIE, + SPECK_QUOTE_GASTON_DEAD, + SPECK_QUOTE_STOGIE_DEAD, + SPECK_QUOTE_PLAYER_HIRES_GASTON, + SPECK_QUOTE_PLAYER_HIRES_STOGIE, + + SPECK_QUOTE_RANDOM_CHIT_CHAT_1, //100 + SPECK_QUOTE_RANDOM_CHIT_CHAT_2, + SPECK_QUOTE_RANDOM_CHIT_CHAT_3, + SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING, + +/* + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + + */ +}; +#else enum { SPECK_QUOTE_FIRST_TIME_IN_0, //0 @@ -115,5 +265,6 @@ enum SPECK_QUOTE_, */ }; +#endif #endif \ No newline at end of file diff --git a/Laptop/XML_Email.cpp b/Laptop/XML_Email.cpp new file mode 100644 index 00000000..ea915e20 --- /dev/null +++ b/Laptop/XML_Email.cpp @@ -0,0 +1,301 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" + #include "Editor All.h" + #include "LuaInitNPCs.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Item Statistics.h" + #include "LuaInitNPCs.h" + #include "email.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAIL_STRING_SIZE+1]; + EMAIL_OTHER_VALUES curEmailOther; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +} + +typedef EmailOtherParseData; + +BOOLEAN EmailOther_TextOnly; + +static void XMLCALL +EmailOtherStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + EmailOtherParseData * pData = (EmailOtherParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "NEW_EMAIL") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "EMAIL") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "Subject") == 0 || + strcmp(name, "Message0") == 0 || + strcmp(name, "Message1") == 0 || + strcmp(name, "Message2") == 0 || + strcmp(name, "Message3") == 0 || + strcmp(name, "Message4") == 0 || + strcmp(name, "Message5") == 0 || + strcmp(name, "Message6") == 0 || + strcmp(name, "Message7") == 0 || + strcmp(name, "Message8") == 0 || + strcmp(name, "Message9") == 0 || + strcmp(name, "Message10") == 0 || + strcmp(name, "Message11") == 0 || + strcmp(name, "Message12") == 0 || + strcmp(name, "Message13") == 0 || + strcmp(name, "Message14") == 0 || + strcmp(name, "Message15") == 0 || + strcmp(name, "Message16") == 0 || + strcmp(name, "Message17") == 0 || + strcmp(name, "Message18") == 0 || + strcmp(name, "Message19") == 0 || + strcmp(name, "Message20") == 0 || + strcmp(name, "Message21") == 0 || + strcmp(name, "Message22") == 0 || + strcmp(name, "Message23") == 0 || + strcmp(name, "Message24") == 0 || + strcmp(name, "Message25") == 0 || + strcmp(name, "Message26") == 0 || + strcmp(name, "Message27") == 0 || + strcmp(name, "Message28") == 0 || + strcmp(name, "Message29") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +EmailOtherCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + EmailOtherParseData * pData = (EmailOtherParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +EmailOtherEndElementHandle(void *userData, const XML_Char *name) +{ + EmailOtherParseData * pData = (EmailOtherParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "NEW_EMAIL") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "EMAIL") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!EmailOther_TextOnly) + { + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szSubject, pData->curEmailOther.szSubject); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[0], L"1. sdssdsfs dfg fdgd fgffdsf test" ); //pData->curEmailOther.szMessage[0]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[1], L"2. sdssdsfs dfg fgfgffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[2], L"3. sdssdsfsd gdfg fdfgfdg ffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[3], L"4. sdssdsf dgdfg dgsffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[4], L"5. sdssdsfdgdfg dgfd gsffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[5], L"6. sdssdsfsffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[6], L"7. sdssdsfsffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[7], L"8. sdssdsfsfdgdgfgfdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[8], L"9. sdssdsfsff dg dfgdg fg dfg dsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[9], L"10. sdssdsfsfgdsgdfgfdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[10], L"11. sdssdsfsff dgdf fgfdg dfgd dsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[11], L"12. sdssdsfsf dfg dfgf gdfg dsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[12], L"13. sdssdsfsf dfgdfgdf gdfg gfdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[13], L"14. sdssdsf dgdf gsffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[14], L"15. sdssdsf dgdf dfg d gdf ffdsf test" ); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[15], L"16. sdssdsfs dgdfg fdg dgdfg gffdsf test" ); + + /* + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[1], pData->curEmailOther.szMessage[1]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[2], pData->curEmailOther.szMessage[2]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[3], pData->curEmailOther.szMessage[3]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[4], pData->curEmailOther.szMessage[4]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[5], pData->curEmailOther.szMessage[5]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[6], pData->curEmailOther.szMessage[6]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[7], pData->curEmailOther.szMessage[7]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[8], pData->curEmailOther.szMessage[8]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[9], pData->curEmailOther.szMessage[9]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[10], pData->curEmailOther.szMessage[10]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[11], pData->curEmailOther.szMessage[11]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[12], pData->curEmailOther.szMessage[12]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[13], pData->curEmailOther.szMessage[13]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[14], pData->curEmailOther.szMessage[14]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[15], pData->curEmailOther.szMessage[15]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[16], pData->curEmailOther.szMessage[16]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[17], pData->curEmailOther.szMessage[17]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[18], pData->curEmailOther.szMessage[18]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[19], pData->curEmailOther.szMessage[19]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[20], pData->curEmailOther.szMessage[20]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[21], pData->curEmailOther.szMessage[21]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[22], pData->curEmailOther.szMessage[22]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[23], pData->curEmailOther.szMessage[23]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[24], pData->curEmailOther.szMessage[24]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[25], pData->curEmailOther.szMessage[25]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[26], pData->curEmailOther.szMessage[26]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[27], pData->curEmailOther.szMessage[27]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[28], pData->curEmailOther.szMessage[28]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[29], pData->curEmailOther.szMessage[29]); + */ + } + else + { + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szSubject, pData->curEmailOther.szSubject); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[0], L"sdssdsfsffdsf test" ); //pData->curEmailOther.szMessage[0]); + /* + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[1], pData->curEmailOther.szMessage[1]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[2], pData->curEmailOther.szMessage[2]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[3], pData->curEmailOther.szMessage[3]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[4], pData->curEmailOther.szMessage[4]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[5], pData->curEmailOther.szMessage[5]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[6], pData->curEmailOther.szMessage[6]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[7], pData->curEmailOther.szMessage[7]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[8], pData->curEmailOther.szMessage[8]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[9], pData->curEmailOther.szMessage[9]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[10], pData->curEmailOther.szMessage[10]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[11], pData->curEmailOther.szMessage[11]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[12], pData->curEmailOther.szMessage[12]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[13], pData->curEmailOther.szMessage[13]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[14], pData->curEmailOther.szMessage[14]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[15], pData->curEmailOther.szMessage[15]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[16], pData->curEmailOther.szMessage[16]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[17], pData->curEmailOther.szMessage[17]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[18], pData->curEmailOther.szMessage[18]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[19], pData->curEmailOther.szMessage[19]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[20], pData->curEmailOther.szMessage[20]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[21], pData->curEmailOther.szMessage[21]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[22], pData->curEmailOther.szMessage[22]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[23], pData->curEmailOther.szMessage[23]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[24], pData->curEmailOther.szMessage[24]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[25], pData->curEmailOther.szMessage[25]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[26], pData->curEmailOther.szMessage[26]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[27], pData->curEmailOther.szMessage[27]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[28], pData->curEmailOther.szMessage[28]); + wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[29], pData->curEmailOther.szMessage[29]); + */ + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curEmailOther.uiIndex = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "Subject") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEmailOther.szSubject, sizeof(pData->curEmailOther.szSubject)/sizeof(pData->curEmailOther.szSubject[0]) ); + pData->curEmailOther.szSubject[sizeof(pData->curEmailOther.szSubject)/sizeof(pData->curEmailOther.szSubject[0]) - 1] = '\0'; + } + /* + else if(strcmp(name, "Message0") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEmailOther.szMessage[0], sizeof(pData->curEmailOther.szMessage[0])/sizeof(pData->curEmailOther.szMessage[0]) ); + pData->curEmailOther.szMessage[sizeof(pData->curEmailOther.szMessage[0])/sizeof(pData->curEmailOther.szMessage[0]) - 1][0] = '\0'; + } + */ + pData->maxReadDepth--; + } + pData->currentDepth--; +} + +BOOLEAN ReadInEmailOther(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + EmailOtherParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EmailOther.xml" ); + + EmailOther_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, EmailOtherStartElementHandle, EmailOtherEndElementHandle); + XML_SetCharacterDataHandler(parser, EmailOtherCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in EmailOther.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/Laptop/XML_EmailMercAvailable.cpp b/Laptop/XML_EmailMercAvailable.cpp new file mode 100644 index 00000000..14d0f13f --- /dev/null +++ b/Laptop/XML_EmailMercAvailable.cpp @@ -0,0 +1,192 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" + #include "Editor All.h" + #include "LuaInitNPCs.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Item Statistics.h" + #include "LuaInitNPCs.h" + #include "email.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAIL_STRING_SIZE+1]; + EMAIL_MERC_AVAILABLE_VALUES curEmailMercAvailable; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +} + +typedef emailMercAvailableParseData; + +BOOLEAN EmailMercAvailable_TextOnly; + +static void XMLCALL +emailMercAvailableStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + emailMercAvailableParseData * pData = (emailMercAvailableParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "EMAIL_MERC_AVAILABLE") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "EMAIL") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "Subject") == 0 || + strcmp(name, "Message") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +emailMercAvailableCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + emailMercAvailableParseData * pData = (emailMercAvailableParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +emailMercAvailableEndElementHandle(void *userData, const XML_Char *name) +{ + emailMercAvailableParseData * pData = (emailMercAvailableParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "EMAIL_MERC_AVAILABLE") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "EMAIL") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!EmailMercAvailable_TextOnly) + { + wcscpy(EmailMercAvailableText[pData->curEmailMercAvailable.uiIndex].szSubject, pData->curEmailMercAvailable.szSubject); + wcscpy(EmailMercAvailableText[pData->curEmailMercAvailable.uiIndex].szMessage, pData->curEmailMercAvailable.szMessage); + } + else + { + wcscpy(EmailMercAvailableText[pData->curEmailMercAvailable.uiIndex].szSubject, pData->curEmailMercAvailable.szSubject); + wcscpy(EmailMercAvailableText[pData->curEmailMercAvailable.uiIndex].szMessage, pData->curEmailMercAvailable.szMessage); + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curEmailMercAvailable.uiIndex = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "Subject") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEmailMercAvailable.szSubject, sizeof(pData->curEmailMercAvailable.szSubject)/sizeof(pData->curEmailMercAvailable.szSubject[0]) ); + pData->curEmailMercAvailable.szSubject[sizeof(pData->curEmailMercAvailable.szSubject)/sizeof(pData->curEmailMercAvailable.szSubject[0]) - 1] = '\0'; + } + else if(strcmp(name, "Message") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEmailMercAvailable.szMessage, sizeof(pData->curEmailMercAvailable.szMessage)/sizeof(pData->curEmailMercAvailable.szMessage[0]) ); + pData->curEmailMercAvailable.szMessage[sizeof(pData->curEmailMercAvailable.szMessage)/sizeof(pData->curEmailMercAvailable.szMessage[0]) - 1] = '\0'; + } + pData->maxReadDepth--; + } + pData->currentDepth--; +} + +BOOLEAN ReadInEmailMercAvailable(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + emailMercAvailableParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EmailMercAvailable.xml" ); + + EmailMercAvailable_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, emailMercAvailableStartElementHandle, emailMercAvailableEndElementHandle); + XML_SetCharacterDataHandler(parser, emailMercAvailableCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in EmailMercAvailable.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/Laptop/XML_EmailMercLevelUp.cpp b/Laptop/XML_EmailMercLevelUp.cpp new file mode 100644 index 00000000..7ec4c5d3 --- /dev/null +++ b/Laptop/XML_EmailMercLevelUp.cpp @@ -0,0 +1,192 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" + #include "Editor All.h" + #include "LuaInitNPCs.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Item Statistics.h" + #include "LuaInitNPCs.h" + #include "email.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAIL_STRING_SIZE+1]; + EMAIL_MERC_LEVEL_UP_VALUES curEmailMercLevelUp; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +} + +typedef emailMercLevelUpParseData; + +BOOLEAN EmailMercLevelUp_TextOnly; + +static void XMLCALL +emailMercLevelUpStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + emailMercLevelUpParseData * pData = (emailMercLevelUpParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "EMAIL_MERC_LEVEL_UP") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "EMAIL") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "Subject") == 0 || + strcmp(name, "Message") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +emailMercLevelUpCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + emailMercLevelUpParseData * pData = (emailMercLevelUpParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +emailMercLevelUpEndElementHandle(void *userData, const XML_Char *name) +{ + emailMercLevelUpParseData * pData = (emailMercLevelUpParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "EMAIL_MERC_LEVEL_UP") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "EMAIL") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!EmailMercLevelUp_TextOnly) + { + wcscpy(EmailMercLevelUpText[pData->curEmailMercLevelUp.uiIndex].szSubject, pData->curEmailMercLevelUp.szSubject); + wcscpy(EmailMercLevelUpText[pData->curEmailMercLevelUp.uiIndex].szMessage, pData->curEmailMercLevelUp.szMessage); + } + else + { + wcscpy(EmailMercLevelUpText[pData->curEmailMercLevelUp.uiIndex].szSubject, pData->curEmailMercLevelUp.szSubject); + wcscpy(EmailMercLevelUpText[pData->curEmailMercLevelUp.uiIndex].szMessage, pData->curEmailMercLevelUp.szMessage); + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curEmailMercLevelUp.uiIndex = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "Subject") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEmailMercLevelUp.szSubject, sizeof(pData->curEmailMercLevelUp.szSubject)/sizeof(pData->curEmailMercLevelUp.szSubject[0]) ); + pData->curEmailMercLevelUp.szSubject[sizeof(pData->curEmailMercLevelUp.szSubject)/sizeof(pData->curEmailMercLevelUp.szSubject[0]) - 1] = '\0'; + } + else if(strcmp(name, "Message") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEmailMercLevelUp.szMessage, sizeof(pData->curEmailMercLevelUp.szMessage)/sizeof(pData->curEmailMercLevelUp.szMessage[0]) ); + pData->curEmailMercLevelUp.szMessage[sizeof(pData->curEmailMercLevelUp.szMessage)/sizeof(pData->curEmailMercLevelUp.szMessage[0]) - 1] = '\0'; + } + pData->maxReadDepth--; + } + pData->currentDepth--; +} + +BOOLEAN ReadInEmailMercLevelUp(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + emailMercLevelUpParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EmailMercLevelUp.xml" ); + + EmailMercLevelUp_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, emailMercLevelUpStartElementHandle, emailMercLevelUpEndElementHandle); + XML_SetCharacterDataHandler(parser, emailMercLevelUpCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in EmailMercLevelUp.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/Laptop/XML_EncyclopediaLocation.cpp b/Laptop/XML_EncyclopediaLocation.cpp new file mode 100644 index 00000000..7adc16b7 --- /dev/null +++ b/Laptop/XML_EncyclopediaLocation.cpp @@ -0,0 +1,1159 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" + #include "Editor All.h" + #include "LuaInitNPCs.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Item Statistics.h" + #include "LuaInitNPCs.h" + #include "email.h" + #include "InterfaceItemImages.h" + #include "Soldier Profile.h" + #include "aim.h" + #include "mercs.h" + #include "Encrypted File.h" + #include "GameSettings.h" +#endif + +#include "Encyclopedia_Data.h" +#include "Encyclopedia.h" + +typedef enum +{ + ENCYCLOPEDIA_ELEMENT_NONE = 0, + ENCYCLOPEDIA_ELEMENT_LIST, + ENCYCLOPEDIA_ELEMENT, + ENCYCLOPEDIA_ELEMENT_PROPERTY, + ENCYCLOPEDIA_ELEMENT_SUBLIST, + ENCYCLOPEDIA_ELEMENT_SUBLIST_PROPERTY, + + +} ENCYCLOPEDIA_PARSE_STAGE; + +typedef struct +{ + ENCYCLOPEDIA_PARSE_STAGE curElement; + + CHAR8 szCharData[ENCYCLOPEDIA_DECRIPTION_SIZE+1]; + ENCYCLOPEDIA_LOCATION curEncyclopediaData; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +}encyclopediaLocationParseData; + + +BOOLEAN EncyclopediaLocation_TextOnly; + +ENCYCLOPEDIA_LOCATION *pEncy; + +//extern BOOLEAN LoadMercBioInfo(UINT8 ubIndex, STR16 pInfoString, STR16 pAddInfo); + +UINT32 FileType = 0; +UINT32 MaxPage = 0; +UINT8 mID = 0; +UINT8 gMercArray[ NUM_PROFILES ]; + +#define SIZE_MERC_BIO_INFO 400 * 2 +#define SIZE_MERC_ADDITIONAL_INFO 160 * 2 +#define MERCBIOSFILENAME "BINARYDATA\\MercBios.edt" +#define AIMBIOSFILENAME "BINARYDATA\\aimbios.edt" + + +CHAR16 MercInfoString[ SIZE_MERC_BIO_INFO ]; +CHAR16 AdditionalInfoString[ SIZE_MERC_BIO_INFO ]; + +BOOLEAN bMERC; + +BOOLEAN LoadEncyclopediaMercBio( UINT8 ubIndex, STR16 pInfoString, STR16 pAddInfo,UINT32 Type ) +{ + HWFILE hFile; + UINT32 uiBytesRead; + //UINT16 i; + UINT32 uiStartSeekAmount; + + if ( Type == 1 ) + hFile = FileOpen(AIMBIOSFILENAME, FILE_ACCESS_READ, FALSE); + else if ( Type == 2 ) + hFile = FileOpen(MERCBIOSFILENAME, FILE_ACCESS_READ, FALSE); + + if ( !hFile ) + { + return( FALSE ); + } + + + // Get current mercs bio info + uiStartSeekAmount = (SIZE_MERC_BIO_INFO + SIZE_MERC_ADDITIONAL_INFO) * ubIndex; + + if ( FileSeek( hFile, uiStartSeekAmount, FILE_SEEK_FROM_START ) == FALSE ) + { + return( FALSE ); + } + + if( !FileRead( hFile, pInfoString, SIZE_MERC_BIO_INFO, &uiBytesRead) ) + { + return( FALSE ); + } + + DecodeString(pInfoString, SIZE_MERC_BIO_INFO); + + // Get the additional info + uiStartSeekAmount = ((SIZE_MERC_BIO_INFO + SIZE_MERC_ADDITIONAL_INFO) * ubIndex )+ SIZE_MERC_BIO_INFO ; + if ( FileSeek( hFile, uiStartSeekAmount, FILE_SEEK_FROM_START ) == FALSE ) + { + return( FALSE ); + } + + if( !FileRead( hFile, pAddInfo, SIZE_MERC_ADDITIONAL_INFO, &uiBytesRead) ) + { + return( FALSE ); + } + + DecodeString(pAddInfo, SIZE_MERC_BIO_INFO); + + FileClose(hFile); + return(TRUE); +} + +BOOLEAN LoadGraphicForItem( ENCYCLOPEDIA_LOCATION *pEncy, UINT32 i ) +{ + CHAR8 zName[ 100 ]; +// UINT32 uiVo; + UINT16 ubGraphic; + CHAR8 zString[512]; +// CHAR8 zString2[512]; + + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("LoadTileGraphicForItem")); + + const char* ext = g_bUsePngItemImages ? ".png" : ".sti"; + + // CHECK SUBCLASS + ubGraphic = Item[i].ubGraphicNum; + + if ( Item[i].ubGraphicType == 0 ) + { + // CHECK SUBCLASS + //ubGraphic++; + + if ( ubGraphic < 10 ) + { + sprintf( zName, "gun0%d", ubGraphic ); + } + else + { + sprintf( zName, "gun%d", ubGraphic ); + } + } + else if ( Item[i].ubGraphicType == 1 ) + { + if ( ubGraphic < 10 ) + { + sprintf( zName, "p1item0%d", ubGraphic ); + } + else + { + sprintf( zName, "p1item%d", ubGraphic ); + } + } + else if ( Item[i].ubGraphicType == 2 ) + { + if ( ubGraphic < 10 ) + { + sprintf( zName, "p2item0%d", ubGraphic ); + } + else + { + sprintf( zName, "p2item%d", ubGraphic ); + } + } + else + { + if ( ubGraphic < 10 ) + { + sprintf( zName, "p3item0%d", ubGraphic ); + } + else + { + sprintf( zName, "p3item%d", ubGraphic ); + } + } + + //Load item + sprintf( zString, "BIGITEMS\\%s%s", zName, ext ); + + strncpy(pEncy[i].szFile, zString,MAX_ENCYCLOPEDIA_CHARS); + + + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("LoadTileGraphicForItem: done")); + + return( TRUE ); +} + +static void XMLCALL +encyclopediaLocationStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + encyclopediaLocationParseData * pData = (encyclopediaLocationParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "ENCYCLOPEDIA") == 0 && pData->curElement == ENCYCLOPEDIA_ELEMENT_NONE) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "DATA") == 0 && pData->curElement == ENCYCLOPEDIA_ELEMENT_LIST) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ENCYCLOPEDIA_ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "Name") == 0 || + strcmp(name, "EnableDesc") == 0 || + strcmp(name, "Hidden") == 0 || + strcmp(name, "Type") == 0 || + strcmp(name, "subGroup") == 0 || + strcmp(name, "SectorX") == 0 || + strcmp(name, "SectorY") == 0 || + strcmp(name, "Level") == 0 || + strcmp(name, "MaxPages") == 0 || + strcmp(name, "PageDesc1") == 0 || + strcmp(name, "PageDesc2") == 0 || + strcmp(name, "PageDesc3") == 0 || + strcmp(name, "PageDesc4") == 0 || + strcmp(name, "PageDesc5") == 0 || + strcmp(name, "PageDesc6") == 0 || + strcmp(name, "PageDesc7") == 0 || + strcmp(name, "PageDesc8") == 0 || + strcmp(name, "PageDesc9") == 0 || + strcmp(name, "PageDesc10") == 0 || + strcmp(name, "PageDesc11") == 0 || + strcmp(name, "PageDesc12") == 0 || + strcmp(name, "PageDesc13") == 0 || + strcmp(name, "PageDesc14") == 0 || + strcmp(name, "PageDesc15") == 0 || + strcmp(name, "PageDesc16") == 0 || + strcmp(name, "PageDesc17") == 0 || + strcmp(name, "PageDesc18") == 0 || + strcmp(name, "PageDesc19") == 0 || + strcmp(name, "PageDesc20") == 0 || + strcmp(name, "MaxImages") == 0 || + strcmp(name, "szFile1") == 0 || + strcmp(name, "szFile2") == 0 || + strcmp(name, "szFile3") == 0 || + strcmp(name, "szFile4") == 0 || + strcmp(name, "ImageDesc1") == 0 || + strcmp(name, "ImageDesc2") == 0 || + strcmp(name, "ImageDesc3") == 0 || + strcmp(name, "ImageDesc4") == 0 || + strcmp(name, "ImagePosition1X") == 0 || + strcmp(name, "ImagePosition1Y") == 0 || + strcmp(name, "ImagePosition2X") == 0 || + strcmp(name, "ImagePosition2Y") == 0 || + strcmp(name, "ImagePosition3X") == 0 || + strcmp(name, "ImagePosition3Y") == 0 || + strcmp(name, "ImagePosition4X") == 0 || + strcmp(name, "ImagePosition4Y") == 0 || + strcmp(name, "SpecialQuestImage") == 0 || + strcmp(name, "BeforeImage") == 0 || + strcmp(name, "AfterImage") == 0 || + strcmp(name, "ImagePositionBeforeX") == 0 || + strcmp(name, "ImagePositionBeforeY") == 0 || + strcmp(name, "ImagePositionAfterX") == 0 || + strcmp(name, "ImagePositionAfterY") == 0 || + strcmp(name, "ImageDescBefore") == 0 || + strcmp(name, "ImageDescAfter") == 0 || + strcmp(name, "szSounds") == 0 || + strcmp(name, "NextMission") == 0 )) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +encyclopediaLocationCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + encyclopediaLocationParseData * pData = (encyclopediaLocationParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + +static void XMLCALL +encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name) +{ + encyclopediaLocationParseData * pData = (encyclopediaLocationParseData *)userData; + + char temp; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "ENCYCLOPEDIA") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT_NONE; + } + else if(strcmp(name, "DATA") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT_LIST; + + if (!EncyclopediaLocation_TextOnly) + { + + //pEncy[pData->curEncyclopediaData.uiIndex].enableDesc = FALSE; + + if ( pData->curEncyclopediaData.enableDesc == TRUE ) pEncy[pData->curEncyclopediaData.uiIndex].enableDesc = FALSE; + else if ( pData->curEncyclopediaData.enableDesc == FALSE ) pEncy[pData->curEncyclopediaData.uiIndex].enableDesc = TRUE; + + pEncy[pData->curEncyclopediaData.uiIndex].uiIndex = pData->curEncyclopediaData.uiIndex; + + if ( pEncy[pData->curEncyclopediaData.uiIndex].SpecialQuestImage == TRUE ) FileType = 3; + + if ( pEncy[pData->curEncyclopediaData.uiIndex].SpecialQuestImage == TRUE ) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, pData->curEncyclopediaData.sDesc1); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc2, pData->curEncyclopediaData.sDesc2); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc3, pData->curEncyclopediaData.sDesc3); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc4, pData->curEncyclopediaData.sDesc4); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc5, pData->curEncyclopediaData.sDesc5); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc6, pData->curEncyclopediaData.sDesc6); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc7, pData->curEncyclopediaData.sDesc7); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc8, pData->curEncyclopediaData.sDesc8); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc9, pData->curEncyclopediaData.sDesc9); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc10, pData->curEncyclopediaData.sDesc10); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc11, pData->curEncyclopediaData.sDesc11); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc12, pData->curEncyclopediaData.sDesc12); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc13, pData->curEncyclopediaData.sDesc13); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc14, pData->curEncyclopediaData.sDesc14); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc15, pData->curEncyclopediaData.sDesc15); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc16, pData->curEncyclopediaData.sDesc16); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc17, pData->curEncyclopediaData.sDesc17); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc18, pData->curEncyclopediaData.sDesc18); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc19, pData->curEncyclopediaData.sDesc19); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc20, pData->curEncyclopediaData.sDesc20); + + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].Name, pData->curEncyclopediaData.Name); + } + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == TRUE && pEncy[pData->curEncyclopediaData.uiIndex].SpecialQuestImage == FALSE ) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, pData->curEncyclopediaData.sDesc1); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc2, pData->curEncyclopediaData.sDesc2); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc3, pData->curEncyclopediaData.sDesc3); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc4, pData->curEncyclopediaData.sDesc4); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc5, pData->curEncyclopediaData.sDesc5); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc6, pData->curEncyclopediaData.sDesc6); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc7, pData->curEncyclopediaData.sDesc7); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc8, pData->curEncyclopediaData.sDesc8); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc9, pData->curEncyclopediaData.sDesc9); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc10, pData->curEncyclopediaData.sDesc10); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc11, pData->curEncyclopediaData.sDesc11); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc12, pData->curEncyclopediaData.sDesc12); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc13, pData->curEncyclopediaData.sDesc13); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc14, pData->curEncyclopediaData.sDesc14); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc15, pData->curEncyclopediaData.sDesc15); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc16, pData->curEncyclopediaData.sDesc16); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc17, pData->curEncyclopediaData.sDesc17); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc18, pData->curEncyclopediaData.sDesc18); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc19, pData->curEncyclopediaData.sDesc19); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc20, pData->curEncyclopediaData.sDesc20); + + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].Name, pData->curEncyclopediaData.Name); + } + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 1 ) + { + for(int cnt = 0;cnt < NUM_PROFILES;cnt++) + { + if ( gConditionsForMercAvailabilityTemp[cnt].ProfilId != 0 ) + { + //mID = gConditionsForMercAvailabilityTemp[cnt].MercBio; + gMercArray[ cnt ] = gConditionsForMercAvailability[cnt].ProfilId; + } + } + + for(int cnt = 0;cnt < NUM_PROFILES;cnt++) + { + if ( gMercArray[ cnt ] == pData->curEncyclopediaData.uiIndex ) + { + mID = gConditionsForMercAvailabilityTemp[cnt].MercBio; + } + } + + if (tempProfiles[pData->curEncyclopediaData.uiIndex].Type == 1 )//if ( gProfilesAIM[ pData->curEncyclopediaData.uiIndex ].ProfilId == pData->curEncyclopediaData.uiIndex ) + { + LoadEncyclopediaMercBio( gAimAvailabilityTemp[pData->curEncyclopediaData.uiIndex].AimBio, MercInfoString, AdditionalInfoString,1); + } + else if (tempProfiles[pData->curEncyclopediaData.uiIndex].Type == 2 )//if ( gProfilesAIM[ pData->curEncyclopediaData.uiIndex ].ProfilId == pData->curEncyclopediaData.uiIndex ) + { + LoadEncyclopediaMercBio( mID, MercInfoString, AdditionalInfoString,2); + } + else + { + MercInfoString[0] = 0; + AdditionalInfoString[0] = 0; + pEncy[pData->curEncyclopediaData.uiIndex].enableDesc = TRUE; + } + + if( MercInfoString[0] != 0) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, MercInfoString); + MaxPage = 0; + } + if( AdditionalInfoString[0] != 0) + { + MaxPage = 2; + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc2, AdditionalInfoString); + } + } + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 2 ) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, Item[pData->curEncyclopediaData.uiIndex].szItemDesc); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].Name, Item[pData->curEncyclopediaData.uiIndex].szLongItemName); + } + + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc1, pData->curEncyclopediaData.sImageDesc1); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc2, pData->curEncyclopediaData.sImageDesc2); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc3, pData->curEncyclopediaData.sImageDesc3); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc4, pData->curEncyclopediaData.sImageDesc4); + + //Specjal Quest Image + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].ImageDescBefore, pData->curEncyclopediaData.ImageDescBefore); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].ImageDescAfter, pData->curEncyclopediaData.ImageDescAfter); + + pEncy[pData->curEncyclopediaData.uiIndex].QuestID = -1; + pEncy[pData->curEncyclopediaData.uiIndex].pQuests = -1; + pEncy[pData->curEncyclopediaData.uiIndex].SpecialQuestImage = pData->curEncyclopediaData.SpecialQuestImage; + + pEncy[pData->curEncyclopediaData.uiIndex].ImagePositionQX[0] = pData->curEncyclopediaData.ImagePositionQX[0]; + pEncy[pData->curEncyclopediaData.uiIndex].ImagePositionQY[0] = pData->curEncyclopediaData.ImagePositionQY[0]; + + pEncy[pData->curEncyclopediaData.uiIndex].ImagePositionQX[1] = pData->curEncyclopediaData.ImagePositionQX[1]; + pEncy[pData->curEncyclopediaData.uiIndex].ImagePositionQY[1] = pData->curEncyclopediaData.ImagePositionQY[1]; + + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].BeforeImage, pData->curEncyclopediaData.BeforeImage,MAX_ENCYCLOPEDIA_CHARS); + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].AfterImage, pData->curEncyclopediaData.AfterImage,MAX_ENCYCLOPEDIA_CHARS); + + + pEncy[pData->curEncyclopediaData.uiIndex].SectorX = pData->curEncyclopediaData.SectorX; + pEncy[pData->curEncyclopediaData.uiIndex].SectorY = pData->curEncyclopediaData.SectorY; + pEncy[pData->curEncyclopediaData.uiIndex].SectorZ = pData->curEncyclopediaData.SectorZ; + + if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == TRUE ) + pEncy[pData->curEncyclopediaData.uiIndex].MaxPages = pData->curEncyclopediaData.MaxPages; + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 1 ) + pEncy[pData->curEncyclopediaData.uiIndex].MaxPages = MaxPage; + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 2 ) + pEncy[pData->curEncyclopediaData.uiIndex].MaxPages = 0; + + pEncy[pData->curEncyclopediaData.uiIndex].MaxImages = pData->curEncyclopediaData.MaxImages; + + if ( pData->curEncyclopediaData.MaxImages > MAX_IMAGES ) + pEncy[pData->curEncyclopediaData.uiIndex].MaxImages = 0; + + if ( pData->curEncyclopediaData.MaxPages > MAX_PAGES ) + pEncy[pData->curEncyclopediaData.uiIndex].MaxPages = 0; + + if (pData->curEncyclopediaData.Hidden == FALSE ) + pEncy[pData->curEncyclopediaData.uiIndex].Hidden = TRUE; + else + pEncy[pData->curEncyclopediaData.uiIndex].Hidden = FALSE; + + if (pEncy[pData->curEncyclopediaData.uiIndex].Hidden == TRUE ) + pEncy[pData->curEncyclopediaData.uiIndex].Filtr = TRUE; + else + pEncy[pData->curEncyclopediaData.uiIndex].Filtr = FALSE; + + if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 2 ) //0 - location , 2 - guns, 1 - profiles + LoadGraphicForItem( pEncy, pData->curEncyclopediaData.uiIndex); + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 1 ) //0 - location , 2 - guns, 1 - profiles + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].szFile, pData->curEncyclopediaData.szFile,MAX_ENCYCLOPEDIA_CHARS); + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == TRUE ) + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].szFile, pData->curEncyclopediaData.szFile,MAX_ENCYCLOPEDIA_CHARS); + + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].szFile2, pData->curEncyclopediaData.szFile2,MAX_ENCYCLOPEDIA_CHARS); + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].szFile3, pData->curEncyclopediaData.szFile3,MAX_ENCYCLOPEDIA_CHARS); + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].szFile4, pData->curEncyclopediaData.szFile4,MAX_ENCYCLOPEDIA_CHARS); + + strncpy(pEncy[pData->curEncyclopediaData.uiIndex].sSounds, pData->curEncyclopediaData.sSounds,MAX_ENCYCLOPEDIA_CHARS); + + if ( FileType == 4 ) //briefing room + pEncy[pData->curEncyclopediaData.uiIndex].NextMission = pData->curEncyclopediaData.NextMission; + else + pEncy[pData->curEncyclopediaData.uiIndex].NextMission = -1; + + pEncy[pData->curEncyclopediaData.uiIndex].MissionID = pData->curEncyclopediaData.uiIndex; + + pEncy[pData->curEncyclopediaData.uiIndex].IDProfile = -1; + + if ( pData->curEncyclopediaData.subGroup1 == 0 ) + pEncy[pData->curEncyclopediaData.uiIndex].subGroup1 = -1; + else + pEncy[pData->curEncyclopediaData.uiIndex].subGroup1 = pData->curEncyclopediaData.subGroup1; + + pEncy[pData->curEncyclopediaData.uiIndex].LocType = pData->curEncyclopediaData.LocType; + + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionX[0] = pData->curEncyclopediaData.sImagePositionX[0]; + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionY[0] = pData->curEncyclopediaData.sImagePositionY[0]; + + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionX[1] = pData->curEncyclopediaData.sImagePositionX[1]; + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionY[1] = pData->curEncyclopediaData.sImagePositionY[1]; + + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionX[2] = pData->curEncyclopediaData.sImagePositionX[2]; + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionY[2] = pData->curEncyclopediaData.sImagePositionY[2]; + + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionX[3] = pData->curEncyclopediaData.sImagePositionX[3]; + pEncy[pData->curEncyclopediaData.uiIndex].sImagePositionY[3] = pData->curEncyclopediaData.sImagePositionY[3]; + + } + else + { + + if ( pEncy[pData->curEncyclopediaData.uiIndex].SpecialQuestImage == TRUE ) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, pData->curEncyclopediaData.sDesc1); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc2, pData->curEncyclopediaData.sDesc2); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc3, pData->curEncyclopediaData.sDesc3); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc4, pData->curEncyclopediaData.sDesc4); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc5, pData->curEncyclopediaData.sDesc5); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc6, pData->curEncyclopediaData.sDesc6); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc7, pData->curEncyclopediaData.sDesc7); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc8, pData->curEncyclopediaData.sDesc8); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc9, pData->curEncyclopediaData.sDesc9); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc10, pData->curEncyclopediaData.sDesc10); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc11, pData->curEncyclopediaData.sDesc11); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc12, pData->curEncyclopediaData.sDesc12); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc13, pData->curEncyclopediaData.sDesc13); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc14, pData->curEncyclopediaData.sDesc14); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc15, pData->curEncyclopediaData.sDesc15); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc16, pData->curEncyclopediaData.sDesc16); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc17, pData->curEncyclopediaData.sDesc17); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc18, pData->curEncyclopediaData.sDesc18); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc19, pData->curEncyclopediaData.sDesc19); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc20, pData->curEncyclopediaData.sDesc20); + + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].Name, pData->curEncyclopediaData.Name); + } + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == TRUE && pEncy[pData->curEncyclopediaData.uiIndex].SpecialQuestImage == FALSE ) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, pData->curEncyclopediaData.sDesc1); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc2, pData->curEncyclopediaData.sDesc2); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc3, pData->curEncyclopediaData.sDesc3); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc4, pData->curEncyclopediaData.sDesc4); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc5, pData->curEncyclopediaData.sDesc5); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc6, pData->curEncyclopediaData.sDesc6); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc7, pData->curEncyclopediaData.sDesc7); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc8, pData->curEncyclopediaData.sDesc8); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc9, pData->curEncyclopediaData.sDesc9); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc10, pData->curEncyclopediaData.sDesc10); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc11, pData->curEncyclopediaData.sDesc11); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc12, pData->curEncyclopediaData.sDesc12); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc13, pData->curEncyclopediaData.sDesc13); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc14, pData->curEncyclopediaData.sDesc14); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc15, pData->curEncyclopediaData.sDesc15); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc16, pData->curEncyclopediaData.sDesc16); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc17, pData->curEncyclopediaData.sDesc17); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc18, pData->curEncyclopediaData.sDesc18); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc19, pData->curEncyclopediaData.sDesc19); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc20, pData->curEncyclopediaData.sDesc20); + + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].Name, pData->curEncyclopediaData.Name); + } + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 1 ) + { + + for(int cnt = 0;cnt < NUM_PROFILES;cnt++) + { + if ( gConditionsForMercAvailabilityTemp[cnt].ProfilId != 0 ) + { + //mID = gConditionsForMercAvailabilityTemp[cnt].MercBio; + gMercArray[ cnt ] = gConditionsForMercAvailability[cnt].ProfilId; + } + } + + for(int cnt = 0;cnt < NUM_PROFILES;cnt++) + { + if ( gMercArray[ cnt ] == pData->curEncyclopediaData.uiIndex ) + { + mID = gConditionsForMercAvailabilityTemp[cnt].MercBio; + } + } + + if (tempProfiles[pData->curEncyclopediaData.uiIndex].Type == 1 )//if ( gProfilesAIM[ pData->curEncyclopediaData.uiIndex ].ProfilId == pData->curEncyclopediaData.uiIndex ) + { + LoadEncyclopediaMercBio( gAimAvailabilityTemp[pData->curEncyclopediaData.uiIndex].AimBio, MercInfoString, AdditionalInfoString,1); + } + else if (tempProfiles[pData->curEncyclopediaData.uiIndex].Type == 2 )//if ( gProfilesAIM[ pData->curEncyclopediaData.uiIndex ].ProfilId == pData->curEncyclopediaData.uiIndex ) + { + LoadEncyclopediaMercBio( mID, MercInfoString, AdditionalInfoString,2); + } + else + { + MercInfoString[0] = 0; + AdditionalInfoString[0] = 0; + pEncy[pData->curEncyclopediaData.uiIndex].enableDesc = TRUE; + } + + if( MercInfoString[0] != 0) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, MercInfoString); + MaxPage = 0; + } + if( AdditionalInfoString[0] != 0) + { + MaxPage = 1; + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc2, AdditionalInfoString); + } + } + else if ( pEncy[pData->curEncyclopediaData.uiIndex].enableDesc == FALSE && FileType == 2 ) + { + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sDesc1, Item[pData->curEncyclopediaData.uiIndex].szItemDesc); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].Name, Item[pData->curEncyclopediaData.uiIndex].szLongItemName); + } + + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc1, pData->curEncyclopediaData.sImageDesc1); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc2, pData->curEncyclopediaData.sImageDesc2); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc3, pData->curEncyclopediaData.sImageDesc3); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].sImageDesc4, pData->curEncyclopediaData.sImageDesc4); + + //Specjal Quest Image + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].ImageDescBefore, pData->curEncyclopediaData.ImageDescBefore); + wcscpy(pEncy[pData->curEncyclopediaData.uiIndex].ImageDescAfter, pData->curEncyclopediaData.ImageDescAfter); + + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.uiIndex = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "Name") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.Name, sizeof(pData->curEncyclopediaData.Name)/sizeof(pData->curEncyclopediaData.Name[0]) ); + pData->curEncyclopediaData.Name[sizeof(pData->curEncyclopediaData.Name)/sizeof(pData->curEncyclopediaData.Name[0]) - 1] = '\0'; + } + else if(strcmp(name, "EnableDesc") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.enableDesc = (BOOLEAN) atol(pData->szCharData); + } + else if(strcmp(name, "Hidden") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.Hidden = (BOOLEAN) atol(pData->szCharData); + } + else if(strcmp(name, "Type") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.LocType = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "subGroup") == 0 ) //&& FileType == 1 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.subGroup1 = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "SectorX") == 0 ) //&& FileType == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.SectorX = (INT16) atol(pData->szCharData); + } + else if(strcmp(name, "SectorY") == 0 ) //&& FileType == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.SectorY = (INT16) atol(pData->szCharData); + } + else if(strcmp(name, "Level") == 0 )//&& FileType == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.SectorZ = (INT16) atol(pData->szCharData); + } + else if(strcmp(name, "MaxPages") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.MaxPages = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "PageDesc1") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc1, sizeof(pData->curEncyclopediaData.sDesc1)/sizeof(pData->curEncyclopediaData.sDesc1[0]) ); + pData->curEncyclopediaData.sDesc1[sizeof(pData->curEncyclopediaData.sDesc1)/sizeof(pData->curEncyclopediaData.sDesc1[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc2") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc2, sizeof(pData->curEncyclopediaData.sDesc2)/sizeof(pData->curEncyclopediaData.sDesc2[0]) ); + pData->curEncyclopediaData.sDesc2[sizeof(pData->curEncyclopediaData.sDesc2)/sizeof(pData->curEncyclopediaData.sDesc2[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc3") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc3, sizeof(pData->curEncyclopediaData.sDesc3)/sizeof(pData->curEncyclopediaData.sDesc3[0]) ); + pData->curEncyclopediaData.sDesc3[sizeof(pData->curEncyclopediaData.sDesc3)/sizeof(pData->curEncyclopediaData.sDesc3[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc4") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc4, sizeof(pData->curEncyclopediaData.sDesc4)/sizeof(pData->curEncyclopediaData.sDesc4[0]) ); + pData->curEncyclopediaData.sDesc4[sizeof(pData->curEncyclopediaData.sDesc4)/sizeof(pData->curEncyclopediaData.sDesc4[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc5") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc5, sizeof(pData->curEncyclopediaData.sDesc5)/sizeof(pData->curEncyclopediaData.sDesc5[0]) ); + pData->curEncyclopediaData.sDesc5[sizeof(pData->curEncyclopediaData.sDesc5)/sizeof(pData->curEncyclopediaData.sDesc5[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc6") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc6, sizeof(pData->curEncyclopediaData.sDesc6)/sizeof(pData->curEncyclopediaData.sDesc6[0]) ); + pData->curEncyclopediaData.sDesc6[sizeof(pData->curEncyclopediaData.sDesc6)/sizeof(pData->curEncyclopediaData.sDesc6[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc7") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc7, sizeof(pData->curEncyclopediaData.sDesc7)/sizeof(pData->curEncyclopediaData.sDesc7[0]) ); + pData->curEncyclopediaData.sDesc7[sizeof(pData->curEncyclopediaData.sDesc7)/sizeof(pData->curEncyclopediaData.sDesc7[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc8") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc8, sizeof(pData->curEncyclopediaData.sDesc8)/sizeof(pData->curEncyclopediaData.sDesc8[0]) ); + pData->curEncyclopediaData.sDesc8[sizeof(pData->curEncyclopediaData.sDesc8)/sizeof(pData->curEncyclopediaData.sDesc8[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc9") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc9, sizeof(pData->curEncyclopediaData.sDesc9)/sizeof(pData->curEncyclopediaData.sDesc9[0]) ); + pData->curEncyclopediaData.sDesc9[sizeof(pData->curEncyclopediaData.sDesc9)/sizeof(pData->curEncyclopediaData.sDesc9[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc10") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc10, sizeof(pData->curEncyclopediaData.sDesc10)/sizeof(pData->curEncyclopediaData.sDesc10[0]) ); + pData->curEncyclopediaData.sDesc10[sizeof(pData->curEncyclopediaData.sDesc10)/sizeof(pData->curEncyclopediaData.sDesc10[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc11") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc11, sizeof(pData->curEncyclopediaData.sDesc11)/sizeof(pData->curEncyclopediaData.sDesc11[0]) ); + pData->curEncyclopediaData.sDesc11[sizeof(pData->curEncyclopediaData.sDesc11)/sizeof(pData->curEncyclopediaData.sDesc11[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc12") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc12, sizeof(pData->curEncyclopediaData.sDesc12)/sizeof(pData->curEncyclopediaData.sDesc12[0]) ); + pData->curEncyclopediaData.sDesc12[sizeof(pData->curEncyclopediaData.sDesc12)/sizeof(pData->curEncyclopediaData.sDesc12[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc13") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc13, sizeof(pData->curEncyclopediaData.sDesc13)/sizeof(pData->curEncyclopediaData.sDesc13[0]) ); + pData->curEncyclopediaData.sDesc13[sizeof(pData->curEncyclopediaData.sDesc13)/sizeof(pData->curEncyclopediaData.sDesc13[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc14") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc14, sizeof(pData->curEncyclopediaData.sDesc14)/sizeof(pData->curEncyclopediaData.sDesc14[0]) ); + pData->curEncyclopediaData.sDesc14[sizeof(pData->curEncyclopediaData.sDesc14)/sizeof(pData->curEncyclopediaData.sDesc14[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc15") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc15, sizeof(pData->curEncyclopediaData.sDesc15)/sizeof(pData->curEncyclopediaData.sDesc15[0]) ); + pData->curEncyclopediaData.sDesc15[sizeof(pData->curEncyclopediaData.sDesc15)/sizeof(pData->curEncyclopediaData.sDesc15[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc16") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc16, sizeof(pData->curEncyclopediaData.sDesc16)/sizeof(pData->curEncyclopediaData.sDesc16[0]) ); + pData->curEncyclopediaData.sDesc16[sizeof(pData->curEncyclopediaData.sDesc16)/sizeof(pData->curEncyclopediaData.sDesc16[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc17") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc17, sizeof(pData->curEncyclopediaData.sDesc17)/sizeof(pData->curEncyclopediaData.sDesc17[0]) ); + pData->curEncyclopediaData.sDesc17[sizeof(pData->curEncyclopediaData.sDesc17)/sizeof(pData->curEncyclopediaData.sDesc17[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc18") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc18, sizeof(pData->curEncyclopediaData.sDesc18)/sizeof(pData->curEncyclopediaData.sDesc18[0]) ); + pData->curEncyclopediaData.sDesc18[sizeof(pData->curEncyclopediaData.sDesc18)/sizeof(pData->curEncyclopediaData.sDesc18[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc19") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc19, sizeof(pData->curEncyclopediaData.sDesc19)/sizeof(pData->curEncyclopediaData.sDesc19[0]) ); + pData->curEncyclopediaData.sDesc19[sizeof(pData->curEncyclopediaData.sDesc19)/sizeof(pData->curEncyclopediaData.sDesc19[0]) - 1] = '\0'; + } + else if(strcmp(name, "PageDesc20") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sDesc20, sizeof(pData->curEncyclopediaData.sDesc20)/sizeof(pData->curEncyclopediaData.sDesc20[0]) ); + pData->curEncyclopediaData.sDesc20[sizeof(pData->curEncyclopediaData.sDesc20)/sizeof(pData->curEncyclopediaData.sDesc20[0]) - 1] = '\0'; + } + else if(strcmp(name, "MaxImages") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.MaxImages = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "szFile1") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.szFile,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.szFile,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.szFile[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.szFile[i] = temp; + } + + } + else if(strcmp(name, "szFile2") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.szFile2,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.szFile2,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.szFile2[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.szFile2[i] = temp; + } + + } + else if(strcmp(name, "szFile3") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.szFile3,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.szFile3,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.szFile3[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.szFile3[i] = temp; + } + + } + else if(strcmp(name, "szFile4") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.szFile4,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.szFile4,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.szFile4[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.szFile4[i] = temp; + } + + } + + else if(strcmp(name, "ImageDesc1") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sImageDesc1, sizeof(pData->curEncyclopediaData.sImageDesc1)/sizeof(pData->curEncyclopediaData.sImageDesc1[0]) ); + pData->curEncyclopediaData.sImageDesc1[sizeof(pData->curEncyclopediaData.sImageDesc1)/sizeof(pData->curEncyclopediaData.sImageDesc1[0]) - 1] = '\0'; + } + else if(strcmp(name, "ImageDesc2") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sImageDesc2, sizeof(pData->curEncyclopediaData.sImageDesc2)/sizeof(pData->curEncyclopediaData.sImageDesc2[0]) ); + pData->curEncyclopediaData.sImageDesc2[sizeof(pData->curEncyclopediaData.sImageDesc2)/sizeof(pData->curEncyclopediaData.sImageDesc2[0]) - 1] = '\0'; + } + else if(strcmp(name, "ImageDesc3") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sImageDesc3, sizeof(pData->curEncyclopediaData.sImageDesc3)/sizeof(pData->curEncyclopediaData.sImageDesc3[0]) ); + pData->curEncyclopediaData.sImageDesc3[sizeof(pData->curEncyclopediaData.sImageDesc3)/sizeof(pData->curEncyclopediaData.sImageDesc3[0]) - 1] = '\0'; + } + else if(strcmp(name, "ImageDesc4") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sImageDesc4, sizeof(pData->curEncyclopediaData.sImageDesc4)/sizeof(pData->curEncyclopediaData.sImageDesc4[0]) ); + pData->curEncyclopediaData.sImageDesc4[sizeof(pData->curEncyclopediaData.sImageDesc4)/sizeof(pData->curEncyclopediaData.sImageDesc4[0]) - 1] = '\0'; + } + else if(strcmp(name, "ImagePosition1X") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionX[0] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition1Y") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionY[0] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition2X") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionX[1] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition2Y") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionY[1] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition3X") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionX[2] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition3Y") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionY[2] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition4X") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionX[3] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition4Y") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.sImagePositionY[3] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "SpecialQuestImage") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.SpecialQuestImage = (BOOLEAN) atol(pData->szCharData); + } + else if(strcmp(name, "BeforeImage") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.BeforeImage,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.BeforeImage,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.BeforeImage[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.BeforeImage[i] = temp; + } + } + else if(strcmp(name, "AfterImage") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.AfterImage,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.AfterImage,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.AfterImage[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.AfterImage[i] = temp; + } + } + else if(strcmp(name, "ImagePositionBeforeX") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.ImagePositionQX[0] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePositionBeforeY") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.ImagePositionQY[0] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePositionAfterX") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.ImagePositionQX[1] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePositionAfterY") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.ImagePositionQY[1] = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImageDescBefore") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.ImageDescBefore, sizeof(pData->curEncyclopediaData.ImageDescBefore)/sizeof(pData->curEncyclopediaData.ImageDescBefore[0]) ); + pData->curEncyclopediaData.ImageDescBefore[sizeof(pData->curEncyclopediaData.ImageDescBefore)/sizeof(pData->curEncyclopediaData.ImageDescBefore[0]) - 1] = '\0'; + } + else if(strcmp(name, "ImageDescAfter") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.ImageDescAfter, sizeof(pData->curEncyclopediaData.ImageDescAfter)/sizeof(pData->curEncyclopediaData.ImageDescAfter[0]) ); + pData->curEncyclopediaData.ImageDescAfter[sizeof(pData->curEncyclopediaData.ImageDescAfter)/sizeof(pData->curEncyclopediaData.ImageDescAfter[0]) - 1] = '\0'; + } + else if(strcmp(name, "SecretCode") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curEncyclopediaData.sCode, sizeof(pData->curEncyclopediaData.sCode)/sizeof(pData->curEncyclopediaData.sCode[0]) ); + pData->curEncyclopediaData.sCode[sizeof(pData->curEncyclopediaData.sCode)/sizeof(pData->curEncyclopediaData.sCode[0]) - 1] = '\0'; + } + else if(strcmp(name, "szSounds") == 0 ) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + + if(MAX_ENCYCLOPEDIA_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curEncyclopediaData.sSounds,pData->szCharData); + else + { + strncpy(pData->curEncyclopediaData.sSounds,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS); + pData->curEncyclopediaData.sSounds[MAX_ENCYCLOPEDIA_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ENCYCLOPEDIA_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curEncyclopediaData.sSounds[i] = temp; + } + + } + else if(strcmp(name, "NextMission") == 0) + { + pData->curElement = ENCYCLOPEDIA_ELEMENT; + pData->curEncyclopediaData.NextMission = (INT32) atol(pData->szCharData); + } + + + pData->maxReadDepth--; + } + pData->currentDepth--; +} + +BOOLEAN ReadInEncyclopediaLocation(STR fileName, BOOLEAN localizedVersion, ENCYCLOPEDIA_LOCATION *Ency, UINT32 FileType2 ) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + encyclopediaLocationParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EncyclopediaLocation.xml" ); + + EncyclopediaLocation_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, encyclopediaLocationStartElementHandle, encyclopediaLocationEndElementHandle); + XML_SetCharacterDataHandler(parser, encyclopediaLocationCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + pEncy = Ency; + FileType = FileType2; + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in EncyclopediaLocation.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/Laptop/email.cpp b/Laptop/email.cpp index 1340ed80..62ff2849 100644 --- a/Laptop/email.cpp +++ b/Laptop/email.cpp @@ -26,6 +26,20 @@ #include "GameSettings.h" #include #endif +#include "soldier profile type.h" + +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "ub_config.h" + +#define EMAIL_EDT_FILE_JA25 "BINARYDATA\\Email25.edt" +#define EMAIL_EDT_FILE_JA2 "BINARYDATA\\Email.edt" +#endif + +#define EMAIL_EDT_CUSTOM_FILE "BINARYDATA\\Email_Custom.edt" +void AddCustomEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition); + using namespace std; //static EmailPtr pEmailList; @@ -245,8 +259,14 @@ UINT32 guiEmailMessage; UINT32 guiMAILDIVIDER; INT16 giCurrentIMPSlot = PLAYER_GENERATED_CHARACTER_ID; - - +EMAIL_MERC_AVAILABLE_VALUES EmailMercAvailableText[NUM_PROFILES]; +EMAIL_MERC_LEVEL_UP_VALUES EmailMercLevelUpText[NUM_PROFILES]; +EMAIL_OTHER_VALUES EmailOtherText[EMAIL_INDEX]; +EMAIL_MERC_INSURANCE_VALUES EmailInsuranceText[NUM_PROFILES]; +BOOLEAN ReadXMLEmail = TRUE; // TRUE - read email from XML, FALSE - read email from EDT +EMAIL_TYPE gEmailT[EMAIL_VAL]; +BOOLEAN SaveNewEmailDataToSaveGameFile( HWFILE hFile ); +BOOLEAN LoadNewEmailDataFromLoadGameFile( HWFILE hFile ); // the enumeration of headers enum{ @@ -314,6 +334,10 @@ void AddEmailRecordToList( STR16 pString ); void UpDateMessageRecordList( void ); void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ); BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ); +#ifdef JA2UB +BOOLEAN HandleNewUBMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ); +void AddBobbyREmailJA2(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType ); +#endif void HandleIMPCharProfileResultsMessage( void ); void HandleEmailViewerButtonStates( void ); void SetUpIconForButton( void ); @@ -662,27 +686,17 @@ void RenderEmail( void ) return; } -void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData ) +//-----------Custom email +void AddCustomEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType ) { CHAR16 pSubject[320]; //MessagePtr pMessageList; //MessagePtr pMessage; //CHAR16 pMessageString[320]; - Email FakeEmail; - - - // starts at iSubjectOffset amd goes iSubjectLength, reading in string - LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", pSubject, 640*(iMessageOffset), 640); - - //Make a fake email that will contain the codes ( ie the merc ID ) - FakeEmail.iFirstData = iFirstData; - FakeEmail.uiSecondData = uiSecondData; - - //Replace the $mercname$ with the actual mercname - ReplaceMercNameAndAmountWithProperData( pSubject, &FakeEmail ); - + + LoadEncryptedDataFromFile(EMAIL_EDT_CUSTOM_FILE, pSubject, 640*(iMessageOffset), 640); // add message to list - AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1); + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_E_NONE ); // if we are in fact int he laptop, redraw icons, might be change in mail status @@ -695,7 +709,211 @@ void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 u return; } -void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition) +//-- + +void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData, UINT8 EmailType, UINT32 EmailAIM ) +{ + CHAR16 pSubject[320]; + //MessagePtr pMessageList; + //MessagePtr pMessage; + //CHAR16 pMessageString[320]; + Email FakeEmail; + + + // starts at iSubjectOffset amd goes iSubjectLength, reading in string +#ifdef JA2UB + if ( EmailType == TYPE_EMAIL_EMAIL_EDT ) + { + if (FileExists(EMAIL_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA25, pSubject, 640*(iMessageOffset), 640); + } + else + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + } + } + else if ( EmailType == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + } +#else + LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", pSubject, 640*(iMessageOffset), 640); +#endif + + //Make a fake email that will contain the codes ( ie the merc ID ) + FakeEmail.iFirstData = iFirstData; + FakeEmail.uiSecondData = uiSecondData; + + //Replace the $mercname$ with the actual mercname + ReplaceMercNameAndAmountWithProperData( pSubject, &FakeEmail ); + + // add message to list + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1, EmailType, EmailAIM ); + + // if we are in fact int he laptop, redraw icons, might be change in mail status + + if( fCurrentlyInLaptop == TRUE ) + { + // redraw icons, might be new mail + DrawLapTopIcons(); + } + + return; +} + +//--- XML Read Mail --- + +void AddEmailWithSpecialDataXML(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData, UINT8 EmailType, UINT32 EmailAIM ) +{ + CHAR16 pSubject[320]; + //MessagePtr pMessageList; + //MessagePtr pMessage; + //CHAR16 pMessageString[320]; + Email FakeEmail; + UINT8 subjectLine = 0; + + if ( EmailType == TYPE_EMAIL_INSURANCE_COMPANY ) + { + wcscpy( pSubject, EmailInsuranceText[iMessageLength].szSubject ); + } + + // starts at iSubjectOffset amd goes iSubjectLength, reading in string + //LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", pSubject, 640*(iMessageOffset), 640); + + //Make a fake email that will contain the codes ( ie the merc ID ) + FakeEmail.iFirstData = iFirstData; + FakeEmail.uiSecondData = uiSecondData; + + //Replace the $mercname$ with the actual mercname + ReplaceMercNameAndAmountWithProperData( pSubject, &FakeEmail ); + + // add message to list + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1, EmailType, EmailAIM); + + // if we are in fact int he laptop, redraw icons, might be change in mail status + + if( fCurrentlyInLaptop == TRUE ) + { + // redraw icons, might be new mail + DrawLapTopIcons(); + } + + return; +} + +void AddPreReadEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, UINT8 EmailType ) +{ + CHAR16 pSubject[320]; + + UINT8 subjectLine = 0; + if ( EmailType == TYPE_EMAIL_AIM_AVAILABLE ) + { + if (EmailMercAvailableText[subjectLine].szSubject !='\0') + wcscpy( pSubject, EmailMercAvailableText[ubSender].szSubject ); + else + wcscpy( pSubject, L"None" ); + } + else if ( EmailType == TYPE_EMAIL_MERC_LEVEL_UP ) + { + if (EmailMercLevelUpText[subjectLine].szSubject !='\0') + wcscpy( pSubject, EmailMercLevelUpText[ubSender].szSubject ); + else + wcscpy( pSubject, L"None" ); + } + + // add message to list + AddEmailMessage( iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 , EmailType, TYPE_E_NONE ); + + // if we are in fact int he laptop, redraw icons, might be change in mail status + + if( fCurrentlyInLaptop == TRUE ) + { + // redraw icons, might be new mail + DrawLapTopIcons(); + } + + return; +} + +void AddEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, UINT8 EmailType ) +{ + CHAR16 pSubject[320]; + + UINT8 subjectLine = 0; + if ( EmailType == TYPE_EMAIL_AIM_AVAILABLE ) + { + if (EmailMercAvailableText[subjectLine].szSubject !='\0') + wcscpy( pSubject, EmailMercAvailableText[ubSender].szSubject ); + else + wcscpy( pSubject, L"None" ); + } + else if ( EmailType == TYPE_EMAIL_MERC_LEVEL_UP ) + { + if (EmailMercLevelUpText[subjectLine].szSubject !='\0') + wcscpy( pSubject, EmailMercLevelUpText[ubSender].szSubject ); + else + wcscpy( pSubject, L"None" ); + } + /* + else if ( EmailType == TYPE_EMAIL_BOBBY_R ) + { + if (EmailBobbyRText[0] !='\0') + wcscpy( pSubject, EmailBobbyRText[0] ); + else + wcscpy( pSubject, L"None" ); + } + */ + /*else if ( EmailType == TYPE_EMAIL_OTHER ) + { + //if (EmailOtherText[subjectLine].szSubject !='\0') + wcscpy( pSubject, EmailOtherText[iMessageLength].szSubject ); + //else + // wcscpy( pSubject, L"None" ); + } + */ + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1, EmailType, TYPE_E_NONE); + + // if we are in fact int he laptop, redraw icons, might be change in mail status + + if( fCurrentlyInLaptop == TRUE ) + { + // redraw icons, might be new mail + DrawLapTopIcons(); + } + + return; +} + +#ifdef JA2UB +void AddBobbyREmailJA2(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType ) +{ + CHAR16 pSubject[320]; + UINT8 subjectLine = 0; + //MessagePtr pMessageList; + //MessagePtr pMessage; + //CHAR16 pMessageString[320]; + + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + + // add message to list + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_EMAIL_BOBBY_R_L1); + + // if we are in fact int he laptop, redraw icons, might be change in mail status + + if( fCurrentlyInLaptop == TRUE ) + { + // redraw icons, might be new mail + DrawLapTopIcons(); + } + + return; +} +#endif + +//--- End XML Read Mail --- + +void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, UINT8 EmailType) { CHAR16 pSubject[320]; @@ -708,9 +926,9 @@ void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 u else subjectLine = 16; // -> see: New113AIMMercMailTexts - wcscpy( pSubject, New113AIMMercMailTexts[subjectLine] ); + wcscpy( pSubject, New113AIMMercMailTexts[subjectLine] ); - AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1 ); + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1 , EmailType, TYPE_E_NONE); // if we are in fact int he laptop, redraw icons, might be change in mail status @@ -723,18 +941,41 @@ void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 u return; } -void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID) +void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType) { CHAR16 pSubject[320]; + UINT8 subjectLine = 0; //MessagePtr pMessageList; //MessagePtr pMessage; //CHAR16 pMessageString[320]; +#ifdef JA2UB + if ( EmailType == TYPE_EMAIL_EMAIL_EDT ) + { + if (FileExists(EMAIL_EDT_FILE_JA25)) + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA25, pSubject, 640*(iMessageOffset), 640); + else + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + } + else if ( EmailType == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + } + else if ( EmailType == TYPE_EMAIL_BOBBY_R ) + { + /* if (EmailBobbyRText[0] !='\0') + wcscpy( pSubject, EmailBobbyRText[0] ); + else + wcscpy( pSubject, L"None" ); + */ + } + +#else // WANNE: Short work in both ways LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", pSubject, 640*(iMessageOffset), 640); - +#endif // add message to list - AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID ); + AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_E_NONE); // if we are in fact int he laptop, redraw icons, might be change in mail status @@ -747,19 +988,31 @@ void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 return; } -void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate) +void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate , UINT8 EmailType ) { CHAR16 pSubject[320]; //MessagePtr pMessageList; //MessagePtr pMessage; //CHAR16 pMessageString[320]; - +#ifdef JA2UB + if ( EmailType == TYPE_EMAIL_EMAIL_EDT ) + { + if (FileExists(EMAIL_EDT_FILE_JA25) ) + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA25, pSubject, 640*(iMessageOffset), 640); + else + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + } + else if ( EmailType == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, pSubject, 640*(iMessageOffset), 640); + } +#else // starts at iSubjectOffset amd goes iSubjectLength, reading in string LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", pSubject, 640*(iMessageOffset), 640); - +#endif // add message to list - AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 ); + AddEmailMessage( iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 , EmailType, TYPE_E_NONE ); // if we are in fact int he laptop, redraw icons, might be change in mail status @@ -772,7 +1025,7 @@ void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, return; } -void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, INT32 iDate, UINT8 ubSender, BOOLEAN fAlreadyRead, INT32 iFirstData, UINT32 uiSecondData, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID ) +void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, INT32 iDate, UINT8 ubSender, BOOLEAN fAlreadyRead, INT32 iFirstData, UINT32 uiSecondData, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType, UINT32 EmailAIM ) { // will add a message to the list of messages EmailPtr pEmail=pEmailList; @@ -830,6 +1083,9 @@ void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, memset( pTempEmail->pSubject, 0, sizeof( CHAR16 ) * 128 ); wcscpy(pTempEmail->pSubject,pSubject); + pTempEmail->EmailVersion = EmailType; + + pTempEmail->EmailType = EmailAIM; // copy offset and length of the actual message in email.edt pTempEmail->usOffset =(UINT16)iMessageOffset; @@ -849,6 +1105,8 @@ void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, pTempEmail->iId=iId+1; else pTempEmail->iId=0; + gEmailT[ (UINT32)pTempEmail->iId ].EmailVersion = EmailType; + gEmailT[ (UINT32)pTempEmail->iId ].EmailType = EmailAIM; // copy date and sender id's pTempEmail->iDate=iDate; @@ -904,6 +1162,9 @@ void RemoveEmailMessage(INT32 iId) // look for message pEmail = GetEmailMessage( iId ); + + gEmailT[ (UINT32)iId ].EmailType = 0; + //while((pEmail->iId !=iId)&&(pEmail->Next)) // pEmail=pEmail->Next; @@ -1285,10 +1546,21 @@ void SwapMessages(INT32 iIdA, INT32 iIdB) pTemp->iId=pA->iId; pTemp->fRead=pA->fRead; pTemp->fNew=pA->fNew; - pTemp->usOffset=pA->usOffset; + pTemp->usOffset=pA->usOffset; + pTemp->EmailVersion=pA->EmailVersion; pTemp->usLength=pA->usLength; pTemp->iDate=pA->iDate; pTemp->ubSender=pA->ubSender; + + if ( pA->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE ) + wcscpy(pTemp->pSubject,EmailMercAvailableText[pA->ubSender].szSubject); + else if ( pA->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP ) + wcscpy(pTemp->pSubject,EmailMercLevelUpText[pA->ubSender].szSubject); + //else if ( pA->EmailVersion == TYPE_EMAIL_OTHER ) + // wcscpy(pTemp->pSubject,EmailOtherText[pA->usLength].szSubject); + else if ( pA->EmailVersion == TYPE_EMAIL_BOBBY_R || pA->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT ) + wcscpy(pTemp->pSubject,pA->pSubject); + else if ( pA->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pA->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) wcscpy(pTemp->pSubject,pA->pSubject); // pA becomes pB @@ -1296,6 +1568,7 @@ void SwapMessages(INT32 iIdA, INT32 iIdB) pA->fRead=pB->fRead; pA->fNew=pB->fNew; pA->usOffset=pB->usOffset; + pA->EmailVersion=pB->EmailVersion; pA->usLength=pB->usLength; pA->iDate=pB->iDate; pA->ubSender=pB->ubSender; @@ -1306,9 +1579,20 @@ void SwapMessages(INT32 iIdA, INT32 iIdB) pB->fRead=pTemp->fRead; pB->fNew=pTemp->fNew; pB->usOffset=pTemp->usOffset; + pB->EmailVersion=pTemp->EmailVersion; pB->usLength=pTemp->usLength; pB->iDate=pTemp->iDate; pB->ubSender=pTemp->ubSender; + + if ( pB->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE ) + wcscpy(pB->pSubject,EmailMercAvailableText[pTemp->ubSender].szSubject); + else if ( pB->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP ) + wcscpy(pB->pSubject,EmailMercLevelUpText[pTemp->ubSender].szSubject); + //else if ( pB->EmailVersion == TYPE_EMAIL_OTHER ) + // wcscpy(pB->pSubject,EmailOtherText[pTemp->usLength].szSubject); + else if ( pB->EmailVersion == TYPE_EMAIL_BOBBY_R || pB->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT ) + wcscpy(pB->pSubject, pTemp->pSubject); + else if ( pB->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pB->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pB->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) wcscpy(pB->pSubject, pTemp->pSubject); // free up memory @@ -1433,7 +1717,7 @@ void DrawSubject(INT32 iCounter, STR16 pSubject, BOOLEAN fRead) return; } -void DrawSender(INT32 iCounter, UINT8 ubSender, BOOLEAN fRead) +void DrawSender(INT32 iCounter, UINT8 ubSender, BOOLEAN fRead, UINT8 EmailType) { // draw name of sender in mail viewer @@ -1452,7 +1736,24 @@ void DrawSender(INT32 iCounter, UINT8 ubSender, BOOLEAN fRead) SetFont( FONT10ARIALBOLD ); } - mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,pSenderNameList[ubSender]); + if ( EmailType == TYPE_EMAIL_AIM_AVAILABLE || EmailType == TYPE_EMAIL_MERC_LEVEL_UP ) + { + if (gMercProfiles[ ubSender ].zNickname !='\0') + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,gMercProfiles[ ubSender ].zNickname); + else + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,L"None"); + } + else if ( EmailType == TYPE_EMAIL_EMAIL_EDT || EmailType == TYPE_EMAIL_BOBBY_R || EmailType == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || EmailType == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) //|| EmailType == TYPE_EMAIL_OTHER ) + { + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,pSenderNameList[ubSender]); + } + else if ( EmailType == TYPE_EMAIL_EMAIL_EDT_NAME_MERC ) + { + if (gMercProfiles[ ubSender ].zNickname !='\0') + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,gMercProfiles[ ubSender ].zNickname); + else + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,L"None"); + } SetFont( MESSAGE_FONT ); SetFontShadow(DEFAULT_SHADOW); @@ -1537,8 +1838,13 @@ void DisplayEmailList() //draw the icon, sender, date, subject DrawLetterIcon(iCounter,pEmail->fRead ); DrawSubject(iCounter, pEmail->pSubject, pEmail->fRead ); - DrawSender(iCounter, pEmail->ubSender, pEmail->fRead ); - DrawDate(iCounter, pEmail->iDate, pEmail->fRead ); + + if ( pEmail->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE || pEmail->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP ) + DrawSender(iCounter, pEmail->ubSender, pEmail->fRead, pEmail->EmailVersion); + else if ( pEmail->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pEmail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC || pEmail->EmailVersion == TYPE_EMAIL_BOBBY_R || pEmail->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || pEmail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pEmail->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT) //|| pEmail->EmailVersion == TYPE_EMAIL_OTHER ) + DrawSender(iCounter, pEmail->ubSender, pEmail->fRead, pEmail->EmailVersion); + + DrawDate(iCounter, pEmail->iDate, pEmail->fRead ); iCounter++; @@ -1780,10 +2086,23 @@ INT32 DisplayEmailMessage(EmailPtr pMail) iHeight+=GetFontHeight( MESSAGE_FONT ); // is there any special event meant for this mail?..if so, handle it + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT ) HandleAnySpecialEmailMessageEvents( iOffSet ); + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT ) //|| pMail->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT ) HandleMailSpecialMessages( ( UINT16 ) ( iOffSet ), &iViewerPositionY, pMail); - + + #ifdef JA2UB + if ( pMail->EmailType != TYPE_E_NONE ) + { + HandleNewUBMailSpecialMessages( 198, &iViewerPositionY, pMail ); + HandleNewUBMailSpecialMessages( 170, &iViewerPositionY, pMail ); + HandleNewUBMailSpecialMessages( 211, &iViewerPositionY, pMail ); + HandleNewUBMailSpecialMessages( 206, &iViewerPositionY, pMail ); + HandleNewUBMailSpecialMessages( 217, &iViewerPositionY, pMail ); + } + #endif + PreProcessEmail( pMail ); @@ -2988,9 +3307,26 @@ void DisplayEmailMessageSubjectDateFromLines( EmailPtr pMail , INT32 iViewerY) mprintf( usX, MESSAGE_FROM_Y + (UINT16)iViewerY, pEmailHeaders[0]); // the actual from info - mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, pSenderNameList[pMail->ubSender]); - - + if ( pMail->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE || pMail->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP ) + { + if (gMercProfiles[ pMail->ubSender ].zNickname !='\0') + mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, gMercProfiles[ pMail->ubSender ].zNickname); + else + mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, L"None"); + } + else if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pMail->EmailVersion == TYPE_EMAIL_BOBBY_R || pMail->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pMail->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) //|| pMail->EmailVersion == TYPE_EMAIL_OTHER ) + { + mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, pSenderNameList[pMail->ubSender]); + } + else if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC ) + { + if (gMercProfiles[ pMail->ubSender ].zNickname !='\0') + mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, gMercProfiles[ pMail->ubSender ].zNickname); + else + mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, L"None"); + } + + // print date FindFontRightCoordinates( MESSAGE_HEADER_X+168, ( INT16 ) ( MESSAGE_DATE_Y + (UINT16)iViewerY ), MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_DATE_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[2] ,MESSAGE_FONT, &usX, &usY); mprintf( usX, MESSAGE_DATE_Y+ (UINT16)iViewerY , pEmailHeaders[2]); @@ -3141,6 +3477,26 @@ void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ) { // handles any special message events +#ifdef JA2UB + switch( iMessageId ) + { + + case EMAIL_MAKECONTACT: + if( !( gJa25SaveStruct.ubEmailFromSectorFlag & SECTOR_EMAIL__ANOTHER_SECTOR ) ) + { + AddStrategicEvent( EVENT_SEND_ENRICO_UNDERSTANDING_EMAIL, GetWorldTotalMin() + ( 2 * 60 ) + Random( 120 ), 0 ); + } + break; + + case( IMP_EMAIL_AGAIN ): + SetBookMark(IMP_BOOKMARK); + break; + case( IMP_EMAIL_INTRO ): + SetBookMark(IMP_BOOKMARK); + break; + } +#else + // handles any special message events switch( iMessageId ) { @@ -3152,6 +3508,7 @@ void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ) SetBookMark(IMP_BOOKMARK); break; } +#endif } void ReDisplayBoxes( void ) @@ -3180,6 +3537,80 @@ void ReDisplayBoxes( void ) } } +#ifdef JA2UB + +BOOLEAN HandleNewUBMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ) +{ + BOOLEAN fSpecialCase = FALSE; + + wstring wstrMail; + wstring::size_type index; + CHAR16 szMail[MAIL_STRING_SIZE]; + + if ( pMail->EmailType == TYPE_E_INSURANCE_L3 && pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT && usMessageId == 170 ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + ModifyInsuranceEmails( usMessageId, iResults, pMail, INSUR_PAYMENT_LENGTH ); + } + else if ( pMail->EmailType == TYPE_E_INSURANCE_L2 && pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT && usMessageId == 211 ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + ModifyInsuranceEmails( usMessageId, iResults, pMail, INSUR_1HOUR_FRAUD_LENGTH ); + } + else if ( pMail->EmailType == TYPE_E_AIM_L1 && pMail->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT && usMessageId == 206 ) + { + if ( gGameUBOptions.fDeadMerc == TRUE ) + ModifyInsuranceEmails( usMessageId, iResults, pMail, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH ); + } + else if ( pMail->EmailType == TYPE_E_AIM_L3 && pMail->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT && usMessageId == 217 ) + { + if ( gGameUBOptions.fDeadMerc == TRUE ) + ModifyInsuranceEmails( usMessageId, iResults, pMail, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH ); + } + //Dealtar's Airport Externalization + else if ( pMail->EmailType == TYPE_EMAIL_BOBBY_R_L1 && gGameUBOptions.fBobbyRSite == TRUE && pMail->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT ) + { + + if (!pMessageRecordList) + { + // WANNE.MAIL: Fix + gusCurShipmentDestinationID = -1; // Reset + gusCurShipmentDestinationID = pMail->iCurrentShipmentDestinationID; + + // Loop through each line of the shipment EDT-file + for (int i = 0; i < BOBBYR_SHIPMENT_ARRIVED_LENGTH; i++) + { + + wstrMail.clear(); + LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", szMail, MAIL_STRING_SIZE *usMessageId, MAIL_STRING_SIZE); + + wstrMail = szMail; + + index = wstrMail.find(L"$DESTINATIONNAME$"); + + // WANNE.MAIL: Fix + if (gusCurShipmentDestinationID > 0) + { + if (index != wstring::npos) + { + wstrMail.erase(index, strlen("$DESTINATIONNAME$")); + RefToDestinationStruct ds = gPostalService.GetDestination(gusCurShipmentDestinationID); + wstrMail.insert(index, ds.wstrName.c_str()); + } + } + + AddEmailRecordToList((STR16)wstrMail.c_str()); + + usMessageId++; + } + } + giPrevMessageId = giMessageId; + } + + return fSpecialCase; +} + +#endif BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ) { @@ -3194,6 +3625,9 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr fSpecialCase = TRUE; break; +#ifdef JA2UB +//no UB +#else case( MERC_INTRO ): SetBookMark( MERC_BOOKMARK ); fReDrawScreenFlag = TRUE; @@ -3242,6 +3676,16 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr { wstrMail.clear(); LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", szMail, MAIL_STRING_SIZE *usMessageId, MAIL_STRING_SIZE); + +/* if (FileExists(EMAIL_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA25, szMail, MAIL_STRING_SIZE *usMessageId, MAIL_STRING_SIZE); + } + else + { + LoadEncryptedDataFromFile(EMAIL_EDT_FILE_JA2, szMail, MAIL_STRING_SIZE *usMessageId, MAIL_STRING_SIZE); + } +*/ wstrMail = szMail; index = wstrMail.find(L"$DESTINATIONNAME$"); @@ -3264,12 +3708,13 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr } giPrevMessageId = giMessageId; break; + +#endif } return fSpecialCase; } - - +#ifdef JA2UB #define IMP_RESULTS_INTRO_LENGTH 9 @@ -3396,6 +3841,132 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr #define IMP_RESULTS_END IMP_PORTRAIT_FEMALE_6 + 1 #define IMP_RESULTS_END_LENGTH 3 +#else + +#define IMP_RESULTS_INTRO_LENGTH 9 + +#define IMP_RESULTS_PERSONALITY_INTRO IMP_RESULTS_INTRO_LENGTH +#define IMP_RESULTS_PERSONALITY_INTRO_LENGTH 5 +#define IMP_PERSONALITY_NORMAL IMP_RESULTS_PERSONALITY_INTRO + IMP_RESULTS_PERSONALITY_INTRO_LENGTH +#define IMP_PERSONALITY_LENGTH 4 +#define IMP_PERSONALITY_HEAT IMP_PERSONALITY_NORMAL + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_NERVOUS IMP_PERSONALITY_HEAT + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_CLAUSTROPHOBIC IMP_PERSONALITY_NERVOUS + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_NONSWIMMER IMP_PERSONALITY_CLAUSTROPHOBIC + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_FEAR_OF_INSECTS IMP_PERSONALITY_NONSWIMMER + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_FORGETFUL IMP_PERSONALITY_FEAR_OF_INSECTS + IMP_PERSONALITY_LENGTH + 1 +#define IMP_PERSONALITY_PSYCHO IMP_PERSONALITY_FORGETFUL + IMP_PERSONALITY_LENGTH +#define IMP_RESULTS_ATTITUDE_INTRO IMP_PERSONALITY_PSYCHO + IMP_PERSONALITY_LENGTH + 1 +#define IMP_RESULTS_ATTITUDE_LENGTH 5 +#define IMP_ATTITUDE_LENGTH 5 +#define IMP_ATTITUDE_NORMAL IMP_RESULTS_ATTITUDE_INTRO + IMP_RESULTS_ATTITUDE_LENGTH +#define IMP_ATTITUDE_FRIENDLY IMP_ATTITUDE_NORMAL + IMP_ATTITUDE_LENGTH +#define IMP_ATTITUDE_LONER IMP_ATTITUDE_FRIENDLY + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_OPTIMIST IMP_ATTITUDE_LONER + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_PESSIMIST IMP_ATTITUDE_OPTIMIST + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_AGGRESSIVE IMP_ATTITUDE_PESSIMIST + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_ARROGANT IMP_ATTITUDE_AGGRESSIVE + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_ASSHOLE IMP_ATTITUDE_ARROGANT + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_COWARD IMP_ATTITUDE_ASSHOLE + IMP_ATTITUDE_LENGTH +#define IMP_RESULTS_SKILLS IMP_ATTITUDE_COWARD + IMP_ATTITUDE_LENGTH + 1 +#define IMP_RESULTS_SKILLS_LENGTH 7 +#define IMP_SKILLS_IMPERIAL_SKILLS IMP_RESULTS_SKILLS + IMP_RESULTS_SKILLS_LENGTH + 1 +#define IMP_SKILLS_IMPERIAL_MARK IMP_SKILLS_IMPERIAL_SKILLS + 1 +#define IMP_SKILLS_IMPERIAL_MECH IMP_SKILLS_IMPERIAL_SKILLS + 2 +#define IMP_SKILLS_IMPERIAL_EXPL IMP_SKILLS_IMPERIAL_SKILLS + 3 +#define IMP_SKILLS_IMPERIAL_MED IMP_SKILLS_IMPERIAL_SKILLS + 4 + +#define IMP_SKILLS_NEED_TRAIN_SKILLS IMP_SKILLS_IMPERIAL_MED + 1 +#define IMP_SKILLS_NEED_TRAIN_MARK IMP_SKILLS_NEED_TRAIN_SKILLS + 1 +#define IMP_SKILLS_NEED_TRAIN_MECH IMP_SKILLS_NEED_TRAIN_SKILLS + 2 +#define IMP_SKILLS_NEED_TRAIN_EXPL IMP_SKILLS_NEED_TRAIN_SKILLS + 3 +#define IMP_SKILLS_NEED_TRAIN_MED IMP_SKILLS_NEED_TRAIN_SKILLS + 4 + +#define IMP_SKILLS_NO_SKILL IMP_SKILLS_NEED_TRAIN_MED + 1 +#define IMP_SKILLS_NO_SKILL_MARK IMP_SKILLS_NO_SKILL + 1 +#define IMP_SKILLS_NO_SKILL_MECH IMP_SKILLS_NO_SKILL + 2 +#define IMP_SKILLS_NO_SKILL_EXPL IMP_SKILLS_NO_SKILL + 3 +#define IMP_SKILLS_NO_SKILL_MED IMP_SKILLS_NO_SKILL + 4 + +#define IMP_SKILLS_SPECIAL_INTRO IMP_SKILLS_NO_SKILL_MED + 1 +#define IMP_SKILLS_SPECIAL_INTRO_LENGTH 2 +#define IMP_SKILLS_SPECIAL_LOCK IMP_SKILLS_SPECIAL_INTRO + IMP_SKILLS_SPECIAL_INTRO_LENGTH +#define IMP_SKILLS_SPECIAL_HAND IMP_SKILLS_SPECIAL_LOCK + 1 +#define IMP_SKILLS_SPECIAL_ELEC IMP_SKILLS_SPECIAL_HAND + 1 +#define IMP_SKILLS_SPECIAL_NIGHT IMP_SKILLS_SPECIAL_ELEC + 1 +#define IMP_SKILLS_SPECIAL_THROW IMP_SKILLS_SPECIAL_NIGHT + 1 +#define IMP_SKILLS_SPECIAL_TEACH IMP_SKILLS_SPECIAL_THROW + 1 +#define IMP_SKILLS_SPECIAL_HEAVY IMP_SKILLS_SPECIAL_TEACH + 1 +#define IMP_SKILLS_SPECIAL_AUTO IMP_SKILLS_SPECIAL_HEAVY + 1 +#define IMP_SKILLS_SPECIAL_STEALTH IMP_SKILLS_SPECIAL_AUTO + 1 +#define IMP_SKILLS_SPECIAL_AMBI IMP_SKILLS_SPECIAL_STEALTH + 1 +#define IMP_SKILLS_SPECIAL_THIEF IMP_SKILLS_SPECIAL_AMBI + 1 +#define IMP_SKILLS_SPECIAL_MARTIAL IMP_SKILLS_SPECIAL_THIEF + 1 +#define IMP_SKILLS_SPECIAL_KNIFE IMP_SKILLS_SPECIAL_MARTIAL + 1 + +#define IMP_RESULTS_PHYSICAL IMP_SKILLS_SPECIAL_KNIFE + 1 +#define IMP_RESULTS_PHYSICAL_LENGTH 7 + +#define IMP_PHYSICAL_SUPER IMP_RESULTS_PHYSICAL + IMP_RESULTS_PHYSICAL_LENGTH +#define IMP_PHYSICAL_SUPER_LENGTH 1 + +#define IMP_PHYSICAL_SUPER_HEALTH IMP_PHYSICAL_SUPER + IMP_PHYSICAL_SUPER_LENGTH +#define IMP_PHYSICAL_SUPER_AGILITY IMP_PHYSICAL_SUPER_HEALTH + 1 +#define IMP_PHYSICAL_SUPER_DEXTERITY IMP_PHYSICAL_SUPER_AGILITY + 1 +#define IMP_PHYSICAL_SUPER_STRENGTH IMP_PHYSICAL_SUPER_DEXTERITY + 1 +#define IMP_PHYSICAL_SUPER_LEADERSHIP IMP_PHYSICAL_SUPER_STRENGTH + 1 +#define IMP_PHYSICAL_SUPER_WISDOM IMP_PHYSICAL_SUPER_LEADERSHIP + 1 + +#define IMP_PHYSICAL_LOW IMP_PHYSICAL_SUPER_WISDOM + 1 +#define IMP_PHYSICAL_LOW_LENGTH 1 + +#define IMP_PHYSICAL_LOW_HEALTH IMP_PHYSICAL_LOW + IMP_PHYSICAL_LOW_LENGTH +#define IMP_PHYSICAL_LOW_AGILITY IMP_PHYSICAL_LOW_HEALTH + 1 +#define IMP_PHYSICAL_LOW_DEXTERITY IMP_PHYSICAL_LOW_AGILITY + 2 +#define IMP_PHYSICAL_LOW_STRENGTH IMP_PHYSICAL_LOW_DEXTERITY + 1 +#define IMP_PHYSICAL_LOW_LEADERSHIP IMP_PHYSICAL_LOW_STRENGTH + 1 +#define IMP_PHYSICAL_LOW_WISDOM IMP_PHYSICAL_LOW_LEADERSHIP + 1 + + +#define IMP_PHYSICAL_VERY_LOW IMP_PHYSICAL_LOW_WISDOM + 1 +#define IMP_PHYSICAL_VERY_LOW_LENGTH 1 + +#define IMP_PHYSICAL_VERY_LOW_HEALTH IMP_PHYSICAL_VERY_LOW + IMP_PHYSICAL_VERY_LOW_LENGTH +#define IMP_PHYSICAL_VERY_LOW_AGILITY IMP_PHYSICAL_VERY_LOW_HEALTH + 1 +#define IMP_PHYSICAL_VERY_LOW_DEXTERITY IMP_PHYSICAL_VERY_LOW_AGILITY + 1 +#define IMP_PHYSICAL_VERY_LOW_STRENGTH IMP_PHYSICAL_VERY_LOW_DEXTERITY + 1 +#define IMP_PHYSICAL_VERY_LOW_LEADERSHIP IMP_PHYSICAL_VERY_LOW_STRENGTH + 1 +#define IMP_PHYSICAL_VERY_LOW_WISDOM IMP_PHYSICAL_VERY_LOW_LEADERSHIP + 1 + + +#define IMP_PHYSICAL_END IMP_PHYSICAL_VERY_LOW_WISDOM + 1 +#define IMP_PHYSICAL_END_LENGTH 3 + +#define IMP_RESULTS_PORTRAIT IMP_PHYSICAL_END + IMP_PHYSICAL_END_LENGTH +#define IMP_RESULTS_PORTRAIT_LENGTH 6 + + +#define IMP_PORTRAIT_MALE_1 IMP_RESULTS_PORTRAIT + IMP_RESULTS_PORTRAIT_LENGTH +#define IMP_PORTRAIT_MALE_2 IMP_PORTRAIT_MALE_1 + 4 +#define IMP_PORTRAIT_MALE_3 IMP_PORTRAIT_MALE_2 + 4 +#define IMP_PORTRAIT_MALE_4 IMP_PORTRAIT_MALE_3 + 4 +#define IMP_PORTRAIT_MALE_5 IMP_PORTRAIT_MALE_4 + 4 +#define IMP_PORTRAIT_MALE_6 IMP_PORTRAIT_MALE_5 + 4 + +#define IMP_PORTRAIT_FEMALE_1 IMP_PORTRAIT_MALE_6 + 4 +#define IMP_PORTRAIT_FEMALE_2 IMP_PORTRAIT_FEMALE_1 + 4 +#define IMP_PORTRAIT_FEMALE_3 IMP_PORTRAIT_FEMALE_2 + 4 +#define IMP_PORTRAIT_FEMALE_4 IMP_PORTRAIT_FEMALE_3 + 4 +#define IMP_PORTRAIT_FEMALE_5 IMP_PORTRAIT_FEMALE_4 + 4 +#define IMP_PORTRAIT_FEMALE_6 IMP_PORTRAIT_FEMALE_5 + 4 + + + +#define IMP_RESULTS_END IMP_PORTRAIT_FEMALE_6 + 1 +#define IMP_RESULTS_END_LENGTH 3 + + +#endif void HandleIMPCharProfileResultsMessage( void) { @@ -4945,8 +5516,15 @@ INT32 GetNumberOfPagesToEmail( ) void ShutDownEmailList() { +UINT32 cnt; + EmailPtr pEmail = pEmailList; EmailPtr pTempEmail = NULL; + + for( cnt=0; cntusLength == MERC_UP_LEVEL_GASTON || pMail->usLength == MERC_UP_LEVEL_STOGIE || - pMail->usLength == MERC_UP_LEVEL_TEX || pMail->usLength == MERC_UP_LEVEL_BIGGENS) - { - iNew113MERCMerc = pMail->usLength; - pMail->usLength = 2; - } - else if (pMail->usLength >= 170 && pMail->usLength <= 177) - { - iNew113AIMMerc = pMail->usLength; - pMail->usLength = 2; - } - // User made merc - else if (pMail->usLength >= 178 && pMail->usLength <= 254) - { - iNew113CustomUserMerc = pMail->usLength; - pMail->usLength = 2; + int iEmailMERCMessage = 0; + int iEmailAIMMessage = 0; + int iEmailOther = 0; + int iEmailBobbyRMessage = 0; + int iEmailInsurance = 0; + int iNew113CustomUserMerc = 0; + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT ) + { + if (pMail->usLength == MERC_UP_LEVEL_GASTON || pMail->usLength == MERC_UP_LEVEL_STOGIE || + pMail->usLength == MERC_UP_LEVEL_TEX || pMail->usLength == MERC_UP_LEVEL_BIGGENS) + { + iNew113MERCMerc = pMail->usLength; + pMail->usLength = 2; + } + else if (pMail->usLength >= 170 && pMail->usLength <= 177) + { + iNew113AIMMerc = pMail->usLength; + pMail->usLength = 2; + } + // User made merc + else if (pMail->usLength >= 178 && pMail->usLength <= 254) + { + iNew113CustomUserMerc = pMail->usLength; + pMail->usLength = 2; + } } + if ( pMail->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP ) + { + iEmailMERCMessage = pMail->usLength; + pMail->usLength = 2; + } + + if ( pMail->EmailVersion == TYPE_EMAIL_BOBBY_R ) + { + iEmailBobbyRMessage = pMail->usLength; + pMail->usLength = 4; + } + + if ( pMail->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE ) + { + iEmailAIMMessage = pMail->usLength; + pMail->usLength = 2; + } + + if ( pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY ) + { + iEmailInsurance = pMail->usLength; + pMail->usLength = 2; + } + /* + if ( pMail->EmailVersion == TYPE_EMAIL_OTHER ) + { + iEmailOther = pMail->usLength; + pMail->usLength = 6; + } + */ // list doesn't exist, reload if( !pTempRecord ) { while(pMail->usLength > iCounter) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - - + // read one record from email file +#ifdef JA2UB + //if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC ) + //{ + if (FileExists(EMAIL_EDT_FILE_JA25) ) + { + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC ) + LoadEncryptedDataFromFile( EMAIL_EDT_FILE_JA25, pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + } + else + { + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC ) + LoadEncryptedDataFromFile( EMAIL_EDT_FILE_JA2, pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + } + //} + if ( pMail->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT || pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pMail->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) + { + LoadEncryptedDataFromFile( EMAIL_EDT_FILE_JA2, pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + } +#else + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC ) + LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); +#endif + /* + if ( pMail->EmailVersion == TYPE_EMAIL_OTHER ) + { + //if ( iCounter != 29 ) + wcscpy(pString, L"\0"); + wcscat( pString, EmailOtherText[iEmailOther].szMessage[pMail->usLength]); + // wcscat( pString, EmailOtherText[0].szMessage[1]); + } + */ // ---------------- // New MERC Merc // ---------------- // WANNE: We have a new 1.13 MERC merc (Text, Gaston, Stogie or Biggens) - if (iNew113MERCMerc != 0) + if (iNew113MERCMerc != 0 ) { // WANNE: TODO: Replace "Biff" with the name of the 1.13 merc - if (iCounter == 1) + if (iCounter == 1 && pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT ) { wcscpy(pString, L"\0"); if (iNew113MERCMerc == MERC_UP_LEVEL_GASTON) @@ -5057,7 +5700,7 @@ void PreProcessEmail( EmailPtr pMail ) wcscpy(pString, L"\0"); // Only output the mail text, not the subject, cause we already have the subject as text - if (iCounter == 1) + if (iCounter == 1 && pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT ) { if (iNew113AIMMerc == 170) { @@ -5091,14 +5734,19 @@ void PreProcessEmail( EmailPtr pMail ) { wcscpy( pString, New113AIMMercMailTexts[15] ); } - } + // Additional Generic Merc mail message + else + { + wcscpy( pString, New113AIMMercMailTexts[17] ); + } + } } // -------------------------- // New Customer User Merc // -------------------------- // WANNE: We have a new 1.13 AIM Wildfire merc - if (iNew113CustomUserMerc != 0) + if (iNew113CustomUserMerc != 0 && pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT_NAME_MERC) { wcscpy(pString, L"\0"); @@ -5108,7 +5756,33 @@ void PreProcessEmail( EmailPtr pMail ) wcscpy( pString, New113AIMMercMailTexts[17] ); } } - + + if (iCounter == 1) + { + if ( pMail->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE ) + { + wcscpy(pString, L"\0"); + wcscpy( pString, EmailMercAvailableText[iEmailAIMMessage].szMessage); + } + else if ( pMail->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP) + { + wcscpy(pString, L"\0"); + wcscpy( pString, EmailMercLevelUpText[iEmailMERCMessage].szMessage); + } + else if ( pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY ) + { + wcscpy(pString, L"\0"); + wcscpy( pString, EmailInsuranceText[iEmailMERCMessage].szMessage); + } + /* + else if ( pMail->EmailVersion == TYPE_EMAIL_BOBBY_R) + { + wcscpy(pString, L"\0"); + wcscpy( pString, EmailBobbyRText[0]); + } + */ + } + // add to list AddEmailRecordToList( pString ); @@ -5116,6 +5790,8 @@ void PreProcessEmail( EmailPtr pMail ) iCounter++; } + if ( pMail->EmailVersion == TYPE_EMAIL_EMAIL_EDT ) + { // WANNE: Set the value back if (iNew113MERCMerc != 0) { @@ -5133,7 +5809,30 @@ void PreProcessEmail( EmailPtr pMail ) { pMail->usLength = iNew113CustomUserMerc; } - + } + + + if ( pMail->EmailVersion == TYPE_EMAIL_BOBBY_R ) + { + if (iEmailBobbyRMessage != 0) + { + pMail->usLength = iEmailBobbyRMessage; + } + } + + if ( pMail->EmailVersion == TYPE_EMAIL_AIM_AVAILABLE ) + pMail->usLength = iEmailAIMMessage; + + if ( pMail->EmailVersion == TYPE_EMAIL_MERC_LEVEL_UP ) + pMail->usLength = iEmailMERCMessage; + +// if ( pMail->EmailVersion == TYPE_EMAIL_OTHER ) +// pMail->usLength = iEmailOther; + + if ( pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY ) + pMail->usLength = iEmailInsurance; + + giPrevMessageId = giMessageId; } @@ -5357,8 +6056,27 @@ void ModifyInsuranceEmails( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail, for( ubCnt=0; ubCntEmailVersion != TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pMail->EmailVersion != TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) + { + if (FileExists(EMAIL_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile( EMAIL_EDT_FILE_JA25, pString, MAIL_STRING_SIZE * usMessageId, MAIL_STRING_SIZE ); + } + else + { + LoadEncryptedDataFromFile( EMAIL_EDT_FILE_JA2, pString, MAIL_STRING_SIZE * usMessageId, MAIL_STRING_SIZE ); + } + } + if ( pMail->EmailType == TYPE_E_INSURANCE_L3 || pMail->EmailType == TYPE_E_INSURANCE_L2 || pMail->EmailType == TYPE_E_AIM_L1 || pMail->EmailType == TYPE_E_AIM_L3 || + pMail->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pMail->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT ) + { + LoadEncryptedDataFromFile( EMAIL_EDT_FILE_JA2, pString, MAIL_STRING_SIZE * usMessageId, MAIL_STRING_SIZE ); + } +#else + LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * usMessageId, MAIL_STRING_SIZE ); +#endif //Replace the $MERCNAME$ and $AMOUNT$ with the mercs name and the amountm if the string contains the keywords. ReplaceMercNameAndAmountWithProperData( pString, pMail ); @@ -5556,27 +6274,30 @@ BOOLEAN ReplaceMercNameAndAmountWithProperData( CHAR16 *pFinishedString, EmailPt #ifdef JA2BETAVERSION void AddAllEmails() -{ +{ +#ifdef JA2UB +//no UB +#else UINT32 uiCnt; UINT32 uiOffset; - AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1, -1 ); - AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1 ); - AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ), -1, -1 ); - AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, -1 ); - AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1 ); + AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); - AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), -1, -1 ); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT ); - AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); - AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); - AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); - AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); + AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); uiOffset = MERC_UP_LEVEL_BIFF; for( uiCnt=0; uiCnt<10; uiCnt++) { - AddEmail( uiOffset, MERC_UP_LEVEL_LENGTH_BIFF, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1 ); + AddEmail( uiOffset, MERC_UP_LEVEL_LENGTH_BIFF, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT_NAME_MERC ); uiOffset += MERC_UP_LEVEL_LENGTH_BIFF; } @@ -5585,52 +6306,106 @@ void AddAllEmails() uiOffset = AIM_REPLY_BARRY; for( uiCnt=0; uiCnt<40; uiCnt++) { - AddEmail( ( UINT8 )( uiOffset + ( uiCnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + uiCnt ), GetWorldTotalMin(), -1, -1 ); + AddEmail( ( UINT8 )( uiOffset + ( uiCnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + uiCnt ), GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT_NAME_MERC ); } - AddEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1 ); - AddEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1 ); - AddEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1 ); - AddEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin(), -1, -1 ); + AddEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); - AddEmail( ENRICO_MIGUEL, ENRICO_MIGUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1 ); - AddEmail(ENRICO_PROG_20, ENRICO_PROG_20_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(ENRICO_PROG_55, ENRICO_PROG_55_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(ENRICO_PROG_80, ENRICO_PROG_80_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(LACK_PLAYER_PROGRESS_1, LACK_PLAYER_PROGRESS_1_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(LACK_PLAYER_PROGRESS_2, LACK_PLAYER_PROGRESS_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(LACK_PLAYER_PROGRESS_3, LACK_PLAYER_PROGRESS_3_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); - AddEmail(ENRICO_CREATURES, ENRICO_CREATURES_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail( ENRICO_MIGUEL, ENRICO_MIGUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail(ENRICO_PROG_20, ENRICO_PROG_20_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(ENRICO_PROG_55, ENRICO_PROG_55_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(ENRICO_PROG_80, ENRICO_PROG_80_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(LACK_PLAYER_PROGRESS_1, LACK_PLAYER_PROGRESS_1_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(LACK_PLAYER_PROGRESS_2, LACK_PLAYER_PROGRESS_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(LACK_PLAYER_PROGRESS_3, LACK_PLAYER_PROGRESS_3_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail(ENRICO_CREATURES, ENRICO_CREATURES_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); //Add an email telling the user that he received an insurance payment - AddEmailWithSpecialData( INSUR_PAYMENT, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); - AddEmailWithSpecialData( INSUR_SUSPIC, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); - AddEmailWithSpecialData( INSUR_SUSPIC_2, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); - AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, -1); - AddEmail( KING_PIN_LETTER, KING_PIN_LETTER_LENGTH, KING_PIN, GetWorldTotalMin(), -1, -1 ); - AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, -1 ); + AddEmailWithSpecialData( INSUR_PAYMENT, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); + AddEmailWithSpecialData( INSUR_SUSPIC, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); + AddEmailWithSpecialData( INSUR_SUSPIC_2, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); + AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( KING_PIN_LETTER, KING_PIN_LETTER_LENGTH, KING_PIN, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); - AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, -1 ); + AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); - AddEmailWithSpecialData(MERC_DIED_ON_OTHER_ASSIGNMENT, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, 0 ); + AddEmailWithSpecialData(MERC_DIED_ON_OTHER_ASSIGNMENT, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); - AddEmailWithSpecialData( INSUR_1HOUR_FRAUD, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); + AddEmailWithSpecialData( INSUR_1HOUR_FRAUD, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); //add an email - AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0 ); + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); - AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0 ); + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); - AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0 ); + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif + } #endif +BOOLEAN SaveNewEmailDataToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + FileWrite( hFile, &gEmailT, sizeof( gEmailT), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gEmailT ) ) + { + return( FALSE ); + } + + return( TRUE ); +} - - - - +BOOLEAN LoadNewEmailDataFromLoadGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + UINT32 uiNumOfEmails=0; + EmailPtr pEmail = pEmailList; +// UINT32 cnt; + + FileRead( hFile, &gEmailT, sizeof( gEmailT), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gEmailT ) ) + { + return( FALSE ); + } +/* + while(pEmail) + { + pEmail=pEmail->Next; + uiNumOfEmails++; + } + + for( cnt=0; cntEmailVersion = gEmailT[ uiNumOfEmails ].EmailVersion; + pEmail=pEmail->Next; + uiNumOfEmails++; + } + return( TRUE ); +} diff --git a/Laptop/email.h b/Laptop/email.h index 6fb1d4c8..17150163 100644 --- a/Laptop/email.h +++ b/Laptop/email.h @@ -2,12 +2,231 @@ #define __EMAIL_H #include "types.h" +#include "soldier profile type.h" // defines #define MAX_EMAIL_LINES 10 //max number of lines can be shown in a message #define MAX_MESSAGES_PAGE 18 // max number of messages per page +//---ja25 ub +#ifdef JA2UB +#define EMAIL_INSURANCE_L1 170 +#define EMAIL_INSURANCE_L2 211 +#define EMAIL_INSURANCE_L3 170 +#define EMAIL_INSURANCE_L4 173 +#define EMAIL_INSURANCE_L5 179 +#define EMAIL_INSURANCE_L6 176 + +#define EMAIL_BOBBY_R_L1 198 + +#define EMAIL_AIM_L1 206 +#define EMAIL_AIM_L2 27 +#define EMAIL_AIM_L3 217 +#define EMAIL_AIM_L4 214 + + + +//JA25: New emails +// email # 1 +#define EMAIL_STARTGAME 0 +#define EMAIL_STARTGAME_LENGTH 8 +// email # 2 +#define EMAIL_PILOTMISSING (EMAIL_STARTGAME + EMAIL_STARTGAME_LENGTH) +#define EMAIL_PILOTMISSING_LENGTH 2 + +// email # 3 +#define EMAIL_MAKECONTACT (EMAIL_PILOTMISSING + EMAIL_PILOTMISSING_LENGTH) +#define EMAIL_MAKECONTACT_LENGTH 3 + +// email # 4 +#define EMAIL_MANUEL (EMAIL_MAKECONTACT + EMAIL_MAKECONTACT_LENGTH) +#define EMAIL_MANUEL_LENGTH 4 + +// # email # 5 - only if Miguel is alive! +#define EMAIL_MIGUELHELLO (EMAIL_MANUEL + EMAIL_MANUEL_LENGTH) +#define EMAIL_MIGUELHELLO_LENGTH 3 + +// email # 6 - player not advancing fast enough +#define EMAIL_CONCERNED (EMAIL_MIGUELHELLO + EMAIL_MIGUELHELLO_LENGTH) +#define EMAIL_CONCERNED_LENGTH 2 + +// email # 7 - player still not advancing fast enough +#define EMAIL_URGENT (EMAIL_CONCERNED + EMAIL_CONCERNED_LENGTH) +#define EMAIL_URGENT_LENGTH 3 + +// email # 8a - from Miguel +#define EMAIL_MIGUELSORRY (EMAIL_URGENT + EMAIL_URGENT_LENGTH) +#define EMAIL_MIGUELSORRY_LENGTH 3 + +// email # 8b - from Miguel, mentioning Manuel +#define EMAIL_MIGUELMANUEL (EMAIL_MIGUELSORRY + EMAIL_MIGUELSORRY_LENGTH) +#define EMAIL_MIGUELMANUEL_LENGTH 4 + +// email # 9 - Miguel sick +#define EMAIL_MIGUELSICK (EMAIL_MIGUELMANUEL + EMAIL_MIGUELMANUEL_LENGTH) +#define EMAIL_MIGUELSICK_LENGTH 3 + +// email # 10a +#define EMAIL_UNDERSTANDING (EMAIL_MIGUELSICK + EMAIL_MIGUELSICK_LENGTH) +#define EMAIL_UNDERSTANDING_LENGTH 3 + +// email # 10b - if we need extra cash +#define EMAIL_EXTRACASH (EMAIL_UNDERSTANDING + EMAIL_UNDERSTANDING_LENGTH) +#define EMAIL_EXTRACASH_LENGTH 4 + +// email # 11 +#define EMAIL_PILOTFOUND (EMAIL_EXTRACASH + EMAIL_EXTRACASH_LENGTH) +#define EMAIL_PILOTFOUND_LENGTH 2 + +// email # 12a - Miguel dead, Manuel never recruited +#define EMAIL_CONGRATS (EMAIL_PILOTFOUND + EMAIL_PILOTFOUND_LENGTH) +#define EMAIL_CONGRATS_LENGTH 4 + +// email # 12b - Miguel alive, Manuel never recruited +#define EMAIL_CONGRATSICK (EMAIL_CONGRATS + EMAIL_CONGRATS_LENGTH) +#define EMAIL_CONGRATSICK_LENGTH 5 + +// email # 12c - Miguel alive, Manuel dead +#define EMAIL_CONGRATMIGMANUELDEAD (EMAIL_CONGRATSICK + EMAIL_CONGRATSICK_LENGTH) +#define EMAIL_CONGRATMIGMANUELDEAD_LENGTH 6 + +// email # 12d - Miguel alive, Manuel recruited and alive +#define EMAIL_CONGRATMIGMANUELALIVE (EMAIL_CONGRATMIGMANUELDEAD + EMAIL_CONGRATMIGMANUELDEAD_LENGTH) +#define EMAIL_CONGRATMIGMANUELALIVE_LENGTH 6 + +// email # 12e - Miguel dead, Manuel dead +#define EMAIL_CONGRATMANUELDEAD (EMAIL_CONGRATMIGMANUELALIVE + EMAIL_CONGRATMIGMANUELALIVE_LENGTH) +#define EMAIL_CONGRATMANUELDEAD_LENGTH 5 + +// email # 12f - Miguel dead, Manuel recruited and alive +#define EMAIL_CONGRATMANUELALIVE (EMAIL_CONGRATMANUELDEAD + EMAIL_CONGRATMANUELDEAD_LENGTH) +#define EMAIL_CONGRATMANUELALIVE_LENGTH 5 + +// email # 13 - original AIM email +#define EMAIL_AIMDISCOUNT (EMAIL_CONGRATMANUELALIVE + EMAIL_CONGRATMANUELALIVE_LENGTH) +#define EMAIL_AIMDISCOUNT_LENGTH 7 + +#define MANUEL_AT_HOME_NOT_USED ( EMAIL_AIMDISCOUNT + EMAIL_AIMDISCOUNT_LENGTH ) +#define MANUEL_AT_HOME_NOT_USED_LENGTH 1 + +//Email #14 Initial IMP email +#define IMP_EMAIL_INTRO (MANUEL_AT_HOME_NOT_USED + MANUEL_AT_HOME_NOT_USED_LENGTH ) +#define IMP_EMAIL_INTRO_LENGTH 10 + +//Email #15 Imp follow up +#define IMP_EMAIL_AGAIN (IMP_EMAIL_INTRO + IMP_EMAIL_INTRO_LENGTH) +#define IMP_EMAIL_AGAIN_LENGTH 5 + + + +// Email #16 - ?? merc left-me-a-message-and-now-I'm-back emails +#define AIM_REPLY_BARRY ( IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH ) +#define AIM_REPLY_LENGTH_BARRY 2 + +#define AIM_REPLY_MELTDOWN (AIM_REPLY_BARRY + ( 39 * AIM_REPLY_LENGTH_BARRY )) +#define AIM_REPLY_LENGTH_MELTDOWN AIM_REPLY_LENGTH_BARRY + + +#define AIM_REFUND ( AIM_REPLY_MELTDOWN + AIM_REPLY_LENGTH_MELTDOWN ) +#define AIM_REFUND_LENGTH 3 + +#define MERC_REFUND ( AIM_REFUND + AIM_REFUND_LENGTH ) +#define MERC_REFUND_LENGTH 3 + + + +#define EMAIL_AIM_PROMOTION_1 ( MERC_REFUND + MERC_REFUND_LENGTH ) +#define EMAIL_AIM_PROMOTION_1_LENGTH 4 + +#define EMAIL_MERC_PROMOTION_1 ( EMAIL_AIM_PROMOTION_1 + EMAIL_AIM_PROMOTION_1_LENGTH ) +#define EMAIL_MERC_PROMOTION_1_LENGTH 5 + +#define EMAIL_AIM_PROMOTION_2 ( EMAIL_MERC_PROMOTION_1 + EMAIL_MERC_PROMOTION_1_LENGTH ) +#define EMAIL_AIM_PROMOTION_2_LENGTH 5 + + +#define IMP_EMAIL_PROFILE_RESULTS ( EMAIL_AIM_PROMOTION_2 + EMAIL_AIM_PROMOTION_2_LENGTH ) +#define IMP_EMAIL_PROFILE_RESULTS_LENGTH 1 + +#define IMP_EMAIL_INTRO2 0 +#define IMP_EMAIL_INTRO_LENGTH2 10 +#define ENRICO_CONGRATS2 (IMP_EMAIL_INTRO2 + IMP_EMAIL_INTRO_LENGTH2) +#define ENRICO_CONGRATS_LENGTH2 3 +#define IMP_EMAIL_AGAIN2 (ENRICO_CONGRATS2 + ENRICO_CONGRATS_LENGTH2) +#define IMP_EMAIL_AGAIN_LENGTH2 6 +#define MERC_INTRO2 (IMP_EMAIL_AGAIN2 + IMP_EMAIL_AGAIN_LENGTH2) +#define MERC_INTRO_LENGTH2 5 +#define MERC_NEW_SITE_ADDRESS2 ( MERC_INTRO2 + MERC_INTRO_LENGTH2 ) +#define MERC_NEW_SITE_ADDRESS_LENGTH2 2 +#define AIM_MEDICAL_DEPOSIT_REFUND2 ( MERC_NEW_SITE_ADDRESS2 + MERC_NEW_SITE_ADDRESS_LENGTH2 ) +#define AIM_MEDICAL_DEPOSIT_REFUND_LENGTH2 3 +#define IMP_EMAIL_PROFILE_RESULTS2 ( AIM_MEDICAL_DEPOSIT_REFUND2 + AIM_MEDICAL_DEPOSIT_REFUND_LENGTH2 ) +#define IMP_EMAIL_PROFILE_RESULTS_LENGTH2 1 +#define MERC_WARNING2 ( IMP_EMAIL_PROFILE_RESULTS_LENGTH2 + IMP_EMAIL_PROFILE_RESULTS2 ) +#define MERC_WARNING_LENGTH2 2 +#define MERC_INVALID2 ( MERC_WARNING2 + MERC_WARNING_LENGTH2 ) +#define MERC_INVALID_LENGTH2 2 +#define NEW_MERCS_AT_MERC ( MERC_INVALID2 + MERC_INVALID_LENGTH2 ) +#define NEW_MERCS_AT_MERC_LENGTH 2 + +//Jagged Alliance 2 + +// insurance company emails +#define INSUR_PAYMENT 200 +#define INSUR_PAYMENT_LENGTH 3 +#define INSUR_SUSPIC 201 +#define INSUR_SUSPIC_LENGTH 3 +#define INSUR_INVEST_OVER 202 +#define INSUR_INVEST_OVER_LENGTH 3 +#define INSUR_SUSPIC_2 203 +#define INSUR_SUSPIC_2_LENGTH 3 + +#define BOBBYR_NOW_OPEN 204 +#define BOBBYR_NOW_OPEN_LENGTH 3 + +#define KING_PIN_LETTER 205 +#define KING_PIN_LETTER_LENGTH 4 + +#define LACK_PLAYER_PROGRESS_1 206 +#define LACK_PLAYER_PROGRESS_1_LENGTH 3 + +#define LACK_PLAYER_PROGRESS_2 207 +#define LACK_PLAYER_PROGRESS_2_LENGTH 3 + +#define LACK_PLAYER_PROGRESS_3 208 +#define LACK_PLAYER_PROGRESS_3_LENGTH 3 + +//A package from bobby r has arrived in Drassen +#define BOBBYR_SHIPMENT_ARRIVED 199 +#define BOBBYR_SHIPMENT_ARRIVED_LENGTH 4 + +// John Kulba has left the gifts for theplayers in drassen +#define JOHN_KULBA_GIFT_IN_DRASSEN 209 +#define JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH 4 + +//when a merc dies on ANOTHER assignment ( ie not with the player ) +#define MERC_DIED_ON_OTHER_ASSIGNMENT 210 +#define MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH 5 + +#define INSUR_1HOUR_FRAUD 211 +#define INSUR_1HOUR_FRAUD_LENGTH 3 + +//when a merc is fired, and is injured +#define AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND 212 +#define AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH 3 + +//when a merc is fired, and is dead +#define AIM_MEDICAL_DEPOSIT_NO_REFUND 213 +#define AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH 3 + +#define BOBBY_R_MEDUNA_SHIPMENT 214 +#define BOBBY_R_MEDUNA_SHIPMENT_LENGTH 4 + +#define AIM_MEDICAL_DEPOSIT_REFUND 215 +#define AIM_MEDICAL_DEPOSIT_REFUND_LENGTH 3 + +#else #define IMP_EMAIL_INTRO 0 #define IMP_EMAIL_INTRO_LENGTH 10 #define ENRICO_CONGRATS (IMP_EMAIL_INTRO + IMP_EMAIL_INTRO_LENGTH) @@ -133,7 +352,7 @@ #define BOBBY_R_MEDUNA_SHIPMENT ( AIM_MEDICAL_DEPOSIT_NO_REFUND + AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH ) #define BOBBY_R_MEDUNA_SHIPMENT_LENGTH 4 - +#endif // WANNE: New 1.13 MERC merc mail text for level up that Speck sends //#define MERC_UP_LEVEL_GASTON (BOBBY_R_MEDUNA_SHIPMENT + BOBBY_R_MEDUNA_SHIPMENT_LENGTH) //#define MERC_UP_LEVEL_GASTON_LENGTH 2 @@ -181,6 +400,10 @@ struct email // WANNE: A reference to the IMP position in the gMercProfiles array. // So we know which analyse email belongs to the imp INT32 iCurrentIMPPosition; + + UINT8 EmailVersion; + + UINT32 EmailType; // WANNE.MAIL: Fix INT16 iCurrentShipmentDestinationID; @@ -269,6 +492,9 @@ enum { KING_PIN, JOHN_KULBA, AIM_SITE, +#ifdef JA2UB + MAIL_MIGUEL, +#endif }; // the length of the subject in char @@ -300,16 +526,16 @@ void RenderEmail(); // message manipulation -void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, INT32 iDate, UINT8 ubSender, BOOLEAN fAlreadyRead, INT32 uiFirstData, UINT32 uiSecondData, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID ); +void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, INT32 iDate, UINT8 ubSender, BOOLEAN fAlreadyRead, INT32 uiFirstData, UINT32 uiSecondData, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType, UINT32 EmailAIM ); void RemoveEmailMessage(INT32 iId); EmailPtr GetEmailMessage(INT32 iId); void LookForUnread(); -void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID); +void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType); // WANNE: For the new WF merc, when they available again -void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition); +void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, UINT8 EmailType); -void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate); +void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, UINT8 EmailType ); BOOLEAN DisplayNewMailBox(); void CreateDestroyNewMailButton(); void CreateDestroyDeleteNoticeMailButton(); @@ -319,12 +545,133 @@ void ReDrawNewMailBox( void ); void ReDisplayBoxes( void ); void ShutDownEmailList(); void AddMessageToPages(INT32 iMessageId); -void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData ); +void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData, UINT8 EmailType, UINT32 EmailAIM ); + +void AddCustomEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType); #ifdef JA2BETAVERSION void AddAllEmails(); #endif +typedef struct +{ + UINT8 uiIndex; + CHAR16 szMessage[MAIL_STRING_SIZE]; + CHAR16 szSubject[EMAIL_SUBJECT_LENGTH]; + +} EMAIL_MERC_AVAILABLE_VALUES; + +typedef struct +{ + UINT8 uiIndex; + CHAR16 szMessage[MAIL_STRING_SIZE]; + CHAR16 szSubject[EMAIL_SUBJECT_LENGTH]; + +} EMAIL_MERC_LEVEL_UP_VALUES; + +typedef struct +{ + UINT8 uiIndex; + CHAR16 szMessage[MAIL_STRING_SIZE]; + CHAR16 szSubject[EMAIL_SUBJECT_LENGTH]; + +} EMAIL_MERC_INSURANCE_VALUES; + +#define EMAIL_INDEX 500 + +typedef struct +{ + UINT8 uiIndex; + CHAR16 szMessage[MAIL_STRING_SIZE][30]; + CHAR16 szSubject[EMAIL_SUBJECT_LENGTH]; +} EMAIL_OTHER_VALUES; + + +typedef struct +{ + UINT8 uiIndex; + UINT32 EmailType; + UINT8 EmailVersion; + +} EMAIL_TYPE; + +#define EMAIL_VAL 4000 + +extern EMAIL_TYPE gEmailT[EMAIL_VAL]; + +enum { + //------------------------------ + //Read Email.edt + // read message from Email.edt + TYPE_EMAIL_EMAIL_EDT = 0, + // read message from Email.edt and nickname (sender) read from MercProfiles.xml + TYPE_EMAIL_EMAIL_EDT_NAME_MERC, + + //------------------------------- + //Read *.xml + //Read message from Email\EmailMercAvailable.xml.XML and nickname (sender) read from MercProfiles.xml + TYPE_EMAIL_AIM_AVAILABLE, + //Read message from Email\EmailMercLevelUp.xml.XML and nickname (sender) read from MercProfiles.xml + TYPE_EMAIL_MERC_LEVEL_UP, + + //Read from others *.XMLs + TYPE_EMAIL_BOBBY_R, + + //Read from JA2 Email.edt + TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT, + TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT, + TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, + + //Read from others *.XMLs + TYPE_EMAIL_ENRICO, + TYPE_EMAIL_CHAR_PROFILE_SITE, + TYPE_EMAIL_GAME_HELP, + TYPE_EMAIL_IMP_PROFILE_RESULTS, + TYPE_EMAIL_SPECK_FROM_MERC, + TYPE_EMAIL_RIS_EMAIL, + TYPE_EMAIL_INSURANCE_COMPANY, + TYPE_EMAIL_KING_PIN, + TYPE_EMAIL_JOHN_KULBA, + TYPE_EMAIL_AIM_SITE, + + TYPE_EMAIL_OTHER, +}; + +enum { + + TYPE_E_NONE = 0, + + TYPE_E_AIM_L1 = 1, //206 + TYPE_E_AIM_L2 = 2, //27 + TYPE_E_AIM_L3 = 3, //217 + TYPE_E_AIM_L4 = 4, //214 + + TYPE_E_INSURANCE_L1 = 5, //170 + TYPE_E_INSURANCE_L2 = 6, //211 + TYPE_E_INSURANCE_L3 = 7, //170 + TYPE_E_INSURANCE_L4 = 8, //173 + TYPE_E_INSURANCE_L5 = 9, //179 + TYPE_E_INSURANCE_L6 = 10, //176 + + TYPE_EMAIL_BOBBY_R_L1 = 11, +}; + +extern EMAIL_MERC_AVAILABLE_VALUES EmailMercAvailableText[NUM_PROFILES]; +extern EMAIL_MERC_LEVEL_UP_VALUES EmailMercLevelUpText[NUM_PROFILES]; +extern EMAIL_MERC_INSURANCE_VALUES EmailInsuranceText[NUM_PROFILES]; + +extern EMAIL_OTHER_VALUES EmailOtherText[EMAIL_INDEX]; +extern BOOLEAN ReadXMLEmail; +extern void AddEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, UINT8 EmailType ); +extern void AddPreReadEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, UINT8 EmailType ); +extern void AddEmailWithSpecialDataXML(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData, UINT8 EmailType ); +extern BOOLEAN SaveNewEmailDataToSaveGameFile( HWFILE hFile ); +extern BOOLEAN LoadNewEmailDataFromLoadGameFile( HWFILE hFile ); + +#ifdef JA2UB +extern void AddBobbyREmailJA2(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, INT16 iCurrentShipmentDestinationID, UINT8 EmailType ); +#endif + #endif diff --git a/Laptop/files.cpp b/Laptop/files.cpp index 9776b91e..4dc15dff 100644 --- a/Laptop/files.cpp +++ b/Laptop/files.cpp @@ -20,6 +20,10 @@ #include "GameSettings.h" #endif +#ifdef JA2UB +#include "ub_config.h" +#endif + #define TOP_X LAPTOP_SCREEN_UL_X #define TOP_Y LAPTOP_SCREEN_UL_Y #define BLOCK_FILE_HEIGHT 10 @@ -44,7 +48,12 @@ #define FILES_LIST_X FILES_SENDER_TEXT_X #define FILES_LIST_Y ( 9 * BLOCK_HEIGHT ) #define FILES_LIST_WIDTH 100 + +#ifdef JA2UB +#define LENGTH_OF_ENRICO_FILE 39 //Ja25 68 +#else #define LENGTH_OF_ENRICO_FILE 68 +#endif #define MAX_FILE_MESSAGE_PAGE_SIZE 325 #define VIEWER_MESSAGE_BODY_START_Y FILES_LIST_Y #define PREVIOUS_FILE_PAGE_BUTTON_X iScreenWidthOffset + 553 @@ -56,6 +65,13 @@ #define FILES_COUNTER_2_WIDTH 43 #define FILES_COUNTER_3_WIDTH 45 +#ifdef JA2UB +#define RIS_EDT_FILE_JA25 "BINARYDATA\\RIS25.edt" +#define RIS_EDT_FILE_JA2 "BINARYDATA\\RIS.edt" + +#define MAP_JA25 "LAPTOP\\TraconaMap.sti" +#define MAP_JA2 "LAPTOP\\ArucoFilesMap.sti" +#endif // the highlighted line INT32 iHighLightFileLine=-1; @@ -176,6 +192,8 @@ void AddStringToFilesList( STR16 pString ); BOOLEAN HandleSpecialFiles( UINT8 ubFormat ); BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ); +BOOLEAN HandleMissionBriefingFiles( UINT8 ubFormat ); //mission briefing by Jazz +FileRecordWidthPtr CreateWidthRecordsForMissionBriefingFile( void ); // callbacks void FilesBtnCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -224,8 +242,16 @@ void GameInitFiles( ) ClearFilesList( ); // add background check by RIS - AddFilesToPlayersLog( ENRICO_BACKGROUND, 0,255, NULL, NULL ); + //#ifdef JA2UB + //if ( gGameUBOptions.RISRAPORT == TRUE ) + // AddFilesToPlayersLog( ENRICO_BACKGROUND, 0,255, NULL, NULL ); + //#else + AddFilesToPlayersLog( ENRICO_BACKGROUND, 0,255, NULL, NULL ); + //#endif + + //mission briefing by Jazz + //AddFilesToPlayersLog( MISSION_BRIEFING, 0,4, NULL, NULL ); } void EnterFiles() @@ -997,6 +1023,11 @@ BOOLEAN DisplayFormattedText( void ) // load first graphic HandleSpecialTerroristFile( pFilesList->ubCode, pFilesList->pPicFileNameList[ 0 ] ); break; + case 4: + // picture on the left, with text on right and below + // load first graphic + HandleMissionBriefingFiles( pFilesList->ubFormat ); + break; default: HandleSpecialFiles( pFilesList->ubFormat ); break; @@ -1009,6 +1040,232 @@ BOOLEAN DisplayFormattedText( void ) return ( TRUE ); } +//Mission briefing by Jazz + +FileRecordWidthPtr CreateWidthRecordsForMissionBriefingFile( void ) +{ + // this fucntion will create the width list for the Arulco intelligence file + FileRecordWidthPtr pTempRecord = NULL; + FileRecordWidthPtr pRecordListHead = NULL; + + + // first record width +// pTempRecord = CreateRecordWidth( 7, 350, 200,0 ); + pTempRecord = CreateRecordWidth( FILES_COUNTER_1_WIDTH, 200, 0,0 ); + + // set up head of list now + pRecordListHead = pTempRecord; + + // next record +// pTempRecord->Next = CreateRecordWidth( 43, 200,0, 0 ); + pTempRecord->Next = CreateRecordWidth( FILES_COUNTER_2_WIDTH, 200,0, 0 ); + pTempRecord = pTempRecord->Next; + + // and the next.. +// pTempRecord->Next = CreateRecordWidth( 45, 200,0, 0 ); + pTempRecord->Next = CreateRecordWidth( FILES_COUNTER_3_WIDTH, 200,0, 0 ); + pTempRecord = pTempRecord->Next; + + return( pRecordListHead ); + +} + +BOOLEAN HandleMissionBriefingFiles( UINT8 ubFormat ) +{ + INT32 iCounter = 0; + CHAR16 sString[2048]; + FileStringPtr pTempString = NULL ; + FileStringPtr pLocatorString = NULL; + INT32 iYPositionOnPage = 0; + INT32 iFileLineWidth = 0; + INT32 iFileStartX = 0; + UINT32 uiFlags = 0; + UINT32 uiFont = 0; + BOOLEAN fGoingOffCurrentPage = FALSE; + FileRecordWidthPtr WidthList = NULL; + + + UINT32 uiPicture; + HVOBJECT hHandle; + VOBJECT_DESC VObjectDesc; + + + ClearFileStringList( ); + + switch( ubFormat ) + { + case( 4 ): + // load data + // read one record from file manager file + + WidthList = CreateWidthRecordsForMissionBriefingFile( ); + while( iCounter < 250 ) + { + LoadEncryptedDataFromFile( "binarydata\\MissionBriefing.EDT", sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); + + AddStringToFilesList( sString ); + iCounter++; + } + + pTempString = pFileStringList; + + + iYPositionOnPage = 0; + iCounter = 0; + pLocatorString = pTempString; + + pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); + + // find out where this string is + while( pLocatorString != pTempString ) + { + iCounter++; + pLocatorString = pLocatorString->Next; + } + + + // move through list and display + while( pTempString ) + { + uiFlags = IAN_WRAP_NO_SHADOW; + // copy over string + wcscpy( sString, pTempString->pString ); + + if( sString[ 0 ] == 0 ) + { + // on last page + fOnLastFilesPageFlag = TRUE; + } + + + // set up font + uiFont = FILES_TEXT_FONT; + if( giFilesPage == 0 ) + { + switch( iCounter ) + { + case( 0 ): + uiFont = FILES_TITLE_FONT; + break; + + } + } + + if( iCounter == 0 ) + { + // reset width + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } + else + { + // reset width + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } + + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, + uiFont, 0, sString, + 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) + { + // now print it + iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); + + fGoingOffCurrentPage = FALSE; + } + else + { + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; + } + + pTempString = pTempString->Next; + + if( pTempString == NULL ) + { + // on last page + fOnLastFilesPageFlag = TRUE; + } + else + { + fOnLastFilesPageFlag = FALSE; + } + + // going over the edge, stop now + if( fGoingOffCurrentPage == TRUE ) + { + pTempString = NULL; + } + iCounter++; + } + ClearOutWidthRecordsList( WidthList ); + ClearFileStringList( ); + break; + } + + // place pictures + // page 1 picture of country + if( giFilesPage == 0 ) + { + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //Ja25, new map +#ifdef JA2UB + if (FileExists(MAP_JA25)) + { + FilenameForBPP("LAPTOP\\TraconaMap.sti", VObjectDesc.ImageFile); + } + else + { + FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); + } +#else + FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); +#endif + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + // get title bar object + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 300, iScreenHeightOffset + 270, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + + } + else if( giFilesPage == 1 ) + { + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //Ja25, new map +#ifdef JA2UB + if (FileExists(MAP_JA25)) + { + FilenameForBPP("LAPTOP\\TraconaMap.sti", VObjectDesc.ImageFile); + } + else + { + FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); + } +#else + FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); +#endif + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + // get title bar object + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 300, iScreenHeightOffset + 270, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + + } + + return ( TRUE ); +} + +//------------------------------------------- BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) { @@ -1041,7 +1298,18 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) WidthList = CreateWidthRecordsForAruloIntelFile( ); while( iCounter < LENGTH_OF_ENRICO_FILE ) { +#ifdef JA2UB + if (FileExists(RIS_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile( RIS_EDT_FILE_JA25, sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); + } + else + { + LoadEncryptedDataFromFile( RIS_EDT_FILE_JA25, sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); + } +#else LoadEncryptedDataFromFile( "BINARYDATA\\RIS.EDT", sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); +#endif AddStringToFilesList( sString ); iCounter++; } @@ -1189,7 +1457,19 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) { // title bar VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; +#ifdef JA2UB + //Ja25, new map + if (FileExists(MAP_JA25)) + { + FilenameForBPP("LAPTOP\\TraconaMap.sti", VObjectDesc.ImageFile); + } + else + { FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); + } +#else + FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); +#endif CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); // get title bar object @@ -1201,6 +1481,10 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) DeleteVideoObjectFromIndex( uiPicture ); } + +#ifdef JA2UB +//JA25 : no picture needed +#else else if( giFilesPage == 4 ) { // kid pic @@ -1217,6 +1501,11 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) DeleteVideoObjectFromIndex( uiPicture ); } +#endif + +#ifdef JA2UB +//Ja25 No picture +#else else if( giFilesPage == 5 ) { @@ -1234,7 +1523,7 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) DeleteVideoObjectFromIndex( uiPicture ); } - +#endif return ( TRUE ); } diff --git a/Laptop/florist Order Form.cpp b/Laptop/florist Order Form.cpp index 79fd08f7..cedfa599 100644 --- a/Laptop/florist Order Form.cpp +++ b/Laptop/florist Order Form.cpp @@ -652,6 +652,9 @@ void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason) if ( gubCurrentlySelectedFlowerLocation == 7 ) { +#ifdef JA2UB +// no UB +#else // sent to meduna! if ( gfFLoristCheckBox0Down ) { @@ -661,6 +664,7 @@ void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason) { HandleFlowersMeanwhileScene( 1 ); } +#endif } //increment the order number diff --git a/Laptop/history.cpp b/Laptop/history.cpp index ff4f5129..8933784f 100644 --- a/Laptop/history.cpp +++ b/Laptop/history.cpp @@ -68,6 +68,11 @@ UINT32 guiSHADELINE; //UINT32 guiVERTLINE; //UINT32 guiBIGBOX; +#ifdef JA2UB +#define QUEST_EDT_FILE_JA25 "BINARYDATA\\quests25.edt" +#define QUEST_EDT_FILE_JA2 "BINARYDATA\\quests.edt" +#endif + enum{ PREV_PAGE_BUTTON=0, NEXT_PAGE_BUTTON, @@ -1681,14 +1686,36 @@ UINT32 GetTimeQuestWasStarted( UINT8 ubCode ) void GetQuestStartedString( UINT8 ubQuestValue, STR16 sQuestString ) { // open the file and copy the string +#ifdef JA2UB + if (FileExists(QUEST_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile( QUEST_EDT_FILE_JA25, sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); + } + else + { + LoadEncryptedDataFromFile( QUEST_EDT_FILE_JA2, sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); + } +#else LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); +#endif } void GetQuestEndedString( UINT8 ubQuestValue, STR16 sQuestString ) { // open the file and copy the string +#ifdef JA2UB + if (FileExists(QUEST_EDT_FILE_JA25)) + { + LoadEncryptedDataFromFile( QUEST_EDT_FILE_JA25, sQuestString, 160 * ( ( ubQuestValue * 2 ) + 1), 160 ); + } + else + { + LoadEncryptedDataFromFile( QUEST_EDT_FILE_JA2, sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); + } +#else LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ( ubQuestValue * 2 ) + 1), 160 ); +#endif } diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index d96f048d..d9057c18 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -28,6 +28,11 @@ #endif #include +#ifdef JA2UB +#include "ub_config.h" +#include "quests.h" +#endif + #define INS_CTRCT_ORDER_GRID_WIDTH 132 #define INS_CTRCT_ORDER_GRID_HEIGHT 216 #define INS_CTRCT_ORDER_GRID_OFFSET_X INS_CTRCT_ORDER_GRID_WIDTH + 2 @@ -1361,12 +1366,30 @@ void StartInsuranceInvestigation( UINT8 ubPayoutID ) if (gStrategicStatus.ubInsuranceInvestigationsCnt == 0) { // first offense - AddEmailWithSpecialData( INSUR_SUSPIC, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); +#ifdef JA2UB +// no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + AddEmailWithSpecialData( 173, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT, TYPE_E_INSURANCE_L4 ); + } +#else + AddEmailWithSpecialData( INSUR_SUSPIC, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } else { // subsequent offense - AddEmailWithSpecialData( INSUR_SUSPIC_2, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); +#ifdef JA2UB +// no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + AddEmailWithSpecialData( 179, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT, TYPE_E_INSURANCE_L5 ); + } +#else + AddEmailWithSpecialData( INSUR_SUSPIC_2, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } if ( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == VERY_SUSPICIOUS_DEATH ) @@ -1394,11 +1417,29 @@ void EndInsuranceInvestigation( UINT8 ubPayoutID ) if ( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == VERY_SUSPICIOUS_DEATH ) { // fraud, no payout! - AddEmailWithSpecialData( INSUR_1HOUR_FRAUD, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); +#ifdef JA2UB +// no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + AddEmailWithSpecialData( 211, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT, TYPE_E_INSURANCE_L2 ); + } +#else + AddEmailWithSpecialData( INSUR_1HOUR_FRAUD, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } else { - AddEmailWithSpecialData( INSUR_INVEST_OVER, INSUR_INVEST_OVER_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); +#ifdef JA2UB +// No UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + AddEmailWithSpecialData( 176, INSUR_INVEST_OVER_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT, TYPE_E_INSURANCE_L6 ); + } +#else + AddEmailWithSpecialData( INSUR_INVEST_OVER, INSUR_INVEST_OVER_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif // only now make a payment (immediately) InsuranceContractPayLifeInsuranceForDeadMerc( ubPayoutID ); @@ -1427,7 +1468,16 @@ void InsuranceContractPayLifeInsuranceForDeadMerc( UINT8 ubPayoutID ) if( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == 0 ) { //Add an email telling the user that he received an insurance payment - AddEmailWithSpecialData( INSUR_PAYMENT, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); +#ifdef JA2UB +// no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.LaptopLinkInsurance == TRUE ) + AddEmailWithSpecialData( 170, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT, TYPE_E_INSURANCE_L3 ); + } +#else + AddEmailWithSpecialData( INSUR_PAYMENT, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed --; diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp index e6b929e9..831bc0db 100644 --- a/Laptop/laptop.cpp +++ b/Laptop/laptop.cpp @@ -85,12 +85,26 @@ #endif #include "connect.h" +#include "Encyclopedia_Data.h" +#include "Encyclopedia.h" +#include "BriefingRoom.h" +#include "BriefingRoomM.h" +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "End Game.h" +#include "ub_config.h" +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; +#ifdef JA2UB +BOOLEAN gfProcessCustomMaps = FALSE; //ja25 UB +#endif // icons text id's enum{ @@ -651,7 +665,10 @@ extern void CheatToGetAll5Merc(); extern void DemoHiringOfMercs( ); #endif - +#ifdef JA2UB +//JA25 UB +#define LAPTOP__HAVENT_CREATED_IMP_REMINDER_EMAIL_ARRIVE_TIME ( (8 + Random(4) ) * 60 ) +#endif void SetLaptopExitScreen( UINT32 uiExitScreen ) { @@ -740,6 +757,13 @@ UINT32 LaptopScreenInit() //reset the flag that enables the 'just hired merc' popup LaptopSaveInfo.sLastHiredMerc.fHaveDisplayedPopUpInLaptop = FALSE; +#ifdef JA2UB + //JA25 UB + //Set the internet as WORKING + if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) + gubQuest[ QUEST_FIX_LAPTOP ] = QUESTNOTSTARTED; +#endif + //Initialize all vars guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; guiPreviousLaptopMode = LAPTOP_MODE_NONE; @@ -770,12 +794,27 @@ UINT32 LaptopScreenInit() GameInitEmail(); GameInitCharProfile(); GameInitFlorist(); +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + { GameInitInsurance(); GameInitInsuranceContract(); + } +//JA25: +#else + GameInitInsurance(); + GameInitInsuranceContract(); +#endif GameInitFuneral(); GameInitSirTech(); GameInitFiles(); GameInitPersonnel(); + + //legion + GameInitEncyclopedia(); + GameInitEncyclopediaLocation(); + GameInitBriefingRoom(); + GameInitBriefingRoomEnter(); // init program states memset( &gLaptopProgramStates, LAPTOP_PROGRAM_MINIMIZED, sizeof( gLaptopProgramStates ) ); @@ -783,7 +822,9 @@ UINT32 LaptopScreenInit() gfAtLeastOneMercWasHired = FALSE; //No longer inits the laptop screens, now InitLaptopAndLaptopScreens() does - +#ifdef JA2UB + InitJa25SaveStruct(); +#endif return( 1 ); } @@ -798,6 +839,11 @@ BOOLEAN InitLaptopAndLaptopScreens() LaptopSaveInfo.fIMPCompletedFlag = FALSE; //Reset the flag so that BOBBYR's isnt available at the begining of the game + #ifdef JA2UB + if ( gGameUBOptions.fBobbyRSite == TRUE ) + LaptopSaveInfo.fBobbyRSiteCanBeAccessed = TRUE; + else + #endif LaptopSaveInfo.fBobbyRSiteCanBeAccessed = FALSE; return( TRUE ); @@ -825,7 +871,13 @@ DrawLapTopText() //This is only called once at game shutdown. UINT32 LaptopScreenShutdown() { +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + InsuranceContractEndGameShutDown(); +//JA25: +#else InsuranceContractEndGameShutDown(); +#endif BobbyRayMailOrderEndGameShutDown(); ShutDownEmailList(); @@ -991,16 +1043,24 @@ INT32 EnterLaptop() fMaximizingProgram = FALSE; fMinizingProgram = FALSE; - // initialize open queue InitLaptopOpenQueue( ); - gfShowBookmarks=FALSE; LoadBookmark( ); if (!is_networked) SetBookMark(AIM_BOOKMARK); + +#ifdef JA2UB + //JA25 UB + SetBookMark(MERC_BOOKMARK); +#endif + if ( gGameExternalOptions.gEncyclopedia == TRUE && !is_networked ) + SetBookMark(ENCYCLOPEDIA_BOOKMARK); + + if ( gGameExternalOptions.gBriefingRoom == TRUE && !is_networked ) + SetBookMark(BRIEFING_ROOM_BOOKMARK); LoadLoadPending( ); @@ -1137,7 +1197,13 @@ void ExitLaptop() // CloseLibrary( LIBRARY_LAPTOP ); //pause the game because we dont want time to advance in the laptop UnPauseGame(); - +#ifdef JA2UB +//ja25 UB + if( gTacticalStatus.uiFlags & IN_ENDGAME_SEQUENCE ) + { + HandleJa25EndGameAndGoToCreditsScreen( FALSE ); + } +#endif } void @@ -1183,6 +1249,27 @@ void RenderLaptop() case( LAPTOP_MODE_NONE ): DrawDeskTopBackground( ); break; + + case LAPTOP_MODE_ENCYCLOPEDIA: //LEGION + RenderEncyclopedia(); + break; + + case LAPTOP_MODE_ENCYCLOPEDIA_LOCATION: + RenderEncyclopediaLocation(FALSE); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_PAGE: + RenderBriefingRoom(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_ENTER: + RenderBriefingRoomEnter(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM: + RenderEncyclopediaLocation(FALSE); + break; + case LAPTOP_MODE_AIM: RenderAIM(); break; @@ -1214,10 +1301,18 @@ void RenderLaptop() RenderMercsFiles(); break; case LAPTOP_MODE_MERC_ACCOUNT: +#ifdef JA2UB +//Ja25 +#else RenderMercsAccount(); +#endif break; case LAPTOP_MODE_MERC_NO_ACCOUNT: +#ifdef JA2UB +//Ja25 +#else RenderMercsNoAccount(); +#endif break; case LAPTOP_MODE_BOBBY_R: @@ -1259,19 +1354,43 @@ void RenderLaptop() break; case LAPTOP_MODE_INSURANCE: +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + RenderInsurance(); +//JA25: // Assert( 0 ); +#else RenderInsurance(); +#endif break; case LAPTOP_MODE_INSURANCE_INFO: +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + RenderInsuranceInfo(); +//JA25: // Assert( 0 ); +#else RenderInsuranceInfo(); +#endif break; case LAPTOP_MODE_INSURANCE_CONTRACT: +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + RenderInsuranceContract(); +//JA25: +#else RenderInsuranceContract(); +#endif break; case LAPTOP_MODE_INSURANCE_COMMENTS: +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + RenderInsuranceComments(); +//JA25: // Assert( 0 ); +#else RenderInsuranceComments(); +#endif break; case LAPTOP_MODE_FUNERAL: @@ -1450,6 +1569,16 @@ void EnterNewLaptopMode() default: if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_MINIMIZED ) { + + if ( guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA_LOCATION || guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA ) + { + guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; + } + else if ( guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) + { + guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; + } + // minized, maximized if( fMaximizingProgram == FALSE ) { @@ -1536,6 +1665,26 @@ void EnterNewLaptopMode() //Initialize the new mode. switch( guiCurrentLaptopMode ) { + //legion + case LAPTOP_MODE_ENCYCLOPEDIA: + EnterEncyclopedia(); + break; + + case LAPTOP_MODE_ENCYCLOPEDIA_LOCATION: + EnterEncyclopediaLocation(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_PAGE: + EnterBriefingRoom(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_ENTER: + EnterBriefingRoomEnter(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM: + EnterEncyclopediaLocation(); + break; case LAPTOP_MODE_AIM: EnterAIM(); @@ -1570,10 +1719,18 @@ void EnterNewLaptopMode() EnterMercsFiles(); break; case LAPTOP_MODE_MERC_ACCOUNT: +#ifdef JA2UB +//Ja25 +#else EnterMercsAccount(); +#endif break; case LAPTOP_MODE_MERC_NO_ACCOUNT: +#ifdef JA2UB +//Ja25 +#else EnterMercsNoAccount(); +#endif break; case LAPTOP_MODE_BOBBY_R: @@ -1613,7 +1770,24 @@ void EnterNewLaptopMode() case LAPTOP_MODE_FLORIST_CARD_GALLERY: EnterFloristCards(); break; - +#ifdef JA2UB + case LAPTOP_MODE_INSURANCE: + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + EnterInsurance(); + break; + case LAPTOP_MODE_INSURANCE_INFO: + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + EnterInsuranceInfo(); + break; + case LAPTOP_MODE_INSURANCE_CONTRACT: + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + EnterInsuranceContract(); + break; + case LAPTOP_MODE_INSURANCE_COMMENTS: + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + EnterInsuranceComments(); + break; +#else case LAPTOP_MODE_INSURANCE: EnterInsurance(); break; @@ -1626,7 +1800,7 @@ void EnterNewLaptopMode() case LAPTOP_MODE_INSURANCE_COMMENTS: EnterInsuranceComments(); break; - +#endif case LAPTOP_MODE_FUNERAL: EnterFuneral(); break; @@ -1694,6 +1868,26 @@ void HandleLapTopHandles() switch( guiCurrentLaptopMode ) { + //legion + case LAPTOP_MODE_ENCYCLOPEDIA: + HandleEncyclopedia(); + break; + + case LAPTOP_MODE_ENCYCLOPEDIA_LOCATION: + HandleEncyclopediaLocation(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_PAGE: + HandleBriefingRoom(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_ENTER: + HandleBriefingRoomEnter(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM: + HandleEncyclopediaLocation(); + break; case LAPTOP_MODE_AIM: @@ -1727,13 +1921,21 @@ void HandleLapTopHandles() case LAPTOP_MODE_MERC_FILES: HandleMercsFiles(); break; +#ifdef JA2UB + case LAPTOP_MODE_MERC_ACCOUNT: +//Ja25 HandleMercsAccount(); + break; + case LAPTOP_MODE_MERC_NO_ACCOUNT: +//Ja25 HandleMercsNoAccount(); + break; +#else case LAPTOP_MODE_MERC_ACCOUNT: HandleMercsAccount(); break; case LAPTOP_MODE_MERC_NO_ACCOUNT: HandleMercsNoAccount(); break; - +#endif case LAPTOP_MODE_BOBBY_R: HandleBobbyR(); @@ -1773,7 +1975,30 @@ void HandleLapTopHandles() case LAPTOP_MODE_FLORIST_CARD_GALLERY: HandleFloristCards(); break; +#ifdef JA2UB + case LAPTOP_MODE_INSURANCE: + // Assert( 0 ); + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + HandleInsurance(); + break; + case LAPTOP_MODE_INSURANCE_INFO: + // Assert( 0 ); + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + HandleInsuranceInfo(); + break; + + case LAPTOP_MODE_INSURANCE_CONTRACT: + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + HandleInsuranceContract(); + break; + + case LAPTOP_MODE_INSURANCE_COMMENTS: + // Assert( 0 ); + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + HandleInsuranceComments(); + break; +#else case LAPTOP_MODE_INSURANCE: HandleInsurance(); break; @@ -1789,6 +2014,7 @@ void HandleLapTopHandles() HandleInsuranceComments(); break; +#endif case LAPTOP_MODE_FUNERAL: HandleFuneral(); break; @@ -1857,9 +2083,9 @@ UINT32 LaptopScreenHandle() // just entered if(gfEnterLapTop) { - EnterLaptop(); - CreateLaptopButtons(); - gfEnterLapTop=FALSE; + EnterLaptop(); + CreateLaptopButtons(); + gfEnterLapTop=FALSE; } if( gfStartMapScreenToLaptopTransition ) @@ -2186,6 +2412,29 @@ UINT32 ExitLaptopMode(UINT32 uiMode) switch( uiMode ) { + + case LAPTOP_MODE_ENCYCLOPEDIA: + ExitEncyclopedia(); + //InitEncyklopediaBool(); + break; + + case LAPTOP_MODE_ENCYCLOPEDIA_LOCATION: + ExitEncyclopediaLocation(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_PAGE: + ExitBriefingRoom(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM_ENTER: + ExitBriefingRoomEnter(); + break; + + case LAPTOP_MODE_BRIEFING_ROOM: + ExitEncyclopediaLocation(); + //InitEncyklopediaBool(); + break; + case LAPTOP_MODE_AIM: ExitAIM(); break; @@ -2217,13 +2466,21 @@ UINT32 ExitLaptopMode(UINT32 uiMode) case LAPTOP_MODE_MERC_FILES: ExitMercsFiles(); break; +#ifdef JA2UB + case LAPTOP_MODE_MERC_ACCOUNT: +//Ja25 ExitMercsAccount(); + break; + case LAPTOP_MODE_MERC_NO_ACCOUNT: +//Ja25 ExitMercsNoAccount(); + break; +#else case LAPTOP_MODE_MERC_ACCOUNT: ExitMercsAccount(); break; case LAPTOP_MODE_MERC_NO_ACCOUNT: ExitMercsNoAccount(); break; - +#endif case LAPTOP_MODE_BOBBY_R: ExitBobbyR(); @@ -2263,7 +2520,30 @@ UINT32 ExitLaptopMode(UINT32 uiMode) case LAPTOP_MODE_FLORIST_CARD_GALLERY: ExitFloristCards(); break; +#ifdef JA2UB + case LAPTOP_MODE_INSURANCE: + // Assert( 0 ); + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + ExitInsurance(); + break; + case LAPTOP_MODE_INSURANCE_INFO: + // Assert( 0 ); + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + ExitInsuranceInfo(); + break; + + case LAPTOP_MODE_INSURANCE_CONTRACT: + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + ExitInsuranceContract(); + break; + + case LAPTOP_MODE_INSURANCE_COMMENTS: + // Assert( 0 ); + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + ExitInsuranceComments(); + break; +#else case LAPTOP_MODE_INSURANCE: ExitInsurance(); break; @@ -2278,7 +2558,7 @@ UINT32 ExitLaptopMode(UINT32 uiMode) case LAPTOP_MODE_INSURANCE_COMMENTS: ExitInsuranceComments(); break; - +#endif case LAPTOP_MODE_FUNERAL: ExitFuneral(); break; @@ -2509,6 +2789,11 @@ BOOLEAN LeaveLapTopScreen( void ) fExitingLaptopFlag = TRUE; InitNewGame( FALSE ); gfDontStartTransitionFromLaptop = TRUE; +#ifdef JA2UB + //Ja25 UB + // ATE: Set flag to look for custom maps + gfProcessCustomMaps = TRUE; +#endif return( TRUE ); } } @@ -2658,12 +2943,31 @@ BOOLEAN HandleExit( void ) void HaventMadeImpMercEmailCallBack() { +#ifdef JA2UB + //if the Laptop is NOT broken + if( gubQuest[ QUEST_FIX_LAPTOP ] != QUESTINPROGRESS && gGameUBOptions.LaptopQuestEnabled == TRUE ) + { + //if the player STILL hasnt made an imp merc yet + if( ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) && ( LaptopSaveInfo.fSentImpWarningAlready == FALSE ) ) + { + //if the player DIDNT import the save + //if( !gubFact[ FACT_PLAYER_IMPORTED_SAVE ] ) + //{ + //send a follow up email to the player + LaptopSaveInfo.fSentImpWarningAlready = TRUE; + AddEmail( IMP_EMAIL_AGAIN, IMP_EMAIL_AGAIN_LENGTH, CHAR_PROFILE_SITE, GetWorldTotalMin( ), -1 ,-1, TYPE_EMAIL_EMAIL_EDT); + //} + } + } +#else + //if the player STILL hasnt made an imp merc yet if( ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) && ( LaptopSaveInfo.fSentImpWarningAlready == FALSE ) ) { LaptopSaveInfo.fSentImpWarningAlready = TRUE; - AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ), -1, -1 ); + AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT ); } +#endif } @@ -2832,7 +3136,8 @@ void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); + if(giCurrentRegion!=WWW_REGION) giOldRegion=giCurrentRegion; if(!fNewWWW) @@ -2877,7 +3182,27 @@ void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) } } giCurrentRegion=WWW_REGION; - RestoreOldRegion(giOldRegion); + RestoreOldRegion(giOldRegion); + + if ( guiCurrentWWWMode >= LAPTOP_MODE_FINANCES && guiCurrentWWWMode <= LAPTOP_MODE_BOBBYR_SHIPMENTS ) + { + IDPageEncyData = PAGENONE; + UnLoadMenuButtons (); + bEncyclopediaLocation = FALSE; + bEncyclopediaCharacter = FALSE; + bEncyclopediaInventory = FALSE; + bEncyclopediaQuests = FALSE; + bBriefingRoom = FALSE; + bBriefingRoomSpecialMission = FALSE; + } + + if ( IDPageEncyData == PAGEENCYCLOPEDIALOCATION ) guiCurrentWWWMode = LAPTOP_MODE_ENCYCLOPEDIA;//{ bEncyclopediaLocation = TRUE; InitData (); } + else if ( IDPageEncyData == PAGEENCYCLOPEDIACHARACTER ) guiCurrentWWWMode = LAPTOP_MODE_ENCYCLOPEDIA;//{ bEncyclopediaCharacter = TRUE; InitData (); } + else if ( IDPageEncyData == PAGEENCYCLOPEDIAINVENTORY ) guiCurrentWWWMode = LAPTOP_MODE_ENCYCLOPEDIA;//{ bEncyclopediaInventory = TRUE; InitData (); } + else if ( IDPageEncyData == PAGEENCYCLOPEDIAQUESTS ) guiCurrentWWWMode = LAPTOP_MODE_ENCYCLOPEDIA;//{ bEncyclopediaQuests = TRUE; InitData (); } + else if ( IDPageEncyData == PAGEBRIEFINGROOM ) guiCurrentWWWMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER;//{ bBriefingRoom = TRUE; InitData (); } + else if ( IDPageEncyData == PAGEBRIEFINGROOMSPECIALMISSION ) guiCurrentWWWMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER;//{ bBriefingRoomSpecialMission = TRUE; InitData (); } + if(guiCurrentWWWMode!=LAPTOP_MODE_NONE) guiCurrentLaptopMode = guiCurrentWWWMode; else @@ -2894,7 +3219,6 @@ void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) btn->uiFlags&=~(BUTTON_CLICKED_ON); // nothing yet - if(giCurrentRegion!=WWW_REGION) giOldRegion=giCurrentRegion; @@ -3650,7 +3974,11 @@ void GoToWebPage(INT32 iPageId ) //} //else // giRainDelayInternetSite = -1; - +#ifdef JA2UB + //if the laptop is broken +if( (gubQuest[ QUEST_FIX_LAPTOP ] != QUESTINPROGRESS) || (gGameUBOptions.LaptopQuestEnabled != TRUE) ) +{ +#endif switch(iPageId) { case AIM_BOOKMARK: @@ -3671,6 +3999,46 @@ void GoToWebPage(INT32 iPageId ) fFastLoadFlag = TRUE; } break; + + //LEGION + case ENCYCLOPEDIA_BOOKMARK: + guiCurrentWWWMode=LAPTOP_MODE_ENCYCLOPEDIA; + guiCurrentLaptopMode=LAPTOP_MODE_ENCYCLOPEDIA; + + // do we have to have a World Wide Wait + if( LaptopSaveInfo.fVisitedBookmarkAlready[ ENCYCLOPEDIA_BOOKMARK ] == FALSE ) + { + // reset flag and set load pending flag + LaptopSaveInfo.fVisitedBookmarkAlready[ ENCYCLOPEDIA_BOOKMARK ] = TRUE; + fLoadPendingFlag = TRUE; + } + else + { + // fast reload + fLoadPendingFlag = TRUE; + fFastLoadFlag = TRUE; + } + break; + + case BRIEFING_ROOM_BOOKMARK: + guiCurrentWWWMode=LAPTOP_MODE_BRIEFING_ROOM_PAGE; + guiCurrentLaptopMode=LAPTOP_MODE_BRIEFING_ROOM_PAGE; + + // do we have to have a World Wide Wait + if( LaptopSaveInfo.fVisitedBookmarkAlready[ BRIEFING_ROOM_BOOKMARK ] == FALSE ) + { + // reset flag and set load pending flag + LaptopSaveInfo.fVisitedBookmarkAlready[ BRIEFING_ROOM_BOOKMARK ] = TRUE; + fLoadPendingFlag = TRUE; + } + else + { + // fast reload + fLoadPendingFlag = TRUE; + fFastLoadFlag = TRUE; + } + break; + case BOBBYR_BOOKMARK: guiCurrentWWWMode=LAPTOP_MODE_BOBBY_R; guiCurrentLaptopMode=LAPTOP_MODE_BOBBY_R; @@ -3795,6 +4163,20 @@ void GoToWebPage(INT32 iPageId ) } +#ifdef JA2UB + } + //the web is not working + else + { + guiCurrentWWWMode = LAPTOP_MODE_BROKEN_LINK; + guiCurrentLaptopMode = LAPTOP_MODE_BROKEN_LINK; + + // slow load + fLoadPendingFlag = TRUE; + fFastLoadFlag = FALSE; + } +#endif + gfShowBookmarks=FALSE; fReDrawScreenFlag=TRUE; return; @@ -3882,6 +4264,14 @@ BOOLEAN DisplayLoadPending( void ) iUnitTime += WWaitDelayIncreasedIfRaining( iUnitTime ); iLoadTime = iUnitTime * 30; +#ifdef JA2UB + //if the site we are going to is the web poage not found page + if( guiCurrentLaptopMode == LAPTOP_MODE_BROKEN_LINK ) + { + iLoadTime=1; + iUnitTime=1; + } +#endif } @@ -4162,7 +4552,12 @@ void EnterLaptopInitLaptopPages() EnterInitAimPolicies(); EnterInitAimHistory(); EnterInitFloristGallery(); +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) + EnterInitInsuranceInfo(); +#else EnterInitInsuranceInfo(); +#endif EnterInitBobbyRayOrder(); EnterInitMercSite(); @@ -4271,13 +4666,13 @@ void CheckIfNewWWWW( void ) { // if no www mode, set new www flag..until new www mode that is not 0 - if( guiCurrentWWWMode == LAPTOP_MODE_NONE ) + if( guiCurrentWWWMode == LAPTOP_MODE_NONE ) { - fNewWWW = TRUE; + fNewWWW = TRUE; } else { - fNewWWW = FALSE; + fNewWWW = FALSE; } return; @@ -5225,14 +5620,26 @@ void SetCurrentToLastProgramOpened( void ) break; case( LAPTOP_PROGRAM_WEB_BROWSER ): // last www mode - if( guiCurrentWWWMode != 0 ) + if ( guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA_LOCATION || guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA ) { - guiCurrentLaptopMode = guiCurrentWWWMode; + guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; + } + else if ( guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) + { + guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; + } + //else if( guiCurrentWWWMode != 0 && ( guiCurrentWWWMode == LAPTOP_MODE_ENCYCLOPEDIA_LOCATION || guiCurrentWWWMode == LAPTOP_MODE_ENCYCLOPEDIA || guiCurrentWWWMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentWWWMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentWWWMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) ) + + else if( guiCurrentWWWMode >= LAPTOP_MODE_FINANCES && guiCurrentWWWMode <= LAPTOP_MODE_BOBBYR_SHIPMENTS ) + { + guiCurrentLaptopMode = guiCurrentWWWMode; } else { guiCurrentLaptopMode = LAPTOP_MODE_WWW; } + + guiCurrentLaptopMode = LAPTOP_MODE_WWW; //gfShowBookmarks = TRUE; fShowBookmarkInfo = TRUE; break; @@ -5538,7 +5945,12 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us SetBookMark( MERC_BOOKMARK ); SetBookMark( FUNERAL_BOOKMARK ); SetBookMark( FLORIST_BOOKMARK ); +#ifdef JA2UB + if (gGameUBOptions.LaptopLinkInsurance == TRUE ) SetBookMark( INSURANCE_BOOKMARK ); +#else + SetBookMark( INSURANCE_BOOKMARK ); +#endif } } @@ -6492,11 +6904,18 @@ void CreateLaptopButtonHelpText( INT32 iButtonIndex, UINT32 uiButtonHelpTextID ) { SetButtonFastHelpText( iButtonIndex, gzLaptopHelpText[ uiButtonHelpTextID ] ); } - - - - - +#ifdef JA2UB +//ja25 ub +void ShouldImpReminderEmailBeSentWhenLaptopBackOnline() +{ + //if this is past the point of when the IMP email should have been sent + if( GetWorldTotalMin() > LAPTOP__HAVENT_CREATED_IMP_REMINDER_EMAIL_ARRIVE_TIME ) + { + //and the email hasnt been sent + HaventMadeImpMercEmailCallBack(); + } +} +#endif diff --git a/Laptop/laptop.h b/Laptop/laptop.h index 8d279b98..dbecb879 100644 --- a/Laptop/laptop.h +++ b/Laptop/laptop.h @@ -137,6 +137,17 @@ enum LAPTOP_MODE_SIRTECH, LAPTOP_MODE_BROKEN_LINK, LAPTOP_MODE_BOBBYR_SHIPMENTS, + + //ENCYCLOPEDIA + LAPTOP_MODE_ENCYCLOPEDIA, + LAPTOP_MODE_ENCYCLOPEDIA_LOCATION, + LAPTOP_MODE_BRIEFING_ROOM_PAGE, + LAPTOP_MODE_BRIEFING_ROOM, + LAPTOP_MODE_BRIEFING_ROOM_ENTER, + + LAPTOP_MODE_AIM_MEMBERS_ARCHIVES_NEW, + + }; // bookamrks for WWW bookmark list @@ -194,6 +205,8 @@ enum{ FLORIST_BOOKMARK, INSURANCE_BOOKMARK, CANCEL_STRING, + ENCYCLOPEDIA_BOOKMARK, //Encyclopedia + BRIEFING_ROOM_BOOKMARK, TEXT_NUM_LAPTOP_BOOKMARKS }; @@ -205,6 +218,12 @@ extern UINT32 guiLaptopBACKGROUND; #define DEAD_MERC_COLOR_GREEN 55 #define DEAD_MERC_COLOR_BLUE 55 +#ifdef JA2UB +//ja25 UB +void ShouldImpReminderEmailBeSentWhenLaptopBackOnline(); + +extern BOOLEAN gfProcessCustomMaps; +#endif #endif diff --git a/Laptop/mercs Account.cpp b/Laptop/mercs Account.cpp index cbfab4cd..500ec65e 100644 --- a/Laptop/mercs Account.cpp +++ b/Laptop/mercs Account.cpp @@ -83,8 +83,12 @@ INT32 guiAccountButtonImage; BOOLEAN gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning = FALSE; // The Authorize button +#ifdef JA2UB +// not UB +#else void BtnMercAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason); UINT32 guiMercAuthorizeBoxButton; +#endif INT32 guiMercAuthorizeButtonImage; @@ -202,7 +206,12 @@ INT32 GetNumberOfHiredMercs() // Is the merc hired? if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) { + + #ifdef JA2UB + uiContractCharge = gMercProfiles[ usMercID ].uiWeeklySalary * gMercProfiles[ usMercID ].iMercMercContractLength; + #else uiContractCharge = gMercProfiles[ usMercID ].sSalary * gMercProfiles[ usMercID ].iMercMercContractLength; + #endif giMercTotalContractCharge += uiContractCharge; count++; @@ -285,7 +294,9 @@ BOOLEAN EnterMercsAccount() guiMercAuthorizeButtonImage = LoadButtonImage("LAPTOP\\BigButtons.sti", -1,0,-1,1,-1 ); - +#ifdef JA2UB +// not UB +#else guiMercAuthorizeBoxButton = CreateIconAndTextButton( guiMercAuthorizeButtonImage, MercAccountText[MERC_ACCOUNT_AUTHORIZE], FONT12ARIAL, MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, @@ -295,6 +306,7 @@ BOOLEAN EnterMercsAccount() DEFAULT_MOVE_CALLBACK, BtnMercAuthorizeButtonCallback); SetButtonCursor(guiMercAuthorizeBoxButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiMercAuthorizeBoxButton, DISABLED_STYLE_SHADED); +#endif guiMercBackBoxButton = CreateIconAndTextButton( guiMercAuthorizeButtonImage, MercAccountText[MERC_ACCOUNT_HOME], FONT12ARIAL, @@ -329,7 +341,13 @@ void ExitMercsAccount() DeleteVideoObjectFromIndex(guiAccountNumberGrid); UnloadButtonImage( guiMercAuthorizeButtonImage ); + + #ifdef JA2UB + //not UB + #else RemoveButton( guiMercAuthorizeBoxButton ); + #endif + RemoveButton( guiMercBackBoxButton ); DeleteVideoObjectFromIndex(guiMercOrderGrid0); @@ -391,11 +409,15 @@ void RenderMercsAccount() DisplayHiredMercs(); + #ifdef JA2UB + //not UB + #else // giMercTotalContractCharge gets set with the price in DisplayHiredMercs(), so if there is currently no charge, disable the button if( giMercTotalContractCharge == 0 ) { DisableButton( guiMercAuthorizeBoxButton ); } + #endif @@ -404,7 +426,9 @@ void RenderMercsAccount() InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } - +#ifdef JA2UB +//not UB +#else void BtnMercAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -440,7 +464,7 @@ void BtnMercAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } - +#endif void BtnMercBackButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -542,11 +566,19 @@ void DisplayHiredMercs() DrawTextToScreen(sTemp, MERC_AC_SECOND_COLUMN_X, usPosY, MERC_AC_SECOND_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); //Display the mercs rate + #ifdef JA2UB + swprintf(sTemp, L"$%6d",gMercProfiles[ usMercID ].uiWeeklySalary ); + #else swprintf(sTemp, L"$%6d",gMercProfiles[ usMercID ].sSalary ); + #endif DrawTextToScreen(sTemp, MERC_AC_THIRD_COLUMN_X, usPosY, MERC_AC_THIRD_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); //Display the total charge + #ifdef JA2UB + uiContractCharge = gMercProfiles[ usMercID ].uiWeeklySalary * gMercProfiles[ usMercID ].iMercMercContractLength; + #else uiContractCharge = gMercProfiles[ usMercID ].sSalary * gMercProfiles[ usMercID ].iMercMercContractLength; + #endif swprintf(sTemp, L"$%6d", uiContractCharge ); DrawTextToScreen(sTemp, MERC_AC_FOURTH_COLUMN_X, usPosY, MERC_AC_FOURTH_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); @@ -584,7 +616,11 @@ void SettleMercAccounts() if( IsMercOnTeam( ubMercID ) || ( gMercProfiles[ ubMercID ].iMercMercContractLength != 0 ) ) { //Calc the contract charge + #ifdef JA2UB + iContractCharge = gMercProfiles[ ubMercID ].uiWeeklySalary * gMercProfiles[ ubMercID ].iMercMercContractLength; + #else iContractCharge = gMercProfiles[ ubMercID ].sSalary * gMercProfiles[ ubMercID ].iMercMercContractLength; + #endif //if the player can afford to pay this merc if( LaptopSaveInfo.iCurrentBalance >= iPartialPayment + iContractCharge ) @@ -611,12 +647,20 @@ void SettleMercAccounts() } // add the transaction to the finance page + + #ifdef JA2UB AddTransactionToPlayersBook( PAY_SPECK_FOR_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -iPartialPayment ); + #else + AddTransactionToPlayersBook( PAY_SPECK_FOR_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -iPartialPayment ); + #endif + AddHistoryToPlayersLog( HISTORY_SETTLED_ACCOUNTS_AT_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -1, -1 ); //Increment the amount of money paid to speck LaptopSaveInfo.uiTotalMoneyPaidToSpeck += iPartialPayment; - +#ifdef JA2UB +//not ub +#else //If the player only made a partial payment if( iPartialPayment != giMercTotalContractCharge ) gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_MAKES_PARTIAL_PAYMENT; @@ -633,7 +677,7 @@ void SettleMercAccounts() // Since the player has paid, make sure speck wont complain about the lack of payment LaptopSaveInfo.uiSpeckQuoteFlags &= ~SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; } - +#endif //Go to the merc homepage to say the quote guiCurrentLaptopMode = LAPTOP_MODE_MERC; gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; @@ -765,7 +809,11 @@ UINT32 CalculateHowMuchPlayerOwesSpeck() //if( IsMercOnTeam( (UINT8)usMercID ) ) { //Calc salary for the # of days the merc has worked since last paid + #ifdef JA2UB + uiContractCharge += gMercProfiles[ usMercID ].uiWeeklySalary * gMercProfiles[ usMercID ].iMercMercContractLength; + #else uiContractCharge += gMercProfiles[ usMercID ].sSalary * gMercProfiles[ usMercID ].iMercMercContractLength; + #endif } } diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 9bafa651..abe3ae68 100644 Binary files a/Laptop/mercs Files.cpp and b/Laptop/mercs Files.cpp differ diff --git a/Laptop/mercs No Account.cpp b/Laptop/mercs No Account.cpp index 770432c6..9058f00a 100644 --- a/Laptop/mercs No Account.cpp +++ b/Laptop/mercs No Account.cpp @@ -149,9 +149,11 @@ void BtnOpenAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) //Get an account number LaptopSaveInfo.guiPlayersMercAccountNumber = Random( 99999 ); - +#ifdef JA2UB + // gusMercVideoSpeckSpeech = SPECK_QUOTE_THANK_PLAYER_FOR_OPENING_ACCOUNT; +#else gusMercVideoSpeckSpeech = SPECK_QUOTE_THANK_PLAYER_FOR_OPENING_ACCOUNT; - +#endif guiCurrentLaptopMode = LAPTOP_MODE_MERC; gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index 2b8479c5..715fafec 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -1,6 +1,11 @@ #ifdef PRECOMPILEDHEADERS #include "Laptop All.h" #include "GameSettings.h" + +#ifdef JA2UB + #include "Ja25 Strategic Ai.h" +#endif + #else #include "laptop.h" #include "mercs.h" @@ -27,6 +32,12 @@ #include "Quests.h" #endif +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "Speck Quotes.h" +#endif + #include "connect.h" UINT8 NUMBER_OF_MERCS = 0; @@ -102,7 +113,11 @@ UINT8 NUMBER_OF_BAD_MERCS = -1; #define SPECK_IDLE_CHAT_DELAY 10000 +#ifdef JA2UB +#define MERC_NUMBER_OF_RANDOM_QUOTES 20//19//14 +#else #define MERC_NUMBER_OF_RANDOM_QUOTES 19//14 +#endif #define MERC_FIRST_MERC BIFF @@ -212,10 +227,16 @@ typedef struct } NUMBER_TIMES_QUOTE_SAID; NUMBER_TIMES_QUOTE_SAID gNumberOfTimesQuoteSaid[ MERC_NUMBER_OF_RANDOM_QUOTES ] = { - +#ifdef JA2UB + { SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING, 0 }, +#endif { SPECK_QUOTE_RANDOM_CHIT_CHAT_1, 0 }, { SPECK_QUOTE_RANDOM_CHIT_CHAT_2, 0 }, +#ifdef JA2UB + { SPECK_QUOTE_RANDOM_CHIT_CHAT_3, 0 }, +#endif + { SPECK_QUOTE_ADVERTISE_GASTON, 0 }, { SPECK_QUOTE_ADVERTISE_STOGIE, 0 }, @@ -304,6 +325,11 @@ BOOLEAN AreAnyOfTheNewMercsAvailable(); void ShouldAnyNewMercMercBecomeAvailable(); BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck ); UINT32 CalcMercDaysServed(); +#ifdef JA2UB +void MarkSpeckImportantQuoteUsed( UINT32 uiQuoteNum ); +BOOLEAN HasImportantSpeckQuoteBeingSaid( UINT32 uiQuoteNum ); +INT8 IsSpeckQuoteImportantQuote( UINT32 uiQuoteNum ); +#endif //ppp BOOLEAN SaveNewMercsToSaveGameFile( HWFILE hFile ) @@ -368,6 +394,17 @@ void GameInitMercs() { LaptopSaveInfo.gubLastMercIndex = LAST_MERC_ID; //NUMBER_OF_BAD_MERCS; } + +#ifdef JA2UB + //Ja25. create an account immediately + { + //open an account + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID; + + //Get an account number + LaptopSaveInfo.guiPlayersMercAccountNumber = Random( 99999 ); + } +#endif gubCurrentMercVideoMode = MERC_VIDEO_NO_VIDEO_MODE; gfMercVideoIsBeingDisplayed = FALSE; @@ -430,13 +467,16 @@ BOOLEAN EnterMercs() // Account Box button guiAccountBoxButtonImage = LoadButtonImage("LAPTOP\\SmallButtons.sti", -1,0,-1,1,-1 ); - +#ifdef JA2UB +// no UB +#else guiAccountBoxButton = QuickCreateButton(guiAccountBoxButtonImage, MERC_ACCOUNT_BUTTON_X, MERC_ACCOUNT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnAccountBoxButtonCallback); SetButtonCursor(guiAccountBoxButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiAccountBoxButton, DISABLED_STYLE_SHADED); +#endif guiFileBoxButton = QuickCreateButton(guiAccountBoxButtonImage, MERC_FILE_BUTTON_X, MERC_FILE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnFileBoxButtonCallback); @@ -524,8 +564,11 @@ void ExitMercs() UnloadButtonImage( guiAccountBoxButtonImage ); RemoveButton( guiFileBoxButton ); +#ifdef JA2UB +//JA25: removed RemoveButton( guiAccountBoxButton ); +#else RemoveButton( guiAccountBoxButton ); - +#endif RemoveMercBackGround(); DeleteVideoSurfaceFromIndex( guiMercVideoFaceBackground ); @@ -634,21 +677,31 @@ void RenderMercs() //Text on the Speck Portrait DisplayWrappedString(MERC_PORTRAIT_TEXT_X, MERC_PORTRAIT_TEXT_Y, MERC_PORTRAIT_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_SPECK_OWNER], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +#ifdef JA2UB + //Display the "ask about or special offer + DisplayWrappedString(MERC_ACCOUNT_BOX_TEXT_X, MERC_ACCOUNT_BOX_TEXT_Y, 230, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, gzNewLaptopMessages[ LPTP_MSG__MERC_SPECIAL_OFFER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +#else +/* ja25:*/ //Text on the Account Box if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_NO_ACCOUNT ) DisplayWrappedString(MERC_ACCOUNT_BOX_TEXT_X, MERC_ACCOUNT_BOX_TEXT_Y, MERC_ACCOUNT_BOX_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_OPEN_ACCOUNT], FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); else DisplayWrappedString(MERC_ACCOUNT_BOX_TEXT_X, MERC_ACCOUNT_BOX_TEXT_Y, MERC_ACCOUNT_BOX_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_VIEW_ACCOUNT], FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); - +#endif //Text on the Files Box DisplayWrappedString(MERC_FILE_BOX_TEXT_X, MERC_FILE_BOX_TEXT_Y, MERC_FILE_BOX_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_VIEW_FILES], FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); //If the Specks popup dioalogue box is active, display it. if( iMercPopUpBox != -1 ) { + +#ifdef JA2UB +//JA25: removed DrawButton( guiAccountBoxButton ); +// ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; +#else DrawButton( guiAccountBoxButton ); ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; - +#endif RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); } @@ -657,9 +710,11 @@ void RenderMercs() //if the page is redrawn, and we are in video conferencing, redraw the VC backgrund graphic gfMercSiteScreenIsReDrawn = TRUE; - +#ifdef JA2UB +//JA25: removed ButtonList[ guiAccountBoxButton ]->uiFlags &= ~BUTTON_FORCE_UNDIRTY; +#else ButtonList[ guiAccountBoxButton ]->uiFlags &= ~BUTTON_FORCE_UNDIRTY; - +#endif InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -692,8 +747,9 @@ BOOLEAN RemoveMercBackGround() } - - +#ifdef JA2UB +//no UB +#else void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -728,6 +784,7 @@ void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } +#endif void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -793,12 +850,20 @@ void DailyUpdateOfMercSite( UINT16 usDate) // pSoldier->iTotalContractLength++; } +#ifdef JA2UB +//JA25: MERC does a 1 time fee, no longer pay as you go +#else + //Get the longest time if( gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength > iNumDays ) iNumDays = gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength; +#endif } } +#ifdef JA2UB +//JA25: No longer pay as you go, now pay up front +#else //if the players hasnt paid for a while, get email him to tell him to pay //iTotalContractLength if( iNumDays > MERC_NUM_DAYS_TILL_ACCOUNT_INVALID ) @@ -806,7 +871,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_INVALID ) { LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_INVALID; - AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); + AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); } } else if( iNumDays > MERC_NUM_DAYS_TILL_ACCOUNT_SUSPENDED ) @@ -814,7 +879,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_SUSPENDED ) { LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_SUSPENDED; - AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); + AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); // Have speck complain next time player come to site LaptopSaveInfo.uiSpeckQuoteFlags |= SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; @@ -825,13 +890,13 @@ void DailyUpdateOfMercSite( UINT16 usDate) if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_VALID_FIRST_WARNING ) { LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID_FIRST_WARNING; - AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); + AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); // Have speck complain next time player come to site LaptopSaveInfo.uiSpeckQuoteFlags |= SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; } } - +#endif //Check and act if any new Merc Mercs should become available ShouldAnyNewMercMercBecomeAvailable(); @@ -868,7 +933,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) //if we havent already sent an email this turn if( !fAlreadySentEmailToPlayerThisTurn ) { - AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), TYPE_EMAIL_EMAIL_EDT); fAlreadySentEmailToPlayerThisTurn = TRUE; } LaptopSaveInfo.gbNumDaysTillFirstMercArrives = -1; @@ -961,6 +1026,9 @@ void DailyUpdateOfMercSite( UINT16 usDate) // If the merc site has never gone down, the number of MERC payment days is above 'X', // and the players account status is ok ( cant have the merc site going down when the player owes him money, player may lose account that way ) +#ifdef JA2UB +// no UB +#else if( ShouldTheMercSiteServerGoDown() ) { UINT32 uiTimeInMinutes=0; @@ -979,6 +1047,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) //Add an event that will get the site back up and running AddStrategicEvent( EVENT_MERC_SITE_BACK_ONLINE, uiTimeInMinutes, 0 ); } +#endif } @@ -1523,8 +1592,13 @@ void HandleTalkingSpeck() if( iMercPopUpBox != -1 ) { +#ifdef JA2UB +//JA25: removed DrawButton( guiAccountBoxButton ); +//JA25: removed ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; +#else DrawButton( guiAccountBoxButton ); ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; +#endif RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); } @@ -1643,7 +1717,11 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) if( fJustEnteredScreen ) { gfDoneIntroSpeech = FALSE; +#ifdef JA2UB + usQuoteToSay = SPECK_QUOTE_NEW_INTRO_1; +#else usQuoteToSay = 0; +#endif return( FALSE ); } @@ -1656,31 +1734,65 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) gfDoneIntroSpeech = TRUE; //set the opening quote based on if the player has been here before + +#ifdef JA2UB + if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_FIRST_VISIT && usQuoteToSay <= SPECK_QUOTE_NEW_INTRO_7 ) //!= 0 ) +#else if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_FIRST_VISIT && usQuoteToSay <= 8 ) //!= 0 ) +#endif { StartSpeckTalking( usQuoteToSay ); usQuoteToSay++; +#ifdef JA2UB + if( usQuoteToSay <= SPECK_QUOTE_NEW_INTRO_7 ) +#else if( usQuoteToSay <= 8 ) +#endif gfDoneIntroSpeech = FALSE; } - +#ifdef JA2UB + //else if its the first time back since the laptop went down + else if( gJa25SaveStruct.fHaveAimandMercOffferItems && !HasImportantSpeckQuoteBeingSaid( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_1 ) ) + { + StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_1 ); + StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_2 ); + StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_3 ); + StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_4 ); + StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_5 ); + StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_6 ); + } +#else //if its the players second visit else if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_SECOND_VISIT ) { StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_1_TOUGH_START ); fCanUseIdleTag = TRUE; } - +#endif // We have been here at least 2 times before, Check which quote we should use else { //if the player has not hired any MERC mercs before // CJC Dec 1 2002: fixing this, so near-bankrupt msg will play +#ifdef JA2UB + if( !IsAnyMercMercsHired( ) && CalcMercDaysServed() == 0) + StartSpeckTalking( SPECK_QUOTE_DEFAULT_INTRO_HAVENT_HIRED_MERCS ); + else + StartSpeckTalking( SPECK_QUOTE_DEFAULT_INTRO_HAVE_HIRED_MERCS ); +#endif + +#ifdef JA2UB +//JA25: not using quote quote +#else + //if the player has not hired any MERC mercs before if( !IsAnyMercMercsHired( ) && CalcMercDaysServed() == 0) { StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_2_BUSINESS_BAD ); } - +#endif +#ifdef JA2UB +//JA25: not using quote quote +#else //else if it is the first visit since the server went down else if( LaptopSaveInfo.fFirstVisitSinceServerWentDown == TRUE ) { @@ -1688,6 +1800,7 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_9_FIRST_VISIT_SINCE_SERVER_WENT_DOWN ); fCanUseIdleTag = TRUE; } +#endif /* //else if new mercs are available else if( LaptopSaveInfo.fNewMercsAvailableAtMercSite ) @@ -1698,14 +1811,20 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) } */ //else if lots of MERC mercs are DEAD, and speck can say the quote ( dont want him to continously say it ) +#ifdef JA2UB + if( CountNumberOfMercMercsWhoAreDead() >= 2 && LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote ) +#else else if( CountNumberOfMercMercsWhoAreDead() >= 2 && LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote ) +#endif { StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_12_PLAYERS_LOST_MERCS ); //Set it so speck Wont say the quote again till someone else dies LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote = 0; } - +#ifdef JA2UB +//JA25: not using quote quote +#else //else if player owes lots of money else if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_SUSPENDED ) { @@ -1713,8 +1832,11 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) fCanSayLackOfPaymentQuote = FALSE; } - +#endif //else if the player owes speck a large sum of money, have speck say so +#ifdef JA2UB +//JA25: not using quote quote +#else else if( CalculateHowMuchPlayerOwesSpeck() > 5000 ) { StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_1 ); @@ -1722,11 +1844,17 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) fCanSayLackOfPaymentQuote = FALSE; } - +#endif else { +#ifdef JA2UB + UINT8 ubNumMercsDead = NumberOfMercMercsDead(); + BOOLEAN fCanUseIdleTag = FALSE; +#endif UINT8 ubRandom = ( UINT8 ) Random( 100 ); - +#ifdef JA2UB +//JA25: not using quote quote +#else //if business is good // if( ubRandom < 40 && ubNumMercsDead < 2 && CountNumberOfMercMercsHired() > 1 ) if( ubRandom < 40 && AreAnyOfTheNewMercsAvailable() && CountNumberOfMercMercsHired() > 1 ) @@ -1734,9 +1862,12 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_3_BUSINESS_GOOD ); fCanUseIdleTag = TRUE; } - +#endif //or if still trying to recruit ( the last recruit hasnt arrived and the player has paid for some of his mercs ) // else if( ubRandom < 80 && LaptopSaveInfo.gbNumDaysTillFourthMercArrives != -1 && LaptopSaveInfo.gbNumDaysTillFirstMercArrives < MERC_NUM_DAYS_TILL_FIRST_MERC_AVAILABLE ) +#ifdef JA2UB +//JA25: not using quote quote +#else else if( ubRandom < 80 && gConditionsForMercAvailability[ LaptopSaveInfo.ubLastMercAvailableId ].usMoneyPaid <= LaptopSaveInfo.uiTotalMoneyPaidToSpeck && CanMercBeAvailableYet( LaptopSaveInfo.ubLastMercAvailableId ) ) { StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_4_TRYING_TO_RECRUIT ); @@ -1745,10 +1876,16 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) //else use the generic opening else +#endif { +#ifdef JA2UB +//JA25: not using quote quote +#else StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_GENERIC_OPENING ); + fCanUseIdleTag = TRUE; +//JA25: not using quote quote //if the merc hasnt said the line before if( !LaptopSaveInfo.fSaidGenericOpeningInMercSite ) { @@ -1756,8 +1893,11 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_TAG_FOR_20 ); } } +#endif } - +#ifdef JA2UB +//no UB +#else if( fCanUseIdleTag ) { UINT8 ubRandom = Random( 100 ); @@ -1784,10 +1924,13 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) Assert( 0 ); } } +#endif } } - +#ifdef JA2UB +//JA25: not using quote quote +#else //If Speck has sent an email to the player, and the player still hasnt paid, has speck complain about it. // CJC Dec 1 2002 ACTUALLY HOOKED IN THAT CHECK if (fCanSayLackOfPaymentQuote) @@ -1807,18 +1950,22 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_11_NEW_MERCS_AVAILABLE ); } +#endif //if any mercs are dead if( IsAnyMercMercsDead() ) { UINT8 ubMercID; //if no merc has died before +#ifdef JA2UB +//JA25: not using quote quote +#else if( !LaptopSaveInfo.fHasAMercDiedAtMercSite ) { LaptopSaveInfo.fHasAMercDiedAtMercSite = TRUE; StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_FIRST_MERC_DIES ); } - +#endif //loop through all the mercs and see if any are dead and the quote is not said for( ubCnt=0; ubCnt 50 ) StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_1 ); else StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_2 ); - +#ifdef JA2UB + //if it hasnt been said, say the encouraged to shop quote + if( !HasImportantSpeckQuoteBeingSaid( SPECK_QUOTE_ENCOURAGE_SHOP_TAG_ON ) ) + { + StartSpeckTalking( SPECK_QUOTE_ENCOURAGE_SHOP_TAG_ON ); + } +#endif gfJustHiredAMercMerc = FALSE; // gfDoneIntroSpeech = TRUE; @@ -2246,6 +2431,11 @@ void HandleSpeckIdleConversation( BOOLEAN fReset ) { IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 1 ); } +#ifdef JA2UB + //if its the biff is dead quote, only say the quote once + else if( sLeastSaidQuote == SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING ) + IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 255 ); +#endif else if( sLeastSaidQuote != -1 ) IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 3 ); } @@ -2348,15 +2538,18 @@ BOOLEAN ShouldTheMercSiteServerGoDown() return( FALSE ); } - +#ifdef JA2UB +//no UB +#else void GetMercSiteBackOnline() { //Add an email telling the user the site is back up - AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1 ); + AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1 , TYPE_EMAIL_EMAIL_EDT); //Set a flag indicating that the server just went up ( so speck can make a comment when the player next visits the site ) LaptopSaveInfo.fFirstVisitSinceServerWentDown = TRUE; } +#endif void DrawMercVideoBackGround() { @@ -2374,7 +2567,11 @@ void DisableMercSiteButton() { if( iMercPopUpBox != -1 ) { +#ifdef JA2UB +//JA25: removed ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; +#else ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; +#endif } } @@ -2434,6 +2631,22 @@ BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID ) if( !IsMercMercAvailable( BUBBA ) ) fRetVal = FALSE; break; +#ifdef JA2UB + case SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING: + if( !gJa25SaveStruct.fBiffWasKilledWhenImportingSave ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_ADVERTISE_GASTON: + if( !IsMercMercAvailable( 58 ) )//GASTON + fRetVal = FALSE; + break; + + case SPECK_QUOTE_ADVERTISE_STOGIE: + if( !IsMercMercAvailable( 59 ) )//STOGIE + fRetVal = FALSE; + break; +#else case SPECK_QUOTE_ADVERTISE_GASTON: if( !IsMercMercAvailable( GASTON ) ) fRetVal = FALSE; @@ -2443,6 +2656,7 @@ BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID ) if( !IsMercMercAvailable( STOGIE ) ) fRetVal = FALSE; break; +#endif } @@ -2536,7 +2750,7 @@ void NewMercsAvailableAtMercSiteCallBack( ) for(UINT8 i=0; i #include +#ifdef JA2UB +#include "ub_config.h" +#endif + #define MAINMENU_TEXT_FILE "LoadScreens\\MainMenu.edt" #define MAINMENU_RECORD_SIZE 80 * 2 -//#define TESTFOREIGNFONTS - // MENU ITEMS enum { -// TITLE, NEW_GAME, NEW_MP_GAME, LOAD_GAME, - //LOAD_MP_GAME, PREFERENCES, CREDITS, QUIT, NUM_MENU_ITEMS }; -//#define MAINMENU_Y iScreenHeightOffset + 277 -#define MAINMENU_Y iScreenHeightOffset + 210 -#define MAINMENU_Y_SPACE 37 +UINT32 MAINMENU_Y; +UINT32 MAINMENU_X; +UINT32 MAINMENU_Y_SPACE; - -INT32 iMenuImages[ NUM_MENU_ITEMS ]; -INT32 iMenuButtons[ NUM_MENU_ITEMS ]; +INT32 iMenuImages[ NUM_MENU_ITEMS ]; +INT32 iMenuButtons[ NUM_MENU_ITEMS ]; UINT16 gusMainMenuButtonWidths[ NUM_MENU_ITEMS ]; -UINT32 guiMainMenuBackGroundImage; -UINT32 guiJa2LogoImage; - -MOUSE_REGION gBackRegion; -INT8 gbHandledMainMenu = 0; +MOUSE_REGION gBackRegion; +INT8 gbHandledMainMenu = 0; BOOLEAN fInitialRender = FALSE; -//BOOLEAN gfDoHelpScreen = 0; BOOLEAN gfMainMenuScreenEntry = FALSE; BOOLEAN gfMainMenuScreenExit = FALSE; UINT32 guiMainMenuExitScreen = MAINMENU_SCREEN; - extern BOOLEAN gfLoadGameUponEntry; - void ExitMainMenu( ); void MenuButtonCallback(GUI_BUTTON *btn, INT32 reason); void HandleMainMenuInput(); @@ -106,11 +99,12 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ); void RenderMainMenu(); void RestoreButtonBackGrounds(); +//Main Menu layout by Jazz +MAIN_MENU_VALUES gMainMenulayout[MAX_MAIN_MENU_IMAGE]; +VSURFACE_DESC vs_desc; + extern void InitSightRange(); //lal - - - UINT32 MainMenuScreenInit( ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version Label: %S", zVersionLabel )); @@ -120,8 +114,6 @@ UINT32 MainMenuScreenInit( ) return( TRUE ); } - - UINT32 MainMenuScreenHandle( ) { UINT32 cnt; @@ -134,7 +126,7 @@ UINT32 MainMenuScreenHandle( ) return MAINMENU_SCREEN; //The splash screen hasn't been up long enough yet. } if( guiSplashFrameFade ) - { //Fade the splash screen. + { uiTime = GetJA2Clock(); if( guiSplashFrameFade > 2 ) ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); @@ -143,12 +135,9 @@ UINT32 MainMenuScreenHandle( ) else { uiTime = GetJA2Clock(); - //while( GetJA2Clock() < uiTime + 375 ); SetMusicMode( MUSIC_MAIN_MENU ); } - //while( uiTime + 100 > GetJA2Clock() ); - guiSplashFrameFade--; InvalidateScreen(); @@ -170,7 +159,6 @@ UINT32 MainMenuScreenHandle( ) SetMusicMode( MUSIC_MAIN_MENU ); } - if ( fInitialRender ) { ClearMainMenu(); @@ -191,12 +179,7 @@ UINT32 MainMenuScreenHandle( ) EndFrameBufferRender( ); - -// if ( gfDoHelpScreen ) -// HandleHelpScreenInput(); -// else - HandleMainMenuInput(); - + HandleMainMenuInput(); HandleMainMenuScreen(); if( gfMainMenuScreenExit ) @@ -212,15 +195,11 @@ UINT32 MainMenuScreenHandle( ) return( guiMainMenuExitScreen ); } - UINT32 MainMenuScreenShutdown( ) { return( FALSE ); } - - - void HandleMainMenuScreen() { if ( gbHandledMainMenu != 0 ) @@ -234,14 +213,8 @@ void HandleMainMenuScreen() break; case NEW_GAME: - -// gfDoHelpScreen = 1; -// gfMainMenuScreenExit = TRUE; -// if( !gfDoHelpScreen ) -// SetMainMenuExitScreen( INIT_SCREEN ); break; - // ROMAN: TODO?? case NEW_MP_GAME: break; @@ -252,20 +225,8 @@ void HandleMainMenuScreen() gbHandledMainMenu = 0; gfSaveGame = FALSE; gfMainMenuScreenExit = TRUE; - break; - // ROMAN: TODO -// case LOAD_MP_GAME: - //// Select the game which is to be restored - //guiPreviousOptionScreen = guiCurrentScreen; - //guiMainMenuExitScreen = SAVE_LOAD_SCREEN; - //gbHandledMainMenu = 0; - //gfSaveGame = FALSE; - //gfMainMenuScreenExit = TRUE; - - //break; - case PREFERENCES: guiPreviousOptionScreen = guiCurrentScreen; guiMainMenuExitScreen = OPTIONS_SCREEN; @@ -282,17 +243,17 @@ void HandleMainMenuScreen() } } - - BOOLEAN InitMainMenu( ) { VOBJECT_DESC VObjectDesc; -// gfDoHelpScreen = 0; + //main Menu by JAzz + UINT16 iCounter2; if(is_networked) { is_networked = FALSE; + #ifdef USE_VFS // remove Multiplayer profile if it exists vfs::CProfileStack *PS = getVFS()->getProfileStack(); @@ -317,59 +278,49 @@ BOOLEAN InitMainMenu( ) CreateDestroyBackGroundMouseMask( TRUE ); CreateDestroyMainMenuButtons( TRUE ); - - // load background graphic and add it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - - if (iResolution == 0) + + // load background graphic and add it + //Main Menu by Jazz + for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ ) { - FilenameForBPP("LOADSCREENS\\MainMenuBackGround.sti", VObjectDesc.ImageFile); - } - else if (iResolution == 1) - { - FilenameForBPP("LOADSCREENS\\MainMenuBackGround_800x600.sti", VObjectDesc.ImageFile); - } - else if (iResolution == 2) - { - FilenameForBPP("LOADSCREENS\\MainMenuBackGround_1024x768.sti", VObjectDesc.ImageFile); - } + VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE; - CHECKF(AddVideoObject(&VObjectDesc, &guiMainMenuBackGroundImage )); + if (gMainMenulayout[iCounter2].Visible == 1) + { + if (iResolution == 0) + { + strcpy(VObjectDesc.ImageFile, gMainMenulayout[iCounter2].FileName); - // load ja2 logo graphic and add it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; -// FilenameForBPP("INTERFACE\\Ja2_2.sti", VObjectDesc.ImageFile); - FilenameForBPP("LOADSCREENS\\Ja2Logo.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiJa2LogoImage )); + if( !AddVideoObject( &VObjectDesc, &gMainMenulayout[iCounter2].uiIndex ) ) + AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName ) ); + } + else if (iResolution == 1) + { + strcpy(VObjectDesc.ImageFile, gMainMenulayout[iCounter2].FileName800x600); -/* - // Gray out some buttons based on status of game! - if( gGameSettings.bLastSavedGameSlot < 0 || gGameSettings.bLastSavedGameSlot >= NUM_SLOT ) - { - DisableButton( iMenuButtons[ LOAD_GAME ] ); + if( !AddVideoObject( &VObjectDesc, &gMainMenulayout[iCounter2].uiIndex ) ) + AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName800x600 ) ); + } + else if (iResolution == 2) + { + strcpy(VObjectDesc.ImageFile, gMainMenulayout[iCounter2].FileName1024x768); + + if( !AddVideoObject( &VObjectDesc, &gMainMenulayout[iCounter2].uiIndex ) ) + AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName1024x768 ) ); + } + } } - //The ini file said we have a saved game, but there is no saved game - else if( gbSaveGameArray[ gGameSettings.bLastSavedGameSlot ] == FALSE ) - DisableButton( iMenuButtons[ LOAD_GAME ] ); -*/ - + //if there are no saved games, disable the button if( !IsThereAnySavedGameFiles() ) DisableButton( iMenuButtons[ LOAD_GAME ] ); - -// DisableButton( iMenuButtons[ CREDITS ] ); -// DisableButton( iMenuButtons[ TITLE ] ); - gbHandledMainMenu = 0; fInitialRender = TRUE; SetPendingNewScreen( MAINMENU_SCREEN); guiMainMenuExitScreen = MAINMENU_SCREEN; - // WANNE: I don't think that is needed! - //InitGameOptions(); - DequeueAllKeyBoardEvents(); return( TRUE ); @@ -378,28 +329,20 @@ BOOLEAN InitMainMenu( ) void ExitMainMenu( ) { -// UINT32 uiDestPitchBYTES; -// UINT8 *pDestBuf; - -// if( !gfDoHelpScreen ) - { - CreateDestroyBackGroundMouseMask( FALSE ); - } - + UINT32 iCounter2 ; + CreateDestroyBackGroundMouseMask( FALSE ); CreateDestroyMainMenuButtons( FALSE ); - DeleteVideoObjectFromIndex( guiMainMenuBackGroundImage ); - DeleteVideoObjectFromIndex( guiJa2LogoImage ); - + for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ ) + { + if (gMainMenulayout[iCounter2].Visible == 1) + { + DeleteVideoObjectFromIndex( gMainMenulayout[iCounter2].uiIndex ); + } + } + gMsgBox.uiExitScreen = MAINMENU_SCREEN; -/* - // CLEAR THE FRAME BUFFER - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); - UnLockVideoSurface( FRAME_BUFFER ); - InvalidateScreen( ); -*/ } // WANNE - MP: This method initializes variables that should be initialized @@ -425,6 +368,10 @@ void InitDependingGameStyleOptions() // HEADROCK HAM 4: CTH constants LoadCTHConstants(); +#ifdef JA2UB + LoadGameUBOptions(); // JA25 UB +#endif + InitSightRange(); //lal ReStartingGame(); @@ -456,7 +403,6 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason) // Snap: UN-Init MP save game directory if ( !InitSaveDir() ) { - //if something didnt work, dont even know how to make error code...//hayden } }; @@ -518,20 +464,16 @@ void MenuButtonMoveCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) { -// btn->uiFlags &= (~BUTTON_CLICKED_ON ); RenderMainMenu(); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_GAIN_MOUSE) { -// btn->uiFlags &= (~BUTTON_CLICKED_ON ); RenderMainMenu(); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } - - void HandleMainMenuInput() { InputAtom InputEvent; @@ -543,19 +485,12 @@ void HandleMainMenuInput() { switch( InputEvent.usParam ) { -/* - case ESC: - gbHandledMainMenu = QUIT; - break; -*/ #ifdef JA2TESTVERSION case 'q': gbHandledMainMenu = NEW_GAME; gfMainMenuScreenExit = TRUE; SetMainMenuExitScreen( INIT_SCREEN ); - -// gfDoHelpScreen = 1; break; case 'i': @@ -563,7 +498,6 @@ void HandleMainMenuInput() gfMainMenuScreenExit = TRUE; break; #endif - case 'c': gbHandledMainMenu = LOAD_GAME; @@ -626,21 +560,9 @@ void SelectMainMenuBackGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReaso } else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { -// if( gfDoHelpScreen ) -// { -// SetMainMenuExitScreen( INIT_SCREEN ); -// gfDoHelpScreen = FALSE; -// } } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { -/* - if( gfDoHelpScreen ) - { - SetMainMenuExitScreen( INIT_SCREEN ); - gfDoHelpScreen = FALSE; - } -*/ } } @@ -690,6 +612,27 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) SGPFILENAME filename; SGPFILENAME filenameMP; INT16 sSlot; + + if (iResolution == 0) + { + MAINMENU_Y = gMainMenulayout[0].MAINMENU_Y; + MAINMENU_X = gMainMenulayout[0].MAINMENU_X; + MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE; + } + + if (iResolution == 1) + { + MAINMENU_Y = gMainMenulayout[0].MAINMENU_800x600Y; + MAINMENU_X = gMainMenulayout[0].MAINMENU_800x600X; + MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE; + } + + if (iResolution == 2) + { + MAINMENU_Y = gMainMenulayout[0].MAINMENU_1024x768Y; + MAINMENU_X = gMainMenulayout[0].MAINMENU_1024x768X; + MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE; + } if( fCreate ) { @@ -710,8 +653,6 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) sSlot = 0; iMenuImages[ LOAD_GAME ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,6,3,4,5,-1 ); - //iMenuImages[ LOAD_MP_GAME ] = UseLoadedButtonImage( iMenuImages[ NEW_MP_GAME ], 3, 3, 4, 5, -1 ); - iMenuImages[ PREFERENCES ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,7,7,8,9,-1 ); iMenuImages[ CREDITS ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,13,10,11,12,-1 ); iMenuImages[ QUIT ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,14,14,15,16,-1 ); @@ -723,21 +664,17 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) case NEW_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], sSlot ); break; case NEW_MP_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 0); break; case LOAD_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 3 ); break; -// case LOAD_MP_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 3); break; case PREFERENCES: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 7 ); break; case CREDITS: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 10 ); break; case QUIT: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 15 ); break; } #ifdef TESTFOREIGNFONTS - iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( 0 + ( cnt * 18 ) ), +// iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( 0 + ( cnt * 18 ) ), + iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)(MAINMENU_X - gusMainMenuButtonWidths[cnt]/2), (INT16)( 0 + ( cnt * 18 ) ), //(INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2) BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, MenuButtonCallback ); -#else - /*iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)(420 - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE ) ), - BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, MenuButtonCallback );*/ - - iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE ) ), +#else + iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)(MAINMENU_X - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE ) ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, MenuButtonCallback ); #endif @@ -745,30 +682,10 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) { return( FALSE ); } - ButtonList[ iMenuButtons[ cnt ] ]->UserData[0] = cnt; - // WANNE: Removed this, because in Release version it always crashes! - /* - #ifndef _DEBUG - //load up some info from the 'mainmenu.edt' file. This makes sure the file is present. The file is - // 'marked' with a code that identifies the testers - INT32 iStartLoc = MAINMENU_RECORD_SIZE * cnt; - if( !LoadEncryptedDataFromFile(MAINMENU_TEXT_FILE, zText, iStartLoc, MAINMENU_RECORD_SIZE ) ) - { - //the file was not able to be loaded properly - SOLDIERTYPE *pSoldier = NULL; - - if( pSoldier->bActive != TRUE ) - { - //something is very wrong - pSoldier->bActive = pSoldier->stats.bLife; - } - } - #endif - */ + ButtonList[ iMenuButtons[ cnt ] ]->UserData[0] = cnt; } - fButtonsCreated = TRUE; } else @@ -792,16 +709,35 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) void RenderMainMenu() { HVOBJECT hPixHandle; - + UINT32 iCounter2; + //Get and display the background image - GetVideoObject(&hPixHandle, guiMainMenuBackGroundImage ); - BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); - - GetVideoObject(&hPixHandle, guiJa2LogoImage ); - BltVideoObject( FRAME_BUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); - + for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ ) + { + if (gMainMenulayout[iCounter2].Visible == 1) + { + if (iResolution == 0) + { + GetVideoObject(&hPixHandle, gMainMenulayout[iCounter2].uiIndex); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePositionX, gMainMenulayout[iCounter2].ImagePositionY, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePositionX, gMainMenulayout[iCounter2].ImagePositionY, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if (iResolution == 1) + { + GetVideoObject(&hPixHandle, gMainMenulayout[iCounter2].uiIndex); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition800x600X, gMainMenulayout[iCounter2].ImagePosition800x600Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition800x600X, gMainMenulayout[iCounter2].ImagePosition800x600Y, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if (iResolution == 2) + { + GetVideoObject(&hPixHandle, gMainMenulayout[iCounter2].uiIndex); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition1024x768X, gMainMenulayout[iCounter2].ImagePosition1024x768Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition1024x768X, gMainMenulayout[iCounter2].ImagePosition1024x768Y, VO_BLT_SRCTRANSPARENCY,NULL); + } + } + } #ifdef TESTFOREIGNFONTS DrawTextToScreen( L"LARGEFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 105, 640, LARGEFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); @@ -836,15 +772,33 @@ void RestoreButtonBackGrounds() { UINT8 cnt; -// RestoreExternBackgroundRect( (UINT16)(320 - gusMainMenuButtonWidths[TITLE]/2), MAINMENU_TITLE_Y, gusMainMenuButtonWidths[TITLE], 23 ); - #ifndef TESTFOREIGNFONTS - for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ ) + + if (iResolution == 0) { - RestoreExternBackgroundRect( (UINT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE )-1), (UINT16)(gusMainMenuButtonWidths[cnt]+1), 23 ); + MAINMENU_Y = gMainMenulayout[0].MAINMENU_Y; + MAINMENU_X = gMainMenulayout[0].MAINMENU_X; + MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE; } + + if (iResolution == 1) + { + MAINMENU_Y = gMainMenulayout[0].MAINMENU_800x600Y; + MAINMENU_X = gMainMenulayout[0].MAINMENU_800x600X; + MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE; + } + + if (iResolution == 2) + { + MAINMENU_Y = gMainMenulayout[0].MAINMENU_1024x768Y; + MAINMENU_X = gMainMenulayout[0].MAINMENU_1024x768X; + MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE; + } + + for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ ) + { + RestoreExternBackgroundRect( (UINT16)(MAINMENU_X - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE )-1), (UINT16)(gusMainMenuButtonWidths[cnt]+1), 23 ); + } + #endif -} - - - +} \ No newline at end of file diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index e807f4f3..e0a9260f 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -2413,7 +2413,10 @@ void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from serve // Disable Reinforcements gGameExternalOptions.gfAllowReinforcements = false; gGameExternalOptions.gfAllowReinforcementsOnlyInCity = false; - + + // WANNE: The new improved interrupt system (IIS) does not work with multiplayer, so disable it + gGameExternalOptions.fImprovedInterruptSystem = false; + // Disable Real-Time Mode // SANDRO - huh? real-time sneak is in preferences //gGameExternalOptions.fAllowRealTimeSneak = false; @@ -2466,6 +2469,8 @@ void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from serve break; } + gGameOptions.ubSquadSize = 6; + // Server forces us to play with new Inventory, but NIV is not allowed on the client, // because of wrong resolution or other stuff if ( UsingNewInventorySystem() == true && !IsNIVModeValid(true) ) @@ -2504,7 +2509,7 @@ void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from serve // OJW - 20091024 - extract random table if (!is_server) - memcpy(guiPreRandomNums,cl_lan->random_table,sizeof(UINT32)*MAX_PREGENERATED_NUMS); + memcpy(guiPreRandomNums,cl_lan->random_table,sizeof(UINT32)*MAX_PREGENERATED_NUMS); // WANNE: Turn on airspace mode (to switch maps) for the server! if (is_server) @@ -2622,6 +2627,9 @@ void reapplySETTINGS() gGameExternalOptions.gfAllowReinforcements = false; gGameExternalOptions.gfAllowReinforcementsOnlyInCity = false; + // WANNE: The new improved interrupt system (IIS) does not work with multiplayer, so disable it + gGameExternalOptions.fImprovedInterruptSystem = false; + // Disable Real-Time Mode // SANDRO - real-time sneak is in preferences //gGameExternalOptions.fAllowRealTimeSneak = false; @@ -2673,6 +2681,8 @@ void reapplySETTINGS() break; } + gGameOptions.ubSquadSize = 6; + // WANNE - MP: We have to re-initialize the correct interface if((UsingNewInventorySystem() == true) && IsNIVModeValid(true)) { diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 360a8a4d..26cf4d3c 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -5,6 +5,7 @@ #include "Merc Hiring.h" #include "event pump.h" #include "Bullets.h" +#include "builddefines.h" extern bool isOwnTeamWipedOut; @@ -185,7 +186,11 @@ extern BOOLEAN fClientReceivedAllFiles; // OJW - 20090507 // Add basic version checking, will only work from now on // note: this cannot be longer than char[30] +#ifdef JA2UB +#define MPVERSION "MP v2.0(UB)" +#else #define MPVERSION "MP v2.0" +#endif // OJW - 2009128 - inline funcs for working with soldiers and teams // sick of confusing myself :) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index d45514a3..f91cbaf6 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -127,7 +127,14 @@ #include "INIReader.h" #include "mercs.h" #include "soldier Profile.h" +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#endif + #include "LuaInitNPCs.h" +#include "Vehicles.h" +#include "Encyclopedia_Data.h" #include //rain @@ -143,7 +150,20 @@ // ///////////////////////////////////////////////////// +#ifdef JA2UB +#include "Strategic Movement.h" #include "LuaInitNPCs.h" +#include "ub_config.h" +#include "Ja25Update.h" +#endif + +#include "LuaInitNPCs.h" + + +#ifdef JA2UB +//void ConvertWeapons( SOLDIERTYPE *pSoldier ); +extern void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ); // ja25 UB +#endif void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ); extern void NextLoopCheckForEnoughFreeHardDriveSpace(); @@ -183,13 +203,16 @@ extern BOOLEAN gfCreatureMeanwhileScenePlayed; BOOLEAN gMusicModeToPlay = FALSE; + +//extern BOOLEAN gfFirstTimeInGameHeliCrash; + #ifdef JA2BETAVERSION BOOLEAN gfDisplaySaveGamesNowInvalidatedMsg = FALSE; #endif BOOLEAN gfUseConsecutiveQuickSaveSlots = FALSE; UINT32 guiCurrentQuickSaveNumber = 0; -UINT32 guiLastSaveGameNum; +UINT32 guiLastSaveGameNum = 1; BOOLEAN DoesAutoSaveFileExist( BOOLEAN fLatestAutoSave ); UINT32 guiJA2EncryptionSet = 0; @@ -411,6 +434,48 @@ typedef struct // HEADROCK HAM 3.6: Global variable keeping track of Militia Upkeep Costs at last midnight. UINT32 uiTotalUpkeepForMilitia; + + UINT32 sMercArrivalGridNo; + +//JA25 UB +#ifdef JA2UB + INT8 fMorrisShouldSayHi; + BOOLEAN fFirstTimeInGameHeliCrash; + UINT32 sINITIALHELIGRIDNO[ 7 ]; + UINT32 sLOCATEGRIDNO; + UINT32 sLOCATEGRIDNO2; + UINT32 sJerryGridNo; + + BOOLEAN sJerryQuotes; + BOOLEAN sInJerry; + BOOLEAN sInGameHeliCrash; + BOOLEAN sLaptopQuestEnabled; + BOOLEAN sTEX_AND_JOHN; + BOOLEAN sRandom_Manuel_Text; + + BOOLEAN sEVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE_UB; + BOOLEAN sHandleAddingEnemiesToTunnelMaps_UB; + + BOOLEAN sInGameHeli; + BOOLEAN spJA2UB; + + BOOLEAN sfDeadMerc; + + UINT8 subEndDefaultSectorX; + UINT8 subEndDefaultSectorY; + UINT8 subEndDefaultSectorZ; + + BOOLEAN sTestUB; + + BOOLEAN sLaptopLinkInsurance; + BOOLEAN sLaptopLinkFuneral; + BOOLEAN sLaptopLinkBobby; + + BOOLEAN ubFiller2[255]; + UINT32 ubFiller3[255]; + INT8 ubFiller4[255]; + +#endif // HEADROCK HAM 4: Added manual restrictions UINT8 ubManualRestrictMilitia[256]; @@ -1906,6 +1971,12 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->snowCamo, sizeof(snowCamo), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->wornSnowCamo, sizeof(wornSnowCamo), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sFacilityTypeOperated, sizeof(sFacilityTypeOperated), sizeof(INT16), numBytesRead); +#ifdef JA2UB + numBytesRead = ReadFieldByField(hFile, &this->fIgnoreGetupFromCollapseCheck, sizeof(fIgnoreGetupFromCollapseCheck), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->GetupFromJA25StartCounter, sizeof(GetupFromJA25StartCounter), sizeof(TIMECOUNTER), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->fWaitingToGetupFromJA25Start, sizeof(fWaitingToGetupFromJA25Start), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubPercentDamageInflictedByTeam, sizeof(ubPercentDamageInflictedByTeam), sizeof(UINT8), numBytesRead); +#endif numBytesRead += buffer; if(numBytesRead != SIZEOF_SOLDIERTYPE_POD) return(FALSE); @@ -2014,6 +2085,18 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) else numBytesRead = ReadFieldByField(hFile, &this->aiData.bAimTime, 1, 1, numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bShownAimTime, sizeof(aiData.bShownAimTime), sizeof(INT8), numBytesRead); + if ( guiCurrentSaveGameVersion >= IMPROVED_INTERRUPT_SYSTEM ) + numBytesRead = ReadFieldByField(hFile, &this->aiData.ubInterruptCounter, sizeof(aiData.ubInterruptCounter), sizeof(UINT8), numBytesRead); // SANDRO - interrupt counter + else + { + //CHRISL: We have to make sure we add a buffer to account for the lack of ubInterruptCounter and that buffer needs to be a full DWORD in size + buffer = 0; + for(int i = 0; i < sizeof(aiData.ubInterruptCounter); i++) + buffer++; + while((buffer%4) > 0) + buffer++; + numBytesRead += buffer; + } //CHRISL: We also need to make sure the structure aligns properly and that we don't need to read any extra // padding bytes while((numBytesRead%__alignof(STRUCT_AIData)) > 0) @@ -2411,8 +2494,7 @@ BOOLEAN OBJECTTYPE::Load( HWFILE hFile ) // WANNE.MEMORY: This call takes all the pc memory if we pass an invalid huge size as a parameter. See previous safety check. objectStack.resize(size); - - + int x = 0; for (StackedObjects::iterator iter = objectStack.begin(); iter != objectStack.end(); ++iter, ++x) { if (! iter->Load(hFile)) { @@ -2425,7 +2507,6 @@ BOOLEAN OBJECTTYPE::Load( HWFILE hFile ) } } } - } else { @@ -2684,19 +2765,11 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) INT32 iSaveLoadGameMessageBoxID = -1; UINT16 usPosX, usActualWidth, usActualHeight; BOOLEAN fWePausedIt = FALSE; + + CHAR16 zString[128]; - - //sprintf( saveDir, "%S", pMessageStrings[ MSG_SAVEDIRECTORY ] ); - -#ifdef JA2BETAVERSION -#ifndef CRIPPLED_VERSION - //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); - //AssertMsg( sizeof( LaptopSaveInfoStruct ) == 7440, String( "LaptopSaveStruct is NOT 7440, it is %d. DF 1.", sizeof( LaptopSaveInfoStruct ) ) ); -#endif -#endif - - if( ubSaveGameID > NUM_SLOT && ubSaveGameID < EARLIST_SPECIAL_SAVE ) - return( FALSE ); //ddd + if( ubSaveGameID > NUM_SAVE_GAMES || ubSaveGameID == EARLIST_SPECIAL_SAVE ) + return( FALSE ); alreadySaving = true; //clear out the save game header @@ -2708,14 +2781,24 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) fWePausedIt = TRUE; } - #ifdef JA2BETAVERSION InitShutDownMapTempFileTest( TRUE, "SaveMapTempFile", ubSaveGameID ); #endif - //Place a message on the screen telling the user that we are saving the game - iSaveLoadGameMessageBoxID = PrepareMercPopupBox( iSaveLoadGameMessageBoxID, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, zSaveLoadText[ SLG_SAVING_GAME_MESSAGE ], 300, 0, 0, 0, &usActualWidth, &usActualHeight); + if ( ubSaveGameID >= SAVE__TIMED_AUTOSAVE_SLOT1 && ubSaveGameID < SAVE__TIMED_AUTOSAVE_SLOT5 + 1 ) + { + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_AUTOSAVE_SAVING_TEXT ],ubSaveGameID ); + iSaveLoadGameMessageBoxID = PrepareMercPopupBox( iSaveLoadGameMessageBoxID, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, zString, 300, 0, 0, 0, &usActualWidth, &usActualHeight); + } + else if ( ubSaveGameID == SAVE__END_TURN_NUM ) //SAVE__END_TURN_NUM_1 || ubSaveGameID == SAVE__END_TURN_NUM_2 ) + { + swprintf( zString, L"%s",pMessageStrings[ MSG_SAVE_END_TURN_SAVE_SAVING_TEXT ] ); + iSaveLoadGameMessageBoxID = PrepareMercPopupBox( iSaveLoadGameMessageBoxID, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, zString, 300, 0, 0, 0, &usActualWidth, &usActualHeight); + } + else + iSaveLoadGameMessageBoxID = PrepareMercPopupBox( iSaveLoadGameMessageBoxID, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, zSaveLoadText[ SLG_SAVING_GAME_MESSAGE ], 300, 0, 0, 0, &usActualWidth, &usActualHeight); + usPosX = ( SCREEN_WIDTH - usActualWidth ) / 2 ; RenderMercPopUpBoxFromIndex( iSaveLoadGameMessageBoxID, usPosX, iScreenHeightOffset + 160, FRAME_BUFFER ); @@ -2817,9 +2900,11 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameHeader.uiRandom = Random( RAND_MAX ); // CHRISL: We need to know what inventory system we're using early on - SaveGameHeader.ubInventorySystem = gGameOptions.ubInventorySystem; + SaveGameHeader.sInitialGameOptions.ubInventorySystem = gGameOptions.ubInventorySystem; - SaveGameHeader.ubAttachmentSystem = gGameOptions.ubAttachmentSystem; + SaveGameHeader.sInitialGameOptions.ubAttachmentSystem = gGameOptions.ubAttachmentSystem; + + SaveGameHeader.sInitialGameOptions.ubSquadSize = gGameOptions.ubSquadSize; // // Save the Save Game header file @@ -3541,6 +3626,21 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) goto FAILED_TO_SAVE; } +#ifdef JA2UB + //save Ja25 info + if( !SaveJa25SaveInfoToSaveGame( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"Ja25 Save info Struct"); + goto FAILED_TO_SAVE; + } + + //Save the tactical info + if( !SaveJa25TacticalInfoToSaveGame( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"Ja25 Tactical info"); + goto FAILED_TO_SAVE; + } +#endif //New profiles by Jazz if( !SaveNewMercsToSaveGameFile( hFile ) ) { @@ -3567,19 +3667,89 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing lua global"); goto FAILED_TO_SAVE; } + #ifdef JA2BETAVERSION SaveGameFilePosition( FileGetPos( hFile ), "Lua global" ); #endif + + //New vehicles by Jazz + if( !SaveNewVehiclesToSaveGameFile( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing new vehicles"); + goto FAILED_TO_SAVE; - //Close the saved game file + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "New Vehicles" ); + #endif + + } + + + + + if( !SaveDataSaveToSaveGameFile( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing save data"); + goto FAILED_TO_SAVE; + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Save Data" ); + #endif + + } + +if( !SaveNewEmailDataToSaveGameFile( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing save data"); + goto FAILED_TO_SAVE; + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Save New Email Data" ); + #endif + + } + + if( !SaveHiddenTownToSaveGameFile( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing hidden town"); + goto FAILED_TO_SAVE; + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Hidden Town" ); + #endif + + } + + if( !SaveEncyclopediaToSaveGameFile( hFile ) ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing Briefing Room & Encyclopedia"); + goto FAILED_TO_SAVE; + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Briefing Room & Encyclopedia" ); + #endif + + } +//Close the saved game file FileClose( hFile ); - - //if we succesfully saved the game, mark this entry as the last saved game file - if( ubSaveGameID < EARLIST_SPECIAL_SAVE && ubSaveGameID != SAVE__TIMED_AUTOSAVE ) + // This defines, which savegame is highlighted in the load screen + if (ubSaveGameID == SAVE__END_TURN_NUM) + { + if (guiLastSaveGameNum == 0) + gGameSettings.bLastSavedGameSlot = SAVE__END_TURN_NUM_1; + else + gGameSettings.bLastSavedGameSlot = SAVE__END_TURN_NUM_2; + } + else if ( ubSaveGameID >= 0 && (ubSaveGameID != SAVE__ASSERTION_FAILURE || ubSaveGameID != EARLIST_SPECIAL_SAVE)) { gGameSettings.bLastSavedGameSlot = ubSaveGameID; } + else + { + // No selection + gGameSettings.bLastSavedGameSlot = -1; + } //Save the save game settings SaveGameSettings(); @@ -3594,7 +3764,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_SAVESUCCESS ] ); } //#ifdef JA2BETAVERSION - else if( ubSaveGameID == SAVE__END_TURN_NUM ) + else if( ubSaveGameID == SAVE__END_TURN_NUM ) //SAVE__END_TURN_NUM_1 || ubSaveGameID == SAVE__END_TURN_NUM_2 ) { // ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_END_TURN_AUTO_SAVE ] ); } @@ -3701,6 +3871,12 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) //Empty the dialogue Queue cause someone could still have a quote in waiting EmptyDialogueQueue( ); +#ifdef JA2UB + //Reset Jerry Quotes JA25UB + if ( gGameUBOptions.JerryQuotes == TRUE ) + HandleJerryMiloQuotes( TRUE ); +#endif + //If there is someone talking, stop them StopAnyCurrentlyTalkingSpeech( ); @@ -3717,7 +3893,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif //is it a valid save number - if( ubSavedGameID >= NUM_SLOT ) + if( ubSavedGameID >= SAVE__END_TURN_NUM ) //NUM_SLOT ) { if( ubSavedGameID != SAVE__END_TURN_NUM ) return( FALSE ); @@ -3794,6 +3970,10 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) guiCurrentSaveGameVersion = SaveGameHeader.uiSavedGameVersion; guiBrokenSaveGameVersion = SaveGameHeader.uiSavedGameVersion; + // WANNE: Store the info + lastLoadedSaveGameDay = SaveGameHeader.uiDay; + lastLoadedSaveGameHour = SaveGameHeader.ubHour; + if(guiCurrentSaveGameVersion >= MOVED_GENERAL_INFO) { FileRead(hFile, &gGameOptions, sizeof( GAME_OPTIONS ), &uiNumBytesRead ); @@ -3802,10 +3982,10 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) { // CHRISL: We need to know what inventory system we're using early on if(SaveGameHeader.uiSavedGameVersion < NIV_SAVEGAME_DATATYPE_CHANGE) - SaveGameHeader.ubInventorySystem = 0; + SaveGameHeader.sInitialGameOptions.ubInventorySystem = 0; - gGameOptions.ubInventorySystem = SaveGameHeader.ubInventorySystem; - gGameOptions.ubAttachmentSystem = SaveGameHeader.ubAttachmentSystem; + gGameOptions.ubInventorySystem = SaveGameHeader.sInitialGameOptions.ubInventorySystem; + gGameOptions.ubAttachmentSystem = SaveGameHeader.sInitialGameOptions.ubAttachmentSystem; } if((UsingNewInventorySystem() == true)) @@ -3831,6 +4011,12 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) InitializeInvPanelCoordsOld(); } + if (gGameOptions.ubSquadSize > 6 && iResolution == 0 || gGameOptions.ubSquadSize > 8 && iResolution == 1) + { + FileClose( hFile ); + return(FALSE); + } + //if the player is loading up an older version of the game, and the person DOESNT have the cheats on, if( guiCurrentSaveGameVersion < 65 && !CHEATER_CHEAT_LEVEL( ) ) { @@ -3894,6 +4080,10 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) gfUseAlternateMap = TRUE; } +#ifdef JA2UB + //Re-init the heli gridnos and time.. + InitializeHeliGridnoAndTime( TRUE ); +#endif for (int x = 0; x < 256; ++x) { gEnemyPreservedTempFileVersion[x] = guiCurrentSaveGameVersion; @@ -4131,7 +4321,17 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) LoadGameFilePosition( FileGetPos( hFile ), "Strategic Information" ); #endif +#ifdef JA2UB + //JA25 UB + // ATE: Validate any new maps... + // OK, if we're a camapign, check for new maps + //if ( !InDefaultCampaign( ) ) + //{ + MakeBadSectorListFromMapsOnHardDrive( TRUE ); + LetLuaMakeBadSectorListFromMapsOnHardDrive( 0 ); + //} +#endif uiRelEndPerc += 1; SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"UnderGround Information..." ); @@ -4212,18 +4412,30 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) RenderProgressBar( 0, 100 ); uiRelStartPerc = uiRelEndPerc; - - - if( !LoadQuestInfoFromSavedGameFile( hFile ) ) + if( guiCurrentSaveGameVersion < QUESTS_DATATYPE_CHANGE ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadQuestInfoFromSavedGameFile failed" ) ); - FileClose( hFile ); - return( FALSE ); + if( !LoadQuestInfoFromSavedGameFile( hFile, MAX_OLD_QUESTS ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadQuestInfoFromSavedGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Quest Info" ); + #endif + } + else + { + if( !LoadQuestInfoFromSavedGameFile( hFile, MAX_QUESTS ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadQuestInfoFromSavedGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Quest Info" ); + #endif } - #ifdef JA2BETAVERSION - LoadGameFilePosition( FileGetPos( hFile ), "Quest Info" ); - #endif - uiRelEndPerc += 1; SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"OppList Info..." ); @@ -4915,6 +5127,43 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) } } + + +#ifdef JA2UB + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Ja25 Tactical info" ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + if ( !LoadJa25SaveInfoFromSavedGame( hFile ) ) + { + FileClose( hFile ); + return( FALSE ); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Ja25 Tactical info" ); + #endif + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Ja25 Save info Struct" ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + if ( !LoadJa25TacticalInfoFromSavedGame( hFile ) ) + { + FileClose( hFile ); + return( FALSE ); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Ja25 Save info Struct" ); + #endif + +#endif + uiRelEndPerc += 1; SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Load New Mercs Prfiles..." ); RenderProgressBar( 0, 100 ); @@ -4956,15 +5205,15 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); RenderProgressBar( 0, 100 ); uiRelStartPerc = uiRelEndPerc; - uiRelEndPerc += 1; - SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Lua Global System..." ); - RenderProgressBar( 0, 100 ); - uiRelStartPerc = uiRelEndPerc; - - if( guiCurrentSaveGameVersion >= 114 ) { + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Lua Global System..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + if( !LoadLuaGlobalFromLoadGameFile( hFile ) ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadLuaGlobalFromLoadGameFile failed" ) ); @@ -4972,10 +5221,110 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) return FALSE; } } + #ifdef JA2BETAVERSION LoadGameFilePosition( FileGetPos( hFile ), "Lua Global System" ); #endif + + if( guiCurrentSaveGameVersion >= VEHICLES_DATATYPE_CHANGE) + { + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Load New Vehicles..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + if( !LoadNewVehiclesToSaveGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadNewVehiclesToSaveGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + } + + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "New Vehicles" ); + #endif + + if( guiCurrentSaveGameVersion >= NEW_SAVE_GAME_GENERAL_SAVE_INFO_DATA) + { + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Load Save Data..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + if( !LoadDataSaveFromLoadGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadDataSaveFromLoadGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Load Save Data" ); + #endif + + } + + if( guiCurrentSaveGameVersion >= NEW_EMAIL_SAVE_GAME) + { + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Load New Email Data..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + if( !LoadNewEmailDataFromLoadGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadNewEmailDataFromLoadGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Load New Email Data" ); + #endif + + } + + if( guiCurrentSaveGameVersion >= HIDDENTOWN_DATATYPE_CHANGE) + { + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Load Hidden Towns..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + if( !LoadHiddenTownFromLoadGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadHiddenTownFromLoadGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Load Hidden Towns" ); + #endif + + } + + if( guiCurrentSaveGameVersion > ENCYCLOPEDIA_SAVEGAME_CHANGE) + { + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Load Briefing Room & Encyclopedia..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + if( !LoadEncyclopediaFromLoadGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadEncyclopediaFromLoadGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Briefing Room & Load Encyclopedia" ); + #endif + + } // //Close the saved game file @@ -5006,8 +5355,12 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) pEmail=pEmail->Next; } } +#ifdef JA2UB + +#else if(!fBookMark && !fEmail) - AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, -1 ); + AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, -1 , TYPE_EMAIL_EMAIL_EDT); +#endif } // WANNE: I disabled that for now, because I am not sure if this works like intended @@ -5658,6 +6011,11 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) } } #endif + //#ifdef JA2UB + //if the soldier has the NON weapon version of the merc knofe or merc umbrella + //ConvertWeapons( &Menptr[ cnt ] ); + //#endif + // JA2Gold: fix next-to-previous attacker value if ( guiCurrentSaveGameVersion < 99 ) { @@ -5984,6 +6342,8 @@ BOOLEAN SaveEmailToSavedGame( HWFILE hFile ) //loop through all the email to find out the total number while(pEmail) { + gEmailT[ uiNumOfEmails ].EmailVersion = 0; //reset + gEmailT[ uiNumOfEmails ].EmailVersion = pEmail->EmailVersion; pEmail=pEmail->Next; uiNumOfEmails++; } @@ -6358,12 +6718,15 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) if ( guiCurrentSaveGameVersion >= BUGFIX_NPC_DATA_FOR_BIG_MAPS ) { numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubLastRequesterSurgeryTargetID, sizeof(gTacticalStatus.ubLastRequesterSurgeryTargetID), sizeof(UINT8), numBytesRead); + if ( guiCurrentSaveGameVersion >= IMPROVED_INTERRUPT_SYSTEM ) + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubInterruptPending, sizeof(gTacticalStatus.ubInterruptPending), sizeof(UINT8), numBytesRead); while( (numBytesRead%4) != 0 ) // This is to make sure the total read is of DWORD length numBytesRead = ReadFieldByField(hFile, &filler, sizeof(filler), sizeof(UINT8), numBytesRead); } else { - numBytesRead++; + numBytesRead++; //&gTacticalStatus.ubLastRequesterSurgeryTargetID added with BUGFIX_NPC_DATA_FOR_BIG_MAPS + numBytesRead++; //&gTacticalStatus.ubInterruptPending added with IMPROVED_INTERRUPT_SYSTEM while( (numBytesRead%4) != 0 ) // This is to make sure the total read is of DWORD length numBytesRead++; } @@ -6764,25 +7127,24 @@ void CreateSavedGameFileNameFromNumber( UINT8 ubSaveGameID, STR pzNewFileName ) #endif sprintf( pzNewFileName , "%s\\%S.%S", gSaveDir, pMessageStrings[ MSG_QUICKSAVE_NAME ], pMessageStrings[ MSG_SAVEEXTENSION ] ); } -//#ifdef JA2BETAVERSION - else if( ubSaveGameID == SAVE__END_TURN_NUM ) + else if( ubSaveGameID>= SAVE__TIMED_AUTOSAVE_SLOT1 && ubSaveGameID < SAVE__TIMED_AUTOSAVE_SLOT5 + 1 ) { - //The name of the file - sprintf( pzNewFileName , "%s\\Auto%02d.%S", gSaveDir, guiLastSaveGameNum, pMessageStrings[ MSG_SAVEEXTENSION ] ); - - //increment end turn number - guiLastSaveGameNum++; - - //just have 2 saves - if( guiLastSaveGameNum == 2 ) - { - guiLastSaveGameNum = 0; - } + sprintf( pzNewFileName , "%s\\%S%02d.%S", gSaveDir, pMessageStrings[ MSG_SAVE_AUTOSAVE_FILENAME ], ubSaveGameID, pMessageStrings[ MSG_SAVEEXTENSION ] ); + } + else if( ubSaveGameID == SAVE__END_TURN_NUM_1 || ubSaveGameID == SAVE__END_TURN_NUM_2 ) + { + if ( ubSaveGameID == SAVE__END_TURN_NUM_1 ) + sprintf( pzNewFileName , "%s\\Auto%02d.%S", gSaveDir, 0, pMessageStrings[ MSG_SAVEEXTENSION ] ); + else if ( ubSaveGameID == SAVE__END_TURN_NUM_2 ) + sprintf( pzNewFileName , "%s\\Auto%02d.%S", gSaveDir, 1, pMessageStrings[ MSG_SAVEEXTENSION ] ); + } + else if( ubSaveGameID == SAVE__END_TURN_NUM ) + { + //The name of the file + sprintf( pzNewFileName , "%s\\Auto%02d.%S", gSaveDir, guiLastSaveGameNum, pMessageStrings[ MSG_SAVEEXTENSION ] ); } -//#endif - else - sprintf( pzNewFileName , "%s\\%S%02d.%S", gSaveDir, pMessageStrings[ MSG_SAVE_NAME ], ubSaveGameID, pMessageStrings[ MSG_SAVEEXTENSION ] ); + sprintf( pzNewFileName , "%s\\%S%02d.%S", gSaveDir, pMessageStrings[ MSG_SAVE_NAME ], ubSaveGameID - SAVE__END_TURN_NUM_2, pMessageStrings[ MSG_SAVEEXTENSION ] ); } @@ -7235,6 +7597,12 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) // HEADROCK HAM 3.6: Save new global variable for militia upkeep sGeneralInfo.uiTotalUpkeepForMilitia = guiTotalUpkeepForMilitia; +#ifdef JA2UB + //ja25 UB + sGeneralInfo.fMorrisShouldSayHi = gfMorrisShouldSayHi; + sGeneralInfo.fFirstTimeInGameHeliCrash = gfFirstTimeInGameHeliCrash; +#endif + // HEADROCK HAM 4: Save global array for Manual Mobile Militia Restrictions // testing for loop memcpy(sGeneralInfo.ubManualRestrictMilitia, gubManualRestrictMilitia, sizeof( UINT8 )*256); @@ -7243,6 +7611,45 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) { sGeneralInfo.HiddenNames[i] = !zHiddenNames[i].Hidden; //legion2 } + + sGeneralInfo.sMercArrivalGridNo = gGameExternalOptions.iInitialMercArrivalLocation; + +#ifdef JA2UB + sGeneralInfo.sINITIALHELIGRIDNO[ 0 ] = gGameUBOptions.InitialHeliGridNo[ 0 ];//14947; + sGeneralInfo.sINITIALHELIGRIDNO[ 1 ] = gGameUBOptions.InitialHeliGridNo[ 1 ];//15584;//16067; + sGeneralInfo.sINITIALHELIGRIDNO[ 2 ] = gGameUBOptions.InitialHeliGridNo[ 2 ];//15754; + sGeneralInfo.sINITIALHELIGRIDNO[ 3 ] = gGameUBOptions.InitialHeliGridNo[ 3 ];//16232; + sGeneralInfo.sINITIALHELIGRIDNO[ 4 ] = gGameUBOptions.InitialHeliGridNo[ 4 ];//16067; + sGeneralInfo.sINITIALHELIGRIDNO[ 5 ] = gGameUBOptions.InitialHeliGridNo[ 5 ];//16230; + sGeneralInfo.sINITIALHELIGRIDNO[ 6 ] = gGameUBOptions.InitialHeliGridNo[ 6 ];//15272; + + sGeneralInfo.sLOCATEGRIDNO = gGameUBOptions.LOCATEGRIDNO; + sGeneralInfo.sLOCATEGRIDNO2 = gGameUBOptions.LOCATEGRIDNO2; + sGeneralInfo.sInGameHeliCrash = gGameUBOptions.InGameHeliCrash; + sGeneralInfo.sJerryGridNo = gGameUBOptions.JerryGridNo; + sGeneralInfo.sJerryQuotes = gGameUBOptions.JerryQuotes; + sGeneralInfo.sInJerry = gGameUBOptions.InJerry; + sGeneralInfo.sLaptopQuestEnabled = gGameUBOptions.LaptopQuestEnabled; + sGeneralInfo.sTEX_AND_JOHN = gGameUBOptions.fTexAndJohn; + sGeneralInfo.sRandom_Manuel_Text = gGameUBOptions.fRandomManuelText; + sGeneralInfo.sEVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE_UB = gGameUBOptions.EventAttackInitialSectorIfPlayerStillThere; + sGeneralInfo.sHandleAddingEnemiesToTunnelMaps_UB = gGameUBOptions.HandleAddingEnemiesToTunnelMaps; + sGeneralInfo.sInGameHeli = gGameUBOptions.InGameHeli; + sGeneralInfo.spJA2UB = gGameUBOptions.pJA2UB; + + sGeneralInfo.sfDeadMerc = gGameUBOptions.fDeadMerc; + + sGeneralInfo.subEndDefaultSectorX = gGameUBOptions.ubEndDefaultSectorX; + sGeneralInfo.subEndDefaultSectorY = gGameUBOptions.ubEndDefaultSectorY; + sGeneralInfo.subEndDefaultSectorZ = gGameUBOptions.ubEndDefaultSectorZ; + + sGeneralInfo.sTestUB = gGameUBOptions.TestUB; + + sGeneralInfo.sLaptopLinkInsurance = gGameUBOptions.LaptopLinkInsurance; + sGeneralInfo.sLaptopLinkFuneral = gGameUBOptions.LaptopLinkFuneral; + sGeneralInfo.sLaptopLinkBobby = gGameUBOptions.LaptopLinkBobby; + +#endif //Setup the //Save the current music mode @@ -7404,6 +7811,47 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sSkyriderCostModifier, sizeof(sGeneralInfo.sSkyriderCostModifier), sizeof(INT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fOutstandingFacilityDebt, sizeof(sGeneralInfo.fOutstandingFacilityDebt), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.uiTotalUpkeepForMilitia, sizeof(sGeneralInfo.uiTotalUpkeepForMilitia), sizeof(UINT32), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sMercArrivalGridNo, sizeof(sGeneralInfo.sMercArrivalGridNo), sizeof(UINT32), numBytesRead); +#ifdef JA2UB + //ja25 UB + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fMorrisShouldSayHi, sizeof(sGeneralInfo.fMorrisShouldSayHi), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fFirstTimeInGameHeliCrash, sizeof(sGeneralInfo.fFirstTimeInGameHeliCrash), sizeof(BOOLEAN), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sINITIALHELIGRIDNO, sizeof(sGeneralInfo.sINITIALHELIGRIDNO), sizeof(UINT32), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sLOCATEGRIDNO, sizeof(sGeneralInfo.sLOCATEGRIDNO), sizeof(UINT32), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sLOCATEGRIDNO2, sizeof(sGeneralInfo.sLOCATEGRIDNO2), sizeof(UINT32), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sJerryGridNo, sizeof(sGeneralInfo.sJerryGridNo), sizeof(UINT32), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sJerryQuotes, sizeof(sGeneralInfo.sJerryQuotes), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sInJerry, sizeof(sGeneralInfo.sInJerry), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sInGameHeliCrash, sizeof(sGeneralInfo.sInGameHeliCrash), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sLaptopQuestEnabled, sizeof(sGeneralInfo.sLaptopQuestEnabled), sizeof(BOOLEAN), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sTEX_AND_JOHN, sizeof(sGeneralInfo.sTEX_AND_JOHN), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sRandom_Manuel_Text, sizeof(sGeneralInfo.sRandom_Manuel_Text), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sEVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE_UB, sizeof(sGeneralInfo.sEVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE_UB), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sHandleAddingEnemiesToTunnelMaps_UB, sizeof(sGeneralInfo.sHandleAddingEnemiesToTunnelMaps_UB), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sInGameHeli, sizeof(sGeneralInfo.sInGameHeli), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.spJA2UB, sizeof(sGeneralInfo.spJA2UB), sizeof(BOOLEAN), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sfDeadMerc, sizeof(sGeneralInfo.sfDeadMerc), sizeof(BOOLEAN), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.subEndDefaultSectorX, sizeof(sGeneralInfo.subEndDefaultSectorX), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.subEndDefaultSectorY, sizeof(sGeneralInfo.subEndDefaultSectorY), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.subEndDefaultSectorZ, sizeof(sGeneralInfo.subEndDefaultSectorZ), sizeof(UINT8), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sTestUB, sizeof(sGeneralInfo.sTestUB), sizeof(BOOLEAN), numBytesRead); + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sLaptopLinkInsurance, sizeof(sGeneralInfo.sLaptopLinkInsurance), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sLaptopLinkFuneral, sizeof(sGeneralInfo.sLaptopLinkFuneral), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sLaptopLinkBobby, sizeof(sGeneralInfo.sLaptopLinkBobby), sizeof(BOOLEAN), numBytesRead); + + + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubFiller2, sizeof(sGeneralInfo.ubFiller2), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubFiller3, sizeof(sGeneralInfo.ubFiller3), sizeof(UINT32), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubFiller4, sizeof(sGeneralInfo.ubFiller4), sizeof(INT8), numBytesRead); + +#endif if ( guiCurrentSaveGameVersion >= NEW_GENERAL_SAVE_INFO_DATA ){ numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubManualRestrictMilitia, sizeof(sGeneralInfo.ubManualRestrictMilitia), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.HiddenNames, sizeof(sGeneralInfo.HiddenNames), sizeof(BOOLEAN), numBytesRead); @@ -7645,6 +8093,14 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) gsMercArriveSectorX = sGeneralInfo.sMercArriveSectorX; gsMercArriveSectorY = sGeneralInfo.sMercArriveSectorY; + + gGameExternalOptions.ubDefaultArrivalSectorX = (UINT8)gsMercArriveSectorX; + gGameExternalOptions.ubDefaultArrivalSectorY = (UINT8)gsMercArriveSectorY; + +#ifdef JA2UB + JA2_5_START_SECTOR_X = gGameExternalOptions.ubDefaultArrivalSectorX; + JA2_5_START_SECTOR_Y = gGameExternalOptions.ubDefaultArrivalSectorY; +#endif gfCreatureMeanwhileScenePlayed = sGeneralInfo.fCreatureMeanwhileScenePlayed; @@ -7682,6 +8138,12 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) // HEADROCK HAM 3.6: Load new global variable for militia upkeep guiTotalUpkeepForMilitia = sGeneralInfo.uiTotalUpkeepForMilitia; +#ifdef JA2UB + //JA25 UB + gfMorrisShouldSayHi = sGeneralInfo.fMorrisShouldSayHi; + gfFirstTimeInGameHeliCrash = sGeneralInfo.fFirstTimeInGameHeliCrash; +#endif + // HEADROCK HAM 4: Load Manual Mobile Militia Restrictions memcpy(gubManualRestrictMilitia, sGeneralInfo.ubManualRestrictMilitia, sizeof(UINT8) * 256); @@ -7690,6 +8152,39 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) zHiddenNames[i].Hidden = !sGeneralInfo.HiddenNames[i]; } + gGameExternalOptions.iInitialMercArrivalLocation = sGeneralInfo.sMercArrivalGridNo; + +#ifdef JA2UB + gGameUBOptions.InitialHeliGridNo[ 0 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 0 ];//14947; + gGameUBOptions.InitialHeliGridNo[ 1 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 1 ];//15584;//16067; + gGameUBOptions.InitialHeliGridNo[ 2 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 2 ];//15754; + gGameUBOptions.InitialHeliGridNo[ 3 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 3 ];//16232; + gGameUBOptions.InitialHeliGridNo[ 4 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 4 ];//16067; + gGameUBOptions.InitialHeliGridNo[ 5 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 5 ];//16230; + gGameUBOptions.InitialHeliGridNo[ 6 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 6 ];//15272; + + gGameUBOptions.LOCATEGRIDNO = sGeneralInfo.sLOCATEGRIDNO; + gGameUBOptions.LOCATEGRIDNO2 = sGeneralInfo.sLOCATEGRIDNO2; + gGameUBOptions.InGameHeliCrash = sGeneralInfo.sInGameHeliCrash; + gGameUBOptions.JerryGridNo = sGeneralInfo.sJerryGridNo; + gGameUBOptions.JerryQuotes = sGeneralInfo.sJerryQuotes; + gGameUBOptions.InJerry = sGeneralInfo.sInJerry; + gGameUBOptions.InGameHeli = sGeneralInfo.sInGameHeli; + gGameUBOptions.pJA2UB = sGeneralInfo.spJA2UB; + + gGameUBOptions.fDeadMerc = sGeneralInfo.sfDeadMerc; + + gGameUBOptions.ubEndDefaultSectorX = sGeneralInfo.subEndDefaultSectorX; + gGameUBOptions.ubEndDefaultSectorY = sGeneralInfo.subEndDefaultSectorY; + gGameUBOptions.ubEndDefaultSectorZ = sGeneralInfo.subEndDefaultSectorZ; + + gGameUBOptions.TestUB = sGeneralInfo.sTestUB; + + gGameUBOptions.LaptopLinkInsurance = sGeneralInfo.sLaptopLinkInsurance; + gGameUBOptions.LaptopLinkFuneral = sGeneralInfo.sLaptopLinkFuneral; + gGameUBOptions.LaptopLinkBobby = sGeneralInfo.sLaptopLinkBobby; +#endif + if ( gGameExternalOptions.fShowCamouflageFaces == TRUE ) { @@ -8337,3 +8832,30 @@ UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ) return( uiEncryptionSet ); } + +//inshy: Now we dont need this convertation, all items chenged in the maps +/* +#ifdef JA2UB +void ConvertWeapons( SOLDIERTYPE *pSoldier ) +{ + INT32 iCnt; + + for( iCnt=0; iCnt< NUM_INV_SLOTS; iCnt++) + { + + + if(UsingNewInventorySystem() == false && gGameOptions.ubAttachmentSystem == ATTACHMENT_OLD ) + { + if( pSoldier->inv[ iCnt ].usItem == 97 || pSoldier->inv[ iCnt ].usItem == 1346 || pSoldier->inv[ iCnt ].usItem == 99 + || pSoldier->inv[ iCnt ].usItem == 1347 || pSoldier->inv[ iCnt ].usItem == 584 || pSoldier->inv[ iCnt ].usItem == 551 ) + pSoldier->inv[ iCnt ].usItem = 129; + + if( pSoldier->inv[ iCnt ].usItem == 117 || pSoldier->inv[ iCnt ].usItem == 349 || pSoldier->inv[ iCnt ].usItem == 1263 ) + pSoldier->inv[ iCnt ].usItem = 71; + } + + + } +} +#endif +*/ diff --git a/SaveLoadGame.h b/SaveLoadGame.h index f1966f0f..5f88a9c7 100644 --- a/SaveLoadGame.h +++ b/SaveLoadGame.h @@ -15,15 +15,25 @@ class SOLDIERTYPE; #define GAME_VERSION_LENGTH 16 -#define SAVE__ERROR_NUM 99 -#define SAVE__END_TURN_NUM 98 +#define SAVE__ERROR_NUM 249//99 + +// WANNE: The end turn have 2 saves (Auto00.sav and Auto01.sav). This 2 save slots should be underneath the 5 auto save slots +#define SAVE__END_TURN_NUM 248//98 +#define SAVE__END_TURN_NUM_1 6//98 +#define SAVE__END_TURN_NUM_2 7//98 // WDS - Automatically try to save when an assertion failure occurs -#define SAVE__ASSERTION_FAILURE 97 -#define SAVE__TIMED_AUTOSAVE 19 // WANNE: This slot does not show up in the load/save screen because it is > 18 +// WANNE: This SAVEGAME should not show up in the load screen +#define SAVE__ASSERTION_FAILURE 247//97 -#define EARLIST_SPECIAL_SAVE 97 +#define SAVE__TIMED_AUTOSAVE_SLOT1 1 //19 // WANNE: This slot does not show up in the load/save screen because it is > 18 +#define SAVE__TIMED_AUTOSAVE_SLOT2 2 +#define SAVE__TIMED_AUTOSAVE_SLOT3 3 +#define SAVE__TIMED_AUTOSAVE_SLOT4 4 +#define SAVE__TIMED_AUTOSAVE_SLOT5 5 + +#define EARLIST_SPECIAL_SAVE 247//97 typedef struct @@ -62,11 +72,7 @@ typedef struct UINT32 uiRandom; - UINT8 ubInventorySystem; - - UINT8 ubAttachmentSystem; - - UINT8 ubFiller[108]; // WANNE: Changed from 109 to 108 because of ubNewAttachmentSystem integration + UINT8 ubFiller[500]; // WANNE: Decrease this filler by 1, for each new UINT8 variable! } SAVED_GAME_HEADER; @@ -92,7 +98,7 @@ BOOLEAN DoesUserHaveEnoughHardDriveSpace(); void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ); -extern UINT32 guiLastSaveGameNum; +extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav) INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave ); #endif diff --git a/SaveLoadScreen.cpp b/SaveLoadScreen.cpp index baf66743..da7a1167 100644 --- a/SaveLoadScreen.cpp +++ b/SaveLoadScreen.cpp @@ -34,14 +34,22 @@ #include "Text.h" #include "Message.h" #include "Map Screen Interface.h" - #include "Multi Language Graphic Utils.h" - #include "Campaign Types.h" - #include "PostalService.h" + #include "Multi Language Graphic Utils.h" + #include "Campaign Types.h" + #include "PostalService.h" #endif #include "Campaign Init.h" #include "connect.h" +#ifdef JA2UB +#include "Strategic Movement.h" + +//#include "Strategic Movement Costs.h" + +#include "LuaInitNPCs.h" +#endif + BOOLEAN gfSchedulesHosed = FALSE; extern UINT32 guiBrokenSaveGameVersion; @@ -53,64 +61,53 @@ UINT16 NUM_SLOT; // ////////////////////////////////////////////////////// +#define SAVE_LOAD_TITLE_FONT FONT14ARIAL +#define SAVE_LOAD_TITLE_COLOR FONT_MCOLOR_WHITE - -#define SAVE_LOAD_TITLE_FONT FONT14ARIAL -#define SAVE_LOAD_TITLE_COLOR FONT_MCOLOR_WHITE - -#define SAVE_LOAD_NORMAL_FONT FONT12ARIAL -#define SAVE_LOAD_NORMAL_COLOR 2//FONT_MCOLOR_DKWHITE//2//FONT_MCOLOR_WHITE -#define SAVE_LOAD_NORMAL_SHADOW_COLOR 118//121//118//125 -/*#define SAVE_LOAD_NORMAL_FONT FONT12ARIAL -#define SAVE_LOAD_NORMAL_COLOR FONT_MCOLOR_DKWHITE//2//FONT_MCOLOR_WHITE -#define SAVE_LOAD_NORMAL_SHADOW_COLOR 2//125 -*/ +#define SAVE_LOAD_NORMAL_FONT FONT12ARIAL +#define SAVE_LOAD_NORMAL_COLOR 2 +#define SAVE_LOAD_NORMAL_SHADOW_COLOR 118 #define SAVE_LOAD_QUICKSAVE_FONT FONT12ARIAL -#define SAVE_LOAD_QUICKSAVE_COLOR 2//FONT_MCOLOR_DKGRAY//FONT_MCOLOR_WHITE -#define SAVE_LOAD_QUICKSAVE_SHADOW_COLOR 189//248//2 +#define SAVE_LOAD_QUICKSAVE_COLOR 2 +#define SAVE_LOAD_QUICKSAVE_SHADOW_COLOR 189 #define SAVE_LOAD_EMPTYSLOT_FONT FONT12ARIAL -#define SAVE_LOAD_EMPTYSLOT_COLOR 2//125//FONT_MCOLOR_WHITE -#define SAVE_LOAD_EMPTYSLOT_SHADOW_COLOR 121//118 +#define SAVE_LOAD_EMPTYSLOT_COLOR 2 +#define SAVE_LOAD_EMPTYSLOT_SHADOW_COLOR 189 -#define SAVE_LOAD_HIGHLIGHTED_FONT FONT12ARIAL -#define SAVE_LOAD_HIGHLIGHTED_COLOR FONT_MCOLOR_WHITE -#define SAVE_LOAD_HIGHLIGHTED_SHADOW_COLOR 2 +#define SAVE_LOAD_HIGHLIGHTED_FONT FONT12ARIAL +#define SAVE_LOAD_HIGHLIGHTED_COLOR FONT_MCOLOR_WHITE +#define SAVE_LOAD_HIGHLIGHTED_SHADOW_COLOR 2 #define SAVE_LOAD_SELECTED_FONT FONT12ARIAL -#define SAVE_LOAD_SELECTED_COLOR 2//145//FONT_MCOLOR_WHITE -#define SAVE_LOAD_SELECTED_SHADOW_COLOR 130//2 +#define SAVE_LOAD_SELECTED_COLOR 2 +#define SAVE_LOAD_SELECTED_SHADOW_COLOR 130 - - -#define SAVE_LOAD_NUMBER_FONT FONT12ARIAL +#define SAVE_LOAD_NUMBER_FONT FONT12ARIAL #define SAVE_LOAD_NUMBER_COLOR FONT_MCOLOR_WHITE -#define SLG_SELECTED_COLOR FONT_MCOLOR_WHITE -#define SLG_UNSELECTED_COLOR FONT_MCOLOR_DKWHITE +#define SLG_SELECTED_COLOR FONT_MCOLOR_WHITE +#define SLG_UNSELECTED_COLOR FONT_MCOLOR_DKWHITE #define SLG_SAVELOCATION_WIDTH 605 -//#define SLG_SAVELOCATION_HEIGHT 30//46 //legion off #define SLG_FIRST_SAVED_SPOT_X iScreenWidthOffset + 17 #define SLG_FIRST_SAVED_SPOT_Y iScreenHeightOffset + 49 -//#define SLG_GAP_BETWEEN_LOCATIONS 35//47 //legion off -#define SLG_DATE_OFFSET_X 13 -//#define SLG_DATE_OFFSET_Y 11 //legion off +#define SLG_DATE_OFFSET_X 13 -#define SLG_SECTOR_OFFSET_X 95//105//114 -#define SLG_SECTOR_OFFSET_Y SLG_DATE_OFFSET_Y +#define SLG_SECTOR_OFFSET_X 95 +#define SLG_SECTOR_OFFSET_Y SLG_DATE_OFFSET_Y #define SLG_SECTOR_WIDTH 98 -#define SLG_NUM_MERCS_OFFSET_X 196//190//SLG_DATE_OFFSET_X -#define SLG_NUM_MERCS_OFFSET_Y SLG_DATE_OFFSET_Y//26 +#define SLG_NUM_MERCS_OFFSET_X 196 +#define SLG_NUM_MERCS_OFFSET_Y SLG_DATE_OFFSET_Y -#define SLG_BALANCE_OFFSET_X 260//SLG_SECTOR_OFFSET_X -#define SLG_BALANCE_OFFSET_Y SLG_DATE_OFFSET_Y//SLG_NUM_MERCS_OFFSET_Y +#define SLG_BALANCE_OFFSET_X 260 +#define SLG_BALANCE_OFFSET_Y SLG_DATE_OFFSET_Y -#define SLG_SAVE_GAME_DESC_X 318//320//204 -#define SLG_SAVE_GAME_DESC_Y SLG_DATE_OFFSET_Y//SLG_DATE_OFFSET_Y + 7 +#define SLG_SAVE_GAME_DESC_X 318 +#define SLG_SAVE_GAME_DESC_Y SLG_DATE_OFFSET_Y #define SLG_TITLE_POS_X iScreenWidthOffset #define SLG_TITLE_POS_Y iScreenHeightOffset @@ -122,9 +119,6 @@ UINT16 NUM_SLOT; #define SLG_SAVE_LOAD_BTN_POS_X iScreenWidthOffset + 123 #define SLG_SAVE_LOAD_BTN_POS_Y iScreenHeightOffset + 438 -//#define SLG_SELECTED_SLOT_GRAPHICS_NUMBER 3 //legion off -//#define SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER 2 //legion off - #define SLG_DOUBLE_CLICK_DELAY 500 //defines for saved game version status @@ -149,12 +143,12 @@ BOOLEAN gfSaveLoadScreenExit = FALSE; BOOLEAN gfRedrawSaveLoadScreen = TRUE; BOOLEAN gfExitAfterMessageBox = FALSE; -INT32 giSaveLoadMessageBox = -1; // SaveLoad pop up messages index value +INT32 giSaveLoadMessageBox = -1; // SaveLoad pop up messages index value UINT32 guiSaveLoadExitScreen = SAVE_LOAD_SCREEN; //Contains the array of valid save game locations -BOOLEAN gbSaveGameArray[ NUM_SAVE_GAMES ]; +BOOLEAN gbSaveGameArray[ NUM_SAVE_GAMES ]; BOOLEAN gfDoingQuickLoad = FALSE; @@ -167,49 +161,38 @@ BOOLEAN gfSaveGame=TRUE; BOOLEAN gfSaveLoadScreenButtonsCreated = FALSE; -INT8 gbSaveGameSelectedLocation[ NUM_SAVE_GAMES ]; -INT8 gbSelectedSaveLocation=-1; -INT8 gbHighLightedLocation=-1; -INT8 gbLastHighLightedLocation=-1; -INT8 gbSetSlotToBeSelected=-1; +INT8 gbSaveGameSelectedLocation[ NUM_SAVE_GAMES ]; +INT32 gbSelectedSaveLocation=-1; +INT8 gbHighLightedLocation=-1; +INT8 gbLastHighLightedLocation=-1; +INT32 gbSetSlotToBeSelected=-1; UINT32 guiSlgBackGroundImage; UINT32 guiBackGroundAddOns; -UINT32 guiBackGroundAddOns_New; -UINT32 SLG_SAVELOCATION_HEIGHT; -UINT32 SLG_GAP_BETWEEN_LOCATIONS; -UINT32 SLG_DATE_OFFSET_Y; -UINT32 SLG_SELECTED_SLOT_GRAPHICS_NUMBER; -UINT32 SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER; +UINT32 guiBackGroundAddOns_New; +UINT32 SLG_SAVELOCATION_HEIGHT; +UINT32 SLG_GAP_BETWEEN_LOCATIONS; +UINT32 SLG_DATE_OFFSET_Y; +UINT32 SLG_SELECTED_SLOT_GRAPHICS_NUMBER; +UINT32 SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER; // The string that will contain the game desc text CHAR16 gzGameDescTextField[ SIZE_OF_SAVE_GAME_DESC ] = {0} ; - BOOLEAN gfUserInTextInputMode = FALSE; -UINT8 gubSaveGameNextPass=0; +UINT8 gubSaveGameNextPass=0; BOOLEAN gfStartedFadingOut = FALSE; - - BOOLEAN gfCameDirectlyFromGame = FALSE; - - BOOLEAN gfLoadedGame = FALSE; //Used to know when a game has been loaded, the flag in gtacticalstatus might have been reset already - BOOLEAN gfLoadGameUponEntry = FALSE; - -//BOOLEAN gfHadToMakeBasementLevels = FALSE; - BOOLEAN gfGettingNameFromSaveLoadScreen = FALSE; #ifdef JA2BETAVERSION extern BOOLEAN gfDisplaySaveGamesNowInvalidatedMsg; #endif -//Dealtar's Airport Externalization -extern CPostalService gPostalService; // //Buttons // @@ -222,7 +205,24 @@ UINT32 guiSlgCancelBtn; // Save game Button void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason); UINT32 guiSlgSaveLoadBtn; -INT32 guiSaveLoadImage; +INT32 guiSaveLoadImage; + +INT32 guiNewButtonImage; +INT32 guiPrevButton, guiNextButton; +void BtnNewPrevButtonCallback(GUI_BUTTON *btn,INT32 reason); +void BtnNewNextButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT16 PAGE_SLOT = 0; +UINT16 VAL_SLOT_START = 0; +UINT16 VAL_SLOT_END = 0; +BOOLEAN RenderImage = TRUE; +BOOLEAN DoAutoSave( int ubSaveGameID, STR16 pGameDesc ); +BOOLEAN AutoSaveToSlot[5]; + +// WANNE: Used For auto save games +UINT32 lastLoadedSaveGameDay = 0; +UINT8 lastLoadedSaveGameHour = 0; + +#define MAX_PAGE_SLOT 12 //Mouse regions for the currently selected save game MOUSE_REGION gSelectedSaveRegion[ NUM_SAVE_GAMES ]; @@ -240,45 +240,37 @@ void SelectedSLSEntireRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); ////////////////////////////////////////////////////// BOOLEAN EnterSaveLoadScreen(); -void RenderSaveLoadScreen(); -void ExitSaveLoadScreen(); -void HandleSaveLoadScreen(); -void GetSaveLoadScreenUserInput(); -void SaveLoadGameNumber( INT8 bSaveGameID ); -BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ); -BOOLEAN DisplaySaveGameEntry( INT8 bEntryID );//, UINT16 usPosY ); +void RenderSaveLoadScreen(); +void ExitSaveLoadScreen(); +void HandleSaveLoadScreen(); +void GetSaveLoadScreenUserInput(); +void SaveLoadGameNumber( INT32 bSaveGameID ); +BOOLEAN LoadSavedGameHeader( INT32 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ); +BOOLEAN DisplaySaveGameEntry( INT32 bEntryID );//, UINT16 usPosY ); BOOLEAN DisplaySaveGameList(); -void InitSaveLoadScreenTextInputBoxes(); -void DestroySaveLoadTextInputBoxes(); -void SetSelection( UINT8 ubNewSelection ); -UINT8 CompareSaveGameVersion( INT8 bSaveGameID ); -void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ); -void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ); -void DeleteAllSaveGameFile( ); -void DisplayOnScreenNumber( BOOLEAN fErase ); - - -void DisableSelectedSlot(); - -void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ); -void ConfirmLoadSavedGameMessageBoxCallBack( UINT8 bExitValue ); -//void FailedSavingGameCallBack( UINT8 bExitValue ); -void FailedLoadingGameCallBack( UINT8 bExitValue ); -void SetSaveLoadExitScreen( UINT32 uiScreen ); - -void NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack( UINT8 bExitValue ); -void NotEnoughHardDriveSpaceForNormalSaveMessageBoxCallBack( UINT8 bExitValue ); - -void RedrawSaveLoadScreenAfterMessageBox( UINT8 bExitValue ); -void ClearSelectedSaveSlot(); -void MoveSelectionUpOrDown( BOOLEAN fUp ); -void SaveGameToSlotNum(); -void StartFadeOutForSaveLoadScreen(); - -//ppp - - - +void InitSaveLoadScreenTextInputBoxes(); +void DestroySaveLoadTextInputBoxes(); +void SetSelection( UINT8 ubNewSelection ); +UINT8 CompareSaveGameVersion( INT32 bSaveGameID ); +void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ); +void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ); +void DeleteAllSaveGameFile( ); +void DisplayOnScreenNumber( BOOLEAN fErase ); +void DisableSelectedSlot(); +void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ); +void ConfirmLoadSavedGameMessageBoxCallBack( UINT8 bExitValue ); +void FailedLoadingGameCallBack( UINT8 bExitValue ); +void SetSaveLoadExitScreen( UINT32 uiScreen ); +void NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack( UINT8 bExitValue ); +void NotEnoughHardDriveSpaceForNormalSaveMessageBoxCallBack( UINT8 bExitValue ); +void RedrawSaveLoadScreenAfterMessageBox( UINT8 bExitValue ); +void ClearSelectedSaveSlot(); +void MoveSelectionUpOrDown( BOOLEAN fUp ); +void SaveGameToSlotNum(); +void StartFadeOutForSaveLoadScreen(); +#ifdef JA2UB +extern void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ); // ja25 UB +#endif ////////////////////////////////////////////////////// // @@ -289,35 +281,25 @@ void StartFadeOutForSaveLoadScreen(); void LoadSaveGameOldOrNew() { if (gGameExternalOptions.fSaveGameSlot == TRUE) - { - NUM_SLOT = NUM_SAVE_GAMES_NEW; - //SAVE_LOAD_SELECTED_FONT = FONT12ARIAL; - //SAVE_LOAD_NUMBER_FONT = FONT12ARIAL; - //SAVE_LOAD_HIGHLIGHTED_FONT = FONT12ARIAL; - //SAVE_LOAD_NORMAL_FONT = FONT12ARIAL; - SLG_SAVELOCATION_HEIGHT = 15; - SLG_GAP_BETWEEN_LOCATIONS = 20; - SLG_DATE_OFFSET_Y = 5; - SLG_SELECTED_SLOT_GRAPHICS_NUMBER = 1; - SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER = 0; - } - else - { - NUM_SLOT = NUM_SAVE_GAMES_OLD; - //SAVE_LOAD_SELECTED_FONT = FONT12ARIAL; - //SAVE_LOAD_NUMBER_FONT = FONT12ARIAL; - //SAVE_LOAD_HIGHLIGHTED_FONT = FONT12ARIAL; - //SAVE_LOAD_NORMAL_FONT = FONT12ARIAL; - SLG_SAVELOCATION_HEIGHT = 30; - SLG_GAP_BETWEEN_LOCATIONS = 35; - SLG_DATE_OFFSET_Y = 11; - SLG_SELECTED_SLOT_GRAPHICS_NUMBER = 3; - SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER = 2; - } - + { + NUM_SLOT = NUM_SAVE_GAMES_NEW; + SLG_SAVELOCATION_HEIGHT = 15; + SLG_GAP_BETWEEN_LOCATIONS = 20; + SLG_DATE_OFFSET_Y = 5; + SLG_SELECTED_SLOT_GRAPHICS_NUMBER = 1; + SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER = 0; + } + else + { + NUM_SLOT = NUM_SAVE_GAMES_OLD; + SLG_SAVELOCATION_HEIGHT = 30; + SLG_GAP_BETWEEN_LOCATIONS = 35; + SLG_DATE_OFFSET_Y = 11; + SLG_SELECTED_SLOT_GRAPHICS_NUMBER = 3; + SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER = 2; + } } - UINT32 SaveLoadScreenInit() { //Set so next time we come in, we can set up @@ -329,13 +311,9 @@ UINT32 SaveLoadScreenInit() gbHighLightedLocation=-1; - - return( TRUE ); } - - UINT32 SaveLoadScreenHandle() { StartFrameBufferRender(); @@ -390,7 +368,6 @@ UINT32 SaveLoadScreenHandle() } } - //If we are not exiting the screen, render the buttons if( !gfSaveLoadScreenExit && guiSaveLoadExitScreen == SAVE_LOAD_SCREEN ) { @@ -398,7 +375,6 @@ UINT32 SaveLoadScreenHandle() RenderButtons( ); } - // ATE: Put here to save RECTS before any fast help being drawn... SaveBackgroundRects( ); RenderButtonsFastHelp(); @@ -416,7 +392,6 @@ UINT32 SaveLoadScreenHandle() return( SAVE_LOAD_SCREEN ); } - if( gfSaveLoadScreenExit ) { ExitSaveLoadScreen(); @@ -435,24 +410,11 @@ UINT32 SaveLoadScreenHandle() return( guiSaveLoadExitScreen ); } - - UINT32 SaveLoadScreenShutdown() { - return( TRUE ); } - - - - - - - - - - void SetSaveLoadExitScreen( UINT32 uiScreen ) { if( uiScreen == GAME_SCREEN ) @@ -460,62 +422,227 @@ void SetSaveLoadExitScreen( UINT32 uiScreen ) EnterTacticalScreen( ); } - //If we are currently in the Message box loop -// if( gfExitAfterMessageBox ) -// ExitSaveLoadScreen(); - - gfSaveLoadScreenExit = TRUE; guiSaveLoadExitScreen = uiScreen; SetPendingNewScreen( uiScreen ); -#if 0 - // 0verhaul: This is a repeat of the previous line, but with a different variable set. - // None of it really makes sense. Why would a quicksave be different from a regular one? - // Why should ctrl+L act differently than alt+L? - if( gfDoingQuickLoad ) - { - fFirstTimeInGameScreen = TRUE; - SetPendingNewScreen( uiScreen ); - } -#endif - ExitSaveLoadScreen(); DestroySaveLoadTextInputBoxes(); } +void InitMSysButtons(BOOLEAN delRegion) +{ + UINT16 usPosX = SLG_FIRST_SAVED_SPOT_X; + UINT16 usPosY = SLG_FIRST_SAVED_SPOT_Y; + UINT8 i; + CHAR16 zString[512]; + CHAR16 zString2[512]; + + if ( delRegion == TRUE ) + { + for(i=0; i= SAVE__TIMED_AUTOSAVE_SLOT1 && i <= SAVE__TIMED_AUTOSAVE_SLOT5 ) + { + swprintf( zString, pMessageStrings[MSG_SAVE_AUTOSAVE_SLOT], VAL_SLOT_START + i ); + } + else if ( PAGE_SLOT == 0 && i >= SAVE__END_TURN_NUM_1 && i <= SAVE__END_TURN_NUM_2 ) + { + swprintf( zString, pMessageStrings[MSG_SAVE_AUTOSAVE_ENDTURN_SLOT], VAL_SLOT_START - SAVE__TIMED_AUTOSAVE_SLOT5 - 1 + i ); + } + else + { + swprintf( zString, pMessageStrings[MSG_SAVE_NORMAL_SLOT], VAL_SLOT_START + i - SAVE__END_TURN_NUM_2 ); + } + + wcscpy( zString2,zString ); + SetRegionFastHelpText( &gSelectedSaveRegion[ i ], zString2 ); + + //if we are to Load a game + if( !gfSaveGame ) + { + //We cannot load a game that hasnt been saved + if( !gbSaveGameArray[ VAL_SLOT_START + i ] ) + MSYS_DisableRegion( &gSelectedSaveRegion[ i ] ); + } + + usPosY += SLG_GAP_BETWEEN_LOCATIONS; + } +} + +BOOLEAN NewEnterSaveLoadScreen() { - INT8 i; VOBJECT_DESC VObjectDesc; UINT16 usPosX = SLG_FIRST_SAVED_SPOT_X; UINT16 usPosY = SLG_FIRST_SAVED_SPOT_Y; + + RenderImage = FALSE; - // WANNE: Do not draw the background black - // Black background - //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + if (guiBackGroundAddOns_New != -1) + DeleteVideoObjectFromIndex( guiBackGroundAddOns_New ); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\LOADSCREENADDONS_SAVEGAME.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBackGroundAddOns_New)); -// if( guiPreviousOptionScreen != MAINMENU_SCREEN ) -// gbSetSlotToBeSelected = -1; + //init the list + InitSaveGameArray(); - // In reality, this is not needed, but even screws things up - //// This is a hack to get sector names , but... if the underground sector is NOT loaded - //if( !gpUndergroundSectorInfoHead ) - //{ - // BuildUndergroundSectorInfoList(); - // gfHadToMakeBasementLevels = TRUE; - //} - //else - //{ - // gfHadToMakeBasementLevels = FALSE; - //} + //Clear out all the saved background rects + EmptyBackgroundRects( ); + + //if the user has asked to load the selected save + if( gfLoadGameUponEntry ) + { + //make sure the save is valid + if( gGameSettings.bLastSavedGameSlot != -1 && gbSaveGameArray[ gGameSettings.bLastSavedGameSlot ] ) + { + gbSelectedSaveLocation = gGameSettings.bLastSavedGameSlot; + + //load the saved game + ConfirmLoadSavedGameMessageBoxCallBack( MSG_BOX_RETURN_YES ); + } + else + { //else the save isnt valid, so dont load it + gfLoadGameUponEntry = FALSE; + } + } + + if (PAGE_SLOT == 0 || PAGE_SLOT < 0 ) + DisableButton( guiPrevButton ); + + if (PAGE_SLOT == MAX_PAGE_SLOT || PAGE_SLOT > MAX_PAGE_SLOT ) + DisableButton( guiNextButton ); + + SpecifyDisabledButtonStyle( guiSlgSaveLoadBtn, DISABLED_STYLE_HATCHED ); + + if( gbSetSlotToBeSelected == -1 ) + DisableButton( guiSlgSaveLoadBtn ); + + InitMSysButtons(TRUE); + + ClearSelectedSaveSlot(); + + //Reset the highlight + gbHighLightedLocation = -1; + + gzGameDescTextField[0] = '\0'; + + SpecifyDisabledButtonStyle( guiSlgSaveLoadBtn, DISABLED_STYLE_HATCHED ); + + //if the last saved game slot is ok, set the selected slot to the last saved slot] + if( gGameSettings.bLastSavedGameSlot != -1 ) + { + //if the slot is valid + if( gbSaveGameArray[ gGameSettings.bLastSavedGameSlot ] ) + { + SAVED_GAME_HEADER SaveGameHeader; + + memset( &SaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); + + //if it is not the Quick Save slot, and we are loading + if( !gfSaveGame || gfSaveGame && gGameSettings.bLastSavedGameSlot != 0 ) + { + gbSelectedSaveLocation = gGameSettings.bLastSavedGameSlot; + gbSaveGameSelectedLocation[ gbSelectedSaveLocation ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; + + //load the save gamed header string + + //Get the heade for the saved game + if( !LoadSavedGameHeader( gbSelectedSaveLocation, &SaveGameHeader ) ) + { + memset( &SaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); + gbSaveGameSelectedLocation[ gbSelectedSaveLocation ] = SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER; + + if (gbSelectedSaveLocation != SAVE__END_TURN_NUM) + { + gbSaveGameArray[ gbSelectedSaveLocation ] = FALSE; + } + + gbSelectedSaveLocation = gGameSettings.bLastSavedGameSlot = -1; + } + + wcscpy( gzGameDescTextField, SaveGameHeader.sSavedGameDesc ); + } + } + } + + //if we are loading and the there is no slot selected + if( gbSelectedSaveLocation == -1 ) + DisableButton( guiSlgSaveLoadBtn ); + else + EnableButton( guiSlgSaveLoadBtn ); + + RenderSaveLoadScreen(); + + // Save load buttons are created + gfSaveLoadScreenButtonsCreated = TRUE; + + gfDoingQuickLoad = FALSE; + + //reset + gfStartedFadingOut = FALSE; + + DisableScrollMessages(); + + gfLoadedGame = FALSE; + + if( gfLoadGameUponEntry ) + { + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + + //unmark the 2 buttons from being dirty + ButtonList[ guiSlgCancelBtn ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + ButtonList[ guiSlgSaveLoadBtn ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + + // CLEAR THE FRAME BUFFER + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( FRAME_BUFFER ); + + // CLEAR THE guiRENDERBUFFER + pDestBuf = LockVideoSurface( guiRENDERBUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( guiRENDERBUFFER ); + } + + gfGettingNameFromSaveLoadScreen = FALSE; + + return( TRUE ); +} + +BOOLEAN EnterSaveLoadScreen() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX = SLG_FIRST_SAVED_SPOT_X; + UINT16 usPosY = SLG_FIRST_SAVED_SPOT_Y; + + PAGE_SLOT = 0; + VAL_SLOT_START = 0; + RenderImage = TRUE; - //guiSaveLoadExitScreen = SAVE_LOAD_SCREEN; // this is where we came from; if loading of resources fails, this is also where we go next/back extern UINT32 guiPreviousScreen; guiSaveLoadExitScreen = guiPreviousScreen; @@ -560,17 +687,8 @@ BOOLEAN EnterSaveLoadScreen() CHECKF(AddVideoObject(&VObjectDesc, &guiBackGroundAddOns_New)); } - - guiSlgButtonImage = LoadButtonImage("INTERFACE\\LoadScreenAddOns.sti", -1,6,-1,9,-1 ); -// guiSlgButtonImage = UseLoadedButtonImage( guiBackGroundAddOns, -1,9,-1,6,-1 ); - - - //Cancel button -// if( gfSaveGame ) -// usPosX = SLG_SAVE_CANCEL_POS_X; -// else - usPosX = SLG_LOAD_CANCEL_POS_X; + usPosX = SLG_LOAD_CANCEL_POS_X; guiSlgCancelBtn = CreateIconAndTextButton( guiSlgButtonImage, zSaveLoadText[SLG_CANCEL], OPT_BUTTON_FONT, OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, @@ -579,18 +697,6 @@ BOOLEAN EnterSaveLoadScreen() usPosX, SLG_CANCEL_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnSlgCancelCallback ); - //load mp game - /*UINT16 MPusPosX = SLG_LOAD_CANCEL_POS_X-39; - - UINT32 MPguiSlgCancelBtn = CreateIconAndTextButton( guiSlgButtonImage, zSaveLoadText[SLG_CANCEL], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - usPosX, SLG_CANCEL_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnSlgCancelCallback );*/ - - - //Either the save or load button if( gfSaveGame ) { @@ -604,7 +710,6 @@ BOOLEAN EnterSaveLoadScreen() TEXT_CJUSTIFIED, SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); - } else { @@ -617,133 +722,94 @@ BOOLEAN EnterSaveLoadScreen() SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); } + + guiNewButtonImage = LoadButtonImage("INTERFACE\\LoadScreenButtons.sti", -1,0,-1,1,-1 ); - //if we are loading, disable the load button -// if( !gfSaveGame ) - { - SpecifyDisabledButtonStyle( guiSlgSaveLoadBtn, DISABLED_STYLE_HATCHED ); + guiPrevButton = CreateIconAndTextButton( guiNewButtonImage, zOptionsText[4], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + SLG_SAVE_LOAD_BTN_POS_X-105, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnNewPrevButtonCallback ); + + + guiNextButton = CreateIconAndTextButton( guiNewButtonImage, zOptionsText[3], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + SLG_SAVE_LOAD_BTN_POS_X+395, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnNewNextButtonCallback ); + + if (PAGE_SLOT == 0 || PAGE_SLOT < 0 ) + DisableButton( guiPrevButton ); + + if (PAGE_SLOT == MAX_PAGE_SLOT || PAGE_SLOT > MAX_PAGE_SLOT ) + DisableButton( guiNextButton ); - if( gbSetSlotToBeSelected == -1 ) - DisableButton( guiSlgSaveLoadBtn ); - } + SpecifyDisabledButtonStyle( guiSlgSaveLoadBtn, DISABLED_STYLE_HATCHED ); - - usPosX = SLG_FIRST_SAVED_SPOT_X; - usPosY = SLG_FIRST_SAVED_SPOT_Y; - for(i=0; iuiFlags |= BUTTON_FORCE_UNDIRTY; ButtonList[ guiSlgSaveLoadBtn ]->uiFlags |= BUTTON_FORCE_UNDIRTY; - // CLEAR THE FRAME BUFFER pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); @@ -788,10 +853,13 @@ Removed so that the user can click on it and get displayed a message that the qu return( TRUE ); } - -void ExitSaveLoadScreen() +void ExitSaveLoadScreen() { - INT8 i; + UINT8 i; + + PAGE_SLOT = 0; + VAL_SLOT_START = 0; + RenderImage = TRUE; gfLoadGameUponEntry = FALSE; @@ -802,17 +870,16 @@ void ExitSaveLoadScreen() gfSaveLoadScreenEntry = TRUE; gfExitAfterMessageBox = FALSE; - UnloadButtonImage( guiSlgButtonImage ); RemoveButton( guiSlgCancelBtn ); - //Remove the save / load button -// if( !gfSaveGame ) - { - RemoveButton( guiSlgSaveLoadBtn ); - UnloadButtonImage( guiSaveLoadImage ); - } + RemoveButton( guiNextButton ); + RemoveButton( guiPrevButton ); + UnloadButtonImage( guiNewButtonImage ); + + RemoveButton( guiSlgSaveLoadBtn ); + UnloadButtonImage( guiSaveLoadImage ); for(i=0; i= NUM_SLOT || bSaveGameID < 0 ) + if( bSaveGameID >= NUM_SAVE_GAMES || bSaveGameID < 0 ) { return; } @@ -1133,25 +1144,23 @@ void SaveLoadGameNumber( INT8 bSaveGameID ) { INT8 bActiveTextField; - bActiveTextField = (INT8)GetActiveFieldID(); + bActiveTextField = (INT32)GetActiveFieldID(); if( bActiveTextField && bActiveTextField != -1 ) { Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField, 128 ); } //if there is save game in the slot, ask for confirmation before overwriting - if( gbSaveGameArray[ bSaveGameID ] ) + if( gbSaveGameArray[ VAL_SLOT_START + bSaveGameID ] ) { CHAR16 sText[512]; - swprintf( sText, zSaveLoadText[SLG_CONFIRM_SAVE], bSaveGameID ); + swprintf( sText, zSaveLoadText[SLG_CONFIRM_SAVE], VAL_SLOT_START + bSaveGameID ); DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, sText, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmSavedGameMessageBoxCallBack ); } else { - //else do NOT put up a confirmation - //Save the game SaveGameToSlotNum(); } @@ -1177,14 +1186,6 @@ void SaveLoadGameNumber( INT8 bSaveGameID ) } else { -/* - IF YOU UNCOMMENT THIS -- LOCALIZE IT!!! - CHAR16 sText[512]; - - swprintf( sText, L"%s%d?", zSaveLoadText[SLG_CONFIRM_LOAD], bSaveGameID ); - - DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, sText, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmLoadSavedGameMessageBoxCallBack ); -*/ //Setup up the fade routines StartFadeOutForSaveLoadScreen(); } @@ -1195,7 +1196,7 @@ void SaveLoadGameNumber( INT8 bSaveGameID ) BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) { // do message box and return - giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + giSaveLoadMessageBox = DoMessageBox(ubStyle,zString,uiExitScreen,( UINT8 )( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); // send back return state return( ( giSaveLoadMessageBox != -1 ) ); @@ -1206,64 +1207,62 @@ BOOLEAN DoSaveLoadMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitS SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; // do message box and return - giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + giSaveLoadMessageBox = DoMessageBox(ubStyle,zString,uiExitScreen,( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ),ReturnCallback, &CenteringRect ); // send back return state return( ( giSaveLoadMessageBox != -1 ) ); } - - BOOLEAN InitSaveGameArray() { - INT8 cnt; + UINT8 cnt,cnt2; + UINT8 i; CHAR8 zSaveGameName[ 512 ]; SAVED_GAME_HEADER SaveGameHeader; - - - for( cnt=0; cnt NUM_SLOT ) + if( bEntry < 0 || bEntry > NUM_SAVE_GAMES /*NUM_SLOT*/ ) { //memset( &pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); memset( pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); @@ -1572,7 +1654,8 @@ BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ) } //Get the name of the file - CreateSavedGameFileNameFromNumber( bEntry, zSavedGameName ); + newSlot = VAL_SLOT_START + bEntry; + CreateSavedGameFileNameFromNumber( newSlot, zSavedGameName ); if( FileExists( zSavedGameName ) ) { @@ -1581,7 +1664,7 @@ BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ) if( !hFile ) { FileClose( hFile ); - gbSaveGameArray[ bEntry ] = FALSE; + gbSaveGameArray[ VAL_SLOT_START + bEntry ] = FALSE; return(FALSE); } @@ -1590,7 +1673,7 @@ BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ) if( uiNumBytesRead != sizeof( SAVED_GAME_HEADER ) ) { FileClose( hFile ); - gbSaveGameArray[ bEntry ] = FALSE; + gbSaveGameArray[ VAL_SLOT_START + bEntry ] = FALSE; return(FALSE); } @@ -1604,7 +1687,7 @@ BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ) if( wcslen( pSaveGameHeader->sSavedGameDesc ) >= SIZE_OF_SAVE_GAME_DESC ) { memset( pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); - gbSaveGameArray[ bEntry ] = FALSE; + gbSaveGameArray[ VAL_SLOT_START + bEntry ] = FALSE; return(FALSE); } @@ -1662,8 +1745,6 @@ void BtnSlgCancelCallback(GUI_BUTTON *btn,INT32 reason) } } - - void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -1676,9 +1757,6 @@ void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); SaveLoadGameNumber( gbSelectedSaveLocation ); - - - InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) @@ -1688,8 +1766,7 @@ void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason) } } -/* -void BtnSlgLoadCallback(GUI_BUTTON *btn,INT32 reason) +void BtnNewPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { @@ -1700,7 +1777,25 @@ void BtnSlgLoadCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); - SaveLoadGameNumber( gbSelectedSaveLocation ); + PAGE_SLOT = PAGE_SLOT - 1; + + if ( PAGE_SLOT == 0 || PAGE_SLOT < 0 ) + VAL_SLOT_START = 0; + else if ( PAGE_SLOT >= 1 ) + VAL_SLOT_START = (PAGE_SLOT * 19); + + if (PAGE_SLOT == 0 || PAGE_SLOT < 0 ) + { + DisableButton( guiPrevButton ); + EnableButton( guiNextButton ); + PAGE_SLOT = 0; + } + else if (PAGE_SLOT < MAX_PAGE_SLOT) + { + EnableButton( guiNextButton ); + } + + NewEnterSaveLoadScreen(); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } @@ -1710,13 +1805,49 @@ void BtnSlgLoadCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } -*/ +void BtnNewNextButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + PAGE_SLOT = PAGE_SLOT + 1; + + if ( PAGE_SLOT >= 1 ) + VAL_SLOT_START = (PAGE_SLOT * 19); + else if ( PAGE_SLOT >= MAX_PAGE_SLOT ) + { + VAL_SLOT_START = (MAX_PAGE_SLOT * 19); + PAGE_SLOT = MAX_PAGE_SLOT; + } + if (PAGE_SLOT > 0 ) + EnableButton( guiPrevButton ); + + if (PAGE_SLOT > MAX_PAGE_SLOT || PAGE_SLOT == MAX_PAGE_SLOT ) + DisableButton( guiNextButton ); + + NewEnterSaveLoadScreen(); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { INT8 bActiveTextField; + CHAR16 zString[128]; if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -1728,23 +1859,73 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) UINT32 uiCurTime = GetJA2Clock(); INT32 i; -/* //If we are saving and this is the quick save slot - if( gfSaveGame && bSelected == 0 ) + if( gfSaveGame && bSelected == 0 && PAGE_SLOT == 0 ) { //Display a pop up telling user what the quick save slot is DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_QUICK_SAVE_RESERVED_FOR_TACTICAL ], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); return; } - - SetSelection( bSelected ); -*/ - - //If we are saving and this is the quick save slot - if( gfSaveGame && bSelected == 0 ) + + //If we are saving and this is the auto save slot + if( gfSaveGame && bSelected == SAVE__TIMED_AUTOSAVE_SLOT1 && PAGE_SLOT == 0 ) { + swprintf( zString, L"%s", pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT_INFO ]); //Display a pop up telling user what the quick save slot is - DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_QUICK_SAVE_RESERVED_FOR_TACTICAL ], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + //If we are saving and this is the auto save slot + if( gfSaveGame && bSelected == SAVE__TIMED_AUTOSAVE_SLOT2 && PAGE_SLOT == 0 ) + { + swprintf( zString, L"%s", pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT_INFO ]); + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + //If we are saving and this is the auto save slot + if( gfSaveGame && bSelected == SAVE__TIMED_AUTOSAVE_SLOT3 && PAGE_SLOT == 0 ) + { + swprintf( zString, L"%s", pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT_INFO ]); + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + //If we are saving and this is the auto save slot + if( gfSaveGame && bSelected == SAVE__TIMED_AUTOSAVE_SLOT4 && PAGE_SLOT == 0 ) + { + swprintf( zString, L"%s", pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT_INFO ]); + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + //If we are saving and this is the auto save slot + if( gfSaveGame && bSelected == SAVE__TIMED_AUTOSAVE_SLOT5 && PAGE_SLOT == 0 ) + { + swprintf( zString, L"%s %d", pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT_INFO ],SAVE__TIMED_AUTOSAVE_SLOT5); + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + //If we are saving and this is the auto save slot + if( gfSaveGame && bSelected == SAVE__END_TURN_NUM_1 && PAGE_SLOT == 0 ) + { + swprintf( zString, L"%s", pMessageStrings[ MSG_SAVE_AUTOSAVE_ENDTURN_TEXT_INFO ]); + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + if( gfSaveGame && bSelected == SAVE__END_TURN_NUM_2 && PAGE_SLOT == 0 ) + { + swprintf( zString, L"%s", pMessageStrings[ MSG_SAVE_AUTOSAVE_ENDTURN_TEXT_INFO ]); + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); return; } @@ -1766,21 +1947,9 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) //Init the text field for the game desc InitSaveLoadScreenTextInputBoxes(); - //If we are Loading the game -// if( !gfSaveGame ) - { - //Enable the save/load button - EnableButton( guiSlgSaveLoadBtn ); - } + EnableButton( guiSlgSaveLoadBtn ); - //If we are saving the game, disbale the button -// if( gfSaveGame ) -// DisableButton( guiSlgSaveLoadBtn ); -// else - { - //Set the time in which the button was first pressed - uiLastTime = GetJA2Clock(); - } + uiLastTime = GetJA2Clock(); //Set the selected region to be highlighted gbSaveGameSelectedLocation[ bSelected ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; @@ -1789,7 +1958,6 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) uiLastTime = GetJA2Clock(); } - //the user is selecting the selected save game slot else { @@ -1799,8 +1967,6 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) //if the user is not currently editing the game desc if( !gfUserInTextInputMode ) { -// SaveLoadGameNumber( gbSelectedSaveLocation ); - if( ( uiCurTime - uiLastTime ) < SLG_DOUBLE_CLICK_DELAY ) { //Load the saved game @@ -1817,11 +1983,10 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gbSaveGameSelectedLocation[ bSelected ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; gfRedrawSaveLoadScreen = TRUE; - } else { - bActiveTextField = (INT8)GetActiveFieldID(); + bActiveTextField = (INT32)GetActiveFieldID(); if( bActiveTextField && bActiveTextField != -1 ) { Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField, 128 ); @@ -1829,15 +1994,10 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) DestroySaveLoadTextInputBoxes(); -// gfRedrawSaveLoadScreen = TRUE; - -// EnableButton( guiSlgSaveLoadBtn ); - DisplaySaveGameEntry( gbLastHighLightedLocation ); gfRedrawSaveLoadScreen = TRUE; - if( ( uiCurTime - uiLastTime ) < SLG_DOUBLE_CLICK_DELAY ) { gubSaveGameNextPass = 1; @@ -1867,8 +2027,6 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } //Set the selected region to be highlighted gbSaveGameSelectedLocation[ bSelected ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; - - } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { @@ -1876,18 +2034,15 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } } - void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { - INT8 bTemp; + UINT8 bTemp; pRegion->uiFlags &= (~BUTTON_CLICKED_ON ); - bTemp = gbHighLightedLocation; gbHighLightedLocation = -1; -// DisplaySaveGameList(); DisplaySaveGameEntry( bTemp ); InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); @@ -1901,7 +2056,37 @@ void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) { return; } - + //Auto save slot 1-5 + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 1 ) + { + return; + } + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 2 ) + { + return; + } + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 3 ) + { + return; + } + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 4 ) + { + return; + } + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 5 ) + { + return; + } + //This slot is reserved for end turn Auto Saves + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 6 ) + { + return; + } + else if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 7 ) + { + return; + } + gbLastHighLightedLocation = gbHighLightedLocation; gbHighLightedLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); @@ -1912,10 +2097,6 @@ void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) } } - - - - void InitSaveLoadScreenTextInputBoxes() { UINT16 usPosY; @@ -1931,11 +2112,10 @@ void InitSaveLoadScreenTextInputBoxes() if( gfSaveLoadScreenExit || guiSaveLoadExitScreen != SAVE_LOAD_SCREEN ) return; - InitTextInputMode(); SetTextInputCursor( CUROSR_IBEAM_WHITE ); - SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH + SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) ); SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); SetTextInputRegularColors( FONT_WHITE, 2 ); @@ -1947,7 +2127,7 @@ void InitSaveLoadScreenTextInputBoxes() usPosY = SLG_FIRST_SAVED_SPOT_Y + SLG_GAP_BETWEEN_LOCATIONS * gbSelectedSaveLocation; //if there is already a string here, use its string - if( gbSaveGameArray[ gbSelectedSaveLocation ] ) + if( gbSaveGameArray[ VAL_SLOT_START + gbSelectedSaveLocation ] ) { //if we are modifying a previously modifed string, use it if( gzGameDescTextField[0] != '\0' ) @@ -1978,16 +2158,12 @@ void DestroySaveLoadTextInputBoxes() SetTextInputCursor( CURSOR_IBEAM ); } - void SetSelection( UINT8 ubNewSelection ) { -// CHAR16 zMouseHelpTextString[256]; -// SAVED_GAME_HEADER SaveGameHeader; - //if we are loading and there is no entry, return if( !gfSaveGame ) { - if( !gbSaveGameArray[ubNewSelection] ) + if( !gbSaveGameArray[VAL_SLOT_START + ubNewSelection] ) return; } @@ -2037,42 +2213,9 @@ void SetSelection( UINT8 ubNewSelection ) //Set the selected slot background graphic gbSaveGameSelectedLocation[ gbSelectedSaveLocation ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; - -/* - //if we are saving AND it is the currently selected slot - if( gfSaveGame && gbSelectedSaveLocation == ubNewSelection ) - { - //copy over the initial game options - memcpy( &SaveGameHeader.sInitialGameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); - } - else - { - //Get the header for the specified saved game - if( !LoadSavedGameHeader( ubNewSelection, &SaveGameHeader ) ) - { - memset( &SaveGameHeader, 0, sizeof( SaveGameHeader ) ); - } - } - - swprintf( zMouseHelpTextString, L"%s: %s\n%s: %s\n%s: %s\n%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], - gzGIOScreenText[ GIO_DIF_LEVEL_TEXT + SaveGameHeader.sInitialGameOptions.ubDifficultyLevel + 1 ], - - gzGIOScreenText[ GIO_TIMED_TURN_TITLE_TEXT ], - gzGIOScreenText[ GIO_TIMED_TURN_TITLE_TEXT + SaveGameHeader.sInitialGameOptions.fTurnTimeLimit + 1], - - gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT ], - gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT + 2 - SaveGameHeader.sInitialGameOptions.fGunNut ], - - gzGIOScreenText[ GIO_GAME_STYLE_TEXT ], - gzGIOScreenText[ GIO_GAME_STYLE_TEXT + (SaveGameHeader.sInitialGameOptions.ubGameStyle == STYLE_SCIFI)?1:0; + 1 ] ); - - //set the slots help text - SetRegionFastHelpText( &gSelectedSaveRegion[ gbSelectedSaveLocation ], zMouseHelpTextString ); - */ } - -UINT8 CompareSaveGameVersion( INT8 bSaveGameID ) +UINT8 CompareSaveGameVersion( INT32 bSaveGameID ) { UINT8 ubRetVal=SLS_HEADER_OK; @@ -2098,7 +2241,6 @@ UINT8 CompareSaveGameVersion( INT8 bSaveGameID ) return( ubRetVal ); } - void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ) { // yes, load the game @@ -2116,7 +2258,6 @@ void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ) } } - void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ) { // yes, Delete all the save game files @@ -2135,11 +2276,12 @@ void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ) void DeleteAllSaveGameFile( ) { - UINT8 cnt; + UINT8 cnt,cnt2; for( cnt=0; cnt 6 && iResolution == 0) || (gGameOptions.ubSquadSize > 8 && iResolution == 1)) + { + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_SQUAD_SIZE_RES_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack ); + NextLoopCheckForEnoughFreeHardDriveSpace(); + } else { DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_LOAD_GAME_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack ); @@ -2249,7 +2395,6 @@ void DoneFadeOutForSaveLoadScreen( void ) { SUCCESSFULLY_CORRECTED_SAVE: #ifdef JA2BETAVERSION -// if( ValidateSoldierInitLinks( 1 ) ) ValidateSoldierInitLinks( 1 ); { #endif @@ -2259,9 +2404,7 @@ void DoneFadeOutForSaveLoadScreen( void ) gFadeInDoneCallback = DoneFadeInForSaveLoadScreen; SetSaveLoadExitScreen( guiScreenToGotoAfterLoadingSavedGame ); - - // LeaveTacticalScreen( MAP_SCREEN ); - + FadeInNextFrame( ); } @@ -2273,10 +2416,19 @@ void DoneFadeOutForSaveLoadScreen( void ) SetSaveLoadExitScreen( guiScreenToGotoAfterLoadingSavedGame ); PauseTime( FALSE ); - - // EnterTacticalScreen( ); FadeInGameScreen( ); } +#ifdef JA2UB + //JA25 UB + // ATE: Validate any new maps... + // OK, if we're a camapign, check for new maps + //if ( !InDefaultCampaign( ) ) + //{ + MakeBadSectorListFromMapsOnHardDrive( TRUE ); + LetLuaMakeBadSectorListFromMapsOnHardDrive( 0 ); + //} +#endif + #ifdef JA2BETAVERSION } #endif @@ -2298,7 +2450,6 @@ void DoneFadeInForSaveLoadScreen( void ) UnPauseGame( ); } } - else { //if the game is currently paused @@ -2308,14 +2459,9 @@ void DoneFadeInForSaveLoadScreen( void ) HandlePlayerPauseUnPauseOfGame(); HandlePlayerPauseUnPauseOfGame(); } - -// UnLockPauseState( ); -// UnPauseGame( ); - } } - void SelectedSLSEntireRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { if (iReason & MSYS_CALLBACK_REASON_INIT) @@ -2342,7 +2488,7 @@ void DisableSelectedSlot() } -void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ) +void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ) { Assert( gbSelectedSaveLocation != -1 ); @@ -2353,8 +2499,7 @@ void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ) } } - -void ConfirmLoadSavedGameMessageBoxCallBack( UINT8 bExitValue ) +void ConfirmLoadSavedGameMessageBoxCallBack( UINT8 bExitValue ) { Assert( gbSelectedSaveLocation != -1 ); @@ -2391,7 +2536,7 @@ void ErrorDetectedInSaveCallback( UINT8 bValue ) } #endif -void FailedLoadingGameCallBack( UINT8 bExitValue ) +void FailedLoadingGameCallBack( UINT8 bExitValue ) { // yes if( bExitValue == MSG_BOX_RETURN_OK ) @@ -2414,38 +2559,26 @@ void FailedLoadingGameCallBack( UINT8 bExitValue ) } } +BOOLEAN DoAutoSave( int ubSaveGameID, STR16 pGameDesc ) +{ + if( !SaveGame( ubSaveGameID, pGameDesc ) ) + { + //Unset the fact that we are saving a game + gTacticalStatus.uiFlags &= ~LOADING_SAVED_GAME; + + if( guiPreviousOptionScreen == MAP_SCREEN ) + DoMapMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_SAVE_GAME_ERROR], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + else + DoMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_SAVE_GAME_ERROR], GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL ); + } + + return( TRUE ); +} BOOLEAN DoQuickSave() { gzGameDescTextField[0] = '\0'; -/* - // Make sure the user has enough hard drive space - if( !DoesUserHaveEnoughHardDriveSpace() ) - { - CHAR16 zText[512]; - CHAR16 zSpaceOnDrive[512]; - UINT32 uiSpaceOnDrive; - CHAR16 zSizeNeeded[512]; - - swprintf( zSizeNeeded, L"%d", REQUIRED_FREE_SPACE / BYTESINMEGABYTE ); - InsertCommasForDollarFigure( zSizeNeeded ); - - uiSpaceOnDrive = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); - - swprintf( zSpaceOnDrive, L"%.2f", uiSpaceOnDrive / (FLOAT)BYTESINMEGABYTE ); - - swprintf( zText, pMessageStrings[ MSG_LOWDISKSPACE_WARNING ], zSpaceOnDrive, zSizeNeeded ); - - if( guiPreviousOptionScreen == MAP_SCREEN ) - DoMapMessageBox( MSG_BOX_BASIC_STYLE, zText, MAP_SCREEN, MSG_BOX_FLAG_OK, NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack ); - else - DoMessageBox( MSG_BOX_BASIC_STYLE, zText, GAME_SCREEN, MSG_BOX_FLAG_OK, NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack, NULL ); - - return( FALSE ); - } -*/ - if( !SaveGame( 0, gzGameDescTextField ) ) { //Unset the fact that we are saving a game @@ -2491,12 +2624,13 @@ BOOLEAN DoQuickLoad() BOOLEAN IsThereAnySavedGameFiles() { - INT8 cnt; + UINT8 cnt,newSlot; CHAR8 zSaveGameName[ 512 ]; for( cnt=0; cnt 1 ) + if( gbSelectedSaveLocation > pSlot ) { SetSelection( (UINT8)(gbSelectedSaveLocation-1) ); } @@ -2568,25 +2706,24 @@ void MoveSelectionUpOrDown( BOOLEAN fUp ) //if the selected slot is invalid if( gbSelectedSaveLocation == -1 ) { - SetSelection( 1 ); + SetSelection( pSlot ); } else { - if( gbSelectedSaveLocation >= 1 && gbSelectedSaveLocation < NUM_SLOT-1 ) + if( gbSelectedSaveLocation >= pSlot && gbSelectedSaveLocation < NUM_SLOT-1 ) { SetSelection( (UINT8)(gbSelectedSaveLocation + 1) ); } } } } - else { if( fUp ) { for( i=gbSelectedSaveLocation-1; i>=0; i--) { - if( gbSaveGameArray[i] ) + if( gbSaveGameArray[VAL_SLOT_START + i] ) { ClearSelectedSaveSlot(); @@ -2608,7 +2745,7 @@ void MoveSelectionUpOrDown( BOOLEAN fUp ) { for( i=gbSelectedSaveLocation+1; ipTranslationTable->usNumberOfSymbols; -//inshy: We don't need anymore ANSI convertation to UNICODE. -//siChar = GetUnicodeChar(siChar); + siChar = GetUnicodeChar(siChar); // search the Translation Table and return the index for the font pTrav = pFManager->pTranslationTable->DynamicArrayOf16BitValues; @@ -746,8 +745,7 @@ INT16 GetIndex(CHAR16 siChar) return 0; } -//inshy: We don't need anymore ANSI convertation to UNICODE. -/* + CHAR16 GetUnicodeChar(CHAR16 siChar) { #ifdef GERMAN @@ -920,7 +918,7 @@ CHAR16 GetUnicodeChar(CHAR16 siChar) //case 236: siChar = 236; break; //i' //case 210: siChar = 210; break; //O' //case 242: siChar = 242; break; //o' -//inshy: French ligatures +//inshy: I've added the character codes for French ligatures to the sources, but I haven't added them in the fonts! //Ligature //case 198: siChar = 198; break; //Æ //case 140: siChar = 338; break; //Œ @@ -932,7 +930,6 @@ CHAR16 GetUnicodeChar(CHAR16 siChar) return siChar; } -*/ //***************************************************************************** // SetFont @@ -1972,23 +1969,23 @@ FontTranslationTable *CreateEnglishTransTable( ) temp++; // POLISH letters in UNICODE - *temp = 260; // ¥ (on) + *temp = 260; // ¥ (îí) temp++; - *temp = 262; // Æ (tse) + *temp = 262; // Æ (öå) temp++; - *temp = 280; // Ê (en') + *temp = 280; // Ê (ýí) temp++; - *temp = 321; // £ (el') + *temp = 321; // £ (ýëü) temp++; - *temp = 323; // Ñ (en) + *temp = 323; // Ñ (ýíü) temp++; - *temp = 211; // Ó (o kratkoe) + *temp = 211; // Ó (î êðàòêîå) temp++; - *temp = 346; // Œ (es') + *temp = 346; // Œ (ýñü) temp++; - *temp = 379; // ¯ (zhet) + *temp = 379; // ¯ (æåò) temp++; - *temp = 377; // (zet) + *temp = 377; // (çåò) temp++; *temp = 261; // ¹ (îí) temp++; @@ -2073,15 +2070,16 @@ FontTranslationTable *CreateEnglishTransTable( ) *temp = 242; //o' temp++; -//French ligatures - *temp = 198; //Æ - temp++; - *temp = 338; //Œ - temp++; - *temp = 230; //æ - temp++; - *temp = 339; //œ - temp++; +//inshy: I've added the character codes for French ligatures to the sources, but I haven't added them in the fonts! +//Ligature +// *temp = 198; //Æ +// temp++; +// *temp = 338; //Œ +// temp++; +// *temp = 230; //æ +// temp++; +// *temp = 339; //œ +// temp++; // Font glyphs for spell targeting icons diff --git a/Standard Gaming Platform/WinFont.cpp b/Standard Gaming Platform/WinFont.cpp index 1b926fa2..0fff1438 100644 Binary files a/Standard Gaming Platform/WinFont.cpp and b/Standard Gaming Platform/WinFont.cpp differ diff --git a/Standard Gaming Platform/debug_win_util.cpp b/Standard Gaming Platform/debug_win_util.cpp index 7e9df4ad..7dd9ffeb 100644 --- a/Standard Gaming Platform/debug_win_util.cpp +++ b/Standard Gaming Platform/debug_win_util.cpp @@ -167,14 +167,13 @@ StackTrace::StackTrace() { // From http://msdn.microsoft.com/en-us/library/bb204633(VS.85).aspx, // the sum of FramesToSkip and FramesToCapture must be less than 63, // so set it to 62. - const int kMaxCallers = 62; - - void* callers[kMaxCallers]; + const int kMaxCallers = 62; // TODO(ajwong): Migrate this to StackWalk64. // WANNE: VS 2005 compilation error // WANNE: I disabled the method call "CaptureStackBackTrace()" because it gives a compilation error in VS 2005 #if ENABLE_STACK_TRACE + void* callers[kMaxCallers]; int count = CaptureStackBackTrace(0, kMaxCallers, callers, NULL); // WANNE: This also does not work in VS 2005 diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index f1edaa0a..3cfd9bf4 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -36,6 +36,7 @@ #include "input.h" #include "zmouse.h" +#include "GameSettings.h" #include #include @@ -796,10 +797,14 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) // Snap: Initialize the Data directory catalogue gDefaultDataCat.NewCat(DataDir); - // Snap: Get the custom Data directory location from ja2.ini (if any) + STRING512 ja2INIfile; + strcat(ja2INIfile, "..\\"); + strcat(ja2INIfile, GAME_INI_FILE); + + // Snap: Get the custom Data directory location from GAME_INI_FILE (if any) // and initialize the custom catalogue char customDataPath[MAX_PATH]; - if ( GetPrivateProfileString( "Ja2 Settings","CUSTOM_DATA_LOCATION", "", customDataPath, MAX_PATH, "..\\Ja2.ini" ) ) + if ( GetPrivateProfileString( "Ja2 Settings","CUSTOM_DATA_LOCATION", "", customDataPath, MAX_PATH, ja2INIfile ) ) { gCustomDataCat.NewCat(std::string(CurrentDir) + '\\' + customDataPath); } @@ -1329,10 +1334,11 @@ void GetRuntimeSettings( ) // Get Executable Directory GetExecutableDirectory( INIFile ); - strcat(INIFile, "\\Ja2.ini"); + strcat(INIFile, "\\"); + strcat(INIFile, GAME_INI_FILE); #else vfs::PropertyContainer oProps; - oProps.initFromIniFile("Ja2.ini"); + oProps.initFromIniFile(GAME_INI_FILE); #endif iResolution = -1; #ifndef USE_VFS @@ -1384,6 +1390,15 @@ void GetRuntimeSettings( ) CIniReader::RegisterFileForMerging(*it); } } + + std::list merge_list_ub; + if(oProps.getStringListProperty(L"Ja2 Settings", L"MERGE_INI_FILES_UB", merge_list_ub, L"")) + { + for(std::list::iterator it = merge_list_ub.begin(); it != merge_list_ub.end(); ++it) + { + CIniReader::RegisterFileForMerging(*it); + } + } #endif #ifdef USE_VFS diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 3a2b714c..fc42692b 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -67,6 +67,8 @@ #include #include +#include "Vehicles.h" + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -75,6 +77,19 @@ class SOLDIERTYPE; // HEADROCK HAM 3.5: Include Facility data #include "Facilities.h" +#include "Vehicles.h" + +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "mercs.h" +#include "ub_config.h" +#endif + // various reason an assignment can be aborted before completion enum{ NO_MORE_MED_KITS = 40, @@ -520,6 +535,11 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ); BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSoldier, UINT8 *pubRepairPtsLeft ); +#ifdef JA2UB +void HaveMercSayWhyHeWontLeave( SOLDIERTYPE *pSoldier ); //Ja25 UB +BOOLEAN CanMercBeAllowedToLeaveTeam( SOLDIERTYPE *pSoldier ); //JA25 UB +#endif + /* No point in allowing SAM site repair any more. Jan/13/99. ARM BOOLEAN IsTheSAMSiteInSectorRepairable( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); BOOLEAN SoldierInSameSectorAsSAM( SOLDIERTYPE *pSoldier ); @@ -2109,7 +2129,8 @@ INT8 CanCharacterSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) return( CHARACTER_CANT_JOIN_SQUAD_VEHICLE ); } - if ( NumberOfPeopleInSquad( bSquadValue ) >= NUMBER_OF_SOLDIERS_PER_SQUAD ) + //SQUAD10 FIX + if ( NumberOfPeopleInSquad( bSquadValue ) >= gGameOptions.ubSquadSize ) { return( CHARACTER_CANT_JOIN_SQUAD_FULL ); } @@ -6050,7 +6071,8 @@ BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ) { if ( IsThisVehicleAccessibleToSoldier( pSoldier, iVehicleIndex ) ) { - AddMonoString( (UINT32 *)&hStringHandle,pVehicleStrings[ pVehicleList[ iVehicleIndex ].ubVehicleType ] ); + //AddMonoString( (UINT32 *)&hStringHandle,pVehicleStrings[ pVehicleList[ iVehicleIndex ].ubVehicleType ] ); + AddMonoString( (UINT32 *)&hStringHandle,gNewVehicle[ pVehicleList[ iVehicleIndex ].ubVehicleType ].NewVehicleStrings ); } } } @@ -8072,6 +8094,17 @@ void BeginRemoveMercFromContract( SOLDIERTYPE *pSoldier ) // This function will setup the quote, then start dialogue beginning the actual leave sequence if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { + +#ifdef JA2UB + //Ja25 UB + //if the merc cant leave + if( !CanMercBeAllowedToLeaveTeam( pSoldier ) ) + { + HaveMercSayWhyHeWontLeave( pSoldier ); + return; + } +#endif + // WANNE: Nothing to do here, when we want to dismiss the robot BOOLEAN fAmIaRobot = AM_A_ROBOT( pSoldier ); if (!fAmIaRobot) @@ -9302,7 +9335,8 @@ void CreateSquadBox( void ) for(uiCounter=0; uiCounter <= uiMaxSquad; uiCounter++) { // get info about current squad and put in string - swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), NUMBER_OF_SOLDIERS_PER_SQUAD ); + //SQUAD10 FIX + swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize ); AddMonoString(&hStringHandle, sString ); // make sure it is unhighlighted @@ -9506,7 +9540,8 @@ BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ) { if ( IsThisVehicleAccessibleToSoldier( pSoldier, iCounter ) ) { - AddMonoString((UINT32 *)&hStringHandle, pVehicleStrings[ pVehicleList[ iCounter ].ubVehicleType ]); + //AddMonoString((UINT32 *)&hStringHandle, pVehicleStrings[ pVehicleList[ iCounter ].ubVehicleType ]); + AddMonoString((UINT32 *)&hStringHandle, gNewVehicle[ pVehicleList[ iCounter ].ubVehicleType ].NewVehicleStrings); fVehiclePresent = TRUE; } } @@ -14430,7 +14465,8 @@ BOOLEAN DisplayFacilityAssignmentMenu( SOLDIERTYPE *pSoldier, UINT8 ubFacilityTy if ( IsThisVehicleAccessibleToSoldier( pSoldier, iCounterB ) ) { // Create line that says "Repair X" where X is the vehicle. - swprintf( sTempString, gzFacilityAssignmentStrings[ FAC_REPAIR_VEHICLE ], pVehicleStrings[ pVehicleList[ iCounterB ].ubVehicleType ]); + // swprintf( sTempString, gzFacilityAssignmentStrings[ FAC_REPAIR_VEHICLE ], pVehicleStrings[ pVehicleList[ iCounterB ].ubVehicleType ]); + swprintf( sTempString, gzFacilityAssignmentStrings[ FAC_REPAIR_VEHICLE ], gNewVehicle[ pVehicleList[ iCounterB ].ubVehicleType ].NewVehicleStrings); AddMonoString((UINT32 *)&hStringHandle, sTempString ); fFoundVehicle = TRUE; } @@ -16348,3 +16384,36 @@ void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilit } } } +#ifdef JA2UB +//Ja25 UB + +BOOLEAN CanMercBeAllowedToLeaveTeam( SOLDIERTYPE *pSoldier ) +{ +/* + //if we are in sector... J14_1 && K14_1 + if( gWorldSectorX == 14 && gWorldSectorY == MAP_ROW_J && gbWorldSectorZ == 1 || + gWorldSectorX == 14 && gWorldSectorY == MAP_ROW_K && gbWorldSectorZ == 1 ) +*/ + //if we are in, or passed the tunnels + if( pSoldier->sSectorX >= 14 ) + { + //dont allow anyone to leave + return( FALSE ); + } + + return( TRUE ); +} + +void HaveMercSayWhyHeWontLeave( SOLDIERTYPE *pSoldier ) +{ + //if the merc is qualified + if( IsSoldierQualifiedMerc( pSoldier ) ) + { + TacticalCharacterDialogue( pSoldier, QUOTE_ANSWERING_MACHINE_MSG ); + } + else + { + TacticalCharacterDialogue( pSoldier, QUOTE_REFUSING_ORDER ); + } +} +#endif diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 7c99ba79..254f2056 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -1990,7 +1990,11 @@ void RenderAutoResolve() SetFactTrue( FACT_FIRST_BATTLE_WON ); } SetTheFirstBattleSector( ( INT16 ) (gpAR->ubSectorX + gpAR->ubSectorY * MAP_WORLD_X ) ); +#ifdef JA2UB +//Ja25: no loyalty +#else HandleFirstBattleEndingWhileInTown( gpAR->ubSectorX, gpAR->ubSectorY, 0, TRUE ); +#endif } switch( gpAR->ubBattleStatus ) diff --git a/Strategic/Campaign Init.cpp b/Strategic/Campaign Init.cpp index 9f9ec7c6..b7a7767c 100644 --- a/Strategic/Campaign Init.cpp +++ b/Strategic/Campaign Init.cpp @@ -642,11 +642,14 @@ void InitNewCampaign() //InitKnowFacilitiesFlags( ); BuildUndergroundSectorInfoList(); - +#ifdef JA2UB +// no UB +#else if (!is_networked) // allow overhead view of omerta A9 on game onset // HEADROCK HAM 3.5: Externalized. SetSectorFlag( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ, SF_ALREADY_VISITED ); //hayden +#endif //Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors //so that no two games are the same. diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index eb52db81..e5afc08e 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -91,6 +91,10 @@ enum //strategic values for each sector #define SF_SKYRIDER_NOTICED_ENEMIES_HERE 0x00000400 #define SF_HAVE_USED_GUIDE_QUOTE 0x00000800 +#ifdef JA2UB +#define SF_HAVE_SAID_PLAYER_QUOTE_NEW_SECTOR 0x00001000 +#endif + #define SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS 0x00100000 //Temp File starts with sm_ #define SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS 0x00200000 //Temp File starts with l_ #define SF_REVEALED_STATUS_TEMP_FILE_EXISTS 0x01000000 //Temp File starts with v_ @@ -377,6 +381,16 @@ enum SHELTER, ABANDONED_MINE, +#ifdef JA2UB +//Ja25: New + FINAL_COMPLEX, + GUARD_POST_TYPE, + CRASH_SITE_TYPE, + POWER_PLANT_TYPE, + MOUNTAINS_TYPE, + UNKNOWN_TYPE, +#endif + NUM_TRAVTERRAIN_TYPES }; extern UINT8 gszTerrain[NUM_TRAVTERRAIN_TYPES][15]; @@ -451,7 +465,12 @@ typedef struct SECTORINFO UINT8 bFiller3; UINT32 uiNumberOfWorldItemsInTempFileThatCanBeSeenByPlayer; - +#ifdef JA2UB + BOOLEAN fValidSector; //ja25 UB + BOOLEAN fCustomSector; + BOOLEAN fCampaignSector; +#endif + INT8 bPadding[ 41 ]; }SECTORINFO; @@ -484,6 +503,11 @@ typedef struct UNDERGROUND_SECTORINFO UINT8 ubMusicMode, ubUnsed; UINT32 uiNumberOfWorldItemsInTempFileThatCanBeSeenByPlayer; +#ifdef JA2UB + BOOLEAN fCustomSector; + BOOLEAN fCampaignSector; +#endif + INT8 bPadding[36]; //no padding left! }UNDERGROUND_SECTORINFO; diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index fe50bf06..157a1772 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -298,13 +298,16 @@ void InitCreatureQuest() fPlayMeanwhile = TRUE; #endif +#ifdef JA2UB +//Ja25 No meanwhiles && no creatures +#else if( fPlayMeanwhile && !gfCreatureMeanwhileScenePlayed ) { //Start the meanwhile scene for the queen ordering the release of the creatures. HandleCreatureRelease(); gfCreatureMeanwhileScenePlayed = TRUE; } - +#endif giHabitatedDistance = 0; switch( gGameOptions.ubDifficultyLevel ) { @@ -1558,8 +1561,12 @@ BOOLEAN LoadCreatureDirectives( HWFILE hFile, UINT32 uiSavedGameVersion ) if( gfClearCreatureQuest && giLairID != -1 ) { giLairID = 0; +#ifdef JA2UB +// no UB +#else gfCreatureMeanwhileScenePlayed = FALSE; uiMeanWhileFlags &= ~(0x00000800); +#endif } gfClearCreatureQuest = FALSE; #endif diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index 9d0fa279..b73ba3e0 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -49,6 +49,18 @@ #include "connect.h" +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "mercs.h" +#include "ub_config.h" +#endif + + #ifdef JA2BETAVERSION extern BOOLEAN gfMercsNeverQuit; #endif @@ -209,11 +221,15 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) // WANNE: This fixes the bug, that Speck did not sent the email on Day 3, when MERC_WEBSITE_ALL_MERCS_AVAILABLE = TRUE! if ( gGameExternalOptions.fMercDayOne == FALSE /* && gGameExternalOptions.fAllMercsAvailable == FALSE */ ) { - AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, -1 ); + #ifdef JA2UB + //No JA25 UB + #else + AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, -1 ,TYPE_EMAIL_EMAIL_EDT ); + #endif } break; case EVENT_DAY2_ADD_EMAIL_FROM_IMP: - AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), -1, -1); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT); break; //If a merc gets hired and they dont show up immediately, the merc gets added to the queue and shows up // uiTimeTillMercArrives minutes later @@ -344,6 +360,10 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) //case EVENT_BEGIN_AIR_RAID: // BeginAirRaid( ); // break; + +#ifdef JA2UB +// Ja25 No meanwhiles +#else case EVENT_MEANWHILE: if( !DelayEventIfBattleInProgress( pEvent ) ) { @@ -351,6 +371,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) InterruptTime(); } break; +#endif case EVENT_BEGIN_CREATURE_QUEST: break; case EVENT_CREATURE_SPREAD: @@ -407,7 +428,11 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) } break; case EVENT_MERC_SITE_BACK_ONLINE: + #ifdef JA2UB + // no JA25 UB + #else GetMercSiteBackOnline(); + #endif break; case EVENT_INVESTIGATE_SECTOR: InvestigateSector( (UINT8)pEvent->uiParam ); @@ -444,6 +469,31 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) case EVENT_POSTAL_SERVICE_SHIPMENT: gPostalService.DeliverShipment(pEvent->uiParam); break; +#ifdef JA2UB + //Ja25 UB + case EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE: + if ( gGameUBOptions.EventAttackInitialSectorIfPlayerStillThere == TRUE ) + { + ShouldEnemiesBeAddedToInitialSector(); + } + break; + + case EVENT_SAY_DELAYED_MERC_QUOTE: + DelayedSayingOfMercQuote( pEvent->uiParam ); + break; + + case EVENT_DELAY_SOMEONE_IN_SECTOR_MSGBOX: + SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector(); + break; + + case EVENT_SECTOR_H8_DONT_WAIT_IN_SECTOR: + HandleSayingDontStayToLongWarningInSectorH8(); + break; + + case EVENT_SEND_ENRICO_UNDERSTANDING_EMAIL: + HandleEnricosUnderstandingEmail(); + break; +#endif #ifdef CRIPPLED_VERSION case EVENT_CRIPPLED_VERSION_END_GAME_CHECK: diff --git a/Strategic/Game Event Hook.h b/Strategic/Game Event Hook.h index 0e016b32..d66894c4 100644 --- a/Strategic/Game Event Hook.h +++ b/Strategic/Game Event Hook.h @@ -85,7 +85,15 @@ enum EVENT_MERC_SITE_NEW_MERC_AVAILABLE, EVENT_POSTAL_SERVICE_SHIPMENT, // EVENT_CHECK_FOR_AIR_RAID, +#ifdef JA2UB + //Ja25: + EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE, + EVENT_SAY_DELAYED_MERC_QUOTE, + EVENT_DELAY_SOMEONE_IN_SECTOR_MSGBOX, + EVENT_SECTOR_H8_DONT_WAIT_IN_SECTOR, + EVENT_SEND_ENRICO_UNDERSTANDING_EMAIL, +#endif #ifdef CRIPPLED_VERSION EVENT_CRIPPLED_VERSION_END_GAME_CHECK, #endif diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index 17382e75..45f7138a 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -74,9 +74,16 @@ #include "XML.h" #include "mercs.h" #include "aim.h" +#include "Map Screen Interface.h" +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "Arms Dealer Init.h" +#endif #include "LuaInitNPCs.h" #include "Luaglobal.h" +#include "SaveLoadScreen.h" class OBJECTTYPE; class SOLDIERTYPE; @@ -93,6 +100,14 @@ extern UNDERGROUND_SECTORINFO* FindUnderGroundSector( INT16 sMapX, INT16 sMapY, UINT8 gubScreenCount=0; +#ifdef JA2UB +void InitCustomStrategicLayer ( void ) +{ + LetLuaGameInit(2); //load custom InitStrategicLayer +} + +#endif + void InitNPCs( void ) { @@ -422,8 +437,30 @@ void InitStrategicLayer( void ) InitSquads(); // Init vehicles InitAllVehicles( ); - // init town loyalty - InitTownLoyalty(); + + #ifdef JA2UB + InitCustomStrategicLayer ( ); + #endif + +#ifdef JA2UB + //Ja25 UB + InitJerryQuotes(); + if ( gGameUBOptions.JerryQuotes == TRUE ) + { + HandleJerryMiloQuotes( TRUE ); //AA + } + + InitJa25StrategicAi( ); +#endif + + +#ifdef JA2UB + ////if ( gGameUBOptions.InitTownLoyalty_UB == TRUE ) + InitTownLoyalty(); //Ja25 no loyalty +#else + // init town loyalty + InitTownLoyalty(); //Ja25 no loyalty +#endif // init the mine management system InitializeMines(); // initialize map screen flags @@ -453,6 +490,9 @@ void InitStrategicLayer( void ) // re-set up leave list arrays for dismissed mercs InitLeaveList( ); + #ifdef JA2UB + LuaInitStrategicLayer(0); //JA25 UB InitStrategicLayer.lua + #endif // reset time compression mode to X0 (this will also pause it) SetGameTimeCompressionLevel( TIME_COMPRESS_X0 ); @@ -472,6 +512,16 @@ void ShutdownStrategicLayer() DeleteAllStrategicEvents(); RemoveAllGroups(); TrashUndergroundSectorInfo(); + +#ifdef JA2UB +//Ja25 No creatures +//Ja25 No strategic ai +#else + DeleteCreatureDirectives(); + + KillStrategicAI(); + +#endif DeleteCreatureDirectives(); KillStrategicAI(); ClearTacticalMessageQueue(); @@ -486,9 +536,26 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) gubScreenCount = 0; return( TRUE ); } + + //reset autosave + AutoSaveToSlot[0] = FALSE; + AutoSaveToSlot[1] = FALSE; + AutoSaveToSlot[2] = FALSE; + AutoSaveToSlot[3] = FALSE; + AutoSaveToSlot[4] = FALSE; + +#ifdef JA2UB +//Ja25 no meanwhiles +#else // reset meanwhile flags uiMeanWhileFlags = 0; +#endif + +#ifdef JA2UB +fFirstTimeInMapScreen = TRUE; +#endif + // Reset the selected soldier gusSelectedSoldier = NOBODY; @@ -528,7 +595,12 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) { //Init all the arms dealers inventory InitAllArmsDealers(); - InitBobbyRayInventory(); +#ifdef JA2UB + if ( gGameUBOptions.fBobbyRSite == TRUE ) + InitBobbyRayInventory(); //Ja25 UB +#else + InitBobbyRayInventory(); +#endif } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: clearing messages"); @@ -625,8 +697,16 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) ResetHeliSeats( ); #ifdef LUA_GAME_INIT_NEW_GAME - LetLuaGameInit(0); + + LetLuaGameInit(0); + + #ifdef JA2UB + InitCustomStrategicLayer ( ); + #endif #else + #ifdef JA2UB + + #else INT32 iStartingCash; // Setup two new messages! @@ -675,7 +755,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) // Setup initial money AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash ); - + #endif #endif UINT32 uiDaysTimeMercSiteAvailable = Random( 2 ) + 1; @@ -700,6 +780,22 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) gubScreenCount = 1; +#ifdef JA2UB + //ja25 ub + //Init the initial hweli crash sequence variable + if ( gGameUBOptions.InGameHeli == FALSE ) + InitializeHeliGridnoAndTime( FALSE ); + + //If tex is in the game ( John is NOT in the game ) + //if( gJa25SaveStruct.fJohnKulbaIsInGame == FALSE ) + //{ + //make sure Betty offers his videos for sale + //AddTexsVideosToBettysInventory(); + //} + + InitJerryMiloInfo(); //JA25 UB +#endif + //Set the fact the game is in progress gTacticalStatus.fHasAGameBeenStarted = TRUE; diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 69e0f447..a34ce89a 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -26,6 +26,9 @@ #include "SaveLoadGame.h" #include "GameSettings.h" #include "connect.h" +#include "Options Screen.h" +#include "SaveLoadScreen.h" +#include "Text.h" // HEADROCK HAM 3.5: Add facility code for hourly update of detection levels #include "Facilities.h" @@ -34,7 +37,11 @@ void HourlyLarryUpdate( void ); extern INT32 GetCurrentBalance( void ); extern void PayOffSkyriderDebtIfAny( ); +#ifdef JA2UB +//no UB +#else void HourlyCheckIfSlayAloneSoHeCanLeave(); +#endif void UpdateRegenCounters( void ); @@ -48,6 +55,7 @@ void HandleMinuteUpdate() void HandleHourlyUpdate() { +CHAR16 zString[128]; //if the game hasnt even started yet ( we havent arrived in the sector ) dont process this if ( DidGameJustStart() ) return; @@ -87,9 +95,11 @@ void HandleHourlyUpdate() HourlyQuestUpdate(); HourlyLarryUpdate(); - +#ifdef JA2UB +// no UB +#else HourlyCheckIfSlayAloneSoHeCanLeave(); - +#endif // WDS - New AI HourlyCheckStrategicAI(); @@ -100,9 +110,96 @@ void HandleHourlyUpdate() UpdateRegenCounters(); } - if ((gGameExternalOptions.autoSaveTime != 0) && - (GetWorldHour() % gGameExternalOptions.autoSaveTime == 0)) { - SaveGame( SAVE__TIMED_AUTOSAVE, L"Auto Save" ); + // WANNE: This check should avoid the resaving of a loaded auto-save game, when entering tactical + BOOLEAN doAutoSave = TRUE; + if (lastLoadedSaveGameDay == GetWorldDay() && lastLoadedSaveGameHour == GetWorldHour() ) + { + doAutoSave = FALSE; + } + + if (doAutoSave) + { + if ( AutoSaveToSlot[1] == FALSE && AutoSaveToSlot[2] == FALSE && AutoSaveToSlot[3] == FALSE && AutoSaveToSlot[4] == FALSE ) + AutoSaveToSlot[0] = TRUE; + + if ((gGameExternalOptions.autoSaveTime != 0) && (GetWorldHour() % gGameExternalOptions.autoSaveTime == 0)) + { + if ( AutoSaveToSlot[0] == TRUE ) + { + if( CanGameBeSaved() ) + { + guiPreviousOptionScreen = guiCurrentScreen; + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT ],SAVE__TIMED_AUTOSAVE_SLOT1); + DoAutoSave(SAVE__TIMED_AUTOSAVE_SLOT1,zString); + } + + AutoSaveToSlot[0] = FALSE; + AutoSaveToSlot[1] = TRUE; + AutoSaveToSlot[2] = FALSE; + AutoSaveToSlot[3] = FALSE; + AutoSaveToSlot[4] = FALSE; + } + else if ( AutoSaveToSlot[1] == TRUE ) + { + if( CanGameBeSaved() ) + { + guiPreviousOptionScreen = guiCurrentScreen; + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT ],SAVE__TIMED_AUTOSAVE_SLOT2); + DoAutoSave(SAVE__TIMED_AUTOSAVE_SLOT2,zString); + } + + AutoSaveToSlot[0] = FALSE; + AutoSaveToSlot[1] = FALSE; + AutoSaveToSlot[2] = TRUE; + AutoSaveToSlot[3] = FALSE; + AutoSaveToSlot[4] = FALSE; + } + else if ( AutoSaveToSlot[2] == TRUE ) + { + if( CanGameBeSaved() ) + { + guiPreviousOptionScreen = guiCurrentScreen; + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT ],SAVE__TIMED_AUTOSAVE_SLOT3); + DoAutoSave(SAVE__TIMED_AUTOSAVE_SLOT3,zString); + } + + AutoSaveToSlot[0] = FALSE; + AutoSaveToSlot[1] = FALSE; + AutoSaveToSlot[2] = FALSE; + AutoSaveToSlot[3] = TRUE; + AutoSaveToSlot[4] = FALSE; + } + else if ( AutoSaveToSlot[3] == TRUE ) + { + if( CanGameBeSaved() ) + { + guiPreviousOptionScreen = guiCurrentScreen; + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT ],SAVE__TIMED_AUTOSAVE_SLOT4); + DoAutoSave(SAVE__TIMED_AUTOSAVE_SLOT4,zString); + } + AutoSaveToSlot[0] = FALSE; + AutoSaveToSlot[1] = FALSE; + AutoSaveToSlot[2] = FALSE; + AutoSaveToSlot[3] = FALSE; + AutoSaveToSlot[4] = TRUE; + + } + else if ( AutoSaveToSlot[4] == TRUE ) + { + if( CanGameBeSaved() ) + { + guiPreviousOptionScreen = guiCurrentScreen; + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_AUTOSAVE_TEXT ],SAVE__TIMED_AUTOSAVE_SLOT5); + DoAutoSave(SAVE__TIMED_AUTOSAVE_SLOT5,zString); + } + AutoSaveToSlot[0] = TRUE; + AutoSaveToSlot[1] = FALSE; + AutoSaveToSlot[2] = FALSE; + AutoSaveToSlot[3] = FALSE; + AutoSaveToSlot[4] = FALSE; + + } + } } } @@ -343,7 +440,9 @@ void HourlyLarryUpdate( void ) } } - +#ifdef JA2UB +// no JA25 UB +#else void HourlyCheckIfSlayAloneSoHeCanLeave() { SOLDIERTYPE *pSoldier; @@ -368,4 +467,5 @@ void HourlyCheckIfSlayAloneSoHeCanLeave() TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING_NO_ASK_EQUIP, 0, 0 ); } } -} \ No newline at end of file +} +#endif diff --git a/Strategic/Ja25 Strategic Ai.cpp b/Strategic/Ja25 Strategic Ai.cpp new file mode 100644 index 00000000..a107eb05 --- /dev/null +++ b/Strategic/Ja25 Strategic Ai.cpp @@ -0,0 +1,2940 @@ +#include "builddefines.h" + +#ifdef PRECOMPILEDHEADERS + #include "Strategic All.h" + #include "Loading Screen.h" + #include "Enemy Soldier Save.h" + #include "points.h" +#else + #include "strategicmap.h" + #include "strategic.h" + #include "Strategic Mines.h" + #include "types.h" + #include "memory.h" + #include + #include + #include + #include + #include "jascreens.h" + #include "worlddef.h" + #include "Soldier Control.h" + #include "overhead.h" + #include "interface panels.h" + #include "isometric utils.h" + #include "Ambient Control.h" + #include "worlddef.h" + #include "worlddat.h" + #include "text.h" + #include "Soldier add.h" + #include "soldier macros.h" + #include "Strategic Pathing.h" + #include "soldier create.h" + #include "handle UI.h" + #include "faces.h" + #include "renderworld.h" + #include "gamescreen.h" + #include "game clock.h" + #include "Soldier Init List.h" + #include "strategic turns.h" + #include "merc entering.h" + #include "Map Information.h" + #include "Assignments.h" + #include "message.h" + #include "Font Control.h" + #include "environment.h" + #include "Game Events.h" + #include "quests.h" + #include "FileMan.h" + #include "animated progressbar.h" + #include "music control.h" + #include "fade screen.h" + #include "Strategic Movement.h" + #include "Campaign Types.h" + #include "sys globals.h" + #include "Exit Grids.h" + #include "Tactical Save.h" + #include "pathai.h" + #include "animation control.h" + #include "squads.h" + #include "worldman.h" + #include "Overhead.h" + #include "Strategic Town Loyalty.h" + #include "Queen Command.h" + #include "cursor control.h" + #include "PreBattle Interface.h" + #include "Shade Table Util.h" + #include "Scheduling.h" + #include "gameloop.h" + #include "Random.h" + #include "ai.h" + #include "opplist.h" + #include "keys.h" + #include "Tactical Placement GUI.h" + #include "Map Screen Helicopter.h" + #include "map edgepoints.h" + #include "Player Command.h" + #include "Event Pump.h" + #include "meanwhile.h" + #include "air raid.h" + #include "Strategic Mines.h" + #include "Creature Spreading.h" + #include "SaveLoadMap.h" + #include "Militia Control.h" + #include "gamesettings.h" + #include "dialogue control.h" + #include "Town Militia.h" + #include "sysutil.h" + #include "Sound Control.h" + #include "points.h" + #include "render dirty.h" + #include "Debug Control.h" + #include "expat.h" + #include "Loading Screen.h" + #include "Queen Command.h" + #include "Enemy Soldier Save.h" + #include "Boxing.h" + #include "NPC.h" + #include "Strategic Event Handler.h" + #include "MessageBoxScreen.h" + #include "interface dialogue.h" + #include "Map Screen Interface.h" + #include "history.h" + #include "Bullets.h" + #include "physics.h" + #include "Explosion Control.h" + #include "Auto Resolve.h" + #include "cursors.h" +#endif + +#ifdef JA2UB + +#include "Ja25Update.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "SaveLoadGame.h" +#include "Campaign.h" +#include "Strategic Status.h" +#include "ub_config.h" +//** Defines ******************************************************************* + +#define JA25_SECTOR_H7_INITIAL_ATTACK ( 7 * 60 + 10 ) + +#define JA25_TIME_BETWEEN_SAI_UPDATES_EASY ( 60 * 5 ) +#define JA25_TIME_BETWEEN_SAI_UPDATES_NORMAL ( 60 * 3 ) +#define JA25_TIME_BETWEEN_SAI_UPDATES_HARD ( 60 * 2 ) + +#define JA25_SAI_RANDOM_TIME ( 60 * 2 ) + +#define JA25_MINIMUM_TIME_BETWEEN_ATTACKS ( 4 * 60 ) //4 hours + +#define JA25_SAI_DEBUG_FILE "JA25AiDebug.rtf" + + +//** Global Variables ********************************************************* + +//extern UINT32 guiSaveGameVersion; + +INT32 giNumJA25Sectors = NUM_CAMPAIGN_JA25_SECTORS; + + +JA25_SAVE_INFO gJa25SaveStruct; + +JA25_SECTOR_AI gJa25AiSectorStruct[CUSTOMSECTOR]; //*gJa25AiSectorStruct = NULL; + +JA25_SECTOR_AI_MANAGER gJa25StrategicAi; + + +//BOOLEAN gfEnemyShouldImmediatelySeekThePlayer=FALSE; + +//** Prototypes **************************************************************** + +//extern UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ, BOOLEAN fCampaignSector ); + + +BOOLEAN AddEnemiesToInitialSectorH7(); +UINT32 GetNumberOfJA25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 *pNumAdmins, UINT8 *pNumTroops, UINT8 *pNumElites ); +void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); + +void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); +void InitJa25InitialEnemiesInSector(); +void InitJa25UnderGroundSectors(); +void InitNumberOfEnemiesInAboveGroundSectors( ); +void InitNumberOfEnemiesInUnderGroundSectors( ); +void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8 bBloodCatPlacements ); +void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); + +void ResetJa25SectorProbabilities(); +BOOLEAN InitJa25StrategicSectorAI( BOOLEAN fReset ); + + +BOOLEAN HandleAddingEnemiesToSector( INT16 sSaiSector, UINT8 ubNumEnemies, INT8 bAttackDirection, INT16 sGridNo ); +BOOLEAN HandleAddEnemiesToSectorPlayerIsntIn( INT16 sSaiSector, UINT8 ubNumEnemies ); +void Ja25SAI_DetermineWhichLevelToAttackFrom( INT16 sSaiSector, INT16 *psSector, INT8 *pbLevel ); + +BOOLEAN AreAllPlayerMercTraversingBetweenSectors(); + +UINT32 GetMinimumTimeBetweenAttacks(); + +void InitJohnKulbaInitialSector(); + +void FixEnemyCounterInSectorBug(); + +void AddEnemiesToFirstTunnelSector(); +void AddEnemiesToSecondTunnelSector(); +UINT8 NumEnemiesToAttackFirstTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites ); +UINT8 NumEnemiesToAttackSecondTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites ); +void RemoveAllEnemySoldierInitListLinks(); +INT16 GetGridNoEnemyWillSeekWhenAttacking( INT8 bSaiSector ); +void SetH11NumEnemiesInSector(); +BOOLEAN HaveMercsEverBeenInComplex(); +#ifdef JA2BETAVERSION +BOOLEAN Ja25BetaDateToInvalidateExe(); +#endif +//ppp +//void CopyJa25SectorAiData( JA25_SECTOR_AI *pDest, JA25_SECTOR_AI *pSource ); + +#ifdef JA2BETAVERSION + BOOLEAN RecordJa25StrategicAiDecisions( INT16 sSectorAttacked, UINT8 ubNumEnemies ); + BOOLEAN OutputJA25SaiString( HWFILE hFile, CHAR *pString ); +#endif + + + +//** Functions **************************************************************** + + + +UINT32 GetNumberOfJA25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 *pNumAdmins, UINT8 *pNumTroops, UINT8 *pNumElites ) +{ + SECTORINFO *pSector; + + //if it is above ground + if( bSectorZ == 0 ) + { + pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ]; + + *pNumAdmins = pSector->ubNumAdmins; + *pNumTroops = pSector->ubNumTroops; + *pNumElites = pSector->ubNumElites; + } + else + { + UNDERGROUND_SECTORINFO *pSector; + + pSector = FindUnderGroundSector( sSectorX, sSectorY, bSectorZ ); + if( pSector ) + { + *pNumAdmins = pSector->ubNumAdmins; + *pNumTroops = pSector->ubNumTroops; + *pNumElites = pSector->ubNumElites; + } + } + + return( 0 ); +} + +void InitJa25StrategicAi() +{ + //Initialize the array of new gun quotes + InitNewGunArray(); +/* + #ifdef ENABLE_CUSTOM_MAP_INTERFACE + //if the player is using a CUSTOM MAP SCENARIO disable the S.A.I. + if( gJa25SaveStruct.fInCustomMap ) + { + return; + } + #endif + + #ifdef JA2BETAVERSION + InitJa25StrategicAiDecisions( FALSE ); + #endif +*/ + // Init and memset AI struct +// giNumJA25Sectors = NUM_CAMPAIGN_JA25_SECTORS; +// gJa25AiSectorStruct = MemAlloc( sizeof( JA25_SAVE_INFO ) * giNumJA25Sectors ); +// memset( gJa25AiSectorStruct, 0, sizeof( JA25_SAVE_INFO ) * giNumJA25Sectors ); + + + //add event at 7:03 + if ( gGameUBOptions.EventAttackInitialSectorIfPlayerStillThere == TRUE ) + { + AddSameDayStrategicEvent( EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE, JA25_SECTOR_H7_INITIAL_ATTACK, 0 ); + AddEveryDayStrategicEventUsingSeconds(EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE,JA25_SECTOR_H7_INITIAL_ATTACK * 60,0); + } + + //Init the underground sectors ( add them to the list of under ground ) + InitJa25UnderGroundSectors(); + + //Init the # of enemies in all the sectors + InitJa25InitialEnemiesInSector(); + + //Init the Ja215 Stratigic AI + InitJa25StrategicSectorAI( TRUE ); + + gStrategicStatus.ubHighestProgress = CurrentPlayerProgressPercentage(); + + //InitJohnKulbaInitialSector(); // wy³¹czone, skrypt lua +} + + +BOOLEAN ShouldEnemiesBeAddedToInitialSector() +{ + //if there are still players in the first sector + if( gfWorldLoaded && + gWorldSectorX == JA2_5_START_SECTOR_X && + gWorldSectorY == JA2_5_START_SECTOR_Y && + AreAnyPlayerMercsStillInSector( JA2_5_START_SECTOR_X, JA2_5_START_SECTOR_Y, 0 ) ) + { + //add enemies to the initial sector + if( !AddEnemiesToInitialSectorH7() ) + { + Assert( 0 ); + + return( FALSE ); + } + } + + return( TRUE ); +} + +BOOLEAN AddEnemiesToInitialSectorH7() +{ + GROUP *pGroup; + UINT8 ubSector; + UINT32 uiWorldMin; + + UINT8 ubNumAdmins; + UINT8 ubNumTroops; + UINT8 ubNumElites; + + UINT8 ubNumRemovedAdmins=0; + UINT8 ubNumRemovedTroops=0; + UINT8 ubNumRemovedElites=0; + + ubSector = SECTOR( JA2_5_START_SECTOR_X, JA2_5_START_SECTOR_Y ); + + //Get the number of enemies in the guard post sector + GetNumberOfJA25EnemiesInSector( 8, MAP_ROW_H, 0, &ubNumAdmins, &ubNumTroops, &ubNumElites ); + + + //determine the #of enemies to travel to the initial heli sector + if( ubNumAdmins > 1 ) + ubNumRemovedAdmins = ubNumAdmins / 3 + Random( 3 ); + + if( ubNumTroops > 1 ) + ubNumRemovedTroops = ubNumTroops / 3 + Random( 3 ); + + if( ubNumElites > 1 ) + ubNumRemovedElites = ubNumElites / 3 + + Random( 3 ); + + //deduct the # that are moving from the # in the guard post sector +// SetNumberJa25EnemiesInSurfaceSector( SEC_H8, (UINT8)(ubNumAdmins-ubNumRemovedAdmins), (UINT8)(ubNumTroops-ubNumRemovedTroops), (UINT8)(ubNumElites-ubNumRemovedElites) ); + SetNumberJa25EnemiesInSector( 8, MAP_ROW_H, 0, (UINT8)(ubNumAdmins-ubNumRemovedAdmins), (UINT8)(ubNumTroops-ubNumRemovedTroops), (UINT8)(ubNumElites-ubNumRemovedElites) ); + + uiWorldMin = GetWorldTotalMin(); + + pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+1, ubNumRemovedAdmins, ubNumRemovedTroops, ubNumRemovedElites ); + + if( pGroup == NULL ) + { + Assert( 0 ); + return( FALSE ); + } + + //Set the sector to attack + pGroup->ubNextX = (UINT8)JA2_5_START_SECTOR_X; + pGroup->ubNextY = (UINT8)JA2_5_START_SECTOR_Y; + + pGroup->uiTraverseTime = 10; + + pGroup->pEnemyGroup->ubIntention = ASSAULT; + + SetGroupArrivalTime( pGroup, uiWorldMin+1 ); + + pGroup->ubMoveType = ONE_WAY; + + +// AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ); + AddAdvancedStrategicEvent( ONETIME_EVENT, EVENT_GROUP_ARRIVAL, GetWorldTotalSeconds( ) + 1, pGroup->ubGroupID ); + + return( TRUE ); +} + +BOOLEAN AreAnyPlayerMercsStillInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) +{ + INT32 iCnt; + + for( iCnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCnt++ ) + { + if( MercPtrs[ iCnt ]->bActive ) + { + if( MercPtrs[ iCnt ]->sSectorX == sSectorX && + MercPtrs[ iCnt ]->sSectorY == sSectorY && + MercPtrs[ iCnt ]->bSectorZ == bSectorZ ) + { + return( TRUE ); + } + } + } + + return( FALSE ); +} + + +void InitJa25InitialEnemiesInSector() +{ + // + // Set the number of enemies in each of the sectors + // + //InitNumberOfEnemiesInAboveGroundSectors( ); //wy³¹czono, skrypt lua + + //Below Ground + //InitNumberOfEnemiesInUnderGroundSectors( ); //wy³¹czono, skrypt lua +} + +void InitJa25UnderGroundSectors() +{ +/* UNDERGROUND_SECTORINFO *curr; + + //Under the mine ( i13 + curr = NewUndergroundNode( 13, 9, 1, TRUE ); + Assert( curr ); + + //under the power generator j13 + curr = NewUndergroundNode( 13, 10, 1, TRUE ); + Assert( curr ); + + //the tunnels J14, k14 + curr = NewUndergroundNode( 14, 10, 1, TRUE ); + Assert( curr ); + curr = NewUndergroundNode( 14, 11, 1, TRUE ); + Assert( curr ); + + //under the complex, K15, level 1 & 2 + curr = NewUndergroundNode( 15, 11, 1, TRUE ); + Assert( curr ); + curr = NewUndergroundNode( 15, 11, 2, TRUE ); + Assert( curr ); + + //under the complex, 2nd part, L15, level 2 & 3 + curr = NewUndergroundNode( 15, 12, 2, TRUE ); + Assert( curr ); + curr = NewUndergroundNode( 15, 12, 3, TRUE ); + Assert( curr ); +*/ +} + +void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ) +{ + //if its a ground level + + if( bSectorZ == 0 ) + { + SetNumberJa25EnemiesInSurfaceSector( SECTOR( sSectorX, sSectorY ), ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //its an underground level + else + { + SetNumberJa25EnemiesInUnderGroundSector( sSectorX, sSectorY, bSectorZ, ubNumAdmins, ubNumTroops, ubNumElites ); + } + +} + +void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ) +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ iSectorID ]; + pSector->ubNumAdmins = ubNumAdmins; + pSector->ubNumTroops = ubNumTroops; + pSector->ubNumElites = ubNumElites; +} + +void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8 bBloodCatPlacements ) +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ iSectorID ]; + pSector->bBloodCats = bNumBloodCats; + + pSector->bBloodCatPlacements = bBloodCatPlacements; +} + +void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ) +{ + UNDERGROUND_SECTORINFO *pSector=NULL; + + pSector = FindUnderGroundSector( sSectorX, sSectorY, bSectorZ ); + Assert( pSector ); + + //Set the values + pSector->ubNumAdmins = ubNumAdmins; + pSector->ubNumTroops = ubNumTroops; + pSector->ubNumElites = ubNumElites; +} + +void InitNumberOfEnemiesInAboveGroundSectors( ) +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + //H7 + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + } + SetNumberJa25EnemiesInSurfaceSector( SEC_H7, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + + + //SEC_H8: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 4 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 13 + Random( 3 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 16 + Random( 6 ); + ubNumElites = 2 + Random( 2 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 19 + Random( 9 ); + ubNumElites = 2 + Random( 2 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_H8, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //Guard Post + //SEC_H9: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 5 ); + ubNumElites = 1 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 16 + Random( 4 ); + ubNumElites = 1 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 19 + Random( 4 ); + ubNumElites = 3 + Random( 2 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 19 + Random( 6 ); + ubNumElites = 3 + Random( 2 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_H9, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + // SEC_H10: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 5 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 9 + Random( 3 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 4 ); + ubNumElites = 2 + Random( 4 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 4 ); + ubNumElites = 2 + Random( 4 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_H10, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //SEC_H11 + SetH11NumEnemiesInSector(); + + + // SEC_I9: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 5 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 9 + Random( 4 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 4 ); + ubNumElites = 2 + Random( 4 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 6 ); + ubNumElites = 2 + Random( 4 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_I9, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //First part of town + // SEC_I10: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 13 + Random( 6 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 16 + Random( 4 ); + ubNumElites = 1 + Random( 3 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 14 + Random( 4 ); + ubNumElites = 5 + Random( 3 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 4 ); + ubNumElites = 5 + Random( 3 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_I10, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //Second part of town + //SEC_I11: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 14 + Random( 7 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 16 + Random( 5 ); + ubNumElites = 2 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 14 + Random( 4 ); + ubNumElites = 5 + Random( 4 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 17 + Random( 4 ); + ubNumElites = 5 + Random( 4 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_I11, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //SEC_I12: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 8 + Random( 6 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 12 + Random( 5 ); + ubNumElites = 2 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 12 + Random( 6 ); + ubNumElites = 3 + Random( 2 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 6 ); + ubNumElites = 3 + Random( 2 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_I12, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //Abandoned mine + // SEC_I13: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_I13, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + // SEC_J11: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 6 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 3 ); + ubNumElites = 3 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 11 + Random( 5 ); + ubNumElites = 6 + Random( 3 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 5 ); + ubNumElites = 6 + Random( 3 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_J11, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + // SEC_J12: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 12 + Random( 4 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 4 ); + ubNumElites = 1 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 11 + Random( 3 ); + ubNumElites = 3 + Random( 2 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 21 + Random( 3 ); + ubNumElites = 3 + Random( 2 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_J12, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //Power Generator, Ground Level + // SEC_J13: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 15 + Random( 6 ); + ubNumElites = 1 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 16 + Random( 5 ); + ubNumElites = 5 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 18 + Random( 4 ); + ubNumElites = 6 + Random( 3 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 18 + Random( 4 ); + ubNumElites = 7 + Random( 3 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_J13, ubNumAdmins, ubNumTroops, ubNumElites ); + } + + //Complex, Ground Level + // SEC_K15: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 14 + Random( 5 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 18 + Random( 3 ); + ubNumElites = 4 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 17 + Random( 3 ); + ubNumElites = 8 + Random( 2 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 17 + Random( 3 ); + ubNumElites = 8 + Random( 2 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_K15, ubNumAdmins, ubNumTroops, ubNumElites ); + } +} + +void InitNumberOfEnemiesInUnderGroundSectors( ) +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + //Mine Sector Level 1 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + } + SetNumberJa25EnemiesInSector( 13, 9, 1, ubNumAdmins, ubNumTroops, ubNumElites ); + + + //Power Generator Level 1 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + } + SetNumberJa25EnemiesInSector( 13, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites ); + + + //Tunnel First Part, Level 1 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + } + SetNumberJa25EnemiesInSector( 14, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites ); + + + //Tunnel Second Part, Level 1 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 0 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + } + SetNumberJa25EnemiesInSector( 14, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites ); + + + + //Complex, Level 1, K15 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 14 + Random( 6 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 14 + Random( 4 ); + ubNumElites = 4 + Random( 3 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 15 + Random( 4 ); + ubNumElites = 6 + Random( 4 ); + break; + } + SetNumberJa25EnemiesInSector( 15, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites ); + + + //Complex, Level 2, K15 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 3 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 15 + Random( 2 ); + ubNumElites = 5 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 12 + Random( 3 ); + ubNumElites = 10 + Random( 2 ); + break; + } + SetNumberJa25EnemiesInSector( 15, 11, 2, ubNumAdmins, ubNumTroops, ubNumElites ); + + + //Complex, Level 2, L15 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 12 + Random( 2 ); + ubNumElites = 1 + Random( 2 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 17 + Random( 2 ); + ubNumElites = 5 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 3 ); + ubNumElites = 14 + Random( 2 ); + break; + } + SetNumberJa25EnemiesInSector( 15, 12, 2, ubNumAdmins, ubNumTroops, ubNumElites ); + + + //Complex, Level 3, L15 + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 26 + Random( 0 ); + ubNumElites = 2 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 0 ); + ubNumElites = 8 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 13 + Random( 0 ); + ubNumElites = 15 + Random( 0 ); + break; + } + SetNumberJa25EnemiesInSector( 15, 12, 3, ubNumAdmins, ubNumTroops, ubNumElites ); +} + +void InitJa25SaveStruct() +{ + memset( &gJa25SaveStruct, 0, sizeof( JA25_SAVE_INFO ) ); + + gJa25SaveStruct.iPowerGenFanPositionSndID = -1; +} + + +BOOLEAN SaveJa25SaveInfoToSaveGame( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + UINT32 uiSize = sizeof( JA25_SAVE_INFO ); +// CHAR8 zString[512]; + + //Make sure struct is 1000 bytes in size +// sprintf( zString, "JA2 SaveInfo Struct != 1000, it is: %d", uiSize ); +// AssertMsg( uiSize == 1000, zString ); + + //Make sure struct is 32 bytes in size +// sprintf( zString, "AI manager != 32, it is: %d", sizeof( JA25_SECTOR_AI_MANAGER ) ); +// AssertMsg( sizeof( JA25_SECTOR_AI_MANAGER ) == 32, zString ); + + //Make sure struct is 840 bytes in size +// sprintf( zString, "AI sector Struct != 40, it is: %d", sizeof( JA25_SECTOR_AI ) ); +// AssertMsg( sizeof( JA25_SECTOR_AI ) == 40, zString ); + + + FileWrite( hFile, &gJa25SaveStruct, sizeof( JA25_SAVE_INFO ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( JA25_SAVE_INFO ) ) + { + return( FALSE ); + } + + + + // + // Ai Manager + // + FileWrite( hFile, &gJa25StrategicAi, sizeof( JA25_SECTOR_AI_MANAGER ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( JA25_SECTOR_AI_MANAGER ) ) + { + return( FALSE ); + } + + // + // Sector Info + // + + FileWrite( hFile, &gJa25AiSectorStruct, sizeof( JA25_SECTOR_AI ) * CUSTOMSECTOR , &uiNumBytesWritten ); //NUM_CAMPAIGN_JA25_SECTORS + if( uiNumBytesWritten != sizeof( JA25_SECTOR_AI ) * CUSTOMSECTOR ) //NUM_CAMPAIGN_JA25_SECTORS + { + return( FALSE ); + } + + // OK, now write out additional sectors + /* + { + INT32 iNumCustomSectors = giNumJA25Sectors - NUM_CAMPAIGN_JA25_SECTORS; + + // Write out # of additional sectors + FileWrite( hFile, &iNumCustomSectors, sizeof( iNumCustomSectors ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( iNumCustomSectors ) ) + { + return( FALSE ); + } +*/ +/* if ( iNumCustomSectors > 0 ) + { + FileWrite( hFile, &(gJa25AiSectorStruct[ NUM_CAMPAIGN_JA25_SECTORS ] ), sizeof( JA25_SECTOR_AI ) * iNumCustomSectors, &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( JA25_SECTOR_AI ) * iNumCustomSectors ) + { + return( FALSE ); + } + } +*/ +// } + + return( TRUE ); +} + + +BOOLEAN LoadJa25SaveInfoFromSavedGame( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + // Free old data +// if ( gJa25AiSectorStruct ) +// { +// MemFree( gJa25AiSectorStruct ); +// gJa25AiSectorStruct = NULL; +// } + + FileRead( hFile, &gJa25SaveStruct, sizeof( JA25_SAVE_INFO ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( JA25_SAVE_INFO ) ) + { + return( FALSE ); + } + + // + // Ai Manager + // + FileRead( hFile, &gJa25StrategicAi, sizeof( JA25_SECTOR_AI_MANAGER ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( JA25_SECTOR_AI_MANAGER ) ) + { + return( FALSE ); + } + + // + // Sector Info + // + + // Init array for campaign sectors +// giNumJA25Sectors = NUM_CAMPAIGN_JA25_SECTORS; +/// gJa25AiSectorStruct = MemAlloc( giNumJA25Sectors * sizeof( JA25_SECTOR_AI ) ); + + FileRead( hFile, &gJa25AiSectorStruct, sizeof( JA25_SECTOR_AI ) * CUSTOMSECTOR , &uiNumBytesRead ); //NUM_CAMPAIGN_JA25_SECTORS + if( uiNumBytesRead != sizeof( JA25_SECTOR_AI ) * CUSTOMSECTOR ) //NUM_CAMPAIGN_JA25_SECTORS + { + return( FALSE ); + } + +// FileRead( hFile, gJa25AiSectorStruct, sizeof( JA25_SECTOR_AI ) * NUM_CAMPAIGN_JA25_SECTORS, &uiNumBytesRead ); +// if( uiNumBytesRead != sizeof( JA25_SECTOR_AI ) * NUM_CAMPAIGN_JA25_SECTORS ) +// { +// return( FALSE ); +// } +/* + if( guiSaveGameVersion < 1008 ) + { + InitJa25StrategicSectorAI( FALSE ); + + gJa25StrategicAi.uiTimeOfLastBattleInMinutes = GetWorldTotalMin( ); + gJa25StrategicAi.uiTimeOfLastUpdate = gJa25StrategicAi.uiTimeOfLastBattleInMinutes; + + SectorInfo[ SEC_I13 ].ubNumTroops = 0; + FixEnemyCounterInSectorBug(); + } +*/ +/* if( guiSaveGameVersion < 1006 ) + { + InitJohnKulbaInitialSector(); + } + + if( guiSaveGameVersion < 1010 ) + { + gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote = -1; + } + + if( guiSaveGameVersion < 1011 ) + { + //Add the enemies to the new sector + SetH11NumEnemiesInSector(); + } +*/ + //for some reason the J13 level wasnt set up right +// if( guiSaveGameVersion < 1012 ) +// { + // + // J13: Power Generator, First Level + // +// gJa25AiSectorStruct[ JA25_J13_1 ].iSectorID = SEC_J13; +// gJa25AiSectorStruct[ JA25_J13_1 ].bSectorZ = 1; + + // + // I13: First Level of Mine + // +// gJa25AiSectorStruct[ JA25_I13_1 ].iSectorID = SEC_I13; +// gJa25AiSectorStruct[ JA25_I13_1 ].bSectorZ = 1; +// } + + + // ATE: At end, we added additional AI info.... +// if ( guiSaveGameVersion > 1012 ) +// { + // Read in ja25 AI information that is > # of custom maps.... + // UINT32 iNumCustomSectors; + + // FileRead( hFile, &iNumCustomSectors, sizeof( UINT32 ), &uiNumBytesRead ); + // if( uiNumBytesRead != sizeof( UINT32 ) ) + // { + // return( FALSE ); + // } + +// giNumJA25Sectors = giNumJA25Sectors + iNumCustomSectors; + + // if ( giNumJA25Sectors > 0 ) + // { + // if # > 0, realloc and read in +// gJa25AiSectorStruct = realloc( gJa25AiSectorStruct, giNumJA25Sectors * sizeof( JA25_SECTOR_AI ) ); +// FileRead( hFile, &(gJa25AiSectorStruct[ NUM_CAMPAIGN_JA25_SECTORS ] ), sizeof( JA25_SECTOR_AI ) * iNumCustomSectors, &uiNumBytesRead ); +// if( uiNumBytesRead != sizeof( JA25_SECTOR_AI ) * iNumCustomSectors ) + // { + // return( FALSE ); + // } + // } +// } + + gJa25SaveStruct.iPowerGenFanPositionSndID = -1; + + return( TRUE ); +} + +void InitJa25StrategicAiBloodcats( ) +{ + INT8 bNumBloodCats=0; + + + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + bNumBloodCats = 3; + break; + case DIF_LEVEL_MEDIUM: + bNumBloodCats = 4; + break; + case DIF_LEVEL_HARD: + bNumBloodCats = 5; + break; + } + SetNumberOfJa25BloodCatsInSector( SEC_I10, bNumBloodCats, 5 ); +} + + +void HandleAddingEnemiesToTunnelMaps() +{ + BOOLEAN fInCombat = ( gTacticalStatus.uiFlags & INCOMBAT ); + UINT8 ubNumEnemies=0; + + //if the player has been in the complex + if( HaveMercsEverBeenInComplex() ) + { + //dont add any enemies to the tunnel maps + return; + } + + //if the player IS NOT in either of the tunnel sectors + if( !AreAnyPlayerMercsStillInSector( 14, 10, 1 ) && + !AreAnyPlayerMercsStillInSector( 14, 11, 1 ) ) + { + AddEnemiesToJa25TunnelMaps(); + } + + //else if the player IS NOT in the 2nd sector but in the first sector + else if( AreAnyPlayerMercsStillInSector( 14, 10, 1 ) && + !AreAnyPlayerMercsStillInSector( 14, 11, 1 ) ) + { + ubNumEnemies = NumEnemiesToAttackFirstTunnelSector( NULL, NULL, NULL ); + + //Add enemies to the first sector + HandleAddEnemiesToSectorPlayerIsntIn( JA25_J14_1, ubNumEnemies ); + + //Remember to move the enemies to be in the entrance to the tunnel + SetJa25GeneralFlag( JA_GF__MOVE_ENEMIES_TO_EDGE_IN_TUNNEL_1 ); + + AddEnemiesToSecondTunnelSector(); + } + + //else if the player is in the second sector + else if( AreAnyPlayerMercsStillInSector( 14, 11, 1 ) ) + { + ubNumEnemies = NumEnemiesToAttackSecondTunnelSector( NULL, NULL, NULL ); + + //Add enemies to the first sector + HandleAddEnemiesToSectorPlayerIsntIn( JA25_K14_1, ubNumEnemies ); + + //Remember to move the enemies to be in the entrance to the tunnel + SetJa25GeneralFlag( JA_GF__MOVE_ENEMIES_TO_EDGE_IN_TUNNEL_2 ); + } +} + +void AddEnemiesToJa25TunnelMaps() +{ + if( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH ) + { + //if the player blew up the fan, add a ton of enemies to the sector + AddEnemiesToFirstTunnelSector(); + + AddEnemiesToSecondTunnelSector(); + } + else if( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_STOPPED_FAN_TO_GET_THROUGH ) + { + } +} + +void AddEnemiesToFirstTunnelSector() +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + NumEnemiesToAttackFirstTunnelSector( &ubNumAdmins, &ubNumTroops, &ubNumElites ); + + SetNumberJa25EnemiesInSector( 14, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites ); +} + +void AddEnemiesToSecondTunnelSector() +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + NumEnemiesToAttackSecondTunnelSector( &ubNumAdmins, &ubNumTroops, &ubNumElites ); + SetNumberJa25EnemiesInSector( 14, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites ); +} + +UINT8 NumEnemiesToAttackFirstTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites ) +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + //if the player blew up the fan, add a ton of enemies to the sector + //1st Tunnel Sector + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 0 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 0 ); + ubNumElites = 1 + Random( 0 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 4 + Random( 0 ); + ubNumElites = 4 + Random( 0 ); + break; + } + + if( pAdmins ) + *pAdmins = ubNumAdmins; + + if( pTroops ) + *pTroops = ubNumTroops; + + if( pElites ) + *pElites = ubNumElites; + + return( ubNumAdmins + ubNumTroops + ubNumElites ); +} + +UINT8 NumEnemiesToAttackSecondTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites ) +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + //if the player blew up the fan, add a ton of enemies to the sector + //1st Tunnel Sector + //2nd Tunnel Sector + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 7 + Random( 2 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 2 ); + ubNumElites = 2 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 6 + Random( 0 ); + ubNumElites = 4 + Random( 3 ); + break; + } + + if( pAdmins ) + *pAdmins = ubNumAdmins; + if( pTroops ) + *pTroops = ubNumTroops; + if( pElites ) + *pElites = ubNumElites; + + return( ubNumAdmins + ubNumTroops + ubNumElites ); +} + + + +void SetJa25GeneralFlag( UINT32 uiFlagToSet ) +{ + gJa25SaveStruct.uiJa25GeneralFlags |= uiFlagToSet; +} + +void ClearJa25GeneralFlag( UINT32 uiFlagToClear ) +{ + gJa25SaveStruct.uiJa25GeneralFlags &= ~uiFlagToClear; +} + +BOOLEAN IsJa25GeneralFlagSet( UINT32 uiFlagToCheck ) +{ + return( ( gJa25SaveStruct.uiJa25GeneralFlags & uiFlagToCheck ) != 0 ); +} + +BOOLEAN InitJa25StrategicSectorAI( BOOLEAN fReset ) +{ + if( fReset ) + { + //Clear out the structures first + memset( &gJa25StrategicAi, 0, sizeof( JA25_SECTOR_AI_MANAGER ) ); +/* + MemFree( gJa25AiSectorStruct ); + giNumJA25Sectors = NUM_CAMPAIGN_JA25_SECTORS; + gJa25AiSectorStruct = MemAlloc( sizeof( JA25_SAVE_INFO ) * giNumJA25Sectors ); + memset( gJa25AiSectorStruct, 0, sizeof( JA25_SAVE_INFO ) * giNumJA25Sectors ); +*/ + } + + //Init the sector values + if( !InitJa25SectorAi() ) + { + return( FALSE ); + } + + gJa25StrategicAi.uiTimeOfLastBattleInMinutes = /*STARTING_TIME*/ gGameExternalOptions.iGameStartingTime / 60 + gGameExternalOptions.iFirstArrivalDelay /*FIRST_ARRIVAL_DELAY*/ / 60; + gJa25StrategicAi.uiTimeOfLastUpdate = gJa25StrategicAi.uiTimeOfLastBattleInMinutes; + + //The player owns the starting sector + //gJa25AiSectorStruct[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fPlayerControlled = TRUE; + + SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; + + + return( TRUE ); +} + + +BOOLEAN InitJa25SectorAi() +{ +UINT32 ubCnt; + // + // H7: Initial sector + // +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + + for( ubCnt=0; ubCnt uiCurrentTime ) + { + //get out + return( FALSE ); + } + + return( TRUE ); +} + + +BOOLEAN Ja25_AreEnemiesAbleToAttackSector( INT16 iSectorID, INT8 bSectorZ ) +{ + //Can the strategic ai attack + if( !CanJa25SaiAttack() ) + { + //get out + return( FALSE ); + } + + // + // All Checks Failed, therefore, enemies can attack + // + + return( TRUE ); +} + + +void Ja25_UpdateTimeOfEndOfLastBattle( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) +{ + // + // Reset timers + // + gsGridNoForMapEdgePointInfo = -1; + gJa25StrategicAi.uiTimeOfLastBattleInMinutes = GetWorldTotalMin( ); + + gJa25StrategicAi.uiTimeOfLastUpdate = GetWorldTotalMin( ); + + ResetJa25SectorProbabilities(); + + gJa25SaveStruct.fEnemyShouldImmediatelySeekThePlayer = FALSE; + gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy = -1; + +} + + +void ResetJa25SectorProbabilities() +{ +/* INT8 bCnt; + + //loop through the array + for( bCnt=0; bCnt< giNumJA25Sectors; bCnt++ ) + { + //if the SAI did the attack ( the varible only gets set when SAI is attacking + if( gJa25SaveStruct.fEnemyShouldImmediatelySeekThePlayer ) + { + gJa25AiSectorStruct[ bCnt ].bCurrentProbability = gJa25AiSectorStruct[ bCnt ].bCurrentProbability / 2; + } + else + { + gJa25AiSectorStruct[ bCnt ].bCurrentProbability = 0; + } + } +*/ +} + + +//returns the element into the array of which sector the enemy will attack +INT8 GetTheFurthestSectorPlayerOwns() +{ + INT8 bCnt; + BOOLEAN fFoundLatest=FALSE; + INT8 bSector=-1; + +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + //Loop through from the end of the list + for( bCnt=giNumJA25Sectors-1; bCnt>=0; bCnt-- ) + { + if( gJa25AiSectorStruct[ bCnt ].fPlayerControlled ) + { + fFoundLatest = TRUE; + break; + } + } + + if( fFoundLatest ) + { + //do sector specific logic to determine the sector + //switch( bCnt ) + //{ + //default: + bSector = bCnt; + //break; + //} + } + +} + //There is no sector + return( bSector ); +} + + +void SetJa25SectorOwnedStatus( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fPlayerOwned ) +{ + INT8 bSector; + + if ( gGameUBOptions.pJA2UB == TRUE ) + { + //get the sector id + bSector = (INT8)GetJA25SectorID( sSectorX, sSectorY, bSectorZ ); + + //if it failed to find this array + if( bSector == -1 ) + { + //if this is the new sector + if( sSectorX == 11 && sSectorY == 8 && bSectorZ == 0 ) + { + //If its the end of combat mode, update sai timers + Ja25_UpdateTimeOfEndOfLastBattle( sSectorX, sSectorY, bSectorZ ); + } + else + { + //If its the end of combat mode, update sai timers + Ja25_UpdateTimeOfEndOfLastBattle( sSectorX, sSectorY, bSectorZ ); + return; + } + return; + } + + if( NumEnemiesInAnySector( sSectorX, sSectorY, bSectorZ ) != 0 ) + { + return; + } + + gJa25AiSectorStruct[ bSector ].fPlayerControlled = fPlayerOwned; + + //if its the players that is doing the taking over + if( fPlayerOwned ) + { + //Remeber that the player has Liberated this sector before + gJa25AiSectorStruct[ bSector ].fPlayerHasLiberatedSectorBefore = TRUE; + } + + //If its the end of combat mode, update sai timers + Ja25_UpdateTimeOfEndOfLastBattle( sSectorX, sSectorY, bSectorZ ); + + //if this is sector H8 + if( sSectorX == 8 && sSectorY == MAP_ROW_H && bSectorZ == 0 ) + { + AddStrategicEvent( EVENT_SECTOR_H8_DONT_WAIT_IN_SECTOR, GetWorldTotalMin() + ( 5 * 60 ), 0 ); + } + + } + +} + + +INT16 GetJA25SectorID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) +{ + INT8 bCnt=0; + INT16 sSector = 0; + +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + + if ( gJa25AiSectorStruct == NULL ) + { + return( -1 ); + } + + if( sSectorX == -1 || sSectorY == -1 ) + { + return( -1 ); + } + + sSector = SECTOR( sSectorX, sSectorY ); + + //loop through the array + for( bCnt=0; bCnt< giNumJA25Sectors; bCnt++ ) + { + //if this is the right sector + if( gJa25AiSectorStruct[ bCnt ].iSectorID == sSector && gJa25AiSectorStruct[ bCnt ].bSectorZ == bSectorZ ) + { + //return the array element + return( bCnt ); + } + } +} + //failed to find the array + return( -1 ); +} + + +BOOLEAN GetSectorJa25SaiWillAttack( INT8 *pbSectorToAttack, INT8 *pbFromDirection, INT16 *psGridNo ) +{ + INT8 bSectorToAttackID=-1; + INT8 bFurthestPlayerSector=-1; + INT8 bAttackDirection=-1; + INT16 sGridNo=-1; + + *pbSectorToAttack = -1; + *pbFromDirection = -1; + *psGridNo = -1; + + return( TRUE ); +} + + + +void JA25_HandleUpdateOfStrategicAi() +{ + UINT32 uiCurrentTime=0; + INT8 bSectorToAttackID=-1; + INT8 bAttackDirection=-1; + INT8 bRandom=0; + INT16 sGridNo=-1; + +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + if ( !gJa25AiSectorStruct ) + { + return; + } + + uiCurrentTime = GetWorldTotalMin( ); + + //if the ai cannot currently attack + if( !CanJa25SaiAttack() ) + { + return; + } + + //if it isnt time to update + if( ( uiCurrentTime - gJa25StrategicAi.uiTimeOfLastUpdate ) < GetMinimumTimeBetweenAttacks() ) + { + return; + } + + //Remeber that we are updating + gJa25StrategicAi.uiTimeOfLastUpdate = uiCurrentTime; + + +// gJa25StrategicAi.uiTimeOfLastBattleInMinutes + + //Get the sector the enemies will attack from + if( !GetSectorJa25SaiWillAttack( &bSectorToAttackID, &bAttackDirection, &sGridNo ) ) + { + return; + } + + //Increment the probabilty of attacking + gJa25AiSectorStruct[ bSectorToAttackID ].bCurrentProbability += gJa25AiSectorStruct[ bSectorToAttackID ].bProbabilityOfAttacking; + + //if we are above the maximum amount + if( gJa25AiSectorStruct[ bSectorToAttackID ].bCurrentProbability > gJa25AiSectorStruct[ bSectorToAttackID ].bMaxProbabilityForAttackingSector ) + { + gJa25AiSectorStruct[ bSectorToAttackID ].bCurrentProbability = gJa25AiSectorStruct[ bSectorToAttackID ].bMaxProbabilityForAttackingSector; + } + + //Debug Check to see if the date is valid +#ifdef JA2BETAVERSION +// if( !Ja25BetaDateToInvalidateExe() ) +// { +// Assert( 0 ); +// } +#endif + + //Check wether the minimum prbability is above the current probabilty + if( gJa25AiSectorStruct[ bSectorToAttackID ].ubMinimumProbabiltyBeforeAttack >= gJa25AiSectorStruct[ bSectorToAttackID ].bCurrentProbability ) + { + //if so leave + return; + } + + + //Get random # + bRandom = Random( 120 ); + + //if the enemies should attack + if( bRandom < gJa25AiSectorStruct[ bSectorToAttackID ].bCurrentProbability ) + { + INT16 sSectorToAttack; + INT16 sSector; + UINT8 ubNumEnemies=0; + UINT8 ubSectorX = SECTORX( gJa25AiSectorStruct[ bSectorToAttackID ].iSectorID ); + UINT8 ubSectorY = SECTORY( gJa25AiSectorStruct[ bSectorToAttackID ].iSectorID ); + INT8 bSectorZ = gJa25AiSectorStruct[ bSectorToAttackID ].bSectorZ; + UINT32 uiBaseNumEnemies=0; + UINT32 uiRandomNumEnemies=0; + + + // + // The AI has decided to attack + // + + // return if we have send guys already + if ( gJa25AiSectorStruct[ bSectorToAttackID ].fEnemyEnrouteToAttack ) + { + return; + } + + //reset the current probability + gJa25AiSectorStruct[ bSectorToAttackID ].bCurrentProbability = 0; + + //if the AI is attacking the same sector + if( gJa25StrategicAi.iLastBattleSectorID == bSectorToAttackID ) + { + gJa25StrategicAi.uiAttackedSameSectorCounter += 1; + } + else + { + //Other wise, reset the counter + gJa25StrategicAi.uiAttackedSameSectorCounter = 0; + } + + gJa25StrategicAi.iLastBattleSectorID = bSectorToAttackID; + + //if all the player mercs are between sector + if( AreAllPlayerMercTraversingBetweenSectors() ) + { + //then the ai shouldnt attack + return; + } + + sSectorToAttack = gJa25AiSectorStruct[ bSectorToAttackID ].iSectorID; + + sSector = sSectorToAttack; + + uiBaseNumEnemies = gJa25AiSectorStruct[ bSectorToAttackID ].bBaseNumEnemies + gJa25StrategicAi.uiAttackedSameSectorCounter; + uiRandomNumEnemies = gJa25AiSectorStruct[ bSectorToAttackID ].bRandomNumEnemies + ( gJa25StrategicAi.uiAttackedSameSectorCounter * 2 ); + ubNumEnemies = uiBaseNumEnemies + Random( uiRandomNumEnemies ); + + //Guarentee no more then 20 enemies in a sector + if( ubNumEnemies > gGameExternalOptions.iMaxEnemyGroupSize ) //MAX_STRATEGIC_TEAM_SIZE ) + { + ubNumEnemies = gGameExternalOptions.iMaxEnemyGroupSize; //MAX_STRATEGIC_TEAM_SIZE; + } + + //if there are enemies to attack + if( ubNumEnemies ) + { + //if the player is NOT in this sector + if( PlayerMercsInSector( ubSectorX, ubSectorY, bSectorZ ) ) + { + //Setup an attack + HandleAddingEnemiesToSector( bSectorToAttackID, ubNumEnemies, bAttackDirection, sGridNo ); + } + else + { + HandleAddEnemiesToSectorPlayerIsntIn( bSectorToAttackID, ubNumEnemies ); + } + + #ifdef JA2BETAVERSION + RecordJa25StrategicAiDecisions( bSectorToAttackID, ubNumEnemies ); + #endif + + } + } + +} + +} + +BOOLEAN HandleAddEnemiesToSectorPlayerIsntIn( INT16 sSaiSector, UINT8 ubNumEnemies ) +{ + INT16 sSectorX = SECTORX( gJa25AiSectorStruct[ sSaiSector ].iSectorID ); + INT16 sSectorY = SECTORY( gJa25AiSectorStruct[ sSaiSector ].iSectorID ); + INT8 bSectorZ = gJa25AiSectorStruct[ sSaiSector ].bSectorZ; + + if ( gGameUBOptions.pJA2UB == TRUE ) + { + + if( !( gTacticalStatus.uiFlags & INCOMBAT ) ) + { + gubEnemyEncounterCode = ENEMY_INVASION_CODE; + } + + SetNumberJa25EnemiesInSector( sSectorX, sSectorY, bSectorZ, 0, ubNumEnemies, 0 ); + + SetThisSectorAsEnemyControlled( sSectorX, sSectorY, bSectorZ, FALSE ); + + //Set up flag so enemies will go and find the player in that sector + gJa25SaveStruct.fEnemyShouldImmediatelySeekThePlayer = TRUE; + gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy = (INT8)sSaiSector; + } + return( TRUE ); +} + +BOOLEAN HandleAddingEnemiesToSector( INT16 sSaiSector, UINT8 ubNumEnemies, INT8 bAttackDirection, INT16 sGridNo ) +{ + GROUP *pGroup=NULL; + INT16 sSectorToAttack; + INT16 sSector; + UINT32 uiWorldMin=0; + INT8 bLevel=0; +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + sSectorToAttack = gJa25AiSectorStruct[ sSaiSector ].iSectorID; + + sSector = sSectorToAttack; + + switch( bAttackDirection ) + { + case INSERTION_CODE_NORTH: + sSector -= 16; + break; + case INSERTION_CODE_SOUTH: + sSector += 16; + break; + case INSERTION_CODE_WEST: + sSector -= 1; + break; + case INSERTION_CODE_EAST: + sSector += 1; + break; + } + + + uiWorldMin = GetWorldTotalMin(); + + if( gJa25AiSectorStruct[ sSaiSector ].bSectorZ == 0 ) + { + pGroup = CreateNewEnemyGroupDepartingFromSector( sSector, 0, ubNumEnemies, 0 ); + + if( sGridNo != -1 ) + { + gsGridNoForMapEdgePointInfo = sGridNo; + + bAttackDirection = INSERTION_CODE_GRIDNO; + + gfCantRetreatInPBI = TRUE; + } + } + else + { + //Set the gridno the enemies will land at + if( sGridNo == -1 ) + { + Assert( 0 ); + return( FALSE ); + } + + //Remeber the gridno the enemies should arrive at + gsGridNoForMapEdgePointInfo = sGridNo; + + //the enemies should arrive at a spcific gridno + bAttackDirection = INSERTION_CODE_GRIDNO; + + //Determine which level the enemies should be created at + Ja25SAI_DetermineWhichLevelToAttackFrom( sSaiSector, &sSector, &bLevel ); + + //underground, we have to specify + pGroup = CreateNewEnemyGroupDepartingFromSectorUsingZLevel( sSector, bLevel, 0, ubNumEnemies, 0 );//was sSector + +// pGroup->pEnemyGroup->ubTroopsInBattle = ubNumEnemies; + } + + +// pGroup->ubSectorX = (UINT8)SECTORX(sSectorToAttack); +// pGroup->ubSectorY = (UINT8)SECTORY(sSectorToAttack); +// pGroup->ubSectorZ = gJa25AiSectorStruct[ sSaiSector ].bSectorZ; + + pGroup->ubNextX = (UINT8)SECTORX(sSectorToAttack); + pGroup->ubNextY = (UINT8)SECTORY(sSectorToAttack); + + pGroup->uiTraverseTime = 1; + pGroup->pEnemyGroup->ubIntention = ASSAULT; + SetGroupArrivalTime( pGroup, uiWorldMin + 1 ); + pGroup->ubMoveType = ONE_WAY; + + gubEnemyEncounterCode = ENEMY_INVASION_CODE; + + if( gJa25AiSectorStruct[ sSaiSector ].bSectorZ == 0 ) + { + AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ); + + // Set vairable telling us to not send any more! + gJa25AiSectorStruct[ sSaiSector ].fEnemyEnrouteToAttack = TRUE; + } + else + { +// AddEnemiesToBattle( pGroup, bAttackDirection, 0, ubNumEnemies, 0, TRUE ); + + pGroup->ubSectorX = (UINT8)SECTORX(sSectorToAttack); + pGroup->ubSectorY = (UINT8)SECTORY(sSectorToAttack); + pGroup->ubSectorZ = gJa25AiSectorStruct[ sSaiSector ].bSectorZ; + + pGroup->ubPrevX = pGroup->ubSectorX; + pGroup->ubPrevY = pGroup->ubSectorY; + pGroup->ubSectorX = pGroup->ubNextX; + pGroup->ubSectorY = pGroup->ubNextY; + pGroup->ubNextX = 0; + pGroup->ubNextY = 0; + + + InitPreBattleInterface( pGroup, TRUE ); + } + + //Set up flag so enemies will go and find the player in that sector + gJa25SaveStruct.fEnemyShouldImmediatelySeekThePlayer = TRUE; + gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy = (INT8)sSaiSector; +} + return( TRUE ); +} + +void SetEnemiesToFindThePlayerMercs() +{ + INT32 cnt; + SOLDIERTYPE *pSoldier; + INT16 sGridNoToGoto=0; + +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + sGridNoToGoto = GetGridNoEnemyWillSeekWhenAttacking( gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy ); + + //Reset fact that we send enemy to find player + gJa25SaveStruct.fEnemyShouldImmediatelySeekThePlayer = FALSE; + gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy = -1; + + //if its not a valid gridno + if( sGridNoToGoto == 0 ) + { + Assert( 0 ); + return; + } + + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive && pSoldier->bInSector ) + { + // send soldier to centre of map, roughly + pSoldier->aiData.sNoiseGridno = sGridNoToGoto; + pSoldier->bNoiseLevel = 0; + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION / 2; + + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; + pSoldier->flags.bHasKeys = TRUE; + + pSoldier->aiData.bOrders = SEEKENEMY; + } + } +} +} + +INT16 GetGridNoEnemyWillSeekWhenAttacking( INT8 bSaiSector ) +{ + INT16 sGridNo=0; +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + switch( bSaiSector ) + { + case JA25_J14_1: + sGridNo = 19749; + break; + + case JA25_K14_1: + sGridNo = 5978; + break; + + default: + + //if for some reason the map doesnt have a center gridno + if( gMapInformation.sCenterGridNo != -1 && gMapInformation.sCenterGridNo != 0 ) + { + sGridNo = gMapInformation.sCenterGridNo; + } + else + { + INT8 bID = RandomSoldierIdForAnyMercInSector(); + + if( bID != -1 ) + { + sGridNo = Menptr[ bID ].sGridNo; + } + } + + break; + } +} + return( sGridNo ); +} + +void Ja25SAI_DetermineWhichLevelToAttackFrom( INT16 sSaiSector, INT16 *psSector, INT8 *pbLevel ) +{ + INT8 bLevel=0; + INT16 sSector=0; +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + switch( sSaiSector ) + { + case JA25_K15_1: + + sSector = SEC_K15; + bLevel = 2; + break; + + case JA25_K15_2: + + sSector = SEC_L15; + bLevel = 2; + break; + + case JA25_L15_2: + + sSector = SEC_L15; + bLevel = 3; + break; + + default: + sSector = gJa25AiSectorStruct[ sSaiSector ].iSectorID; + bLevel = gJa25AiSectorStruct[ sSaiSector ].bSectorZ; + break; + } + + *psSector = sSector; + *pbLevel = bLevel; + +} +} + +BOOLEAN AreAllPlayerMercTraversingBetweenSectors() +{ + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + GROUP *pGroup=0; + + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->bActive ) + { + pGroup = GetGroup( pSoldier->ubGroupID ); + + if( pGroup != NULL ) + { + //if the group is NOT between sector + if( pGroup->fBetweenSectors == FALSE ) + { + return( FALSE ); + } + } + } + } + + return( TRUE ); +} + + +#ifdef JA2BETAVERSION + +BOOLEAN RecordJa25StrategicAiDecisions( INT16 sSectorAttacked, UINT8 ubNumEnemies ) +{ + CHAR8 zOutputString[512]; + HWFILE hFile; +/* + //open up the debug file + hFile = FileOpen( JA25_SAI_DEBUG_FILE, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return( FALSE ); + } + + //move the end of the file + FileSeek( hFile, 0, FILE_SEEK_FROM_END ); + + OutputJA25SaiString( hFile, "\n\n--- Strategic Ai Attack ---\n" ); + + //Sector + sprintf( zOutputString, "Sector Attacked: %c%d: Level %d\n", + 'A' + SECTORY( gJa25AiSectorStruct[ sSectorAttacked ].iSectorID ) - 1, + SECTORX( gJa25AiSectorStruct[ sSectorAttacked ].iSectorID ), + gJa25AiSectorStruct[ sSectorAttacked ].bSectorZ ); + OutputJA25SaiString( hFile, zOutputString ); + + //Num enemies + sprintf( zOutputString, "Num Enemies: %d\n", ubNumEnemies ); + OutputJA25SaiString( hFile, zOutputString ); + + //Time since last attack + sprintf( zOutputString, "Time Since Last Attack: %d hours\n", ( GetWorldTotalMin() - gJa25StrategicAi.uiTimeOfLastBattleInMinutes ) / 60 ); + OutputJA25SaiString( hFile, zOutputString ); + + //Probability + sprintf( zOutputString, "Probability of Attack: %d/%d\n", gJa25AiSectorStruct[ sSectorAttacked ].bProbabilityOfAttacking, gJa25AiSectorStruct[ sSectorAttacked ].bCurrentProbability ); + OutputJA25SaiString( hFile, zOutputString ); + + FileClose( hFile ); +*/ + return( TRUE ); +} + +BOOLEAN InitJa25StrategicAiDecisions( BOOLEAN fLoadedGame ) +{ + HWFILE hFile; + + //open up the debug file + hFile = FileOpen( JA25_SAI_DEBUG_FILE, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return( FALSE ); + } + + if( fLoadedGame ) + OutputJA25SaiString( hFile, "\n\n\n\n\n\n****** Loaded Game ******\n\n"); + else + OutputJA25SaiString( hFile, "\n\n\n\n\n\n****** New Game ******\n\n"); + + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + OutputJA25SaiString( hFile, "Easy Difficulty\n"); + break; + case DIF_LEVEL_MEDIUM: + OutputJA25SaiString( hFile, "Normal Difficulty\n"); + break; + case DIF_LEVEL_HARD: + OutputJA25SaiString( hFile, "Hard Difficulty\n"); + break; + } + + OutputJA25SaiString( hFile, "\n\n\n"); + + FileClose( hFile ); + + return( FALSE ); +} + + +BOOLEAN OutputJA25SaiString( HWFILE hFile, CHAR *pString ) +{ + UINT32 uiNumBytesWritten; + UINT32 uiStrLen; + + uiStrLen = strlen( pString ); + + FileWrite( hFile, pString, uiStrLen, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStrLen ) + { + return( FALSE ); + } + + return( TRUE ); +} + +#endif + +UINT32 GetMinimumTimeBetweenAttacks() +{ + UINT32 uiTime=0; + + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + uiTime = JA25_TIME_BETWEEN_SAI_UPDATES_EASY; + break; + case DIF_LEVEL_MEDIUM: + uiTime = JA25_TIME_BETWEEN_SAI_UPDATES_NORMAL; + break; + case DIF_LEVEL_HARD: + uiTime = JA25_TIME_BETWEEN_SAI_UPDATES_HARD; + break; + } + + //Add a random time to calculation + uiTime += Random( JA25_SAI_RANDOM_TIME ); + + return( uiTime ); +} + +void InitJohnKulbaInitialSector() +{ + gJa25SaveStruct.ubJohnKulbaInitialSectorY = MAP_ROW_I; + + //Randomly choose John's starting sector + if( Random( 100 ) < 50 ) + { + gJa25SaveStruct.ubJohnKulbaInitialSectorX = 10; + } + else + { + gJa25SaveStruct.ubJohnKulbaInitialSectorX = 11; + } +} + +void HandleSayingDontStayToLongWarningInSectorH8() +{ + UINT8 ubMercArray[3]; + UINT8 ubNumMercs=0; + SOLDIERTYPE *pSoldier=NULL; + INT32 cnt; + + //if the player has advance passed this sector, leave + + if( gJa25AiSectorStruct[ JA25_H9 ].fPlayerControlled && gGameUBOptions.pJA2UB == TRUE ) + { + return; + } + + if ( SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled == TRUE && gGameUBOptions.pJA2UB == FALSE ) + { + return; + } + + //if there are no enemies in the sector, leave + if( NumEnemiesInSector( 8, 8 ) > 0 ) + { + return; + } + + //if all the mercs are traversing, leave + if( AreAllPlayerMercTraversingBetweenSectors() ) + { + return; + } + + //if there are no mercs still in H8, leave + if( PlayerMercsInSector( 8, 8, 0 ) == 0 ) + { + return; + } + + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + + //Check to see if Gaston, Stogie or the PGC is on the team + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + //if the merc is alive, in this sector, etc... + if( pSoldier->bActive && + pSoldier->sSectorX == 8 && + pSoldier->sSectorY == 8 && + pSoldier->bSectorZ == 0 && + pSoldier->stats.bLife >= OKLIFE && + !pSoldier->flags.fBetweenSectors ) + { + //if the merc is either PGC, gaston, or stogie + if( pSoldier->ubProfile == 58 || + pSoldier->ubProfile == 59 || + pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER ) + + { + ubMercArray[ ubNumMercs++ ] = pSoldier->ubID; + } + } + } + + if( ubNumMercs == 0 ) + { + return; + } + + TacticalCharacterDialogue( &Menptr[ ubMercArray[ Random( ubNumMercs ) ] ], QUOTE_LAME_REFUSAL ); +} + +void FixEnemyCounterInSectorBug() +{ + INT32 iSectorCnt; + SECTORINFO *pSector; + + //loop through all the sector and see if there has been + for( iSectorCnt=0; iSectorCnt<256 ; iSectorCnt++ ) + { + //if the sector can never be rreached + pSector = &SectorInfo[ iSectorCnt ]; + + if( pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] == EDGEOFWORLD ) + { + pSector->ubNumAdmins = 0; + pSector->ubNumTroops = 0; + pSector->ubNumElites = 0; + } + } + + pSector = &SectorInfo[ SEC_L15 ]; + pSector->ubNumAdmins = 0; + pSector->ubNumTroops = 0; + pSector->ubNumElites = 0; + +} + + +void HandleEnricosUnderstandingEmail() +{ + //if the player just got the laptop working again, and we are to send an email when entering a new sector + if( gJa25SaveStruct.fSendEmail_10_NextSector ) + { + AddEmail( EMAIL_UNDERSTANDING, EMAIL_UNDERSTANDING_LENGTH, MAIL_ENRICO, GetWorldTotalMin() , -1 , -1, TYPE_EMAIL_EMAIL_EDT); + + //Remeber we sent it + gJa25SaveStruct.ubEmailFromSectorFlag |= SECTOR_EMAIL__ANOTHER_SECTOR; + gJa25SaveStruct.fSendEmail_10_NextSector = FALSE; + } +} + + +void HandleRemovingEnemySoldierInitLinksIfPlayerEverWonInSector() +{ + INT16 sJa25SaiSectorValue; + +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + //Get the Ja25 SAI sector value for the sector that is being attacked + sJa25SaiSectorValue = GetJA25SectorID( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + + //if the player has WON in this sector before, we must destroy the ENEMIES soldier init list links + if( sJa25SaiSectorValue != -1 && gJa25AiSectorStruct[ sJa25SaiSectorValue ].fPlayerHasLiberatedSectorBefore ) + { + //Toast the ENEMIES init links + RemoveAllEnemySoldierInitListLinks(); + } +} +} + +void RemoveAllEnemySoldierInitListLinks() +{ + SOLDIERINITNODE *curr; + + curr = gSoldierInitHead; + + //Loop through the list + while( curr ) + { + // if this soldier is using detailed placement information, AND he is an enemy + if( curr->pDetailedPlacement && curr->pDetailedPlacement->bTeam == ENEMY_TEAM ) + { + MemFree( curr->pDetailedPlacement ); + curr->pDetailedPlacement = NULL; + curr->pBasicPlacement->fDetailedPlacement = FALSE; + } + curr = curr->next; + } +} + +void Ja25HandleStartingAnyBattlesInOtherSectors() +{ + UINT8 ubNumEnemies=0; + UINT8 ubNumPlayers=0; + INT8 bCnt; + INT8 bSectorX, bSectorY, bSectorZ; + +if ( gGameUBOptions.pJA2UB == TRUE ) +{ + + //if there is a world loaded + if( gWorldSectorX != -1 && gWorldSectorY != -1 && gbWorldSectorZ != -1 ) + { + ubNumEnemies = NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + + //if there is enemies in this sector + if( ubNumEnemies != 0 ) + { + //get out + return; + } + } + + //loop through all the sectors and see if there any that have both enemy and player team mercs + for( bCnt=0; bCnt< giNumJA25Sectors; bCnt++ ) + { + bSectorX = SECTORX( gJa25AiSectorStruct[ bCnt ].iSectorID ); + bSectorY = SECTORX( gJa25AiSectorStruct[ bCnt ].iSectorID ); + bSectorZ = gJa25AiSectorStruct[ bCnt ].bSectorZ; + + ubNumEnemies = NumEnemiesInAnySector( bSectorX, bSectorY, bSectorZ ); + ubNumPlayers = PlayerMercsInSector( bSectorX, bSectorY, bSectorZ ); + + //if there are both enemies and player mercs in the same sector + if( ubNumEnemies != 0 && ubNumPlayers != 0 ) + { +// GROUP *pEnemyGroup; +// GROUP *pPlayerGroup; + + //we must start a battle +// PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiatingBattleGroup ); + return; + } + } +} +} + +// -1 if enemy isnt supposed to seek player, otherwise SAI sectgor ID get returned +INT8 GetSectorEnemyIsToImmediatelySeekEnemyIn() +{ + INT16 sJa25SaiSectorValue; + + //if the currently loaded sector isnt the sector which the enemies are to attack + sJa25SaiSectorValue = GetJA25SectorID( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + + if( sJa25SaiSectorValue == -1 || sJa25SaiSectorValue != gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy ) + { + return( -1 ); + } + + //if the enemy is to seek the player when entering the sector + if( gJa25SaveStruct.fEnemyShouldImmediatelySeekThePlayer ) + { + return( gJa25SaveStruct.bSectorTheEnemyWillSeekEnemy ); + } + else + { + return( -1 ); + } +} + + +void SetH11NumEnemiesInSector() +{ + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + + // SEC_H11: + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = 1 + Random( 2 ); + ubNumTroops = 6 + Random( 3 ); + ubNumElites = 0 + Random( 0 ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 8 + Random( 3 ); + ubNumElites = 2 + Random( 2 ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 10 + Random( 4 ); + ubNumElites = 4 + Random( 3 ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = 0 + Random( 0 ); + ubNumTroops = 20 + Random( 4 ); + ubNumElites = 4 + Random( 3 ); + break; + } + + SetNumberJa25EnemiesInSurfaceSector( SEC_H11, ubNumAdmins, ubNumTroops, ubNumElites ); + } +} + +BOOLEAN HaveMercsEverBeenInComplex() +{ + +if (gGameUBOptions.pJA2UB == TRUE ) +{ + //if the player has liberated K15 level 1 + if( gJa25AiSectorStruct[ JA25_K15_1 ].fPlayerHasLiberatedSectorBefore ) + { + return( TRUE ); + } + else if( AreAnyPlayerMercsStillInSector( 15, 11, 1 ) ) + { + return( TRUE ); + } +} +else if (gGameUBOptions.pJA2UB == FALSE ) +{ + //if the player has liberated K15 level 1 + if( SectorInfo[ SEC_K15 ].uiTimeLastPlayerLiberated && gbWorldSectorZ == 1 ) + { + return( TRUE ); + } + else if( AreAnyPlayerMercsStillInSector( 15, 11, 1 ) ) + { + return( TRUE ); + } + +} + + return( FALSE ); +} + +#ifdef JA2BETAVERSION +BOOLEAN Ja25BetaDateToInvalidateExe() +{ + SYSTEMTIME sSystemTime; + + GetSystemTime( &sSystemTime ); + + + //if according to the system clock, we are past May 12, 2000, quit the game + if( sSystemTime.wYear >= 2000 && sSystemTime.wMonth >= 5 && sSystemTime.wDay >= 12 ) + { + return( FALSE ); + } + + return( TRUE ); +} +#endif + + +void AddJA25AIDataToSector( JA25_SECTOR_AI *pSectorAIInfo ) +{ + // See if there exists AI information here already... +/* INT8 bSector; + + //get the sector id + bSector = (INT8)GetJA25SectorID( (INT16)SECTORX( pSectorAIInfo->iSectorID ), (INT16)SECTORY( pSectorAIInfo->iSectorID ), pSectorAIInfo->bSectorZ ); + + if ( bSector != -1 ) + { + memcpy( &( gJa25AiSectorStruct[ bSector ] ), pSectorAIInfo, sizeof( JA25_SECTOR_AI ) ); + return; + } + + // Increment array + gJa25AiSectorStruct = realloc( gJa25AiSectorStruct, ( giNumJA25Sectors + 1 ) * sizeof( JA25_SECTOR_AI ) ); + + memcpy( &( gJa25AiSectorStruct[ giNumJA25Sectors ] ), pSectorAIInfo, sizeof( JA25_SECTOR_AI ) ); + + giNumJA25Sectors++; +*/ +} + +#endif \ No newline at end of file diff --git a/Strategic/Ja25 Strategic Ai.h b/Strategic/Ja25 Strategic Ai.h new file mode 100644 index 00000000..193f7d32 --- /dev/null +++ b/Strategic/Ja25 Strategic Ai.h @@ -0,0 +1,338 @@ +#ifndef JA25__STRATEGIC_AI +#define JA25__STRATEGIC_AI + +#ifdef JA2UB +typedef struct +{ + UINT32 uiJerryMiloQuotesFlags; //used to keep track of the quotes Jerry says. + BOOLEAN fImportCharactersFromOldJa2Save; // True if we have loaded in merc profiles from JA2 + + BOOLEAN fInCustomMap; + + BOOLEAN fJohnKulbaIsInGame; // If true Kulba is in the game, otherwise tex is + + BOOLEAN fMorrisToSayHurtPlayerQuoteNextTurn; + UINT8 ubPlayerMorrisHurt; + + BOOLEAN fBiggensUsedDetonator; + + BOOLEAN fSendEmail_10_NextSector; // True if we are to send email #10 next time the player loads up a sector + + UINT8 ubEmailFromSectorFlag; + + BOOLEAN fNpcHasBeenAdded; // True if manuel has been added to sector H10 or i9 + + BOOLEAN fShowMercDestinationDialogWhenHiringMerc; // + + BOOLEAN fHaveAimandMercOffferItems; // TRUE when MERC and AIM are giving away 'gifts' to the mercs that get hired + + BOOLEAN fBiffWasKilledWhenImportingSave; //TRUE is biff was killed when we imported the save + + UINT8 ubImportantSpeckQuotesSaidBefore; + + BOOLEAN fShouldMsgBoxComeUpSayingSomeoneImportantIsInSector; + + UINT8 ubStateOfFanInPowerGenSector; + + UINT8 ubHowPlayerGotThroughFan; + + UINT32 uiJa25TacticalFlags; + + INT32 iPowerGenFanPositionSndID; + + UINT32 uiTacticalTurnCounter; + + UINT32 uiTurnPowerGenFanWentDown; + + UINT32 uiJa25GeneralFlags; + + UINT8 ubStatusOfFortifiedDoor; + + UINT32 uiDisplayCoverCounter; + UINT32 uiDisplayLosCounter; + UINT32 uiDisplayGunRangeCounter; + + UINT8 ubLoadScreenStairTraversal; + + UINT8 ubMorrisNoteState; + + UINT8 ubJohnKulbaInitialSectorX; + UINT8 ubJohnKulbaInitialSectorY; + + UINT8 ubDisplayPlayerLostMsgBox; + + BOOLEAN fJerryBreakingLaptopOccuring; + + BOOLEAN fEnemyShouldImmediatelySeekThePlayer; + INT8 bSectorTheEnemyWillSeekEnemy; + + INT8 bNewMercProfileIDForSayingMorrisNote; + + UINT8 ubDisplayCommanderMorrisNote; + + UINT16 usFiller1; + + UINT32 uiTurnLastSaidSeeEnemyQuote; + + UINT8 ubFiller[928]; //Struct is originally 1000 bytes in size + +} JA25_SAVE_INFO; + +extern JA25_SAVE_INFO gJa25SaveStruct; + +//following flags use uiEmailFromSectorFlag +#define SECTOR_EMAIL__ANOTHER_SECTOR 0x01 +#define SECTOR_EMAIL__J11_J12 0x02 +#define SECTOR_EMAIL__POWER_GEN 0x04 +#define SECTOR_EMAIL__TUNNEL 0x08 +#define SECTOR_EMAIL__POWER_GEN_LVL_1 0x10 + + +//following flags use fNpcHasBeenAdded +#define SECTOR_ADDED_NPC__MANUEL 0x01 +#define SECTOR_ADDED_NPC__TEX 0x02 +#define SECTOR_ADDED_NPC__JOHN_K 0x04 + + +//Following flags use ubImportantSpeckQuotesSaidBefore +#define SPECK__ENCOURAGE_POAYER_TO_KEEP_SHOPPING 1<<0 +#define SPECK__SECOND_INTRO_BEEN_SAID 1<<1 +#define SPECK__BETTER_EQUIPMENT 1<<2 + + +//following flags are used with ubStateOfFanInPowerGenSector +enum +{ + PGF__RUNNING_NORMALLY, + PGF__STOPPED, + PGF__BLOWN_UP, +}; + + +//following flags are used with uiJa25TacticalFlags + + + +//following flags are used with ubHowPlayerGotThroughFan +enum +{ + PG__PLAYER_NOT_GONE_THROUGH_YET, + PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH, + PG__PLAYER_STOPPED_FAN_TO_GET_THROUGH, +}; + +//The following flags are used with uiJa25GeneralFlags. +#define JA_GF__POWER_GEN_FAN_HAS_BEEN_STOPPED 0x00000001 +#define JA_GF__BIGGENS_SAID_QUOTE_117 0x00000002 +#define JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE 0x00000004 +#define JA_GF__PLAYER_HAS_SEEN_FORTIFIED_DOOR 0x00000008 + +#define JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX 0x00000010 +#define JA_GF__ALREADY_MOVED_ENEMIES_IN_COMPLEX 0x00000020 +#define JA_GF__PICKED_UP_MONEY_IN_GUARD_POST 0x00000040 +#define JA_GF__PICKED_UP_MONEY_IN_FIRST_TOWN 0x00000080 + +#define JA_GF__PLAYER_SAID_LAPTOP_FIXED_QUOTE 0x00000100 +#define JA_GF__RAUL_BLOW_HIMSELF_UP 0x00000200 +#define JA_GF__QUOTE_105_HAS_BEEN_SAID 0x00000400 +#define JA_GF__BARRETT_IS_HALF_PRICE 0x00000800 + +#define JA_GF__MOVE_ENEMIES_TO_EDGE_IN_TUNNEL_1 0x00001000 +#define JA_GF__MOVE_ENEMIES_TO_EDGE_IN_TUNNEL_2 0x00002000 +#define JA_GF__PLAYER_SEEN_FAN_BEFORE 0x00004000 +#define JA_GF__PLAYER_SAID_GATE_LOCKED_QUOTE 0x00008000 + + +//The following is used with ubStatusOfFortifiedDoor +enum +{ + FD__CLOSED, + FD__OPEN, +}; + + +//the following is used with ubLoadScreenStairTraversal +enum +{ + LS__NOT_GOING_UP_STAIRS, + LS__GOING_UP_STAIRS, + LS__GOING_DOWN_STAIRS, +}; + + + +//the following is used with ubMorrisNoteState +enum +{ + MN__NOT_PICKED_UP_YET, + MN__PICKED_UP_BY_OLD_MERC_NEVER_SAID_QUOTE, + MN__PICKED_UP_BY_OLD_MERC_SAID_QUOTE_ALREADY, + MN__PICKED_UP_BY_NEW_MERC, + MN__FINISHED = MN__PICKED_UP_BY_NEW_MERC, +}; + + +//used with ubDisplayCommanderMorrisNote +enum +{ + DMN__NOT_TO_DISPLAY_IT, + DMN__DISPLAY_PART_1, + DMN__DISPLAY_PART_2, + DMN__FINISHED, +}; + + +BOOLEAN AreAnyPlayerMercsStillInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); + +BOOLEAN ShouldEnemiesBeAddedToInitialSector(); + +void InitJa25StrategicAi(); + +extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); + +void InitJa25SaveStruct(); + +void InitJa25StrategicAiBloodcats( ); +extern void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); + +BOOLEAN SaveJa25SaveInfoToSaveGame( HWFILE hFile ); +BOOLEAN LoadJa25SaveInfoFromSavedGame( HWFILE hFile ); + + +void AddEnemiesToJa25TunnelMaps(); +void HandleAddingEnemiesToTunnelMaps(); + +void SetJa25GeneralFlag( UINT32 uiFlagToSet ); +void ClearJa25GeneralFlag( UINT32 uiFlagToClear ); +BOOLEAN IsJa25GeneralFlagSet( UINT32 uiFlagToCheck ); + + + + + + + + +typedef struct +{ + UINT32 uiTimeOfLastBattleInMinutes; + UINT32 uiTimeOfLastUpdate; + + INT16 iLastBattleSectorID; + INT8 bLastBattleSectorZ; + + INT8 bFiller1; + + UINT32 uiAttackedSameSectorCounter; + + INT8 bFiller[16]; + +} JA25_SECTOR_AI_MANAGER; + + + + +typedef struct +{ + INT16 iSectorID; + INT8 bSectorZ; + + INT8 bBaseNumEnemies; // The base number of enemies that can present in the sector + INT8 bRandomNumEnemies; // The random amount of enemies that can be present + + INT8 bProbabilityOfAttacking; // The probability Increase of attacking every hour of time compressing + + INT8 bMaxProbabilityForAttackingSector; // The max amount of probabilty the enemy will attack enemy + + INT8 bCurrentProbability; // Gets updated every hour when there can be an attack, reset when attack occurs + + BOOLEAN fPlayerControlled; // Set when the player controls the sector + + UINT8 ubMinimumProbabiltyBeforeAttack; + + BOOLEAN fPlayerHasLiberatedSectorBefore; //Set when the player has a victory in the sector, never gets cleared after that + + BOOLEAN fAutoDirection; //Calculate direction enemy are coming in from + + UINT8 ubInsertionDirection; // For custom maps, used to describe which direction enemies are from + + UINT32 sInsertionGridNo; // For custom maps, the insertion gridno + + BOOLEAN fCustomSector; // Ah, a flag so the AI doesn't need to lookup sector info + + UINT8 ubLoadingScreenID; // For a custom map, which loading screen to use + + BOOLEAN fEnemyEnrouteToAttack; // To help things so that the enemy wioll not continually send dudes + + INT8 bFiller[21]; + +} JA25_SECTOR_AI; + +#define CUSTOMSECTOR 1020 + +extern JA25_SECTOR_AI gJa25AiSectorStruct[CUSTOMSECTOR]; + +enum +{ + JA25_H7, + JA25_H8, + JA25_H9, + JA25_I9, + JA25_H10, + JA25_I10, //5 + JA25_I11, + JA25_J11, + JA25_I12, + JA25_J12, + JA25_I13, //10 + JA25_J13, + JA25_I13_1, + JA25_J13_1, + JA25_J14_1, + JA25_K14_1, //15 + JA25_K15, + JA25_K15_1, + JA25_K15_2, + JA25_L15_2, + JA25_L15_3, + + NUM_CAMPAIGN_JA25_SECTORS +}; + + + + +extern BOOLEAN gfEnemyShouldImmediatelySeekThePlayer; +//extern INT32 giNumJA25Sectors; + +extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); +void SetJa25SectorOwnedStatus( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fPlayerOwned ); +INT8 GetTheFurthestSectorPlayerOwns(); +void Ja25_UpdateTimeOfEndOfLastBattle( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); +BOOLEAN Ja25_AreEnemiesAbleToAttackSector( INT16 iSectorID, INT8 bSectorZ ); +BOOLEAN InitJa25SectorAi(); +INT16 GetJA25SectorID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); +void JA25_HandleUpdateOfStrategicAi(); + +void SetEnemiesToFindThePlayerMercs(); + +void HandleSayingDontStayToLongWarningInSectorH8(); +extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); + +#ifdef JA2BETAVERSION + BOOLEAN InitJa25StrategicAiDecisions( BOOLEAN fLoadedGame ); +#endif + +void HandleEnricosUnderstandingEmail(); + +void HandleRemovingEnemySoldierInitLinksIfPlayerEverWonInSector(); + +// -1 if enemy isnt supposed to seek player, otherwise SAI sectgor ID get returned +INT8 GetSectorEnemyIsToImmediatelySeekEnemyIn(); + +void AddJA25AIDataToSector( JA25_SECTOR_AI *pSectorAIInfo ); +extern void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8 bBloodCatPlacements ); + +#endif + +#endif \ No newline at end of file diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 2fd56087..aac56a23 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -45,6 +45,14 @@ #include "LOS.h" #include "Music Control.h" +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "Ja25Update.h" +#include "ub_config.h" +#include "Ja25Update.h" +#endif + #include "Intro.h" #include "End Game.h" #include "Queen Command.h" @@ -60,15 +68,80 @@ extern "C" { #include "lua_state.h" #include "lua_function.h" #include + +#include "Encrypted File.h" //-------------------------- UB ------------------------------ extern BOOLEAN gfDoneWithSplashScreen; extern UINT32 iStringToUseLua; extern INT8 Test; +//Briefing room +static int l_SetEndMission(lua_State *L); +static int l_SetStartMission(lua_State *L); +static int l_CheckMission (lua_State *L); + void FatigueCharacter( SOLDIERTYPE *pSoldier ); static int l_AddCustomEmail (lua_State *L); +static int l_SetDefaultArrivalSector (lua_State *L); +static int l_GetDefaultArrivalSector (lua_State *L); +static int l_SetMercArrivalLocation(lua_State *L); +static int l_GetDefaultArrivalSectorX (lua_State *L); +static int l_GetDefaultArrivalSectorY (lua_State *L); + +static int l_InitProfile(lua_State *L); + +#ifdef JA2UB + +static int l_InitMercgridNo0 (lua_State *L); +static int l_InitMercgridNo1 (lua_State *L); +static int l_InitMercgridNo2 (lua_State *L); +static int l_InitMercgridNo3 (lua_State *L); +static int l_InitMercgridNo4 (lua_State *L); +static int l_InitMercgridNo5 (lua_State *L); +static int l_InitMercgridNo6 (lua_State *L); +static int l_InitJerryGridNo (lua_State *L); + +static int l_SetInternalLocateGridNo(lua_State *L); + +static int l_setInGameHeliCrash (lua_State *L); +static int l_setJerryQuotes (lua_State *L); +static int l_setInJerry (lua_State *L); +static int l_setLaptopQuest (lua_State *L); +static int l_setInGameHeli (lua_State *L); + + +//static int l_getMercgridNo0 (lua_State *L); +//static int l_getMercgridNo1 (lua_State *L); +//static int l_getMercgridNo2 (lua_State *L); +//static int l_getMercgridNo3 (lua_State *L); +//static int l_getMercgridNo4 (lua_State *L); +//static int l_getMercgridNo5 (lua_State *L); +//static int l_getMercgridNo6 (lua_State *L); + +static int l_Ja25SaveStructJohnKulbaIsInGame(lua_State *L); +static int l_Ja25SaveCheckStructJohnKulbaIsInGame(lua_State *L); + +static int l_Ja25SaveStructubJohnKulbaInitialSectorY(lua_State *L); +static int l_Ja25SaveStructubJohnKulbaInitialSectorX(lua_State *L); + +static int l_SetNumberJa25EnemiesInSurfaceSector(lua_State *L); +static int l_SetNumberOfJa25BloodCatsInSector(lua_State *L); + +static int l_HasNpcSaidQuoteBefore(lua_State *L); + +static int l_ShouldThePlayerStopWhenWalkingOnBiggensActionItem(lua_State *L); + + +static int l_HandleSeeingPowerGenFan (lua_State *L); +static int l_HandleSwitchToOpenFortifiedDoor (lua_State *L); +static int l_HandleSeeingFortifiedDoor (lua_State *L); +static int l_HandlePlayerHittingSwitchToLaunchMissles (lua_State *L); +static int l_HavePersonAtGridnoStop(lua_State *L); + +#endif + static int l_WhoIsThere2 (lua_State *L); static int l_GuaranteeAtLeastXItemsOfIndex(lua_State *L); @@ -78,7 +151,9 @@ static int l_FindUnderGroundSector(lua_State *L); static int l_AddEnemyToUnderGroundSector(lua_State *L); static int l_FindUnderGroundSectorVisited(lua_State *L); -//static int l_EnterTacticalInFinalSector(lua_State *L); +#ifdef JA2UB +static int l_EnterTacticalInFinalSector(lua_State *L); +#endif static int l_ReStartingGame(lua_State *L); @@ -109,8 +184,8 @@ BOOLEAN LetLuaInterfaceDialogue( UINT8 ubNPC, UINT8 InitFunction); BOOLEAN LuaHandlePlayerTeamMemberDeath(UINT8 ProfileId, UINT8 Init); BOOLEAN LuaHandleNPCTeamMemberDeath(UINT8 ProfileId, UINT8 Init); BOOLEAN LuaCheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck, UINT8 Init); -BOOLEAN LuaHandleQuestCodeOnSectorExit( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); -BOOLEAN LuaHandleQuestCodeOnSectorEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); +BOOLEAN LuaHandleQuestCodeOnSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); +//BOOLEAN LuaHandleQuestCodeOnSectorEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); BOOLEAN LuaHandleDelayedItemsArrival( UINT32 uiReason, UINT8 Init); BOOLEAN LetLuaHandleNPCSystemEvent( UINT32 uiEvent, UINT8 Init); @@ -276,6 +351,9 @@ static int l_AddToShouldBecomeHostileOrSayQuoteList(lua_State *L); static int l_AddPreReadEmail (lua_State *L); static int l_AddEmail (lua_State *L); +static int l_AddEmailXML (lua_State *L); +static int l_AddEmailXML2 (lua_State *L); +static int l_AddEmailLevelUpXML (lua_State *L); static int l_EVENT_SoldierGotHit (lua_State *L); static int l_EVENT_InitNewSoldierAnim (lua_State *L); @@ -621,6 +699,19 @@ static int l_WhoIs(lua_State *L); static int l_SetHandleGlobalLoyaltyEvent (lua_State *L); +//----05-08-2011--- + +// tactical tex box function +static int l_ExecuteTacticalTextBox(lua_State *L); + +//Town function +static int l_VisibleTown (lua_State *L); +static int l_HiddenTown (lua_State *L); +//static int l_EraseTown (lua_State *L); +//static int l_ResizeTown (lua_State *L); + +static int l_gubBoxerID(lua_State *L); +static int l_RemoveGraphicFromTempFile (lua_State *L); using namespace std; @@ -713,6 +804,11 @@ void IniGlobal_1(lua_State *L) void IniFunction(lua_State *L) { + //Briefing room + lua_register(L, "SetEndMission", l_SetEndMission); + lua_register(L, "SetStartMission", l_SetStartMission); + lua_register(L, "CheckMission", l_CheckMission); + //Sector lua_register(L, "AddAlternateSector", l_AddAlternateSector); lua_register(L, "AddAltUnderGroundSector", l_AddAltUnderGroundSector); @@ -918,7 +1014,9 @@ void IniFunction(lua_State *L) //Email lua_register(L, "AddPreReadEmail", l_AddPreReadEmail); lua_register(L, "AddEmail", l_AddEmail); - + lua_register(L, "AddEmailMercAvailableXML", l_AddEmailXML); + lua_register(L, "AddEmailMercLevelUpXML", l_AddEmailLevelUpXML); + lua_register(L, "AddEmailXML", l_AddEmailXML2); //Items lua_register(L, "CreateItem", l_CreateItem); lua_register(L, "CreateMoney", l_CreateMoney); @@ -1226,6 +1324,30 @@ void IniFunction(lua_State *L) lua_register(L, "SetTurnTimeLimit", l_fTurnTimeLimit); lua_register(L, "InitMercFace", l_InitFace); + + +#ifdef JA2UB + //john + lua_register(L, "Ja25JohnKulbaIsInGame", l_Ja25SaveStructJohnKulbaIsInGame); + lua_register(L, "Ja25CheckJohnKulbaIsInGame", l_Ja25SaveCheckStructJohnKulbaIsInGame); + lua_register(L, "Ja25JohnKulbaInitialSectorY", l_Ja25SaveStructubJohnKulbaInitialSectorY); + lua_register(L, "Ja25JohnKulbaInitialSectorX", l_Ja25SaveStructubJohnKulbaInitialSectorX); + + lua_register(L, "SetNumberJa25EnemiesInSurfaceSector", l_SetNumberJa25EnemiesInSurfaceSector); + + lua_register(L, "SetNumberOfJa25BloodCatsInSector", l_SetNumberOfJa25BloodCatsInSector); + + lua_register(L, "HasNpcSaidQuoteBefore", l_HasNpcSaidQuoteBefore); + + lua_register(L, "ShouldThePlayerStopWhenWalkingOnBiggensActionItem", l_ShouldThePlayerStopWhenWalkingOnBiggensActionItem); + + lua_register(L, "HandleSeeingPowerGenFan", l_HandleSeeingPowerGenFan); + lua_register(L, "HandleSwitchToOpenFortifiedDoor", l_HandleSwitchToOpenFortifiedDoor); + lua_register(L, "HandleSeeingFortifiedDoor", l_HandleSeeingFortifiedDoor); + lua_register(L, "HandlePlayerHittingSwitchToLaunchMissles", l_HandlePlayerHittingSwitchToLaunchMissles); + lua_register(L, "HavePersonAtGridnoStop", l_HavePersonAtGridnoStop); + +#endif lua_register(L, "WhoIsThere2", l_WhoIsThere2); @@ -1243,11 +1365,13 @@ void IniFunction(lua_State *L) lua_register(L, "SetCurrentWorldSector", l_SetCurrentWorldSector); -// lua_register(L, "EnterTacticalInFinalSector", l_EnterTacticalInFinalSector); +#ifdef JA2UB + lua_register(L, "EnterTacticalInFinalSector", l_EnterTacticalInFinalSector); +#endif lua_register(L, "ReStartingGame", l_ReStartingGame); -// lua_register(L, "AddCustomEmail", l_AddCustomEmail); + lua_register(L, "AddCustomEmail", l_AddCustomEmail); //intro lua_register(L, "DisplaySirtechSplashScreen", l_DisplaySirtechSplashScreen); @@ -1263,6 +1387,56 @@ void IniFunction(lua_State *L) lua_register(L, "StartVideo", l_StartVideo); lua_register(L, "SetGlobalLoyaltyEvent", l_SetHandleGlobalLoyaltyEvent); + + lua_register(L, "SetDefaultArrivalSector", l_SetDefaultArrivalSector); + lua_register(L, "GetDefaultArrivalSector", l_GetDefaultArrivalSector); + lua_register(L, "SetDefaultArrivalGridNo", l_SetMercArrivalLocation); + lua_register(L, "GetDefaultArrivalSectorX", l_GetDefaultArrivalSectorX); + lua_register(L, "GetDefaultArrivalSectorY", l_GetDefaultArrivalSectorY); + + lua_register(L, "InitialProfile", l_InitProfile); + + #ifdef JA2UB + lua_register(L, "InitialHeliGridNo1", l_InitMercgridNo0); + lua_register(L, "InitialHeliGridNo2", l_InitMercgridNo1); + lua_register(L, "InitialHeliGridNo3", l_InitMercgridNo2); + lua_register(L, "InitialHeliGridNo4", l_InitMercgridNo3); + lua_register(L, "InitialHeliGridNo5", l_InitMercgridNo4); + lua_register(L, "InitialHeliGridNo6", l_InitMercgridNo5); + lua_register(L, "InitialHeliGridNo7", l_InitMercgridNo6); + + lua_register(L, "InitialJerryGridNo", l_InitJerryGridNo); + + lua_register(L, "InitialLaptopQuest", l_setLaptopQuest); + + lua_register(L, "InitialHeliCrash", l_setInGameHeliCrash ); + lua_register(L, "InitialJerryQuotes", l_setJerryQuotes ); + lua_register(L, "InitialJerry", l_setInJerry ); + lua_register(L, "InitialHeli", l_setInGameHeli ); + + lua_register(L, "InternalLocateGridNo", l_SetInternalLocateGridNo ); + #endif + + //lua_register(L, "GetINITIALHELIGRIDNO1", l_getMercgridNo0); + //lua_register(L, "GetINITIALHELIGRIDNO2", l_getMercgridNo1); + //lua_register(L, "GetINITIALHELIGRIDNO3", l_getMercgridNo2); + //lua_register(L, "GetINITIALHELIGRIDNO4", l_getMercgridNo3); + //lua_register(L, "GetINITIALHELIGRIDNO5", l_getMercgridNo4); + //lua_register(L, "GetINITIALHELIGRIDNO6", l_getMercgridNo5); + //lua_register(L, "GetINITIALHELIGRIDNO7", l_getMercgridNo6); + + lua_register(L, "ExecuteTacticalTextBox", l_ExecuteTacticalTextBox); + + //Town function + lua_register(L, "VisibleTown", l_VisibleTown); + lua_register(L, "HiddenTown", l_HiddenTown); + //lua_register(L, "EraseTown", l_EraseTown); + //lua_register(L, "ResizeTown", l_ResizeTown); + + lua_register(L, "gubBoxerID", l_gubBoxerID); + + lua_register(L, "RemoveGraphicFromTempFile", l_RemoveGraphicFromTempFile); + } @@ -1412,7 +1586,7 @@ static int l_StartVideo(lua_State *L) } //------------------- End intro ----------- -/* +#ifdef JA2UB static int l_EnterTacticalInFinalSector(lua_State *L) { @@ -1420,7 +1594,8 @@ static int l_EnterTacticalInFinalSector(lua_State *L) return 0; } -*/ +#endif + static int l_ReStartingGame(lua_State *L) { @@ -1429,6 +1604,98 @@ static int l_ReStartingGame(lua_State *L) return 0; } +#ifdef JA2UB +BOOLEAN LetLuaMakeBadSectorListFromMapsOnHardDrive(UINT8 Init) +{ + char * filename = "scripts\\MakeMapsOnHardDrive.lua"; + UINT32 size, bytesRead; + char* buffer; + + HWFILE file = FileOpen(filename, FILE_ACCESS_READ, FALSE); + + if (!file) + return false; + + size = FileSize(filename); + buffer = new char[size+1]; + buffer[size] = 0; + FileRead(file, buffer, size, &bytesRead); + FileClose(file); + + lua_State *L = lua_open(); + luaL_openlibs(L); + + IniFunction(L); + IniGlobalGameSetting(L); + + if (luaL_dostring(L, buffer)) + { + // oh noes, error + // TODO: write to log or something + return false; + } + + if ( Init == 0 ) + { + lua_getglobal(L , "MakeBadSectorListFromMapsOnHardDrive"); + lua_call(L,0,0); + } + + lua_close(L); + + delete[] buffer; + + + return true; + +} + +BOOLEAN LuaInitStrategicLayer(UINT8 Init) +{ + char * filename = "scripts\\InitStrategicLayer.lua"; + UINT32 size, bytesRead; + char* buffer; + + HWFILE file = FileOpen(filename, FILE_ACCESS_READ, FALSE); + + if (!file) + return false; + + size = FileSize(filename); + buffer = new char[size+1]; + buffer[size] = 0; + FileRead(file, buffer, size, &bytesRead); + FileClose(file); + + lua_State *L = lua_open(); + luaL_openlibs(L); + + IniFunction(L); + IniGlobalGameSetting(L); + + if (luaL_dostring(L, buffer)) + { + // oh noes, error + // TODO: write to log or something + return false; + } + + if ( Init == 0 ) + { + lua_getglobal(L , "InitStrategicLayer"); + lua_call(L,0,0); + } + + lua_close(L); + + delete[] buffer; + + + return true; + +} + +#endif static int l_SetHandleGlobalLoyaltyEvent (lua_State *L) { @@ -1452,8 +1719,6 @@ INT8 bSectorZ; return 0; } - -/* static int l_AddCustomEmail (lua_State *L) { UINT8 n = lua_gettop(L); @@ -1461,7 +1726,8 @@ int i; INT32 iMessageOffset; INT32 iMessageLength; UINT8 ubSender; -INT32 iCurrentIMPPosition; +//INT32 iCurrentIMPPosition; +INT16 iCurrentShipmentDestinationID = -1; for (i= 1; i<=n; i++ ) { @@ -1469,14 +1735,15 @@ INT32 iCurrentIMPPosition; if (i == 2 ) iMessageLength = lua_tointeger(L,i); if (i == 3 ) ubSender = lua_tointeger(L,i); //if (i == 4 ) iDate = lua_tointeger(L,i); - if (i == 4 ) iCurrentIMPPosition = lua_tointeger(L,i); + //if (i == 4 ) iCurrentIMPPosition = lua_tointeger(L,i); + //if (i == 5) iCurrentShipmentDestinationID = lua_tointeger(L,i); } - AddCustomEmail(iMessageOffset,iMessageLength,ubSender, GetWorldTotalMin(), iCurrentIMPPosition); + AddCustomEmail(iMessageOffset,iMessageLength,ubSender, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_OTHER); return 0; } -*/ + static int l_gMercProfileGearset(lua_State *L) { UINT8 n = lua_gettop(L); @@ -1663,6 +1930,217 @@ UINT8 Val = 0,Prof = 0, whois = 0; return 1; } +#ifdef JA2UB +static int l_HandlePlayerHittingSwitchToLaunchMissles (lua_State *L) +{ + + HandlePlayerHittingSwitchToLaunchMissles( ); + + return 0; +} + +static int l_HavePersonAtGridnoStop(lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +UINT32 sGridNo = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sGridNo = lua_tointeger(L,i); + } + + HavePersonAtGridnoStop( sGridNo ); + + return 0; +} + +static int l_HandleSeeingPowerGenFan (lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +INT32 sGridNo = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sGridNo = lua_tointeger(L,i); + } + + HandleSeeingPowerGenFan( sGridNo ); + + return 0; +} + +static int l_HandleSwitchToOpenFortifiedDoor (lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +INT32 sGridNo = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sGridNo = lua_tointeger(L,i); + } + + HandleSwitchToOpenFortifiedDoor( sGridNo ); + + return 0; +} + +static int l_HandleSeeingFortifiedDoor (lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +INT32 sGridNo = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sGridNo = lua_tointeger(L,i); + } + + HandleSeeingFortifiedDoor( sGridNo ); + + return 0; +} + +static int l_ShouldThePlayerStopWhenWalkingOnBiggensActionItem (lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +UINT8 ubRecordNum = 0; +BOOLEAN Bool; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) ubRecordNum = lua_tointeger(L,i); + } + + Bool = ShouldThePlayerStopWhenWalkingOnBiggensActionItem( ubRecordNum ); + + lua_pushboolean(L, Bool); + + return 1; +} + +static int l_HasNpcSaidQuoteBefore (lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +UINT8 ubNPC = 0; +UINT8 ubRecord = 0; +BOOLEAN Bool; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) ubNPC = lua_tointeger(L,i); + if (i == 2 ) ubRecord = lua_tointeger(L,i); + } + + Bool = HasNpcSaidQuoteBefore( ubNPC, ubRecord ); + + lua_pushboolean(L, Bool); + + return 1; +} + +static int l_SetNumberOfJa25BloodCatsInSector(lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +INT8 bNumBloodCats=0; +INT8 bBloodCatPlacements=0; +INT16 sSectorX; +INT16 sSectorY; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sSectorX = lua_tointeger(L,i); + if (i == 2 ) sSectorY = lua_tointeger(L,i); + if (i == 3 ) bNumBloodCats = lua_tointeger(L,i); + if (i == 4 ) bBloodCatPlacements = lua_tointeger(L,i); + } + + SectorInfo[ SECTOR( sSectorX, sSectorY ) ].bBloodCatPlacements = bBloodCatPlacements; + SectorInfo[ SECTOR( sSectorX, sSectorY ) ].bBloodCats = bNumBloodCats; + return 0; +} + +static int l_SetNumberJa25EnemiesInSurfaceSector(lua_State *L) +{ +UINT8 n = lua_gettop(L); + +int i; + UINT8 ubNumAdmins=0; + UINT8 ubNumTroops=0; + UINT8 ubNumElites=0; + +INT16 sSectorX; +INT16 sSectorY; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sSectorX = lua_tointeger(L,i); + if (i == 2 ) sSectorY = lua_tointeger(L,i); + if (i == 3 ) ubNumAdmins = lua_tointeger(L,i); + if (i == 4 ) ubNumTroops = lua_tointeger(L,i); + if (i == 5 ) ubNumElites = lua_tointeger(L,i); + } + SetNumberJa25EnemiesInSurfaceSector( SECTOR( sSectorX, sSectorY ), ubNumAdmins, ubNumTroops, ubNumElites ); + return 0; +} + +static int l_Ja25SaveStructubJohnKulbaInitialSectorY(lua_State *L) +{ +UINT32 Y; +UINT8 n = lua_gettop(L); + + Y = lua_tointeger(L,n); + + gJa25SaveStruct.ubJohnKulbaInitialSectorY = Y; + return 0; +} + +static int l_Ja25SaveStructubJohnKulbaInitialSectorX(lua_State *L) +{ +UINT32 X; +UINT8 n = lua_gettop(L); + + X = lua_tointeger(L,n); + + gJa25SaveStruct.ubJohnKulbaInitialSectorX = X; + return 0; +} + +//gJa25SaveStruct.fJohnKulbaIsInGame +static int l_Ja25SaveCheckStructJohnKulbaIsInGame(lua_State *L) +{ +BOOLEAN FactFalse; +UINT8 n = lua_gettop(L); + + FactFalse = gJa25SaveStruct.fJohnKulbaIsInGame; + + lua_pushboolean(L, FactFalse); + + return 1; +} + + +//gJa25SaveStruct.fJohnKulbaIsInGame +static int l_Ja25SaveStructJohnKulbaIsInGame(lua_State *L) +{ +BOOLEAN FactFalse; +UINT8 n = lua_gettop(L); + + FactFalse = lua_toboolean(L,n); + + gJa25SaveStruct.fJohnKulbaIsInGame = FactFalse; + return 0; +} + +#endif + +//-------------- End UB ---------------- + static int l_WhoIsThere2 (lua_State *L) { UINT8 n = lua_gettop(L); @@ -1973,8 +2451,8 @@ BOOLEAN LuaHandleQuestCodeOnSectorEntry( INT16 sSectorX, INT16 sSectorY, INT8 bS return true; } - -BOOLEAN LuaHandleQuestCodeOnSectorExit( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init) +*/ +BOOLEAN LuaHandleQuestCodeOnSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init) { char * filename = "scripts\\strategicmap.lua"; UINT32 size, bytesRead; @@ -2017,6 +2495,15 @@ BOOLEAN LuaHandleQuestCodeOnSectorExit( INT16 sSectorX, INT16 sSectorY, INT8 bSe lua_call(L,3,0); } + if ( Init == 1 ) + { + lua_getglobal(L , "HandleQuestCodeOnSectorEntry"); + lua_pushnumber (L, sSectorX ); + lua_pushnumber (L, sSectorY ); + lua_pushnumber (L, bSectorZ ); + lua_call(L,3,0); + } + lua_close(L); delete[] buffer; @@ -2025,7 +2512,7 @@ BOOLEAN LuaHandleQuestCodeOnSectorExit( INT16 sSectorX, INT16 sSectorY, INT8 bSe return true; } -*/ + BOOLEAN LetLuaGameInit(UINT8 Init) { char * filename = "scripts\\GameInit.lua"; @@ -2076,6 +2563,12 @@ BOOLEAN LetLuaGameInit(UINT8 Init) lua_call(L,0,0); } + if ( Init == 2 ) + { + lua_getglobal(L , "InitStrategicLayer"); + lua_call(L,0,0); + } + lua_close(L); delete[] buffer; @@ -2084,7 +2577,7 @@ BOOLEAN LetLuaGameInit(UINT8 Init) return true; } -/* + BOOLEAN LuaHandleNPCTeamMemberDeath(UINT8 ProfileId, UINT8 Init) { char * filename = "scripts\\Overhead.lua"; @@ -2186,7 +2679,7 @@ BOOLEAN LuaHandlePlayerTeamMemberDeath(UINT8 ProfileId, UINT8 Init) return true; } -*/ + BOOLEAN LetLuaMyCustomHandleAtNewGridNo(UINT8 bNewSide, UINT8 ProfileId, UINT8 Init) { char * filename = "scripts\\Overhead.lua"; @@ -2315,7 +2808,7 @@ BOOLEAN FindSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex, BOOLEAN fPl } //-------------------------------- -/* + BOOLEAN LuaHandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum , UINT8 InitFunction) { char * filename = "scripts\\InterfaceDialogue.lua"; @@ -2487,7 +2980,7 @@ BOOLEAN LetLuaPerformItemAction(UINT32 ActionID, INT32 sGridNo , UINT8 InitFunct return true; } -*/ + BOOLEAN LetLuaHourlyQuestUpdate(UINT8 Init) { char * filename = "scripts\\HourlyUpdate.lua"; @@ -2548,6 +3041,395 @@ BOOLEAN LetLuaHourlyQuestUpdate(UINT8 Init) //object //--------------- +#ifdef JA2UB +static int l_InitMercgridNo0 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 0 ] = GridNo; + + return 0; +} + +static int l_InitMercgridNo1 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 1 ] = GridNo; + + return 0; +} + +static int l_InitMercgridNo2 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 2 ] = GridNo; + + return 0; +} + +static int l_InitMercgridNo3 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 3 ] = GridNo; + + return 0; +} + +static int l_InitMercgridNo4 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 4 ] = GridNo; + + return 0; +} + +static int l_InitMercgridNo5 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 5 ] = GridNo; + + return 0; +} + +static int l_InitMercgridNo6 (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InitialHeliGridNo[ 6 ] = GridNo; + + return 0; +} + +static int l_InitJerryGridNo (lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.JerryGridNo = GridNo; + + return 0; +} + +static int l_setLaptopQuest (lua_State *L) +{ +BOOLEAN set = TRUE; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) set = lua_toboolean(L,i); + } + + + gGameUBOptions.LaptopQuestEnabled = set; + + + return 0; +} + +static int l_setInJerry (lua_State *L) +{ +BOOLEAN set = TRUE; +UINT8 n = lua_gettop(L); +UINT32 GridNo = 0; +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) set = lua_toboolean(L,i); + if (i == 2 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.InJerry = set; + + if ( GridNo > 0 ) + gGameUBOptions.JerryGridNo = GridNo; + else if ( GridNo < -1 ) + gGameUBOptions.JerryGridNo = 15943; + + return 0; +} + +static int l_setJerryQuotes (lua_State *L) +{ +BOOLEAN set = TRUE; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) set = lua_toboolean(L,i); + } + + + gGameUBOptions.JerryQuotes = set; + + + return 0; +} + +static int l_setInGameHeliCrash (lua_State *L) +{ +BOOLEAN set = TRUE; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) set = lua_toboolean(L,i); + } + + + gGameUBOptions.InGameHeliCrash = set; + + + return 0; +} + +static int l_setInGameHeli (lua_State *L) +{ +BOOLEAN set = TRUE; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) set = lua_toboolean(L,i); + } + + + gGameUBOptions.InGameHeli= set; + + + return 0; +} + +static int l_SetInternalLocateGridNo(lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameUBOptions.LOCATEGRIDNO = GridNo; + + return 0; +} +#endif + + +static int l_ExecuteTacticalTextBox(lua_State *L) +{ +INT16 sLeftPosition = 110; +UINT32 idText = 0; +UINT8 n = lua_gettop(L); +wchar_t sText[400]; +UINT32 uiStartLoc=0; +CHAR16 zString[512]; +int i; + +//#define LANGMESSAGEFILE "BinaryData\\TacticalMessages.EDT" +//#define EDT_SIZE 400 * 2 + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sLeftPosition = lua_tointeger(L,i); + if (i == 2 ) idText = lua_tointeger(L,i); + + } + /* + if ( FileExists(LANGMESSAGEFILE) ) + { + uiStartLoc = EDT_SIZE * idText; + LoadEncryptedDataFromFile(LANGMESSAGEFILE, sText, uiStartLoc, EDT_SIZE); + swprintf( zString, sText ); + } + else + { + //Create the string + swprintf( zString, L"Empty Text" ); + } + */ + if ( idText >= 0 && idText <= 1000 ) + { + swprintf( zString, XMLTacticalMessages[idText] ); + + if ( sLeftPosition <= 0 ) sLeftPosition = 110; + + ExecuteTacticalTextBox( sLeftPosition, zString ); + } + + return 0; +} + +static int l_SetMercArrivalLocation(lua_State *L) +{ +UINT32 GridNo; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) GridNo = lua_tointeger(L,i); + } + + gGameExternalOptions.iInitialMercArrivalLocation = GridNo; + + return 0; +} + +static int l_GetDefaultArrivalSectorY (lua_State *L) +{ +INT16 sSectorY = 1; + + sSectorY = gsMercArriveSectorY; + + lua_pushinteger(L, sSectorY); + + return 1; +} + +static int l_GetDefaultArrivalSectorX (lua_State *L) +{ +INT16 sSectorX = 9; + + sSectorX = gsMercArriveSectorX; + + lua_pushinteger(L, sSectorX); + + return 1; +} + +static int l_GetDefaultArrivalSector (lua_State *L) +{ +INT16 sSectorX = 9; +INT16 sSectorY = 1; + + sSectorX = gsMercArriveSectorX; + sSectorY = gsMercArriveSectorY; + + lua_pushinteger(L, sSectorX); + lua_pushinteger(L, sSectorY); + + return 2; +} + +static int l_SetDefaultArrivalSector(lua_State *L) +{ +UINT8 sSectorX; +UINT8 sSectorY; +UINT8 n = lua_gettop(L); +int i; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) sSectorX = lua_tointeger(L,i); + if (i == 2 ) sSectorY = lua_tointeger(L,i); + } + + if ( ( sSectorX >= 1 || sSectorX <= 16 ) && ( sSectorY >= 1 || sSectorY <= 16 ) ) + { + gsMercArriveSectorX = sSectorX; + gsMercArriveSectorY = sSectorY; + + #ifdef JA2UB + JA2_5_START_SECTOR_X = sSectorX; + JA2_5_START_SECTOR_Y = sSectorY; + #endif + gGameExternalOptions.ubDefaultArrivalSectorX = sSectorX; + gGameExternalOptions.ubDefaultArrivalSectorY = sSectorY; + } + else + { + + #ifdef JA2UB + JA2_5_START_SECTOR_X = 7; + JA2_5_START_SECTOR_Y = 8; + + gsMercArriveSectorX = 7; + gsMercArriveSectorY = 8; + + gGameExternalOptions.ubDefaultArrivalSectorX = 7; + gGameExternalOptions.ubDefaultArrivalSectorY = 8; + + #else + + gsMercArriveSectorX = 9; + gsMercArriveSectorY = 1; + + + gGameExternalOptions.ubDefaultArrivalSectorX = 9; + gGameExternalOptions.ubDefaultArrivalSectorY = 1; + #endif + } + + return 0; +} static int l_BoxerExists(lua_State *L) { @@ -2560,6 +3442,24 @@ BOOLEAN Bool; return 1; } +static int l_gubBoxerID(lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +UINT8 val,val2; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) val = lua_tointeger(L,i); + if (i == 2 ) val2 = lua_tointeger(L,i); + } + + if ( val >= 0 && val <= 2 ) + gubBoxerID[ val ] = val2; + +return 0; +} + static int l_CheckTalkerUnpropositionedFemale(lua_State *L) { BOOLEAN Bool; @@ -2621,6 +3521,37 @@ UINT32 Town; return 0; } +static int l_InitProfile(lua_State *L) +{ +UINT8 n = lua_gettop(L); +int i; +UINT8 ubProfileID; +//UINT32 Town; +UINT16 x = 0; +UINT16 y = 0; +UINT8 z = 0; +UINT32 sGridNo; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) ubProfileID = lua_tointeger(L,i); + if (i == 2 ) x = lua_tointeger(L,i); + if (i == 3 ) y = lua_tointeger(L,i); + if (i == 4 ) z = lua_tointeger(L,i); + if (i == 5 ) sGridNo = lua_tointeger(L,i); + } + + gMercProfiles[ ubProfileID ].sSectorX = x; + gMercProfiles[ ubProfileID ].sSectorY = y; + gMercProfiles[ ubProfileID ].bSectorZ = z; + gMercProfiles[ ubProfileID ].sGridNo = sGridNo; + gMercProfiles[ ubProfileID ].fUseProfileInsertionInfo = TRUE; + gMercProfiles[ ubProfileID ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gMercProfiles[ ubProfileID ].usStrategicInsertionData = sGridNo; + +return 0; +} + static int l_GetgMercProfilesbTown(lua_State *L) { UINT8 n = lua_gettop(L); @@ -5664,15 +6595,17 @@ UINT16 SextorX; UINT16 SextorY; UINT8 SkyDrive; +UINT8 vehicle = 163; // Default: Helicopter for (i= 1; i<=n; i++ ) { if (i == 1 ) SextorX = lua_tointeger(L,i); if (i == 2 ) SextorY = lua_tointeger(L,i); if (i == 3 ) SkyDrive = lua_tointeger(L,i); + if (i == 4 ) vehicle = lua_tointeger(L,i); } - SetUpHelicopterForPlayer( SextorX, SextorY, SkyDrive ); + SetUpHelicopterForPlayer( SextorX, SextorY, SkyDrive, vehicle ); return 0; } @@ -6415,7 +7348,8 @@ static int l_SetGlobalLuaVal (lua_State *L) { UINT8 n = lua_gettop(L); int i; -UINT32 val,set; +UINT32 val; +INT32 set; for (i= 1; i<=n; i++ ) { @@ -6433,7 +7367,8 @@ static int l_GetGlobalLuaVal (lua_State *L) { UINT8 n = lua_gettop(L); int i; -UINT32 val,set; +UINT32 val; +INT32 set; for (i= 1; i<=n; i++ ) { @@ -6471,7 +7406,8 @@ static int l_CheckGlobalLuaVal (lua_State *L) { UINT8 n = lua_gettop(L); int i; -UINT32 val,set; +UINT32 val; +INT32 set; for (i= 1; i<=n; i++ ) { @@ -7209,6 +8145,122 @@ INT32 option2 = 0; // Option 2, vaies with action return 0; } +//AddEmailXML +static int l_AddEmailXML2 (lua_State *L) +{ + UINT8 n = lua_gettop(L); + int i; + + //INT32 iMessageOffset; + //INT32 iMessageLength; + UINT8 ubSender; + UINT8 uiIndex; + //INT32 iCurrentIMPPosition; + + UINT8 pMerc = 0; + UINT8 iMerc = 0; + UINT8 oMerc = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) uiIndex = lua_tointeger(L,i); + //if (i == 1 ) iMessageOffset = lua_tointeger(L,i); + //if (i == 2 ) iMessageLength = lua_tointeger(L,i); + if (i == 2 ) ubSender = lua_tointeger(L,i); + //if (i == 4 ) iCurrentIMPPosition = lua_tointeger(L,i); + } + + oMerc = uiIndex; + iMerc = oMerc * 1; + + if ( oMerc != 0 ) + pMerc = oMerc + 1; + else + pMerc = 0; + + AddEmailTypeXML(pMerc,iMerc, ubSender, GetWorldTotalMin(), -1, TYPE_EMAIL_OTHER); + //AddEmailTypeXML(iMessageOffset,iMessageLength, ubSender, GetWorldTotalMin(), iCurrentIMPPosition, TYPE_EMAIL_AIM_AVAILABLE); + return 0; +} + +//AddEmailXML +static int l_AddEmailXML (lua_State *L) +{ + UINT8 n = lua_gettop(L); + int i; + + //INT32 iMessageOffset; + //INT32 iMessageLength; + //UINT8 ubSender; + UINT8 uiIndex; + //INT32 iCurrentIMPPosition; + + UINT8 pMerc = 0; + UINT8 iMerc = 0; + UINT8 oMerc = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) uiIndex = lua_tointeger(L,i); + //if (i == 1 ) iMessageOffset = lua_tointeger(L,i); + //if (i == 2 ) iMessageLength = lua_tointeger(L,i); + //if (i == 3 ) ubSender = lua_tointeger(L,i); + //if (i == 4 ) iCurrentIMPPosition = lua_tointeger(L,i); + } + + oMerc = uiIndex; + iMerc = oMerc * 1; + + if ( oMerc != 0 ) + pMerc = oMerc + 1; + else + pMerc = 0; + + if ( gProfilesAIM[uiIndex].ProfilId == uiIndex ) + AddEmailTypeXML(pMerc,iMerc, iMerc, GetWorldTotalMin(), -1, TYPE_EMAIL_AIM_AVAILABLE); + //AddEmailTypeXML(iMessageOffset,iMessageLength, ubSender, GetWorldTotalMin(), iCurrentIMPPosition, TYPE_EMAIL_AIM_AVAILABLE); + return 0; +} + +//AddEmailXML +static int l_AddEmailLevelUpXML (lua_State *L) +{ + UINT8 n = lua_gettop(L); + int i; + + //INT32 iMessageOffset; + //INT32 iMessageLength; + //UINT8 ubSender; + UINT8 uiIndex; + //INT32 iCurrentIMPPosition; + + UINT8 pMerc = 0; + UINT8 iMerc = 0; + UINT8 oMerc = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) uiIndex = lua_tointeger(L,i); + //if (i == 1 ) iMessageOffset = lua_tointeger(L,i); + //if (i == 2 ) iMessageLength = lua_tointeger(L,i); + //if (i == 3 ) ubSender = lua_tointeger(L,i); + //if (i == 4 ) iCurrentIMPPosition = lua_tointeger(L,i); + } + + oMerc = uiIndex; + iMerc = oMerc * 1; + + if ( oMerc != 0 ) + pMerc = oMerc + 1; + else + pMerc = 0; + + if ( gProfilesMERC[uiIndex].ProfilId == uiIndex ) + AddEmailTypeXML(pMerc,iMerc, iMerc, GetWorldTotalMin(), -1, TYPE_EMAIL_MERC_LEVEL_UP); + //AddEmailTypeXML(iMessageOffset,iMessageLength, ubSender, GetWorldTotalMin(), iCurrentIMPPosition, TYPE_EMAIL_MERC_LEVEL_UP); + return 0; +} + //AddEmail static int l_AddEmail (lua_State *L) { @@ -7230,7 +8282,7 @@ static int l_AddEmail (lua_State *L) if (i == 5) iCurrentShipmentDestinationID = lua_tointeger(L,i); } - AddEmail(iMessageOffset,iMessageLength,ubSender, GetWorldTotalMin(), iCurrentIMPPosition, iCurrentShipmentDestinationID); + AddEmail(iMessageOffset,iMessageLength,ubSender, GetWorldTotalMin(), iCurrentIMPPosition, iCurrentShipmentDestinationID, TYPE_EMAIL_EMAIL_EDT); return 0; } @@ -7253,7 +8305,7 @@ UINT8 ubSender; if (i == 3 ) ubSender = lua_tointeger(L,i); } - AddPreReadEmail(iMessageOffset,iMessageLength,ubSender, GetWorldTotalMin()); + AddPreReadEmail(iMessageOffset,iMessageLength,ubSender, GetWorldTotalMin(), TYPE_EMAIL_EMAIL_EDT); return 0; } @@ -10552,6 +11604,186 @@ static int l_AddAltUnderGroundSector(lua_State *L) return 0; } +//--------------Briefing room-----------------------30-06-2011 + +static int l_SetEndMission(lua_State *L) +{ + UINT32 idMission, nextMission; + UINT8 n = lua_gettop(L); + int i = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) idMission = lua_tointeger(L,i); + } + + if ( gBriefingRoomData[idMission].CheckMission == MISSIONSTART ) + { + gBriefingRoomData[idMission].CheckMission = MISSIONEND; //set end mission + nextMission = gBriefingRoomData[idMission].NextMission; + if ( nextMission != -1 ) + gBriefingRoomData[nextMission].Hidden = TRUE; // set next mission + } + + return 0; +} + +static int l_SetStartMission(lua_State *L) +{ + UINT32 idMission; + UINT8 n = lua_gettop(L); + int i = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) idMission = lua_tointeger(L,i); + } + + if ( gBriefingRoomData[idMission].CheckMission != MISSIONSTART || gBriefingRoomData[idMission].CheckMission != MISSIONEND || gBriefingRoomData[idMission].CheckMission == MISSIONNOSTARTED ) + { + gBriefingRoomData[idMission].CheckMission = MISSIONSTART; //set start mission + gBriefingRoomData[idMission].Hidden = TRUE; // set next mission + } + + return 0; +} + +static int l_CheckMission (lua_State *L) +{ + UINT8 n = lua_gettop(L); + int i = 0; + UINT32 idMission = 0; + UINT32 Bool = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) idMission = lua_tointeger(L,i); + } + + if ( gBriefingRoomData[idMission].CheckMission == MISSIONNOSTARTED) + Bool = 0; + else if ( gBriefingRoomData[idMission].CheckMission == MISSIONSTART) + Bool = 1; + else if (gBriefingRoomData[idMission].CheckMission == MISSIONEND) + Bool = 2; + + lua_pushinteger(L, Bool); + + + return 1; +} + +//-------------------------------------------------------------- + +static int l_RemoveGraphicFromTempFile (lua_State *L) +{ + UINT8 n = lua_gettop(L); + int i = 0; + INT32 uiMapIndex; + UINT16 usIndex; + INT16 sSectorX; + INT16 sSectorY; + UINT8 ubSectorZ; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) uiMapIndex = lua_tointeger(L,i); + if (i == 2 ) usIndex = lua_tointeger(L,i); + if (i == 3 ) sSectorX = lua_tointeger(L,i); + if (i == 4 ) sSectorY = lua_tointeger(L,i); + if (i == 5 ) ubSectorZ = lua_tointeger(L,i); + } + + RemoveGraphicFromTempFile( uiMapIndex, usIndex, sSectorX, sSectorY, ubSectorZ ); + + + return 0; +} + +//------------ Towns function +/* +static int l_ResizeTown (lua_State *L) +{ + UINT8 n = lua_gettop(L); + + UINT16 x = 0; + UINT16 y = 0; + UINT8 TownID; + + int i = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) x = lua_tointeger(L,i); + if (i == 2 ) y = lua_tointeger(L,i); + if (i == 3 ) TownID = lua_tointeger(L,i); + } + + if ( TownID > 0 && TownID <= NUM_TOWNS ) //MAX_TOWNS + StrategicMap[SECTOR( x, y )].bNameId = TownID; + + return 0; +} + +static int l_EraseTown (lua_State *L) +{ + UINT8 n = lua_gettop(L); + + UINT8 TownID,cnt; + + int i = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) TownID = lua_tointeger(L,i); + } + + for (cnt = 0; cnt < 256; cnt++) + { + if ( StrategicMap[cnt].bNameId == TownID && TownID < NUM_TOWNS ) StrategicMap[cnt].bNameId = 0; + } + + return 0; +} +*/ +static int l_HiddenTown (lua_State *L) +{ + UINT8 n = lua_gettop(L); + UINT8 TownID; + + int i = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) TownID = lua_tointeger(L,i); + } + + if ( TownID > 0 && TownID <= NUM_TOWNS ) + gfHiddenTown[TownID] = FALSE; + + return 0; +} + +static int l_VisibleTown (lua_State *L) +{ + UINT8 n = lua_gettop(L); + UINT8 TownID; + + int i = 0; + + for (i= 1; i<=n; i++ ) + { + if (i == 1 ) TownID = lua_tointeger(L,i); + } + + if ( TownID > 0 && TownID <= NUM_TOWNS ) + gfHiddenTown[TownID] = TRUE; + + return 0; +} + +//--------------- + static int lh_getBooleanFromTable(lua_State *L, const char * fieldname) { lua_getfield(L, -1, fieldname); diff --git a/Strategic/LuaInitNPCs.h b/Strategic/LuaInitNPCs.h index e7fe5333..c50641a3 100644 --- a/Strategic/LuaInitNPCs.h +++ b/Strategic/LuaInitNPCs.h @@ -56,8 +56,8 @@ extern BOOLEAN LetLuaInterfaceDialogue( UINT8 ubNPC, UINT8 InitFunction); extern BOOLEAN LuaHandlePlayerTeamMemberDeath(UINT8 ProfileId, UINT8 Init); extern BOOLEAN LuaHandleNPCTeamMemberDeath(UINT8 ProfileId, UINT8 Init); extern BOOLEAN LuaCheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck, UINT8 Init); -extern BOOLEAN LuaHandleQuestCodeOnSectorExit( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); -extern BOOLEAN LuaHandleQuestCodeOnSectorEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); +extern BOOLEAN LuaHandleQuestCodeOnSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); +//extern BOOLEAN LuaHandleQuestCodeOnSectorEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); extern BOOLEAN LuaHandleDelayedItemsArrival( UINT32 uiReason, UINT8 Init); extern BOOLEAN LetLuaHandleNPCSystemEvent( UINT32 uiEvent, UINT8 Init); @@ -69,6 +69,12 @@ extern void IniLuaGlobal(); extern BOOLEAN LoadLuaGlobalFromLoadGameFile( HWFILE hFile ); extern BOOLEAN SaveLuaGlobalToSaveGameFile( HWFILE hFile ); + +#ifdef JA2UB +extern BOOLEAN LuaInitStrategicLayer(UINT8 Init); +extern BOOLEAN LetLuaMakeBadSectorListFromMapsOnHardDrive(UINT8 Init); +#endif + //Intro extern BOOLEAN LuaIntro(UINT8 Init, UINT32 uiCurrentVideo, INT8 bIntroType, UINT32 iStringToUse); diff --git a/Strategic/Luaglobal.cpp b/Strategic/Luaglobal.cpp index d3bc205e..36faad62 100644 --- a/Strategic/Luaglobal.cpp +++ b/Strategic/Luaglobal.cpp @@ -22,6 +22,7 @@ #include "Queen Command.h" #include "gamescreen.h" #include "Map Screen Interface Map.h" +#include "ub_config.h" #include "Creature Spreading.h" #include "World Items.h" @@ -34,6 +35,8 @@ extern "C" { #include "lualib.h" } +#include "Ja25_Tactical.h" + using namespace std; extern BOOLEAN gfDoneWithSplashScreen; @@ -50,6 +53,11 @@ void IniGlobalGameSetting(lua_State *L) lua_pushinteger(L, gGameOptions.ubDifficultyLevel); lua_setglobal(L, "newDIFFICULTY_LEVEL"); + +#ifdef JA2UB + lua_pushinteger(L, gGameOptions.ubDifficultyLevel); + lua_setglobal(L, "difficultyLevel"); +#endif // ------------------------------- // ja2_options.ini Settings (use "ini" prefix) @@ -84,10 +92,74 @@ void IniGlobalGameSetting(lua_State *L) lua_pushinteger(L, gGameExternalOptions.fCanTrueCiviliansBecomeHostile); lua_setglobal(L, "iniCAN_TRUE_CIVILIANS_BECOME_HOSTILE"); +#ifdef JA2UB + lua_pushinteger(L, gGameUBOptions.LOCATEGRIDNO); + lua_setglobal(L, "iniNEW_MERC_ARRIVAL_LOCATION"); +#else + lua_pushinteger(L, gGameExternalOptions.iInitialMercArrivalLocation); + lua_setglobal(L, "iniNEW_MERC_ARRIVAL_LOCATION"); +#endif + + lua_pushinteger(L, gGameExternalOptions.ubDefaultArrivalSectorY); + lua_setglobal(L, "iniDEFAULT_ARRIVAL_SECTOR_Y"); + + lua_pushinteger(L, gGameExternalOptions.ubDefaultArrivalSectorX); + lua_setglobal(L, "iniDEFAULT_ARRIVAL_SECTOR_X"); + +#ifdef JA2UB + lua_pushinteger(L, gGameUBOptions.ubEndDefaultSectorX); + lua_setglobal(L, "iniDEFAULT_END_SECTOR_X"); + + lua_pushinteger(L, gGameUBOptions.ubEndDefaultSectorY); + lua_setglobal(L, "iniDEFAULT_END_SECTOR_Y"); + + lua_pushinteger(L, gGameUBOptions.ubEndDefaultSectorZ); + lua_setglobal(L, "iniDEFAULT_END_SECTOR_Z"); + + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 0 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO1"); + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 1 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO2"); + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 2 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO3"); + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 3 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO4"); + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 4 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO5"); + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 5 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO6"); + lua_pushinteger(L, gGameUBOptions.InitialHeliGridNo[ 6 ]); + lua_setglobal(L, "iniINITIALHELIGRIDNO7"); + + lua_pushinteger(L, gGameUBOptions.JerryGridNo); + lua_setglobal(L, "iniJERRYGRIDNO"); + + lua_pushboolean(L, gGameUBOptions.LaptopQuestEnabled); + lua_setglobal(L, "iniLAPTOP_QUEST"); + + lua_pushboolean(L, gGameUBOptions.InJerry); + lua_setglobal(L, "iniJERRY"); + + lua_pushboolean(L, gGameUBOptions.JerryQuotes); + lua_setglobal(L, "iniJERRYQUOTES"); + + lua_pushboolean(L, gGameUBOptions.InGameHeliCrash); + lua_setglobal(L, "iniINGAMEHELICRASH"); + + + lua_pushboolean(L, gGameUBOptions.InGameHeli); + lua_setglobal(L, "iniINGAMEHELI"); +#endif + // ------------------------------- // Other global variables // ------------------------------- - + +#ifdef JA2UB + lua_pushinteger(L, gGameUBOptions.TestUB); + lua_setglobal(L, "TestUB"); +#endif + lua_pushinteger(L, gGameExternalOptions.ubDefaultArrivalSectorY); lua_setglobal(L, "ubDefaultArrivalSectorY"); @@ -166,9 +238,39 @@ void IniGlobalGameSetting(lua_State *L) lua_pushboolean(L, IsMusicPlaying()); lua_setglobal(L, "fMusicPlaying"); - // unused - //lua_pushboolean(L, gfForceMusicToTense); - //lua_setglobal(L, "gfForceMusicToTense"); +// lua_pushboolean(L, gfForceMusicToTense); +// lua_setglobal(L, "gfForceMusicToTense"); + + //GameExternalOptions + lua_pushboolean(L, gGameExternalOptions.gfInvestigateSector); + lua_setglobal(L, "gfInvestigateSector"); + + lua_pushboolean(L, gGameExternalOptions.fMercDayOne); + lua_setglobal(L, "fMercDayOne"); + + lua_pushinteger(L, gGameOptions.ubGameStyle); + lua_setglobal(L, "gameStyle"); + + lua_pushinteger(L, gGameExternalOptions.fEnableCrepitus); + lua_setglobal(L, "enableCrepitus"); + + lua_pushinteger(L, gGameOptions.ubDifficultyLevel); + lua_setglobal(L, "difficultyLevel"); + + lua_pushinteger(L, gGameExternalOptions.iStartingCashNovice); + lua_setglobal(L, "startingCashNovice"); + + lua_pushinteger(L, gGameExternalOptions.iStartingCashExperienced); + lua_setglobal(L, "startingCashExperienced"); + + lua_pushinteger(L, gGameExternalOptions.iStartingCashExpert); + lua_setglobal(L, "startingCashExpert"); + + lua_pushinteger(L, gGameExternalOptions.iStartingCashInsane); + lua_setglobal(L, "startingCashInsane"); + + lua_pushinteger(L, gGameExternalOptions.fCanTrueCiviliansBecomeHostile); + lua_setglobal(L, "fCanTrueCiviliansBecomeHostile"); // WANNE: Currently not used lua_pushinteger(L, guiNumWorldItems); @@ -196,5 +298,82 @@ void IniGlobalGameSetting(lua_State *L) lua_setglobal(L, "gfDoneWithSplashScreen"); lua_pushinteger(L, gbIntroScreenMode); - lua_setglobal(L, "gbIntroScreenMode"); + lua_setglobal(L, "gbIntroScreenMode"); + +#ifdef JA2UB + lua_pushboolean(L, gGameUBOptions.fTexAndJohn); + lua_setglobal(L, "enabledJohnAndTex"); + + lua_pushboolean(L, gGameUBOptions.fRandomManuelText); + lua_setglobal(L, "RandomManuelText"); +#endif + +#ifdef JA2UB + //Items + lua_pushinteger(L, BARRETT_UB); + lua_setglobal(L, "itemBARRETT_UB"); + + lua_pushinteger(L, CALICO_960_UB); + lua_setglobal(L, "itemCALICO_960_UB"); + + lua_pushinteger(L, PSG1_UB); + lua_setglobal(L, "itemPSG1_UB"); + + lua_pushinteger(L, L85_UB); + lua_setglobal(L, "itemL85_UB"); + + lua_pushinteger(L, TAR21_UB); + lua_setglobal(L, "itemTAR21_UB"); + + lua_pushinteger(L, VAL_SILENT_UB); + lua_setglobal(L, "itemVAL_SILENT_UB"); + + lua_pushinteger(L, MICRO_UZI_UB); + lua_setglobal(L, "itemMICRO_UZI_UB"); + + lua_pushinteger(L, CALICO_950_UB); + lua_setglobal(L, "itemCALICO_950_UB"); + + lua_pushinteger(L, CALICO_900_UB); + lua_setglobal(L, "itemCALICO_900_UB"); + + lua_pushinteger(L, CLIP_CANNON_BALL); + lua_setglobal(L, "itemCLIP_CANNON_BALL"); + + lua_pushinteger(L, MERC_UMBRELLA); + lua_setglobal(L, "itemMERC_UMBRELLA"); + + lua_pushinteger(L, HAND_CANNON); + lua_setglobal(L, "itemHAND_CANNON"); + + lua_pushinteger(L, HARTFORD_6_SHOOTER); + lua_setglobal(L, "itemHARTFORD_6_SHOOTER"); + + lua_pushinteger(L, TEX_MOVIE_ATTACK_CLYDESDALES); + lua_setglobal(L, "itemTEX_MOVIE_ATTACK_CLYDESDALES"); + + lua_pushinteger(L, TEX_MOVIE_WILD_EAST); + lua_setglobal(L, "itemTEX_MOVIE_WILD_EAST"); + + lua_pushboolean(L, TEX_MOVIE_HAVE_HONDA); + lua_setglobal(L, "itemTEX_MOVIE_HAVE_HONDA"); + + lua_pushboolean(L, LAPTOP_TRANSMITTER); + lua_setglobal(L, "itemLAPTOP_TRANSMITTER"); + + lua_pushboolean(L, CHE_GUEVARA_CANTEEN); + lua_setglobal(L, "itemCHE_GUEVARA_CANTEEN"); + + lua_pushboolean(L, MERC_WRISTWATCH); + lua_setglobal(L, "itemMERC_WRISTWATCH"); + + lua_pushboolean(L, SAM_GARVER_COMBAT_KNIFE); + lua_setglobal(L, "itemSAM_GARVER_COMBAT_KNIFE"); + + lua_pushboolean(L, MERC_UMBRELLA_OLD); + lua_setglobal(L, "itemMERC_UMBRELLA_OLD"); + + lua_pushboolean(L, MORRIS_INSTRUCTION_NOTE); + lua_setglobal(L, "itemMORRIS_INSTRUCTION_NOTE"); +#endif } \ No newline at end of file diff --git a/Strategic/Luaglobal.h b/Strategic/Luaglobal.h index d056b9ed..7c328cec 100644 --- a/Strategic/Luaglobal.h +++ b/Strategic/Luaglobal.h @@ -11,13 +11,17 @@ extern "C" { // -------------------------- // WANNE: Should we enable lua scripting for different actions, or should we use "hardcoded" stuff instead? -#define LUA_GAME_INIT_NEW_GAME // GameInit.lua (Function: InitNewGame) -#define LUA_GAME_INIT_NPCS // GameInit.lua (Function: InitNPCs) -#define LUA_INTRO // Intro.lua -#define LUA_HOURLY_QUEST_UPDATE // HourlyUpdate.lua -#define LUA_STRATEGY_EVENT_HANDLER // StrategicEventHandler.lua -#define LUA_STRATEGY_TOWN_LOYALTY // StrategicTownLoyalty.lua -#define LUA_OVERHEAD // Overhead.lua + +#define LUA_INTERFACE_DIALOGUE // InterfaceDialogue.lua +#define LUA_EXPLOSION_CONTROL // ExplosionControl.lua +#define LUA_HANDLE_QUEST_CODE_ON_SECTOR // Strategicmap.lua +#define LUA_GAME_INIT_NEW_GAME // GameInit.lua (Function: InitNewGame) +#define LUA_GAME_INIT_NPCS // GameInit.lua (Function: InitNPCs) +#define LUA_INTRO // Intro.lua +#define LUA_HOURLY_QUEST_UPDATE // HourlyUpdate.lua +#define LUA_STRATEGY_EVENT_HANDLER // StrategicEventHandler.lua +#define LUA_STRATEGY_TOWN_LOYALTY // StrategicTownLoyalty.lua +#define LUA_OVERHEAD // Overhead.lua // -------------------------- void IniGlobalGameSetting(lua_State *L); diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index abf31cdc..b6d674d4 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -42,6 +42,7 @@ #include "Facilities.h" #endif +#include "Vehicles.h" // the amounts of time to wait for hover stuff #define TIME_DELAY_FOR_HOVER_WAIT 10 // minutes @@ -69,7 +70,7 @@ extern PathStPtr pTempHelicopterPath; extern UINT8 ubSAMControlledSectors[ MAP_WORLD_Y ][ MAP_WORLD_X ]; // the seating capacities -extern INT32 iSeatingCapacities[]; +//extern INT32 iSeatingCapacities[]; // the static NPC dialogue faces //extern UINT32 uiExternalStaticNPCFaces[]; @@ -677,8 +678,13 @@ void LandHelicopter( void ) } else { +#ifdef JA2UB + Assert( 0 ); +//No meanwhiles +#else // play meanwhile scene if it hasn't been used yet HandleKillChopperMeanwhileScene(); +#endif } } @@ -862,7 +868,7 @@ void SetUpHelicopterForMovement( void ) pVehicleList[ iHelicopterVehicleId ].ubMovementGroup = CreateNewVehicleGroupDepartingFromSector( ( UINT8 )( pVehicleList[ iHelicopterVehicleId ].sSectorX ), ( UINT8 )( pVehicleList[ iHelicopterVehicleId ].sSectorY ), iHelicopterVehicleId ); // add everyone in vehicle to this mvt group - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iHelicopterVehicleId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iHelicopterVehicleId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iHelicopterVehicleId ].pPassengers[ iCounter ] != NULL ) { @@ -949,14 +955,14 @@ void UpdateRefuelSiteAvailability( void ) } -void SetUpHelicopterForPlayer( INT16 sX, INT16 sY , UINT8 SkyDrive ) +void SetUpHelicopterForPlayer( INT16 sX, INT16 sY , UINT8 SkyDrive, UINT8 VehicleID ) { if( fSkyRiderSetUp == FALSE ) { fHelicopterAvailable = TRUE; fSkyRiderAvailable = TRUE; - iHelicopterVehicleId = AddVehicleToList( sX, sY, 0, HELICOPTER ); + iHelicopterVehicleId = AddVehicleToList( sX, sY, 0, VehicleID ); //HELICOPTER Assert( iHelicopterVehicleId != -1 ); @@ -1001,7 +1007,7 @@ UINT8 MoveAllInHelicopterToFootMovementGroup( void ) } // go through list of everyone in helicopter - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iHelicopterVehicleId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iHelicopterVehicleId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { // get passenger pSoldier = pVehicleList[ iHelicopterVehicleId ].pPassengers[ iCounter ]; diff --git a/Strategic/Map Screen Helicopter.h b/Strategic/Map Screen Helicopter.h index 2f07c6ff..c51f9b5f 100644 --- a/Strategic/Map Screen Helicopter.h +++ b/Strategic/Map Screen Helicopter.h @@ -191,7 +191,7 @@ BOOLEAN IsRefuelSiteInSector( INT16 sMapX, INT16 sMapY ); void UpdateRefuelSiteAvailability( void ); // setup helicopter for player -void SetUpHelicopterForPlayer( INT16 sX, INT16 sY , UINT8 SkyDrive ); +void SetUpHelicopterForPlayer( INT16 sX, INT16 sY , UINT8 SkyDrive, UINT8 VehicleID ); // the intended path of the helicopter INT32 DistanceOfIntendedHelicopterPath( void ); diff --git a/Strategic/Map Screen Interface Border.cpp b/Strategic/Map Screen Interface Border.cpp index f9918173..0bebdc80 100644 --- a/Strategic/Map Screen Interface Border.cpp +++ b/Strategic/Map Screen Interface Border.cpp @@ -28,12 +28,13 @@ // Also include Town Militia for checks regarding Mobile Militia Restrictions #include "Town Militia.h" // Also include Quests, for checking whether a fact is true. - #include "Quests.h" + #include "Quests.h" #endif - #include "connect.h" - +#ifdef JA2UB +#include "ub_config.h" +#endif //#define MAP_BORDER_CORNER_X 584 //#define MAP_BORDER_CORNER_Y 279 @@ -454,6 +455,65 @@ BOOLEAN CreateButtonsForMapBorder( void ) // SetButtonCursor(guiMapBorderLandRaiseButtons[ 0 ], MSYS_NO_CURSOR ); // SetButtonCursor(guiMapBorderLandRaiseButtons[ 1 ], MSYS_NO_CURSOR ); + +#ifdef JA2UB + //EnableButton + + if (gGameUBOptions.BorderTown == TRUE) + { + EnableButton( giMapBorderButtons[ MAP_BORDER_TOWN_BTN ]); + } + else + { + DisableButton( giMapBorderButtons[ MAP_BORDER_TOWN_BTN ]); + } + + if (gGameUBOptions.BorderMine == TRUE) + { + EnableButton( giMapBorderButtons[ MAP_BORDER_MINE_BTN ]); + } + else + { + DisableButton( giMapBorderButtons[ MAP_BORDER_MINE_BTN ]); + } + + if (gGameUBOptions.BorderTeams == TRUE) + { + EnableButton( giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ]); + } + else + { + DisableButton( giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ]); + } + + if (gGameUBOptions.BorderMilitia == TRUE) + { + EnableButton( giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ]); + } + else + { + DisableButton( giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ]); + } + + if (gGameUBOptions.BorderAirspace == TRUE) + { + EnableButton( giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ]); + } + else + { + DisableButton( giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ]); + } + + if (gGameUBOptions.BorderItem == TRUE) + { + EnableButton( giMapBorderButtons[ MAP_BORDER_ITEM_BTN ]); + } + else + { + DisableButton( giMapBorderButtons[ MAP_BORDER_ITEM_BTN ]); + } +#endif + InitializeMapBorderButtonStates( ); return( TRUE ); diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 702844b1..6d6bfdb6 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -54,6 +54,13 @@ #include "game init.h" #endif +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "SaveLoadGame.h" +#include "strategicmap.h" +#endif + #include "connect.h" /* CHRISL: Adjusted settings to allow new Map_Screen_Bottom_800x600.sti to work. This is needed if we @@ -1329,11 +1336,15 @@ BOOLEAN AllowedToTimeCompress( void ) return( FALSE ); } +#ifdef JA2UB +//Ja25 no meanwhiles +#else // meanwhile coming up if ( gfMeanwhileTryingToStart ) { return( FALSE ); } +#endif // someone has something to say if ( !DialogueQueueIsEmpty() ) @@ -1419,7 +1430,18 @@ BOOLEAN AllowedToTimeCompress( void ) { return FALSE; } - +#ifdef JA2UB + //if the player hasnt been to the initial sector yet + if( !GetSectorFlagStatus( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, 0, SF_HAS_ENTERED_TACTICAL ) ) //7, 8 + { + //if there is something that jerry wants to say + if( !WillJerryMiloAllowThePlayerToCompressTimeAtBeginingOfGame() ) + { + return( FALSE ); + } + } +#endif + return( TRUE ); } @@ -1734,8 +1756,11 @@ BOOLEAN AnyUsableRealMercenariesOnTeam( void ) void RequestTriggerExitFromMapscreen( INT8 bExitToWhere ) { - Assert( ( bExitToWhere >= MAP_EXIT_TO_LAPTOP ) && ( bExitToWhere <= MAP_EXIT_TO_MAINMENU ) ); - +#ifdef JA2UB + Assert( ( bExitToWhere >= MAP_EXIT_TO_LAPTOP ) && ( bExitToWhere <= MAP_EXIT_TO_INTRO_SCREEN ));//MAP_EXIT_TO_MAINMENU ) ); +#else + Assert( ( bExitToWhere >= MAP_EXIT_TO_LAPTOP ) && ( bExitToWhere <= MAP_EXIT_TO_MAINMENU )); +#endif // if allowed to do so if ( AllowedToExitFromMapscreenTo( bExitToWhere ) ) { @@ -1777,8 +1802,11 @@ void RequestTriggerExitFromMapscreen( INT8 bExitToWhere ) BOOLEAN AllowedToExitFromMapscreenTo( INT8 bExitToWhere ) { +#ifdef JA2UB + Assert( ( bExitToWhere >= MAP_EXIT_TO_LAPTOP ) && ( bExitToWhere <= MAP_EXIT_TO_INTRO_SCREEN)); //MAP_EXIT_TO_MAINMENU ) ); +#else Assert( ( bExitToWhere >= MAP_EXIT_TO_LAPTOP ) && ( bExitToWhere <= MAP_EXIT_TO_MAINMENU ) ); - +#endif // if already leaving, disallow any other attempts to exit if ( fLeavingMapScreen ) { @@ -1813,11 +1841,15 @@ BOOLEAN AllowedToExitFromMapscreenTo( INT8 bExitToWhere ) return( FALSE ); } +#ifdef JA2UB +//Ja25 No meanwhiles +#else // meanwhile coming up if ( gfMeanwhileTryingToStart ) { return( FALSE ); } +#endif // if we're locked into paused time compression by some event that enforces that if ( PauseStateLocked() ) @@ -1953,6 +1985,13 @@ void HandleExitsFromMapScreen( void ) ReStartingGame(); SetPendingNewScreen( MAINMENU_SCREEN ); break; +#ifdef JA2UB + //JA25 ub + case MAP_EXIT_TO_INTRO_SCREEN: + // SetPendingNewScreen( INTRO_SCREEN ); + BeginLoadScreen(); + break; +#endif default: // invalid exit type Assert( FALSE ); diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index b1a175f9..c43ebe14 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -10,7 +10,9 @@ #else #define MAX_MESSAGES_ON_MAP_BOTTOM 9 #endif - +#ifdef JA2UB +extern INT8 gbExitingMapScreenToWhere; +#endif // exit to where defines enum{ MAP_EXIT_TO_LAPTOP = 0, @@ -18,6 +20,9 @@ enum{ MAP_EXIT_TO_OPTIONS, MAP_EXIT_TO_LOAD, MAP_EXIT_TO_SAVE, +#ifdef JA2UB + MAP_EXIT_TO_INTRO_SCREEN, +#endif // OJW - 20090210 - clean resources on disconnect MAP_EXIT_TO_MAINMENU }; diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 3cd0599d..0eaedd8e 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -40,6 +40,7 @@ #include "InterfaceItemImages.h" #include "SaveLoadGame.h"//dnl ch51 081009 #include "Map Information.h"//dnl ch51 091009 +#include "Interface Items.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 23f52310..5bea60e8 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -593,6 +593,71 @@ void AnimateRoute( PathStPtr pPath ); extern void EndConfirmMapMoveMode( void ); extern BOOLEAN CanDrawSectorCursor( void ); +void DrawIconL(INT32 MAP_GRID_X2, INT32 MAP_GRID_Y2, INT32 i, INT32 Sector_X , INT32 Sector_Y ); //Legion +UINT32 guiIcon2[256]; +ICON_FILE gHiddenIcon[ 256 ]; + +#ifdef JA2UB +void SetUpValidCampaignSectors( void ); +#endif + +BOOLEAN LoadHiddenTownFromLoadGameFile( HWFILE hFile ); +BOOLEAN SaveHiddenTownToSaveGameFile( HWFILE hFile ); + +//--------------Legion 2----Jazz----------- + +void DrawIconL(INT32 MAP_GRID_X2, INT32 MAP_GRID_Y2, INT32 i, INT32 Sector_X , INT32 Sector_Y ) +{ + UINT8 *pDestBuf2; + UINT32 uiDestPitchBYTES; + INT16 sX, sY; + HVOBJECT hHandle; + INT8 ubVidObjIndex = 0; + + if( fZoomFlag ) + { + pDestBuf2 = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, MAP_VIEW_START_X+MAP_GRID_X - 1, MAP_VIEW_START_Y+MAP_GRID_Y - 1, MAP_VIEW_WIDTH+1,MAP_VIEW_HEIGHT-9 ); + UnLockVideoSurface(guiSAVEBUFFER); + + GetScreenXYFromMapXYStationary( Sector_X, Sector_Y, &sX, &sY ); + sX += -MAP_GRID_X + MAP_GRID_X2; + sY += -MAP_GRID_Y - MAP_GRID_Y2; + ubVidObjIndex = 0; + } + else + { + GetScreenXYFromMapXY( Sector_X, Sector_Y, &sX, &sY ); + + sX = (UINT16) (MAP_VIEW_START_X + MAP_GRID_X + (MAP_GRID_X2 * MAP_GRID_X) / 10); + sY = (UINT16) (MAP_VIEW_START_Y + MAP_GRID_Y + ((MAP_GRID_Y2 * MAP_GRID_Y) / 10) + 1); + + /* + if (iResolution == 0) + { + sY += MAP_GRID_Y2; + sX += MAP_GRID_X2; + } + else if (iResolution == 1) + { + sY += + 5 + MAP_GRID_Y2; + sX += - MAP_GRID_X2 + 3; + } + else if (iResolution == 2) + { + sY += + 10 + MAP_GRID_Y2; + sX += - MAP_GRID_X2 + 10; + } + */ + ubVidObjIndex = 1; + } + + // draw Tixa in its sector + GetVideoObject( &hHandle, guiIcon2[i]); + BltVideoObject( guiSAVEBUFFER, hHandle, ubVidObjIndex, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); +} + +//----------------------------------- // This method outputs the numbers (1-16) and letters (A - P) void DrawMapIndexBigMap( BOOLEAN fSelectedCursorIsYellow ) @@ -724,6 +789,9 @@ UINT32 DrawMap( void ) SGPRect clip; INT16 cnt, cnt2; INT32 iCounter = 0; + INT32 iCounter2 = 0; + INT16 pSectorX = 0, pSectorY = 0; + INT16 sBaseSectorValue = 0; //MAP_VIEW_START_X = (SCREEN_WIDTH - 370); //MAP_VIEW_START_Y = 10; @@ -932,7 +1000,27 @@ UINT32 DrawMap( void ) // UNFORTUNATELY, WE CAN'T SHADE THESE ICONS AS PART OF SHADING THE MAP, BECAUSE FOR AIRSPACE, THE SHADE FUNCTION // DOESN'T MERELY SHADE THE EXISTING MAP SURFACE, BUT INSTEAD GRABS THE ORIGINAL GRAPHICS FROM BIGMAP, AND CHANGES // THEIR PALETTE. BLITTING ICONS PRIOR TO SHADING WOULD MEAN THEY DON'T SHOW UP IN AIRSPACE VIEW AT ALL. + + for (cnt = 1; cnt < NUM_TOWNS; cnt++) + { + if ( gfHiddenTown[ cnt ] == TRUE ) + { + if ( gfIconTown[ cnt ] == TRUE && gfDrawHiddenTown[ cnt ] == TRUE ) + { + sBaseSectorValue = sBaseSectorList[ cnt-1 ]; + pSectorX = SECTORX( sBaseSectorValue ); + pSectorY = SECTORY( sBaseSectorValue ); + + INT8 bTownId = GetTownIdForSector( pSectorX, pSectorY ); + if ( /*bTownId != 0 &&*/ bTownId < NUM_TOWNS ) + { + DrawIconL(gHiddenIcon[cnt].IconX, gHiddenIcon[cnt].IconY, cnt, pSectorX, pSectorY); + } + } + } + } + /* // if Orta found if( fFoundOrta ) { @@ -944,7 +1032,8 @@ UINT32 DrawMap( void ) { DrawTixa(); } - + */ + // draw SAM sites ShowSAMSitesOnStrategicMap( ); @@ -1081,7 +1170,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1"); for( bTown = FIRST_TOWN; bTown < NUM_TOWNS; bTown++) { // skip Orta/Tixa until found - if( ( ( fFoundOrta != FALSE ) || ( bTown != ORTA ) ) && ( ( bTown != TIXA ) || ( fFoundTixa != FALSE) ) ) + //if( ( ( fFoundOrta != FALSE ) || ( bTown != ORTA ) ) && ( ( bTown != TIXA ) || ( fFoundTixa != FALSE) ) ) + if( gfHiddenTown[ bTown ] == TRUE ) { swprintf( sString, L"%s", pTownNames[ bTown ] ); @@ -4212,6 +4302,18 @@ void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY ) BOOLEAN IsTheCursorAllowedToHighLightThisSector( INT16 sSectorX, INT16 sSectorY ) { + //Ja25UB + // check to see if this sector is a blocked out sector? +/* if ( !SectorInfo[ ( SECTOR( sSectorX, sSectorY ) ) ].fValidSector ) + { + return ( FALSE ); + } + else + { + // return cursor is allowed to highlight this sector + return ( TRUE ); + } +*/ // check to see if this sector is a blocked out sector? if( sBadSectorsList[ sSectorX ][ sSectorY ] ) @@ -4793,7 +4895,7 @@ void DisplayPositionOfHelicopter( void ) RemoveVehicleFromList (iHelicopterVehicleId); InitAVehicle (iHelicopterVehicleId, 13, MAP_ROW_B); fSkyRiderSetUp = FALSE; - SetUpHelicopterForPlayer( 13, MAP_ROW_B , SKYRIDER ); + SetUpHelicopterForPlayer( 13, MAP_ROW_B, gNewVehicle[ HELICOPTER ].NewPilot, HELICOPTER ); pGroup = GetGroup( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup ); if (!pGroup) { static bool heliMsg2Given = false; @@ -5186,7 +5288,8 @@ void BlitTownGridMarkers( void ) while( pTownNamesList[ iCounter ] != 0 ) { // skip Orta/Tixa until found - if( ( ( fFoundOrta != FALSE ) || ( pTownNamesList[ iCounter ] != ORTA ) ) && ( ( pTownNamesList[ iCounter ] != TIXA ) || ( fFoundTixa != FALSE) ) ) + //if( ( ( fFoundOrta != FALSE ) || ( pTownNamesList[ iCounter ] != ORTA ) ) && ( ( pTownNamesList[ iCounter ] != TIXA ) || ( fFoundTixa != FALSE) ) ) + if( gfHiddenTown[ pTownNamesList[ iCounter ] ] == TRUE ) { if( fZoomFlag ) { @@ -7548,9 +7651,17 @@ void HideExistenceOfUndergroundMapSector( UINT8 ubSectorX, UINT8 ubSectorY ) void InitMapSecrets( void ) { //UINT8 ubSamIndex; + INT32 iCounter2 = 0; fFoundTixa = FALSE; fFoundOrta = FALSE; + + for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) + { + gfHiddenTown [ iCounter2 ] = gfHiddenTownTemp [ iCounter2 ]; + gfDrawHiddenTown[ iCounter2 ] = FALSE; + gfIconTown [ iCounter2 ] = gfIconTownTemp [ iCounter2 ]; + } //for( ubSamIndex = 0; ubSamIndex < NUMBER_OF_SAMS; ubSamIndex++ ) //{ @@ -7655,3 +7766,152 @@ void MilitiaDisbandYesNoBoxCallback( UINT8 bExitValue ) return; } + +#ifdef JA2UB +void SetUpValidCampaignSectors( void ) +{ +/* +INT32 iRow, iCol; + + for( iRow=1; iRow<=16; iRow++ ) + { + for( iCol=1; iCol<=16; iCol++ ) + { + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector = FALSE; + sBadSectorsList[iCol][iRow] = 1; +// SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCampaignSector = FALSE; + } + } +*/ + +#ifdef JA2UB_PRESS_PREVIEW + + INT32 iRow, iCol; + + for( iRow=1; iRow<=16; iRow++ ) + { + for( iCol=1; iCol<=16; iCol++ ) + { + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector = FALSE; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCampaignSector = FALSE; + } + } + +#endif + + + SectorInfo[ ( SECTOR( 7 , 8 ) ) ].fValidSector = TRUE; //H7 + SectorInfo[ ( SECTOR( 7 , 8 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 8 , 8 ) ) ].fValidSector = TRUE; //H8 + SectorInfo[ ( SECTOR( 8 , 8 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 9 , 8 ) ) ].fValidSector = TRUE; //H9 + SectorInfo[ ( SECTOR( 9 , 8 ) ) ].fCampaignSector = TRUE; //H9 + + SectorInfo[ ( SECTOR( 10 , 8 ) ) ].fValidSector = TRUE; //H10 + SectorInfo[ ( SECTOR( 10 , 8 ) ) ].fCampaignSector = TRUE; + +#ifndef JA2UB_PRESS_PREVIEW + + SectorInfo[ ( SECTOR( 11, 8 ) ) ].fValidSector = TRUE; //H11 + SectorInfo[ ( SECTOR( 11, 8 ) ) ].fCampaignSector = TRUE; + +#endif + + SectorInfo[ ( SECTOR( 9 , 9 ) ) ].fValidSector = TRUE; //I9 + SectorInfo[ ( SECTOR( 9 , 9 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 10 , 9 ) ) ].fValidSector = TRUE; //I10 + SectorInfo[ ( SECTOR( 10 , 9 ) ) ].fCampaignSector = TRUE; + +#ifndef JA2UB_PRESS_PREVIEW + + SectorInfo[ ( SECTOR( 11 , 9 ) ) ].fValidSector = TRUE; //I11 + SectorInfo[ ( SECTOR( 11 , 9 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 12 , 9 ) ) ].fValidSector = TRUE; //I12 + SectorInfo[ ( SECTOR( 12 , 9 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 13 , 9 ) ) ].fValidSector = TRUE; //I13 + SectorInfo[ ( SECTOR( 13 , 9 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 11 , 10 ) ) ].fValidSector = TRUE; //J11 + SectorInfo[ ( SECTOR( 11 , 10 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 12 , 10 ) ) ].fValidSector = TRUE; //J12 + SectorInfo[ ( SECTOR( 12 , 10 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 13 , 10 ) ) ].fValidSector = TRUE; //J13 + SectorInfo[ ( SECTOR( 13 , 10 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 14 , 10 ) ) ].fValidSector = TRUE; //J14 + SectorInfo[ ( SECTOR( 14 , 10 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 14 , 11 ) ) ].fValidSector = TRUE; //K14 + SectorInfo[ ( SECTOR( 14 , 11 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 15 , 11 ) ) ].fValidSector = TRUE; //K15 + SectorInfo[ ( SECTOR( 15 , 11 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 16 , 11 ) ) ].fValidSector = TRUE; //K16 + SectorInfo[ ( SECTOR( 16 , 11 ) ) ].fCampaignSector = TRUE; + + SectorInfo[ ( SECTOR( 15 , 12 ) ) ].fValidSector = TRUE; //L15 + SectorInfo[ ( SECTOR( 15 , 12 ) ) ].fCampaignSector = TRUE; + +#endif + + +} +#endif + +BOOLEAN SaveHiddenTownToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + + FileWrite( hFile, &gfHiddenTown, sizeof( gfHiddenTown), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gfHiddenTown ) ) + { + return( FALSE ); + } + + FileWrite( hFile, &gfDrawHiddenTown, sizeof( gfDrawHiddenTown), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gfDrawHiddenTown ) ) + { + return( FALSE ); + } + + FileWrite( hFile, &gfIconTown, sizeof( gfIconTown), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gfIconTown ) ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN LoadHiddenTownFromLoadGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + FileRead( hFile, &gfHiddenTown, sizeof( gfHiddenTown), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gfHiddenTown ) ) + { + return( FALSE ); + } + + FileRead( hFile, &gfDrawHiddenTown, sizeof( gfDrawHiddenTown), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gfDrawHiddenTown ) ) + { + return( FALSE ); + } + + FileRead( hFile, &gfIconTown, sizeof( gfIconTown), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gfIconTown ) ) + { + return( FALSE ); + } + + return( TRUE ); +} diff --git a/Strategic/Map Screen Interface Map.h b/Strategic/Map Screen Interface Map.h index e06b61c2..dc874386 100644 --- a/Strategic/Map Screen Interface Map.h +++ b/Strategic/Map Screen Interface Map.h @@ -11,6 +11,22 @@ void DrawMapIndexBigMap( BOOLEAN fSelectedCursorIsYellow ); UINT32 DrawMap( void ); +#define MAX_ICON_CHARS 500 + +typedef struct +{ + CHAR8 IconSti[MAX_ICON_CHARS]; + INT32 IconX; + INT32 IconY; +} ICON_FILE; + +extern ICON_FILE gHiddenIcon[ 256 ]; + +extern UINT32 guiIcon2[256]; + +extern BOOLEAN LoadHiddenTownFromLoadGameFile( HWFILE hFile ); +extern BOOLEAN SaveHiddenTownToSaveGameFile( HWFILE hFile ); + void GetScreenXYFromMapXY( INT16 sMapX, INT16 sMapY, INT16 *psX, INT16 *psY ); void GetScreenXYFromMapXYStationary( INT16 sMapX, INT16 sMapY, INT16 *psX, INT16 *psY ); @@ -307,4 +323,8 @@ extern UINT32 guiSubLevel1, guiSubLevel2, guiSubLevel3; extern INT16 sBaseSectorList[ MAX_TOWNS - 1 ]; extern POINT pTownPoints[ MAX_TOWNS ]; -#endif \ No newline at end of file +#ifdef JA2UB +extern void SetUpValidCampaignSectors( void ); +#endif + +#endif diff --git a/Strategic/Map Screen Interface TownMine Info.cpp b/Strategic/Map Screen Interface TownMine Info.cpp index 90b4c903..3b6a96c6 100644 --- a/Strategic/Map Screen Interface TownMine Info.cpp +++ b/Strategic/Map Screen Interface TownMine Info.cpp @@ -303,13 +303,15 @@ void AddTextToTownBox( void ) AddMonoString( &hStringHandle, pLandTypeStrings[ CAMBRIA_HOSPITAL_SITE ] ); break; case SEC_J9: //Tixa - if( !fFoundTixa ) + //if( !fFoundTixa ) + if( gfHiddenTown[ TIXA ] == FALSE ) AddMonoString( &hStringHandle, pLandTypeStrings[ SAND ] ); else AddMonoString( &hStringHandle, pTownNames[ TIXA ] ); break; case SEC_K4: //Orta - if( !fFoundOrta ) + //if( !fFoundOrta ) + if( gfHiddenTown[ ORTA ] == FALSE ) AddMonoString( &hStringHandle, pLandTypeStrings[ SWAMP ] ); else AddMonoString( &hStringHandle, pTownNames[ ORTA ] ); diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index ca292f32..3fc6d3eb 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -3932,11 +3932,13 @@ void AddStringsToMoveBox( void ) // add this vehicle if( fVehicleIsMoving[ iCount ] ) { - swprintf( sString, L"*%s*", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); + // swprintf( sString, L"*%s*", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); + swprintf( sString, L"*%s*", gNewVehicle[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ].NewVehicleStrings ); } else { - swprintf( sString, L"%s", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); + // swprintf( sString, L"%s", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); + swprintf( sString, L"%s", gNewVehicle[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ].NewVehicleStrings); } AddMonoString(&hStringHandle, sString ); @@ -5781,8 +5783,8 @@ BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void ) return( FALSE ); } - gubPBSectorX = gGameExternalOptions.ubDefaultArrivalSectorX; - gubPBSectorY = gGameExternalOptions.ubDefaultArrivalSectorY; + gubPBSectorX = (UINT8)gGameExternalOptions.ubDefaultArrivalSectorX; + gubPBSectorY = (UINT8)gGameExternalOptions.ubDefaultArrivalSectorY; } gubPBSectorZ = 0; @@ -5805,10 +5807,13 @@ BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void ) FadeInGameScreen( ); SetUpShutDownMapScreenHelpTextScreenMask( ); - +#ifdef JA2UB +//no ja25 UB +#else // Add e-mail message - AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); +#endif return( TRUE ); } @@ -5919,12 +5924,19 @@ BOOLEAN NotifyPlayerWhenEnemyTakesControlOfImportantSector( INT16 sSectorX, INT1 if( fContested && bTownId ) { +#ifdef JA2UB + // no UB +#else if( bTownId == SAN_MONA ) { //San Mona isn't important. return( TRUE ); } +#endif swprintf( sStringB, pMapErrorString[ 25 ], sString ); +#ifdef JA2UB + HandleDisplayingOfPlayerLostDialogue( ); +#endif // put up the message informing the player of the event DoScreenIndependantMessageBox( sStringB, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); return( TRUE ); diff --git a/Strategic/MapScreen Quotes.cpp b/Strategic/MapScreen Quotes.cpp new file mode 100644 index 00000000..36f68871 --- /dev/null +++ b/Strategic/MapScreen Quotes.cpp @@ -0,0 +1,486 @@ +#ifdef PRECOMPILEDHEADERS + #include "Strategic All.h" +#else + #include "Map Screen Interface.h" + #include "string.h" + #include "Map Screen Interface Map.h" + #include "Render Dirty.h" + #include "Font Control.h" + #include "Assignments.h" + #include "Soldier Control.h" + #include "Overhead.h" + #include "Squads.h" + #include "Sound Control.h" + #include "Soundman.h" + #include "Message.h" + #include "PopUpBox.h" + #include "Game Clock.h" + #include "Handle Items.h" + #include "Interface Items.h" + #include "Isometric Utils.h" + #include "Interface.h" + #include "Game Event Hook.h" + #include "Tactical Save.h" + #include "Quests.h" + #include "Strategicmap.h" + #include "Soldier Profile.h" + #include "Strategic Movement.h" + #include "Dialogue Control.h" + #include "Map Screen Interface Border.h" + #include "Map Screen Interface Bottom.h" + #include "Vehicles.h" + #include "LINE.H" + #include "Text.h" + #include "gameloop.h" + #include "Map Screen Helicopter.h" + #include "PreBattle Interface.h" + #include "WordWrap.h" + #include "interface control.h" + #include "GameSettings.h" + #include "Campaign Types.h" + #include "Map Screen Interface Map Inventory.h" + #include "strategic.h" + #include "Keys.h" + #include "Soldier macros.h" + #include "Militia Control.h" + #include "Random.h" + #include "Cursor Control.h" + #include "renderworld.h" + #include "Game Init.h" + #include "Strategic Mines.h" + #include "finances.h" + #include "strategic.h" + #include "Air Raid.h" + #include "Queen Command.h" + #include "Render Fun.h" +#endif + +#include "connect.h" + + #ifdef JA2UB + +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "ub_config.h" +#include "Ja25Update.h" + + +#include "MapScreen Quotes.h" +//****** Global Variables ***************************************** + +UINT16 gusWaitingQuote=MILO_NO_QUOTE; +UINT16 gusJerryDialogueDelay = 0; + + + +//******* Function Prototypes *************************************** + +BOOLEAN Internal_JerryMeloCharacterDialogue( UINT16 usQuoteNum ); +BOOLEAN DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained(); +BOOLEAN DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained2ndTime(); +BOOLEAN DoesPlayerHaveMoreThen6MercsAndJerryHasComplained2ndTime(); +BOOLEAN DoesPlayerHaveLessThen6MercsAndJerryHasNotDoubleCheckedYet(); +//BOOLEAN DoesPlayerHaveExactly6MercsOrLessThen6MercsAndJerryHasDoubleChecked(); +BOOLEAN DoesPlayerHaveLessThen6MercsAndJerryHasDoubleChecked(); +BOOLEAN DoesPlayerHaveExactly6MercsAndNotSaidQuoteBefore(); +BOOLEAN HasJerryAlreadySaidTheMapScreenIntroSequence(); +BOOLEAN HasJerrySaidTheLetsGoToTraconaQuote(); + + +//ppp + +//******* Functions ************************************************** + + +//void JerryMiloTalk( UINT16 usQuoteNum, UINT32 uiDelay ) +void JerryMiloTalk( UINT16 usQuoteNum ) +{ +// gusWaitingQuote = usQuoteNum; + + // have skyrider talk to player + Internal_JerryMeloCharacterDialogue( usQuoteNum ); + + //set that jerry has said the quote + JerryMiloSaidQuote( usQuoteNum ); + + return; +} + +void JerryMiloDelayedTalk( UINT16 usQuoteNum, UINT32 uiDelay ) +{ + gusWaitingQuote = usQuoteNum; + gusJerryDialogueDelay = uiDelay; + + return; +} + + +void HandleJerryMiloQuotes( BOOLEAN fReset ) +{ + + static UINT32 uiLastCount; + UINT32 uiCurrentTime = GetJA2Clock(); + + + if( fReset ) + { + uiLastCount = 0; + gusWaitingQuote = MILO_NO_QUOTE; + return; + } + +// if ( gGameUBOptions.InGameHeliCrash == TRUE ) +// { + + // return;//AA + if( gusWaitingQuote == MILO_NO_QUOTE ) + { + return; + } + + if( uiLastCount == 0 ) + { + uiLastCount = GetJA2Clock(); + return; + } + + if( ( uiCurrentTime - uiLastCount ) > gusJerryDialogueDelay ) + { + JerryMiloTalk( gusWaitingQuote ); + + //if the quote waiting to be said was the opening quote + if( gusWaitingQuote == MILO_QUOTE__OPENING_GREETING_PART_1 ) + { + //say the follow up part + if( DoesPlayerHaveExactly6MercsAndNotSaidQuoteBefore() ) + { + JerryMiloTalk( MILO_QUOTE__ALREADY_HAS_6_MERCS ); + } + else + { + JerryMiloTalk( MILO_QUOTE__OPENING_GREETING_PART_2 ); + } + } + + gusWaitingQuote = MILO_NO_QUOTE; + + uiLastCount = uiCurrentTime; + } + +// } +} + +BOOLEAN Internal_JerryMeloCharacterDialogue( UINT16 usQuoteNum ) +{ + BOOLEAN fRetVal = FALSE; + fTeamPanelDirty = TRUE; + + fRetVal = CharacterDialogue( 76, usQuoteNum, uiExternalStaticNPCFacesUB[ JERRY_MELO_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_JERRY_MILO, usQuoteNum, 0, 0, uiExternalStaticNPCFacesUB[ JERRY_MELO_FACE ], DIALOGUE_EXTERNAL_NPC_UI ); + + return( fRetVal ); +} + +BOOLEAN HasJerryMiloSaidQuoteBefore( UINT32 uiQuoteID ) +{ + //has the quote been said + return( ( gJa25SaveStruct.uiJerryMiloQuotesFlags & ( 1 << uiQuoteID ) ) != 0 ); +} + + +void JerryMiloSaidQuote( UINT32 uiQuoteID ) +{ + gJa25SaveStruct.uiJerryMiloQuotesFlags |= ( 1 << uiQuoteID ); +} + + +BOOLEAN WillJerryMiloAllowThePlayerToCompressTimeAtBeginingOfGame() +{ + +if ( gGameUBOptions.JerryQuotes == TRUE ) +{ + //to speed things up, has jerry finished the intro speech? + if( HasJerryAlreadySaidTheMapScreenIntroSequence() ) + return( TRUE ); + + + //if the player has more then 6merc and Jerry hasnt complained the first time + if( DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained() ) + { + return( FALSE ); + } + + //if the player has over 6 mercs and jerry HAS NOT complained the 2nd time + if( DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained2ndTime() ) + { + return( FALSE ); + } + + //if the player has over 6 mercs and jerry HAS complained the 2nd time + if( DoesPlayerHaveMoreThen6MercsAndJerryHasComplained2ndTime() ) + { + return( FALSE ); + } + + //if the player has less then 6 mercs, and hasnt double checked yet + if( DoesPlayerHaveLessThen6MercsAndJerryHasNotDoubleCheckedYet() ) + { + return( FALSE ); + } + +/* + //if the player has exactly 6 mercs OR the player has less then 6 AND has double checked + if( DoesPlayerHaveExactly6MercsOrLessThen6MercsAndJerryHasDoubleChecked() ) + { + return( FALSE ); + } +*/ + + //if the player has exactly 6 mercs OR the player has less then 6 AND has double checked + if( DoesPlayerHaveLessThen6MercsAndJerryHasDoubleChecked() ) + { + return( FALSE ); + } + + //if the player has exactly 6 mercs OR the player has less then 6 AND has double checked + if( DoesPlayerHaveExactly6MercsAndNotSaidQuoteBefore() ) + { + return( FALSE ); + } + + + if( !HasJerrySaidTheLetsGoToTraconaQuote() ) + { + return( FALSE ); + } +} + return( TRUE ); +} + +BOOLEAN HasJerrySaidTheLetsGoToTraconaQuote() +{ + return( HasJerryMiloSaidQuoteBefore( MILO_QUOTE__HEADED_TO_TRACONA_QUOTE ) ); +} + +void HaveJerrySayWhyPlayerCantTimeCompressAtBeginningOfGame() +{ + if( !gfFirstTimeInGameHeliCrash) + { + INT32 i=0; + } + + /* + if (gGameOptions.ubSquadSize > 6) + { + if( DoesPlayerHaveLessThen6MercsAndJerryHasNotDoubleCheckedYet() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS ); + return; + } + //else if the player has less then 6 mercs, and hasnt double checked yet + else if( DoesPlayerHaveLessThen6MercsAndJerryHasNotDoubleCheckedYet() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS ); + return; + } + //if the player has less then 6 AND has double checked + else if( DoesPlayerHaveLessThen6MercsAndJerryHasDoubleChecked() ) + { + JerryMiloTalk( MILO_QUOTE__HEADED_TO_TRACONA_QUOTE ); + return; + } + else + { + JerryMiloTalk( MILO_QUOTE__HEADED_TO_TRACONA_QUOTE ); + return; + } + } + else + */ + { + //if the player has more then 6merc and Jerry hasnt complained the first time + if( DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS ); + return; + } + + //else if the player has over 6 mercs and jerry HAS NOT complained the 2nd time + else if( DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained2ndTime() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS_2ND_TIME ); + return; + } + + //else if the player has over 6 mercs and jerry HAS complained the 2nd time + else if( DoesPlayerHaveMoreThen6MercsAndJerryHasComplained2ndTime() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS_2ND_TIME ); + return; + } + + //else if the player has less then 6 mercs, and hasnt double checked yet + else if( DoesPlayerHaveLessThen6MercsAndJerryHasNotDoubleCheckedYet() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS ); + return; + } + + //if the player has less then 6 AND has double checked + else if( DoesPlayerHaveLessThen6MercsAndJerryHasDoubleChecked() ) + { + JerryMiloTalk( MILO_QUOTE__HEADED_TO_TRACONA_QUOTE ); + return; + } + + else if( !HasJerrySaidTheLetsGoToTraconaQuote() ) + { + JerryMiloTalk( MILO_QUOTE__HEADED_TO_TRACONA_QUOTE ); + return; + } + } + + //shoud satisfy condition above + Assert( 0 ); +} + + +BOOLEAN DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has over 6 mercs, and jerry hasnt complained about that yet + if( ubNumMercsOnTeam > 6 && !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + +BOOLEAN DoesPlayerHaveMoreThen6MercsAndJerryHasntComplained2ndTime() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has over 6 mercs and jerry HAS NOT complained the 2nd time + if( ubNumMercsOnTeam > 6 && !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS_2ND_TIME ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + +BOOLEAN DoesPlayerHaveMoreThen6MercsAndJerryHasComplained2ndTime() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has over 6 mercs and jerry HAS complained the 2nd time + if( ubNumMercsOnTeam > 6 && HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS_2ND_TIME ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + +BOOLEAN DoesPlayerHaveLessThen6MercsAndJerryHasNotDoubleCheckedYet() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has less then 6 mercs, and hasnt double checked yet + if( ubNumMercsOnTeam < 6 && !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + +BOOLEAN DoesPlayerHaveExactly6MercsAndNotSaidQuoteBefore() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has exactly 6 mercs OR the player has less then 6 AND has double checked + if( ubNumMercsOnTeam == 6 && !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__ALREADY_HAS_6_MERCS ) && !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + + +BOOLEAN DoesPlayerHaveLessThen6MercsAndJerryHasDoubleChecked() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has exactly 6 mercs OR the player has less then 6 AND has double checked + if( ubNumMercsOnTeam < 6 && HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + + +BOOLEAN DoesPlayerHaveNoMercsHiredAndJerryHasntSaidQuoteYet() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //if the player has less then 6 mercs, and hasnt double checked yet + //if( ubNumMercsOnTeam == 0 && !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__PLAYER_HAS_NO_MERCS ) ) + if( ubNumMercsOnTeam == 0 ) + { + return( TRUE ); + } + + return( FALSE ); +} + +BOOLEAN DidPlayerInitiallyHaveLessThen6MercsAndNowHaveExactly6AndHasntSaidFullLoadQuote() +{ + UINT8 ubNumMercsOnTeam = NumberOfMercsOnPlayerTeam(); + + //If we have been to the sector, make sure we dont say it + + //if( SectorInfo[ SEC_H7].uiFlags & SF_HAS_ENTERED_TACTICAL ) + if( SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].uiFlags & SF_HAS_ENTERED_TACTICAL ) + { + return( FALSE ); + } + + //if the player has 6 mercs, and has said the regular opening line ( not the line with 6 mercs ) + if( ubNumMercsOnTeam == 6 && + HasJerryMiloSaidQuoteBefore( MILO_QUOTE__OPENING_GREETING_PART_2 ) && + !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__ALREADY_HAS_6_MERCS ) ) + { + return( TRUE ); + } + + return( FALSE ); +} + + +void InitJerryQuotes() +{ + //Clear out the quote flags + gJa25SaveStruct.uiJerryMiloQuotesFlags = 0; +} + +BOOLEAN HasJerryAlreadySaidTheMapScreenIntroSequence() +{ + // return TRUE; //AA + if( HasJerryMiloSaidQuoteBefore( MILO_QUOTE__HEADED_TO_TRACONA_QUOTE ) || gGameUBOptions.InGameHeliCrash == FALSE ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + +#endif \ No newline at end of file diff --git a/Strategic/MapScreen Quotes.h b/Strategic/MapScreen Quotes.h new file mode 100644 index 00000000..e3d4f246 --- /dev/null +++ b/Strategic/MapScreen Quotes.h @@ -0,0 +1,62 @@ +#ifndef _MAPSCREEN_QUOTES__H_ +#define _MAPSCREEN_QUOTES__H_ + + +//Enums for the quotes Jerry Milo can say +enum +{ + MILO_QUOTE__OPENING_GREETING_PART_1, + MILO_QUOTE__OPENING_GREETING_PART_2, + MILO_QUOTE__FRIENDLY_APPROACH_NOTHING_TO_SAY, + MILO_QUOTE__FRIENDLY_APPROACH_NOTHING_TO_SAY_ALT, + MILO_QUOTE__REFUSE_TO_ACCEPT_ITEM, + MILO_QUOTE__DIRECT_APPROACH_NOTHING_TO_SAY, //5 + MILO_QUOTE__THREATEN_APPROACH_NOTHING_TO_SAY, + MILO_QUOTE__RECRUITMENT_REFUSAL, + MILO_QUOTE__WOUNDED, + MILO_QUOTE__GET_LOST, + MILO_QUOTE__ACCEPT_MONEY, //10 + MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS, + MILO_QUOTE__PLAYER_HAS_MORE_THEN_6_MERCS_2ND_TIME, + MILO_QUOTE__PLAYER_HAS_LESS_THEN_6_MERCS, + MILO_QUOTE__CRASH_QUOTE, + MILO_QUOTE__FOLLOWS_PC_ANSWER_TO_14_PART_1, //15 + MILO_QUOTE__FOLLOWS_PC_ANSWER_TO_14_PART_2, + MILO_QUOTE__FOLLOWS_PC_ANSWER_TO_14_PART_3, + MILO_QUOTE__ALTERNATE_DIRECT_DEFAULT, + MILO_QUOTE__FIRST_RESPONSE_TO_THREATENING, + MILO_QUOTE__DEFAULT_COWERING_QUOTE, //20 + MILO_QUOTE__HEADED_TO_TRACONA_QUOTE, + MILO_QUOTE__JERRY_HEALED, + MILO_QUOTE__JERRY_BECOMES_ENEMY, + MILO_QUOTE__ALREADY_HAS_6_MERCS, + MILO_QUOTE__PLAYER_HAS_NO_MERCS, + + + MILO_NO_QUOTE = 0xFFFF, +}; + + + + +void JerryMiloTalk( UINT16 usQuoteNum ); + +BOOLEAN HasJerryMiloSaidQuoteBefore( UINT32 uiQuoteID ); + +void JerryMiloSaidQuote( UINT32 uiQuoteID ); + +BOOLEAN WillJerryMiloAllowThePlayerToCompressTimeAtBeginingOfGame(); + +void HaveJerrySayWhyPlayerCantTimeCompressAtBeginningOfGame(); + +BOOLEAN DoesPlayerHaveNoMercsHiredAndJerryHasntSaidQuoteYet(); + +void HandleJerryMiloQuotes( BOOLEAN fReset ); + +void JerryMiloDelayedTalk( UINT16 usQuoteNum, UINT32 uiDelay ); + +void InitJerryQuotes(); + +BOOLEAN DidPlayerInitiallyHaveLessThen6MercsAndNowHaveExactly6AndHasntSaidFullLoadQuote(); + +#endif diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index b1a6230b..a4309e35 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -44,6 +44,10 @@ #include "GameSettings.h" #include "connect.h" +#ifdef JA2UB +#include "ub_config.h" +#endif + void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ); void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldier, BOOLEAN fAddRehireButton ); void MercDepartEquipmentBoxCallBack( UINT8 bExitValue ); @@ -1036,7 +1040,16 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) AddTransactionToPlayersBook(FULL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->usMedicalDeposit ); //add an email - AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile ); +#ifdef JA2UB +//no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.fDeadMerc == TRUE ) + AddEmailWithSpecialData( 27, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L2 ); + } +#else + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } //else if the merc is a dead, refund NOTHING!! else if( pSoldier->stats.bLife <= 0 ) @@ -1045,8 +1058,16 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) //AddTransactionToPlayersBook( NO_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), 0 ); //add an email - AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile ); - +#ifdef JA2UB +//no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.fDeadMerc == TRUE ) + AddEmailWithSpecialData( 217, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L3 ); + } +#else + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } //else the player is injured, refund a partial amount else @@ -1058,7 +1079,16 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) AddTransactionToPlayersBook( PARTIAL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), iRefundAmount ); //add an email - AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), iRefundAmount, pSoldier->ubProfile ); +#ifdef JA2UB +// no UB + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gGameUBOptions.fDeadMerc == TRUE ) + AddEmailWithSpecialData( 214, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), iRefundAmount, pSoldier->ubProfile, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L4 ); + } +#else + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), iRefundAmount, pSoldier->ubProfile, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); +#endif } } diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index c1296a72..621f5980 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -180,11 +180,15 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B INT8 bTownId = 0; UINT8 ubSectorID; - +#ifdef JA2UB +//Ja25: No meanwhiles +#else if( AreInMeanwhile( ) ) { return FALSE; } +#endif + if( bMapZ == 0 ) { @@ -222,7 +226,11 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B //If the player has been to Bobbyr when it was down, and we havent already sent email, send him an email if( LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction == BOBBYR_BEEN_TO_SITE_ONCE && LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction != BOBBYR_ALREADY_SENT_EMAIL ) { - AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, -1); +#ifdef JA2UB +// no UB +#else + AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); +#endif LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction = BOBBYR_ALREADY_SENT_EMAIL; } } @@ -258,8 +266,12 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B if( !bMapZ && ubSectorID != SEC_J9 && ubSectorID != SEC_K4 ) { HandleMoraleEvent( NULL, MORALE_TOWN_LIBERATED, sMapX, sMapY, bMapZ ); - HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_TOWN_SECTOR, sMapX, sMapY, bMapZ ); +#ifdef JA2UB +//Ja25: no loyalty +#else + HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_TOWN_SECTOR, sMapX, sMapY, bMapZ ); +#endif // liberation by definition requires that the place was enemy controlled in the first place CheckIfEntireTownHasBeenLiberated( bTownId, sMapX, sMapY ); } @@ -272,7 +284,11 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B if ( GetTotalLeftInMine( GetMineIndexForSector( sMapX, sMapY ) ) > 0) { HandleMoraleEvent( NULL, MORALE_MINE_LIBERATED, sMapX, sMapY, bMapZ ); +#ifdef JA2UB +// Ja25: no loyalty +#else HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_MINE, sMapX, sMapY, bMapZ ); +#endif } } @@ -282,13 +298,20 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B if ( 1 /*!GetSectorFlagStatus( sMapX, sMapY, bMapZ, SF_SECTOR_HAS_BEEN_LIBERATED_ONCE ) */) { // SAM site liberated for first time, schedule meanwhile +#ifdef JA2UB +//JA25 No meanwhiles +#else HandleMeanWhileEventPostingForSAMLiberation( GetSAMIdFromSector( sMapX, sMapY, bMapZ ) ); +#endif } HandleMoraleEvent( NULL, MORALE_SAM_SITE_LIBERATED, sMapX, sMapY, bMapZ ); +#ifdef JA2UB +// Ja25: no loyalty +#else HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_SAM, sMapX, sMapY, bMapZ ); UpdateAirspaceControl( ); - +#endif // if Skyrider has been delivered to chopper, and already mentioned Drassen SAM site, but not used this quote yet if ( IsHelicopterPilotAvailable( ) && ( guiHelicopterSkyriderTalkState >= 1 ) && ( !gfSkyriderSaidCongratsOnTakingSAM ) ) { @@ -319,21 +342,35 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B // SetSectorFlag( sMapX, sMapY, bMapZ, SF_SECTOR_HAS_BEEN_LIBERATED_ONCE ); if ( bMapZ == 0 && ( ( sMapY == MAP_ROW_M && (sMapX >= 2 && sMapX <= 6) ) || sMapY == MAP_ROW_N && sMapX == 6) ) { - HandleOutskirtsOfMedunaMeanwhileScene( ); + +#ifdef JA2UB +//Ja25 No meanwhiles +#else + HandleOutskirtsOfMedunaMeanwhileScene(); +#endif + } } - +#ifdef JA2UB +//Ja25 No strategic ai +#else if( fContested ) { StrategicHandleQueenLosingControlOfSector( (UINT8)sMapX, (UINT8)sMapY, (UINT8)bMapZ ); } +#endif } else { +#ifdef JA2UB +//Ja25 No strategic ai +#else + if( sMapX == 3 && sMapY == 16 && bMapZ == 1 ) { //Basement sector (P3_b1) gfUseAlternateQueenPosition = TRUE; } +#endif } // also set fact the player knows they own it diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 468cf345..5bb76f57 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -49,6 +49,10 @@ #include "message.h" #endif +#ifdef JA2UB +#include "ub_config.h" +#endif + extern void InitializeTacticalStatusAtBattleStart(); extern BOOLEAN gfDelayAutoResolveStart; extern BOOLEAN gfTransitionMapscreenToAutoResolve; @@ -861,6 +865,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); +#ifdef JA2UB + if ( gGameUBOptions.AutoResolve == FALSE ) + DisableButton( iPBButton[0] ); +#endif DoTransitionFromMapscreenToPreBattleInterface(); } diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index d6f0b65f..bb1e3009 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -52,6 +52,17 @@ #include "connect.h" #include "Reinforcement.h" #include "MilitiaSquads.h" + +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "Arms Dealer Init.h" +#endif + #include //The sector information required for the strategic AI. Contains the number of enemy troops, @@ -75,6 +86,13 @@ extern BOOLEAN gfOverrideSector; INT32 gsInterrogationGridNo[3] = { 7756, 7757, 7758 }; +#ifdef JA2UB +INT32 gsGridNoForMapEdgePointInfo=-1; +#endif + +#ifdef JA2UB +void HandleBloodCatDeaths( SECTORINFO *pSector ); +#endif extern void Ensure_RepairedGarrisonGroup( GARRISON_GROUP **ppGarrison, INT32 *pGarraySize ); @@ -883,6 +901,37 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) switch( pSoldier->ubProfile ) { +#ifdef JA2UB + case 75://MORRIS: + + if( !pSoldier->bSectorZ ) + { + pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ]; + if( pSector->ubNumElites ) + { + pSector->ubNumElites--; + } + if( pSector->ubElitesInBattle ) + { + pSector->ubElitesInBattle--; + } + } + else + { + UNDERGROUND_SECTORINFO *pUnderground; + pUnderground = FindUnderGroundSector( (UINT8)pSoldier->sSectorX, (UINT8)pSoldier->sSectorY, (UINT8)pSoldier->bSectorZ ); + Assert( pUnderground ); + if( pUnderground->ubNumElites ) + { + pUnderground->ubNumElites--; + } + if( pUnderground->ubElitesInBattle ) + { + pUnderground->ubElitesInBattle--; + } + } + break; +#endif case MIKE: case IGGY: if( pSoldier->ubProfile == IGGY && !gubFact[ FACT_IGGY_AVAILABLE_TO_ARMY ] ) @@ -1154,6 +1203,11 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) { pSector->bBloodCats--; } +#ifdef JA2UB + //JA25 UB + //handle anything important when bloodcats die + HandleBloodCatDeaths( pSector ); +#endif } break; @@ -1303,6 +1357,10 @@ void AddPossiblePendingEnemiesToBattle() if(!(gWorldSectorX > 0 && gWorldSectorY > 0 && gbWorldSectorZ == 0))//dnl ch57 161009 return; +#ifdef JA2UB + BOOLEAN fMagicallyAppeared=FALSE; +#endif + UINT8 ubSlots, ubNumAvailable; UINT8 ubNumElites, ubNumTroops, ubNumAdmins; UINT8 ubNumGroupsInSector; @@ -1410,6 +1468,14 @@ void AddPossiblePendingEnemiesToBattle() ubStrategicInsertionCode = INSERTION_CODE_SOUTH; else if( NumEnemiesInSector( gWorldSectorX, gWorldSectorY - 1 ) ) ubStrategicInsertionCode = INSERTION_CODE_NORTH; + #ifdef JA2UB + else if( gsGridNoForMapEdgePointInfo != -1 ) + { + //Ja25: it doesnt matter the entry point at this point, it will become GRIDNO at a later point + ubStrategicInsertionCode = INSERTION_CODE_NORTH; + fMagicallyAppeared = FALSE; + } + #endif } if( ubStrategicInsertionCode == 255 ) @@ -1609,6 +1675,11 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub UINT8 ubCurrSlot; UINT8 ubTotalSoldiers; UINT8 bDesiredDirection=0; + +#ifdef JA2UB + UINT8 ubCnt; +#endif + switch( ubStrategicInsertionCode ) { case INSERTION_CODE_NORTH: bDesiredDirection = SOUTHEAST; break; @@ -1651,8 +1722,40 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } ubTotalSoldiers = ubNumAdmins + ubNumTroops + ubNumElites; + + #ifdef JA2UB + if( gsGridNoForMapEdgePointInfo != -1 ) + { + ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + } + #endif + + #ifdef JA2UB + if( ubStrategicInsertionCode == INSERTION_CODE_GRIDNO ) + { + if( gsGridNoForMapEdgePointInfo == -1 ) + { + Assert( 0 ); + gsGridNoForMapEdgePointInfo=0; + } - ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumAdmins+ubNumElites+ubNumTroops) ); + for( ubCnt=0; ubCnt<32;ubCnt++) + { + MapEdgepointInfo.sGridNo[ ubCnt ] = gsGridNoForMapEdgePointInfo; + } + + MapEdgepointInfo.ubNumPoints = 32; + MapEdgepointInfo.ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + } + else + { + ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumAdmins+ubNumElites+ubNumTroops) ); + } + #else + ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumAdmins+ubNumElites+ubNumTroops) ); + #endif + + ubCurrSlot = 0; while( ubTotalSoldiers ) { @@ -1731,6 +1834,10 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub pSoldier->bActionPoints = 0; } } + + #ifdef JA2UB + gsGridNoForMapEdgePointInfo = -1; + #endif } @@ -1875,7 +1982,10 @@ void BeginCaptureSquence( ) void EndCaptureSequence( ) { - +#ifdef JA2UB +// no UB +#else + // Set flag... if( !( gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE ) || !(gStrategicStatus.uiFlags & STRATEGIC_PLAYER_CAPTURED_FOR_ESCAPE) ) { @@ -1917,7 +2027,7 @@ void EndCaptureSequence( ) gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_ESCAPE; } } - +#endif } void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) @@ -2272,3 +2382,41 @@ BOOLEAN CheckPendingEnemies() return FALSE; } +#ifdef JA2UB +void HandleBloodCatDeaths( SECTORINFO *pSector ) +{ + //if the current sector is the first part of the town + if( gWorldSectorX == 10 && gWorldSectorY == 9 && gbWorldSectorZ == 0 ) + { + //if ALL the bloodcats are killed + if( pSector->bBloodCats == 0 ) + { + UINT8 bId1=-1; + UINT8 bId2=-1; + UINT8 bNum=0; + + SetFactTrue( FACT_PLAYER_KILLED_ALL_BETTYS_BLOODCATS ); + + //Instantly have betties missing items show up + //DailyCheckOnItemQuantities( TRUE ); + + // Now have a merc say the killed bloodcat quote + bNum = Get3RandomQualifiedMercs( &bId1, &bId2, NULL ); + + //if there are some qualified mercs + if( bNum != 0 ) + { + //must make sure TEX doesnt say the quote + if( bId1 != NOBODY && Menptr[ bId1 ].ubProfile != 64 ) + { + TacticalCharacterDialogue( &Menptr[ bId1 ], QUOTE_RENEW_REFUSAL_DUE_TO_LACK_OF_FUNDS ); + } + else if( bId2 != NOBODY && Menptr[ bId2 ].ubProfile != 64 ) + { + TacticalCharacterDialogue( &Menptr[ bId2 ], QUOTE_RENEW_REFUSAL_DUE_TO_LACK_OF_FUNDS ); + } + } + } + } +} +#endif diff --git a/Strategic/Queen Command.h b/Strategic/Queen Command.h index f8607311..cb93e1ba 100644 --- a/Strategic/Queen Command.h +++ b/Strategic/Queen Command.h @@ -56,6 +56,10 @@ BOOLEAN OnlyHostileCivsInSector(); extern INT32 gsInterrogationGridNo[3]; +#ifdef JA2UB +extern INT32 gsGridNoForMapEdgePointInfo; +#endif + BOOLEAN CheckPendingEnemies(); #endif \ No newline at end of file diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 6bd55536..1d10c271 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -36,6 +36,15 @@ #include "BobbyRMailOrder.h" #include "connect.h" +#ifdef JA2UB +#include "email.h" +#include "Strategic Merc Handler.h" +#include "laptop.h" +#include "Ja25 Strategic Ai.h" +#include "ub_config.h" +#endif + +#include "LuaInitNPCs.h" #define TESTQUESTS @@ -655,14 +664,23 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Quests"); BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) { + + +// LuaCheckFact ( usFact, ubProfileID, 0 ); + +//#if 0 INT8 bTown = -1; switch( usFact ) { +#ifdef JA2UB +//Ja25 No dimitri +#else case FACT_DIMITRI_DEAD: gubFact[ usFact ] = (gMercProfiles[ DIMITRI ].bMercStatus == MERC_IS_DEAD ); break; +#endif case FACT_CURRENT_SECTOR_IS_SAFE: gubFact[FACT_CURRENT_SECTOR_IS_SAFE] = !( ( (gTacticalStatus.fEnemyInSector && NPCHeardShot( ubProfileID ) ) || gTacticalStatus.uiFlags & INCOMBAT ) ); break; @@ -705,6 +723,9 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_NPC_WOUNDED_BY_PLAYER: gubFact[FACT_NPC_WOUNDED_BY_PLAYER] = CheckNPCWounded( ubProfileID, TRUE ); break; +#ifdef JA2UB +// no ja25 UB +#else case FACT_IRA_NOT_PRESENT: gubFact[FACT_IRA_NOT_PRESENT] = !CheckNPCWithin( ubProfileID, IRA, 10 ); break; @@ -721,6 +742,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) gubFact[FACT_IRA_UNHIRED_AND_ALIVE] = FALSE; } break; +#endif case FACT_NPC_BLEEDING: gubFact[FACT_NPC_BLEEDING] = CheckNPCBleeding( ubProfileID ); break; @@ -734,7 +756,9 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) gubFact[FACT_NPC_BLEEDING_BUT_OKAY] = FALSE; } break; - +#ifdef JA2UB +//Ja25: NO Carmen +#else case FACT_PLAYER_HAS_HEAD_AND_CARMEN_IN_SAN_MONA: gubFact[usFact] = (CheckNPCSector( CARMEN, 5, MAP_ROW_C, 0 ) && CheckPlayerHasHead() ); break; @@ -746,7 +770,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_PLAYER_HAS_HEAD_AND_CARMEN_IN_DRASSEN: gubFact[usFact] = (CheckNPCSector( CARMEN, 13, MAP_ROW_C, 0 ) && CheckPlayerHasHead() ); break; - +#endif case FACT_NPC_OWED_MONEY: gubFact[FACT_NPC_OWED_MONEY] = (gMercProfiles[ubProfileID].iBalance < 0); break; @@ -783,7 +807,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) break; /* case FACT_SKYRIDER_CLOSE_TO_CHOPPER: - SetUpHelicopterForPlayer( 13, MAP_ROW_B , SKYRIDER ); + SetUpHelicopterForPlayer( 13, MAP_ROW_B, gNewVehicle[ HELICOPTER ].NewPilot, HELICOPTER ); break; */ case FACT_SPIKE_AT_DOOR: @@ -870,9 +894,13 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_SHANK_NOT_IN_SECTOR: gubFact[usFact] = ( FindSoldierByProfileID( SHANK, FALSE ) == NULL ); break; +#ifdef JA2UB +//Ja25 No queen +#else case FACT_QUEEN_DEAD: gubFact[usFact] = (gMercProfiles[ QUEEN ].bMercStatus == MERC_IS_DEAD); break; +#endif case FACT_MINE_EMPTY: gubFact[usFact] = IsHisMineEmpty( ubProfileID ); break; @@ -1011,21 +1039,33 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) break; case FACT_PLAYER_OWNS_2_TOWNS_INCLUDING_OMERTA: +#ifdef JA2UB +//UB +#else gubFact[usFact] = ( ( GetNumberOfWholeTownsUnderControl() == gGameExternalOptions.ubEarlyRebelsRecruitment[1] || gGameExternalOptions.ubEarlyRebelsRecruitment[0] == 1 || ( gubQuest[QUEST_FOOD_ROUTE] == QUESTDONE && gGameExternalOptions.ubEarlyRebelsRecruitment[0] == 4 ) ) && IsTownUnderCompleteControlByPlayer( OMERTA ) ); +#endif break; case FACT_PLAYER_OWNS_3_TOWNS_INCLUDING_OMERTA: +#ifdef JA2UB +//UB +#else gubFact[usFact] = ( ( GetNumberOfWholeTownsUnderControl() == gGameExternalOptions.ubEarlyRebelsRecruitment[2] || gGameExternalOptions.ubEarlyRebelsRecruitment[0] == 1 || ( gubQuest[QUEST_FOOD_ROUTE] == QUESTDONE && gGameExternalOptions.ubEarlyRebelsRecruitment[0] == 4 ) ) && IsTownUnderCompleteControlByPlayer( OMERTA ) ); +#endif break; case FACT_PLAYER_OWNS_4_TOWNS_INCLUDING_OMERTA: +#ifdef JA2UB +//UB +#else gubFact[usFact] = ( ( GetNumberOfWholeTownsUnderControl() >= gGameExternalOptions.ubEarlyRebelsRecruitment[3] || gGameExternalOptions.ubEarlyRebelsRecruitment[0] == 1 || ( gubQuest[QUEST_FOOD_ROUTE] == QUESTDONE && gGameExternalOptions.ubEarlyRebelsRecruitment[0] == 4 ) ) && IsTownUnderCompleteControlByPlayer( OMERTA ) ); // silversurfer: this is the highest requirement and therefore we will automatically enable recruitment of Miguel if ( gubFact[usFact] ) SetFactTrue(40); // Miguel will now be willing to join and so will the other RPC +#endif break; case FACT_PLAYER_FOUGHT_THREE_TIMES_TODAY: @@ -1132,11 +1172,13 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_WALDO_ALIVE: gubFact[usFact] = gMercProfiles[ WALDO ].bMercStatus != MERC_IS_DEAD; break; - +#ifdef JA2UB +//UB +#else case FACT_PERKO_ALIVE: gubFact[usFact] = gMercProfiles[ PERKO ].bMercStatus != MERC_IS_DEAD; break; - +#endif case FACT_TONY_ALIVE: gubFact[usFact] = gMercProfiles[ TONY ].bMercStatus != MERC_IS_DEAD; break; @@ -1262,6 +1304,8 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) default: break; } + +//#endif return( gubFact[usFact] ); } @@ -1346,9 +1390,13 @@ void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fU else GiveQuestRewardPoint( sSectorX, sSectorY, 9, NO_PROFILE ); break; +#ifdef JA2UB +//off +#else case QUEST_KILL_DEIDRANNA : GiveQuestRewardPoint( sSectorX, sSectorY, 25, NO_PROFILE ); break; +#endif default : GiveQuestRewardPoint( sSectorX, sSectorY, 4, NO_PROFILE ); break; @@ -1376,6 +1424,58 @@ void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fU gMercProfiles[ MADAME ].bNPCData = 0; gMercProfiles[ MADAME ].bNPCData2 = 0; } + +#ifdef JA2UB + //if the quest is the FIX LAPTOP quest + if( ubQuest == QUEST_FIX_LAPTOP && gGameUBOptions.LaptopQuestEnabled == TRUE ) + { + //Set the fact that AIM and MERC should start selling + gJa25SaveStruct.fHaveAimandMercOffferItems = TRUE; + + //Remeber that we should send email in the next sector + gJa25SaveStruct.fSendEmail_10_NextSector = TRUE; + + AddEmail( EMAIL_PILOTMISSING, EMAIL_PILOTMISSING_LENGTH, MAIL_ENRICO, GetWorldTotalMin() ,-1,-1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( EMAIL_MAKECONTACT, EMAIL_MAKECONTACT_LENGTH, MAIL_ENRICO, GetWorldTotalMin() ,-1,-1, TYPE_EMAIL_EMAIL_EDT); + + //Merc and Aim emails + AddEmail( EMAIL_AIM_PROMOTION_1, EMAIL_AIM_PROMOTION_1_LENGTH, AIM_SITE, GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( EMAIL_MERC_PROMOTION_1, EMAIL_MERC_PROMOTION_1_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(),-1,-1, TYPE_EMAIL_EMAIL_EDT); + AddEmail( EMAIL_AIM_PROMOTION_2, EMAIL_AIM_PROMOTION_2_LENGTH, AIM_SITE, GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT); + + //Manuel + { + SOLDIERTYPE *pSoldier=NULL; + + pSoldier = FindSoldierByProfileID( 60 , TRUE ); //MANUEL + + if( pSoldier != NULL ) + { + //Add the Manuel email + AddEmail( EMAIL_MANUEL, EMAIL_MANUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin() ,-1, -1, TYPE_EMAIL_EMAIL_EDT); + } + } + + //Miguel + { + //if miguel was dead, when importing the save + if( gubFact[ FACT_PLAYER_IMPORTED_SAVE_MIGUEL_DEAD ] == FALSE ) + { + //Add the miguel email + AddEmail( EMAIL_MIGUELHELLO, EMAIL_MIGUELHELLO_LENGTH, MAIL_MIGUEL, GetWorldTotalMin(),-1, -1, TYPE_EMAIL_EMAIL_EDT); + } + } + + //If any aim mercs were asked to send emails when the get back from duty elsewhere + HandleAddingAnyAimAwayEmailsWhenLaptopGoesOnline(); + + //Should we send the IMP reminder email when we go back online + ShouldImpReminderEmailBeSentWhenLaptopBackOnline(); + + //Force which ever of these emails that needed to be sent, to be sent + HandleEmailBeingSentWhenEnteringSector( 0, 0, 0, TRUE ); + } +#endif }; void InitQuestEngine() @@ -1411,6 +1511,21 @@ void CheckForQuests( UINT32 uiDay ) ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay ); #endif +#ifdef JA2UB + // ------------------------------------------------------------------------------- + // QUEST 23 : Detroy missles + // ------------------------------------------------------------------------------- + // The game always starts with destrouy missles quest, so turn it on if it hasn't + // already started + if( gubQuest[ QUEST_DESTROY_MISSLES ] == QUESTNOTSTARTED ) + { + StartQuest( QUEST_DESTROY_MISSLES, -1, -1 ); +#ifdef TESTQUESTS + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DESTORY MISSLES quest"); +#endif + } +//Ja25: No deliver letter quest, dont start it +#else // ------------------------------------------------------------------------------- // QUEST 0 : DELIVER LETTER // ------------------------------------------------------------------------------- @@ -1425,7 +1540,7 @@ void CheckForQuests( UINT32 uiDay ) ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest"); #endif } - +#endif // This quest gets turned OFF through conversation with Miguel - when user hands // Miguel the letter } @@ -1454,13 +1569,15 @@ BOOLEAN SaveQuestInfoToSavedGameFile( HWFILE hFile ) } -BOOLEAN LoadQuestInfoFromSavedGameFile( HWFILE hFile ) +BOOLEAN LoadQuestInfoFromSavedGameFile( HWFILE hFile, UINT8 MaxQuest ) { UINT32 uiNumBytesRead; //Save all the states if the Quests - FileRead( hFile, gubQuest, MAX_QUESTS, &uiNumBytesRead ); - if( uiNumBytesRead != MAX_QUESTS ) + //FileRead( hFile, gubQuest, MAX_QUESTS, &uiNumBytesRead ); + //if( uiNumBytesRead != MAX_QUESTS ) + FileRead( hFile, gubQuest, MaxQuest, &uiNumBytesRead ); + if( uiNumBytesRead != MaxQuest ) { return(FALSE); } diff --git a/Strategic/Quests.h b/Strategic/Quests.h index c6b94ad5..aeb226b1 100644 --- a/Strategic/Quests.h +++ b/Strategic/Quests.h @@ -9,7 +9,8 @@ #define QUESTINPROGRESS 1 #define QUESTDONE 2 -#define MAX_QUESTS 30 +#define MAX_QUESTS 255 +#define MAX_OLD_QUESTS 30 #define MAX_FACTS 65536 #define NUM_FACTS 500 //If you increase this number, add entries to the fact text list in QuestText.c @@ -67,7 +68,15 @@ enum Quests QUEST_FREE_CHILDREN, // 20 QUEST_LEATHER_SHOP_DREAM, +#ifdef JA2UB + QUEST_DESTROY_MISSLES = 23, + QUEST_FIX_LAPTOP, + QUEST_GET_RID_BLOODCATS_AT_BETTYS, + QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL, +#else QUEST_KILL_DEIDRANNA = 25 + +#endif } ; /* // The first quest is mandatory. Player must find Miguel and deliver letter to him. The tough @@ -518,6 +527,34 @@ enum Facts FACT_PLAYER_KILLED_BOXERS = 368, // HEADROCK HAM 4: Seen Mobile Militia screen after having at least one mobile unit? FACT_MOBILE_RESTRICTIONS_VIEWED = 369, +#ifdef JA2UB + //Ja25 UB + FACT_IMPORTED_SAVE_AND_MARY_WAS_DEAD = 400, + FACT_JOHN_KULBA_OFFERED_TO_BE_RECRUITED,// 401, + FACT_TEX_IS_IN_GAME_AND_ALIVE_IN_STORE,// 402, + FACT_PLAYER_PAID_BETTY_MORE_THEN_X_FOR_ITEM = 403, + FACT_PLAYER_BOUGHT_A_TEX_VIDEO_FROM_BETTY,// 404, + FACT_RAULS_INVENTORY_CHANGED_SINCE_LAST_VISIT,// 405 + FACT_PLAYER_THREATENED_RAUL_COUPLE_TIMES,// 406 + FACT_PLAYER_BOUGHT_SOMETHING_FROM_RAUL,// 407 +// FACT_SKYRIDER_IN_C16,// 408 +// FACT_SKYRIDER_IN_C16,// 409 +// FACT_SKYRIDER_IN_C16,// 410 +// FACT_SKYRIDER_IN_C16,// 411 + FACT_PLAYER_BOUGHT_BARRET_FROM_RAUL = 412, + FACT_MERC_SAY_QUOTE_WHEN_TALK_MENU_CLOSES,// 413 + FACT_PLAYER_IMPORTED_SAVE_MIGUEL_DEAD,// 414 + FACT_PLAYER_IMPORTED_SAVE_FATIMA_OR_PACOS_DEAD,// 415 + FACT_PLAYER_IMPORTED_SAVE_CARLOS_DEAD,// 416 + FACT_PLAYER_IMPORTED_SAVE_IRA_DEAD,// 417 + FACT_PLAYER_IMPORTED_SAVE_DIMITRI_DEAD,// 418 + FACT_PLAYER_IMPORTED_SAVE,// 419 + FACT_PLAYER_KILLED_ALL_BETTYS_BLOODCATS,// 420 + FACT_BIGGENS_IS_ON_TEAM,// 421 + FACT_FAN_STOPPPED,// 422 + FACT_BIGGENS_ON_TEAM_AND_FAN_STOPPED,// 423 + FACT_PLAYER_KNOWS_ABOUT_FAN_STOPPING,// 424 +#endif } ; //** END FACTS ************************* @@ -562,7 +599,7 @@ extern void CheckForQuests( UINT32 uiDay ); void InitQuestEngine(); -BOOLEAN LoadQuestInfoFromSavedGameFile( HWFILE hFile ); +BOOLEAN LoadQuestInfoFromSavedGameFile( HWFILE hFile, UINT8 MaxQuest ); BOOLEAN SaveQuestInfoToSavedGameFile( HWFILE hFile ); // added by SANDRO diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index 5edeb108..7d8caebb 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -1167,7 +1167,7 @@ void PostNextSchedule( SOLDIERTYPE *pSoldier ) usBestTime = NUM_MIN_IN_DAY - (usTime - pSchedule->usTime[ i ]); iBestIndex = i; } - } + } // WANNE: Removed the assertion and added the check instead //Assert( iBestIndex >= 0 ); diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index 31c63699..71900da5 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -419,6 +419,9 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) void HandleDelayedItemsArrival( UINT32 uiReason ) { + +// LuaHandleDelayedItemsArrival( uiReason, 0); + // This function moves all the items that Pablos has stolen // (or items that were delayed) to the arrival location for new shipments, INT32 sStartGridNo; @@ -426,6 +429,10 @@ void HandleDelayedItemsArrival( UINT32 uiReason ) BOOLEAN fOk; WORLDITEM * pTemp = 0; UINT8 ubLoop; + + + +//#if 0 if (uiReason == NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS ) { if ( gMercProfiles[ PABLO ].bMercStatus == MERC_IS_DEAD ) @@ -523,19 +530,27 @@ void HandleDelayedItemsArrival( UINT32 uiReason ) if (pTemp) { delete [] pTemp; } + +//#endif } void AddSecondAirportAttendant( void ) { + +//LetLuaHandleEarlyMorningEvents(2); +//#if 0 // add the second airport attendant to the Drassen airport... gMercProfiles[99].sSectorX = BOBBYR_SHIPPING_DEST_SECTOR_X; gMercProfiles[99].sSectorY = BOBBYR_SHIPPING_DEST_SECTOR_Y; gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z; +//#endif } void SetPabloToUnbribed( void ) { +// LetLuaHandleEarlyMorningEvents(3); +//#if 0 if (guiPabloExtraDaysBribed > 0) { // set new event for later on, because the player gave Pablo more money! @@ -546,10 +561,13 @@ void SetPabloToUnbribed( void ) { SetFactFalse( FACT_PABLOS_BRIBED ); } +//#endif } void HandlePossiblyDamagedPackage( void ) { +// LetLuaHandleEarlyMorningEvents(1); +//#if 0 if (Random( 100 ) < 70) { SetFactTrue( FACT_PACKAGE_DAMAGED ); @@ -562,10 +580,14 @@ void HandlePossiblyDamagedPackage( void ) } // whatever happened, the shipment is no longer delayed SetFactFalse( FACT_SHIPMENT_DELAYED_24_HOURS ); +//#endif } void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck ) { + +// LuaCheckForKingpinsMoneyMissing ( fFirstCheck , 0 ); +//#if 0 UINT32 uiLoop; UINT32 uiTotalCash = 0; BOOLEAN fKingpinWillDiscover = FALSE, fKingpinDiscovers = FALSE; @@ -644,11 +666,14 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck ) // he sends email to the player AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, Random( 120 ), FACT_KINGPIN_KNOWS_MONEY_GONE, 2 ); } - +//#endif } void HandleNPCSystemEvent( UINT32 uiEvent ) { + +// LetLuaHandleNPCSystemEvent( uiEvent, 0 ); +//#if 0 if (uiEvent < NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS) { switch( uiEvent ) @@ -687,7 +712,12 @@ void HandleNPCSystemEvent( UINT32 uiEvent ) { // KP knows money is gone, hasn't told player, if this event is called then the 2 // days are up... send email - AddEmail( KING_PIN_LETTER, KING_PIN_LETTER_LENGTH, KING_PIN, GetWorldTotalMin(), -1, -1 ); + +#ifdef JA2UB +// no UB +#else + AddEmail( KING_PIN_LETTER, KING_PIN_LETTER_LENGTH, KING_PIN, GetWorldTotalMin(), -1, -1 , TYPE_EMAIL_EMAIL_EDT ); +#endif StartQuest( QUEST_KINGPIN_MONEY, 5, MAP_ROW_D ); // add event to send terrorists two days from now AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, Random( 120 ), FACT_KINGPIN_KNOWS_MONEY_GONE, 2 ); @@ -786,7 +816,11 @@ void HandleNPCSystemEvent( UINT32 uiEvent ) break; case NPC_ACTION_SEND_ENRICO_MIGUEL_EMAIL: - AddEmail( ENRICO_MIGUEL, ENRICO_MIGUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1 ); +#ifdef JA2UB +// no UB +#else + AddEmail( ENRICO_MIGUEL, ENRICO_MIGUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1 , TYPE_EMAIL_EMAIL_EDT); +#endif break; case NPC_ACTION_TIMER_FOR_VEHICLE: @@ -801,6 +835,8 @@ void HandleNPCSystemEvent( UINT32 uiEvent ) break; } } + +//#endif } void HandleEarlyMorningEvents( void ) diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index f5eeca56..4280e892 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -48,6 +48,9 @@ #include "Town Militia.h" #endif +#ifdef JA2UB +#include "ub_config.h" +#endif //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -464,12 +467,36 @@ void MercDailyUpdate() //remove the Flag, so if the merc goes on another assignment, the player can leave an email. pProfile->ubMiscFlags3 &= ~PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM; +#ifdef JA2UB - // Read from Email.edt + //if the Laptop is NOT broken + if( gubQuest[ QUEST_FIX_LAPTOP ] != QUESTINPROGRESS && gGameUBOptions.LaptopQuestEnabled == TRUE ) + { +#endif + // Read from EmailMercAvailable.xml + UINT8 pMerc = 0; + UINT8 iMerc = 0; + UINT8 oMerc = 0; + + if ( ReadXMLEmail == TRUE ) + { + oMerc = cnt; + iMerc = oMerc * 1; + + if ( oMerc != 0 ) + pMerc = oMerc + 1; + else + pMerc = 0; + if ( gProfilesAIM[cnt].ProfilId == cnt ) + AddEmailTypeXML( pMerc, iMerc, iMerc, GetWorldTotalMin(), -1 , TYPE_EMAIL_AIM_AVAILABLE); + } + else + { + // Read from Email.edt and sender (nickname) from MercProfiles.xml if (cnt < 170) { // TO DO: send E-mail to player telling him the merc has returned from an assignment - AddEmail( ( UINT8 )( iOffset + ( cnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + cnt ), GetWorldTotalMin(), -1, -1 ); + AddEmail( ( UINT8 )( iOffset + ( cnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, (UINT8) cnt, GetWorldTotalMin(), -1, -1 , TYPE_EMAIL_EMAIL_EDT_NAME_MERC); } else { @@ -477,25 +504,29 @@ void MercDailyUpdate() if (cnt < 178) { UINT16 iMsgLength = cnt; - UINT8 sender = cnt - 119; // SenderNameList.xml + //UINT8 sender = cnt - 119; // SenderNameList.xml // Fake Barry Unger mail, but with the msgLength of the WF merc ID -> Correct in PreProcessEmail() - AddEmailWFMercAvailable( ( UINT8 )( iOffset + 0 * AIM_REPLY_LENGTH_BARRY ), iMsgLength, sender, GetWorldTotalMin(), -1 ); + AddEmailWFMercAvailable( ( UINT8 )( iOffset + 0 * AIM_REPLY_LENGTH_BARRY ), iMsgLength, cnt, GetWorldTotalMin(), -1 , TYPE_EMAIL_EMAIL_EDT_NAME_MERC); } // Generic mail else { // TODO.RW: Send generic mail UINT16 iMsgLength = cnt; - UINT8 sender = cnt - 119; // SenderNameList.xml + //UINT8 sender = cnt - 119; // SenderNameList.xml // Fake Barry Unger mail, but with the msgLength of the WF merc ID -> Correct in PreProcessEmail() - AddEmailWFMercAvailable( ( UINT8 )( iOffset + 0 * AIM_REPLY_LENGTH_BARRY ), iMsgLength, sender, GetWorldTotalMin(), -1 ); + AddEmailWFMercAvailable( ( UINT8 )( iOffset + 0 * AIM_REPLY_LENGTH_BARRY ), iMsgLength, cnt, GetWorldTotalMin(), -1 , TYPE_EMAIL_EMAIL_EDT_NAME_MERC); } } - + + } // WANNE: Should we stop time compression. I don't know. //StopTimeCompression(); +#ifdef JA2UB + } +#endif } } } @@ -546,8 +577,11 @@ void MercDailyUpdate() // build quit list //BuildMercQuitList( pQuitList ); +#ifdef JA2UB +//no UB +#else HandleSlayDailyEvent( ); - +#endif // rebuild list for mapscreen ReBuildCharactersList( ); // HEADROCK HAM B1: Run a function to redefine Roaming Militia Restrictions. @@ -1042,8 +1076,11 @@ void UpdateBuddyAndHatedCounters( void ) pProfile->bHated[2] = pProfile->bLearnToHate; pProfile->bMercOpinion[ubOtherProfileID] = HATED_OPINION; } - +#ifdef JA2UB + if (pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC || (pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC && ( /* pSoldier->ubProfile == DEVIN || */ pSoldier->ubProfile == SLAY || pSoldier->ubProfile == IGGY || pSoldier->ubProfile == CONRAD ) ) ) +#else if (pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC || (pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC && (pSoldier->ubProfile == DEVIN || pSoldier->ubProfile == SLAY || pSoldier->ubProfile == IGGY || pSoldier->ubProfile == CONRAD ) ) ) +#endif { // Leave now! ( handle equipment too ).... TacticalCharacterDialogue( pSoldier, QUOTE_MERC_QUIT_LEARN_TO_HATE ); @@ -1374,3 +1411,56 @@ void HourlyCamouflageUpdate( void ) } } } +#ifdef JA2UB +void HandleAddingAnyAimAwayEmailsWhenLaptopGoesOnline() +{ + UINT32 cnt; + INT32 iOffset; + MERCPROFILESTRUCT *pProfile; + + + //Loop through all the profiles + for( cnt = 0; cnt < NUM_PROFILES; cnt++) + { + pProfile = &(gMercProfiles[ cnt ]); + + if (pProfile->uiDayBecomesAvailable == 0) + { + //if the merc CAN become ready + if( pProfile->bMercStatus != MERC_FIRED_AS_A_POW ) + { + // if the player has left a message for this merc + if ( pProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM ) + { + iOffset = AIM_REPLY_BARRY; + + //remove the Flag, so if the merc goes on another assignment, the player can leave an email. + pProfile->ubMiscFlags3 &= ~PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM; + + UINT8 pMerc = 0; + UINT8 iMerc = 0; + UINT8 oMerc = 0; + + if ( ReadXMLEmail == TRUE ) + { + oMerc = cnt; + iMerc = oMerc * 1; + + if ( oMerc != 0 ) + pMerc = oMerc + 1; + else + pMerc = 0; + if ( gProfilesAIM[cnt].ProfilId == cnt ) + AddEmailTypeXML( pMerc, iMerc, iMerc, GetWorldTotalMin(), -1 , TYPE_EMAIL_AIM_AVAILABLE); + } + else + { + // TO DO: send E-mail to player telling him the merc has returned from an assignment + AddEmail( ( UINT8 )( iOffset + ( cnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + cnt ), GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT_NAME_MERC); + } + } + } + } + } +} +#endif diff --git a/Strategic/Strategic Merc Handler.h b/Strategic/Strategic Merc Handler.h index 1f9b4968..838a24ab 100644 --- a/Strategic/Strategic Merc Handler.h +++ b/Strategic/Strategic Merc Handler.h @@ -12,4 +12,10 @@ void MercComplainAboutEquipment( UINT8 ubProfileID ); BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier ); void UpdateBuddyAndHatedCounters( void ); void HourlyCamouflageUpdate( void ); + +#ifdef JA2UB +//ja25 UB +void HandleAddingAnyAimAwayEmailsWhenLaptopGoesOnline(); +#endif + #endif diff --git a/Strategic/Strategic Movement Costs.cpp b/Strategic/Strategic Movement Costs.cpp index 514f69bb..07884df9 100644 --- a/Strategic/Strategic Movement Costs.cpp +++ b/Strategic/Strategic Movement Costs.cpp @@ -13,8 +13,26 @@ #endif #include "Map Screen Interface Map.h" +#ifdef JA2UB +#include "Ja25Update.h" +#include "message.h" +#include "strategicmap.h" +#include "Map Screen Interface Map.h" +#include "Strategic Movement.h" +//#include "Summary Info.h" +#include "ub_config.h" +#endif + extern BOOLEAN sBadSectorsList[ WORLD_MAP_X ][ WORLD_MAP_X ]; +#ifdef JA2UB +extern void UpdateCustomMapMovementCosts(); // ja25 UB +extern void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ); // ja25 UB +extern void AddCustomMap( INT32 iRow, INT32 iCol, BOOLEAN fDisplayMessages, BOOLEAN fMessageIfNotExist ); //ja25 UB +extern UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ); +extern BOOLEAN SectorIsImpassableUB( INT16 sSector ); +#endif + typedef enum { SMCTABLE_ELEMENT_NONE = 0, @@ -3378,33 +3396,2187 @@ void InitStrategicRowP() pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; } */ +#ifdef JA2UB +void InitStrategicRowA() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_A1 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A2 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A3 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A4 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A5 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A6 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A7 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A8 ]; + pSector->ubTravelRating = 14; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A9 ]; + pSector->ubTravelRating = 70; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A10 ]; + pSector->ubTravelRating = 70; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A11 ]; + pSector->ubTravelRating = 18; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A12 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A13 ]; + pSector->ubTravelRating = 14; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A14 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A15 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_A16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowB() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_B1 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B2 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B3 ]; + pSector->ubTravelRating = 6; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B4 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B5 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B6 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B7 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B8 ]; + pSector->ubTravelRating = 20; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B9 ]; + pSector->ubTravelRating = 70; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B10 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B11 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B12 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B13 ]; + pSector->ubTravelRating = 85; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B14 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B15 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_B16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowC() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_C1 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C2 ]; + pSector->ubTravelRating = 40; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C3 ]; + pSector->ubTravelRating = 40; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C4 ]; + pSector->ubTravelRating = 20; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C5 ]; + pSector->ubTravelRating = 80; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C6 ]; + pSector->ubTravelRating = 75; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C7 ]; + pSector->ubTravelRating = 45; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C8 ]; + pSector->ubTravelRating = 48; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C9 ]; + pSector->ubTravelRating = 80; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C10 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C11 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C12 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C13 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C14 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C15 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_C16 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowD() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_D1 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D2 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD;//EDGEOFWORLD_SAMSITE; + + pSector = &SectorInfo[ SEC_D3 ]; + pSector->ubTravelRating = 40; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D4 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D5 ]; + pSector->ubTravelRating = 49; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D6 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D7 ]; + pSector->ubTravelRating = 45; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D8 ]; + pSector->ubTravelRating = 16; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D9 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D10 ]; + pSector->ubTravelRating = 11; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D11 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D12 ]; + pSector->ubTravelRating = 11; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D13 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D14 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D15 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_D16 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowE() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_E1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E2 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E3 ]; + pSector->ubTravelRating = 45; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E4 ]; + pSector->ubTravelRating = 11; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E5 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E6 ]; + pSector->ubTravelRating = 11; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E7 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E8 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E9 ]; + pSector->ubTravelRating = 56; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E10 ]; + pSector->ubTravelRating = 11; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E11 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E12 ]; + pSector->ubTravelRating = 35; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E13 ]; + pSector->ubTravelRating = 45; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E14 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E15 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_E16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowF() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_F1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F2 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F3 ]; + pSector->ubTravelRating = 40; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F4 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F5 ]; + pSector->ubTravelRating = 6; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F6 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F7 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F8 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F9 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F10 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F11 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F12 ]; + pSector->ubTravelRating = 40; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F13 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F14 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F15 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_F16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowG() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_G1 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G2 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G3 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G4 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G5 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G6 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G7 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G8 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G9 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G10 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G11 ]; + pSector->ubTravelRating = 25; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G12 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G13 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G14 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G15 ]; + pSector->ubTravelRating = 16; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_G16 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowH() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_H1 ]; + pSector->ubTravelRating = 67; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H2 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H3 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H4 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H5 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H6 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H7 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = MOUNTAINS_TYPE; + + pSector = &SectorInfo[ SEC_H8 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = MOUNTAINS_TYPE; + + pSector = &SectorInfo[ SEC_H9 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = MOUNTAINS_TYPE; + + pSector = &SectorInfo[ SEC_H10 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = DENSE; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = DENSE; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = SPARSE; + + pSector = &SectorInfo[ SEC_H11 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = TOWN; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = TOWN; + + + pSector = &SectorInfo[ SEC_H12 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H13 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H14 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H15 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_H16 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowI() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_I1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I2 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I3 ]; + pSector->ubTravelRating = 45; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I4 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I5 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I6 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I7 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I8 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I9 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = SPARSE; + + +#ifdef JA2UB_PRESS_PREVIEW + + pSector = &SectorInfo[ SEC_I10 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + +#else + + pSector = &SectorInfo[ SEC_I10 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = TOWN; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = TOWN; + +#endif + + pSector = &SectorInfo[ SEC_I11 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = TOWN; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = TOWN; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = TOWN; + + pSector = &SectorInfo[ SEC_I12 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = DENSE; + + pSector = &SectorInfo[ SEC_I13 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = PLAINS; + + pSector = &SectorInfo[ SEC_I14 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I15 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_I16 ]; + pSector->ubTravelRating = 2; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowJ() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_J1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J2 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J3 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J4 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J5 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J6 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J7 ]; + pSector->ubTravelRating = 6; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J8 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J9 ]; + pSector->ubTravelRating = 80; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J10 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J11 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = SPARSE; + + pSector = &SectorInfo[ SEC_J12 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = DENSE; + + pSector = &SectorInfo[ SEC_J13 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = POWER_PLANT_TYPE; + + pSector = &SectorInfo[ SEC_J14 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = GROUNDBARRIER; + + pSector = &SectorInfo[ SEC_J15 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_J16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowK() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_K1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K2 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K3 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K4 ]; + pSector->ubTravelRating = 45; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K5 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K6 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K7 ]; + pSector->ubTravelRating = 60; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K8 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K9 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K10 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K11 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K12 ]; + pSector->ubTravelRating = 70; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_K13 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = GROUNDBARRIER; + + pSector = &SectorInfo[ SEC_K14 ]; + pSector->ubTravelRating = 50; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = GROUNDBARRIER; + + pSector = &SectorInfo[ SEC_K15 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = GROUNDBARRIER; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = FINAL_COMPLEX; + + pSector = &SectorInfo[ SEC_K16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = GROUNDBARRIER; +} + +void InitStrategicRowL() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_L1 ]; + pSector->ubTravelRating = 4; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L2 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L3 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L4 ]; + pSector->ubTravelRating = 15; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L5 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L6 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L7 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L8 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L9 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L10 ]; + pSector->ubTravelRating = 9; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L11 ]; + pSector->ubTravelRating = 17; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L12 ]; + pSector->ubTravelRating = 55; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L13 ]; + pSector->ubTravelRating = 18; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L14 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_L15 ]; + pSector->ubTravelRating = 3; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = GROUNDBARRIER; + + pSector = &SectorInfo[ SEC_L16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowM() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_M1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M2 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M3 ]; + pSector->ubTravelRating = 70; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M4 ]; + pSector->ubTravelRating = 38; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M5 ]; + pSector->ubTravelRating = 70; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M6 ]; + pSector->ubTravelRating = 65; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M7 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M8 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M9 ]; + pSector->ubTravelRating = 8; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M10 ]; + pSector->ubTravelRating = 7; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M11 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M12 ]; + pSector->ubTravelRating = 12; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M13 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M14 ]; + pSector->ubTravelRating = 2; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M15 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_M16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowN() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_N1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N2 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N3 ]; + pSector->ubTravelRating = 80; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N4 ]; + pSector->ubTravelRating = 80; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N5 ]; + pSector->ubTravelRating = 80; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N6 ]; + pSector->ubTravelRating = 40; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N7 ]; + pSector->ubTravelRating = 20; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N8 ]; + pSector->ubTravelRating = 10; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N9 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N10 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N11 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N12 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N13 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N14 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N15 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_N16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowO() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_O1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O2 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O3 ]; + pSector->ubTravelRating = 90; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O4 ]; + pSector->ubTravelRating = 90; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O5 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O6 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O7 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O8 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O9 ]; + pSector->ubTravelRating = 5; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O10 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O11 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O12 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O13 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O14 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O15 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_O16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} + +void InitStrategicRowP() +{ + SECTORINFO *pSector; + + pSector = &SectorInfo[ SEC_P1 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +// pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; //keep as EDGEOFWORLD so we can teleport to demo maps. + + pSector = &SectorInfo[ SEC_P2 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P3 ]; + pSector->ubTravelRating = 100; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P4 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P5 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P6 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P7 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P8 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P9 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P10 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P11 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P12 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P13 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P14 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P15 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + pSector = &SectorInfo[ SEC_P16 ]; + pSector->ubTravelRating = 0; + pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; +} +#endif + BOOLEAN InitStrategicMovementCosts() { char fileName[MAX_PATH]; - +#ifdef JA2UB +if ( gGameUBOptions.StrategicMovementCostsXML == TRUE ) + { +#endif // need to be here strcpy(fileName, TABLEDATA_DIRECTORY); strcat(fileName, MOVEMENTCOSTFILENAME); if(!ReadInStrategicMovementCosts(fileName)) return FALSE; - - //InitStrategicRowA(); - //InitStrategicRowB(); - //InitStrategicRowC(); - //InitStrategicRowD(); - //InitStrategicRowE(); - //InitStrategicRowF(); - //InitStrategicRowG(); - //InitStrategicRowH(); - //InitStrategicRowI(); - //InitStrategicRowJ(); - //InitStrategicRowK(); - //InitStrategicRowL(); - //InitStrategicRowM(); - //InitStrategicRowN(); - //InitStrategicRowO(); - //InitStrategicRowP(); - +#ifdef JA2UB + } + else + { + InitStrategicRowA(); + InitStrategicRowB(); + InitStrategicRowC(); + InitStrategicRowD(); + InitStrategicRowE(); + InitStrategicRowF(); + InitStrategicRowG(); + InitStrategicRowH(); + InitStrategicRowI(); + InitStrategicRowJ(); + InitStrategicRowK(); + InitStrategicRowL(); + InitStrategicRowM(); + InitStrategicRowN(); + InitStrategicRowO(); + InitStrategicRowP(); + } +#endif //WriteInStrategicMovementCosts("TABLEDATA\\~MovementCosts.xml"); @@ -3457,6 +5629,581 @@ BOOLEAN InitStrategicMovementCosts() } } #endif + + #ifdef JA2UB + if ( gGameUBOptions.MakeStrategicMovementCosts == TRUE ) + UpdateCustomMapMovementCosts(); //Ja25 UB + //MakeBadSectorListFromMapsOnHardDrive( TRUE ); //ja25 UB + #endif + + return( TRUE ); } + +#ifdef JA2UB +void AddCustomMap( INT32 iRow, INT32 iCol, BOOLEAN fDisplayMessages, BOOLEAN fMessageIfNotExist ) //ja25 UB +{ + CHAR8 zMapName[200]; + //SUMMARYFILE *pSummary; + //SUMMARYFILE *pSummary + INT8 bLevel; + UNDERGROUND_SECTORINFO *pSector; + //UNDERGROUND_SECTORINFO *curr; + //SECTORINFO *pSector = NULL; + + // if we are the first secotr, ignore! + //if ( iRow == JA2_5_START_SECTOR_Y && iCol == JA2_5_START_SECTOR_X ) + //{ + // return; + //} + + + for ( bLevel = 0; bLevel < 4; bLevel++ ) + { + + // ATE: Check for existance of 'remove' file - if so, remove this sector from list, adjust + // movement costs accordingly... + if ( bLevel == 0 ) + { + sprintf( zMapName, "Maps\\%c%d.nomap", iRow + 'A' -1, iCol ); + + if ( FileExistsNoDB( zMapName ) ) + { + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector = FALSE; + sBadSectorsList[iCol][iRow] = 1; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubTravelRating = 50; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubTraversability[ THROUGH_STRATEGIC_MOVE ] = EDGEOFWORLD; + + // update adjacent movement costs + if( iRow > 1 ) + { + SectorInfo[ ( SECTOR( iCol, iRow-1 ) ) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + } + + if( iCol > 1 ) + { + SectorInfo[ ( SECTOR( iCol-1, iRow ) ) ].ubTraversability[ EAST_STRATEGIC_MOVE ] = EDGEOFWORLD; + } + + if( iRow < 16 ) + { + SectorInfo[ ( SECTOR( iCol, iRow+1 ) ) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] = EDGEOFWORLD; + } + + if( iCol < 16 ) + { + SectorInfo[ ( SECTOR( iCol+1, iRow ) ) ].ubTraversability[ WEST_STRATEGIC_MOVE ] = EDGEOFWORLD; + } + continue; + } + } + + if ( bLevel == 0 ) + { + sprintf( zMapName, "Maps\\%c%d.dat", iRow + 'A' -1, iCol ); + } + else + { + sprintf( zMapName, "Maps\\%c%d_b%d.dat", iRow + 'A' -1, iCol, bLevel ); + } + + //check to see if there is a map here + if ( !FileExistsNoDB( zMapName ) ) + { + if ( fMessageIfNotExist && bLevel == 0 ) + { + if ( fDisplayMessages ) + { + sprintf( zMapName, "Maps\\%c%d", iRow + 'A' -1, iCol ); + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map file does not exist." ); + } + } + //return; + continue; + } + + if ( bLevel == 0 ) + { + sprintf( zMapName, "Maps\\%c%d", iRow + 'A' -1, iCol ); + } + else + { + sprintf( zMapName, "Maps\\%c%d_b%d", iRow + 'A' -1, iCol, bLevel ); + } + + // OK, now check a bunch of conditions... + + // Is this level a virgin? + if ( bLevel == 0 ) + { + if ( GetSectorFlagStatus( (INT16)iCol, (INT16)iRow, 0, SF_ALREADY_VISITED ) ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map has already been visited." ); + + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector = TRUE; + sBadSectorsList[iCol][iRow] = 0; + } + continue; + } + + } + else + { + pSector = FindUnderGroundSector( (INT16)iCol, (INT16)iRow, bLevel ); + + if ( pSector ) + { + if ( pSector->fVisited ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map has already been visited." ); + sBadSectorsList[iCol][iRow] = 0; + } + continue; + } + } + } + + // Is this the current sector? + if ( gWorldSectorX == iCol && gWorldSectorY == iRow && gbWorldSectorZ == bLevel ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map is the current sector." ); + sBadSectorsList[iCol][iRow] = 0; + } + continue; + } + + + //We're good! + if ( fDisplayMessages ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_CHAT, L"Added Custom map: %S.", zMapName ); + } + + if ( bLevel == 0 ) + { + if ( SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCampaignSector ) + { + // ATE: This has been changed, if a campaign sector, just remove flag... + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCampaignSector = FALSE; + sBadSectorsList[iCol][iRow] = 0; + continue; + } + } + + else + { + // See if this sector exists, and if so is it a campagin sectior? + pSector = FindUnderGroundSector( (INT16)iCol, (INT16)iRow, bLevel ); + + if ( pSector ) + { + if ( pSector->fCampaignSector ) + { + // ATE: This has been changed, if a campaign sector, just remove flag... + pSector->fCampaignSector = FALSE; + sBadSectorsList[iCol][iRow] = 0; + continue; + } + } + } + + if ( bLevel == 0 ) + { + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector = TRUE; + sBadSectorsList[iCol][iRow] = 0; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCustomSector = TRUE; + + + if ( gGameUBOptions.AddRandomEnemyToSector == TRUE ) + { + if ( SECTOR( iCol , iRow ) == SEC_H7 || SECTOR( iCol , iRow ) == SEC_H8 || SECTOR( iCol , iRow ) == SEC_H9 || + SECTOR( iCol , iRow ) == SEC_H10 || SECTOR( iCol , iRow ) == SEC_H11 || SECTOR( iCol , iRow ) == SEC_I9 || + SECTOR( iCol , iRow ) == SEC_I10 || SECTOR( iCol , iRow ) == SEC_I11 || SECTOR( iCol , iRow ) == SEC_I12 || + SECTOR( iCol , iRow ) == SEC_I13 || SECTOR( iCol , iRow ) == SEC_J11 || SECTOR( iCol , iRow ) == SEC_J12 || + SECTOR( iCol , iRow ) == SEC_J13 || SECTOR( iCol , iRow ) == SEC_K14 || SECTOR( iCol , iRow ) == SEC_K15 || + SECTOR( iCol , iRow ) == SEC_K16 || SECTOR( iCol , iRow ) == SEC_L15 || + ( SECTOR( iCol , iRow ) == SEC_I13 && bLevel == 1) || ( SECTOR( iCol , iRow ) == SEC_J13 && bLevel == 1) || + ( SECTOR( iCol , iRow ) == SEC_J14 && bLevel == 1) || ( SECTOR( iCol , iRow ) == SEC_K15 && bLevel == 1) || + ( SECTOR( iCol , iRow ) == SEC_K15 && bLevel == 2) || ( SECTOR( iCol , iRow ) == SEC_L15 && bLevel == 2) || + ( SECTOR( iCol , iRow ) == SEC_L15 && bLevel == 3) ) + { + } + else + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_CHAT, L"Added Random Enemy to sector : %S.", zMapName ); + RandomAddEnemy( iCol, iRow, bLevel ); + } + } + + + } + else + { + + pSector = FindUnderGroundSector( (UINT8)iCol, (UINT8)iRow, bLevel ); + if ( pSector ) + { + //ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + } + else + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_CHAT, L"Added New Underground : %S.", zMapName ); + pSector = NewUndergroundNode( (UINT8)iCol, (UINT8)iRow, bLevel ); + sBadSectorsList[iCol][iRow] = 0; + if ( gGameUBOptions.AddRandomEnemyToSector == TRUE ) + { + if ( SECTOR( iCol , iRow ) == SEC_H7 || SECTOR( iCol , iRow ) == SEC_H8 || SECTOR( iCol , iRow ) == SEC_H9 || + SECTOR( iCol , iRow ) == SEC_H10 || SECTOR( iCol , iRow ) == SEC_H11 || SECTOR( iCol , iRow ) == SEC_I9 || + SECTOR( iCol , iRow ) == SEC_I10 || SECTOR( iCol , iRow ) == SEC_I11 || SECTOR( iCol , iRow ) == SEC_I12 || + SECTOR( iCol , iRow ) == SEC_I13 || SECTOR( iCol , iRow ) == SEC_J11 || SECTOR( iCol , iRow ) == SEC_J12 || + SECTOR( iCol , iRow ) == SEC_J13 || SECTOR( iCol , iRow ) == SEC_K14 || SECTOR( iCol , iRow ) == SEC_K15 || + SECTOR( iCol , iRow ) == SEC_K16 || SECTOR( iCol , iRow ) == SEC_L15 || + ( SECTOR( iCol , iRow ) == SEC_I13 && bLevel == 1) || ( SECTOR( iCol , iRow ) == SEC_J13 && bLevel == 1) || + ( SECTOR( iCol , iRow ) == SEC_J14 && bLevel == 1) || ( SECTOR( iCol , iRow ) == SEC_K15 && bLevel == 1) || + ( SECTOR( iCol , iRow ) == SEC_K15 && bLevel == 2) || ( SECTOR( iCol , iRow ) == SEC_L15 && bLevel == 2) || + ( SECTOR( iCol , iRow ) == SEC_L15 && bLevel == 3) ) + { + } + else + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_CHAT, L"Added Random Enemy to sector : %S.", zMapName ); + RandomAddEnemy( iCol, iRow, bLevel ); + } + + } + + } + } + + // I guess we need to load level to get the map information....? + // we don't want to destroy the level we're in, however.... + //pSummary = (SUMMARYFILE*)MemAlloc( sizeof( SUMMARYFILE ) ); + //memset( pSummary, 0, sizeof( SUMMARYFILE ) ); +/* + if ( !EvaluateWorldEx( zMapName, 0, pSummary, FALSE, FALSE, NULL ) ) + { + if ( fDisplayMessages ) + { + // Spew message + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + + if ( gfTriedToLoadOldMapVersion ) + { + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Incompatible map." ); + } + } + } + else + { + //JA25_SECTOR_AI SectorAIInfo; + UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumBloodcats; + + //Test some stuff here, like the total # of placements, enemies, etc + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = pSummary->MapInfo.ubNumAdminsE; + ubNumTroops = pSummary->MapInfo.ubNumTroopsE; + ubNumElites = pSummary->MapInfo.ubNumElitesE; + ubNumBloodcats = pSummary->MapInfo.ubNumBloodcatsE; + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = pSummary->MapInfo.ubNumAdminsN; + ubNumTroops = pSummary->MapInfo.ubNumTroopsN; + ubNumElites = pSummary->MapInfo.ubNumElitesN; + ubNumBloodcats = pSummary->MapInfo.ubNumBloodcatsN; + break; + case DIF_LEVEL_HARD: + ubNumAdmins = pSummary->MapInfo.ubNumAdminsD; + ubNumTroops = pSummary->MapInfo.ubNumTroopsD; + ubNumElites = pSummary->MapInfo.ubNumElitesD; + ubNumBloodcats = pSummary->MapInfo.ubNumBloodcatsD; + break; + } + + /*if( pSummary->MapInfo.sNorthGridNo == -1 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map needs NORTH entry point." ); + } + MemFree( pSummary ); + continue; + } + + if( pSummary->MapInfo.sEastGridNo == -1 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map needs EAST entry point." ); + } + MemFree( pSummary ); + continue; + } + + if( pSummary->MapInfo.sWestGridNo == -1 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map needs WEST entry point." ); + } + MemFree( pSummary ); + continue; + } + + if( pSummary->MapInfo.sSouthGridNo == -1 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map needs SOUTH entry point." ); + } + MemFree( pSummary ); + continue; + } + + if( pSummary->MapInfo.sCenterGridNo == -1 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map needs CENTER entry point." ); + } + MemFree( pSummary ); + continue; + } + + + if ( ( pSummary->ubAdminDetailed + pSummary->ubTroopDetailed + pSummary->ubEliteDetailed ) != 32 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map requires 32 enemy placements." ); + } + MemFree( pSummary ); + continue; + } + + // Check total populations + if ( ( ubNumTroops + ubNumAdmins + ubNumElites ) > 32 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Map population total must be less than 32." ); + } + MemFree( pSummary ); + continue; + } + + // Check insertion gridno if baaenment + if ( bLevel > 0 ) + { + if ( pSummary->MapInfo.sInsertionGridNo == -1 ) + { + if ( fDisplayMessages ) + { + ScreenMsg( MSG_FONT_RED, MSG_CHAT, L"Failed to add map: %S.", zMapName ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"Underground level needs invasion insertion gridno value." ); + } + MemFree( pSummary ); + continue; + } + } + + //We're good! + if ( fDisplayMessages ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_CHAT, L"Added Custom map: %S.", zMapName ); + } + + //if the sector shoulnd have a map there + if ( bLevel == 0 ) + { + if ( SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCampaignSector ) + { + // ATE: This has been changed, if a campaign sector, just remove flag... + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCampaignSector = FALSE; + //continue; + } + } + else + { + // See if this sector exists, and if so is it a campagin sectior? + pSector = FindUnderGroundSector( (INT16)iCol, (INT16)iRow, bLevel ); + + if ( pSector ) + { + if ( pSector->fCampaignSector ) + { + // ATE: This has been changed, if a campaign sector, just remove flag... + pSector->fCampaignSector = FALSE; + //continue; + } + } + } + + if ( bLevel == 0 ) + { + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector = TRUE; + SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCustomSector = TRUE; + + // Seed level + //SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubNumAdmins = ubNumAdmins; + //SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubNumTroops = ubNumTroops; + //SectorInfo[ ( SECTOR( iCol , iRow ) ) ].ubNumElites = ubNumElites; + //SectorInfo[ ( SECTOR( iCol , iRow ) ) ].bBloodCats = ubNumBloodcats; + + // wcscpy( SectorInfo[ ( SECTOR( iCol , iRow ) ) ].zCustomLevelName, pSummary->MapInfo.zLevelName ); + } + else + { + pSector = NewUndergroundNode( (UINT8)iCol, (UINT8)iRow, bLevel, FALSE ); + + // Seed + pSector->ubNumAdmins = ubNumAdmins; + pSector->ubNumTroops = ubNumTroops; + pSector->ubNumElites = ubNumElites; + + wcscpy( pSector->zCustomLevelName, pSummary->MapInfo.zLevelName ); + } + + // Seed AI + memset( &SectorAIInfo, 0, sizeof( SectorAIInfo ) ); + + SectorAIInfo.iSectorID = SECTOR( iCol , iRow ) ; + SectorAIInfo.bSectorZ = bLevel; + SectorAIInfo.bBaseNumEnemies = pSummary->MapInfo.ubBaseNumEnemies; + SectorAIInfo.bRandomNumEnemies = 4; + SectorAIInfo.bProbabilityOfAttacking = pSummary->MapInfo.ubAttackProbabilityRate; + SectorAIInfo.bMaxProbabilityForAttackingSector = 60; + SectorAIInfo.ubMinimumProbabiltyBeforeAttack = pSummary->MapInfo.ubGracePeriod; + SectorAIInfo.fAutoDirection = pSummary->MapInfo.fAutoDirection; + SectorAIInfo.ubInsertionDirection = pSummary->MapInfo.ubInsertionDirection; + SectorAIInfo.sInsertionGridNo = pSummary->MapInfo.sInsertionGridNo; + SectorAIInfo.fCustomSector = TRUE; + SectorAIInfo.ubLoadingScreenID = pSummary->MapInfo.ubLoadingScreenID; + + AddJA25AIDataToSector( &SectorAIInfo ); + + if ( bLevel == 0 ) + { + SetNumberOfJa25BloodCatsInSector( SectorAIInfo.iSectorID, ubNumBloodcats, pSummary->CreatureTeam.ubNumAnimals ); + } + + } + + MemFree( pSummary ); + */ + + } + +} + +void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ) +{ + INT32 iRow, iCol; + + + for( iRow=1; iRow<=16; iRow++ ) + { + for( iCol=1; iCol<=16; iCol++ ) + { + sBadSectorsList[iCol][iRow] = 1; + } + } + + SetUpValidCampaignSectors( ); + + //loop through all the sectors + for( iRow=1; iRow<=16; iRow++ ) + { + for( iCol=1; iCol<=16; iCol++ ) + { + AddCustomMap( iRow, iCol, fDisplayMessages, FALSE ); + } + } + +if ( gGameUBOptions.MakeStrategicMovementCosts == TRUE ) + UpdateCustomMapMovementCosts(); +} + +void UpdateCustomMapMovementCosts() +{ + INT32 iRow, iCol; + + //loop through all the sectors + for( iRow=1; iRow<=16; iRow++ ) + { + for( iCol=1; iCol<=16; iCol++ ) + { + + + if( SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fValidSector && SectorInfo[ ( SECTOR( iCol , iRow ) ) ].fCustomSector ) + { + + //if ( SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ THROUGH_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ THROUGH_STRATEGIC_MOVE ] = PLAINS; + + //sector above is clear + if( iRow > 1 && SectorInfo[ ( SECTOR( iCol , iRow - 1 ) ) ].fValidSector ) + { + + //if ( SectorInfo[ ( SECTOR( iCol, iRow-1 ) ) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow-1 ) ) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; + //if ( SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + + + } + + //sector west is clear + if( iCol > 1 && SectorInfo[ ( SECTOR( iCol - 1 , iRow ) ) ].fValidSector ) + { + //if ( SectorInfo[ ( SECTOR( iCol-1, iRow ) ) ].ubTraversability[ EAST_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol-1, iRow ) ) ].ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + //if ( SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ WEST_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + } + + //sector south is clear + if( iRow < 16 && SectorInfo[ ( SECTOR( iCol , iRow + 1 ) ) ].fValidSector ) + { + //if ( SectorInfo[ ( SECTOR( iCol, iRow+1 ) ) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow+1 ) ) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] = PLAINS; + //if ( SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; + } + + //sector east is clear + if( iCol < 16 && SectorInfo[ ( SECTOR( iCol + 1 , iRow ) ) ].fValidSector ) + { + //if ( SectorInfo[ ( SECTOR( iCol+1, iRow ) ) ].ubTraversability[ WEST_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol+1, iRow ) ) ].ubTraversability[ WEST_STRATEGIC_MOVE ] = PLAINS; + //if ( SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ EAST_STRATEGIC_MOVE ] == EDGEOFWORLD ) + SectorInfo[ ( SECTOR( iCol, iRow ) ) ].ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; + } + } + } + } +} +#endif diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 87d23842..1d3eaac4 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -52,6 +52,14 @@ #include "MilitiaSquads.h" #include "Vehicles.h" +#ifdef JA2UB +#include "Ja25Update.h" +#include "Ja25 Strategic Ai.h" +//#include "Map Screen Interface Map.h" + +//extern JA25_SECTOR_AI *gJa25AiSectorStruct; +#endif + #include "connect.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -1700,7 +1708,11 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if( fExceptionQueue || fCheckForBattle && gTacticalStatus.fEnemyInSector && FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, TRUE ) && (pGroup->ubNextX != gWorldSectorX || pGroup->ubNextY != gWorldSectorY || gbWorldSectorZ > 0 ) || + #ifdef JA2UB + //Ja25: NO meanwhiles + #else AreInMeanwhile() || + #endif //KM : Aug 11, 1999 -- Patch fix: Added additional checks to prevent a 2nd battle in the case // where the player is involved in a potential battle with bloodcats/civilians fCheckForBattle && HostileCiviliansPresent() || @@ -1710,12 +1722,16 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe //QUEUE BATTLE! //Delay arrival by a random value ranging from 3-5 minutes, so it doesn't get the player //too suspicious after it happens to him a few times, which, by the way, is a rare occurrence. +#ifdef JA2UB +/*Ja25: No meanwhiles*/ +#else if( AreInMeanwhile() ) { pGroup->uiArrivalTime ++; //tack on only 1 minute if we are in a meanwhile scene. This effectively //prevents any battle from occurring while inside a meanwhile scene. } else +#endif { pGroup->uiArrivalTime += Random(3) + 3; } @@ -1802,13 +1818,27 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe { // check for discovering secret locations INT8 bTownId = GetTownIdForSector( pGroup->ubSectorX, pGroup->ubSectorY ); - + + if ( gfHiddenTown[ bTownId ] == FALSE ) + { + gfHiddenTown[ bTownId ] = TRUE; + + if ( gfIconTown[ bTownId ] == TRUE ) + gfDrawHiddenTown[ bTownId ] = TRUE; + } + #ifdef JA2UB + //Ja25: No tixa, orta or sam site + #else + /* if( bTownId == TIXA ) SetTixaAsFound(); else if( bTownId == ORTA ) SetOrtaAsFound(); - else if( IsThisSectorASAMSector( pGroup->ubSectorX, pGroup->ubSectorY, 0 ) ) + else + */ + if( IsThisSectorASAMSector( pGroup->ubSectorX, pGroup->ubSectorY, 0 ) ) SetSAMSiteAsFound( GetSAMIdFromSector( pGroup->ubSectorX, pGroup->ubSectorY, 0 ) ); + #endif } @@ -1982,7 +2012,8 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if ( GroupAtFinalDestination( pGroup ) && ( pGroup->ubSectorZ == 0 ) && !fNeverLeft ) { // HEADROCK HAM 3.6: Messages are no longer yellow by default. - ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pVehicleStrings[ pVehicleList[ iVehId ].ubVehicleType ], pMapVertIndex[ pGroup->ubSectorY ], pMapHortIndex[ pGroup->ubSectorX ] ); + // ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pVehicleStrings[ pVehicleList[ iVehId ].ubVehicleType ], pMapVertIndex[ pGroup->ubSectorY ], pMapHortIndex[ pGroup->ubSectorX ] ); + ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], gNewVehicle[ pVehicleList[ iVehId ].ubVehicleType ].NewVehicleStrings, pMapVertIndex[ pGroup->ubSectorY ], pMapHortIndex[ pGroup->ubSectorX ] ); } } } @@ -2053,6 +2084,41 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe } } } + +#ifdef JA2UB +/* +//if the enemy group is at its final destination + if( !pGroup->fPlayer && GroupAtFinalDestination( pGroup ) ) + { + // Check to see if this is an AI sector + INT16 sJa25SaiSectorValue = GetJA25SectorID( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ ); + + if ( sJa25SaiSectorValue != -1 ) + { + // If we were told to attack, reset flag + if ( gJa25AiSectorStruct[ sJa25SaiSectorValue ].fEnemyEnrouteToAttack ) + { + gJa25AiSectorStruct[ sJa25SaiSectorValue ].fEnemyEnrouteToAttack = FALSE; + } + } + +*/ + //add the enemies to the sector +/* + SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].ubNumAdmins += pGroup->pEnemyGroup->ubNumAdmins; + SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].ubNumTroops += pGroup->pEnemyGroup->ubNumTroops; + SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].ubNumElites += pGroup->pEnemyGroup->ubNumElites; + if( fBattleGoingToStart ) + { + SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].ubAdminsInBattle = pGroup->pEnemyGroup->ubNumAdmins; + SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].ubTroopsInBattle = pGroup->pEnemyGroup->ubNumTroops; + SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].ubElitesInBattle = pGroup->pEnemyGroup->ubNumElites; + } +*/ + //} + +#endif + gfWaitingForInput = FALSE; } @@ -2063,10 +2129,15 @@ void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNe { // if any mercs are actually in the group + + #ifdef JA2UB + //Ja25 No strategic ai + #else if( StrategicAILookForAdjacentGroups( pGroup ) ) { //The routine actually just deleted the enemy group (player's don't get deleted), so we are done! return; } + #endif if( pGroup->fPlayer ) { @@ -2679,7 +2750,11 @@ void RemovePGroup( GROUP *pGroup ) } else { + #ifdef JA2UB + //Ja25 No strategic ai + #else RemoveGroupFromStrategicAILists( pGroup->ubGroupID ); + #endif MemFree( pGroup->pEnemyGroup ); } @@ -2983,6 +3058,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup //Determine the group's method(s) of tranportation. If more than one, //we will always use the highest time. + // WANNE: If we have an old savegame (from the dev. trunk, where the skyrider can only move on roads), just change the "pGroup->ubTransportationMask" to 16 for the heli to fix it in the savegame fFoot = (UINT8)(pGroup->ubTransportationMask & FOOT); fCar = (UINT8)(pGroup->ubTransportationMask & CAR); fTruck = (UINT8)(pGroup->ubTransportationMask & TRUCK); @@ -4349,7 +4425,12 @@ void ResetMovementForEnemyGroup( GROUP *pGroup ) } if( !pGroup->fBetweenSectors || !pGroup->ubNextX || !pGroup->ubNextY ) { //Reset the group's assignment by moving it to the group's original sector as it's pending group. + + #ifdef JA2UB + //Ja25 No strategic ai + #else RepollSAIGroup( pGroup ); + #endif return; } @@ -4751,6 +4832,11 @@ void RandomizePatrolGroupLocation( GROUP *pGroup ) //roll the dice to see if this will become an ambush random encounter. BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) { + +#ifdef JA2UB + //Ja25: No BLoodcat ambushes + return( FALSE ); +#else SECTORINFO *pSector; INT32 iHoursElapsed; UINT8 ubSectorID; @@ -4929,6 +5015,7 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) gubEnemyEncounterCode = NO_ENCOUNTER_CODE; return FALSE; } +#endif } void NotifyPlayerOfBloodcatBattle( UINT8 ubSectorX, UINT8 ubSectorY ) @@ -5132,7 +5219,13 @@ BOOLEAN HandlePlayerGroupEnteringSectorToCheckForNPCsOfNote( GROUP *pGroup ) // get the strategic sector value sStrategicSector = sSectorX + MAP_WORLD_X * sSectorY; - +#ifdef JA2UB + // ATE: if this is a custom map, return Ja25 UB + if ( SectorInfo[ SECTOR( sSectorY, sSectorX ) ].fCustomSector ) + { + return( FALSE ); + } +#endif // skip towns/pseudo-towns (anything that shows up on the map as being special) if( StrategicMap[ sStrategicSector ].bNameId != BLANK_SECTOR ) { @@ -5397,4 +5490,65 @@ BOOLEAN ScoutIsPresentInSquad( INT16 ubSectorNumX, INT16 ubSectorNumY ) } return ( fScoutPresent ); -} \ No newline at end of file +} + +#ifdef JA2UB +GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8 ubSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ) +{ + GROUP *pNew; + AssertMsg( uiSector >= 0 && uiSector <= 255, String( "CreateNewEnemyGroup with out of range value of %d", uiSector ) ); + pNew = (GROUP*)MemAlloc( sizeof( GROUP ) ); + AssertMsg( pNew, "MemAlloc failure during CreateNewEnemyGroup." ); + memset( pNew, 0, sizeof( GROUP ) ); + pNew->pEnemyGroup = (ENEMYGROUP*)MemAlloc( sizeof( ENEMYGROUP ) ); + AssertMsg( pNew->pEnemyGroup, "MemAlloc failure during enemy group creation." ); + memset( pNew->pEnemyGroup, 0, sizeof( ENEMYGROUP ) ); + pNew->pWaypoints = NULL; + pNew->ubSectorX = (UINT8)SECTORX( uiSector ); + pNew->ubSectorY = (UINT8)SECTORY( uiSector ); + pNew->ubSectorZ = ubSectorZ; + pNew->ubOriginalSector = (UINT8)uiSector; + pNew->fPlayer = FALSE; + pNew->ubMoveType = CIRCULAR; + pNew->ubNextWaypointID = 0; + pNew->ubFatigueLevel = 100; + pNew->ubRestAtFatigueLevel = 0; + pNew->pEnemyGroup->ubNumAdmins = ubNumAdmins; + pNew->pEnemyGroup->ubNumTroops = ubNumTroops; + pNew->pEnemyGroup->ubNumElites = ubNumElites; + pNew->ubGroupSize = (UINT8)(ubNumAdmins + ubNumTroops + ubNumElites); + pNew->ubTransportationMask = FOOT; + pNew->fVehicle = FALSE; + pNew->ubCreatedSectorID = pNew->ubOriginalSector; + pNew->ubSectorIDOfLastReassignment = 255; +/* +#ifdef JA2BETAVERSION + { + UINT16 str[ 512 ]; + //if( PlayerMercsInSector( pNew->ubSectorX, pNew->ubSectorY, pNew->ubSectorZ ) || CountAllMilitiaInSector( pNew->ubSectorX, pNew->ubSectorY ) ) + //{ + // swprintf( str, L"Attempting to send enemy troops from player occupied location. " + // L"Please ALT+TAB out of the game before doing anything else and send 'Strategic Decisions.txt' " + // L"and this message. You'll likely need to revert to a previous save. If you can reproduce this " + // L"with a save close to this event, that would really help me! -- KM:0" ); + // DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); + //} + if( pNew->ubGroupSize > 25 ) + { + swprintf( str, L"Strategic AI warning: Creating an enemy group containing %d soldiers " + L"(%d admins, %d troops, %d elites) in sector %c%d. This message is a temporary test message " + L"to evaluate a potential problems with very large enemy groups.", + pNew->ubGroupSize, ubNumAdmins, ubNumTroops, ubNumElites, + pNew->ubSectorY + 'A' - 1, pNew->ubSectorX ); + DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); + } + } +#endif +*/ + if( AddGroupToList( pNew ) ) + return pNew; + return NULL; +} + + +#endif diff --git a/Strategic/Strategic Movement.h b/Strategic/Strategic Movement.h index 2867881e..db00d846 100644 --- a/Strategic/Strategic Movement.h +++ b/Strategic/Strategic Movement.h @@ -179,6 +179,9 @@ BOOLEAN SetGroupPatrolParameters( UINT8 ubGroupID, UINT8 ubRestAtFL, UINT8 ubRes //Enemy grouping functions -- private use by the strategic AI. //............................................................ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); +#ifdef JA2UB +GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8 ubSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites ); +#endif //ARRIVALCALLBACK -- None of these functions should be called directly. //............... diff --git a/Strategic/Strategic Status.cpp b/Strategic/Strategic Status.cpp index 4de53c25..3d661bcd 100644 --- a/Strategic/Strategic Status.cpp +++ b/Strategic/Strategic Status.cpp @@ -208,10 +208,13 @@ void HandleEnricoEmail(void) UINT8 ubCurrentProgress = CurrentPlayerProgressPercentage(); UINT8 ubHighestProgress = HighestPlayerProgressPercentage(); +#ifdef JA2UB +//JA25 UB +#else // if creatures have attacked a mine (doesn't care if they're still there or not at the moment) if (HasAnyMineBeenAttackedByMonsters() && !(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_CREATURES)) { - AddEmail(ENRICO_CREATURES, ENRICO_CREATURES_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_CREATURES, ENRICO_CREATURES_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_CREATURES; return; // avoid any other E-mail at the same time } @@ -219,21 +222,21 @@ void HandleEnricoEmail(void) if ((ubCurrentProgress >= SOME_PROGRESS_THRESHOLD) && !(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_SOME_PROGRESS)) { - AddEmail(ENRICO_PROG_20, ENRICO_PROG_20_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_PROG_20, ENRICO_PROG_20_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_SOME_PROGRESS; return; // avoid any setback E-mail at the same time } if ((ubCurrentProgress >= ABOUT_HALFWAY_THRESHOLD) && !(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_ABOUT_HALFWAY)) { - AddEmail(ENRICO_PROG_55, ENRICO_PROG_55_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_PROG_55, ENRICO_PROG_55_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_ABOUT_HALFWAY; return; // avoid any setback E-mail at the same time } if ((ubCurrentProgress >= NEARLY_DONE_THRESHOLD) && !(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_NEARLY_DONE)) { - AddEmail(ENRICO_PROG_80, ENRICO_PROG_80_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_PROG_80, ENRICO_PROG_80_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_NEARLY_DONE; return; // avoid any setback E-mail at the same time } @@ -243,7 +246,7 @@ void HandleEnricoEmail(void) (((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && (gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_FLAG_SETBACK_OVER))) && !(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_MAJOR_SETBACK)) { - AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_MAJOR_SETBACK; } else @@ -251,7 +254,7 @@ void HandleEnricoEmail(void) if (((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && !(gStrategicStatus.usEnricoEmailFlags & (ENRICO_EMAIL_SENT_MINOR_SETBACK | ENRICO_EMAIL_SENT_MAJOR_SETBACK))) { - AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_MINOR_SETBACK; } else @@ -314,15 +317,15 @@ void HandleEnricoEmail(void) switch( bComplaint ) { case 3: - AddEmail(LACK_PLAYER_PROGRESS_3, LACK_PLAYER_PROGRESS_3_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(LACK_PLAYER_PROGRESS_3, LACK_PLAYER_PROGRESS_3_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_LACK_PROGRESS3; break; case 2: - AddEmail(LACK_PLAYER_PROGRESS_2, LACK_PLAYER_PROGRESS_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(LACK_PLAYER_PROGRESS_2, LACK_PLAYER_PROGRESS_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_LACK_PROGRESS2; break; default: - AddEmail(LACK_PLAYER_PROGRESS_1, LACK_PLAYER_PROGRESS_1_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1); + AddEmail(LACK_PLAYER_PROGRESS_1, LACK_PLAYER_PROGRESS_1_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_LACK_PROGRESS1; break; @@ -343,7 +346,7 @@ void HandleEnricoEmail(void) } } } - +#endif // reset # of new sectors visited 'today' // grant some leeway for the next day, could have started moving // at night... diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 8e4227fa..193e35d8 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -1840,7 +1840,11 @@ void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSec // set fact is has been lib'ed and set history event AddHistoryToPlayersLog( HISTORY_LIBERATED_TOWN, bTownId, GetWorldTotalMin(), sSectorX, sSectorY ); +#ifdef JA2UB +//Ja25: No meanhwiles +#else HandleMeanWhileEventPostingForTownLiberation( bTownId ); +#endif } // even taking over non-trainable "towns" like Orta/Tixa for the first time should count as "player activity" @@ -1869,11 +1873,16 @@ void CheckIfEntireTownHasBeenLost( INT8 bTownId, INT16 sSectorX, INT16 sSectorY // reported here (and they're the only ones you can protect) if ( MilitiaTrainingAllowedInSector( sSectorX, sSectorY, 0 ) && IsTownUnderCompleteControlByEnemy(bTownId) ) { + +#ifdef JA2UB +//Ja25 No meanwhile +#else // the whole town is under enemy control, check if we libed this town before if ( gTownLoyalty[ bTownId ].fLiberatedAlready ) { HandleMeanWhileEventPostingForTownLoss( bTownId ); } +#endif } } @@ -1919,12 +1928,14 @@ void HandleLoyaltyChangeForNPCAction( UINT8 ubNPCProfileId ) // NOTE: This affects Chitzena,too, a second time, so first value is discounted for it IncrementTownLoyaltyEverywhere( LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_GLOBAL ); break; - +#ifdef JA2UB +// ja25 UB +#else case AUNTIE: // Bloodcats killed IncrementTownLoyalty( ALMA, LOYALTY_BONUS_AUNTIE_WHEN_BLOODCATS_KILLED ); break; - +#endif case MATT: // Brother Dynamo freed IncrementTownLoyalty( ALMA, LOYALTY_BONUS_MATT_WHEN_DYNAMO_FREED ); diff --git a/Strategic/Strategic_VS2005.vcproj b/Strategic/Strategic_VS2005.vcproj index 3d3590c9..092f0ceb 100644 --- a/Strategic/Strategic_VS2005.vcproj +++ b/Strategic/Strategic_VS2005.vcproj @@ -378,6 +378,10 @@ RelativePath=".\Game Init.h" > + + @@ -414,6 +418,10 @@ RelativePath=".\Map Screen Interface.h" > + + @@ -576,6 +584,10 @@ RelativePath=".\Hourly Update.cpp" > + + @@ -612,6 +624,10 @@ RelativePath=".\Map Screen Interface.cpp" > + + diff --git a/Strategic/Strategic_VS2008.vcproj b/Strategic/Strategic_VS2008.vcproj index 5c8843d0..fdf1a739 100644 --- a/Strategic/Strategic_VS2008.vcproj +++ b/Strategic/Strategic_VS2008.vcproj @@ -379,6 +379,10 @@ RelativePath="Game Init.h" > + + @@ -415,6 +419,10 @@ RelativePath="Map Screen Interface.h" > + + @@ -575,6 +583,10 @@ RelativePath="Hourly Update.cpp" > + + @@ -611,6 +623,10 @@ RelativePath="Map Screen Interface.cpp" > + + diff --git a/Strategic/Strategic_VS2010.vcxproj b/Strategic/Strategic_VS2010.vcxproj index a5f528a5..9a237a7d 100644 --- a/Strategic/Strategic_VS2010.vcxproj +++ b/Strategic/Strategic_VS2010.vcxproj @@ -33,6 +33,7 @@ + @@ -42,6 +43,7 @@ + @@ -83,6 +85,7 @@ + @@ -92,6 +95,7 @@ + diff --git a/Strategic/Strategic_VS2010.vcxproj.filters b/Strategic/Strategic_VS2010.vcxproj.filters index 00b93da1..aece6dcc 100644 --- a/Strategic/Strategic_VS2010.vcxproj.filters +++ b/Strategic/Strategic_VS2010.vcxproj.filters @@ -150,6 +150,12 @@ Header Files + + Header Files + + + Header Files + @@ -323,5 +329,11 @@ Source Files + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index cbe3f88f..ea36e382 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -1519,7 +1519,11 @@ void HandleContinueOfTownTraining( void ) if( pSoldier->bActive ) { fContinueEventPosted = TRUE; +#ifdef JA2UB +//no UB +#else SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTINUE_TRAINING_MILITIA, pSoldier->ubProfile, 0, 0, 0, 0 ); +#endif // now set all of these peoples assignment done too //HandleInterfaceMessageForContinuingTrainingMilitia( pSoldier ); diff --git a/Strategic/UndergroundInit.cpp b/Strategic/UndergroundInit.cpp index b45bca95..dcbfec9d 100644 --- a/Strategic/UndergroundInit.cpp +++ b/Strategic/UndergroundInit.cpp @@ -55,7 +55,7 @@ BOOLEAN LuaUnderground::InitializeSectorList() { // WANNE: Skip initialization in a multiplayer game, because some variables are not yet set // No problem: Underground sectors are not currently used in a multiplayer game - if (!is_networked || gGameOptions.ubDifficultyLevel > 0) + if ( !is_networked || gGameOptions.ubDifficultyLevel > 0) { LuaState L = GetLuaState(); @@ -65,7 +65,7 @@ BOOLEAN LuaUnderground::InitializeSectorList() .TableOpen() .TParam("difficultyLevel", int(gGameOptions.ubDifficultyLevel)) .TParam("gameStyle", int(gGameOptions.ubGameStyle)) - .TableClose(); + .TableClose(); SGP_THROW_IFFALSE(initsectorlist_func.Call(1), "call to lua function BuildUndergroundSectorList failed"); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 1bf9863d..b31b1110 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -119,8 +119,21 @@ #include "connect.h" //hayden #include "fresh_header.h" #include "InterfaceItemImages.h" + +#ifdef JA2UB +#include "laptop.h" + +#include "Strategic Movement.h" + + +//#include "Strategic Movement Costs.h" // DEFINES +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "ub_config.h" +#include "LuaInitNPCs.h" +#endif #define MAX_SORT_METHODS 6 @@ -153,6 +166,10 @@ #define MINS_TO_FLASH_CONTRACT_TIME (4 * 60) +#ifdef JA2UB +void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ); // ja25 UB +#endif + // CHRISL: Reclassify all coordinates as int variables and declare their values in an initialization function. int TOWN_INFO_X; int TOWN_INFO_Y; @@ -1002,6 +1019,9 @@ extern INT32 GetNumberOfMercsInUpdateList( void ); extern INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier = TRUE ); void DeleteAllItemsInInventoryPool(); +#ifdef JA2UB +void HandleWhenPlayerHasNoMercsAndNoLaptop(); +#endif #ifdef JA2TESTVERSION void TestDumpStatChanges( void ); @@ -2760,7 +2780,8 @@ void DrawCharacterInfo(INT16 sCharNumber) if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle - wcscpy(sString, pShortVehicleStrings[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ]); +// wcscpy(sString, pShortVehicleStrings[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ]); + wcscpy(sString, gNewVehicle[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ].NewShortVehicleStrings); } else { @@ -2776,7 +2797,9 @@ void DrawCharacterInfo(INT16 sCharNumber) if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle - wcscpy(sString, pVehicleStrings[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ]); + //wcscpy(sString, pVehicleStrings[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ]); + wcscpy(sString, gNewVehicle[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ].NewVehicleStrings); + } else { @@ -2792,7 +2815,8 @@ void DrawCharacterInfo(INT16 sCharNumber) if( pSoldier->bAssignment == VEHICLE ) { // show vehicle type - wcscpy( sString, pShortVehicleStrings[ pVehicleList[ pSoldier->iVehicleId ].ubVehicleType ] ); + // wcscpy( sString, pShortVehicleStrings[ pVehicleList[ pSoldier->iVehicleId ].ubVehicleType ] ); + wcscpy( sString, gNewVehicle[ pVehicleList[ pSoldier->iVehicleId ].ubVehicleType ].NewShortVehicleStrings ); } else { @@ -2845,7 +2869,8 @@ void DrawCharacterInfo(INT16 sCharNumber) else if ( pSoldier->bVehicleUnderRepairID != -1 ) { // vehicle - wcscpy( sString, pShortVehicleStrings[ pVehicleList[ pSoldier->bVehicleUnderRepairID ].ubVehicleType ] ); + // wcscpy( sString, pShortVehicleStrings[ pVehicleList[ pSoldier->bVehicleUnderRepairID ].ubVehicleType ] ); + wcscpy( sString, gNewVehicle[ pVehicleList[ pSoldier->bVehicleUnderRepairID ].ubVehicleType ].NewShortVehicleStrings ); } else { @@ -4462,7 +4487,8 @@ UINT32 MapScreenHandle(void) VOBJECT_DESC VObjectDesc; // static BOOLEAN fSecondFrame = FALSE; INT32 iCounter = 0; - + INT32 iCounter2 = 0; + char fileName[500]; //DO NOT MOVE THIS FUNCTION CALL!!! @@ -4853,6 +4879,59 @@ UINT32 MapScreenHandle(void) VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\prison.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTIXAICON)); + + //----------- legion 2 + for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) + { + //if ( gfDrawHiddenTown[iCounter2] == TRUE ) + //{ + //VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + + /* + if (iResolution == 0) + { + strcpy(fileName, gHiddenIcon[iCounter2].IconSti); + strcat(fileName,".sti"); + } + if (iResolution == 1) + { + strcpy(fileName, gHiddenIcon[iCounter2].IconSti); + strcat(fileName,"_800x600.sti"); + } + if (iResolution == 2) + { + strcpy(fileName, gHiddenIcon[iCounter2].IconSti); + strcat(fileName,"_1024x768.sti"); + } + + if ( gfIconTown[iCounter2] == TRUE ) + strcpy(VObjectDesc.ImageFile, fileName); + else + FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + */ + + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + + if ( gfIconTown[iCounter2] == TRUE ) + { + strcpy(VObjectDesc.ImageFile, gHiddenIcon[iCounter2].IconSti); + } + else + { + FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + } + + if (!FileExists(VObjectDesc.ImageFile)) + { + FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + } + + + CHECKF(AddVideoObject(&VObjectDesc, &guiIcon2[iCounter2])); + //} + } + //------- VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\merc_between_sector_icons.sti", VObjectDesc.ImageFile); @@ -4880,6 +4959,7 @@ UINT32 MapScreenHandle(void) CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectors)); + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\secondary_gun_hidden.sti", VObjectDesc.ImageFile); CHECKF( AddVideoObject( &VObjectDesc, &guiSecItemHiddenVO ) ); @@ -4991,6 +5071,18 @@ UINT32 MapScreenHandle(void) { fFirstTimeInMapScreen = FALSE; // fShowMapScreenHelpText = TRUE; +#ifdef JA2UB + //JA25 UB + //Get Jerry Milo to say his opening quote, if he hasnt said it before + if( !HasJerryMiloSaidQuoteBefore( MILO_QUOTE__OPENING_GREETING_PART_1 ) ) + JerryMiloDelayedTalk( MILO_QUOTE__OPENING_GREETING_PART_1, 1100 ); + } + //Should Jerry popup a new quote now + else if( DidPlayerInitiallyHaveLessThen6MercsAndNowHaveExactly6AndHasntSaidFullLoadQuote() ) + { + //Get Jerry Milo to say his opening quote + JerryMiloDelayedTalk( MILO_QUOTE__ALREADY_HAS_6_MERCS, 500 ); +#endif } fShowMapInventoryPool = FALSE; @@ -5164,7 +5256,16 @@ UINT32 MapScreenHandle(void) return( MAP_SCREEN ); } } +#ifdef JA2UB + //Ja25 UB + if ( gfProcessCustomMaps ) + { + MakeBadSectorListFromMapsOnHardDrive( TRUE ); + LetLuaMakeBadSectorListFromMapsOnHardDrive( 0 ); + gfProcessCustomMaps = FALSE; + } +#endif // check to see if we need to rebuild the characterlist for map screen HandleRebuildingOfMapScreenCharacterList( ); @@ -5334,11 +5435,26 @@ UINT32 MapScreenHandle(void) InterruptTimeForMenus( ); +#ifdef JA2UB + //JA25 UB + //Handle Jerry Milo quotes + if ( gGameUBOptions.JerryQuotes == TRUE ) + HandleJerryMiloQuotes( FALSE ); +#endif + // place down background BlitBackgroundToSaveBuffer( ); if( fLeavingMapScreen == TRUE ) { + +#ifdef JA2UB + //JA25 UB + //specify that we are leaving mapscreen + if ( gGameUBOptions.JerryQuotes == TRUE ) + HandleJerryMiloQuotes( TRUE ); +#endif + return( MAP_SCREEN ); } @@ -5653,8 +5769,11 @@ UINT32 MapScreenHandle(void) RenderKeyRingPopup( FALSE ); } - CheckForMeanwhileOKStart( ); - +#ifdef JA2UB +/* UB */ +#else + CheckForMeanwhileOKStart( ); +#endif // save background rects // ATE: DO this BEFORE rendering help text.... SaveBackgroundRects( ); @@ -5767,6 +5886,15 @@ UINT32 MapScreenHandle(void) HandleExitsFromMapScreen( ); } +#ifdef JA2UB + //Ja25 ub + //Handle the strategic AI + JA25_HandleUpdateOfStrategicAi(); + + //Should the msg box come up telling the user that they lost? + if (gGameUBOptions.InGameHeliCrash == TRUE ) + HandleWhenPlayerHasNoMercsAndNoLaptop(); //AA +#endif return( MAP_SCREEN ); } @@ -6674,6 +6802,8 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) BOOLEAN fCtrl, fAlt; INT16 sMapX, sMapY; + + INT32 iCounter2 = 0; fCtrl = _KeyDown( CTRL ); fAlt = _KeyDown( ALT ); @@ -7344,7 +7474,15 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) CopySectorInventoryToInventoryPoolQ(0); break; } - RequestContractMenu(); + //Ja25 UB + //if ( fAlt ) + //{ + // MakeBadSectorListFromMapsOnHardDrive( TRUE ); + //} + //else + //{ + RequestContractMenu(); + //} break; case 'd': @@ -7518,7 +7656,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) if( fAlt ) { // set up the helicopter over Omerta (if it's not already set up) - SetUpHelicopterForPlayer( 9,1 , SKYRIDER ); + SetUpHelicopterForPlayer( 9,1 , SKYRIDER, HELICOPTER ); // raise Drassen loyalty to minimum that will allow Skyrider to fly if ( gTownLoyalty[ DRASSEN ].fStarted && ( gTownLoyalty[ DRASSEN ].ubRating < LOYALTY_LOW_THRESHOLD ) ) { @@ -7582,7 +7720,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) break; // haydent - case 'k': + case 'k': if(gGameExternalOptions.fEnableInventoryPoolQ && fShowMapInventoryPool == TRUE)//dnl ch51 081009 { CopySectorInventoryToInventoryPoolQs(0); @@ -7612,6 +7750,28 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) } break; case 'm': + //JA25 UB + // only handle border button keyboard equivalents if the button is visible! + /*if ( fAlt ) + { + INT16 sMapX, sMapY; + + // Get sector that is hilighted... + if ( GetMouseMapXY(&sMapX, &sMapY) ) + { + AddCustomMap( sMapY, sMapX, TRUE, TRUE ); + UpdateCustomMapMovementCosts(); + } + } + else + { + if ( !fShowMapInventoryPool ) + { + // toggle show mines flag + ToggleShowMinesMode(); + } + } + */ // only handle border button keyboard equivalents if the button is visible! if ( !fShowMapInventoryPool ) { @@ -7654,6 +7814,12 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) #ifdef JA2TESTVERSION fFoundOrta = !fFoundOrta; fFoundTixa = !fFoundTixa; + + for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) + { + gfHiddenTown [ iCounter2 ] = TRUE; + } + fMapPanelDirty = TRUE; #endif } @@ -8082,6 +8248,9 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) void EndMapScreen( BOOLEAN fDuringFade ) { + +INT32 iCounter2 = 0; + if ( fInMapMode == FALSE ) { // shouldn't be here @@ -8259,6 +8428,14 @@ void EndMapScreen( BOOLEAN fDuringFade ) DeleteVideoObjectFromIndex( guiHelicopterIcon ); DeleteVideoObjectFromIndex( guiMINEICON ); DeleteVideoObjectFromIndex( guiSectorLocatorGraphicID ); + + //----------- Legion 2 + for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) + { + //if ( gfDrawHiddenTown[iCounter2] == TRUE ) + DeleteVideoObjectFromIndex(guiIcon2[iCounter2]); + } + //------- DeleteVideoObjectFromIndex( guiBULLSEYE ); @@ -12897,6 +13074,8 @@ BOOLEAN AnyMercsLeavingRealSoon() void HandleRemovalOfPreLoadedMapGraphics( void ) { +INT32 iCounter2 = 0; + if( fPreLoadedMapGraphics == TRUE ) { DeleteMapBottomGraphics( ); @@ -12938,6 +13117,14 @@ void HandleRemovalOfPreLoadedMapGraphics( void ) DeleteVideoObjectFromIndex( guiNewMailIcons ); DeleteVideoObjectFromIndex( guiBULLSEYE ); + + //----------- Legion 2 + for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) + { + //if ( gfDrawHiddenTown[iCounter2] == TRUE ) + DeleteVideoObjectFromIndex(guiIcon2[iCounter2]); + } + //------- // remove the graphic for the militia pop up box @@ -13133,6 +13320,13 @@ void TellPlayerWhyHeCantCompressTime( void ) ScreenMsg( FONT_MCOLOR_RED, MSG_BETAVERSION, L"(BETA) If permanent, take screenshot now, send with *previous* save & describe what happened since."); #endif } +#ifdef JA2UB + else if( DoesPlayerHaveNoMercsHiredAndJerryHasntSaidQuoteYet() ) + { + JerryMiloTalk( MILO_QUOTE__PLAYER_HAS_NO_MERCS ); + DoMapMessageBox( MSG_BOX_BASIC_STYLE, pMapScreenJustStartedHelpText[ 0 ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); + } +#endif else if( gfAtLeastOneMercWasHired == FALSE ) { // no mercs hired, ever @@ -13181,6 +13375,15 @@ void TellPlayerWhyHeCantCompressTime( void ) { DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 55 ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); } +#ifdef JA2UB + //JA25 UB + else if( !WillJerryMiloAllowThePlayerToCompressTimeAtBeginingOfGame() ) + { + // TODO.RW: JA2UB + //Have jerry say why the player cant compress time + HaveJerrySayWhyPlayerCantTimeCompressAtBeginningOfGame(); + } +#endif // ARM: THIS TEST SHOULD BE THE LAST ONE, BECAUSE IT ACTUALLY RESULTS IN SOMETHING HAPPENING NOW. // KM: Except if we are in a creature lair and haven't loaded the sector yet (no battle yet) else if( gTacticalStatus.uiFlags & INCOMBAT || gTacticalStatus.fEnemyInSector ) @@ -14354,11 +14557,15 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA INT32 GetContractExpiryTime( SOLDIERTYPE *pSoldier ) { +#ifdef JA2UB +/* JA25 UB */ +#else if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) || ( pSoldier->ubProfile == SLAY ) ) { return ( pSoldier->iEndofContractTime ); } - else + else +#endif { // never - really high number return ( 999999 ); @@ -14947,7 +15154,7 @@ void DestinationPlottingCompleted( void ) void HandleMilitiaRedistributionClick( void ) { INT8 bTownId; - BOOLEAN fTownStillHidden; + //BOOLEAN fTownStillHidden; CHAR16 sString[ 128 ]; @@ -14955,9 +15162,12 @@ void HandleMilitiaRedistributionClick( void ) if ( iCurrentMapSectorZ == 0 ) { bTownId = GetTownIdForSector( sSelMapX, sSelMapY ); - fTownStillHidden = ( ( bTownId == TIXA ) && !fFoundTixa ) || ( ( bTownId == ORTA ) && !fFoundOrta ); - - if( ( bTownId != BLANK_SECTOR ) && !fTownStillHidden ) + //fTownStillHidden = ( ( bTownId == TIXA ) && !fFoundTixa ) || ( ( bTownId == ORTA ) && !fFoundOrta ); + + // fTownStillHidden = ( ( bTownId == TIXA ) && !gfHiddenTown[ TIXA ] ) || ( ( bTownId == ORTA ) && !gfHiddenTown[ ORTA ] ); + + // WANNE: if gfHiddenTown[townID] == TRUE, then it is not HIDDEN!!! + if( ( bTownId != BLANK_SECTOR ) && gfHiddenTown[ bTownId ] ) //&& !fTownStillHidden ) { if ( MilitiaTrainingAllowedInSector( sSelMapX, sSelMapY, ( INT8 )iCurrentMapSectorZ ) ) { @@ -15190,7 +15400,8 @@ void GetMapscreenMercAssignmentString( SOLDIERTYPE *pSoldier, CHAR16 sString[] ) { if ( pSoldier->bAssignment == VEHICLE ) { - wcscpy( sString, pShortVehicleStrings[ pVehicleList[ pSoldier->iVehicleId ].ubVehicleType ] ); + // wcscpy( sString, pShortVehicleStrings[ pVehicleList[ pSoldier->iVehicleId ].ubVehicleType ] ); + wcscpy( sString, gNewVehicle[ pVehicleList[ pSoldier->iVehicleId ].ubVehicleType ].NewShortVehicleStrings); } else { @@ -15304,8 +15515,12 @@ void GetMapscreenMercDepartureString( SOLDIERTYPE *pSoldier, CHAR16 sString[], U INT32 iDaysRemaining = 0; INT32 iHoursRemaining = 0; - +#ifdef JA2UB +//Ja25: Removed the aim merc check because aim mercs are hired for a 1 time fee + if( ( pSoldier->ubProfile != SLAY ) || pSoldier->stats.bLife == 0 ) +#else if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC && pSoldier->ubProfile != SLAY ) || pSoldier->stats.bLife == 0 ) +#endif { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } @@ -15817,3 +16032,24 @@ INT32 GetTotalContractExpenses ( void ) } return (iTotalCost); } + +#ifdef JA2UB +void HandleWhenPlayerHasNoMercsAndNoLaptop() +{ + const UINT8 ubNumLoopsToDisplay=50; + + if( gJa25SaveStruct.ubDisplayPlayerLostMsgBox == 0 || + gJa25SaveStruct.ubDisplayPlayerLostMsgBox >= ubNumLoopsToDisplay || + guiCurrentScreen == MSG_BOX_SCREEN ) + { + return; + } + + gJa25SaveStruct.ubDisplayPlayerLostMsgBox += 1; + + if( gJa25SaveStruct.ubDisplayPlayerLostMsgBox == ubNumLoopsToDisplay ) + { + DoMapMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__PLAYER_LOST_SHOULD_RESTART ], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + } +} +#endif diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index f3b2cd49..0daae333 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -106,12 +106,33 @@ #include "cursors.h" #endif +#include "LuaInitNPCs.h" +#include "Luaglobal.h" + +#ifdef JA2UB +#include "SaveLoadGame.h" +#include "email.h" +#include "Ja25 Strategic Ai.h" +#include "Merc Hiring.h" +#include "Ja25_Tactical.h" +#include "Timer Control.h" +#include "Soldier Control.h" +#include "Ja25Update.h" +#include "Map Screen Interface Bottom.h" +#include "Strategic AI.h" +#include "ub_config.h" +#include "Luaglobal.h" +#endif + #include "connect.h" //hayden added alot ""'s to get around client spawing random/different placed AI #include "SaveLoadGame.h" #include "Strategic Mines.h" #include "Strategic Mines LUA.h" #include "UndergroundInit.h" +#include "LuaInitNPCs.h" +#include "Luaglobal.h" + #include "sgp_logger.h" //forward declarations of common classes to eliminate includes @@ -316,6 +337,29 @@ void DoneFadeOutExitGridSector( void ); INT32 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ); INT32 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UINT32 *puiNumAttempts ); + +//JA25UB +#ifdef JA2UB +void HandleQuestCodeOnSectorExit( INT16 sOldSectorX, INT16 sOldSectorY, INT8 bOldSectorZ ); +void HandlePotentialMoraleHitForSkimmingSectors( GROUP *pGroup ); +void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); +void ShouldNpcBeAddedToSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); +void HandlePlayerQuotesWhenEnteringFirstTunnelSector(); +void AddExitGridForFanToPowerGenSector(); +void HandleSectorSpecificUnLoadingOfMap( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); +//void MakeAllTeamMembersCrouchedThenStand(); +void HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap(); +void HandleFortifiedDoor(); +void CreateAndAddMoneyObjectToGround( UINT32 sGridNo, INT32 iEasyAmount, INT32 iNormalAmount, INT32 iHardAmount ); +void HandleGoingUpOrDownStairsForLoadScreensPurposes( INT16 sCurrentlyInSectorZ, INT16 sGoingToSectorZ ); +void HandleMovingEnemiesCloseToEntranceInFirstTunnelMap(); +void HandleMovingEnemiesCloseToEntranceInSecondTunnelMap(); +void HandleFirstPartOfTunnelFanSound(); +void HandlePowerGenFanSoundModification(); +BOOLEAN MoveEnemyFromGridNoToRoofGridNo( UINT32 sSourceGridNo, UINT32 sDestGridNo ); +void HandleMovingEnemiesOntoRoofs(); +#endif + void HandleQuestCodeOnSectorExit( INT16 sOldSectorX, INT16 sOldSectorY, INT8 bOldSectorZ ); void HandlePotentialMoraleHitForSkimmingSectors( GROUP *pGroup ); @@ -780,6 +824,12 @@ INT8 NUM_TOWNS; extern UINT8 gubTownRebelSentiment [ MAX_TOWNS ]; extern BOOLEAN gfTownUsesLoyalty [ MAX_TOWNS ]; extern BOOLEAN gfMilitiaAllowedInTown [ MAX_TOWNS ]; +BOOLEAN gfHiddenTown [ MAX_TOWNS ]; // Info: Visible town are TRUE, hidden towns are FALSE +BOOLEAN gfDrawHiddenTown [ MAX_TOWNS ]; +BOOLEAN gfDrawHiddenTownTemp [ MAX_TOWNS ]; +BOOLEAN gfHiddenTownTemp [ MAX_TOWNS ]; +BOOLEAN gfIconTown [ MAX_TOWNS ]; +BOOLEAN gfIconTownTemp [ MAX_TOWNS ]; #define INVALID_TOWN_INDEX -1 @@ -801,7 +851,14 @@ typedef enum CITYTABLE_ELEMENT_TOWNPOINT_Y, CITYTABLE_ELEMENT_USES_LOYALTY, CITYTABLE_ELEMENT_REBEL_SENTIMENT, - CITYTABLE_ELEMENT_MILITIA + CITYTABLE_ELEMENT_MILITIA, + CITYTABLE_ELEMENT_HIDDENTOWN, + CITYTABLE_ELEMENT_ICONTOWN, + CITYTABLE_ELEMENT_ICONFILE, + CITYTABLE_ELEMENT_ICON_POSITION, + CITYTABLE_ELEMENT_ICON_POSITION_X, + CITYTABLE_ELEMENT_ICON_POSITION_Y + } CITYTABLE_PARSE_STAGE; typedef struct @@ -814,6 +871,11 @@ typedef struct UINT8 townRebelSentiment; BOOLEAN townMilitiaAllowed; CHAR8 cityName[MAX_TOWN_NAME_LENGHT]; + BOOLEAN HiddenTown; + BOOLEAN TownIcon; + CHAR8 IconSTI[MAX_ICON_CHARS]; + UINT8 ubPosIconX; + UINT8 ubPosIconY; } cityInfo; typedef struct @@ -879,6 +941,25 @@ citytableStartElementHandle(void *userData, const XML_Char *name, const XML_Char memset(gfTownUsesLoyalty,0,sizeof(gfTownUsesLoyalty)); memset(gubTownRebelSentiment,0,sizeof(gubTownRebelSentiment)); memset(gfMilitiaAllowedInTown,0,sizeof(gfMilitiaAllowedInTown)); + memset(gfHiddenTown,0,sizeof(gfHiddenTown)); + memset(gfHiddenTownTemp,0,sizeof(gfHiddenTownTemp)); + memset(gfIconTown,0,sizeof(gfIconTown)); + memset(gfIconTownTemp,0,sizeof(gfIconTownTemp)); + memset(gfDrawHiddenTown,0,sizeof(gfDrawHiddenTown)); + memset(gfDrawHiddenTownTemp,0,sizeof(gfDrawHiddenTownTemp)); + + strncpy(gHiddenIcon[pData->curCityInfo.uiIndex].IconSti, pData->curCityInfo.IconSTI,MAX_ICON_CHARS); + + //if ( pData->curCityInfo.ubPosIconX < 0 ) + // gHiddenIcon[pData->curCityInfo.uiIndex].IconX = 0; + //else + gHiddenIcon[pData->curCityInfo.uiIndex].IconX = pData->curCityInfo.ubPosIconX; + + //if ( pData->curCityInfo.ubPosIconY < 0 ) + // gHiddenIcon[pData->curCityInfo.uiIndex].IconY = 0; + //else + gHiddenIcon[pData->curCityInfo.uiIndex].IconY = pData->curCityInfo.ubPosIconY; + } pData->maxReadDepth++; //we are not skipping this element @@ -917,6 +998,38 @@ citytableStartElementHandle(void *userData, const XML_Char *name, const XML_Char pData->curElement = CITYTABLE_ELEMENT_MILITIA; pData->maxReadDepth++; //we are not skipping this element } + else if(strcmp(name, "hiddenTown") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) + { + pData->curElement = CITYTABLE_ELEMENT_HIDDENTOWN; + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "townIcon") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) + { + pData->curElement = CITYTABLE_ELEMENT_ICONTOWN; + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "szIconFile") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) + { + pData->curElement = CITYTABLE_ELEMENT_ICONFILE; + pData->maxReadDepth++; //we are not skipping this element + } + + else if(strcmp(name, "iconPosition") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) + { + pData->curElement = CITYTABLE_ELEMENT_ICON_POSITION; + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "x") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICON_POSITION) + { + pData->curElement = CITYTABLE_ELEMENT_ICON_POSITION_X; + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "y") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICON_POSITION) + { + pData->curElement = CITYTABLE_ELEMENT_ICON_POSITION_Y; + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) { pData->curElement = CITYTABLE_ELEMENT_BASESECTOR; @@ -968,6 +1081,9 @@ citytableCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL citytableEndElementHandle(void *userData, const XML_Char *name) { + +char temp; + citytableParseData * pData = (citytableParseData *) userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -1018,6 +1134,34 @@ citytableEndElementHandle(void *userData, const XML_Char *name) gfMilitiaAllowedInTown[pData->curCityInfo.uiIndex ] = pData->curCityInfo.townMilitiaAllowed; //mbstowcs( pTownNames[pData->curCityInfo.uiIndex], pData->curCityInfo.cityName, MAX_TOWN_NAME_LENGHT); MultiByteToWideChar( CP_UTF8, 0, pData->curCityInfo.cityName, -1, pTownNames[pData->curCityInfo.uiIndex], MAX_TOWN_NAME_LENGHT); + + strncpy(gHiddenIcon[pData->curCityInfo.uiIndex].IconSti, pData->curCityInfo.IconSTI,MAX_ICON_CHARS); + + //if ( pData->curCityInfo.ubPosIconX < 0 ) + // gHiddenIcon[pData->curCityInfo.uiIndex].IconX = 0; + //else + gHiddenIcon[pData->curCityInfo.uiIndex].IconX = pData->curCityInfo.ubPosIconX; + + //if ( pData->curCityInfo.ubPosIconY < 0 ) + // gHiddenIcon[pData->curCityInfo.uiIndex].IconY = 0; + //else + gHiddenIcon[pData->curCityInfo.uiIndex].IconY = pData->curCityInfo.ubPosIconY; + + if ( pData->curCityInfo.HiddenTown == FALSE ) + { + gfHiddenTown[pData->curCityInfo.uiIndex] = TRUE; + gfHiddenTownTemp[pData->curCityInfo.uiIndex] = gfHiddenTown[pData->curCityInfo.uiIndex]; + gfDrawHiddenTown[pData->curCityInfo.uiIndex] = FALSE; + } + else + { + gfHiddenTown[pData->curCityInfo.uiIndex] = FALSE; + gfHiddenTownTemp[pData->curCityInfo.uiIndex] = gfHiddenTown[pData->curCityInfo.uiIndex]; + gfDrawHiddenTown[pData->curCityInfo.uiIndex] = FALSE; + } + + gfIconTown[pData->curCityInfo.uiIndex] = pData->curCityInfo.TownIcon; + gfIconTownTemp[pData->curCityInfo.uiIndex] = gfIconTown[pData->curCityInfo.uiIndex]; } else if ( pData->curCityInfo.uiIndex != INVALID_TOWN_INDEX && localizedMapTextOnly) { @@ -1069,6 +1213,55 @@ citytableEndElementHandle(void *userData, const XML_Char *name) pData->curCityInfo.townMilitiaAllowed = (BOOLEAN)atol(pData->szCharData); } + else if(strcmp(name, "hiddenTown") == 0 && pData->curElement == CITYTABLE_ELEMENT_HIDDENTOWN) + { + pData->curElement = CITYTABLE_ELEMENT_CITY; + + pData->curCityInfo.HiddenTown = (BOOLEAN)atol(pData->szCharData); + } + else if(strcmp(name, "townIcon") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICONTOWN) + { + pData->curElement = CITYTABLE_ELEMENT_CITY; + + pData->curCityInfo.TownIcon = (INT32)atol(pData->szCharData); + } + else if(strcmp(name, "szIconFile") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICONFILE) + { + + pData->curElement = CITYTABLE_ELEMENT_CITY; + + if(MAX_ICON_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curCityInfo.IconSTI,pData->szCharData); + else + { + strncpy(pData->curCityInfo.IconSTI,pData->szCharData,MAX_ICON_CHARS); + pData->curCityInfo.IconSTI[MAX_ICON_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_ICON_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curCityInfo.IconSTI[i] = temp; + } + } + + else if(strcmp(name, "iconPosition") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICON_POSITION) + { + pData->curElement = CITYTABLE_ELEMENT_CITY; + } + else if(strcmp(name, "x") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICON_POSITION_X) + { + pData->curElement = CITYTABLE_ELEMENT_ICON_POSITION; + + pData->curCityInfo.ubPosIconX = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "y") == 0 && pData->curElement == CITYTABLE_ELEMENT_ICON_POSITION_Y) + { + pData->curElement = CITYTABLE_ELEMENT_ICON_POSITION; + + pData->curCityInfo.ubPosIconY = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_BASESECTOR) { pData->curElement = CITYTABLE_ELEMENT_CITY; @@ -1136,6 +1329,13 @@ BOOLEAN WriteInStrategicMapSectorTownNames(STR fileName) FilePrintf(hFile,"\t\t\t%d\r\n", gubTownRebelSentiment[cnt] ); FilePrintf(hFile,"\t\t\t%d\r\n", gfMilitiaAllowedInTown[cnt] ); + + if ( gfHiddenTown[cnt] == TRUE) + FilePrintf(hFile,"\t\t\t%d\r\n", 0 ); + else + FilePrintf(hFile,"\t\t\t%d\r\n", 1 ); + + FilePrintf(hFile,"\t\t\t%d\r\n", gfIconTown[cnt] ); FilePrintf(hFile,"\t\t\t\r\n"); FilePrintf(hFile,"\t\t\t\t%d\r\n",(sBaseSectorList[cnt-1]%16)+1); @@ -1283,7 +1483,12 @@ void BeginLoadScreen( void ) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); +#ifdef JA2UB + if( guiCurrentScreen == MAP_SCREEN && !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME) ) +#else +//Ja25: No meanwhiles if( guiCurrentScreen == MAP_SCREEN && !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && !AreInMeanwhile() ) +#endif { if (!gGameExternalOptions.fDisableStrategicTransition) { @@ -1332,6 +1537,15 @@ void BeginLoadScreen( void ) InvalidateScreen( ); RefreshScreen( NULL ); +#ifdef JA2UB + //if we are going to the intro screen, return before putting up a loadscreen + if( gbExitingMapScreenToWhere == MAP_EXIT_TO_INTRO_SCREEN ) + { + SetPendingNewScreen( INTRO_SCREEN ); + return; + } +#endif + //If we are loading a saved game, use the Loading screen we saved into the SavedGameHeader file // ( which gets reloaded into gubLastLoadingScreenID ) if( !gfGotoSectorTransition ) @@ -1689,6 +1903,9 @@ void GetMapFileName(INT16 sMapX,INT16 sMapY, INT8 bSectorZ, STR8 bString, BOOLEA } } +#ifdef JA2UB +/* Ja25: No meanwhiles */ +#else // If we are in a meanwhile... if ( AreInMeanwhile( ) && sMapX == 3 && sMapY == 16 && !bSectorZ )//GetMeanwhileID() != INTERROGATION ) { @@ -1697,6 +1914,7 @@ void GetMapFileName(INT16 sMapX,INT16 sMapY, INT8 bSectorZ, STR8 bString, BOOLEA strcat( bExtensionString, "_m" ); } } +#endif // This is the string to return, but... sprintf( bString, "%s%s%s.DAT", pVertStrings[sMapY], pHortStrings[sMapX], bExtensionString ); @@ -1808,8 +2026,11 @@ void HandleRPCDescriptionOfSector( INT16 sSectorX, INT16 sSectorY, INT16 sSector } // Handle guide description ( will be needed if a SAM one ) +#ifdef JA2UB +//UB +#else HandleRPCDescription( ); - +#endif } @@ -1946,10 +2167,14 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { StopAnyCurrentlyTalkingSpeech( ); +#ifdef JA2UB +/* Ja25 no creatures */ +#else if( gWorldSectorX == 9 && gWorldSectorY == 10 && gbWorldSectorZ == 2 ) { InitCreatureQuest(); //Ignored if already active. } +#endif } //Stop playing any music -- will fade out. @@ -2008,6 +2233,10 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // Check for helicopter being on the ground in this sector... HandleHelicopterOnGroundSkyriderProfile( ); +#ifdef JA2UB + //Check to see if we should add Manuel to this sector, if so add him + ShouldNpcBeAddedToSector( gWorldSectorX, gWorldSectorY, bMapZ ); +#endif } //Load and enter the new sector @@ -2054,14 +2283,23 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) SetMusicMode( MUSIC_TACTICAL_NOTHING ); } - + + #ifdef JA2UB + // Say a quote from a merc who has new lines for the sector ( if any ) + HandlePlayerTeamQuotesWhenEnteringSector( sMapX, sMapY, bMapZ ); + #else // ATE: Check what sector we are in, to show description if we have an RPC..... HandleRPCDescriptionOfSector( sMapX, sMapY, bMapZ ); - + #endif // ATE: Set Flag for being visited... SetSectorFlag( sMapX, sMapY, bMapZ, SF_HAS_ENTERED_TACTICAL ); +#ifdef JA2UB + //ja2ub + // If any emails should be sent from this sector + HandleEmailBeingSentWhenEnteringSector( sMapX, sMapY, bMapZ, FALSE ); +#endif // ATE; Reset some flags for creature sayings.... gTacticalStatus.fSaidCreatureFlavourQuote = FALSE; @@ -2074,7 +2312,10 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) gTacticalStatus.fGoodToAllowCrows = FALSE; gTacticalStatus.fHasEnteredCombatModeSinceEntering = FALSE; gTacticalStatus.fDontAddNewCrows = FALSE; - +#ifdef JA2UB + //Call this function, if Jerry doesnt need to be added, it will return + UpdateJerryMiloInInitialSector(); +#endif // Adjust delay for tense quote gTacticalStatus.sCreatureTenseQuoteDelay = (INT16)( 10 + Random( 20 ) ); @@ -2145,8 +2386,11 @@ void PrepareLoadedSector() BOOLEAN fEnemyPresenceInThisSector = FALSE; BOOLEAN fAddCivs = TRUE; INT8 bMineIndex = -1; - +#ifdef JA2UB +//Ja25 No meanwhiles +#else if( AreInMeanwhile( ) == FALSE ) +#endif { if( gbWorldSectorZ == 0 ) { @@ -2170,7 +2414,12 @@ void PrepareLoadedSector() //if we are loading a 'pristine' map ( ie, not loading a saved game ) if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME )) { + +#ifdef JA2UB +//Ja25 No meanwhiles +#else if ( !AreReloadingFromMeanwhile( ) ) +#endif { SetPendingNewScreen(GAME_SCREEN); @@ -2291,8 +2540,11 @@ void PrepareLoadedSector() { AddProfilesNotUsingProfileInsertionData(); } - +#ifdef JA2UB +//Ja25 No meanwhiles +#else if( !AreInMeanwhile() || GetMeanwhileID() == INTERROGATION ) +#endif { if (is_networked) { @@ -2360,6 +2612,13 @@ void PrepareLoadedSector() ScreenMsg( FONT_YELLOW, MSG_DEBUG, L"Current Time is: %d", GetWorldTotalMin() ); +#ifdef JA2UB + HandleSectorSpecificModificatioToMap( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE ); + + //If there needs to be modifications done to the enemy exp levels... + HandleJa25EnemyExpLevelModifier( ); +#endif + AllTeamsLookForAll( TRUE ); } @@ -2372,17 +2631,6 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN UINT8 cnt; SOLDIERTYPE * pSoldier; - if ( CheckFact( FACT_ALL_TERRORISTS_KILLED, 0 ) ) - { - // end terrorist quest - // SANDRO - removed ending quest from here, placed to Interface Dialogue - //EndQuest( QUEST_KILL_TERRORISTS, gMercProfiles[ CARMEN ].sSectorX, gMercProfiles[ CARMEN ].sSectorY ); - // remove Carmen - gMercProfiles[ CARMEN ].sSectorX = 0; - gMercProfiles[ CARMEN ].sSectorY = 0; - gMercProfiles[ CARMEN ].bSectorZ = 0; - } - // are we in a mine sector, on the surface? if ( IsThereAMineInThisSector( sNewSectorX, sNewSectorY ) && ( bNewSectorZ == 0 )) { @@ -2451,18 +2699,16 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN #endif } } - - if ( CheckFact( FACT_ROBOT_RECRUITED_AND_MOVED, 0 ) == FALSE ) + + if ( CheckFact( FACT_ALL_TERRORISTS_KILLED, 0 ) ) { - SOLDIERTYPE * pRobot; - pRobot = FindSoldierByProfileID( ROBOT, TRUE ); - if (pRobot) - { - // robot is on our team and we have changed sectors, so we can - // replace the robot-under-construction in Madlab's sector - RemoveGraphicFromTempFile( gsRobotGridNo, SEVENTHISTRUCT1, gMercProfiles[MADLAB].sSectorX, gMercProfiles[MADLAB].sSectorY, gMercProfiles[MADLAB].bSectorZ ); - SetFactTrue( FACT_ROBOT_RECRUITED_AND_MOVED ); - } + // end terrorist quest + // SANDRO - removed ending quest from here, placed to Interface Dialogue + //EndQuest( QUEST_KILL_TERRORISTS, gMercProfiles[ CARMEN ].sSectorX, gMercProfiles[ CARMEN ].sSectorY ); + // remove Carmen + gMercProfiles[ CARMEN ].sSectorX = 0; + gMercProfiles[ CARMEN ].sSectorY = 0; + gMercProfiles[ CARMEN ].bSectorZ = 0; } // Check to see if any player merc has the Chalice; if so, @@ -2479,11 +2725,30 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN } } } - + if ( (gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS) && CheckFact( FACT_KINGPIN_CAN_SEND_ASSASSINS, 0 ) && (GetTownIdForSector( sNewSectorX, sNewSectorY ) != BLANK_SECTOR) && Random( 10 + GetNumberOfMilitiaInSector( sNewSectorX, sNewSectorY, bNewSectorZ ) ) < 3 ) { DecideOnAssassin(); } + + if ( CheckFact( FACT_ROBOT_RECRUITED_AND_MOVED, 0 ) == FALSE ) + { + SOLDIERTYPE * pRobot; + pRobot = FindSoldierByProfileID( ROBOT, TRUE ); + if (pRobot) + { + // robot is on our team and we have changed sectors, so we can + // replace the robot-under-construction in Madlab's sector + RemoveGraphicFromTempFile( gsRobotGridNo, SEVENTHISTRUCT1, gMercProfiles[MADLAB].sSectorX, gMercProfiles[MADLAB].sSectorY, gMercProfiles[MADLAB].bSectorZ ); + SetFactTrue( FACT_ROBOT_RECRUITED_AND_MOVED ); + } + } + + #ifdef LUA_HANDLE_QUEST_CODE_ON_SECTOR + + LuaHandleQuestCodeOnSector( sNewSectorX, sNewSectorY, bNewSectorZ, 1); + + #else /* if ( sNewSectorX == 5 && sNewSectorY == MAP_ROW_C ) @@ -2518,12 +2783,25 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN gMercProfiles[ ELLIOT ].bLife = gMercProfiles[ ELLIOT ].bLifeMax; } } - + + #endif + ResetOncePerConvoRecordsForAllNPCsInLoadedSector(); } void HandleQuestCodeOnSectorExit( INT16 sOldSectorX, INT16 sOldSectorY, INT8 bOldSectorZ ) { + +#ifdef JA2UB +SOLDIERTYPE *pSoldier=NULL; +#endif + + #ifdef LUA_HANDLE_QUEST_CODE_ON_SECTOR + + LuaHandleQuestCodeOnSector( sOldSectorX, sOldSectorY, bOldSectorZ, 0); + + #else + if ( sOldSectorX == KINGPIN_MONEY_SECTOR_X && sOldSectorY == KINGPIN_MONEY_SECTOR_Y && bOldSectorZ == KINGPIN_MONEY_SECTOR_Z ) { CheckForKingpinsMoneyMissing( TRUE ); @@ -2535,7 +2813,57 @@ void HandleQuestCodeOnSectorExit( INT16 sOldSectorX, INT16 sOldSectorY, INT8 bOl gMercProfiles[ CONRAD ].sSectorX = 0; gMercProfiles[ CONRAD ].sSectorY = 0; } +#ifdef JA2UB + //JA25 UB + if( sOldSectorX == 7 && sOldSectorY == MAP_ROW_H && bOldSectorZ == 0 ) + { + // remove Jerry from the map + gMercProfiles[ 76 ].sSectorX = 0; + gMercProfiles[ 76 ].sSectorY = 0; + } + //if the player is leaving a sector with Tex in it + if( sOldSectorX == gMercProfiles[ 64 ].sSectorX && sOldSectorY == gMercProfiles[ 64 ].sSectorY && bOldSectorZ == 0 && gMercProfiles[ 64 ].ubLastDateSpokenTo != 0 ) + { + pSoldier = FindSoldierByProfileID( 64, TRUE ); + + //if the npc isnt on the players team AND the player has never spoken to them + if( pSoldier == NULL && gMercProfiles[ 64 ].ubLastDateSpokenTo != 0 ) + { + // remove Tex from the map + gMercProfiles[ 64 ].sSectorX = 0; + gMercProfiles[ 64 ].sSectorY = 0; + } + } + + //if the player is leaving a sector with John kulba in it + if( sOldSectorX == gMercProfiles[ 62 ].sSectorX && sOldSectorY == gMercProfiles[ 62 ].sSectorY && bOldSectorZ == 0 && gMercProfiles[ 62 ].ubLastDateSpokenTo != 0 ) + { + pSoldier = FindSoldierByProfileID( 62, TRUE ); + + //if the npc isnt on the players team AND the player has never spoken to them + if( pSoldier == NULL && gMercProfiles[ 62 ].ubLastDateSpokenTo != 0 ) + { + // remove Tex from the map + gMercProfiles[ 62 ].sSectorX = 0; + gMercProfiles[ 62 ].sSectorY = 0; + } + } + + //if the player is leaving a sector with Manuel in it + if( sOldSectorX == gMercProfiles[ 60 ].sSectorX && sOldSectorY == gMercProfiles[ 60 ].sSectorY && bOldSectorZ == 0 ) + { + pSoldier = FindSoldierByProfileID( 60, TRUE ); + + //if the npc isnt on the players team AND the player has never spoken to them + if( pSoldier == NULL && gMercProfiles[ 60 ].ubLastDateSpokenTo != 0 ) + { + // remove Manuel from the map + gMercProfiles[ 60 ].sSectorX = 0; + gMercProfiles[ 60 ].sSectorY = 0; + } + } +#endif if ( sOldSectorX == HOSPITAL_SECTOR_X && sOldSectorY == HOSPITAL_SECTOR_Y && bOldSectorZ == HOSPITAL_SECTOR_Z ) { CheckForMissingHospitalSupplies(); @@ -2543,6 +2871,8 @@ void HandleQuestCodeOnSectorExit( INT16 sOldSectorX, INT16 sOldSectorY, INT8 bOl // reset the state of the museum alarm for Eldin's quotes SetFactFalse( FACT_MUSEUM_ALARM_WENT_OFF ); + + #endif } BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ ) @@ -2588,7 +2918,11 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ ) memset( &(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS ); } +#ifdef JA2UB +//Ja25 No meanwhiles +#else if( AreInMeanwhile() == FALSE ) +#endif { SetSectorFlag( sSectorX, sSectorY, bSectorZ, SF_ALREADY_VISITED ); } @@ -2942,10 +3276,17 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, } else { + #ifdef JA2UB + //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + //pSoldier->sInsertionGridNo = gMapInformation.sNorthGridNo; + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + pSoldier->sInsertionGridNo = gGameUBOptions.LOCATEGRIDNO; + #else //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH; //pSoldier->sInsertionGridNo = gMapInformation.sNorthGridNo; pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->sInsertionGridNo = gGameExternalOptions.iInitialMercArrivalLocation; + #endif } break; case INSERTION_CODE_CHOPPER: @@ -3312,13 +3653,15 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS wcscat( zString, pTownNames[ CAMBRIA ] ); break; case SEC_J9: //Tixa - if( !fFoundTixa ) + //if( !fFoundTixa ) + if( gfHiddenTown[ TIXA ] == FALSE ) wcscat( zString, pLandTypeStrings[ SAND ] ); else wcscat( zString, pTownNames[ TIXA ] ); break; case SEC_K4: //Orta - if( !fFoundOrta ) + //if( !fFoundOrta ) + if( gfHiddenTown[ ORTA ] == FALSE ) wcscat( zString, pLandTypeStrings[ SWAMP ] ); else wcscat( zString, pTownNames[ ORTA ] ); @@ -4538,6 +4881,13 @@ void SetupNewStrategicGame( ) StrategicMap[ CALCULATE_STRATEGIC_INDEX( sSectorX, sSectorY ) ].fEnemyControlled = TRUE; } } + +#ifdef JA2UB + //Ja25 + // Make the initial sector free of enemies + StrategicMap[ CALCULATE_STRATEGIC_INDEX( JA2_5_START_SECTOR_X, JA2_5_START_SECTOR_Y ) ].fEnemyControlled = FALSE; + +#endif //Initialize the game time InitNewGameClock(); @@ -4555,6 +4905,12 @@ void SetupNewStrategicGame( ) AddEveryDayStrategicEvent( EVENT_DAILY_UPDATE_BOBBY_RAY_INVENTORY, BOBBYRAY_UPDATE_TIME, 0 ); //Daily Update of the M.E.R.C. site. AddEveryDayStrategicEvent( EVENT_DAILY_UPDATE_OF_MERC_SITE, 0, 0 ); + +#ifdef JA2UB +//Ja25: No insurance for mercs +//JA25: There is no mines +//Ja25 no town opinions +#else //Daily update of insured mercs AddEveryDayStrategicEvent( EVENT_HANDLE_INSURED_MERCS, INSURANCE_UPDATE_TIME, 0 ); //Daily update of mercs @@ -4565,6 +4921,8 @@ void SetupNewStrategicGame( ) AddEveryDayStrategicEvent( EVENT_SETUP_TOWN_OPINION, 0, 0 ); // Daily checks for E-mail from Enrico AddEveryDayStrategicEvent( EVENT_ENRICO_MAIL, ENRICO_MAIL_TIME , 0 ); +#endif + // if ( gGameOptions.fAirStrikes ) // { @@ -5654,7 +6012,9 @@ void GetLoadedSectorString( STR16 pString ) } } - +#ifdef JA2UB +// no UB +#else void HandleSlayDailyEvent( void ) { SOLDIERTYPE *pSoldier = NULL; @@ -5683,6 +6043,7 @@ void HandleSlayDailyEvent( void ) TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING_NO_ASK_EQUIP, 0, 0 ); } } +#endif BOOLEAN IsSectorDesert( INT16 sSectorX, INT16 sSectorY ) { @@ -6124,3 +6485,897 @@ BOOLEAN EscapeDirectionIsValid( INT8 * pbDirection ) } return( *pbDirection != -1 ); } +#ifdef JA2UB + + +//------------ub + +typedef struct +{ + INT16 sSectorID; + INT8 bSectorZ; + UINT8 ubQuoteNum; +} ENTER_SECTOR_PLAYER_QUOTE; + +void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) +{ + UINT32 uiCnt; + INT8 bNumValidMercs=-1; + INT32 iSectorID = SECTOR( sSectorX, sSectorY ); + UINT8 ubValidMercProfileIDArray[ NUM_MERCS_WITH_NEW_QUOTES ]; + SOLDIERTYPE *pSoldier=NULL; + + + #define NUM_VALID_SECTORS 6 + #define DELAY_FOR_PLAYER_DESC_OF_SECTOR 2 + ENTER_SECTOR_PLAYER_QUOTE PlayerSectorDescQuote[ NUM_VALID_SECTORS ] = + { + { SEC_H9, 0, QUOTE_HATE_MERC_1_ON_TEAM }, + { SEC_I9, 0, QUOTE_LEARNED_TO_HATE_MERC_ON_TEAM }, + { SEC_H10, 0, QUOTE_LEARNED_TO_HATE_MERC_ON_TEAM }, + { SEC_I10, 0, QUOTE_HATE_MERC_2_ON_TEAM }, + { SEC_J13, 0, QUOTE_ENTER_SECTOR_WITH_FAN_1 }, + { SEC_J14, 1, 0 }, + }; + + //loop through all the sectors that have the quotes + for( uiCnt=0; uiCntbActive && pSoldier->bInSector ) + { + pSoldier->EVENT_InitNewSoldierAnim( CRAWLING, 1, TRUE ); + pSoldier->ChangeSoldierStance( PRONE ); + } + } +} +*/ +void HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap() +{ + SOLDIERTYPE *pSoldier=NULL; + UINT8 ubNumEnemiesMoved=0; + + //if we are loading a saved game, or we have already moved the enemies, get out. + if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME || + gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__ALREADY_MOVED_ENEMIES_IN_COMPLEX ) + { + return; + } + + //if the player made a 'noise' going through the gate at the end of the tunnel sector + if( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE ) + { + UINT8 cnt; + + // + //Move some of the enemies to be 'near' them player when the enter the room + // + + // Loop through the list and move some of the enemies + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + //if the soldier is active, + if ( pSoldier->bActive ) + { + // + // move the soldier to the modified location + // + + if( pSoldier->sGridNo == 13959 ) + { + pSoldier->SetSoldierGridNo( 15705, TRUE ); + ubNumEnemiesMoved++; + } + + if( pSoldier->sGridNo == 13983 ) + { + pSoldier->SetSoldierGridNo( 15712, TRUE ); + ubNumEnemiesMoved++; + } + + if( pSoldier->sGridNo == 12543 ) + { + pSoldier->SetSoldierGridNo( 15233, TRUE ); + ubNumEnemiesMoved++; + } + } + } + + while( ubNumEnemiesMoved < 3 ) + { + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + //if the soldier is active, + if ( pSoldier->bActive && pSoldier->sGridNo != 15705 && pSoldier->sGridNo != 15712 && pSoldier->sGridNo != 15233 ) + { + // + // move the soldier to the modified location + // + + if( ubNumEnemiesMoved == 0 ) + { + pSoldier->SetSoldierGridNo( 15706, TRUE ); + ubNumEnemiesMoved++; + } + + if( ubNumEnemiesMoved == 1 ) + { + pSoldier->SetSoldierGridNo( 15713, TRUE ); + ubNumEnemiesMoved++; + } + + if( ubNumEnemiesMoved == 2 ) + { + pSoldier->SetSoldierGridNo( 15234, TRUE ); + ubNumEnemiesMoved++; + } + } + } + } + + //Remeber we have moved the enemies + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__ALREADY_MOVED_ENEMIES_IN_COMPLEX; + } +} + +void HandleFortifiedDoor() +{ + //if the fortified door should be open + if( gJa25SaveStruct.ubStatusOfFortifiedDoor == FD__OPEN ) + { + ModifyDoorStatus( 11419, TRUE, DONTSETDOORSTATUS ); + } +} + +void CreateAndAddMoneyObjectToGround( UINT32 sGridNo, INT32 iEasyAmount, INT32 iNormalAmount, INT32 iHardAmount ) +{ + OBJECTTYPE Object; + INT32 iCash=0; +// INT8 bAmountToAdd=0; + + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + iCash = iEasyAmount; + break; + + case DIF_LEVEL_MEDIUM: + iCash = iNormalAmount; + break; + + case DIF_LEVEL_HARD: + iCash = iHardAmount; + break; + + default: + Assert(0); + } + + CreateMoney( iCash, &Object ); + + //add the item to the world + AddItemToPool( sGridNo, &Object, FALSE, 0, 0, 0 ); +} + + +void HandleGoingUpOrDownStairsForLoadScreensPurposes( INT16 sCurrentlyInSectorZ, INT16 sGoingToSectorZ ) +{ + if( sCurrentlyInSectorZ == sGoingToSectorZ ) + { + gJa25SaveStruct.ubLoadScreenStairTraversal = LS__NOT_GOING_UP_STAIRS; + } + else if( sCurrentlyInSectorZ < sGoingToSectorZ ) + { + gJa25SaveStruct.ubLoadScreenStairTraversal = LS__GOING_DOWN_STAIRS; + } + else + { + gJa25SaveStruct.ubLoadScreenStairTraversal = LS__GOING_UP_STAIRS; + } +} + +void HandleMovingEnemiesCloseToEntranceInFirstTunnelMap() +{ + SOLDIERTYPE *pSoldier=NULL; + UINT8 ubIndex=0; + UINT32 cnt; + BOOLEAN fDone=FALSE; + INT16 sXPos, sYPos; + UINT32 sGridNos[27]={ 18200, 18360, 18520, + 18199, 18359, 18519, + 18198, 18358, 18518, + 18197, 18357, 18517, + 18196, 18356, 18516, + 18195, 18355, 18515, + 18194, 18354, 18514, + 18193, 18353, 18513, + 18035, 18034, 18033, + }; + + + // + //Move some of the enemies to be 'near' them player when the enter the room + // + + // Loop through the list and move some of the enemies + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + //if the soldier is active, + if ( pSoldier->bActive ) + { + fDone = FALSE; + while( !fDone ) + { + //if there is no one in the gridno + if( WhoIsThere2( sGridNos[ ubIndex ], 0 ) == NOBODY ) + { + // move the soldier to the modified location + ConvertGridNoToCenterCellXY( sGridNos[ ubIndex ], &sXPos, &sYPos ); + pSoldier->EVENT_SetSoldierPosition( sXPos, sYPos ); +// SetSoldierGridNo( pSoldier, sGridNos[ ubIndex ], TRUE ); + ubIndex++; + fDone=TRUE; + } + else + { + ubIndex++; + } + + if( ubIndex >= 27 ) + { + Assert( 0 ); + return; + } + } + } + } +} + +void HandleMovingEnemiesCloseToEntranceInSecondTunnelMap() +{ + SOLDIERTYPE *pSoldier=NULL; + UINT8 ubIndex=0; + BOOLEAN fDone=FALSE; + UINT32 cnt; + INT16 sXPos, sYPos; + UINT32 sGridNos[30]={ 4900, 4901, 4902, 4903, 4904, + 5060, 5061, 5062, 5063, 5064, + 5220, 5221, 5222, 5223, 5224, + 5380, 5381, 5382, 5383, 5384, + 5540, 5541, 5542, 5543, 5544, + 5700, 5701, 5702, 5703, 5704 }; + + + + // + //Move some of the enemies to be 'near' them player when the enter the room + // + + // Loop through the list and move some of the enemies + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + //if the soldier is active, + if ( pSoldier->bActive ) + { + fDone = FALSE; + while( !fDone ) + { + //if there is no one in the gridno + if( WhoIsThere2( sGridNos[ ubIndex ], 0 ) == NOBODY ) + { + // move the soldier to the modified location + ConvertGridNoToCenterCellXY( sGridNos[ ubIndex ], &sXPos, &sYPos ); + pSoldier->EVENT_SetSoldierPosition( sXPos, sYPos ); +// SetSoldierGridNo( pSoldier, sGridNos[ ubIndex ], TRUE ); + ubIndex++; + fDone=TRUE; + } + else + { + ubIndex++; + } + + if( ubIndex >= 26 ) + { + Assert( 0 ); + return; + } + } + } + } +} + +void HandlePowerGenFanSoundModification() +{ + SetTileAnimCounter( TILE_ANIM__FAST_SPEED ); + + switch( gJa25SaveStruct.ubStateOfFanInPowerGenSector ) + { + case PGF__RUNNING_NORMALLY: + HandleAddingPowerGenFanSound(); + + //MAKE SURE the fan does not have an exit grid + RemoveExitGridFromWorld( PGF__FAN_EXIT_GRID_GRIDNO ); + break; + + case PGF__STOPPED: + //Add an exit grid to the map + AddExitGridForFanToPowerGenSector(); + break; + + case PGF__BLOWN_UP: + break; + + default: + Assert( 0 ); + } +} + +void HandleFirstPartOfTunnelFanSound() +{ + switch( gJa25SaveStruct.ubStateOfFanInPowerGenSector ) + { + case PGF__RUNNING_NORMALLY: + case PGF__STOPPED: + + //add the sound to the world + HandleAddingPowerGenFanSound(); + break; + } +} + +void HandleMovingEnemiesOntoRoofs() +{ + if( gWorldSectorX <= 0 || gWorldSectorY <= 0 || gbWorldSectorZ < 0 ) + { + return; + } + + //if this is the sector south of the town + if( gWorldSectorX == 11 && gWorldSectorY == MAP_ROW_J && gbWorldSectorZ == 0 ) + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + case DIF_LEVEL_MEDIUM: + break; + case DIF_LEVEL_HARD: + MoveEnemyFromGridNoToRoofGridNo( 15446, 13993 ); + MoveEnemyFromGridNoToRoofGridNo( 15436, 14006 ); + break; + } + } + + //else if this is the sector south of the town + else if( gWorldSectorX == 11 && gWorldSectorY == MAP_ROW_H && gbWorldSectorZ == 0 ) + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + case DIF_LEVEL_MEDIUM: + break; + case DIF_LEVEL_HARD: + MoveEnemyFromGridNoToRoofGridNo( 8711, 5521 ); + break; + } + } +} + + + +BOOLEAN MoveEnemyFromGridNoToRoofGridNo( UINT32 sSourceGridNo, UINT32 sDestGridNo ) +{ + SOLDIERTYPE *pSoldier=NULL; + INT32 cnt; + INT16 sXPos, sYPos; + + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive && pSoldier->bInSector && + pSoldier->sGridNo == sSourceGridNo ) + { + pSoldier->SetSoldierHeight( 50.0 ); + + // move soldier + ConvertGridNoToCenterCellXY( sDestGridNo, &sXPos, &sYPos ); + pSoldier->EVENT_SetSoldierPosition( sXPos, sYPos ); + + return( TRUE ); +// pSoldier->bOrders = SEEKENEMY; + } + } + + return( FALSE ); +} +#endif diff --git a/Strategic/strategicmap.h b/Strategic/strategicmap.h index 087228cd..18c882d8 100644 --- a/Strategic/strategicmap.h +++ b/Strategic/strategicmap.h @@ -5,6 +5,8 @@ #include "soldier control.h" #include "FileMan.h" +#include "mapscreen.h" + //The maximum size for any team strategically speaking. For example, we can't have more than 20 enemies, militia, or creatures at a time. //#define MAX_STRATEGIC_TEAM_SIZE 20 @@ -28,6 +30,13 @@ extern INT16 gWorldSectorX; extern INT16 gWorldSectorY; extern INT8 gbWorldSectorZ; +extern BOOLEAN gfHiddenTown [ MAX_TOWNS ]; +extern BOOLEAN gfDrawHiddenTown [ MAX_TOWNS ]; +extern BOOLEAN gfDrawHiddenTownTemp [ MAX_TOWNS ]; +extern BOOLEAN gfHiddenTownTemp [ MAX_TOWNS ]; +extern BOOLEAN gfIconTown [ MAX_TOWNS ]; +extern BOOLEAN gfIconTownTemp [ MAX_TOWNS ]; + // SAM definitions extern UINT8 NUMBER_OF_SAMS; #define MAX_NUMBER_OF_SAMS 50 //4 //50 @@ -142,9 +151,13 @@ UINT8 GetMilitiaCountAtLevelAnywhereInTown( UINT8 ubTownValue, UINT8 ubLevelValu void PrepareLoadedSector(); + +#ifdef JA2UB +// no JA2 UB +#else // handle for slay...no better place to really put this stuff void HandleSlayDailyEvent( void ); - +#endif void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bNewSectorZ ); @@ -188,4 +201,13 @@ extern INT8 gbGreenToRegPromotions; extern INT8 gbRegToElitePromotions; extern INT8 gbMilitiaPromotions; +#ifdef JA2UB +void BeginLoadScreen(); + +//ja25 UB +void HandleSectorSpecificModificatioToMap( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BOOLEAN fLoadingSavedGame ); + +void HandleEmailBeingSentWhenEnteringSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BOOLEAN fLaptopJustGotFixed ); +#endif + #endif diff --git a/Tactical/Action Items.h b/Tactical/Action Items.h index 001b605e..cb90e2c5 100644 --- a/Tactical/Action Items.h +++ b/Tactical/Action Items.h @@ -27,7 +27,17 @@ typedef enum ACTION_ITEM_UNTRAP_DOOR, ACTION_ITEM_TOGGLE_PRESSURE_ITEMS, ACTION_ITEM_MUSEUM_ALARM, - ACTION_ITEM_BLOODCAT_ALARM + ACTION_ITEM_BLOODCAT_ALARM, +#ifdef JA2UB + ACTION_ITEM_BIGGENS_BOMBS, + ACTION_ITEM_BIGGENS_WARNING, + ACTION_ITEM_SEE_FORTIFIED_DOOR, + ACTION_ITEM_OPEN_FORTIFED_DOOR, + ACTION_ITEM_SEE_POWER_GEN_FAN, + ACTION_ITEM_NEW = ACTION_ITEM_SEE_POWER_GEN_FAN + 215 +#else + ACTION_ITEM_NEW = ACTION_ITEM_BLOODCAT_ALARM + 220 +#endif } ItemActionType; #endif \ No newline at end of file diff --git a/Tactical/Animation Control.cpp b/Tactical/Animation Control.cpp index 4aa8768c..2d0c27d8 100644 --- a/Tactical/Animation Control.cpp +++ b/Tactical/Animation Control.cpp @@ -997,6 +997,16 @@ ANIMCONTROLTYPE gAnimControl[ NUMANIMATIONSTATES ] = //RUN (with pistol) {"RUN WITH PISTOL" , 0, 0, (FLOAT)2.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + //SIDE STEPPING WITH READIED WEAPON + "SIDE STEPPING WITH PISTOL RDY" , 0, 50, (FLOAT)0.4, ANIM_MOVING | ANIM_NORESTART | ANIM_FIREREADY | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "SIDE STEPPING WITH RIFLE RDY" , 0, 50, (FLOAT)0.4, ANIM_MOVING | ANIM_NORESTART | ANIM_FIREREADY | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "SIDE STEPPING WITH DUAL RDY" , 0, 50, (FLOAT)0.4, ANIM_MOVING | ANIM_NORESTART | ANIM_FIREREADY | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + + //WALKING WITH READIED WEAPON + {"WALKING WITH PISTOL RDY" , 20, 0, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_FIREREADY | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"WALKING WITH RIFLE RDY" , 20, 0, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_FIREREADY | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"WALKING WITH DUAL RDY" , 20, 0, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_FIREREADY | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + }; ANI_SPEED_DEF gubAnimWalkSpeeds[ TOTALBODYTYPES ] = @@ -1397,6 +1407,14 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ REGMALE ][ JUMPDOWNWALL ] = RGMWALLJUMP; gubAnimSurfaceIndex[ REGMALE ][ JUMPWINDOWS ] = RGMJUMPWINDOWS; + + gubAnimSurfaceIndex[ REGMALE ][ SIDE_STEP_PISTOL_RDY ] = RGMSIDESTEP_P_RDY; + gubAnimSurfaceIndex[ REGMALE ][ SIDE_STEP_RIFLE_RDY ] = RGMSIDESTEP_R_RDY; + gubAnimSurfaceIndex[ REGMALE ][ SIDE_STEP_DUAL_RDY ] = RGMSIDESTEP_D_RDY; + + gubAnimSurfaceIndex[ REGMALE ][ WALKING_PISTOL_RDY ] = RGMWALK_P_RDY; + gubAnimSurfaceIndex[ REGMALE ][ WALKING_RIFLE_RDY ] = RGMWALK_R_RDY; + gubAnimSurfaceIndex[ REGMALE ][ WALKING_DUAL_RDY ] = RGMWALK_D_RDY; gubAnimSurfaceMidWaterSubIndex[ REGMALE ][ STANDING][0] = RGMWATER_R_STD; gubAnimSurfaceMidWaterSubIndex[ REGMALE ][ WALKING ][0] = RGMWATER_R_WALK; @@ -1775,6 +1793,13 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ BIGMALE ][ JUMPWINDOWS ] = BGMJUMPWINDOWS; + gubAnimSurfaceIndex[ BIGMALE ][ SIDE_STEP_PISTOL_RDY ] = BGMSIDESTEP_P_RDY; + gubAnimSurfaceIndex[ BIGMALE ][ SIDE_STEP_RIFLE_RDY ] = BGMSIDESTEP_R_RDY; + gubAnimSurfaceIndex[ BIGMALE ][ SIDE_STEP_DUAL_RDY ] = BGMSIDESTEP_D_RDY; + + gubAnimSurfaceIndex[ BIGMALE ][ WALKING_PISTOL_RDY ] = BGMWALK_P_RDY; + gubAnimSurfaceIndex[ BIGMALE ][ WALKING_RIFLE_RDY ] = BGMWALK_R_RDY; + gubAnimSurfaceIndex[ BIGMALE ][ WALKING_DUAL_RDY ] = BGMWALK_D_RDY; gubAnimSurfaceItemSubIndex[ BIGMALE ][ STANDING ] = BGMPISTOLBREATH; gubAnimSurfaceItemSubIndex[ BIGMALE ][ WALKING ] = BGMNOTHING_WALK; @@ -2169,6 +2194,14 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ STOCKYMALE ][ JUMPWINDOWS ] = RGMJUMPWINDOWS; + gubAnimSurfaceIndex[ STOCKYMALE ][ SIDE_STEP_PISTOL_RDY ] = RGMSIDESTEP_P_RDY; + gubAnimSurfaceIndex[ STOCKYMALE ][ SIDE_STEP_RIFLE_RDY ] = RGMSIDESTEP_R_RDY; + gubAnimSurfaceIndex[ STOCKYMALE ][ SIDE_STEP_DUAL_RDY ] = RGMSIDESTEP_D_RDY; + + gubAnimSurfaceIndex[ STOCKYMALE ][ WALKING_PISTOL_RDY ] = RGMWALK_P_RDY; + gubAnimSurfaceIndex[ STOCKYMALE ][ WALKING_RIFLE_RDY ] = RGMWALK_R_RDY; + gubAnimSurfaceIndex[ STOCKYMALE ][ WALKING_DUAL_RDY ] = RGMWALK_D_RDY; + gubAnimSurfaceItemSubIndex[ STOCKYMALE ][ STANDING ] = RGMPISTOLBREATH; gubAnimSurfaceItemSubIndex[ STOCKYMALE ][ WALKING ] = RGMNOTHING_WALK; gubAnimSurfaceItemSubIndex[ STOCKYMALE ][ RUNNING] = RGMNOTHING_RUN; @@ -2541,6 +2574,15 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ REGFEMALE ][ JUMPWINDOWS ] = RGFJUMPWINDOWS; + gubAnimSurfaceIndex[ REGFEMALE ][ SIDE_STEP_PISTOL_RDY ] = RGFSIDESTEP_P_RDY; + gubAnimSurfaceIndex[ REGFEMALE ][ SIDE_STEP_RIFLE_RDY ] = RGFSIDESTEP_R_RDY; + gubAnimSurfaceIndex[ REGFEMALE ][ SIDE_STEP_DUAL_RDY ] = RGFSIDESTEP_D_RDY; + + gubAnimSurfaceIndex[ REGFEMALE ][ WALKING_PISTOL_RDY ] = RGFWALK_P_RDY; + gubAnimSurfaceIndex[ REGFEMALE ][ WALKING_RIFLE_RDY ] = RGFWALK_R_RDY; + gubAnimSurfaceIndex[ REGFEMALE ][ WALKING_DUAL_RDY ] = RGFWALK_D_RDY; + + gubAnimSurfaceItemSubIndex[ REGFEMALE ][ STANDING ] = RGFPISTOLBREATH; gubAnimSurfaceItemSubIndex[ REGFEMALE ][ WALKING ] = RGFNOTHING_WALK; gubAnimSurfaceItemSubIndex[ REGFEMALE ][ RUNNING ] = RGFNOTHING_RUN; @@ -3275,6 +3317,14 @@ BOOLEAN LoadAnimationStateInstructions( ) memcpy(gusAnimInst[RUNNING_W_PISTOL],fuckTheBoundz[RUNNING],sizeof(fuckTheBoundz[RUNNING])); + memcpy(gusAnimInst[SIDE_STEP_PISTOL_RDY],fuckTheBoundz[SIDE_STEP],sizeof(fuckTheBoundz[SIDE_STEP])); + memcpy(gusAnimInst[SIDE_STEP_RIFLE_RDY],fuckTheBoundz[SIDE_STEP],sizeof(fuckTheBoundz[SIDE_STEP])); + memcpy(gusAnimInst[SIDE_STEP_DUAL_RDY],fuckTheBoundz[SIDE_STEP],sizeof(fuckTheBoundz[SIDE_STEP])); + + memcpy(gusAnimInst[WALKING_PISTOL_RDY],fuckTheBoundz[WALKING],sizeof(fuckTheBoundz[WALKING])); + memcpy(gusAnimInst[WALKING_RIFLE_RDY],fuckTheBoundz[WALKING],sizeof(fuckTheBoundz[WALKING])); + memcpy(gusAnimInst[WALKING_DUAL_RDY],fuckTheBoundz[WALKING],sizeof(fuckTheBoundz[WALKING])); + return( TRUE ); } @@ -3665,6 +3715,20 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // else usAnimSurface = BGMSTANDAIM2; } } + if ( usAnimSurface == BGMSIDESTEP_R_RDY ) + { + if ( pSoldier->uiAnimSubFlags & SUB_ANIM_BIGGUYSHOOT2 ) + { + usAnimSurface = BGMSIDESTEP_R_RDY2; + } + } + if ( usAnimSurface == BGMWALK_R_RDY ) + { + if ( pSoldier->uiAnimSubFlags & SUB_ANIM_BIGGUYSHOOT2 ) + { + usAnimSurface = BGMWALK_R_RDY2; + } + } // SWITCH TO DIFFERENT STAND ANIMATION FOR BIG GUY! if ( usAnimSurface == BGMSTANDING ) @@ -3788,13 +3852,17 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // Look for good two pistols sub anim..... if ( gDoubleHandledSub.usAnimState == usAnimState ) - { + { // Do we carry two pistols... //if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass == IC_GUN ) if ( pSoldier->IsValidSecondHandShot() ) { - usAnimSurface = gDoubleHandledSub.usAnimationSurfaces[ pSoldier->ubBodyType ]; - fAdjustedForItem = TRUE; + usAltAnimSurface = gDoubleHandledSub.usAnimationSurfaces[ pSoldier->ubBodyType ]; + if ( usAltAnimSurface != INVALID_ANIMATION ) + { + usAnimSurface = usAltAnimSurface; + fAdjustedForItem = TRUE; + } } } diff --git a/Tactical/Animation Control.h b/Tactical/Animation Control.h index b1e1765b..38f4129e 100644 --- a/Tactical/Animation Control.h +++ b/Tactical/Animation Control.h @@ -563,6 +563,14 @@ enum AnimationStates THROW_KNIFE_SP_BM, RUNNING_W_PISTOL, + SIDE_STEP_PISTOL_RDY, + SIDE_STEP_RIFLE_RDY, + SIDE_STEP_DUAL_RDY, + + WALKING_PISTOL_RDY, + WALKING_RIFLE_RDY, + WALKING_DUAL_RDY, + NUMANIMATIONSTATES }; diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index d775fc18..4f9a2513 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -522,6 +522,32 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = BGMPISTOL_RUN, "ANIMS\\M_MERC\\M_P_RUN.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFPISTOL_RUN, "ANIMS\\F_MERC\\F_P_RUN.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMSIDESTEP_P_RDY, "ANIMS\\S_MERC\\S_P_RDY_SDSP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMSIDESTEP_R_RDY, "ANIMS\\S_MERC\\S_R_RDY_SDSP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMSIDESTEP_D_RDY, "ANIMS\\S_MERC\\S_DBL_RDY_SDSP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + + BGMSIDESTEP_P_RDY, "ANIMS\\M_MERC\\M_N2_SDSP_RDY.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMSIDESTEP_R_RDY, "ANIMS\\M_MERC\\M_R_SDSP_RDY.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMSIDESTEP_R_RDY2, "ANIMS\\M_MERC\\M_R_BDSS_SDSP_RDY.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMSIDESTEP_D_RDY, "ANIMS\\M_MERC\\M_DBL_SDSP_RDY.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + + RGFSIDESTEP_P_RDY, "ANIMS\\F_MERC\\F_P_RDY_SDSP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFSIDESTEP_R_RDY, "ANIMS\\F_MERC\\F_R_RDY_SDSP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFSIDESTEP_D_RDY, "ANIMS\\F_MERC\\F_DBL_RDY_SDSP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + + RGMWALK_P_RDY, "ANIMS\\S_MERC\\S_P_RDY_WALK.sti", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMWALK_R_RDY, "ANIMS\\S_MERC\\S_R_RDY_WALK.sti", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMWALK_D_RDY, "ANIMS\\S_MERC\\S_DBL_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + + BGMWALK_P_RDY, "ANIMS\\M_MERC\\M_N2_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMWALK_R_RDY, "ANIMS\\M_MERC\\M_R_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMWALK_R_RDY2, "ANIMS\\M_MERC\\M_R_RDY_DBASS_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMWALK_D_RDY, "ANIMS\\M_MERC\\M_DBL_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + + RGFWALK_P_RDY, "ANIMS\\F_MERC\\F_P_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFWALK_R_RDY, "ANIMS\\F_MERC\\F_R_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFWALK_D_RDY, "ANIMS\\F_MERC\\F_DBL_RDY_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + }; diff --git a/Tactical/Animation Data.h b/Tactical/Animation Data.h index aa167776..93886033 100644 --- a/Tactical/Animation Data.h +++ b/Tactical/Animation Data.h @@ -551,6 +551,32 @@ BGMWITHSTONE, BGMPISTOL_RUN, RGFPISTOL_RUN, + RGMSIDESTEP_P_RDY, + RGMSIDESTEP_R_RDY, + RGMSIDESTEP_D_RDY, + + BGMSIDESTEP_P_RDY, + BGMSIDESTEP_R_RDY, + BGMSIDESTEP_R_RDY2, + BGMSIDESTEP_D_RDY, + + RGFSIDESTEP_P_RDY, + RGFSIDESTEP_R_RDY, + RGFSIDESTEP_D_RDY, + + RGMWALK_P_RDY, + RGMWALK_R_RDY, + RGMWALK_D_RDY, + + BGMWALK_P_RDY, + BGMWALK_R_RDY, + BGMWALK_R_RDY2, + BGMWALK_D_RDY, + + RGFWALK_P_RDY, + RGFWALK_R_RDY, + RGFWALK_D_RDY, + NUMANIMATIONSURFACETYPES } AnimationSurfaceTypes; diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index a5a6d4b3..e22bb656 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -19,6 +19,16 @@ #include "GameSettings.h" #endif +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "ub_config.h" +#endif + #include #define MIN_REPAIR_TIME_IN_MINUTES 15 // minutes @@ -48,7 +58,12 @@ const ARMS_DEALER_INFO DefaultarmsDealerInfo[ NUM_ARMS_DEALERS ] = /* Jake Cameron */ { 0.8f, 1.1f, JAKE, ARMS_DEALER_BUYS_SELLS, 2500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE, 2500, 2500, 0, 1, 10, 0, 100, 1, 2, false, true }, /* Gabby Mulnick*/ { 1.0f, 1.0f, GABBY, ARMS_DEALER_BUYS_SELLS, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true }, +#ifdef JA2UB +/* Devin Connell*/ //ja25 ub Biggins//{ 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE , 5000, 5000, 0, 3, 10, 0, 10, 2, 3, false, false }, +#else /* Devin Connell*/ { 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE , 5000, 5000, 0, 3, 10, 0, 10, 2, 3, false, false }, +#endif + /* Howard Filmore*/ { 1.0f, 1.0f, HOWARD, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true }, /* Sam Rozen */ { 1.0f, 1.0f, SAM, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE , 3000, 3000, 0, 1, 10, 0, 100, 1, 2, false, true }, /* Frank */ { 1.0f, 1.0f, FRANK, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 0, 100, 1, 2, false, true }, @@ -64,11 +79,20 @@ const ARMS_DEALER_INFO DefaultarmsDealerInfo[ NUM_ARMS_DEALERS ] = //Speed Cost /* Arnie Brunzwell*/{ 0.1f, 0.8f, ARNIE, ARMS_DEALER_REPAIRS, 1500, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1500, 1500, 0, 1, 10, 1, 10, 1, 2, false, true }, /* Fredo */ { 0.6f, 0.6f, FREDO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, +#ifdef JA2UB +/* Raul */ { 0.80f, 1.8f, PERKO, ARMS_DEALER_BUYS_SELLS, 20000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE , 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, +#else /* Perko */ { 1.0f, 0.4f, PERKO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE, 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, +#endif /* Elgin */ { 1.0f, 1.0f, DRUGGIST, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 1, 10, 1, 2, false, true }, /* Manny */ { 1.0f, 1.0f, MANNY, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS , 500, 500, 0, 1, 10, 1, 10, 1, 2, false, true }, +#ifdef JA2UB +/* Betty */ { 0.75f, 1.25f, 73, ARMS_DEALER_BUYS_SELLS, 10000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE , 1000, 1000, 0, 1, 10, 1, 10, 1, 2, false, true }, +#endif + + }; std::vector armsDealerInfo (NUM_ARMS_DEALERS); @@ -92,9 +116,9 @@ BOOLEAN AdjustCertainDealersInventory(); void LimitArmsDealersInventory( UINT8 ubArmsDealer, UINT32 uDealerItemType, UINT8 ubMaxNumberOfItemType ); void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType ); void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany ); - +#ifdef JA2UB void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); - +#endif void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems ); BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ); @@ -102,6 +126,13 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ); BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); +#ifdef JA2UB +UINT8 GetFirstValidSpecialItemFromDealer( UINT8 ubArmsDealer, INT16 sItemIndex ); + +void AddTexsVideosToBettysInventory(); +BOOLEAN CanThisItemBeSoldToSimulatedCustomer( UINT8 ubArmsDealerID, UINT16 usItemIndex ); +#endif + void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ); BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); @@ -287,8 +318,11 @@ void DailyUpdateOfArmsDealersInventory() SimulateArmsDealerCustomer(); //if there are some items that are out of stock, order some more +#ifdef JA2UB + DailyCheckOnItemQuantities( FALSE ); +#else DailyCheckOnItemQuantities(); - +#endif //make sure certain items are in stock and certain limits are respected AdjustCertainDealersInventory( ); } @@ -327,6 +361,13 @@ void SimulateArmsDealerCustomer() { if ( Item[usItemIndex].usItemClass == 0 ) break; +#ifdef JA2UB + //JA25 UB// + if( !CanThisItemBeSoldToSimulatedCustomer( ubArmsDealer, usItemIndex ) ) + { + continue; + } +#endif //if there are some of these in stock if( numPerfectItems[usItemIndex] > 0) { @@ -367,8 +408,11 @@ void SimulateArmsDealerCustomer() } } - +#ifdef JA2UB +void DailyCheckOnItemQuantities( BOOLEAN fInstallyHaveItemsAppear ) +#else void DailyCheckOnItemQuantities() +#endif { UINT8 ubArmsDealer; UINT16 usItemIndex; @@ -409,6 +453,15 @@ void DailyCheckOnItemQuantities() { iter->ubQtyOnOrder = 0; iter->uiOrderArrivalTime = 0; +#ifdef JA2UB + //JA25 UB if the dealer is RAUL + if( ubArmsDealer == ARMS_DEALER_RAUL ) + { + //set the fact the raul refreshed his inventory + SetFactTrue( FACT_RAULS_INVENTORY_CHANGED_SINCE_LAST_VISIT ); + } +#endif + } } } @@ -435,7 +488,14 @@ void DailyCheckOnItemQuantities() { // figure out how many items to reorder (items are reordered an entire batch at a time) ubNumItems = HowManyItemsToReorder( ubMaxSupply, numTotalItems[ usItemIndex ] ); - +#ifdef JA2UB + //if the dealer is betty, and we are to ADD the stuff instantly + if( ubArmsDealer == ARMS_DEALER_BETTY && fInstallyHaveItemsAppear && + ( usItemIndex == MEDICKIT || usItemIndex == FIRSTAIDKIT ) ) + { + ubNumItems = ubMaxSupply + ubMaxSupply/2; + } +#endif // if this is the first day the player is eligible to have access to this thing if ( gArmsDealerStatus[ubArmsDealer].fPreviouslyEligible[ usItemIndex ] == false ) { @@ -445,8 +505,19 @@ void DailyCheckOnItemQuantities() } else { - ubReorderDays = ( UINT8) ( armsDealerInfo[ ubArmsDealer ].daysDelayMin + Random( armsDealerInfo[ ubArmsDealer ].daysDelayMax - armsDealerInfo[ ubArmsDealer ].daysDelayMin ) ); - +#ifdef JA2UB + if( fInstallyHaveItemsAppear ) + { + ubReorderDays = 0; + } + else + { + ubReorderDays = ( UINT8) ( armsDealerInfo[ ubArmsDealer ].daysDelayMin + Random( armsDealerInfo[ ubArmsDealer ].daysDelayMax - armsDealerInfo[ ubArmsDealer ].daysDelayMin ) ); + } + +#else + ubReorderDays = ( UINT8) ( armsDealerInfo[ ubArmsDealer ].daysDelayMin + Random( armsDealerInfo[ ubArmsDealer ].daysDelayMax - armsDealerInfo[ ubArmsDealer ].daysDelayMin ) ); +#endif //Determine when the inventory should arrive uiArrivalDay = GetWorldDay() + ubReorderDays; // consider changing this to minutes // post new order @@ -558,7 +629,42 @@ BOOLEAN AdjustCertainDealersInventory( ) { GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_FRANZ, VIDEO_CAMERA, 1 ); } +#ifdef JA2UB + //------------UB--------------------- + + + //if Raul hasnt yet sold the barret + if( !( gArmsDealerStatus[ ARMS_DEALER_RAUL ].ubSpecificDealerFlags & ARMS_DEALER_FLAG__RAUL_HAS_SOLD_BARRETT_TO_PLAYER ) ) + { + //Guarentee at least 1 Barrett + GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_RAUL, BARRETT_UB, 1 ); + } + + //if the player hasnt done the "killed the annoying bloodcats" quest for betty, + if( gubQuest[ QUEST_FIX_LAPTOP ] != QUESTDONE && gGameUBOptions.LaptopQuestEnabled == TRUE ) + { + //Guarntee 1 laptop transmitter to be at betty's + GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_BETTY, LAPTOP_TRANSMITTER , 1 ); //4500 + } + else + { + GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, LAPTOP_TRANSMITTER, 0 ); //4500 + } + + if( gubQuest[ QUEST_GET_RID_BLOODCATS_AT_BETTYS ] != QUESTDONE ) + { + //make sure she doesnt sell these items just yet + GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, FIRSTAIDKIT, 0 ); + GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, MEDICKIT, 0 ); + GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, COMPOUND18, 0 ); + GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, CERAMIC_PLATES, 0 ); + GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, LAME_BOY, 0 ); + } + + //Guarntee 1 laptop transmitter to be at betty's + GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_BETTY, PORNOS, 1 ); +#endif return( TRUE ); } @@ -1163,11 +1269,19 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) { return(FALSE); } - + +//#ifdef JA2UB +//Ja25: TEMP!!! +// return( FALSE ); +//#endif switch ( ubArmsDealer ) { case ARMS_DEALER_ARNIE: +#ifdef JA2UB +//Ja25 neither in exp. +#else case ARMS_DEALER_PERKO: +#endif // repairs ANYTHING non-electronic // if ( !( uiFlags & ITEM_ELECTRONIC ) ) if ( !( Item[ usItemIndex ].electronic ) ) @@ -1619,6 +1733,9 @@ void RemoveRandomItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemI BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ) { INT8 bArmsDealer; +#ifdef JA2UB + BOOLEAN fBoobyTrapItemsWhenDropping=FALSE; +#endif //Get Dealer ID from from merc Id bArmsDealer = GetArmsDealerIDFromMercID( ubMercID ); if( bArmsDealer == -1 ) @@ -1642,7 +1759,14 @@ BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ) Assert(0); return( FALSE ); } - +#ifdef JA2UB //RAUL + //Ja25 UB + //if Raul blew him,self up, dont drop any items + if( pSoldier->ubProfile == PERKO /* RAUL */ && IsJa25GeneralFlagSet( JA_GF__RAUL_BLOW_HIMSELF_UP ) ) + { + return( TRUE ); + } +#endif //loop through all the items in the dealer's inventory, and drop them all where the dealer was set up. for (DealerItemList::iterator iter = gArmsDealersInventory[bArmsDealer].begin(); iter != gArmsDealersInventory[bArmsDealer].end(); ++iter) { @@ -2273,6 +2397,37 @@ UINT32 CalculateMinutesClosedBetween( UINT8 ubArmsDealer, UINT32 uiStartTime, UI return ( uiMinutesClosed ); } +#ifdef JA2UB +//JA25 ub + + +void AddTexsVideosToBettysInventory() +{ + GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_BETTY, TEX_MOVIE_ATTACK_CLYDESDALES, 1 ); + GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_BETTY, TEX_MOVIE_WILD_EAST, 1 ); + GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_BETTY, TEX_MOVIE_HAVE_HONDA, 1 ); +} + + +BOOLEAN CanThisItemBeSoldToSimulatedCustomer( UINT8 ubArmsDealerID, UINT16 usItemIndex ) +{ + switch( ubArmsDealerID ) + { + case ARMS_DEALER_BETTY: + //if the item is.. + + if( usItemIndex == TEX_MOVIE_ATTACK_CLYDESDALES || //1356 || + usItemIndex == TEX_MOVIE_WILD_EAST || //1357 || + usItemIndex == TEX_MOVIE_HAVE_HONDA || //1358 || + usItemIndex == LAPTOP_TRANSMITTER )//1355 ) + { + return( FALSE ); + } + break; + } + + return( TRUE ); +} void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ) { @@ -2294,4 +2449,47 @@ void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UIN } } + + +/* UINT16 usCnt=0; + UINT8 ubNumToRemove=0; + SPECIAL_ITEM_INFO SpclItemInfo; + UINT8 ubNumLeftToRemove=0; + INT8 bItemCondition=0; + UINT8 bElementToRemove=0; + + + //if the num items in stock is greater then the num past in + if( gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubTotalItems > ubAtMostNumItems ) + { + ubNumToRemove = gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubTotalItems - ubAtMostNumItems; + + ubNumLeftToRemove = ubNumToRemove; + + //loop through the specified #of times + while( ubNumLeftToRemove > 0 ) + { + SetSpecialItemInfoToDefaults( &SpclItemInfo ); + + //remove special ones first + if( gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubTotalItems > gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubPerfectItems ) + { + bElementToRemove = GetFirstValidSpecialItemFromDealer( ubArmsDealer, sItemIndex ); + + RemoveSpecialItemFromArmsDealerInventoryAtElement( ubArmsDealer, sItemIndex, bElementToRemove ); + + ubNumLeftToRemove -= 1; + } + else + { + //lower the number to the required number + RemoveItemFromArmsDealerInventory( ubArmsDealer, sItemIndex, &SpclItemInfo, ubNumLeftToRemove ); + + ubNumLeftToRemove = 0; + } + } + } + + */ } +#endif diff --git a/Tactical/Arms Dealer Init.h b/Tactical/Arms Dealer Init.h index d711a946..239900ce 100644 --- a/Tactical/Arms Dealer Init.h +++ b/Tactical/Arms Dealer Init.h @@ -8,13 +8,18 @@ //enums for the various arms dealers enum { +//Ja25 None are in exp. ARMS_DEALER_TONY, ARMS_DEALER_FRANZ, ARMS_DEALER_KEITH, ARMS_DEALER_JAKE, ARMS_DEALER_GABBY, - +#ifdef JA2UB +//no UB +#else ARMS_DEALER_DEVIN, +#endif + ARMS_DEALER_HOWARD, ARMS_DEALER_SAM, ARMS_DEALER_FRANK, @@ -28,7 +33,12 @@ enum ARMS_DEALER_ARNIE, ARMS_DEALER_FREDO, + +#ifdef JA2UB + ARMS_DEALER_RAUL, +#else ARMS_DEALER_PERKO, +#endif // added only in GameVersion 54 ARMS_DEALER_ELGIN, @@ -36,6 +46,10 @@ enum // added only in GameVersion 55 ARMS_DEALER_MANNY, +#ifdef JA2UB + ARMS_DEALER_BETTY, +#endif + NUM_ARMS_DEALERS, }; @@ -108,8 +122,13 @@ enum #define ARMS_DEALER_ALL_WEAPONS ARMS_DEALER_ALL_GUNS | ARMS_DEALER_BLADE | ARMS_DEALER_LAUNCHER | ARMS_DEALER_KNIFECLASS - - +#ifdef JA2UB +//Raul +#define ARMS_DEALER_FLAG__RAUL_HAS_SOLD_BARRETT_TO_PLAYER 0x00000001 // Raul has sold the Barrett to the player +#define ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_48 0x00000002 // Raul said the quote for when the player first puts the hand cannon down +#define ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_49 0x00000004 // Quote for when player removes hand cannon from players offer area +#define ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_50 0x00000008 // Quote for when player adds the hand cannon AGAIN into the players offer area +#endif @@ -193,6 +212,8 @@ public: BOOLEAN fRepairDelayBeenUsed; // Set when a repairman has missed his repair time estimate & given his excuse for it BOOLEAN fUnusedKnowsPlayer; // Set if the shopkeeper has met with the player before [UNUSED] UINT32 uiTimePlayerLastInSKI; // game time (in total world minutes) when player last talked to this dealer in SKI + + BOOLEAN fHasSoldSomethingToPlayer; //If set, the player has at some point sold something to the player UINT16 ubStrayAmmo[MAXITEMS]; // partially-depleted ammo mags are stored here as #bullets, and can be converted to full packs BOOLEAN fPreviouslyEligible[MAXITEMS]; // whether or not dealer has been eligible to sell this item in days prior to today @@ -303,9 +324,9 @@ extern const ARMS_DEALER_INFO DefaultarmsDealerInfo[ NUM_ARMS_DEALERS ]; extern std::vector armsDealerInfo; extern ARMS_DEALER_STATUS gArmsDealerStatus[ NUM_ARMS_DEALERS ]; - - - +#ifdef JA2UB +void AddTexsVideosToBettysInventory(); +#endif void InitAllArmsDealers(); @@ -362,6 +383,9 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN UINT32 CalculateOvernightRepairDelay( UINT8 ubArmsDealer, UINT32 uiTimeWhenFreeToStartIt, UINT32 uiMinutesToFix ); UINT32 CalculateMinutesClosedBetween( UINT8 ubArmsDealer, UINT32 uiStartTime, UINT32 uiEndTime ); +#ifdef JA2UB +extern void DailyCheckOnItemQuantities( BOOLEAN fInstallyHaveItemsAppear ); //Ja25 UB +#endif extern void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany ); diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index c9561b54..dffe9530 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -267,7 +267,12 @@ DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = // // Devin ( Explosives ) // +//Betty UB +#ifdef JA2UB +DEALER_POSSIBLE_INV gBettyInventory[MAXITEMS+1];// = +#else DEALER_POSSIBLE_INV gDevinInventory[MAXITEMS+1];// = +#endif //{ // { STUN_GRENADE, 3 }, // { TEARGAS_GRENADE, 3 }, @@ -665,7 +670,11 @@ DEALER_POSSIBLE_INV gArnieInventory[MAXITEMS+1];// = // // Perko ( REPAIR) // +#ifdef JA2UB +DEALER_POSSIBLE_INV gRaulInventory[MAXITEMS+1]; +#else DEALER_POSSIBLE_INV gPerkoInventory[MAXITEMS+1];// = +#endif //{ // // NO INVENTORY // @@ -694,6 +703,13 @@ INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ) { switch( ubDealerID ) { + +#ifdef JA2UB + case ARMS_DEALER_BETTY: + return( GetMaxItemAmount( gBettyInventory, usItemIndex ) ); + break; +#endif + // Ja25: Not in exp. case ARMS_DEALER_TONY: return( GetMaxItemAmount( gTonyInventory, usItemIndex ) ); break; @@ -709,11 +725,15 @@ INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ) case ARMS_DEALER_ARNIE: return( GetMaxItemAmount( gArnieInventory, usItemIndex ) ); break; - +#ifdef JA2UB + case ARMS_DEALER_RAUL: + return( GetMaxItemAmount( gRaulInventory, usItemIndex ) ); // + break; +#else case ARMS_DEALER_PERKO: return( GetMaxItemAmount( gPerkoInventory, usItemIndex ) ); break; - +#endif case ARMS_DEALER_KEITH: return( GetMaxItemAmount( gKeithInventory, usItemIndex ) ); break; @@ -757,11 +777,13 @@ INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ) case ARMS_DEALER_GABBY: return( GetMaxItemAmount( gGabbyInventory, usItemIndex ) ); break; - +#ifdef JA2UB + //no ub +#else case ARMS_DEALER_DEVIN: return( GetMaxItemAmount( gDevinInventory, usItemIndex ) ); break; - +#endif case ARMS_DEALER_ELGIN: return( GetMaxItemAmount( gElginInventory, usItemIndex ) ); break; @@ -801,6 +823,11 @@ DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID { switch( ubArmsDealerID ) { + #ifdef JA2UB + case ARMS_DEALER_BETTY: + return( gBettyInventory ); + break; + #endif case ARMS_DEALER_TONY: return( gTonyInventory ); break; @@ -817,10 +844,15 @@ DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID return( gArnieInventory ); break; +#ifdef JA2UB + case ARMS_DEALER_RAUL: + return( gRaulInventory ); + break; +#else case ARMS_DEALER_PERKO: return( gPerkoInventory ); break; - +#endif case ARMS_DEALER_KEITH: return( gKeithInventory ); break; @@ -864,11 +896,13 @@ DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID case ARMS_DEALER_GABBY: return( gGabbyInventory ); break; - +#ifdef JA2UB + //no UB +#else case ARMS_DEALER_DEVIN: return( gDevinInventory ); break; - +#endif case ARMS_DEALER_ELGIN: return( gElginInventory ); break; diff --git a/Tactical/ArmsDealerInvInit.h b/Tactical/ArmsDealerInvInit.h index 275f5cd0..1030a113 100644 --- a/Tactical/ArmsDealerInvInit.h +++ b/Tactical/ArmsDealerInvInit.h @@ -53,7 +53,13 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ); BOOLEAN CanDealerItemBeSoldUsed( UINT16 usItemIndex ); extern DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1]; + +#ifdef JA2UB +extern DEALER_POSSIBLE_INV gBettyInventory[MAXITEMS+1]; +#else //ja25 ub Biggins extern DEALER_POSSIBLE_INV gDevinInventory[MAXITEMS+1]; +#endif + extern DEALER_POSSIBLE_INV gFranzInventory[MAXITEMS+1]; extern DEALER_POSSIBLE_INV gKeithInventory[MAXITEMS+1]; extern DEALER_POSSIBLE_INV gSamInventory[MAXITEMS+1]; @@ -69,7 +75,11 @@ extern DEALER_POSSIBLE_INV gAlbertoInventory[MAXITEMS+1]; extern DEALER_POSSIBLE_INV gCarloInventory[MAXITEMS+1]; extern DEALER_POSSIBLE_INV gMickyInventory[MAXITEMS+1]; extern DEALER_POSSIBLE_INV gArnieInventory[MAXITEMS+1]; +#ifdef JA2UB +extern DEALER_POSSIBLE_INV gRaulInventory[MAXITEMS+1]; +#else extern DEALER_POSSIBLE_INV gPerkoInventory[MAXITEMS+1]; +#endif extern DEALER_POSSIBLE_INV gFredoInventory[MAXITEMS+1]; #endif diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index ca637dbe..6c74da9b 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -37,6 +37,17 @@ #include "Tactical Save.h" #endif +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "mercs.h" +#include "ub_config.h" +#endif + #include "email.h" @@ -1327,12 +1338,22 @@ void HandleUnhiredMercDeaths( INT32 iProfileID ) gStrategicStatus.ubUnhiredMercDeaths++; //send an email as long as the merc is from aim +#ifdef JA2UB + //ja25 ub + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) + { + if ( gProfilesAIM[ iProfileID ].ProfilId == iProfileID && gGameUBOptions.fDeadMerc == TRUE ) //new profiles by Jazz + //send an email to the player telling the player that a merc died + AddEmailWithSpecialData(206, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, iProfileID, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L1 ); + } +#else // if( iProfileID < BIFF ) if ( gProfilesAIM[ iProfileID ].ProfilId == iProfileID ) //new profiles by Jazz { //send an email to the player telling the player that a merc died - AddEmailWithSpecialData(MERC_DIED_ON_OTHER_ASSIGNMENT, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, iProfileID ); + AddEmailWithSpecialData(MERC_DIED_ON_OTHER_ASSIGNMENT, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, iProfileID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); } +#endif } } @@ -1347,6 +1368,11 @@ void HandleUnhiredMercDeaths( INT32 iProfileID ) // returns a number between 0-100, this is an estimate of how far a player has progressed through the game UINT8 CurrentPlayerProgressPercentage(void) { +#ifdef JA2UB + INT8 bFurthestSectorPlayerOwns=-1; //JA25 UB + UINT8 ubCurrentProgress; +#else + UINT32 uiCurrentIncome; UINT32 uiPossibleIncome; UINT16 usCurrentProgress; @@ -1364,8 +1390,129 @@ UINT8 CurrentPlayerProgressPercentage(void) UINT16 usMaxIncomeProgress; UINT16 usMaxControlProgress; UINT16 usMaxVisitProgress; +#endif +#ifdef JA2UB + //Get the furthest sector the player owns + bFurthestSectorPlayerOwns = GetTheFurthestSectorPlayerOwns(); + //JA25 UB + switch( bFurthestSectorPlayerOwns ) + { + //initial sector + case SEC_H7: + ubCurrentProgress = 44; + break; + case SEC_H8: + ubCurrentProgress = 45; + break; + + //guard post + case SEC_H9: + ubCurrentProgress = 55; + break; + + //field + case SEC_H10: + ubCurrentProgress = 58; + break; + + //field + case SEC_I9: + ubCurrentProgress = 60; + break; + + //first part of town + case SEC_I10: + ubCurrentProgress = 63; + break; + + //second part of town + case SEC_I11: + ubCurrentProgress = 65; + break; + + //field + case SEC_I12: + ubCurrentProgress = 68; + break; + + //Abondoned mine + case SEC_I13: + ubCurrentProgress = 70; + break; + + // cave under abondoned mine +/* case SEC_I13_1: + ubCurrentProgress = 72; + break; +*/ + //field + case SEC_J11: + ubCurrentProgress = 70; + break; + + //field + case SEC_J12: + ubCurrentProgress = 70; + break; + + //power gen plant + case SEC_J13: + ubCurrentProgress = 75; + break; +/* + //power gen plant, sub level + case JA25_J13_1: + ubCurrentProgress = 75; + break; + + //first part of tunnel + case JA25_J14_1: + ubCurrentProgress = 80; + break; + + //second part of tunnel + case JA25_K14_1: + ubCurrentProgress = 82; + break; + + //ground level of complex + case JA25_K15: + ubCurrentProgress = 90; + break; + + //initial sector of complex + case JA25_K15_1: + ubCurrentProgress = 85; + break; + + // 2nd level down of complex + case JA25_K15_2: + ubCurrentProgress = 95; + break; + + //2nd last sector + case JA25_L15_2: + ubCurrentProgress = 98; + break; + + //last sector + case JA25_L15_3: + ubCurrentProgress = 100; + break; +*/ + default: + + // OK, use percentage complete from map... + //Assert( 0 ); + //ubCurrentProgress = SectorInfo[ bFurthestSectorPlayerOwns ].ubCurrentProgressValue; + ubCurrentProgress = 50; + break; + } + + return(ubCurrentProgress); +#else if( gfEditMode ) return 0; @@ -1510,6 +1657,8 @@ UINT8 CurrentPlayerProgressPercentage(void) return((UINT8)usCurrentProgress); + +#endif } UINT8 HighestPlayerProgressPercentage(void) @@ -1534,11 +1683,14 @@ void HourlyProgressUpdate(void) // CJC: note when progress goes above certain values for the first time // at 35% start the Madlab quest - if ( ubCurrentProgress >= gGameExternalOptions.ubGameProgressStartMadlabQuest && gStrategicStatus.ubHighestProgress <= gGameExternalOptions.ubGameProgressStartMadlabQuest ) +#ifdef JA2UB +// no UB +#else + if ( ubCurrentProgress >= gGameExternalOptions.ubGameProgressStartMadlabQuest && gStrategicStatus.ubHighestProgress < gGameExternalOptions.ubGameProgressStartMadlabQuest ) { HandleScientistAWOLMeanwhileScene(); } - +#endif // at 50% make Mike available to the strategic AI if ( ubCurrentProgress >= gGameExternalOptions.ubGameProgressMikeAvailable && gStrategicStatus.ubHighestProgress <= gGameExternalOptions.ubGameProgressMikeAvailable ) { @@ -1828,9 +1980,32 @@ UINT16 TotalVisitableSurfaceSectors( void ) void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue ) { +#ifdef JA2UB +//JA25 UB +#else UINT8 ubEmailOffset = 0; int iMsgLength = 0; - + + UINT8 pMerc = 0; + UINT8 iMerc = 0; + UINT8 oMerc = 0; + + // Read from EmailMercAvailable.xml + if ( ReadXMLEmail == TRUE ) + { + oMerc = ubMercMercIdValue; + iMerc = oMerc * 1; + + if ( oMerc != 0 ) + pMerc = oMerc + 1; + else + pMerc = 0; + if ( gProfilesMERC[ubMercMercIdValue].ProfilId == ubMercMercIdValue ) + AddEmailTypeXML( pMerc, iMerc, iMerc, GetWorldTotalMin(), -1 , TYPE_EMAIL_MERC_LEVEL_UP); + } + else + { + // Read from Email.edt and sender (nickname) from MercProfiles.xml // WANNE: TODO: Tex, Biggins, Stoggy and Gaston have special handling because they are the new MERC merc in 1.13 // There is no letter template in Email.edt. We have them hardcoded in the source code. if (ubMercMercIdValue == 124 || ubMercMercIdValue == 125 || ubMercMercIdValue == 126 || ubMercMercIdValue == 127) @@ -1866,5 +2041,8 @@ void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue ) ubEmailOffset = MERC_UP_LEVEL_BIFF + MERC_UP_LEVEL_LENGTH_BIFF * ( ubMercMercIdValue ); } - AddEmail( ubEmailOffset, iMsgLength, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1); + AddEmail( ubEmailOffset, iMsgLength, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT_NAME_MERC); + + } +#endif } diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 12a45b9b..20c29d0b 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -246,7 +246,9 @@ void ShutDownQuoteBox( BOOLEAN fForce ) gCivQuoteData.iDialogueBox = -1; gCivQuoteData.bActive = FALSE; - +#ifdef JA2UB +// no UB +#else // do we need to do anything at the end of the civ quote? if ( gCivQuoteData.pCiv && gCivQuoteData.pCiv->aiData.bAction == AI_ACTION_OFFER_SURRENDER ) { @@ -261,6 +263,7 @@ void ShutDownQuoteBox( BOOLEAN fForce ) ActionDone( gCivQuoteData.pCiv ); } } +#endif } } @@ -480,11 +483,17 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLEAN fCanUseHints ) { UINT8 ubCivType; +#ifdef JA2UB + +#else INT8 bTownId; - BOOLEAN bCivLowLoyalty = FALSE; - BOOLEAN bCivHighLoyalty = FALSE; INT8 bCivHint; INT8 bMineId; +#endif + + BOOLEAN bCivLowLoyalty = FALSE; + BOOLEAN bCivHighLoyalty = FALSE; + BOOLEAN bMiners = FALSE; UINT16 iCounter2; UINT16 FileEDTQUoteID; @@ -496,7 +505,11 @@ UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLE for( iCounter2 = NON_CIV_GROUP; iCounter2 < NUM_CIV_GROUPS; iCounter2++ ) { +#ifdef JA2UB + if (pCiv->ubCivilianGroup > UNNAMED_CIV_GROUP_19 && pCiv->ubCivilianGroup == iCounter2) +#else if (pCiv->ubCivilianGroup > QUEENS_CIV_GROUP && pCiv->ubCivilianGroup == iCounter2) +#endif { if ( pCiv->aiData.bNeutral ) { @@ -508,7 +521,68 @@ UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLE } } } - + +#ifdef JA2UB + if( ubCivType != CIV_TYPE_ENEMY ) + { + //if the civ is not an enemy + if ( pCiv->aiData.bNeutral ) + { + return( CIV_QUOTE__CIV_NOT_ENEMY ); //43 + } + else + { + // + //the civ is an enemy + // + + //if the civ can fight + if( pCiv->ubBodyType == REGMALE || pCiv->ubBodyType == REGFEMALE || pCiv->ubBodyType == BIGMALE ) + { + return( CIV_QUOTE__CIV_ENEMY_CAN_FIGHT); //40 + } + else if( pCiv->stats.bLife < pCiv->stats.bLifeMax ) + { + return( CIV_QUOTE__CIV_HURT ); //42 + } + else + { + return( CIV_QUOTE__CIV_ENEMY_GENERIC ); //41 + } + } + } + + + if( ubCivType == CIV_TYPE_ENEMY ) + { + // Determine what type of quote to say... + // Are are we going to attack? + + if ( pCiv->aiData.bAction == AI_ACTION_TOSS_PROJECTILE || pCiv->aiData.bAction == AI_ACTION_FIRE_GUN || + pCiv->aiData.bAction == AI_ACTION_FIRE_GUN || pCiv->aiData.bAction == AI_ACTION_KNIFE_MOVE ) + { + return( CIV_QUOTE_ENEMY_THREAT ); + } + + // Hurt? + else if ( pCiv->stats.bLife < 30 ) + { + return( CIV_QUOTE_ENEMY_HURT ); + } + // elite? + else if ( pCiv->ubSoldierClass == SOLDIER_CLASS_ELITE ) + { + return( CIV_QUOTE_ENEMY_ELITE ); + } + else + { + return( CIV_QUOTE_ENEMY_ADMIN ); + } + } + + return( 255 ); +#else + if ( ubCivType == CIV_TYPE_ENEMY ) { // Determine what type of quote to say... @@ -785,7 +859,7 @@ UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLE { return( CIV_QUOTE_KIDS_ALL_PURPOSE ); } - +#endif } @@ -844,7 +918,13 @@ void StartCivQuote( SOLDIERTYPE *pCiv ) } else RandomVal = 15; - + +#ifdef JA2UB + if( ubCivQuoteID == 255 ) + { + return; + } +#endif // Determine entry id // ATE: Try and get entry from soldier pointer.... diff --git a/Tactical/Civ Quotes.h b/Tactical/Civ Quotes.h index 9afe8641..2df9cfb6 100644 --- a/Tactical/Civ Quotes.h +++ b/Tactical/Civ Quotes.h @@ -54,9 +54,23 @@ enum CIV_QUOTE_ENEMY_OFFER_SURRENDER, CIV_QUOTE_HICKS_SEE_US_AT_NIGHT, CIV_QUOTE_DEIDRANNA_DEAD, +#ifdef JA2UB + //40 + CIV_QUOTE__CIV_ENEMY_CAN_FIGHT, + CIV_QUOTE__CIV_ENEMY_GENERIC, + CIV_QUOTE__CIV_HURT, + CIV_QUOTE__CIV_NOT_ENEMY, + CIV_QUOTE_44, + CIV_QUOTE_45, + CIV_QUOTE_46, + CIV_QUOTE_47, + CIV_QUOTE_48, + CIV_QUOTE_49, + CIV_QUOTE_NEW = CIV_QUOTE_DEIDRANNA_DEAD + 990, // 500 reserved +#else CIV_QUOTE_NEW = CIV_QUOTE_DEIDRANNA_DEAD + 1000, // 500 reserved - +#endif NUM_CIV_QUOTES }; diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 1deaae5b..6a4db2c3 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -61,6 +61,15 @@ #include "Auto Resolve.h" #include "connect.h" +#ifdef JA2UB +#include "Intro.h" +#include "MapScreen Quotes.h" +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "Animation Control.h" +#endif + +#include "ub_config.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -128,6 +137,24 @@ std::vector uiExternalStaticNPCFaces; // 157, // 158, //}; +#ifdef JA2UB +UINT32 uiExternalStaticNPCFacesUB[ NUMBER_OF_EXTERNAL_NPC_FACES ]; +UINT32 uiExternalFaceProfileIdsUB[ NUMBER_OF_EXTERNAL_NPC_FACES ]= +{ + 97, + 106, + 148, + 156, + 157, + 158, + 76, //Jerry Melo +}; + + +BOOLEAN AreAllTheMercsFinishedSayingThereInitialHeliCrashQuotes(); +void InitJerriesSpeechCallBack(); +void HandlePlayerClosingMorrisNoteDisplayedOnScreen(); +#endif UINT8 gubMercValidPrecedentQuoteID[ NUMBER_VALID_MERC_PRECEDENT_QUOTES ] = { 80, 81, 82, 83, 86, 87, 88, 95, 97, 99, 100, 101, 102 }; @@ -217,6 +244,11 @@ void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ); void DisplayTextForExternalNPC( UINT8 ubCharacterNum, STR16 zQuoteStr ); void CreateTalkingUI( INT8 bUIHandlerID, INT32 iFaceIndex, UINT8 ubCharacterNum, SOLDIERTYPE *pSoldier, STR16 zQuoteStr ); +#ifdef JA2UB +BOOLEAN AreAllTheMercsFinishedSayingThereInitialHeliCrashQuotes(); +void InitJerriesSpeechCallBack(); +void HandlePlayerClosingMorrisNoteDisplayedOnScreen(); +#endif void HandleExternNPCSpeechFace( INT32 iIndex ); @@ -310,6 +342,13 @@ void InitalizeStaticExternalNPCFaces( void ) // // Code for loading miners' faces has been moved to LuaMines::InitMinerFaces ... // +#ifdef JA2UB + for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ ) + { + uiExternalStaticNPCFacesUB[ iCounter ] = ( UINT32 )InitFace( ( UINT8 )( uiExternalFaceProfileIdsUB[ iCounter ] ), NOBODY, FACE_FORCE_SMALL ); + } +#endif + //for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ ) //{ // uiExternalStaticNPCFaces[ iCounter ] = ( UINT32 )InitFace( ( UINT8 )( uiExternalFaceProfileIds[ iCounter ] ), NOBODY, FACE_FORCE_SMALL ); @@ -336,6 +375,14 @@ void ShutdownStaticExternalNPCFaces( void ) //{ // DeleteFace( uiExternalStaticNPCFaces[ iCounter ] ); //} + +#ifdef JA2UB + for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ ) + { + DeleteFace( uiExternalStaticNPCFacesUB[ iCounter ] ); + } +#endif + for (std::vector::iterator face = uiExternalStaticNPCFaces.begin(); face != uiExternalStaticNPCFaces.end(); ++face) { @@ -425,6 +472,9 @@ void StopAnyCurrentlyTalkingSpeech( ) { InternalShutupaYoFace( gpCurrentTalkingFace->iID, TRUE ); } +#ifdef JA2UB + RemoveJerryMiloBrokenLaptopOverlay(); +#endif } @@ -664,6 +714,68 @@ void HandleDialogue( ) UnPauseGame(); } + +#ifdef JA2UB + if ( iQSize == 0 ) + { + if( gfMorrisShouldSayHi ) + { + SOLDIERTYPE * pMorris; + SOLDIERTYPE * pSoldier; + INT16 sPlayerGridNo; + UINT8 ubPlayerID; + UINT8 ubQualifiedSoldierIDArray[ NUM_MERCS_WITH_NEW_QUOTES ]; + UINT8 ubNumQualifiedMercs=0; + UINT8 ubCnt=0; + + if( !( gMercProfiles[ 75 ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) ) + { + pMorris = FindSoldierByProfileID( 75, FALSE ); + if ( pMorris && pMorris->stats.bLife >= OKLIFE ) + { + sPlayerGridNo = ClosestPC( pMorris, NULL ); + if (sPlayerGridNo != NOWHERE ) + { + ubPlayerID = WhoIsThere2( sPlayerGridNo, 0 ); + if (ubPlayerID != NOBODY) + { + InitiateConversation( pMorris, MercPtrs[ ubPlayerID ], NPC_INITIAL_QUOTE, 0 ); + gMercProfiles[ pMorris->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE; + } + } + } + } + else + { + //Get the # of qualified mercs + ubNumQualifiedMercs = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubQualifiedSoldierIDArray, NULL ); + + //if there is some qualified mercs + if( ubNumQualifiedMercs != 0 ) + { + //loop through all the mercs + for( ubCnt=0; ubCntusQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_MORRIS; + } + } + + //Morris should say a new quote +// CharacterDialogue( MORRIS, QUOTE_ATTACKED_BY_MULTIPLE_CREATURES, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI, FALSE, FALSE ); + + TriggerNPCRecord( 75, 2 ); + + gfMorrisShouldSayHi = FALSE; + } + } + + + return; + } +#else //Ja25: no mike if ( iQSize == 0 ) { @@ -694,7 +806,7 @@ void HandleDialogue( ) return; } - +#endif // ATE: Remove any civ quotes.... // ShutDownQuoteBoxIfActive( TRUE ); @@ -807,7 +919,15 @@ void HandleDialogue( ) // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; gubCurrentTalkingID = QItem->ubCharacterNum; - +#ifdef JA2UB + //Ja25: test + if( QItem->ubCharacterNum == 75 ) //MORRIS + { + if( QItem->usQuoteNum == 0 ) + { + } + } +#endif ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier ); } @@ -1123,6 +1243,32 @@ void HandleDialogue( ) { SetUpdateBoxFlag( TRUE ); } +#ifdef JA2UB + else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_JERRY_MILO ) + { + //switch on the quote that is being spoken + switch( QItem->uiSpecialEventData ) + { + case JM_SE__SHOW_RADIO_LOCATOR: + HandleShowingRadioLocatorsInMorrisArea(); + break; + + case JM_SE__HEADING_TO_TRACONA: + + // play the heli crash video + SetIntroType( INTRO_HELI_CRASH ); + + //Go to the intro screen + RequestTriggerExitFromMapscreen( MAP_EXIT_TO_INTRO_SCREEN ); + break; + + + default: + //nothing + break; + } + } +#else //Ja25: removed the flag, no militia else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_CONTINUE_TRAINING_MILITIA ) { // grab soldier ptr from profile ID @@ -1134,6 +1280,7 @@ void HandleDialogue( ) HandleInterfaceMessageForContinuingTrainingMilitia( pSoldier ); } } +#endif else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_ENTER_MAPSCREEN ) { if( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) @@ -1168,6 +1315,49 @@ void HandleDialogue( ) } else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE ) { +#ifdef JA2UB + //JA25 UB + if ( QItem->uiSpecialEventData & MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING ) + { + HandleEveryoneDoneTheirEndGameQuotes(); + } + else + { + // grab soldier ptr from profile ID + pSoldier = FindSoldierByProfileID( (UINT8)QItem->uiSpecialEventData, FALSE ); + + // Now, wake these sluts up and have them say quote... + pSoldier->fIgnoreGetupFromCollapseCheck = FALSE; + + //Get the soldier up + pSoldier->bCollapsed = FALSE; + pSoldier->ChangeSoldierStance( ANIM_STAND ); + + //if the soldier is Jerry + if( FindSoldierByProfileID( 76, FALSE ) == pSoldier ) //JERRY + { + //Play the sound of the Antena breaking + PlayJA2SampleFromFile( "SOUNDS\\Metal Antenna Crunch.wav", RATE_11025, HIGHVOLUME, 1, MIDDLE ); + } + + //Turn off the flag saying we are doing the initial heli crash + gfFirstTimeInGameHeliCrash = FALSE; + + //if all the mercs are done their talk + if( AreAllTheMercsFinishedSayingThereInitialHeliCrashQuotes() ) + { + //Trigger Jerry Milo's script record 10 ( call action 301 ) + //AA + //if ( gGameUBOptions.InGameHeliCrash == TRUE ) + if ( gGameUBOptions.JerryQuotes == TRUE ) + DelayedMercQuote( 76 , 0xffff, 4 ); //JERRY + + //End the ui Lock + guiPendingOverrideEvent = LU_ENDUILOCK; + } + } + } +#else //Ja25 No queen if ( QItem->uiSpecialEventData & MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA ) { HandleDoneLastKilledQueenQuote( ); @@ -1177,6 +1367,7 @@ void HandleDialogue( ) HandleDoneLastEndGameQuote( ); } } +#endif else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_SLEEP ) { // no soldier, leave now @@ -1317,11 +1508,14 @@ BOOLEAN TacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteNum ) return( FALSE ); } +#ifdef JA2UB +//Ja25 no meanwhiles +#else if ( AreInMeanwhile( ) ) { return( FALSE ); } - +#endif if (pSoldier->stats.bLife < CONSCIOUSNESS ) return( FALSE ); @@ -1784,7 +1978,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN } //else if ( ubCharacterNum >= FIRST_RPC && ubCharacterNum < GASTON && //new profiles by Jazz - else if ( ( gProfilesRPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesNPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesVehicle[ubCharacterNum].ProfilId == ubCharacterNum ) && + else if ( ( gProfilesRPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesNPC[ubCharacterNum].ProfilId == ubCharacterNum ) && //|| gProfilesVehicle[ubCharacterNum].ProfilId == ubCharacterNum ) && ( !( gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) || ProfileCurrentlyTalkingInDialoguePanel( ubCharacterNum ) || (gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_FORCENPCQUOTE) ) @@ -1832,12 +2026,32 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN //new profiles by Jazz if ( ( gProfilesRPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesNPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesVehicle[ubCharacterNum].ProfilId == ubCharacterNum ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { - if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) - { - sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum ); +//inshy: fix for UB-1.13 version only sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum ); + if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) + { +//#ifdef JA2UB + sprintf( zFileName,"SPEECH\\%03d_%03d.ogg",ubCharacterNum,usQuoteNum ); if ( !FileExists( zFileName ) ) { - sprintf( zFileName,"SPEECH\\r_%03d_%03d.wav",ubCharacterNum,usQuoteNum ); + sprintf( zFileName,"SPEECH\\%03d_%03d.ogg",ubCharacterNum,usQuoteNum ); + } + +//#else +// sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum ); +//#endif + if ( !FileExists( zFileName ) ) + { +//inshy: fix for UB-1.13 version only sprintf( zFileName,"SPEECH\\r_%03d_%03d.wav",ubCharacterNum,usQuoteNum ); +//#ifdef JA2UB + sprintf( zFileName,"SPEECH\\%03d_%03d.wav",ubCharacterNum,usQuoteNum ); + + if ( !FileExists( zFileName ) ) + { + sprintf( zFileName,"SPEECH\\%03d_%03d.wav",ubCharacterNum,usQuoteNum ); + } +//#else +// sprintf( zFileName,"SPEECH\\r_%03d_%03d.wav",ubCharacterNum,usQuoteNum ); +//#endif // Also check for Russian Gold sound files (identical to international ones) if(! FileExists( zFileName ) ) { @@ -2511,6 +2725,10 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) { if ( gTacticalStatus.bNumFoughtInBattle[ ENEMY_TEAM ] == 0 ) { + +#ifdef JA2UB +//Ja25 No Ira, Miguel etc. +#else // quotes referring to Deidranna's men so we skip quote if there were no army guys fought if ( (usQuoteNum == QUOTE_SECTOR_SAFE) && (pTeamSoldier->ubProfile == IRA || pTeamSoldier->ubProfile == MIGUEL || pTeamSoldier->ubProfile == SHANK ) ) { @@ -2521,6 +2739,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) { continue; } +#endif } ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; @@ -2720,6 +2939,21 @@ void TextOverlayClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) ShutDownLastQuoteTacticalTextBox( ); } } +#ifdef JA2UB + //JA25 UB + //if we are in the heli crash sequence + else if( gJa25SaveStruct.fJerryBreakingLaptopOccuring ) + { + InitJerriesSpeechCallBack(); + } + + //else the Commander morris note is being displayed + else if( gJa25SaveStruct.ubDisplayCommanderMorrisNote != DMN__NOT_TO_DISPLAY_IT || + gJa25SaveStruct.ubDisplayCommanderMorrisNote != DMN__FINISHED ) + { + HandlePlayerClosingMorrisNoteDisplayedOnScreen(); + } +#endif } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { @@ -2981,3 +3215,96 @@ void SetExternMapscreenSpeechPanelXY( INT16 sXPos, INT16 sYPos ) gsExternPanelXPosition = sXPos; gsExternPanelYPosition = sYPos; } + + +#ifdef JA2UB +//JA25 UB +BOOLEAN AreAllTheMercsFinishedSayingThereInitialHeliCrashQuotes() +{ + INT32 cnt; + SOLDIERTYPE *pSoldier; + + // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + //if the merc is alive, in sector, etc... + if ( OK_CONTROLLABLE_MERC( pSoldier ) ) + { + //if the merc is still not done the initial speech, and still prone + if( pSoldier->fIgnoreGetupFromCollapseCheck ) + { + //we arent done + return( FALSE ); + } + } + } + + //See if Jerry is still waiting to get up + pSoldier = FindSoldierByProfileID( 76, FALSE ); + if( pSoldier ) + { + //if the merc is still not done the initial speech, and still prone + if( pSoldier->fIgnoreGetupFromCollapseCheck ) + { + //we arent done + return( FALSE ); + } + } + + //all mercs on the team are done + return( TRUE ); +} + +void InitJerriesSpeechCallBack() +{ + //Trigger Jerry Milo's script record 10 ( call action 301 ) + TriggerNPCRecord( 76, 10 ); + + //Clear the overlay + RemoveJerryMiloBrokenLaptopOverlay(); +} + +void RemoveJerryMiloBrokenLaptopOverlay() +{ + //if the overlay is up + if( gJa25SaveStruct.fJerryBreakingLaptopOccuring ) + { + gJa25SaveStruct.fJerryBreakingLaptopOccuring = FALSE; + + RemoveVideoOverlay( giTextBoxOverlay ); + giTextBoxOverlay = -1; + + if( fTextBoxMouseRegionCreated ) + { + MSYS_RemoveRegion( &gTextBoxMouseRegion ); + fTextBoxMouseRegionCreated = FALSE; + } + } +} + +void HandlePlayerClosingMorrisNoteDisplayedOnScreen() +{ + RemoveVideoOverlay( giTextBoxOverlay ); + giTextBoxOverlay = -1; + + if ( fTextBoxMouseRegionCreated ) + { + MSYS_RemoveRegion( &gTextBoxMouseRegion ); + fTextBoxMouseRegionCreated = FALSE; + } + + if( gJa25SaveStruct.ubDisplayCommanderMorrisNote == DMN__DISPLAY_PART_2 ) + { + gJa25SaveStruct.ubDisplayCommanderMorrisNote = DMN__FINISHED; + + HandleShowingRadioLocatorsInMorrisArea(); + } + else + { + DelayedMercQuote( gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote, DQ__MORRIS_NOTE_DISPLAY_NOTE_1, GetWorldTotalSeconds() + 1 ); + } +} +#endif diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index 9039cb78..c9992e03 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -163,6 +163,10 @@ enum DialogQuoteIDs QUOTE_PERSONALITY_BIAS_WITH_MERC_2, QUOTE_MERC_LEAVING_ALSUCO_SOON, QUOTE_MERC_GONE_UP_IN_PRICE, +#ifdef JA2UB + QUOTE_ENTER_SECTOR_WITH_FAN_1, + QUOTE_ENTER_SECTOR_WITH_FAN_2, +#endif @@ -194,7 +198,13 @@ enum DialogQuoteIDs #define DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU 0x00000400 #define DIALOGUE_SPECIAL_EVENT_ENABLE_AI 0x00000800 #define DIALOGUE_SPECIAL_EVENT_USE_ALTERNATE_FILES 0x00001000 + +#ifdef JA2UB +#define DIALOGUE_SPECIAL_EVENT_JERRY_MILO 0x00002000 +#else #define DIALOGUE_SPECIAL_EVENT_CONTINUE_TRAINING_MILITIA 0x00002000 +#endif + #define DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING 0x00004000 #define DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE 0x00008000 #define DIALOGUE_SPECIAL_EVENT_SLEEP 0x00010000 @@ -214,9 +224,20 @@ enum DialogQuoteIDs #define DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW 0x40000000 #define DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING_NO_ASK_EQUIP 0x80000000 +#ifdef JA2UB +#define MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING 0x20000000 +#define MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA 0x10000000 +#else #define MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA 0x00000001 #define MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING 0x00000002 +#endif +#ifdef JA2UB +enum{ + JERRY_MELO_FACE = 6, + NUMBER_OF_EXTERNAL_NPC_FACES, +}; +#endif enum{ SKYRIDER_EXTERNAL_FACE =0, @@ -236,6 +257,11 @@ enum{ UPDATE_BOX_REASON_SHOW_BOX, }; +#ifdef JA2UB +extern UINT32 uiExternalStaticNPCFacesUB[ ]; +extern UINT32 uiExternalFaceProfileIdsUB[ ]; +#endif + //extern UINT32 uiExternalStaticNPCFaces[ ]; extern std::vector uiExternalStaticNPCFaces; //extern UINT32 uiExternalFaceProfileIds[ ]; @@ -358,5 +384,8 @@ void UnPauseDialogueQueue( void ); void SetExternMapscreenSpeechPanelXY( INT16 sXPos, INT16 sYPos ); +#ifdef JA2UB +void RemoveJerryMiloBrokenLaptopOverlay(); +#endif #endif \ No newline at end of file diff --git a/Tactical/End Game.cpp b/Tactical/End Game.cpp index edb0ad2f..77c55296 100644 --- a/Tactical/End Game.cpp +++ b/Tactical/End Game.cpp @@ -44,6 +44,23 @@ #include "screenids.h" #endif +#ifdef JA2UB +#include "email.h" +#include "Game Clock.h" +#include "Ja25_Tactical.h" +#include "Game Init.h" +#include "interface Dialogue.h" +#include "ub_config.h" + +void HandleAddingTheEndGameEmails(); +void EndFadeToCredits( void ); +void FadeToCredits( void ); +void InFinalSectorAfterFadeIn( void ); +void FadeOutToLaptopOnEndGame( void ); + +BOOLEAN gfPlayersLaptopWasntWorkingAtEndOfGame; +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -136,7 +153,9 @@ void ChangeO3SectorStatue( BOOLEAN fFromExplosion ) RecompileLocalMovementCostsFromRadius( 13830, 5 ); } - +#ifdef JA2UB +//Ja25 no queen +#else void DeidrannaTimerCallback( void ) { HandleDeidrannaDeath( gpKillerSoldier, gsGridNo, gbLevel ); @@ -384,12 +403,15 @@ void DoneFadeOutEndCinematic( void ) SetIntroType( INTRO_ENDING ); } - +#endif // OK, end death UI - fade to smaker.... void HandleDoneLastEndGameQuote( ) { - EndQueenDeathEndgame( ); - +#ifdef JA2UB +//Ja25 No queen +#else +EndQueenDeathEndgame( ); +#endif gFadeOutDoneCallback = DoneFadeOutEndCinematic; FadeOutGameScreen( ); @@ -399,9 +421,213 @@ void HandleDoneLastEndGameQuote( ) void QueenBitchTimerCallback( void ) { +#ifdef JA2UB +//no Ub +#else HandleQueenBitchDeath( gpKillerSoldier, gsGridNo, gbLevel ); +#endif } +#ifdef JA2UB +void EndGameEveryoneSayTheirGoodByQuotes( void ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier; + + // Start end cimimatic.... + gTacticalStatus.uiFlags |= IN_ENDGAME_SEQUENCE; + + //lock the interface + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + + // + // first thing is to loop through team and look for QUALIFIED mercs on the team to say special end game quote + // + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + { + // Are we in this sector, On the current squad? + if( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) && IsSoldierQualifiedMerc( pSoldier ) ) + { + TacticalCharacterDialogue( pSoldier, QUOTE_RENEWING_CAUSE_BUDDY_2_ON_TEAM ); + } + } + + // + // Next is to loop through ENTIRE team and say end quote... + // + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + { + // Are we in this sector, On the current squad? + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) + { + TacticalCharacterDialogue( pSoldier, QUOTE_END_GAME_COMMENT ); + } + } + + // Add queue event to proceed w/ smacker cimimatic + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING, 0,0,0,0 ); +} + + +void HandleAddingTheEndGameEmails() +{ + BOOLEAN fMiguelAlive=FALSE; + BOOLEAN fManuelAlive=FALSE; + BOOLEAN fManuelHired=FALSE; + + + //Miguel alive + if( gubFact[ FACT_PLAYER_IMPORTED_SAVE_MIGUEL_DEAD ] ) + fMiguelAlive = FALSE; + else + fMiguelAlive = TRUE; + + //manuel alive + if( gMercProfiles[ 60 ].bMercStatus == MERC_IS_DEAD ) + fManuelAlive = FALSE; + else + fManuelAlive = TRUE; + + //manuel hired + if( gMercProfiles[ 60 ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) + fManuelHired = TRUE; + else + fManuelHired = FALSE; + + // + // Determine the EMAIL to be sent out to the player + // + + + // email # 12a - Miguel dead, Manuel never recruited + if( !fMiguelAlive && !fManuelHired ) + { + AddEmail( EMAIL_CONGRATS, EMAIL_CONGRATS_LENGTH, MAIL_ENRICO, GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT); + } + + // email # 12b - Miguel alive, Manuel never recruited + else if( fMiguelAlive && !fManuelHired ) + { + AddEmail( EMAIL_CONGRATSICK, EMAIL_CONGRATSICK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT); + } + + // email # 12c - Miguel alive, Manuel dead + else if( fMiguelAlive && !fManuelAlive ) + { + AddEmail( EMAIL_CONGRATMIGMANUELDEAD, EMAIL_CONGRATMIGMANUELDEAD_LENGTH, MAIL_ENRICO, GetWorldTotalMin() , -1, -1, TYPE_EMAIL_EMAIL_EDT); + } + + // email # 12d - Miguel alive, Manuel recruited and alive + else if( fMiguelAlive && fManuelAlive && fManuelHired ) + { + AddEmail( EMAIL_CONGRATMIGMANUELALIVE, EMAIL_CONGRATMIGMANUELALIVE_LENGTH, MAIL_ENRICO, GetWorldTotalMin() , -1, -1, TYPE_EMAIL_EMAIL_EDT); + } + + // email # 12e - Miguel dead, Manuel dead + else if( !fMiguelAlive && !fManuelAlive ) + { + AddEmail( EMAIL_CONGRATMANUELDEAD, EMAIL_CONGRATMANUELDEAD_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1 , -1, TYPE_EMAIL_EMAIL_EDT); + } + + // email # 12f - Miguel dead, Manuel recruited and alive + else if( !fMiguelAlive && fManuelAlive && fManuelHired ) + { + AddEmail( EMAIL_CONGRATMANUELALIVE, EMAIL_CONGRATMANUELALIVE_LENGTH, MAIL_ENRICO, GetWorldTotalMin() , -1, -1, TYPE_EMAIL_EMAIL_EDT); + } + + else + { + Assert( 0 ); + } +} + + +void HandleEveryoneDoneTheirEndGameQuotes() +{ + // UnLock UI! + guiPendingOverrideEvent = LU_ENDUILOCK; + HandleTacticalUI( ); + + //if laptop is still BROKEN + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTINPROGRESS && gGameUBOptions.LaptopQuestEnabled == TRUE ) + { + gfPlayersLaptopWasntWorkingAtEndOfGame = TRUE; + + // otherwise, go to the credits screen + HandleJa25EndGameAndGoToCreditsScreen( TRUE ); + } + else + { + gfPlayersLaptopWasntWorkingAtEndOfGame = FALSE; + + gFadeOutDoneCallback = FadeOutToLaptopOnEndGame; + + FadeOutGameScreen( ); + } +} + + +void HandleJa25EndGameAndGoToCreditsScreen( BOOLEAN fFromTactical ) +{ + if( fFromTactical ) + { + FadeToCredits( ); + } + else + { + //Reset flag indicating we are in the end game sequence + gTacticalStatus.uiFlags &= ~IN_ENDGAME_SEQUENCE; + + //We want to reinitialize the game + ReStartingGame(); + } +} + +void EnterTacticalInFinalSector() +{ + gFadeInDoneCallback = InFinalSectorAfterFadeIn; + + FadeInGameScreen( ); +} + +void InFinalSectorAfterFadeIn( void ) +{ + //Have everyone start talking + DelayedMercQuote( NOBODY, DQ__START_EVERYONE_TALKING_AT_END_OF_GAME, GetWorldTotalSeconds() + 2 ); +} + +void FadeToCredits( void ) +{ + gFadeOutDoneCallback = EndFadeToCredits; + + FadeOutGameScreen( ); +} + +void EndFadeToCredits( void ) +{ + //then we can go strait to the laptop screen + InternalLeaveTacticalScreen( CREDIT_SCREEN ); + + //Reset flag indicating we are in the end game sequence + gTacticalStatus.uiFlags &= ~IN_ENDGAME_SEQUENCE; + + //We want to reinitialize the game + ReStartingGame(); +} + +void FadeOutToLaptopOnEndGame( void ) +{ + + //then we can go strait to the laptop screen + InternalLeaveTacticalScreen( LAPTOP_SCREEN ); + + //Add the end Game Emails + HandleAddingTheEndGameEmails(); +} +#else //Ja25 no queen void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ) { @@ -500,5 +726,47 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLe giNPCReferenceCount = 0; } } +#endif +#ifdef JA2UB +//JA25UB +void DoneFadeOutEndCinematic( void ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier; + //Change the currently selecter sector in mapscreen + //ChangeSelectedMapSector( 16, 11, 0 ); + ChangeSelectedMapSector( gGameUBOptions.ubEndDefaultSectorX, gGameUBOptions.ubEndDefaultSectorY, gGameUBOptions.ubEndDefaultSectorZ ); + // + // Loop through all the soldiers and move any of them that are in the complex to be in the safe sector near ther + // + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + { + // if the soldier was in the complex + if( pSoldier->bActive && + pSoldier->sSectorX == 15 && ( pSoldier->sSectorY == 11 || pSoldier->sSectorY == 12 ) ) + { + if ( GetGroup( pSoldier->ubGroupID ) ) + { + //move them to the 'fake' sector + //PlaceGroupInSector( pSoldier->ubGroupID, 15, 11, 16, 11, 0, FALSE ); + PlaceGroupInSector( pSoldier->ubGroupID, 15, 11, gGameUBOptions.ubEndDefaultSectorX, gGameUBOptions.ubEndDefaultSectorY, gGameUBOptions.ubEndDefaultSectorZ, FALSE ); + } + else + { + pSoldier->sSectorX = gGameUBOptions.ubEndDefaultSectorX; //16; + pSoldier->sSectorY = gGameUBOptions.ubEndDefaultSectorY; //11; + pSoldier->bSectorZ = gGameUBOptions.ubEndDefaultSectorZ; //0; + } + } + } + + // + // Go watch the movies + // + InternalLeaveTacticalScreen( INTRO_SCREEN ); + SetIntroType( INTRO_ENDING ); +} +#endif diff --git a/Tactical/End Game.h b/Tactical/End Game.h index ca65e4c4..a5c8da35 100644 --- a/Tactical/End Game.h +++ b/Tactical/End Game.h @@ -5,18 +5,24 @@ BOOLEAN DoesO3SectorStatueExistHere( INT32 sGridNo ); void ChangeO3SectorStatue( BOOLEAN fFromExplosion ); +void HandleDoneLastKilledQueenQuote( ); +void HandleDoneLastEndGameQuote( ); + +#ifdef JA2UB +void DoneFadeOutEndCinematic( void ); +void HandleJa25EndGameAndGoToCreditsScreen( BOOLEAN fFromTactical ); +void HandleEveryoneDoneTheirEndGameQuotes(); +void EndGameEveryoneSayTheirGoodByQuotes( void ); +void EnterTacticalInFinalSector(); +extern BOOLEAN gfPlayersLaptopWasntWorkingAtEndOfGame; +#else void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ); void BeginHandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ); - -void HandleDoneLastKilledQueenQuote( ); - void EndQueenDeathEndgameBeginEndCimenatic( ); void EndQueenDeathEndgame( ); void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ); void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ); - -void HandleDoneLastEndGameQuote( ); - +#endif #endif \ No newline at end of file diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 8458e988..692cbfc7 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -214,6 +214,27 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF sprintf( VObjectDesc.ImageFile, "FACES\\b%02de.sti", iFaceFileID ); } } + +#ifdef JA2UB + else if ( usMercProfileID == 64 ) + { + // SANDRO - old/new traits check (I am not sure if this is used at all) + if ( gGameOptions.fNewTraitSystem ) + { + if ( ProfileHasSkillTrait( 64, RANGER_NT ) > 0 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\B64c.sti" ); + } + } + else + { + if ( ProfileHasSkillTrait( 64, CAMOUFLAGED_OT ) > 0 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\B64c.sti" ); + } + } + } +#else else if ( usMercProfileID == TEX ) { // SANDRO - old/new traits check (I am not sure if this is used at all) @@ -232,6 +253,7 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF } } } +#endif } else { @@ -496,6 +518,31 @@ void GetFaceRelativeCoordinates( FACETYPE *pFace, UINT16 *pusEyesX, UINT16 *pusE usEyesY = gMercProfiles[ usMercProfileID ].usEyesY; usMouthY = gMercProfiles[ usMercProfileID ].usMouthY; usMouthX = gMercProfiles[ usMercProfileID ].usMouthX; + +#ifdef JA2UB + + if ( gGameOptions.fNewTraitSystem ) + { + if( usMercProfileID == 64 && ( gMercProfiles[ 64 ].bSkillTraits[0] == RANGER_NT || gMercProfiles[ 64 ].bSkillTraits[1] == RANGER_NT ) ) + { + usEyesX = 13; + usEyesY = 34; + usMouthX = 13; + usMouthY = 55; + } + } + else + { + if( usMercProfileID == 64 && ( gMercProfiles[ 64 ].bSkillTraits[0] == CAMOUFLAGED_OT || gMercProfiles[ 64 ].bSkillTraits[1] == CAMOUFLAGED_OT ) ) + { + usEyesX = 13; + usEyesY = 34; + usMouthX = 13; + usMouthY = 55; + } + } + +#endif // Use some other values for x,y, base on if we are a RPC! if ( !( pFace->uiFlags & FACE_BIGFACE ) ||( pFace->uiFlags & FACE_FORCE_SMALL )) @@ -2834,11 +2881,14 @@ BOOLEAN SetFaceTalking( INT32 iFaceIndex, CHAR8 *zSoundFile, STR16 zTextString, pFace->fAnimatingTalking = TRUE; pFace->fFinishTalking = FALSE; +#ifdef JA2UB +//Ja25: No Meanwhiles +#else if ( !AreInMeanwhile( ) ) { TurnOnSectorLocator( pFace->ubCharacterNum ); } - +#endif // Play sample if( gGameSettings.fOptions[ TOPTION_SPEECH ] ) pFace->uiSoundID = PlayJA2GapSample( zSoundFile, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN, &(pFace->GapList ) ); diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index 72a0578f..a386fb8f 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -39,11 +39,26 @@ #include "fresh_header.h" #include "connect.h" +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "mercs.h" +#include "ub_config.h" +#endif + BOOLEAN gfSetPerceivedDoorState = FALSE; BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE * pStructure, BOOLEAN fNoAnimations ); +#ifdef JA2UB +void HandleForceingTheTunnelGate( UINT32 sGridNo ); //Ja25 UB +#endif + void HandleDoorChangeFromGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fNoAnimations ) { STRUCTURE * pStructure; @@ -601,7 +616,12 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE *p { // it's locked.... pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); - +#ifdef JA2UB + //JA25 UB + //If this is the tunnel sector, and the merc failed opening the fence door, play a quote + HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( pSoldier, FALSE ); +#endif + // Do we have a quote for locked stuff? // Now just show on message bar if ( !AM_AN_EPC( pSoldier ) ) @@ -622,7 +642,49 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE *p break; } break; +#ifdef JA2UB + case HANDLE_DOOR_FORCE: + // Set costs for these + sAPCost = GetAPsToOpenDoor( pSoldier ); // SANDRO + sBPCost = APBPConstants[BP_BOOT_DOOR]; + + // OK, using force, if we have no lock, just open the door! + if ( pDoor == NULL ) + { + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + fHandleDoor = TRUE; + + ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_THERE_IS_NO_LOCK_STR ] ); + } + else + { + //JA25 UB + //If this is the tunnel sector, and the merc failed opening the fence door, play a quote + if( HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( pSoldier, TRUE ) ) + { + } + else + { + // Attempt to force door + if ( AttemptToSmashDoor( pSoldier, pDoor ) ) + { + //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_DESTROYED_STR ] ); + // pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + fHandleDoor = TRUE; + } + else + { + //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_NOT_DESTROYED_STR ] ); + UpdateDoorPerceivedValue( pDoor ); + } + ProcessImplicationsOfPCMessingWithDoor( pSoldier ); + } + } + //Handle Special code for the gate in the tunnel + HandleForceingTheTunnelGate( sGridNo ); //JA25 UB + break; +#else case HANDLE_DOOR_FORCE: // Set costs for these @@ -654,7 +716,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE *p ProcessImplicationsOfPCMessingWithDoor( pSoldier ); } break; - +#endif case HANDLE_DOOR_CROWBAR: @@ -738,7 +800,11 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE *p } else { - //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_HAS_NOT_BEEN_PICKED_STR ] ); +#ifdef JA2UB + //If this is the tunnel sector, and the merc failed opening the fence door, play a quote + HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( pSoldier, FALSE ); + +#endif //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_HAS_NOT_BEEN_PICKED_STR ] ); } ProcessImplicationsOfPCMessingWithDoor( pSoldier ); } @@ -761,6 +827,10 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE *p } else { +#ifdef JA2UB + //If this is the tunnel sector, and the merc failed opening the fence door, play a quote + HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( pSoldier, FALSE ); //JA25 UB +#endif if ( ExamineDoorForTraps( pSoldier, pDoor ) ) { // We have a trap. Use door pointer to determine what type, etc @@ -824,11 +894,23 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT32 sGridNo, STRUCTURE *p // Now just show on message bar //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_NOT_PROPER_KEY_STR ], pSoldier->name ); +#ifdef JA2UB + //If this is the tunnel sector, and the merc failed opening the fence door, play a quote + if( HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( pSoldier, FALSE ) ) //JA25 UB + { + // OK PLay damn battle sound + if ( Random( 2 ) ) + { + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + } + } +#else // OK PLay damn battle sound if ( Random( 2 ) ) { pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } +#endif } } break; @@ -1487,3 +1569,24 @@ void SetDoorString( INT32 sGridNo ) } } + +#ifdef JA2UB +//Ja25 UB +void HandleForceingTheTunnelGate( UINT32 sGridNo ) +{ + //if this isnt the Last sector of the tunnel + if( !( gWorldSectorX == 14 && gWorldSectorY == MAP_ROW_K && gbWorldSectorZ == 1 ) ) + { + return; + } + + //if it is not the right gridno + if( sGridNo != 4742 ) + { + return; + } + + //If the player blew up the fan, then the enemies can hear it in the tunnel and prepare for it. + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE; +} +#endif diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 4f4e59e6..273fb5a9 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -66,6 +66,11 @@ #include "Morale.h" #endif +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#endif + #define NUM_ITEMS_LISTED 8 #define NUM_ITEM_FLASH_SLOTS 50 #define MIN_LOB_RANGE 6 @@ -1799,7 +1804,9 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr BOOLEAN fShouldSayCoolQuote = FALSE; BOOLEAN fDidSayCoolQuote = FALSE; BOOLEAN fSaidBoobyTrapQuote = FALSE; - +#ifdef JA2UB + UINT16 usItem=0; +#endif // OK. CHECK IF WE ARE DOING ALL IN THIS POOL.... if ( iItemIndex == ITEM_PICKUP_ACTION_ALL || iItemIndex == ITEM_PICKUP_SELECTION ) { @@ -2003,7 +2010,15 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr } } } - +#ifdef JA2UB + //JA25 ub + //if the item is valid + if( usItem != 0 ) + { + //handle the picking up of a new ja25 gun + HandleNewGunComment( pSoldier, usItem, TRUE ); + } +#endif // Aknowledge.... if( pSoldier->bTeam == OUR_TEAM && !fDidSayCoolQuote && !fSaidBoobyTrapQuote ) { @@ -4639,7 +4654,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) { // SANDRO was here, AP_DISARM_MINE changed to GetAPsToDisarmMine if(EnoughPoints(gpBoobyTrapSoldier, GetAPsToDisarmMine( gpBoobyTrapSoldier ), APBPConstants[BP_DISARM_MINE], TRUE)) - DeductPoints(gpBoobyTrapSoldier, GetAPsToDisarmMine( gpBoobyTrapSoldier ), APBPConstants[BP_DISARM_MINE]); + DeductPoints(gpBoobyTrapSoldier, GetAPsToDisarmMine( gpBoobyTrapSoldier ), APBPConstants[BP_DISARM_MINE], AFTERACTION_INTERRUPT); else return; } @@ -5719,9 +5734,7 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) { if (pSoldier->bActionPoints >= GetBasicAPsToPickupItem( pSoldier ) ) - { - DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0 ); - + { // Make copy of item gTempObject = pOpponent->inv[pTempItemPool->iItemIndex]; if ( ItemIsCool( &gTempObject ) ) @@ -5737,7 +5750,8 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, // add to merc records if ( pSoldier->ubProfile != NO_PROFILE ) gMercProfiles[ pSoldier->ubProfile ].records.usItemsStolen++; - + + DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0, AFTERACTION_INTERRUPT ); } else { diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index a6a1b7f4..281819a0 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -97,6 +97,8 @@ #endif #include "teamturns.h" +#include "Options Screen.h" +#include "SaveLoadScreen.h" ////////////////////////////////////////////////////////////////////////////// // SANDRO - In this file, all APBPConstants[AP_CROUCH] and APBPConstants[AP_PRONE] were changed to GetAPsCrouch() and GetAPsProne() @@ -1225,6 +1227,8 @@ UINT32 UIHandleEnterPalEditMode( UI_EVENT *pUIEvent ) UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent ) { +CHAR16 zString[128]; + // CANCEL FROM PLANNING MODE! if ( InUIPlanMode( ) ) { @@ -1248,9 +1252,15 @@ UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent ) //if( FileExists( "..\\AutoSave.pls" ) && CanGameBeSaved() ) if (gGameSettings.fOptions[TOPTION_USE_AUTO_SAVE] == TRUE && CanGameBeSaved() ) { - //Save the game guiPreviousOptionScreen = guiCurrentScreen; - SaveGame( SAVE__END_TURN_NUM, L"End Turn Auto Save" ); + + //increment end turn number + guiLastSaveGameNum++; + if( guiLastSaveGameNum == 2 ) + guiLastSaveGameNum = 0; + + swprintf( zString, L"%s%d",pMessageStrings[ MSG_SAVE_END_TURN_SAVE_TEXT ], guiLastSaveGameNum + 1); + SaveGame(SAVE__END_TURN_NUM, zString ); } ////ddd îïòèìèçàöèÿ äëÿ õîäà äðàíèêîâ @@ -1687,7 +1697,7 @@ UINT32 UIHandleMovementMenu( UI_EVENT *pUIEvent ) { case MOVEMENT_MENU_RUN: - if ( pSoldier->usUIMovementMode != WALKING && pSoldier->usUIMovementMode != RUNNING ) + if ( pSoldier->usUIMovementMode != WALKING && pSoldier->usUIMovementMode != RUNNING && pSoldier->usUIMovementMode != WALKING_PISTOL_RDY && pSoldier->usUIMovementMode != WALKING_RIFLE_RDY && pSoldier->usUIMovementMode != WALKING_DUAL_RDY ) { UIHandleSoldierStanceChange( pSoldier->ubID, ANIM_STAND ); pSoldier->flags.fUIMovementFast = 1; @@ -3869,6 +3879,9 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, INT switch ( pSoldier->usUIMovementMode ) { case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: gUIDisplayActionPointsOffY = 10; gUIDisplayActionPointsOffX = 10; @@ -4632,6 +4645,9 @@ void SetMovementModeCursor( SOLDIERTYPE *pSoldier ) switch ( pSoldier->usUIMovementMode ) { case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: guiNewUICursor = MOVE_WALK_UICURSOR; break; @@ -4692,6 +4708,9 @@ void SetConfirmMovementModeCursor( SOLDIERTYPE *pSoldier, BOOLEAN fFromMove ) switch ( pSoldier->usUIMovementMode ) { case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: guiNewUICursor = ALL_MOVE_WALK_UICURSOR; break; @@ -4721,6 +4740,9 @@ void SetConfirmMovementModeCursor( SOLDIERTYPE *pSoldier, BOOLEAN fFromMove ) switch ( pSoldier->usUIMovementMode ) { case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: guiNewUICursor = CONFIRM_MOVE_WALK_UICURSOR; break; @@ -4946,7 +4968,7 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos ) // Setting "Last Target" pSoldier->sLastTarget = sXPos + (MAXCOL * sYPos); - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERACTION_INTERRUPT ); return( TRUE ); } @@ -5938,12 +5960,14 @@ BOOLEAN HandleTalkInit( ) ubQuoteNum = QUOTE_NEGATIVE_COMPANY; break; } - +#ifdef JA2UB +// ja25 UB +#else if ( pTSoldier->ubProfile == IRA ) { ubQuoteNum = QUOTE_PASSING_DISLIKE; } - +#endif TacticalCharacterDialogue( pTSoldier, ubQuoteNum ); return( FALSE ); diff --git a/Tactical/Interface Control.cpp b/Tactical/Interface Control.cpp index 4d633d96..f79441a2 100644 --- a/Tactical/Interface Control.cpp +++ b/Tactical/Interface Control.cpp @@ -52,6 +52,13 @@ #include "GameSettings.h" #endif +#include "connect.h" +#include "Text.h" + +#ifdef JA2UB +#include "Dialogue Control.h" +#endif + /* I deleted here declaration of clock coords for tactical screen i will declare them * in functions that Initialize coord for SMPanet and TEAMPanel * any questions? joker @@ -726,38 +733,57 @@ void RenderTopmostTacticalInterface( ) GetSoldierScreenPos( pSoldier, &sMercScreenX, &sMercScreenY ); GetSoldierAnimOffsets( pSoldier, &sOffsetX, &sOffsetY ); - if ( pSoldier->ubBodyType == QUEENMONSTER ) - { - sDamageX = sMercScreenX + pSoldier->sDamageX - pSoldier->sBoundingBoxOffsetX; - sDamageY = sMercScreenY + pSoldier->sDamageY - pSoldier->sBoundingBoxOffsetY; + if ( pSoldier->ubBodyType == QUEENMONSTER ) + { + sDamageX = sMercScreenX + pSoldier->sDamageX - pSoldier->sBoundingBoxOffsetX; + sDamageY = sMercScreenY + pSoldier->sDamageY - pSoldier->sBoundingBoxOffsetY; - sDamageX += 25; - sDamageY += 10; - } - else - { - sDamageX = pSoldier->sDamageX + (INT16)(sMercScreenX + ( 2 * 30 / 3 ) ); - sDamageY = pSoldier->sDamageY + (INT16)(sMercScreenY - 5 ); + sDamageX += 25; + sDamageY += 10; + } + else + { + sDamageX = pSoldier->sDamageX + (INT16)(sMercScreenX + ( 2 * 30 / 3 ) ); + sDamageY = pSoldier->sDamageY + (INT16)(sMercScreenY - 5 ); - sDamageX -= sOffsetX; - sDamageY -= sOffsetY; + sDamageX -= sOffsetX; + sDamageY -= sOffsetY; - if ( sDamageY < gsVIEWPORT_WINDOW_START_Y ) - { - sDamageY = ( sMercScreenY - sOffsetY ); - } - } - - SetFont( TINYFONT1 ); + if ( sDamageY < gsVIEWPORT_WINDOW_START_Y ) + { + sDamageY = ( sMercScreenY - sOffsetY ); + } + } + + SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - - gprintfdirty( sDamageX, sDamageY, L"-%d", pSoldier->sDamage ); - mprintf( sDamageX, sDamageY, L"-%d", pSoldier->sDamage ); + + bool showDamage = true; + if (gGameExternalOptions.ubEnemyHitCount > 0 && pSoldier->bTeam == ENEMY_TEAM || pSoldier->bTeam == CREATURE_TEAM) + showDamage = false; + + if (showDamage) + { + gprintfdirty( sDamageX, sDamageY, L"-%d", pSoldier->sDamage ); + mprintf( sDamageX, sDamageY, L"-%d", pSoldier->sDamage ); + } + else + { + if (gGameExternalOptions.ubEnemyHitCount == 1) + { + gprintfdirty( sDamageX, sDamageY, L"%s", gzHiddenHitCountStr[0]); + mprintf( sDamageX, sDamageY, L"%s", gzHiddenHitCountStr[0]); + } + else + { + gprintfdirty( sDamageX, sDamageY, L""); + mprintf( sDamageX, sDamageY, L""); + } + } } } } - } if ( gusSelectedSoldier != NOBODY ) @@ -1017,6 +1043,9 @@ void EraseInterfaceMenus( BOOLEAN fIgnoreUIUnLock ) PopDownMovementMenu( ); PopDownOpenDoorMenu( ); DeleteTalkingMenu( ); +#ifdef JA2UB + RemoveJerryMiloBrokenLaptopOverlay(); +#endif } diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index 6998f7e3..690d3f7d 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -81,6 +81,23 @@ #include "Overhead.h" #endif +#include "LuaInitNPCs.h" +#include "Text.h" +#include "Luaglobal.h" + + +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "Soldier macros.h" +#include "LOS.h" +#include "Soldier Control.h" +#include "Ja25Update.h" +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -167,6 +184,29 @@ extern void EndGameMessageBoxCallBack( UINT8 ubExitValue ); extern INT32 FindNearestOpenableNonDoor( INT32 sStartGridNo ); extern void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ); +#ifdef JA2UB +//JA25 UB +void PerformJerryMiloAction301(); +void PerformJerryMiloAction302(); +void DelayedMercQuote( UINT16 usProfileID, UINT32 uiQuoteNum, UINT32 uiTimeTillQuoteSaid ); +void DelayedSayingOfMercQuote( UINT32 uiParam ); +void HandleSpecificQuoteWhenLeavingNpcTalkMenu(); +void HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( UINT8 ubNpcProfileID, UINT32 uiQuoteNum ); +void CheckForValidQuotesWhenLeavingDealer( UINT8 ubProfile ); +BOOLEAN IsMineEntranceInSectorI13AtThisGridNo( UINT32 sGridNo ); +void HaveBiggensDetonatingExplosivesByTheMine(); +void ReplaceMineEntranceGraphicWithCollapsedEntrance(); +void HandleCannotAffordNpcMsgBox(); +void CantAffordMercCallback( UINT8 ubExitValue ); +void HandleMercArrivesQuotesFromHeliCrashSequence(); +void HandleRaulBlowingHimselfUp(); +void HandleTexFlushingToilet(); +void HandleTexMakingHimselfAlreadyBeIntroduced(); +void DisplayJerryBreakingLaptopTransmitterPopup(); +void HaveNpcOpenUpDealerScreen( UINT8 ubProfileID ); +void HandleTexBecomingCamoed(); +#endif + UINT8 ubTalkMenuApproachIDs[] = { APPROACH_REPEAT, @@ -212,6 +252,11 @@ INT32 giHospitalTempBalance; // stores amount of money for current doctoring INT32 giHospitalRefund; // stores amount of money given to hospital for doctoring that wasn't used INT8 gbHospitalPriceModifier; // stores discount being offered +#ifdef JA2UB +//ja25 ub +BOOLEAN gfDisplayMsgBoxSayingCantAffordNPC=FALSE; +#endif + enum { HOSPITAL_UNSET = 0, @@ -1677,6 +1722,13 @@ void HandleNPCClosePanel( ) void HandleStuffForNPCEscorted( UINT8 ubNPC ) { + +#ifdef LUA_INTERFACE_DIALOGUE + + LetLuaInterfaceDialogue(ubNPC,0); + +#else + SOLDIERTYPE * pSoldier; switch( ubNPC ) @@ -1723,6 +1775,8 @@ void HandleStuffForNPCEscorted( UINT8 ubNPC ) } break; } + +#endif } void HandleFactForNPCUnescorted( UINT8 ubNPC ) @@ -4044,13 +4098,22 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { // This is not the end, 'cause momma creature is still alive TriggerNPCRecordImmediately( 136, 8 ); +#ifdef JA2UB +//no Ub +#else EndQueenDeathEndgame( ); +#endif + } else { // Continue with endgame cimematic.. DeleteTalkingMenu( ); +#ifdef JA2UB +//no Ub +#else EndQueenDeathEndgameBeginEndCimenatic( ); +#endif } break; @@ -4058,7 +4121,11 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // Just end queen killed dequence....... DeleteTalkingMenu( ); +#ifdef JA2UB +// no UB +#else EndQueenDeathEndgame( ); +#endif break; case NPC_ACTION_MAKE_ESTONI_A_FUEL_SITE: @@ -4308,10 +4375,51 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum TriggerNPCRecord( WALTER, 15 ); } break; +#ifdef JA2UB + //JA25 UB + case NPC_ACTION_TRIGGER_JERRY_CONVERSATION_WITH_PGC_1: + PerformJerryMiloAction301(); + break; + + case NPC_ACTION_TRIGGER_JERRY_CONVERSATION_WITH_PGC_2: + PerformJerryMiloAction302(); + break; + + case NPC_ACTION_BIGGENS_DETONATES_BOMBS: + HaveBiggensDetonatingExplosivesByTheMine(); + break; + + case NPC_ACTION_LEAVING_NPC_TALK_MENU: + HandleSpecificQuoteWhenLeavingNpcTalkMenu(); + break; + + case NPC_ACTION_RAUL_BLOWS_HIMSELF_UP: + HandleRaulBlowingHimselfUp(); + break; + + case NPC_ACTION_TEX_FLUSHES_TOILET: + HandleTexFlushingToilet(); + break; + + case NPC_ACTION_MARK_TEX_AS_ALREADY_INTRODUCED_HIMSELF: + HandleTexMakingHimselfAlreadyBeIntroduced(); + break; + + case NPC_ACTION_MAKE_TEX_CAMOED: + HandleTexBecomingCamoed(); + break; + + case NPC_ACTION_HAVE_DEALER_OPEN_BUY_SELL_SCREEN: + HaveNpcOpenUpDealerScreen( ubTargetNPC ); + break; +#endif default: ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"No code support for NPC action %d", usActionCode ); break; } + + //Lua + // LuaHandleNPCDoAction( ubTargetNPC, usActionCode, ubQuoteNum , 0); } } @@ -4554,6 +4662,36 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) break; case NPC_ACTION_ASK_ABOUT_PAYING_RPC: case NPC_ACTION_ASK_ABOUT_PAYING_RPC_WITH_DAILY_SALARY: + +#ifdef JA2UB + if ( ubExitValue == MSG_BOX_RETURN_YES ) + { + //if the player cannot afford to hire the npc + if( LaptopSaveInfo.iCurrentBalance < gMercProfiles[ubProfile].sSalary ) + { + //Set a flag indicating that you cannot afford the merc + gfDisplayMsgBoxSayingCantAffordNPC = TRUE; + } + else + { + //First Deduct the money out of the players account + AddTransactionToPlayersBook( PAYMENT_TO_NPC, ubProfile, GetWorldTotalMin(), -gMercProfiles[ubProfile].sSalary ); + + TriggerNPCRecord( ubProfile, 1 ); + + //if the person is BIGGENS + if( ubProfile == 61 ) //BIGGENS + { + SetFactTrue( FACT_BIGGENS_IS_ON_TEAM ); + } + } + } + else + { + TriggerNPCRecord( ubProfile, 0 ); + } +#else + if ( ubExitValue == MSG_BOX_RETURN_YES ) { TriggerNPCRecord( ubProfile, 1 ); @@ -4562,6 +4700,7 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) { TriggerNPCRecord( ubProfile, 0 ); } +#endif break; case NPC_ACTION_REDUCE_CONRAD_SALARY_CONDITIONS: if ( ubExitValue == MSG_BOX_RETURN_YES ) @@ -4971,6 +5110,12 @@ void TextRegionClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) void CarmenLeavesSectorCallback( void ) { +#ifdef LUA_INTERFACE_DIALOGUE + + LetLuaInterfaceDialogue(0,0); + +#else + if (gWorldSectorX == 13 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0) { TriggerNPCRecord( 78, 34 ); @@ -4983,5 +5128,582 @@ void CarmenLeavesSectorCallback( void ) { TriggerNPCRecord( 78, 36 ); } - +#endif } + +#ifdef JA2UB +//JA25 UB + + +void PerformJerryMiloAction301() +{ + UINT8 ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES]; + INT8 bNumMercsPresent=-1; + SOLDIERTYPE *pSoldier=NULL; + INT32 cnt; + UINT8 ubId; + + //Get the number and array of the new soldiers + bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubMercsPresent, NULL ); + + +//Randomly choose one +/* //if there is at least 1 of the desired mercs found + if( bNumMercsPresent != -1 ) + { + ubId = ubMercsPresent[ Random( bNumMercsPresent ) ]; + + pSoldier = MercPtrs[ ubId ]; + + TacticalCharacterDialogue( pSoldier, QUOTE_DEATH_RATE_REFUSAL ); + } +*/ + //Have them all say their quote + + for( cnt=0; cntubProfile; + else + { + BOOLEAN fDone=FALSE; + + while( !fDone ) + { + ubProfileID = Random( bNumMercsPresent ); + + if( ubProfileID != ubIdOfMercWhoSaidQuote ) + { + ubId = ubMercsPresent[ ubProfileID ]; + fDone = TRUE; + } + } + + ubProfileID = MercPtrs[ ubId ]->ubProfile; + } + + //Say the quote in 15 seconds + DelayedMercQuote( ubProfileID, QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE, GetWorldTotalSeconds( ) + 15 ); + + } + + //handle the merc arrives quotes now + HandleMercArrivesQuotesFromHeliCrashSequence(); + + //Set the fact that we should show the destination dialog + gJa25SaveStruct.fShowMercDestinationDialogWhenHiringMerc = TRUE; + + //Close the dialogue panel + DeleteTalkingMenu(); +} + +void DelayedMercQuote( UINT16 usProfileID, UINT32 uiQuoteNum, UINT32 uiTimeTillQuoteSaid ) +{ + UINT32 uiParam; + + uiParam = usProfileID + ( uiQuoteNum << 16 ); + + AddStrategicEventUsingSeconds( EVENT_SAY_DELAYED_MERC_QUOTE, uiTimeTillQuoteSaid, uiParam ); +} + +void DelayedSayingOfMercQuote( UINT32 uiParam ) +{ + SOLDIERTYPE *pSoldier=NULL; + UINT16 usProfileID; + UINT16 usQuoteNum; + + usProfileID = 0x0000FFFF & uiParam; + usQuoteNum = uiParam >> 16; + + //if its a normal quote + if( usQuoteNum < DQ__NORMAL_DELAYED_QUOTE ) + { + //Get the soldier that should say the quote + pSoldier = FindSoldierByProfileID( (UINT8)usProfileID, FALSE ); + if( pSoldier == NULL ) + return; + + // + // Do Quote specific code here + // + if( usQuoteNum == QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE ) + { + //if the soldier is saying the 'brr its cold' quote, and he has left the sector + if( pSoldier->sSectorX != JA2_5_START_SECTOR_X || pSoldier->sSectorY != JA2_5_START_SECTOR_Y && pSoldier->bSectorZ != 0 ) + { + //dont say the quote + return; + } + } + + //Say the quote + TacticalCharacterDialogue( pSoldier, usQuoteNum ); + } + else + { + switch( usQuoteNum ) + { + case DQ__JERRY_BROKE_TRANSMITTER: + //Display the popup saying Jerry broke the transmitter + DisplayJerryBreakingLaptopTransmitterPopup(); + break; + + case DQ__MORRIS_NOTE_NEW_MERC_DELAY: + HandleCommanderMorrisNewMercWantsNoteDelayedSpeech(); + break; + + case DQ__MORRIS_NOTE_DISPLAY_NOTE_1: + case DQ__MORRIS_NOTE_DISPLAY_NOTE_2: + { + //Get the soldier that should say the quote + pSoldier = FindSoldierByProfileID( (UINT8)usProfileID, FALSE ); + if( pSoldier == NULL ) + return; + + DisplayCommanderMorrisNote( pSoldier ); + } + break; + + case DQ__SHOW_RADIO_LOCATOR: + BeginMultiPurposeLocator( usProfileID, 0, TRUE ); + break; + + case DQ__NEW_MERC_SAY_NOTE_QUOTES: + //Get the soldier that should say the quote + pSoldier = FindSoldierByProfileID( (UINT8)usProfileID, FALSE ); + if( pSoldier == NULL ) + return; + + HandleNewMercSayingContentsOfMorrisNote( pSoldier ); + break; + + case DQ__START_EVERYONE_TALKING_AT_END_OF_GAME: + EndGameEveryoneSayTheirGoodByQuotes(); + break; + + case DQ__FADE_OUT_TO_END_GAME_CINEMATIC: + HandleFadingOutToEndGameCinematics(); + break; + } + } +} + +void HandleSpecificQuoteWhenLeavingNpcTalkMenu() +{ + SetFactTrue( FACT_MERC_SAY_QUOTE_WHEN_TALK_MENU_CLOSES ); +} + +void HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( UINT8 ubNpcProfileID, UINT32 uiQuoteNum ) +{ + INT8 bNumMercsPresent=-1; + UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + UINT8 ValidSoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES] = {0}; + UINT8 ubNumValidSoldiers=0; + UINT8 ubCnt; + SOLDIERTYPE *pSoldier=NULL; + SOLDIERTYPE * pNPC; + + pNPC = FindSoldierByProfileID( ubNpcProfileID, FALSE ); + if( pNPC == NULL ) + { + return; + } + + //Get the number and array of the new soldiers + bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL ); + + //if the player doesnt have any qualified players on the team + if( bNumMercsPresent == -1 ) + { + return; + } + + + //loop through the mercs and see if there in range of the dealer + for( ubCnt=0; ubCntsGridNo, pSoldier->sGridNo ) < 10 && !AM_AN_EPC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pSoldier )) && !pSoldier->flags.fMercAsleep && + SoldierTo3DLocationLineOfSightTest( pSoldier, pNPC->sGridNo, 0, 0, (UINT8)MaxDistanceVisible(), TRUE ) ) + { + ValidSoldierIdArray[ ubNumValidSoldiers ] = pSoldier->ubID; + ubNumValidSoldiers++; + } + } + + //If there is a valid merc, pick a merc to say the quote + if( ubNumValidSoldiers > 0 ) + { + UINT8 ubChosenMerc = (UINT8)Random( ubNumValidSoldiers ); + TacticalCharacterDialogue( MercPtrs[ ValidSoldierIdArray[ ubChosenMerc ] ], (UINT16)uiQuoteNum ); + } + + SetFactFalse( FACT_MERC_SAY_QUOTE_WHEN_TALK_MENU_CLOSES ); +} + +void CheckForValidQuotesWhenLeavingDealer( UINT8 ubProfile ) +{ + //if the user is going to the dealer + if( gTalkPanel.bCurSelect != -1 && ubTalkMenuApproachIDs[ gTalkPanel.bCurSelect ] == APPROACH_BUYSELL ) + { + return; + } + + //if their scripting event going on, leave + if( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) + { + return; + } + + + if( CheckFact( FACT_MERC_SAY_QUOTE_WHEN_TALK_MENU_CLOSES, 0 ) ) + { + switch( ubProfile ) + { + case 73 : //BETTY: + HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( ubProfile, QUOTE_JOINING_CAUSE_BUDDY_1_ON_TEAM ); + break; + + case 74 : //RAUL: + //if the Raul is about to blow himself up + if( !IsJa25GeneralFlagSet( JA_GF__RAUL_BLOW_HIMSELF_UP ) ) + { + //we can say the quote + HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( ubProfile, QUOTE_JOINING_CAUSE_BUDDY_2_ON_TEAM ); + } + break; + + case 77: //RUDY: + HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( ubProfile, QUOTE_REFUSAL_RENEW_DUE_TO_MORALE ); + break; + + default: + AssertMsg( 0, "Code has not been implemented to handle saying a quote when leaving this NPC" ); + } + } +} + + +// This function checks if we should replace the mine entrance graphic +BOOLEAN IsMineEntranceInSectorI13AtThisGridNo( UINT32 sGridNo ) +{ + // First check current sector...... + if( gWorldSectorX == 13 && gWorldSectorY == MAP_ROW_I && gbWorldSectorZ == 0 ) + { + //if this is the right gridno + if( sGridNo == 12421 ) + { + return( TRUE ); + } + } + + return( FALSE ); +} + +void HaveBiggensDetonatingExplosivesByTheMine() +{ + SOLDIERTYPE *pSoldier = NULL; + UINT8 ubID=NOBODY; + + pSoldier = FindSoldierByProfileID( 61 , FALSE ); //BIGGENS + if( pSoldier != NULL ) + { + ubID = pSoldier->ubID; + } + //Have Biggens Triger the bombs by the cave wall + SetOffBombsByFrequency( ubID, FIRST_MAP_PLACED_FREQUENCY + 1 ); +} + +void ReplaceMineEntranceGraphicWithCollapsedEntrance() +{ + UINT16 usTileIndex; + UINT32 usGridNo=12745; + + //Make sure wed ont blow things up twice + //off + if( gJa25SaveStruct.fBiggensUsedDetonator ) + return; + + //Remeber that biggens detonated the explosives + gJa25SaveStruct.fBiggensUsedDetonator = TRUE; + + // Turn on permenant changes.... + ApplyMapChangesToMapTempFile( TRUE ); + + // Remove it! + // Get index for it... + GetTileIndexFromTypeSubIndex( FIRSTOSTRUCT, (INT8)( 1 ), &usTileIndex ); + + AddStructToHead( usGridNo, usTileIndex ); + + //remove the exit grid from the world + RemoveExitGridFromWorld( 12422 ); + RemoveExitGridFromWorld( 12423 ); + AddRemoveExitGridToUnloadedMapTempFile( 12422, 13, MAP_ROW_I, 0 ); + AddRemoveExitGridToUnloadedMapTempFile( 12423, 13, MAP_ROW_I, 0 ); + + gpWorldLevelData[ usGridNo ].uiFlags |= MAPELEMENT_REVEALED; + + + // Re-render the world! + gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; + + // FOR THE NEXT RENDER LOOP, RE-EVALUATE REDUNDENT TILES + InvalidateWorldRedundency( ); + SetRenderFlags(RENDER_FLAG_FULL); + + // Redo movement costs.... + RecompileLocalMovementCostsFromRadius( usGridNo, 5 ); + + + + + // + // Apply changes to the underground mine + // + + //Remove the old tunnel pieces first + + //First half of entrance + usGridNo = 13057; + + // Get index for it... + GetTileIndexFromTypeSubIndex( FIRSTDECORATIONS, (INT8)( 1 ), &usTileIndex ); + + RemoveStructFromUnLoadedMapTempFile( usGridNo, usTileIndex, 13, MAP_ROW_I, 1 ); + + // Get index for it... + GetTileIndexFromTypeSubIndex( FIRSTDECORATIONS, (INT8)( 5 ), &usTileIndex ); + + //Apply changes + AddStructToUnLoadedMapTempFile( usGridNo, usTileIndex, 13, MAP_ROW_I, 1 ); + + + + // 2nd half of entrance + usGridNo = 12897; + + // Get index for it... + GetTileIndexFromTypeSubIndex( FIRSTDECORATIONS, (INT8)( 2 ), &usTileIndex ); + + RemoveStructFromUnLoadedMapTempFile( usGridNo, usTileIndex, 13, MAP_ROW_I, 1 ); + + // Get index for it... + GetTileIndexFromTypeSubIndex( FIRSTDECORATIONS, (INT8)( 6 ), &usTileIndex ); + + //Apply changes + AddStructToUnLoadedMapTempFile( usGridNo, usTileIndex, 13, MAP_ROW_I, 1 ); + + //Remove the exit grid + AddRemoveExitGridToUnloadedMapTempFile( usGridNo, 13, MAP_ROW_I, 1 ); + + // Turn off permenant changes.... + ApplyMapChangesToMapTempFile( FALSE ); +} + +void HandleCannotAffordNpcMsgBox() +{ +// CHAR16 zString[512]; + if( !gfDisplayMsgBoxSayingCantAffordNPC ) + { + return; + } + + //display a msg box saying cant afford merc +// swprintf( zString, zNewTacticalMessages[ TACT_MSG__CANNOT_AFFORD_MERC ], gMercProfiles[ 61 ].zNickname ); //BIGGENS +// DoMessageBox( MSG_BOX_BASIC_STYLE, zString, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, CantAffordMercCallback, NULL ); + + gfDisplayMsgBoxSayingCantAffordNPC = FALSE; +} + +void CantAffordMercCallback( UINT8 ubExitValue ) +{ + //Make the RPC say a quote + TriggerNPCRecord( 61, 0 ); //BIGGENS +} + +void HandleMercArrivesQuotesFromHeliCrashSequence() +{ + UINT32 uiCnt; + SOLDIERTYPE *pSoldier=NULL; + + uiCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; uiCnt++,pSoldier++) + { + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector ) + { + HandleMercArrivesQuotes( pSoldier ); + } + } +} + +void HandleRaulBlowingHimselfUp() +{ + SOLDIERTYPE *pSoldier=NULL; + UINT16 usItem=0; + + //Find Raul + pSoldier = FindSoldierByProfileID( 74, FALSE ); + + //if he exists + if( pSoldier ) + { + //First lower his life, artificially + pSoldier->stats.bLife = 5; + + //blow himself up with, hmmm, lets say TNT. :) + usItem = HAND_GRENADE; + IgniteExplosion( 74, CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, usItem, pSoldier->pathing.bLevel ); + + SetJa25GeneralFlag( JA_GF__RAUL_BLOW_HIMSELF_UP ); + } +} + +void HandleTexFlushingToilet() +{ + PlayJA2SampleFromFile( "SOUNDS\\ToiletFlush.wav", RATE_11025, HIGHVOLUME, 1, MIDDLE ); +} + +void HandleTexMakingHimselfAlreadyBeIntroduced() +{ + gMercProfiles[ 64 ].ubLastDateSpokenTo = GetWorldDay( ); +} + +void HandleTexBecomingCamoed() +{ + SOLDIERTYPE *pSoldier=NULL; + + //Find TEX + pSoldier = FindSoldierByProfileID( 64, FALSE ); + + //if we found him + if( pSoldier != NULL ) + { + //make him camoed + pSoldier->bCamo = 100; + pSoldier->CreateSoldierPalettes( ); + } + + //Then set him to be camo'ed in the profile ( cause he is still an RPC and we are just about to hire him ) + // SANDRO - old/new traits check (I am not sure if this is used at all) + if ( gGameOptions.fNewTraitSystem ) + { + gMercProfiles[ 64 ].bSkillTraits[0] = RANGER_NT; + } + else + { + gMercProfiles[ 64 ].bSkillTraits[0] = CAMOUFLAGED_OT; + } + + //Close down the talking menu... + DeleteTalkingMenu( ); + +// InitTalkingMenu( pSoldier->ubProfile, pSoldier->sGridNo ); + + // Trigger Tex to say the quote, this will cause the radio locater to come up giving a pause to make it appear that he + // put on camoflauge + TriggerNPCRecord( 64, 15 ); +} + +void DisplayJerryBreakingLaptopTransmitterPopup() +{ + CHAR16 zString[512]; + INT8 bID=-1; + UINT32 uiStartLoc=0; + + #define LANGMESSAGEFILE "BinaryData\\TacticalMessages.EDT" + #define EDT_SIZE 400 * 2 + + + if( gJa25SaveStruct.fJerryBreakingLaptopOccuring ) + { + return; + } + + //get a random ID for a mercs name + bID = RandomSoldierIdForAnyMercInSector(); + + if( bID == -1 ) + { + //Assert( 0 ); + return; + } +/* + if ( FileExists(LANGMESSAGEFILE) ) + { + + uiStartLoc = EDT_SIZE * 10; + LoadEncryptedDataFromFile(LANGMESSAGEFILE, sText, uiStartLoc, EDT_SIZE); + + swprintf( zString, sText, Menptr[ bID ].name ); + } + else + { + //Create the string + swprintf( zString, zNewTacticalMessages[ TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA ], Menptr[ bID ].name ); + } +*/ + #ifdef UBMODSHADYJOB //See file builddefines.h + swprintf( zString, XMLTacticalMessages[0] ); //Shady Job + #else + swprintf( zString, zNewTacticalMessages[TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA], Menptr[ bID ].name ); //UB + #endif + + + //Display it + ExecuteTacticalTextBox( 110, zString ); + + gJa25SaveStruct.fJerryBreakingLaptopOccuring = TRUE; +} + +void HaveNpcOpenUpDealerScreen( UINT8 ubProfileID ) +{ + DeleteTalkingMenu( ); + + //Enter the shopkeeper interface + EnterShopKeeperInterfaceScreen( gTalkPanel.ubCharNum ); +} +#endif diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index af8d37fe..e7acebc9 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -81,6 +81,12 @@ // BOB : quick attachment popup #include "popup_class.h" #endif + +#ifdef JA2UB +#include "Ja25_Tactical.h" +#endif + + //////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - all "APBPConstants[AP_PICKUP_ITEM]" were replaced by GetBasicAPsToPickupItem() //////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1278,15 +1284,15 @@ BOOLEAN InitInvSlotInterface( INV_REGION_DESC *pRegionDesc , INV_REGION_DESC *pC // Kaiden: Vehicle Inventory change - Added two new STI's for Vehicle Inventory // Feel free to change them to more appropriate pictures, I just blanked out // the body image for now, I'm no graphics artist. - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\inventory_figure_Vehicle.sti", -VObjectDesc.ImageFile); - CHECKF( AddVideoObject( &VObjectDesc, &(guiBodyInvVO[ 4 ][ 0 ] ) ) ); + //VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\inventory_figure_Vehicle.sti", + //VObjectDesc.ImageFile); + //CHECKF( AddVideoObject( &VObjectDesc, &(guiBodyInvVO[ 4 ][ 0 ] ) ) ); - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\inventory_figure_Vehicle_h.sti", -VObjectDesc.ImageFile); - CHECKF( AddVideoObject( &VObjectDesc, &(guiBodyInvVO[ 4 ][ 1 ] ) ) ); + //VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\inventory_figure_Vehicle_h.sti", + //VObjectDesc.ImageFile); + //CHECKF( AddVideoObject( &VObjectDesc, &(guiBodyInvVO[ 4 ][ 1 ] ) ) ); // add gold key graphic VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; @@ -1410,12 +1416,12 @@ void ShutdownInvSlotInterface( ) DeleteVideoObjectFromIndex( guiBodyInvVO[ 2 ][ 0 ] ); DeleteVideoObjectFromIndex( guiBodyInvVO[ 1 ][ 0 ] ); DeleteVideoObjectFromIndex( guiBodyInvVO[ 3 ][ 0 ] ); - DeleteVideoObjectFromIndex( guiBodyInvVO[ 4 ][ 0 ] ); + //DeleteVideoObjectFromIndex( guiBodyInvVO[ 4 ][ 0 ] ); DeleteVideoObjectFromIndex( guiBodyInvVO[ 0 ][ 1 ] ); DeleteVideoObjectFromIndex( guiBodyInvVO[ 2 ][ 1 ] ); DeleteVideoObjectFromIndex( guiBodyInvVO[ 1 ][ 1 ] ); DeleteVideoObjectFromIndex( guiBodyInvVO[ 3 ][ 1 ] ); - DeleteVideoObjectFromIndex( guiBodyInvVO[ 4 ][ 1 ] ); + //DeleteVideoObjectFromIndex( guiBodyInvVO[ 4 ][ 1 ] ); DeleteVideoObjectFromIndex( guiGoldKeyVO ); @@ -1441,7 +1447,7 @@ void RenderInvBodyPanel( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY ) // the original statement if ( (gGameExternalOptions.fVehicleInventory) && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiBodyInvVO[4][0], 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + //BltVideoObjectFromIndex( guiSAVEBUFFER, guiBodyInvVO[4][0], 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); } else { @@ -2487,7 +2493,7 @@ void DegradeNewlyAddedItems( ) { guiNewlyPlacedItemTimer = uiTime; - for ( cnt2 = 0; cnt2 < NUM_TEAM_SLOTS; cnt2++ ) + for ( cnt2 = 0; cnt2 < gGameOptions.ubSquadSize; cnt2++ ) { // GET SOLDIER if ( gTeamPanel[ cnt2 ].fOccupied ) @@ -6738,8 +6744,8 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) } // Charge AP values... - DeductPoints( pSoldier, 3, 0 ); - DeductPoints( gpItemPointerSoldier, 3, 0 ); + DeductPoints( pSoldier, 3, 0, UNTRIGGERED_INTERRUPT ); + DeductPoints( gpItemPointerSoldier, 3, 0, UNTRIGGERED_INTERRUPT ); usItem = gpItemPointer->usItem; @@ -7709,6 +7715,21 @@ BOOLEAN LoadTileGraphicForItem( INVTYPE *pItem, UINT32 *puiVo ) sprintf( zName, "p2item%d", ubGraphic ); } } +/* +#ifdef JA2UB + else if ( pItem->ubGraphicType == 9 ) // UB Items + { + if ( ubGraphic < 10 ) + { + sprintf( zName, "GUN_UB0%d", ubGraphic ); + } + else + { + sprintf( zName, "GUN_UB%d", ubGraphic ); + } + } +#endif +*/ else { if ( ubGraphic < 10 ) diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 696105ce..e6682aef 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3363,11 +3363,11 @@ BOOLEAN UIHandleItemPlacement( UINT8 ubHandPos, UINT16 usOldItemIndex, UINT16 us // Deduct points if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0, UNTRIGGERED_INTERRUPT ); } if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpSMCurrentMerc, 2, 0 ); + DeductPoints( gpSMCurrentMerc, 2, 0, UNTRIGGERED_INTERRUPT ); } } @@ -4725,11 +4725,11 @@ BOOLEAN InitializeTEAMPanelCoords( ) TM_APPANEL_HEIGHT = 56; TM_APPANEL_WIDTH = 16; - TM_ENDTURN_X = (SCREEN_WIDTH - 133); //( 507 + INTERFACE_START_X ); + TM_ENDTURN_X = (SCREEN_WIDTH - 131); //( 507 + INTERFACE_START_X ); TM_ENDTURN_Y = ( 9 + INTERFACE_START_Y ); - TM_ROSTERMODE_X = (SCREEN_WIDTH - 133); //( 507 + INTERFACE_START_X ); + TM_ROSTERMODE_X = (SCREEN_WIDTH - 131); //( 507 + INTERFACE_START_X ); TM_ROSTERMODE_Y = ( 45 + INTERFACE_START_Y ); - TM_DISK_X = (SCREEN_WIDTH - 133); //( 507 + INTERFACE_START_X ); + TM_DISK_X = (SCREEN_WIDTH - 131); //( 507 + INTERFACE_START_X ); TM_DISK_Y = ( 81 + INTERFACE_START_Y ); TM_NAME_WIDTH = 60; @@ -4882,17 +4882,38 @@ BOOLEAN InitializeTEAMPanel( ) VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - if (iResolution == 0) + //SQUAD10 FIX: Use panels with more slots if SquadSize at current resolution is > 6 + switch (iResolution) { - FilenameForBPP("INTERFACE\\bottom_bar.sti", VObjectDesc.ImageFile); - } - else if (iResolution == 1) - { - FilenameForBPP("INTERFACE\\bottom_bar_800x600.sti", VObjectDesc.ImageFile); - } - else if (iResolution == 2) - { - FilenameForBPP("INTERFACE\\bottom_bar_1024x768.sti", VObjectDesc.ImageFile); + case 0: + FilenameForBPP("INTERFACE\\bottom_bar.sti", VObjectDesc.ImageFile); + break; + case 1: + if (gGameOptions.ubSquadSize > 6) + { + FilenameForBPP("INTERFACE\\bottom_bar_8_800x600.sti", VObjectDesc.ImageFile); + } + else + { + FilenameForBPP("INTERFACE\\bottom_bar_800x600.sti", VObjectDesc.ImageFile); + } + break; + case 2: + if (gGameOptions.ubSquadSize > 8) + { + FilenameForBPP("INTERFACE\\bottom_bar_10_1024x768.sti", VObjectDesc.ImageFile); + } + else if (gGameOptions.ubSquadSize > 6) + { + FilenameForBPP("INTERFACE\\bottom_bar_8_1024x768.sti", VObjectDesc.ImageFile); + } + else + { + FilenameForBPP("INTERFACE\\bottom_bar_1024x768.sti", VObjectDesc.ImageFile); + } + break; + default: + FilenameForBPP("INTERFACE\\bottom_bar.sti", VObjectDesc.ImageFile); } CHECKF( AddVideoObject( &VObjectDesc, &guiTEAMPanel ) ); @@ -4919,7 +4940,7 @@ BOOLEAN InitializeTEAMPanel( ) // Add region MSYS_AddRegion( &gTEAM_PanelRegion); - for ( posIndex = 0, cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++, posIndex +=2 ) + for ( posIndex = 0, cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++, posIndex +=2 ) { MSYS_DefineRegion( &gTEAM_FaceRegions[ cnt ], sTEAMFacesXY[ posIndex ], sTEAMFacesXY[ posIndex + 1 ] ,(INT16)(sTEAMFacesXY[ posIndex ] + TM_FACE_WIDTH ), (INT16)(sTEAMFacesXY[ posIndex + 1 ] + TM_FACE_HEIGHT), MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MercFacePanelMoveCallback, MercFacePanelCallback ); @@ -5056,7 +5077,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) RestoreExternBackgroundRect( INTERFACE_START_X, INTERFACE_START_Y, SCREEN_WIDTH - INTERFACE_START_X , INTERFACE_HEIGHT ); // LOOP THROUGH ALL MERCS ON TEAM PANEL - for ( cnt = 0, posIndex = 0; cnt < NUM_TEAM_SLOTS; cnt++, posIndex+= 2 ) + for ( cnt = 0, posIndex = 0; cnt < gGameOptions.ubSquadSize; cnt++, posIndex+= 2 ) { // GET SOLDIER if ( !gTeamPanel[ cnt ].fOccupied ) @@ -5180,7 +5201,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) } // Loop through all mercs and make go - for ( cnt = 0, posIndex = 0; cnt < NUM_TEAM_SLOTS; cnt++, posIndex+= 2 ) + for ( cnt = 0, posIndex = 0; cnt < gGameOptions.ubSquadSize; cnt++, posIndex+= 2 ) { // GET SOLDIER if ( gTeamPanel[ cnt ].fOccupied ) @@ -6345,7 +6366,7 @@ BOOLEAN PlayerExistsInSlot( UINT8 ubID ) { INT32 cnt; - for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++ ) { if ( gTeamPanel[ cnt ].fOccupied ) { @@ -6364,7 +6385,7 @@ INT8 GetTeamSlotFromPlayerID( UINT8 ubID ) { INT8 cnt; - for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++ ) { if ( gTeamPanel[ cnt ].fOccupied ) { @@ -6383,7 +6404,7 @@ BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT8 ubMercID ) { INT32 cnt; - for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++ ) { if ( gTeamPanel[ cnt ].fOccupied ) { @@ -6412,7 +6433,7 @@ void AddPlayerToInterfaceTeamSlot( UINT8 ubID ) if ( !PlayerExistsInSlot( ubID ) ) { // Find a free slot - for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++ ) { if ( !gTeamPanel[ cnt ].fOccupied ) { @@ -6438,7 +6459,7 @@ BOOLEAN InitTEAMSlots( ) { INT32 cnt; - for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++ ) { gTeamPanel[ cnt ].fOccupied = FALSE; gTeamPanel[ cnt ].ubID = NOBODY; @@ -6451,7 +6472,7 @@ BOOLEAN InitTEAMSlots( ) BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT8 *pubID ) { - if ( ubPanelSlot >= NUM_TEAM_SLOTS ) + if ( ubPanelSlot >= gGameOptions.ubSquadSize ) { return( FALSE ); } @@ -6471,7 +6492,7 @@ void RemoveAllPlayersFromSlot( ) { int cnt; - for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = 0; cnt < gGameOptions.ubSquadSize; cnt++ ) { RemovePlayerFromInterfaceTeamSlot( (UINT8)cnt ); } @@ -6480,7 +6501,7 @@ void RemoveAllPlayersFromSlot( ) BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubPanelSlot ) { - if ( ubPanelSlot >= NUM_TEAM_SLOTS ) + if ( ubPanelSlot >= gGameOptions.ubSquadSize ) { return( FALSE ); } @@ -6623,7 +6644,7 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife return( pSoldier->ubID ); } - for ( cnt = ( bFirstID + 1 ); cnt < NUM_TEAM_SLOTS; cnt++ ) + for ( cnt = ( bFirstID + 1 ); cnt < gGameOptions.ubSquadSize; cnt++ ) { if ( gTeamPanel[ cnt ].fOccupied ) { @@ -7004,11 +7025,11 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Deduct points if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0, UNTRIGGERED_INTERRUPT ); } if ( gpItemPopupSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPopupSoldier, 2, 0 ); + DeductPoints( gpItemPopupSoldier, 2, 0, UNTRIGGERED_INTERRUPT ); } } @@ -7047,11 +7068,11 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Deduct points if ( gpItemPointerSoldier && gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0, UNTRIGGERED_INTERRUPT ); } if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpSMCurrentMerc, 2, 0 ); + DeductPoints( gpSMCurrentMerc, 2, 0, UNTRIGGERED_INTERRUPT ); } } diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 7e98e1de..dbc95584 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -34,7 +34,7 @@ typedef enum #define NEW_ITEM_CYCLE_COUNT 19 #define NEW_ITEM_CYCLES 4 -#define NUM_TEAM_SLOTS 6 +#define NUM_TEAM_SLOTS 10 #define PASSING_ITEM_DISTANCE_OKLIFE 3 diff --git a/Tactical/Interface Utils.cpp b/Tactical/Interface Utils.cpp index fe75ee35..1c48e76b 100644 --- a/Tactical/Interface Utils.cpp +++ b/Tactical/Interface Utils.cpp @@ -58,7 +58,9 @@ enum{ }; // the ids for the car portraits -INT32 giCarPortraits[ 4 ] = { -1, -1, -1, -1 }; +//INT32 giCarPortraits[ 4 ] = { -1, -1, -1, -1 }; + +INT32 giCarPortraits[ NUM_PROFILES ]; // the car portrait file names STR pbCarPortraitFileNames[ ]={ @@ -74,17 +76,31 @@ BOOLEAN LoadCarPortraitValues( void ) { INT32 iCounter = 0; VOBJECT_DESC VObjectDesc; - + + /* if( giCarPortraits[ 0 ] != -1 ) { return FALSE; } + */ + + for( iCounter = 0; iCounter < NUM_PROFILES; iCounter++ ) + { + if ( gProfilesVehicle[ iCounter ].ProfilId == iCounter ) + { + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy( VObjectDesc.ImageFile, gNewVehicle[ iCounter ].szIconFace ); + CHECKF( AddVideoObject( &VObjectDesc, (UINT32 *)&giCarPortraits[ iCounter ] ) ); + } + } + + /* for( iCounter = 0; iCounter < NUMBER_CAR_PORTRAITS; iCounter++ ) { VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( VObjectDesc.ImageFile, pbCarPortraitFileNames[ iCounter ] ); CHECKF( AddVideoObject( &VObjectDesc, (UINT32 *)&giCarPortraits[ iCounter ] ) ); - } + }*/ return( TRUE ); } @@ -94,15 +110,27 @@ void UnLoadCarPortraits( void ) INT32 iCounter = 0; // car protraits loaded? + /* if( giCarPortraits[ 0 ] == -1 ) { return; } + for( iCounter = 0; iCounter < NUMBER_CAR_PORTRAITS; iCounter++ ) { DeleteVideoObjectFromIndex( giCarPortraits[ iCounter ] ); giCarPortraits[ iCounter ] = -1; } + */ + + for( iCounter = 0; iCounter < NUM_PROFILES; iCounter++ ) + { + if ( gProfilesVehicle[ iCounter ].ProfilId == iCounter ) + { + DeleteVideoObjectFromIndex( giCarPortraits[ iCounter ] ); + } + } + return; } @@ -444,7 +472,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLEAN fAutoFace ) { BOOLEAN fDoFace = FALSE; - UINT8 ubVehicleType = 0; +// UINT8 ubVehicleType = 0; if ( pSoldier->bActive ) @@ -453,10 +481,11 @@ void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLE if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // get the type of vehicle - ubVehicleType = pVehicleList[ pSoldier->bVehicleID ].ubVehicleType; +// ubVehicleType = pVehicleList[ pSoldier->bVehicleID ].ubVehicleType; // just draw the vehicle - BltVideoObjectFromIndex( guiSAVEBUFFER, giCarPortraits[ ubVehicleType ], 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); +// BltVideoObjectFromIndex( guiSAVEBUFFER, giCarPortraits[ ubVehicleType ], 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( guiSAVEBUFFER, giCarPortraits[ pSoldier->ubProfile ], 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( sFaceX, sFaceY, FACE_WIDTH, FACE_HEIGHT ); return; diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index bd93092c..e3772619 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -64,6 +64,16 @@ #endif #include "InterfaceItemImages.h" +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "mercs.h" +#include "ub_config.h" +#endif #include "connect.h" //const UINT32 INTERFACE_START_X = 0; @@ -1888,7 +1898,8 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) //Legion if (pSoldier->ubBodyType == TANK_NE || pSoldier->ubBodyType == TANK_NW) { - swprintf( NameStr, pVehicleStrings[4] ); + swprintf( NameStr, gNewVehicle[164].NewVehicleStrings ); + //swprintf( NameStr, pVehicleStrings[4] ); } else if (zHiddenNames[pSoldier->ubProfile].Hidden == TRUE) { @@ -1925,7 +1936,8 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) //Legion if (pSoldier->ubBodyType == TANK_NE || pSoldier->ubBodyType == TANK_NW) { - swprintf( NameStr, pVehicleStrings[4] ); + //swprintf( NameStr, pVehicleStrings[4] ); + swprintf( NameStr, gNewVehicle[164].NewVehicleStrings ); } else if (zHiddenNames[pSoldier->ubProfile].Hidden == TRUE) { @@ -3840,11 +3852,47 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) { // OK, set cancle code! gOpenDoorMenu.fMenuHandled = 2; +#ifdef JA2UB + //Handle someone trying to open the door in the tunnel gate` + HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( gOpenDoorMenu.pSoldier, FALSE ); //Ja25 UB +#endif } // Switch on command.... if ( uiBtnID == iActionIcons[ OPEN_DOOR_ICON ] ) { +#ifdef JA2UB + //Handle someone trying to open the door in the tunnel gate` + if( HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( gOpenDoorMenu.pSoldier, TRUE ) ) //Ja25 UB + { + // OK, set cancle code! + gOpenDoorMenu.fMenuHandled = 2; + } + else + { + // Open door normally... + // Check APs + if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_OPEN_DOOR], APBPConstants[BP_OPEN_DOOR], FALSE ) ) + { + // Set UI + SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + + if ( gOpenDoorMenu.fClosingDoor ) + { + gOpenDoorMenu.pSoldier->ChangeSoldierState( GetAnimStateForInteraction( gOpenDoorMenu.pSoldier, TRUE, CLOSE_DOOR ), 0 , FALSE ); + } + else + { + InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_OPEN ); + } + } + else + { + // OK, set cancel code! + gOpenDoorMenu.fMenuHandled = 2; + } + } +#else // Open door normally... // Check APs // SANDRO - changed APs for opening dorrs calc @@ -3867,6 +3915,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) // OK, set cancel code! gOpenDoorMenu.fMenuHandled = 2; } +#endif } if ( uiBtnID == iActionIcons[ BOOT_DOOR_ICON ] ) @@ -3939,6 +3988,30 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ EXPLOSIVE_DOOR_ICON ] ) { +#ifdef JA2UB + //Handle someone trying to open the door in the tunnel gate` + if( HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( gOpenDoorMenu.pSoldier, TRUE ) ) //Ja25 UB + { + // OK, set cancle code! + gOpenDoorMenu.fMenuHandled = 2; + } + else + { + // Explode + if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_EXPLODE_DOOR], APBPConstants[BP_EXPLODE_DOOR], FALSE ) ) + { + // Set UI + SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + + InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_EXPLODE ); + } + else + { + // OK, set cancle code! + gOpenDoorMenu.fMenuHandled = 2; + } + } +#else // Explode if ( EnoughPoints( gOpenDoorMenu.pSoldier, GetAPsToBombDoor( gOpenDoorMenu.pSoldier ), APBPConstants[BP_EXPLODE_DOOR], FALSE ) ) // SANDRO { @@ -3952,6 +4025,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) // OK, set cancle code! gOpenDoorMenu.fMenuHandled = 2; } +#endif } if ( uiBtnID == iActionIcons[ UNTRAP_DOOR_ICON ] ) @@ -3973,6 +4047,30 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ USE_CROWBAR_ICON ] ) { +#ifdef JA2UB + //Handle someone trying to open the door in the tunnel gate` + if( HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( gOpenDoorMenu.pSoldier, TRUE ) ) //JA25 UB + { + // OK, set cancle code! + gOpenDoorMenu.fMenuHandled = 2; + } + else + { + // Explode + if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_USE_CROWBAR], APBPConstants[BP_USE_CROWBAR], FALSE ) ) + { + // Set UI + SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + + InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_CROWBAR ); + } + else + { + // OK, set cancle code! + gOpenDoorMenu.fMenuHandled = 2; + } + } +#else // Explode if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_USE_CROWBAR], APBPConstants[BP_USE_CROWBAR], FALSE ) ) { @@ -3986,6 +4084,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) // OK, set cancle code! gOpenDoorMenu.fMenuHandled = 2; } +#endif } HandleOpenDoorMenu( ); @@ -4866,24 +4965,31 @@ void DoorMenuBackregionCallback( MOUSE_REGION * pRegion, INT32 iReason ) STR16 GetSoldierHealthString( SOLDIERTYPE *pSoldier ) { - INT32 cnt, cntStart; - if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) + if (gGameExternalOptions.fHideEnemyHealthText && (pSoldier->bTeam == ENEMY_TEAM || pSoldier->bTeam == CREATURE_TEAM)) { - cntStart = 4; + return L""; } - else + else { - cntStart = 0; - } - //Show health on others......... - for ( cnt = cntStart; cnt < 6; cnt ++ ) - { - if ( pSoldier->stats.bLife < bHealthStrRanges[ cnt ] ) + INT32 cnt, cntStart; + if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) { - break; + cntStart = 4; } + else + { + cntStart = 0; + } + //Show health on others......... + for ( cnt = cntStart; cnt < 6; cnt ++ ) + { + if ( pSoldier->stats.bLife < bHealthStrRanges[ cnt ] ) + { + break; + } + } + return zHealthStr[ cnt ]; } - return zHealthStr[ cnt ]; } diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index f957585b..e4d71b66 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -57,6 +57,11 @@ #include "math.h" #endif +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -5797,7 +5802,10 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) } // Lesh: end - +#ifdef JA2UB + //handle the placing up of a new ja25 gun + HandleNewGunComment( pSoldier, pObj->usItem, FALSE ); +#endif pInSlot = &(pSoldier->inv[bPos]); //we are placing an object, how we handle this depends on what is in the slot already diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp new file mode 100644 index 00000000..5e6912bb --- /dev/null +++ b/Tactical/Ja25_Tactical.cpp @@ -0,0 +1,1965 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "items.h" + #include "Action Items.h" + #include "weapons.h" + #include "Interface Cursors.h" + #include "Soldier Control.h" + #include "overhead.h" + #include "Handle UI.h" + #include "Animation Control.h" + #include "points.h" + #include "Sound Control.h" + #include "Sys globals.h" + #include "Isometric Utils.h" + #include "Animation Data.h" + #include "worldman.h" + #include "Random.h" + #include "Campaign.h" + #include "interface.h" + #include "interface panels.h" + #include "explosion control.h" + #include "Keys.h" + + #include "wcheck.h" + #include "soldier profile.h" + #include "SkillCheck.h" + #include "los.h" + #include "message.h" + #include "text.h" + + #include "fov.h" + #include "MessageBoxScreen.h" + + #include "PathAIDebug.h" + #include "Interface Control.h" + #include "ShopKeeper Interface.h" + #include "Cursors.h" + + #include "GameSettings.h" + #include "environment.h" + #include "Auto Resolve.h" + #include "Interface Items.h" + #include "Campaign Types.h" + #include "history.h" + #include "Game Clock.h" + #include "strategicmap.h" + #include "Inventory Choosing.h" + #include "Soldier macros.h" + #include "Smell.h" + #include "lighting.h" + #include "utilities.h" + #include "english.h" + #include "debug control.h" +#endif + +#ifdef JA2UB + +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "Ja25_Tactical.h" +#include "Dialogue Control.h" +#include "interface Dialogue.h" +#include "Quests.h" +#include "SaveLoadMap.h" +#include "renderworld.h" +#include "qarray.h" +#include "Soldier Init List.h" +#include "Soldier Control.h" +#include "End Game.h" +#include "structure.h" +#include "Explosion Control.h" +#include "ub_config.h" + +//******************************************************************* +// +// Local Defines +// +//******************************************************************* + + +#define TCTL__DELAY_BETWEEN_ALARM_SOUNDS 4000 + +#define NUM_NEW_GUN_QUOTES 15 + + +#define PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_EASY 2 +#define PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_NORMAL 2 +#define PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_HARD 1 + + + +typedef struct +{ + INT16 sItem; + BOOLEAN fHasBeenSaid; + +} NEW_GUN_QUOTES_STRUCT; + + +//Morris items +//UINT32 MORRIS_INSTRUCTION_NOTE = 1362; + +UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ); + +//******************************************************************* +// +// Global Variables +// +//******************************************************************* + +NEW_GUN_QUOTES_STRUCT gNewGunQuotes[ NUM_NEW_GUN_QUOTES ]; + + +//******************************************************************* +// +// Function Prototypes +// +//******************************************************************* + +void StopPowerGenFan(); +void SetNewGunQuoteToBePlayedForThisGun( INT32 iItemIndex ); +BOOLEAN HasNewGunQuoteBeenPlayedForThisGun( INT32 iItemIndex ); +BOOLEAN IsThisGunANewJa25Gun( INT32 iItemIndex ); +BOOLEAN SaveNewGunQuotesArrayToSaveGameFile( HWFILE hFile ); +BOOLEAN LoadNewGunQuotesArrayToSaveGameFile( HWFILE hFile ); +void HandlePickingUpMorrisInstructionNote( SOLDIERTYPE *pSoldier, INT32 iIndex ); +BOOLEAN IsSoldierAliveWithInitListGridNo( INT16 sInitListID ); + +void Ja25ScaleAllEnemiesByValue( INT8 bExpScaleValue ); +INT8 JA25SecondHighestExpLevelOnPlayersTeam( ); +INT8 JA25HighestExpLevelOnTeam( INT8 bTeam ); +INT8 JA25SecondHighestExpLevelOnEnemiesTeam( ); +INT8 CountNumberOfMercsOnSameTeamOfSameExpLevel( INT8 bTeam, INT8 bExpLevel ); + +BOOLEAN IsSoldierQualifiedGunCommenterMerc( SOLDIERTYPE *pSoldier ); +UINT32 GetNumberOfTurnsPowerGenFanWillBeStoppedFor(); +void HandleInitialEventsInHeliCrash(); + +BOOLEAN gfFirstTimeInGameHeliCrash = FALSE; + +void HandleHowPlayerGotThroughFan(); + +//ppp + +//******************************************************************* +// +// Functions +// +//******************************************************************* + +BOOLEAN useOldJA2Inventory = TRUE; + +//inshy: chenge index of items to 1.13 version. Now we dont need Items.xml in UB-113 folder +/* +UINT32 BARRETT_UB = 335; +UINT32 CALICO_960_UB = 69; +UINT32 PSG1_UB =334; +UINT32 L85_UB =331; +UINT32 TAR21_UB =332; +UINT32 VAL_SILENT_UB =333; +UINT32 MICRO_UZI_UB = 330; +UINT32 CALICO_950_UB = 67; +UINT32 CALICO_900_UB = 68; + +UINT32 CLIP_CANNON_BALL = 1354; +UINT32 MERC_UMBRELLA = 1361; +UINT32 HAND_CANNON = 1352; +UINT32 HARTFORD_6_SHOOTER = 66; +UINT32 TEX_MOVIE_ATTACK_CLYDESDALES = 1356; +UINT32 TEX_MOVIE_WILD_EAST = 1357; +UINT32 TEX_MOVIE_HAVE_HONDA = 1358; +UINT32 LAPTOP_TRANSMITTER = 1355; +UINT32 CHE_GUEVARA_CANTEEN = 1359; +UINT32 MERC_WRISTWATCH = 1360; +UINT32 SAM_GARVER_COMBAT_KNIFE = 1353; +UINT32 MERC_UMBRELLA_OLD = 1361; //not used??? +UINT32 MORRIS_INSTRUCTION_NOTE = 1362; + +//inshy: chenge index of items to 1.13 version. Now we dont need Items.xml in UB-113 folder + +UINT32 BARRETT_UB = 43; +UINT32 CALICO_960_UB = 44; +UINT32 PSG1_UB =45; +UINT32 L85_UB =46; +UINT32 TAR21_UB =47; +UINT32 VAL_SILENT_UB =48; +UINT32 MICRO_UZI_UB = 57; +UINT32 CALICO_950_UB = 66; +UINT32 CALICO_900_UB = 67; + +UINT32 CLIP_CANNON_BALL = 115; +UINT32 MERC_UMBRELLA = 70; +UINT32 HAND_CANNON = 63; +UINT32 HARTFORD_6_SHOOTER = 68; +UINT32 TEX_MOVIE_ATTACK_CLYDESDALES = 328; +UINT32 TEX_MOVIE_WILD_EAST = 329; +UINT32 TEX_MOVIE_HAVE_HONDA = 330; +UINT32 LAPTOP_TRANSMITTER = 331; +UINT32 CHE_GUEVARA_CANTEEN = 332; +UINT32 MERC_WRISTWATCH = 333; +UINT32 SAM_GARVER_COMBAT_KNIFE = 69; +UINT32 MERC_UMBRELLA_OLD = 335; +UINT32 MORRIS_INSTRUCTION_NOTE = 336; +*/ + +UINT32 TEX_MOVIE_ATTACK_CLYDESDALES; +UINT32 TEX_MOVIE_WILD_EAST; +UINT32 TEX_MOVIE_HAVE_HONDA; +UINT32 LAPTOP_TRANSMITTER; +UINT32 CHE_GUEVARA_CANTEEN; +UINT32 MERC_WRISTWATCH; +UINT32 SAM_GARVER_COMBAT_KNIFE; +UINT32 MERC_UMBRELLA_OLD; +UINT32 MORRIS_INSTRUCTION_NOTE; +UINT32 HAND_CANNON; +UINT32 HARTFORD_6_SHOOTER; +UINT32 MERC_UMBRELLA; + +UINT32 BARRETT_UB; +UINT32 CALICO_960_UB; +UINT32 PSG1_UB; +UINT32 L85_UB; +UINT32 TAR21_UB; +UINT32 VAL_SILENT_UB; +UINT32 MICRO_UZI_UB; +UINT32 CALICO_950_UB; +UINT32 CALICO_900_UB; + +UINT32 CLIP_CANNON_BALL; + +void Old_UB_Inventory (); +void New_UB_Inventory (); + +void Old_UB_Inventory () +{ + BARRETT_UB = 43; + CALICO_960_UB = 44; + PSG1_UB =45; + L85_UB =46; + TAR21_UB =47; + VAL_SILENT_UB =48; + MICRO_UZI_UB = 57; + CALICO_950_UB = 66; + CALICO_900_UB = 67; + + CLIP_CANNON_BALL = 115; + MERC_UMBRELLA = 70; + HAND_CANNON = 63; + HARTFORD_6_SHOOTER = 68; + TEX_MOVIE_ATTACK_CLYDESDALES = 328; + TEX_MOVIE_WILD_EAST = 329; + TEX_MOVIE_HAVE_HONDA = 330; + LAPTOP_TRANSMITTER = 331; + CHE_GUEVARA_CANTEEN = 332; + MERC_WRISTWATCH = 333; + SAM_GARVER_COMBAT_KNIFE = 69; + MERC_UMBRELLA_OLD = 335; + MORRIS_INSTRUCTION_NOTE = 336; +} + + +void New_UB_Inventory () +{ + //inshy: chenge index of items to 1.13 version. Now we dont need Items.xml in UB-113 folder + BARRETT_UB = 335; + CALICO_960_UB = 69; + PSG1_UB =334; + L85_UB =331; + TAR21_UB =332; + VAL_SILENT_UB =333; + MICRO_UZI_UB = 330; + CALICO_950_UB = 67; + CALICO_900_UB = 68; + + CLIP_CANNON_BALL = 1354; + MERC_UMBRELLA = 1361; + HAND_CANNON = 1352; + HARTFORD_6_SHOOTER = 66; + TEX_MOVIE_ATTACK_CLYDESDALES = 1356; + TEX_MOVIE_WILD_EAST = 1357; + TEX_MOVIE_HAVE_HONDA = 1358; + LAPTOP_TRANSMITTER = 1355; + CHE_GUEVARA_CANTEEN = 1359; + MERC_WRISTWATCH = 1360; + SAM_GARVER_COMBAT_KNIFE = 1353; + MERC_UMBRELLA_OLD = 1361; //not used??? + MORRIS_INSTRUCTION_NOTE = 1362; +} + +//GridNo +UINT32 SWITCHINMORRISAREA_GRIDNO = 15231; +UINT32 SWITCHTOLAUNCHMISSLES_GRIDNO1 = 14268; +UINT32 SWITCHTOLAUNCHMISSLES_GRIDNO2 = 15708; +UINT32 RADIOLOCATORS_GRIDNO1 = 15070; +UINT32 RADIOLOCATORS_GRIDNO2 = 14744; +UINT32 POWERGENSECTOR_GRIDNO1 = 15100; +UINT32 POWERGENSECTOR_GRIDNO2 = 12220; +UINT32 POWERGENSECTOR_GRIDNO3 = 14155; +UINT32 POWERGENSECTOR_GRIDNO4 = 13980; +UINT32 POWERGENSECTOREXITGRID_GRIDNO1 = 19749; +UINT32 POWERGENFANSOUND_GRIDNO1 = 10979; +UINT32 POWERGENFANSOUND_GRIDNO2 = 19749; +UINT32 STARTFANBACKUPAGAIN_GRIDNO = 10980; +UINT32 STOPPOWERGENFAN_GRIDNO = 10980; + +void InitGridNoUB() +{ + SWITCHINMORRISAREA_GRIDNO = gGameUBOptions.SwitchInMorrisAreaGridNo; //= 15231; + SWITCHTOLAUNCHMISSLES_GRIDNO1 = gGameUBOptions.SwitchToLaunchMisslesGridNo1; //= 14268; + SWITCHTOLAUNCHMISSLES_GRIDNO2 = gGameUBOptions.SwitchToLaunchMisslesGridNo2; //= 15708; + RADIOLOCATORS_GRIDNO1 = gGameUBOptions.RadioLocatorsGridNo1; //= 15070; + RADIOLOCATORS_GRIDNO2 = gGameUBOptions.RadioLocatorsGridNo2; //= 14744; + POWERGENSECTOR_GRIDNO1 = gGameUBOptions.PowergenSectorGridNo1; //= 15100; + POWERGENSECTOR_GRIDNO2 = gGameUBOptions.PowergenSectorGridNo2; //= 12220; + POWERGENSECTOR_GRIDNO3 = gGameUBOptions.PowergenSectorGridNo3; //= 14155; + POWERGENSECTOR_GRIDNO4 = gGameUBOptions.PowergenSectorGridNo4; //= 13980; + POWERGENSECTOREXITGRID_GRIDNO1 = gGameUBOptions.PowergenSectorExitgridGridNo; // = 19749; + POWERGENFANSOUND_GRIDNO1 = gGameUBOptions.PowergenFanSoundGridNo1; //= 10979; + POWERGENFANSOUND_GRIDNO2 = gGameUBOptions.PowergenFanSoundGridNo2; //= 19749; + STARTFANBACKUPAGAIN_GRIDNO = gGameUBOptions.StartFanbackupAgainGridNo; //= 10980; + STOPPOWERGENFAN_GRIDNO = gGameUBOptions.StopPowergenFanGridNo; //= 10980; +} + + +BOOLEAN IsSoldierQualifiedMerc( SOLDIERTYPE *pSoldier ) +{ + if( pSoldier->ubProfile == 58 || /// GASTON + pSoldier->ubProfile == 59 || // STOGIE + pSoldier->ubProfile == 64 ||// TEX || + pSoldier->ubProfile == 62 || //JOHN_K || + pSoldier->ubProfile == 61 || //BIGGENS || + pSoldier->ubProfile == 60 || //MANUEL || + pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER + ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + +BOOLEAN IsSoldierQualifiedMercForSeeingPowerGenFan( SOLDIERTYPE *pSoldier ) +{ + if( pSoldier->ubProfile == 60 ||//MANUEL || + pSoldier->ubProfile == 53 || //PGCMale3 + pSoldier->ubProfile == 55 || //PGCFem2 + pSoldier->ubProfile == 57 //PGCMale4 + ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + +BOOLEAN IsSoldierQualifiedGunCommenterMerc( SOLDIERTYPE *pSoldier ) +{ + if( pSoldier->ubProfile == 58 || // GASTON + pSoldier->ubProfile == 59 || // STOGIE + pSoldier->ubProfile == 64 || // TEX + pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER + ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + +BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier ) +{ + if( pSoldier->ubProfile == 58 || // GASTON + pSoldier->ubProfile == 59 || // STOGIE + pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER + ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + + +INT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray ) +{ + SOLDIERTYPE *pSoldier=NULL; + INT32 cnt; + INT8 bNumMercsPresent=0; + + if( pSoldierIdArray ) + memset( pSoldierIdArray, NOBODY, NUM_MERCS_WITH_NEW_QUOTES ); + + if( pProfileIdArray ) + memset( pProfileIdArray, NO_PROFILE, NUM_MERCS_WITH_NEW_QUOTES ); + + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + + //Check to see if Gaston, Stogie or the PGC is on the team + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + //if the merc is alive, in sector, etc... + //Note: cant do the OK_CONTROLLABLE_MERC() cause it does bInSector which is not set when EnterSector is finshed ( we need it then ) + if( pSoldier->bActive && + pSoldier->sSectorX == gWorldSectorX && + pSoldier->sSectorY == gWorldSectorY && + pSoldier->bSectorZ == gbWorldSectorZ && + pSoldier->stats.bLife >= OKLIFE && + !pSoldier->flags.fBetweenSectors ) + { + //if the merc is one of the mercs we are looking for + if( IsSoldierQualifiedMerc( pSoldier ) ) + { + //if we are to return an array of the mercs + if( pProfileIdArray != NULL ) + { + //record the profile num of the merc + pProfileIdArray[ bNumMercsPresent ] = pSoldier->ubProfile; + } + + //if we are to return an array of the mercs + if( pSoldierIdArray != NULL ) + { + //record the soldier num of the merc + pSoldierIdArray[ bNumMercsPresent ] = pSoldier->ubID; + } + + bNumMercsPresent++; + } + } + } + + return( bNumMercsPresent ); +} + + + +INT8 RandomProfileIdFromNewMercsOnPlayerTeam() +{ + INT8 bNumMercsPresent=-1; + UINT8 ProfileIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + + //Get the number and array of the new soldiers + bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, ProfileIdArray ); + + Assert( bNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES ); + + if( bNumMercsPresent != 0 ) + { + //return a random merc from the array + return( ProfileIdArray[ Random( bNumMercsPresent ) ] ); + } + else + { + return( -1 ); + } +} + + +INT8 RandomSoldierIdFromNewMercsOnPlayerTeam() +{ + INT8 bNumMercsPresent=-1; + UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + + //Get the number and array of the new soldiers + bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL ); + + Assert( bNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES ); + + if( bNumMercsPresent != 0 ) + { + //return a random merc from the array + return( SoldierIdArray[ Random( bNumMercsPresent ) ] ); + } + else + { + return( -1 ); + } +} + + +INT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ) +{ + INT8 bNumMercsPresent=-1; + UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + BOOLEAN UsedArray[NUM_MERCS_WITH_NEW_QUOTES]; + UINT8 ubCnt; + BOOLEAN fFound=FALSE; + UINT8 ubRand; + + memset( UsedArray, 0, NUM_MERCS_WITH_NEW_QUOTES ); + memset( pRandomSoldierIdArray, NOBODY, NUM_MERCS_WITH_NEW_QUOTES ); + + //Get the number and array of the new soldiers + bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL ); + + Assert( bNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES ); + + if( bNumMercsPresent != 0 ) + { + //loop through all the available mercs + for( ubCnt=0; ubCnt= 1 && pSoldierId1 != NULL ) + { + *pSoldierId1 = RandomSoldierIdArray[ 0 ]; + ubNumberDifMercsAssigned++; + } + + if( bNumMercs >= 2 && pSoldierId2 != NULL ) + { + *pSoldierId2 = RandomSoldierIdArray[ 1 ]; + ubNumberDifMercsAssigned++; + } + else + { + *pSoldierId2 = RandomSoldierIdArray[ 0 ]; + } + + if( pSoldierId3 != NULL ) + { + if( bNumMercs >= 3 ) + { + *pSoldierId3 = RandomSoldierIdArray[ 2 ]; + ubNumberDifMercsAssigned++; + } + else if( bNumMercs >= 2 ) + { + if( Chance( 50 ) ) + *pSoldierId3 = RandomSoldierIdArray[ 1 ]; + else + *pSoldierId3 = RandomSoldierIdArray[ 0 ]; + } + } + + return( ubNumberDifMercsAssigned ); +} + + +void HandleWhenCertainPercentageOfEnemiesDie() +{ + UINT32 uiPercentEnemiesKilled; + UINT8 ubSectorID; + + //if there isnt enemies in the sector + if( ( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) == 0 ) + { + //get out + return; + } + + uiPercentEnemiesKilled = (UINT32)( 100 * (UINT32)(gTacticalStatus.ubArmyGuysKilled + 1) / (UINT32)( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) ); + + ubSectorID = SECTOR( gWorldSectorX, gWorldSectorY ); + + switch( gbWorldSectorZ ) + { + case 0: + switch( ubSectorID ) + { + case SEC_K15: + //all enemies are dead and if the quote hasnt been said yet + if( uiPercentEnemiesKilled >= 100 && !( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX ) ) + { + INT8 bProfile = RandomProfileIdFromNewMercsOnPlayerTeam(); + + if( bProfile != -1 ) + DelayedMercQuote( bProfile, QUOTE_WONT_RENEW_CONTRACT_LAME_REFUSAL, GetWorldTotalSeconds() + 5 ); + + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX; + } + break; + } + } +} + +void StopPowerGenFan() +{ + UINT16 usTileIndex; + SOLDIERTYPE *pSoldier=NULL; + + // ATE: If destroyed, don't go into here + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector == PGF__BLOWN_UP ) + { + return; + } + + //If the fan is already stopped, or has been stopped in the past + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector == PGF__STOPPED || + IsJa25GeneralFlagSet( JA_GF__POWER_GEN_FAN_HAS_BEEN_STOPPED ) ) + { + //leave + return; + } + + //if we are in turn based combat + if( !((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) ) + { + return; + } + + //Remeber how the player got through + SetJa25GeneralFlag( JA_GF__POWER_GEN_FAN_HAS_BEEN_STOPPED ); + + gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__STOPPED; + + //Set the fact that player stopped the fan + SetFactTrue( FACT_FAN_STOPPPED ); + + //Is biggens on the team + pSoldier = FindSoldierByProfileID( 61, TRUE ); // BIGGENS + if( pSoldier != NULL ) + { + SetFactTrue( FACT_BIGGENS_ON_TEAM_AND_FAN_STOPPED ); + } + + //Turn off the power gen fan sound + HandleRemovingPowerGenFanSound(); + + //remeber which turn the fan stopped on + gJa25SaveStruct.uiTurnPowerGenFanWentDown = gJa25SaveStruct.uiTacticalTurnCounter; + + + // + // Replace the Fan graphic + // + + // Turn on permenant changes.... + ApplyMapChangesToMapTempFile( TRUE ); + + //Add the exit grid to the power gen fan + AddExitGridForFanToPowerGenSector(); + + // Remove it! + // Get index for it... + GetTileIndexFromTypeSubIndex( FIFTHOSTRUCT, (INT8)( 1 ), &usTileIndex ); + RemoveStruct( STOPPOWERGENFAN_GRIDNO, usTileIndex ); + + + // Add the new one + // Get index for it... + GetTileIndexFromTypeSubIndex( FIFTHOSTRUCT, (INT8)( 7 ), &usTileIndex ); + AddStructToHead( STOPPOWERGENFAN_GRIDNO, usTileIndex ); + + ApplyMapChangesToMapTempFile( FALSE ); + + //Recompile the movement costs since we have added a exit grid + RecompileLocalMovementCosts( STOPPOWERGENFAN_GRIDNO ); + + gpWorldLevelData[ STOPPOWERGENFAN_GRIDNO ].uiFlags |= MAPELEMENT_REVEALED; + + // Re-render the world! + gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; + + // FOR THE NEXT RENDER LOOP, RE-EVALUATE REDUNDENT TILES + SetRenderFlags(RENDER_FLAG_FULL); +} + +void HandleStartingFanBackUp() +{ + //if the fan has been stopped for the right amount of time + if( gJa25SaveStruct.uiTacticalTurnCounter == ( gJa25SaveStruct.uiTurnPowerGenFanWentDown + GetNumberOfTurnsPowerGenFanWillBeStoppedFor() ) ) + { + //if it is stopped + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector == PGF__STOPPED ) + { + StartFanBackUpAgain(); + } + } +} + + +void StartFanBackUpAgain() +{ + UINT16 usTileIndex; + + // ATE: If destroyed, don't go into here + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector == PGF__BLOWN_UP ) + { + return; + } + + //Remeber how the player got through + gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__RUNNING_NORMALLY; + + + //Start the fan sound + HandleAddingPowerGenFanSound(); + + + // + // Replace the Fan graphic + // + + // Turn on permenant changes.... + ApplyMapChangesToMapTempFile( TRUE ); + + // Remove it! + // Get index for it... + GetTileIndexFromTypeSubIndex( FIFTHOSTRUCT, (INT8)( 7 ), &usTileIndex ); + RemoveStruct( STARTFANBACKUPAGAIN_GRIDNO, usTileIndex ); + + + // Add the new one + // Get index for it... + GetTileIndexFromTypeSubIndex( FIFTHOSTRUCT, (INT8)( 1 ), &usTileIndex ); + AddStructToHead( STARTFANBACKUPAGAIN_GRIDNO, usTileIndex ); + + ApplyMapChangesToMapTempFile( FALSE ); + + //Recompile the movement costs since we have added a exit grid + RecompileLocalMovementCosts( STARTFANBACKUPAGAIN_GRIDNO ); + + gpWorldLevelData[ STARTFANBACKUPAGAIN_GRIDNO ].uiFlags |= MAPELEMENT_REVEALED; + + // Re-render the world! + gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; + + //Remove the exit grid + RemoveExitGridFromWorld( PGF__FAN_EXIT_GRID_GRIDNO ); + + // FOR THE NEXT RENDER LOOP, RE-EVALUATE REDUNDENT TILES + SetRenderFlags(RENDER_FLAG_FULL); +} + +void HandlePowerGenAlarm() +{ + static UINT32 uiLastTime=0; + static UINT32 uiAlarmCounter=0; + UINT32 uiCurTime=0; + + //if its not the right sector + if( !( gWorldSectorX == 13 && gWorldSectorY == MAP_ROW_J && gbWorldSectorZ == 0 ) ) + { + //leave + return; + } + + //if the fan is not stopped + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector != PGF__STOPPED ) + { + uiAlarmCounter = 0; + //leave + return; + } + + uiCurTime = GetJA2Clock(); + + if( ( uiCurTime - uiLastTime ) >= TCTL__DELAY_BETWEEN_ALARM_SOUNDS ) + { + uiAlarmCounter++; + + PlayJA2SampleFromFile( "SOUNDS\\AlarmFan.wav", RATE_11025, MIDVOLUME, 1, MIDDLE ); + + uiLastTime = uiCurTime; + + + if( uiAlarmCounter == 2 && !IsJa25GeneralFlagSet( JA_GF__BIGGENS_SAID_QUOTE_117 ) ) + { + // + // Have merc say the quote, if the conditions are right + // + if( gubFact[ FACT_PLAYER_KNOWS_ABOUT_FAN_STOPPING ] ) + { + INT8 bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + + if( bID != -1 ) + { + TacticalCharacterDialogue( &Menptr[ bID ], QUOTE_PERSONALITY_BIAS_WITH_MERC_2 ); + } + } + else + { + UINT8 bSoldierId1, bSoldierId2, bSoldierId3; + Get3RandomQualifiedMercs( &bSoldierId1, &bSoldierId2, &bSoldierId3 ); + + if( bSoldierId1 != -1 && Menptr[ bSoldierId1 ].ubProfile != 61 ) //BIGGENS + { + TacticalCharacterDialogue( &Menptr[ bSoldierId1 ], QUOTE_PERSONALITY_BIAS_WITH_MERC_1 ); + } + else if( bSoldierId2 != -1 && Menptr[ bSoldierId2 ].ubProfile != 61 ) //BIGGENS + { + TacticalCharacterDialogue( &Menptr[ bSoldierId2 ], QUOTE_PERSONALITY_BIAS_WITH_MERC_1 ); + } + else if( bSoldierId3 != -1 && Menptr[ bSoldierId3 ].ubProfile != 61 ) // BIGGENS + { + TacticalCharacterDialogue( &Menptr[ bSoldierId3 ], QUOTE_PERSONALITY_BIAS_WITH_MERC_1 ); + } + } + } + } +} + + + + +void HandleAddingPowerGenFanSound() +{ + UINT32 sGridNo; + + //if its not already playing + if( gJa25SaveStruct.iPowerGenFanPositionSndID != -1 ) + { + return; + } + + if( gbWorldSectorZ == 0 ) + sGridNo = POWERGENFANSOUND_GRIDNO1; + else + sGridNo = POWERGENFANSOUND_GRIDNO2; + + //Create the new ambient fan sound + //gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND ); + + SetPositionSndsInActive( ); + SetPositionSndsActive( ); +} + +void HandleRemovingPowerGenFanSound() +{ + //if there is an ambience sound playing + if( gJa25SaveStruct.iPowerGenFanPositionSndID != -1 ) + { + //delete it + DeletePositionSnd( gJa25SaveStruct.iPowerGenFanPositionSndID ); + + gJa25SaveStruct.iPowerGenFanPositionSndID = -1; + } +} + + +void AddExitGridForFanToPowerGenSector() +{ + EXITGRID ExitGrid; + + memset( &ExitGrid, 0, sizeof( EXITGRID ) ); + + ExitGrid.ubGotoSectorX = 14; + ExitGrid.ubGotoSectorY = MAP_ROW_J; + ExitGrid.ubGotoSectorZ = 1; + ExitGrid.usGridNo = POWERGENSECTOREXITGRID_GRIDNO1; + + //Add the exit grid when the fan is either stopped or blown up + AddExitGridToWorld( PGF__FAN_EXIT_GRID_GRIDNO, &ExitGrid ); +} + +BOOLEAN HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( SOLDIERTYPE *pSoldierAtDoor, BOOLEAN fSayQuoteOnlyOnce ) +{ + INT8 bSlot; + UINT32 cnt; + UINT8 ubID; + SOLDIERTYPE *pSoldier; + + + //is this the right sector + if( !( gWorldSectorX == 14 && gWorldSectorY == MAP_ROW_K && gbWorldSectorZ == 1 ) ) + { + //wrong door + return( FALSE ); + } + + //if the player has already said the quote + if( IsJa25GeneralFlagSet( JA_GF__PLAYER_SAID_GATE_LOCKED_QUOTE ) ) + { + return( FALSE ); + } + + // + // look to see if anyone on the team has wire cutters + // + // loop throught the team and see if anyone in this sector has the wire cutter + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + //if the soldier is in the sector + if( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->stats.bLife >= CONSCIOUSNESS ) && + !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) + { + bSlot = FindObj( pSoldier, WIRECUTTERS ); + if( bSlot != NO_SLOT ) + { + //the merc has wire cutters + return( FALSE ); + } + } + } + + ubID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + + if( ubID != -1 ) + { + //have the merc say the quote about the tough gate + TacticalCharacterDialogue( &Menptr[ ubID ], QUOTE_IMPATIENT_QUOTE ); + } + + //remeber we said the quote + if( fSayQuoteOnlyOnce ) + { + SetJa25GeneralFlag( JA_GF__PLAYER_SAID_GATE_LOCKED_QUOTE ); + } + + return( TRUE ); +} + +void HandleHowPlayerGotThroughFan() +{ + switch( gJa25SaveStruct.ubStateOfFanInPowerGenSector ) + { + case PGF__STOPPED: + gJa25SaveStruct.ubHowPlayerGotThroughFan = PG__PLAYER_STOPPED_FAN_TO_GET_THROUGH; + break; + + case PGF__BLOWN_UP: + gJa25SaveStruct.ubHowPlayerGotThroughFan = PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH; + + //If the player blew up the fan, then the enemies can hear it in the tunnel and prepare for it. + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE; + break; + } + +} +/* +void RevealAllDroppedEnemyItems() +{ + UINT32 uiCnt=0; + + //loop through all the items + for(uiCnt=0; uiCntsSectorX == gWorldSectorX && + pSoldier->sSectorY == gWorldSectorY && + pSoldier->bSectorZ == gbWorldSectorZ ) + { + TacticalCharacterDialogue( pSoldier, (UINT16)uiQuoteNum ); + } + + //Say the quote of the newly hired person + pSoldier = FindSoldierByProfileID( ubProfile, TRUE ); + if( pSoldier ) + { + TacticalCharacterDialogue( pSoldier, (UINT16)uiQuoteNum ); + } + + return( TRUE ); +} + +//returns false if a new merc is not going to handle saying the new quote +BOOLEAN HandleNewGunComment( SOLDIERTYPE *pSoldier, INT32 iItemIndex, BOOLEAN fFromGround ) +{ + BOOLEAN fNewMerc = IsSoldierQualifiedGunCommenterMerc( pSoldier ); + + if( !fFromGround ) + { + //if this is morris's note, handle it + HandlePickingUpMorrisInstructionNote( pSoldier, iItemIndex ); + } + + //if the quote has already been said + if( HasNewGunQuoteBeenPlayedForThisGun( iItemIndex ) ) + { + //get out + return( TRUE ); + } + + //if we are not in tactical or map screen, + if( guiCurrentScreen != GAME_SCREEN && guiCurrentScreen != MAP_SCREEN ) + { + //only remeber that we have picked up the gun at some point + SetNewGunQuoteToBePlayedForThisGun( iItemIndex ); + + return( FALSE ); + } + + //if the soldier is a NOT new merc AND this item is from the ground AND the merc didnt say this quote recently + if( !fNewMerc && fFromGround && ( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_FOUND_SOMETHING_NICE ) == 0 ) + { + //if the merc can say it + if( QuoteExp_GotGunOrUsedGun[ pSoldier->ubProfile ] == QUOTE_FOUND_SOMETHING_SPECIAL ) + { + //Have the merc say his cool item quote + TacticalCharacterDialogue( pSoldier, QUOTE_FOUND_SOMETHING_SPECIAL ); + + pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_FOUND_SOMETHING_NICE; + } + } + + //if it is a new merc + if( fNewMerc ) + { + //if the item is the hand cannon + if( iItemIndex == HAND_CANNON ) //4498 + { + //say the new gun quote + TacticalCharacterDialogue( pSoldier, QUOTE_PRECEDENT_TO_REPEATING_ONESELF_RENEW ); + } + else + { + //say the new gun quote + TacticalCharacterDialogue( pSoldier, QUOTE_HATE_MERC_1_ON_TEAM_WONT_RENEW ); + } + + //rememeber we have played the quote + SetNewGunQuoteToBePlayedForThisGun( iItemIndex ); + } + + return( TRUE ); +} + + + + +BOOLEAN SaveJa25TacticalInfoToSaveGame( HWFILE hFile ) +{ + if( !SaveNewGunQuotesArrayToSaveGameFile( hFile ) ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN LoadJa25TacticalInfoFromSavedGame( HWFILE hFile ) +{ + if( !LoadNewGunQuotesArrayToSaveGameFile( hFile ) ) + { + return( FALSE ); + } + + return( TRUE ); +} + + + +BOOLEAN SaveNewGunQuotesArrayToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + UINT32 uiSize = sizeof( NEW_GUN_QUOTES_STRUCT ) * NUM_NEW_GUN_QUOTES; + + FileWrite( hFile, &gNewGunQuotes, uiSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSize ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN LoadNewGunQuotesArrayToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + UINT32 uiSize = sizeof( NEW_GUN_QUOTES_STRUCT ) * NUM_NEW_GUN_QUOTES; + + FileRead( hFile, &gNewGunQuotes, uiSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiSize ) + { + return( FALSE ); + } + + InitNewGunArray(); + + return( TRUE ); +} + +void InitNewGunArray() +{ + INT32 iCnt=0; + + gNewGunQuotes[iCnt++].sItem = BARRETT_UB; + gNewGunQuotes[iCnt++].sItem = CALICO_960_UB; + gNewGunQuotes[iCnt++].sItem = PSG1_UB; + gNewGunQuotes[iCnt++].sItem = L85_UB; + gNewGunQuotes[iCnt++].sItem = TAR21_UB; + gNewGunQuotes[iCnt++].sItem = VAL_SILENT_UB; + gNewGunQuotes[iCnt++].sItem = MICRO_UZI_UB; + gNewGunQuotes[iCnt++].sItem = HAND_CANNON; + gNewGunQuotes[iCnt++].sItem = CALICO_950_UB; + gNewGunQuotes[iCnt++].sItem = CALICO_900_UB; +} + + +BOOLEAN IsThisGunANewJa25Gun( INT32 iItemIndex ) +{ + //if this gun ISNT a new gun + if( !( iItemIndex == BARRETT_UB || + iItemIndex == CALICO_960_UB || + iItemIndex == PSG1_UB || + iItemIndex == L85_UB || + iItemIndex == TAR21_UB || + iItemIndex == VAL_SILENT_UB || + iItemIndex == MICRO_UZI_UB || + iItemIndex == HAND_CANNON || + iItemIndex == CALICO_950_UB || + iItemIndex == CALICO_900_UB ) ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN HasNewGunQuoteBeenPlayedForThisGun( INT32 iItemIndex ) +{ + INT32 iCnt; + + for( iCnt=0; iCntubProfile, DQ__NEW_MERC_SAY_NOTE_QUOTES, GetWorldTotalSeconds()+1 ); + } + + //else if there is a new merc on the team + else if( bID != -1 ) + { + UINT32 uiTime=0; + + if( gJa25SaveStruct.ubMorrisNoteState == MN__PICKED_UP_BY_OLD_MERC_SAID_QUOTE_ALREADY ) + { + return; + } + + //the merc is not a new merc + gJa25SaveStruct.ubMorrisNoteState = MN__PICKED_UP_BY_OLD_MERC_SAID_QUOTE_ALREADY; + + TacticalCharacterDialogue( &Menptr[ bID ], QUOTE_RENEWING_CAUSE_BUDDY_1_ON_TEAM ); + + gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote = bID; + + //if we are in turnbased combat + if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) + { + uiTime = GetWorldTotalSeconds() + 3; + } + else + { + uiTime = GetWorldTotalSeconds() + 10; + } + + DelayedMercQuote( NOBODY, DQ__MORRIS_NOTE_NEW_MERC_DELAY, uiTime ); + } + + else + { + // + // Create a merc popup box that will display a message telling player what to do + // + + gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote = pSoldier->ubProfile; + + DelayedMercQuote( pSoldier->ubProfile, DQ__MORRIS_NOTE_DISPLAY_NOTE_1, GetWorldTotalSeconds() + 1 ); + + gJa25SaveStruct.ubMorrisNoteState = MN__FINISHED; + } +} + +void HandleDeathInPowerGenSector( SOLDIERTYPE *pSoldier ) +{ + //if this is NOT the power gen sector + if( gWorldSectorX != 13 || gWorldSectorY != 10 || gbWorldSectorZ != 0 ) + { + return; + } + else + { + BOOLEAN fFoundValidEnemy=FALSE; + UINT8 ubNumFlagedEnemiesInSector=0; + UINT32 sRandomSlotGridNo; + UINT8 uiCnt; + SOLDIERINITNODE *pInitListSoldier; + + #define NUM_ENEMIES_SLOTS 4 + + UINT32 sEnemyPlacementGridNo[ NUM_ENEMIES_SLOTS ]= + { + POWERGENSECTOR_GRIDNO1, + POWERGENSECTOR_GRIDNO2, + POWERGENSECTOR_GRIDNO3, + POWERGENSECTOR_GRIDNO4, + }; + + // + // Count number of Flaged guys still left + // + for( uiCnt=0; uiCntubID ); + + //is this the same soldier + if( pInitListSoldier && pInitListSoldier->pBasicPlacement->usStartingGridNo == sRandomSlotGridNo ) + { + fFoundValidEnemy = TRUE; + } + + //we are done, + break; + } + } +*/ + // if we found an enemy, or this is the 2nd last enemy in the sector + if( fFoundValidEnemy || ubNumFlagedEnemiesInSector <= 2 ) + { + StopPowerGenFan(); + } + + } + +} + + +BOOLEAN IsSoldierAliveWithInitListGridNo( INT16 sInitListGridNo ) +{ + SOLDIERINITNODE *curr; + curr = gSoldierInitHead; + while( curr ) + { + if( curr->pBasicPlacement->usStartingGridNo == sInitListGridNo && curr->pSoldier != NULL ) + { + if ( curr->pSoldier->stats.bLife >= OKLIFE ) + { + return( TRUE ); + } + } + curr = curr->next; + } + return( FALSE ); +} + +#define JA25__MAX_EXP_DECREASE (-2) +#define JA25__MIN_EXP_LEVEL_AFTER_CHANGE (2) + +void HandleJa25EnemyExpLevelModifier( ) +{ + INT8 bPlayerExpLevel=0; + INT8 bEnemyExpLevel=0; + INT8 bDifference=0; + + if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) + { + return; + } + + //if there are no enemies + if( NumEnemyInSector() == 0 ) + { + //get out + return; + } + + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + + //Get the 2nd highest player exp level + bPlayerExpLevel = JA25SecondHighestExpLevelOnPlayersTeam( ); + + //get the enemies exp level + bEnemyExpLevel = JA25SecondHighestExpLevelOnEnemiesTeam( ); + + //get the difference b/n the 2 + bDifference = bPlayerExpLevel - bEnemyExpLevel; + + //if the players exp level is less then enemies + if( bDifference < 0 ) + { + //if the difference + if( bDifference < JA25__MAX_EXP_DECREASE ) + { + bDifference = JA25__MAX_EXP_DECREASE; + } + + //Degrade all the enemies exp levels by difference + Ja25ScaleAllEnemiesByValue( bDifference ); + } + break; + case DIF_LEVEL_MEDIUM: + + //if the player imported the save + if( gJa25SaveStruct.fImportCharactersFromOldJa2Save ) + { + //Get the 2nd highest player exp level + bPlayerExpLevel = JA25SecondHighestExpLevelOnPlayersTeam( ); + + //get the best enemies exp level + bEnemyExpLevel = JA25HighestExpLevelOnTeam( ENEMY_TEAM ); + + //get the difference b/n the 2 + bDifference = bPlayerExpLevel - bEnemyExpLevel; + + //if the players exp level is greater then enemies + if( bDifference > 0 ) + { + //Upgrade all the enemies exp levels by difference + Ja25ScaleAllEnemiesByValue( bDifference ); + } + } + + break; + case DIF_LEVEL_HARD: + //Get the highest player exp level + bPlayerExpLevel = JA25HighestExpLevelOnTeam( OUR_TEAM ); + + //get the best enemies exp level + bEnemyExpLevel = JA25HighestExpLevelOnTeam( ENEMY_TEAM ); + + //get the difference b/n the 2 + bDifference = bPlayerExpLevel - bEnemyExpLevel; + + //if the players exp level is greater then enemies + if( bDifference > 0 ) + { + //if the player imported the save + if( gJa25SaveStruct.fImportCharactersFromOldJa2Save ) + { + //Upgrade all the enemies exp levels by difference + Ja25ScaleAllEnemiesByValue( bDifference ); + } + else + { + //Upgrade all the enemies exp levels by 1 + Ja25ScaleAllEnemiesByValue( 1 ); + } + } + break; + } +} + +INT8 JA25HighestExpLevelOnTeam( INT8 bTeam ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + INT8 bHighestExpLevel=0; + + cnt = gTacticalStatus.Team[ bTeam ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->bActive ) + { + if( bHighestExpLevel < pSoldier->stats.bExpLevel ) + { + bHighestExpLevel = pSoldier->stats.bExpLevel; + } + } + } + + return( bHighestExpLevel ); +} + + +INT8 JA25SecondHighestExpLevelOnPlayersTeam( ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + INT8 bHighestExpLevel=0; + INT8 b2ndHighestExpLevel=0; + INT8 bNumber=0; + + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->bActive ) + { + if( bHighestExpLevel < pSoldier->stats.bExpLevel ) + { + bHighestExpLevel = pSoldier->stats.bExpLevel; + } + + else if( b2ndHighestExpLevel < pSoldier->stats.bExpLevel ) + { + b2ndHighestExpLevel = pSoldier->stats.bExpLevel; + } + } + } + + //Count number of people on team with same EXP level + bNumber = CountNumberOfMercsOnSameTeamOfSameExpLevel( OUR_TEAM, bHighestExpLevel ); + + //if there are more then 2 mercs on the team with the same high exp level + if( bNumber >= 2 ) + { + //use the highest exp level + b2ndHighestExpLevel = bHighestExpLevel; + } + else + { + //else we are to only decuct 1 exp level from the main guy so there isnt a HUGE descrepincy b/n 1 super merc + //and a bunch of low level losers on a team + b2ndHighestExpLevel = bHighestExpLevel - 1; + } + + return( b2ndHighestExpLevel ); +} + +INT8 JA25SecondHighestExpLevelOnEnemiesTeam( ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + INT8 bHighestExpLevel=0; + INT8 b2ndHighestExpLevel=0; + INT8 bNumber=0; + + //Get the highest exp level on the enemy team + bHighestExpLevel = JA25HighestExpLevelOnTeam( ENEMY_TEAM ); + + //Count number of people on team with same EXP level + bNumber = CountNumberOfMercsOnSameTeamOfSameExpLevel( ENEMY_TEAM, bHighestExpLevel ); + + //if there are more then 2 enemies at the high exp level + if( bNumber > 2 ) + { + //use the highest value + b2ndHighestExpLevel = bHighestExpLevel; + } + else + { + //otherwise loop through and determine the second highest exp level + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->bActive ) + { + //if the exp level is less then the highest + if( pSoldier->stats.bExpLevel < bHighestExpLevel ) + { + //is this a new second highest level + if( b2ndHighestExpLevel < pSoldier->stats.bExpLevel ) + { + b2ndHighestExpLevel = pSoldier->stats.bExpLevel; + } + } + } + } + } + + return( b2ndHighestExpLevel ); +} + + +void Ja25ScaleAllEnemiesByValue( INT8 bExpScaleValue ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + INT8 bNewExpLevel=0; + + cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->bActive ) + { + bNewExpLevel = pSoldier->stats.bExpLevel + bExpScaleValue; + + if( bNewExpLevel > 10 ) + { + bNewExpLevel = 10; + } + //else if the new value will bring it below 1 + else if( bNewExpLevel < 1 ) + { + bNewExpLevel = 1; + } + + //if the enemy originally had a higher exp level AND will now go below set level + else if( pSoldier->stats.bExpLevel > JA25__MIN_EXP_LEVEL_AFTER_CHANGE && bNewExpLevel < JA25__MIN_EXP_LEVEL_AFTER_CHANGE ) + { + bNewExpLevel = JA25__MIN_EXP_LEVEL_AFTER_CHANGE; + } + + + pSoldier->stats.bExpLevel = bNewExpLevel; + } + } +} + +INT8 CountNumberOfMercsOnSameTeamOfSameExpLevel( INT8 bTeam, INT8 bExpLevel ) +{ + INT8 bNumber=0; + SOLDIERTYPE *pSoldier=NULL; + INT32 cnt; + + cnt = gTacticalStatus.Team[ bTeam ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++, pSoldier++) + { + if( pSoldier->bActive ) + { + if( bExpLevel == pSoldier->stats.bExpLevel ) + { + bNumber++; + } + } + } + + return( bNumber ); +} + +INT8 RandomSoldierIdForAnyMercInSector() +{ + UINT8 SoldierIdArray[18]; + UINT8 ubNumMercsInSector=0; + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + UINT8 ubCount=0; + + ubNumMercsInSector = PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, gbWorldSectorZ ); + + if( ubNumMercsInSector == 0 ) + { + return( -1 ); + } + + memset( SoldierIdArray, 0, 18 ); + + //loop through the merc array and fill in the soldier id + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + //if the soldier is in the sector + if( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->stats.bLife >= CONSCIOUSNESS ) && + !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) + { + SoldierIdArray[ ubCount++ ] = cnt; + } + } + + return( SoldierIdArray[ Random( ubCount ) ] ); +} + +void HandleFanStartingAtEndOfCombat() +{ + //if its not the right sector + if( !( gWorldSectorX == 13 && gWorldSectorY == MAP_ROW_J && gbWorldSectorZ == 0 ) ) + { + //leave + return; + } + + //if the fan is not stopped + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector != PGF__STOPPED ) + { + //leave + return; + } + + StartFanBackUpAgain(); +} + + +void HandleInitialEventsInHeliCrash() +{ + SOLDIERTYPE *pSoldier=NULL; + INT32 cnt; + + //first, loop through all the mercs and injure them + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + //if the merc is alive + if( pSoldier->bActive ) + { + pSoldier->stats.bLife -= ( 3 + Random( 5 ) ); + pSoldier->sBreathRed = ( 15 + Random( 15 ) ) * 100; + pSoldier->bActionPoints = 0; + } + } +/* +#ifdef JA2TESTVERSION + //Add a smoke effect behind the heli + NewSmokeEffect( 15102, SMOKE_GRENADE, 0, NOBODY ); +#endif +*/ +} + + +UINT32 GetNumberOfTurnsPowerGenFanWillBeStoppedFor() +{ + UINT32 uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_EASY; + + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_EASY; + break; + case DIF_LEVEL_MEDIUM: + uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_NORMAL; + break; + case DIF_LEVEL_HARD: + uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_HARD; + break; + } + + return( uiNumTurns ); +} + + +void DisplayCommanderMorrisNote( SOLDIERTYPE *pSoldier ) +{ + CHAR16 zString[1024]; + + if( gJa25SaveStruct.ubDisplayCommanderMorrisNote == DMN__FINISHED ) + { + return; + } + + if( pSoldier == NULL ) + { + return; + } + + //if it si the first part of the note to be displayed + if( gJa25SaveStruct.ubDisplayCommanderMorrisNote == DMN__NOT_TO_DISPLAY_IT ) + { + gJa25SaveStruct.ubDisplayCommanderMorrisNote = DMN__DISPLAY_PART_1; + + swprintf( zString, zNewTacticalMessages[ TCTL_MSG__END_GAME_POPUP_TXT_1 ], pSoldier->name ); + } + + //if it si the second part of the note to be displayed + else if( gJa25SaveStruct.ubDisplayCommanderMorrisNote == DMN__DISPLAY_PART_1 ) + { + gJa25SaveStruct.ubDisplayCommanderMorrisNote = DMN__DISPLAY_PART_2; + + swprintf( zString, zNewTacticalMessages[ TCTL_MSG__END_GAME_POPUP_TXT_2 ], pSoldier->name, pSoldier->name ); + } + + //Display it + ExecuteTacticalTextBox( 110, zString ); +} + + + +void HandleCommanderMorrisNewMercWantsNoteDelayedSpeech() +{ + INT8 bID=-1; + + //if the note has already been picked up by a new merc, or the note has been displayed + if( gJa25SaveStruct.ubMorrisNoteState == MN__PICKED_UP_BY_NEW_MERC || + gJa25SaveStruct.ubMorrisNoteState == MN__FINISHED ) + { + return; + } + + //if the original merc who said the quote is valid + bID = gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote; + if( bID != -1 && IsSoldierQualifiedMerc( &Menptr[ bID ] ) ) + { + } + else + { + bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + + if( bID != -1 ) + { + gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote = bID; + } + else + { + return; + } + } + + TacticalCharacterDialogue( &Menptr[ bID ], QUOTE_RENEWING_CAUSE_BUDDY_1_ON_TEAM ); +} + + +void HandleShowingRadioLocatorsInMorrisArea() +{ + //Reveal the switch in Morris area + HandleOpenControlPanelToRevealSwitchInMorrisArea(); + + //control panel locater + BeginMultiPurposeLocator( RADIOLOCATORS_GRIDNO1, 0, TRUE ); + + //if we are not in combat + if( !((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) ) + { + DelayedMercQuote( RADIOLOCATORS_GRIDNO2, DQ__SHOW_RADIO_LOCATOR, GetWorldTotalSeconds() + 3 ); + } +} + +void HandleNewMercSayingContentsOfMorrisNote( SOLDIERTYPE *pSoldier ) +{ + TacticalCharacterDialogue( pSoldier, QUOTE_MERC_LEAVING_ALSUCO_SOON ); + + TacticalCharacterDialogue( pSoldier, QUOTE_MERC_GONE_UP_IN_PRICE ); + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_JERRY_MILO, JM_SE__SHOW_RADIO_LOCATOR, 0, 0, 0, DIALOGUE_TACTICAL_UI ); +} + +void HandlePlayerHittingSwitchToLaunchMissles() +{ + INT32 cnt; + SOLDIERTYPE *pSoldier=NULL; + + // + // The player Just won the game, remeber this + // + gGameSettings.fPlayerFinishedTheGame = TRUE; + SaveGameSettings(); + + //Update the quest log + InternalEndQuest( QUEST_DESTROY_MISSLES, -1, -1, TRUE ); + + //lock the interface + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + + // + // Loop through all the mercs in the sector and make them run to the elevator + // + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + // if the soldier was in the complex + if( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && + pSoldier->sSectorX == 15 && pSoldier->sSectorY == 12 && pSoldier->bSectorZ == 3 ) + { + if( PythSpacesAway( pSoldier->sGridNo, SWITCHTOLAUNCHMISSLES_GRIDNO1 ) < PythSpacesAway( pSoldier->sGridNo, SWITCHTOLAUNCHMISSLES_GRIDNO2 ) ) + pSoldier->EVENT_InternalGetNewSoldierPath( SWITCHTOLAUNCHMISSLES_GRIDNO1, RUNNING, TRUE, TRUE ); + else + pSoldier->EVENT_InternalGetNewSoldierPath( SWITCHTOLAUNCHMISSLES_GRIDNO2, RUNNING, TRUE, TRUE ); + } + } + + //Start a timer so we can fade out + DelayedMercQuote( NOBODY, DQ__FADE_OUT_TO_END_GAME_CINEMATIC, GetWorldTotalSeconds()+2 ); +} + +void HandleFadingOutToEndGameCinematics() +{ + gFadeOutDoneCallback = DoneFadeOutEndCinematic; + + FadeOutGameScreen( ); + + // UnLock UI! + guiPendingOverrideEvent = LU_ENDUILOCK; + HandleTacticalUI( ); +} + +void HandleOpenControlPanelToRevealSwitchInMorrisArea() +{ + //if the note has already been picked up by a new merc, or the note has been displayed + if( gJa25SaveStruct.ubMorrisNoteState == MN__PICKED_UP_BY_NEW_MERC || + gJa25SaveStruct.ubMorrisNoteState == MN__FINISHED ) + { + STRUCTURE * pStructure; + INT32 iItemIndex; + ITEM_POOL * pItemPool; + + + // first, find the switch item and turn off its trap level + + if ( ItemTypeExistsAtLocation( SWITCHINMORRISAREA_GRIDNO, SWITCH, 0, &iItemIndex ) ) + { + //gWorldItems[ iItemIndex ]->data.bTrap = 0; + gWorldItems[ iItemIndex ].object[0]->data.bTrap = 0; + GetItemPool( SWITCHINMORRISAREA_GRIDNO, &pItemPool, 0 ); + if ( pItemPool ) + { + SetItemPoolVisibilityOn( pItemPool, ANY_VISIBILITY_VALUE, FALSE ); + } + } + + //Open up the Control Panel so the switch is visibile + pStructure = FindStructure( SWITCHINMORRISAREA_GRIDNO, STRUCTURE_GENERIC ); + if( pStructure == NULL ) + { + return; + } + + if( SwapStructureForPartnerForcingGraphicalChange( SWITCHINMORRISAREA_GRIDNO, pStructure ) == NULL ) + { + //an error occured + return; + } + } +} +#endif \ No newline at end of file diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h new file mode 100644 index 00000000..1584dadf --- /dev/null +++ b/Tactical/Ja25_Tactical.h @@ -0,0 +1,141 @@ +#ifndef _JA25_TACTICAL__H_ +#define _JA25_TACTICAL__H_ + +#ifdef JA2UB + +#include "MapScreen Quotes.h" + +#define PGF__FAN_EXIT_GRID_GRIDNO 10979 + +#define NUM_MERCS_WITH_NEW_QUOTES 20//7 + + +#define DQ__NORMAL_DELAYED_QUOTE 0xff00 +#define DQ__JERRY_BROKE_TRANSMITTER 0xffff +#define DQ__MORRIS_NOTE_NEW_MERC_DELAY 0xfffe +#define DQ__MORRIS_NOTE_DISPLAY_NOTE_1 0xfffd +#define DQ__MORRIS_NOTE_DISPLAY_NOTE_2 0xfffc +#define DQ__SHOW_RADIO_LOCATOR 0xfffb +#define DQ__NEW_MERC_SAY_NOTE_QUOTES 0xfffa +#define DQ__START_EVERYONE_TALKING_AT_END_OF_GAME 0xfff0 +#define DQ__FADE_OUT_TO_END_GAME_CINEMATIC 0xfff9 + +enum +{ + JM_SE__HEADING_TO_TRACONA =MILO_QUOTE__HEADED_TO_TRACONA_QUOTE, + JM_SE__SHOW_RADIO_LOCATOR = MILO_NO_QUOTE-10, +}; + +/* +// things that need to be saved in the exp in tactical +typedef struct +{ + +} JA25_TACTICAL_SAVE_STRUCT; + +*/ +extern BOOLEAN gfFirstTimeInGameHeliCrash; + +INT8 RandomProfileIdFromNewMercsOnPlayerTeam(); +INT8 RandomSoldierIdFromNewMercsOnPlayerTeam(); +INT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray ); +BOOLEAN IsSoldierQualifiedMerc( SOLDIERTYPE *pSoldier ); +BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier ); +BOOLEAN IsSoldierQualifiedMercForSeeingPowerGenFan( SOLDIERTYPE *pSoldier ); + +BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQuoteNum ); + +//Pass in an array of size NUM_MERCS_WITH_NEW_QUOTES, array will be filled with +//random soldier IDs of the qualified mercs +INT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ); + + +extern UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ); + +void HandleWhenCertainPercentageOfEnemiesDie(); + +void StartFanBackUpAgain(); + +void AddExitGridForFanToPowerGenSector(); + +void HandleAddingPowerGenFanSound(); +void HandleRemovingPowerGenFanSound(); + +void HandleStartingFanBackUp(); + +void HandlePowerGenAlarm(); + + +BOOLEAN HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuoteOnlyOnce ); + +extern void HandleHowPlayerGotThroughFan(); + +//void RevealAllDroppedEnemyItems(); + +void HandlePlayingQuoteWhenHiringNpc( UINT8 ubProfile ); + + +BOOLEAN LoadJa25TacticalInfoFromSavedGame( HWFILE hFile ); +BOOLEAN SaveJa25TacticalInfoToSaveGame( HWFILE hFile ); + +BOOLEAN HandleNewGunComment( SOLDIERTYPE *pSoldier, INT32 iItemIndex, BOOLEAN fFromGround ); +void HandleDeathInPowerGenSector( SOLDIERTYPE *pSoldier ); + +void HandleJa25EnemyExpLevelModifier( ); + +INT8 RandomSoldierIdForAnyMercInSector(); + +void HandleFanStartingAtEndOfCombat(); + +extern void HandleInitialEventsInHeliCrash(); + +void HandleCommanderMorrisNewMercWantsNoteDelayedSpeech(); + +void DisplayCommanderMorrisNote( SOLDIERTYPE *pSoldier ); + +void HandleShowingRadioLocatorsInMorrisArea(); + +void HandleNewMercSayingContentsOfMorrisNote( SOLDIERTYPE *pSoldier ); + +void HandlePlayerHittingSwitchToLaunchMissles(); + +void HandleStartingEveryoneTalkingAtEndOfGame(); + +void HandleFadingOutToEndGameCinematics(); + +void HandleOpenControlPanelToRevealSwitchInMorrisArea(); + +void InitNewGunArray(); + +extern BOOLEAN useOldJA2Inventory; +extern UINT32 TEX_MOVIE_ATTACK_CLYDESDALES; +extern UINT32 TEX_MOVIE_WILD_EAST; +extern UINT32 TEX_MOVIE_HAVE_HONDA; +extern UINT32 LAPTOP_TRANSMITTER; +extern UINT32 CHE_GUEVARA_CANTEEN; +extern UINT32 MERC_WRISTWATCH; +extern UINT32 SAM_GARVER_COMBAT_KNIFE; +extern UINT32 MERC_UMBRELLA_OLD; +extern UINT32 MORRIS_INSTRUCTION_NOTE; +extern UINT32 HAND_CANNON; +extern UINT32 HARTFORD_6_SHOOTER; +extern UINT32 MERC_UMBRELLA; +extern UINT32 CLIP_CANNON_BALL; +extern UINT32 BARRETT_UB; +extern UINT32 CALICO_960_UB; +extern UINT32 PSG1_UB; +extern UINT32 L85_UB; +extern UINT32 TAR21_UB; +extern UINT32 VAL_SILENT_UB; +extern UINT32 MICRO_UZI_UB; +extern UINT32 CALICO_950_UB; +extern UINT32 CALICO_900_UB; + +extern void Old_UB_Inventory (); +extern void New_UB_Inventory (); + +extern void InitGridNoUB(); + +#endif + +#endif \ No newline at end of file diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 4f75dded..1b667383 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -45,6 +45,10 @@ #include "Overhead.h" #endif +#ifdef JA2UB +#include "ub_config.h" +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -479,9 +483,15 @@ void HandleHeliDrop( ) for ( cnt = gbCurDrop; cnt < gbNumHeliSeatsOccupied; cnt++ ) { // Add merc to sector + #ifdef JA2UB + //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; + #else //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; + #endif // HEADROCK HAM 3.5: Externalized! UpdateMercInSector( MercPtrs[ gusHeliSeats[ cnt ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); @@ -617,10 +627,15 @@ void HandleHeliDrop( ) MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE ); // Change insertion code +#ifdef JA2UB + //MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; +#else //MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; - +#endif // HEADROCK HAM 3.5: Externalized! UpdateMercInSector( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); //EVENT_SetSoldierPosition( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], sWorldX, sWorldY ); @@ -828,7 +843,7 @@ void HandleFirstHeliDropOfGame( ) // Move to header file... // HEADROCK HAM 3.5: Externalized! - AddExtraItems( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ, true ); + AddExtraItems( (UINT8)gGameExternalOptions.ubDefaultArrivalSectorX, (UINT8)gGameExternalOptions.ubDefaultArrivalSectorY, startingZ, true ); // HEADROCK HAM 3.5: Starting sector externalized - might not contain enemies at all! if (NumEnemyInSector( ) > 0) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 0af485d8..fea8667b 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -60,6 +60,18 @@ #include "GameSettings.h" #endif #include "connect.h" + +#ifdef JA2UB +#include "Soldier Control.h" +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "Campaign Types.h" +#include "MapScreen Quotes.h" +#include "opplist.h" +#include "Ja25Update.h" +#include "ub_config.h" +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -84,7 +96,37 @@ INT16 gsMercArriveSectorY = gGameExternalOptions.ubDefaultArrivalSectorY; void CheckForValidArrivalSector( ); +#ifdef JA2UB +void AddItemToMerc( UINT8 ubNewMerc, INT16 sItemType ); +#define NUM_INITIAL_GRIDNOS_FOR_HELI_CRASH 7 + +UINT32 gsInitialHeliGridNo[ NUM_INITIAL_GRIDNOS_FOR_HELI_CRASH ] = +{ + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +INT16 gsInitialHeliRandomTimes[ NUM_INITIAL_GRIDNOS_FOR_HELI_CRASH ] = +{ + 0, + 0, + 0, + 0, + 0, + 0, + 0 +}; + + +UINT32 GetInitialHeliGridNo( ); +UINT16 GetInitialHeliRandomTime(); +#endif INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) { SOLDIERTYPE *pSoldier; @@ -136,6 +178,37 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) return( MERC_HIRE_FAILED ); } +#ifdef JA2UB + //JA25 UB + //MErc mercs come with an umbrella + if ( gProfilesMERC[ubCurrentSoldier].ProfilId == ubCurrentSoldier ) +// if( ( ubCurrentSoldier >= 40 && ubCurrentSoldier <= 50 ) || ubCurrentSoldier == 58 /*GASTON*/ || ubCurrentSoldier == 59 /*STOGIE*/ ) + { + AddItemToMerc( iNewIndex, MERC_UMBRELLA ); //1361 + } + + //if this is an AIM or MERC merc + if( gJa25SaveStruct.fHaveAimandMercOffferItems ) + { + //if its an aim merc + //if( ubCurrentSoldier < 40 ) + if ( gProfilesAIM[ubCurrentSoldier].ProfilId == ubCurrentSoldier ) + { + //give the mercs one of the promo items + AddItemToMerc( iNewIndex, SAM_GARVER_COMBAT_KNIFE ); //1353 + } + + // if its a merc merc + else if ( gProfilesMERC[ubCurrentSoldier].ProfilId == ubCurrentSoldier ) + //else if( ubCurrentSoldier <= 50 || ubCurrentSoldier == 58 /*GASTON*/ || ubCurrentSoldier == 59 /*STOGIE*/ ) + { + //give the mercs one of the promo items + AddItemToMerc( iNewIndex, CHE_GUEVARA_CANTEEN ); //1359 + AddItemToMerc( iNewIndex, MERC_WRISTWATCH ); //1360 + AddItemToMerc( iNewIndex, SAM_GARVER_COMBAT_KNIFE ); //1353 + } + } +#else //ja25: No enrico, therefore, no email if( DidGameJustStart() ) { // OK, CHECK FOR FIRST GUY, GIVE HIM SPECIAL ITEM! @@ -160,7 +233,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) // ATE: Insert for demo , not using the heli sequence.... pHireMerc->ubInsertionCode = INSERTION_CODE_CHOPPER; } - +#endif //record how long the merc will be gone for pMerc->bMercStatus = (UINT8)pHireMerc->iTotalContractLength; @@ -202,11 +275,47 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) { if( DidGameJustStart() ) { - pHireMerc->uiTimeTillMercArrives = ( gGameExternalOptions.iGameStartingTime + gGameExternalOptions.iFirstArrivalDelay ) / NUM_SEC_IN_MIN; +#ifdef JA2UB + //ja25ub + //set a flag so we know we are doing the heli crash + if ( gGameUBOptions.InGameHeliCrash == TRUE || gGameUBOptions.InGameHeli == FALSE) + gfFirstTimeInGameHeliCrash = TRUE; //AA FALSE ?? + else + gfFirstTimeInGameHeliCrash = FALSE; + // Set time of initial merc arrival in minutes +#endif + pHireMerc->uiTimeTillMercArrives = ( gGameExternalOptions.iGameStartingTime + gGameExternalOptions.iFirstArrivalDelay ) / NUM_SEC_IN_MIN; +#ifdef JA2UB + + if ( gGameUBOptions.InGameHeli == FALSE ) + { + // Set the gridno for the soldier + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + pSoldier->usStrategicInsertionData = GetInitialHeliGridNo( ); + + //Set a "code" to enable the merc to be in the direction we set! + pSoldier->ubInsertionDirection = Random( NUM_WORLD_DIRECTIONS ) + 100; + + if( pSoldier->ubStrategicInsertionCode == 0 ) + { + Assert( 0 ); + } + + pSoldier->fWaitingToGetupFromJA25Start = TRUE; + + pSoldier->fIgnoreGetupFromCollapseCheck = TRUE; + + RESETTIMECOUNTER( pSoldier->GetupFromJA25StartCounter, GetInitialHeliRandomTime() ); + } + else + { + pHireMerc->ubInsertionCode = INSERTION_CODE_CHOPPER; + } +#else // Set insertion for first time in chopper pHireMerc->ubInsertionCode = INSERTION_CODE_CHOPPER; - +#endif //set when the merc's contract is finished pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 ); } @@ -302,7 +411,10 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) pSoldier->ubWhatKindOfMercAmI = MERC_TYPE__NPC; //pSoldier->iTotalContractCharge = -1; } - +#ifdef JA2UB + //Ja25: Need to set start time for all mercs + pSoldier->iStartContractTime = GetWorldDay( ); +#endif //remove the merc from the Personnel screens departed list ( if they have never been hired before, its ok to call it ) RemoveNewlyHiredMercFromPersonnelDepartedList( pSoldier->ubProfile ); @@ -364,7 +476,11 @@ void MercArrivesCallback( UINT8 ubSoldierID ) // OK, If this sector is currently loaded, and guy does not have CHOPPER insertion code.... // ( which means we are at beginning of game if so ) // Setup chopper.... - if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER && pSoldier->sSectorX == 9 && pSoldier->sSectorY == 1 ) + #ifdef JA2UB + if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER && pSoldier->sSectorX == gGameExternalOptions.ubDefaultArrivalSectorX && pSoldier->sSectorY == gGameExternalOptions.ubDefaultArrivalSectorY && gGameUBOptions.InGameHeli == TRUE ) + #else + if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER && pSoldier->sSectorX == gGameExternalOptions.ubDefaultArrivalSectorX && pSoldier->sSectorY == gGameExternalOptions.ubDefaultArrivalSectorY ) + #endif { gfTacticalDoHeliRun = TRUE; @@ -385,9 +501,15 @@ void MercArrivesCallback( UINT8 ubSoldierID ) else { // OK, otherwise, set them in north area, so once we load again, they are here. +#ifdef JA2UB + //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + pSoldier->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; +#else //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH; pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; +#endif } if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER ) @@ -404,7 +526,14 @@ void MercArrivesCallback( UINT8 ubSoldierID ) gsSectorLocatorY = pSoldier->sSectorY; TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT, 2, 0 ); + +//ja25ub +#ifdef JA2UB + //if its the first time in, dont say anything + if( !gfFirstTimeInGameHeliCrash ) +#endif TacticalCharacterDialogue( pSoldier, QUOTE_MERC_REACHED_DESTINATION ); + TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT, 3, 0 ); TacticalCharacterDialogueWithSpecialEventEx( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_UNSET_ARRIVES_FLAG, 0, 0, 0 ); } @@ -514,7 +643,14 @@ void HandleMercArrivesQuotes( SOLDIERTYPE *pSoldier ) { INT8 cnt, bHated, bLastTeamID; SOLDIERTYPE *pTeamSoldier; - +#ifdef JA2UB + //if we are at the begining of the game going through the initial heli scequence + if( pSoldier->fWaitingToGetupFromJA25Start ) + { + //we can "leave" this function cause we dont want to do anything with buddy system + return; + } +#endif // If we are approaching with helicopter, don't say any ( yet ) if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER ) { @@ -657,8 +793,8 @@ void CheckForValidArrivalSector( ) INT16 sLeft, sRight; INT16 cnt1, cnt2, sGoodX, sGoodY; UINT8 ubRadius = 4; - INT32 leftmost; - INT32 sSectorGridNo, sSectorGridNo2; + UINT32 leftmost; + UINT32 sSectorGridNo, sSectorGridNo2; INT32 uiRange, uiLowestRange = 999999; BOOLEAN fFound = FALSE; CHAR16 sString[ 1024 ]; @@ -724,4 +860,203 @@ void CheckForValidArrivalSector( ) } } +#ifdef JA2UB +UINT32 GetInitialHeliGridNo( ) +{ + UINT8 ubCnt; + UINT32 sGridNo; + for( ubCnt=0; ubCnt 1000 ) + fDone = TRUE; + + usCounter++; + } + return( 1000 + Random( 2000 ) ); +} + +void InitializeHeliGridnoAndTime( BOOLEAN fLoading ) +{ + Assert( NUM_INITIAL_GRIDNOS_FOR_HELI_CRASH == 7 ); + + if( !fLoading ) + { + gfFirstTimeInGameHeliCrash = FALSE; + } + + gsInitialHeliGridNo[ 0 ] = gGameUBOptions.InitialHeliGridNo[ 0 ];//14947; + gsInitialHeliGridNo[ 1 ] = gGameUBOptions.InitialHeliGridNo[ 1 ];//15584;//16067; + gsInitialHeliGridNo[ 2 ] = gGameUBOptions.InitialHeliGridNo[ 2 ];//15754; + gsInitialHeliGridNo[ 3 ] = gGameUBOptions.InitialHeliGridNo[ 3 ];//16232; + gsInitialHeliGridNo[ 4 ] = gGameUBOptions.InitialHeliGridNo[ 4 ];//16067; + gsInitialHeliGridNo[ 5 ] = gGameUBOptions.InitialHeliGridNo[ 5 ];//16230; + gsInitialHeliGridNo[ 6 ] = gGameUBOptions.InitialHeliGridNo[ 6 ];//15272; + + gsInitialHeliRandomTimes[ 0 ] = gGameUBOptions.InitalHeliRandomTimes[ 0 ];//1300; + gsInitialHeliRandomTimes[ 1 ] = gGameUBOptions.InitalHeliRandomTimes[ 1 ];//2000; + gsInitialHeliRandomTimes[ 2 ] = gGameUBOptions.InitalHeliRandomTimes[ 2 ];//2750; + gsInitialHeliRandomTimes[ 3 ] = gGameUBOptions.InitalHeliRandomTimes[ 3 ];//3400; + gsInitialHeliRandomTimes[ 4 ] = gGameUBOptions.InitalHeliRandomTimes[ 4 ];//4160; + gsInitialHeliRandomTimes[ 5 ] = gGameUBOptions.InitalHeliRandomTimes[ 5 ];//4700; + gsInitialHeliRandomTimes[ 6 ] = gGameUBOptions.InitalHeliRandomTimes[ 6 ];//5630; +} + +void InitJerryMiloInfo() +{ + if ( gGameUBOptions.InJerry == TRUE ) +{ + // return; //AA + //Set Jerry Milo's Gridno h7 + gMercProfiles[ 76 ].sSectorX = JA2_5_START_SECTOR_X; + gMercProfiles[ 76 ].sSectorY = JA2_5_START_SECTOR_Y; + gMercProfiles[ 76 ].bSectorZ = 0; + + gMercProfiles[ 76 ].sGridNo = gGameUBOptions.JerryGridNo; //15109; + + gMercProfiles[ 76 ].fUseProfileInsertionInfo = TRUE; + + gMercProfiles[ 76 ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gMercProfiles[ 76 ].usStrategicInsertionData = gGameUBOptions.JerryGridNo; //15109; + +} + +if ( gGameUBOptions.InGameHeliCrash == TRUE ) + { + //init Jerry Milo quotes + InitJerryQuotes(); + } +} + + +void UpdateJerryMiloInInitialSector() +{ + SOLDIERTYPE *pSoldier = NULL; + SOLDIERTYPE *pJerrySoldier=NULL; + + + //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; + SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; + //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; + StrategicMap[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; + +if ( gGameUBOptions.InGameHeli == TRUE ) + return; //AA + +if ( gGameUBOptions.InGameHeliCrash == TRUE ) + { + //if it is the first sector we are loading up, place Jerry in the map + if( !gfFirstTimeInGameHeliCrash ) + return; + + if ( gGameUBOptions.InJerry == TRUE ) + { + pSoldier = FindSoldierByProfileID( 76, FALSE ); //JERRY + if( pSoldier == NULL ) + { + Assert( 0 ); + } + + } + + //the internet part of the laptop isnt working. It gets broken in the heli crash. + if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) + StartQuest( QUEST_FIX_LAPTOP, -1, -1 ); + + //Record the initial sector as ours + //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; + SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; + StrategicMap[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; + + if ( gGameUBOptions.InJerry == TRUE ) + { + //Set some variable so Jerry will be on the ground + pSoldier->fWaitingToGetupFromJA25Start = TRUE; + pSoldier->fIgnoreGetupFromCollapseCheck = TRUE; + + //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; //to by³o wy³¹czone + //pSoldier->usStrategicInsertionData = GetInitialHeliGridNo( ); //to by³o wy³¹czone + + RESETTIMECOUNTER( pSoldier->GetupFromJA25StartCounter, gsInitialHeliRandomTimes[ 6 ] + 800 + Random( 400 ) ); + + //should we be on our back or tummy + if( Random( 100 ) < 50 ) + pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); + else + pSoldier->EVENT_InitNewSoldierAnim( FALLBACKHIT_STOP, 1, TRUE ); + } + +//Wont work cause it gets reset every frame + //make sure we can see Jerry + + if ( gGameUBOptions.InJerry == TRUE ) + { + pJerrySoldier = FindSoldierByProfileID(76, FALSE );//JERRY + if( pJerrySoldier != NULL ) + { + //Make sure we can see the pilot + gbPublicOpplist[OUR_TEAM][ pJerrySoldier->ubID ] = SEEN_CURRENTLY; + pJerrySoldier->bVisible = TRUE; + } + + } + + //Lock the interface + guiPendingOverrideEvent = LU_BEGINUILOCK; + } +} + +void AddItemToMerc( UINT8 ubNewMerc, INT16 sItemType ) +{ + + + // OK, give this item to our merc! + OBJECTTYPE gTempObject; + BOOLEAN fReturn=FALSE; + + // make an objecttype + CreateItem(sItemType, 100, &gTempObject); + + // Give it + fReturn = AutoPlaceObject( MercPtrs[ ubNewMerc ], &gTempObject, FALSE ); + + if(!fReturn && (UsingNewInventorySystem() == true)) + { + (MercPtrs[ubNewMerc]->inv[NUM_INV_SLOTS-1]) = gTempObject; + fReturn=TRUE; + } + Assert( fReturn ); + + +} +#endif diff --git a/Tactical/Merc Hiring.h b/Tactical/Merc Hiring.h index e9215d92..78dcf93b 100644 --- a/Tactical/Merc Hiring.h +++ b/Tactical/Merc Hiring.h @@ -41,6 +41,9 @@ typedef struct extern INT16 gsMercArriveSectorX; extern INT16 gsMercArriveSectorY; +//ja25ub +//extern BOOLEAN gfFirstTimeInGameHeliCrash; + INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc); void MercArrivesCallback( UINT8 ubSoldierID ); @@ -55,4 +58,9 @@ void UpdateAnyInTransitMercsWithGlobalArrivalSector( ); UINT32 GetMercArrivalTimeOfDay( ); extern INT16 StrategicPythSpacesAway(INT16 sOrigin, INT16 sDest); -#endif \ No newline at end of file +#ifdef JA2UB +void UpdateJerryMiloInInitialSector(); +void InitializeHeliGridnoAndTime( BOOLEAN fLoading ); +void InitJerryMiloInfo(); +#endif +#endif diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index c8daf2c0..97c32888 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -119,6 +119,13 @@ #include "Luaglobal.h" #include "LuaInitNPCs.h" #include "Interface.h" +#include "Vehicles.h" +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "Soldier Control.h" +#include "ub_config.h" +#endif // OJW - 20090419 UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS = CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS; @@ -194,6 +201,13 @@ extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndRead extern void PlayStealthySoldierFootstepSound( SOLDIERTYPE *pSoldier ); +#ifdef JA2UB +BOOLEAN CanMsgBoxForPlayerToBeNotifiedOfSomeoneElseInSector(); + +extern void PlayStealthySoldierFootstepSound( SOLDIERTYPE *pSoldier ); +//extern BOOLEAN gfFirstTimeInGameHeliCrash; //JA25 UB +#endif + extern BOOLEAN gfSurrendered; // GLOBALS @@ -1087,7 +1101,46 @@ BOOLEAN ExecuteOverhead( ) */ } } +#ifdef JA2UB + //Ja25 UB + // ATE: JA25 additon - poll for getting up from start of game... + if( pSoldier->fWaitingToGetupFromJA25Start ) + { + if( !DialogueActive( ) ) + { + ///if the timer is done, AND no one is talking + if( TIMECOUNTERDONE( pSoldier->GetupFromJA25StartCounter, 0 ) ) + { + //make sure they wont say this again + pSoldier->fWaitingToGetupFromJA25Start = FALSE; + // + //Get the soldier that should say the quote + // + + //if the merc is one of the mercs who has Quote 80, say that + if( pSoldier->ubProfile == 58 ||//GASTON + pSoldier->ubProfile == 59 ||//STOGIE + pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER ) + { + TacticalCharacterDialogue( pSoldier, QUOTE_REPUTATION_REFUSAL ); + } + else + { + // Now make them say their curse sound + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + } + + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, pSoldier->ubProfile, 0, 0, pSoldier->iFaceIndex, 0 ); + } + } + else + { + pSoldier->GetupFromJA25StartCounter += giTimerDiag; + } + } + +#endif // Checkout fading if ( pSoldier->flags.fBeginFade ) { @@ -1333,6 +1386,21 @@ BOOLEAN ExecuteOverhead( ) // Cancel reverse pSoldier->bReverse = FALSE; + BOOLEAN fAimAfterMove = FALSE; + if ( pSoldier->usAnimState == SIDE_STEP_PISTOL_RDY || pSoldier->usAnimState == SIDE_STEP_RIFLE_RDY || + pSoldier->usAnimState == WALKING_PISTOL_RDY || pSoldier->usAnimState == WALKING_RIFLE_RDY ) + { + fAimAfterMove = TRUE; + pSoldier->usPendingAnimation = AIM_RIFLE_STAND; + pSoldier->ubPendingDirection = pSoldier->ubDirection; + } + else if ( pSoldier->usAnimState == SIDE_STEP_DUAL_RDY || pSoldier->usAnimState == WALKING_DUAL_RDY ) + { + fAimAfterMove = TRUE; + pSoldier->usPendingAnimation = AIM_DUAL_STAND; + pSoldier->ubPendingDirection = pSoldier->ubDirection; + } + // OK, if we are the selected soldier, refresh some UI stuff if ( pSoldier->ubID == (UINT8)gusSelectedSoldier ) { @@ -1591,7 +1659,10 @@ BOOLEAN ExecuteOverhead( ) { UnSetUIBusy( pSoldier->ubID ); - pSoldier->SoldierGotoStationaryStance( ); + if ( !fAimAfterMove ) // SANDRO - don't do this after movement with weapon raised + { + pSoldier->SoldierGotoStationaryStance( ); + } } } } @@ -1740,7 +1811,10 @@ BOOLEAN ExecuteOverhead( ) dAngle = gdRadiansForAngle[ pSoldier->bMovementDirection ]; // For walking, base it on body type! - if ( pSoldier->usAnimState == WALKING ) + if ( pSoldier->usAnimState == WALKING || + pSoldier->usAnimState == WALKING_PISTOL_RDY || + pSoldier->usAnimState == WALKING_RIFLE_RDY || + pSoldier->usAnimState == WALKING_DUAL_RDY ) { pSoldier->MoveMerc( gubAnimWalkSpeeds[ pSoldier->ubBodyType ].dMovementChange, dAngle, TRUE ); @@ -1814,6 +1888,37 @@ BOOLEAN ExecuteOverhead( ) } } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - hack! - resolve possible pending interrupt + if(GetSoldier(&pSoldier, gusSelectedSoldier) && gGameExternalOptions.fImprovedInterruptSystem ) + { + if ( pSoldier->bActive ) + { + if ( ResolvePendingInterrupt( pSoldier, UNDEFINED_INTERRUPT ) ) + { + fKeepMoving = FALSE; + pSoldier->AdjustNoAPToFinishMove( TRUE ); + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; + + // "artificially" set lock ui flag in this case + if (pSoldier->bTeam == gbPlayerNum) + { + AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, Message[STR_INTERRUPT] ); + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + } + + // return early + gubNPCAPBudget = 0; + gubNPCDistLimit = 0; + + return( TRUE ); + } + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Turn off auto bandage if we need to... if ( gTacticalStatus.fAutoBandageMode ) { @@ -2442,8 +2547,8 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } else { - // Adjust AP/Breathing points to move - DeductPoints( pSoldier, sAPCost, sBPCost ); + // Adjust AP/Breathing points to move + DeductPoints( pSoldier, sAPCost, sBPCost, MOVEMENT_INTERRUPT ); } // OK, let's check for monsters.... @@ -2702,7 +2807,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) // Set "interrupt occurred" flag to false so that we will know whether *this // particular call* to HandleSight caused an interrupt - gTacticalStatus.fInterruptOccurred = FALSE; + gTacticalStatus.fInterruptOccurred = FALSE; if ( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { @@ -2724,6 +2829,17 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) HandleSight(pSoldier,SIGHT_LOOK | SIGHT_RADIO | SIGHT_INTERRUPT); } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - if pending interrupt flag was set for movement type of interupt, resolve it here + if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + if ( ResolvePendingInterrupt( pSoldier, MOVEMENT_INTERRUPT ) ) + { + AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, Message[STR_INTERRUPT] ); + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // ATE: Check if we have sighted anyone, if so, don't do anything else... // IN other words, we have stopped from sighting... if (gTacticalStatus.fInterruptOccurred) @@ -2860,7 +2976,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); SetFactTrue( FACT_SKYRIDER_CLOSE_TO_CHOPPER ); TriggerNPCRecord( SKYRIDER, 15 ); - SetUpHelicopterForPlayer( 13, MAP_ROW_B, SKYRIDER ); + SetUpHelicopterForPlayer( 13, MAP_ROW_B, gNewVehicle[ HELICOPTER ].NewPilot, HELICOPTER ); } break; @@ -3368,6 +3484,9 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) // handle stuff for Carmen if Slay is killed switch( pSoldier->ubProfile ) { +#ifdef JA2UB +//Ja25 No carmen +#else case SLAY: pTeamSoldier = FindSoldierByProfileID( CARMEN, FALSE ); if (pTeamSoldier && pTeamSoldier->aiData.bAttitude == ATTACKSLAYONLY && !TileIsOutOfBounds(ClosestPC( pTeamSoldier, NULL )) ) @@ -3376,6 +3495,7 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) TriggerNPCRecord( CARMEN, 29 ); } break; +#endif case ROBOT: if (CheckFact( FACT_FIRST_ROBOT_DESTROYED, 0 ) == FALSE ) { @@ -3450,8 +3570,10 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if (pSoldierOld->bTeam == CIV_TEAM ) { + #ifdef JA2UB + #else SOLDIERTYPE * pOther; - + #endif // ATE: Added string to player if ( bVisible != -1 && pSoldierOld->ubProfile != NO_PROFILE ) { @@ -3460,6 +3582,24 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) switch( pSoldierOld->ubProfile ) { +#ifdef JA2UB + case 75: //MORRIS + { + INT8 bSoldierID; + + //Geta a random soldier ID + bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + + //if there is any + if( bSoldierID != -1 ) + { + //say the MORRIS dead quote + TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW ); + } + } + break; + +#else //Ja25: none of these characters are in the exp. case BRENDA: SetFactTrue( FACT_BRENDA_DEAD ); { @@ -3598,13 +3738,22 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) HandleNPCDoAction( DOREEN, NPC_ACTION_FREE_KIDS, 0 ); } break; - // SANDRO - Check if queen bitch is dead + #endif + +#ifdef JA2UB + +#else + // SANDRO - Check if queen bitch is dead case QUEEN: // Muhahahahaaa, QUEST COMPLETED! Give us everything!! Exp, glory, fame! EndQuest( QUEST_KILL_DEIDRANNA, pSoldierOld->sSectorX, pSoldierOld->sSectorY ); - break; + break; +#endif + } - +#ifdef JA2UB +// Ja25no queen +#else // Are we looking at the queen? if ( pSoldierOld->ubProfile == QUEEN ) { @@ -3615,7 +3764,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) BeginHandleDeidrannaDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->pathing.bLevel ); } - +#endif // crows/cows are on the civilian team, but none of the following applies to them if ( ( pSoldierOld->ubBodyType != CROW ) && ( pSoldierOld->ubBodyType != COW ) ) { @@ -3663,6 +3812,10 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) } else // enemies and creatures... should any of this stuff not be called if a creature dies? { + +#ifdef JA2UB +//no queen, or queen monster +#else if ( pSoldierOld->ubBodyType == QUEENMONSTER ) { SOLDIERTYPE *pKiller = NULL; @@ -3674,7 +3827,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) BeginHandleQueenBitchDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->pathing.bLevel ); } } - +#endif if ( pSoldierOld->bTeam == ENEMY_TEAM ) { gTacticalStatus.ubArmyGuysKilled++; @@ -3695,7 +3848,9 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) // reset the chosen one! gTacticalStatus.ubTheChosenOne = NOBODY; } - +#ifdef JA2UB +//no queen, or queen monster +#else if ( pSoldierOld->ubProfile == QUEEN ) { HandleMoraleEvent( NULL, MORALE_DEIDRANNA_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -3710,6 +3865,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) HandleNPCDoAction( 0, NPC_ACTION_GRANT_EXPERIENCE_5, 0 ); } +#endif } @@ -3778,10 +3934,39 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) //if the NPC is a dealer, add the dealers items to the ground AddDeadArmsDealerItemsToWorld( pSoldierOld->ubProfile ); + +#ifdef JA2UB + HandleDeathInPowerGenSector( pSoldierOld ); //ja25 ub + HandleWhenCertainPercentageOfEnemiesDie(); //ja25 ub +#endif //The queen AI layer must process the event by subtracting forces, etc. ProcessQueenCmdImplicationsOfDeath( pSoldierOld ); +#ifdef JA2UB + //------------------- ja25 ub ------------------------- + //if the person was Raul, and we are to say the blown up quotes + if( pSoldierOld->ubProfile == PERKO /*RAUL */ && IsJa25GeneralFlagSet( JA_GF__RAUL_BLOW_HIMSELF_UP ) ) + { + UINT8 SoldierId1; + UINT8 SoldierId2; + //Get some random Soldier ID's of the valid mercs + if( Get3RandomQualifiedMercs( &SoldierId1, &SoldierId2, NULL ) != 0 ) + { + //Say the "he blew himself up quote" + TacticalCharacterDialogue( &Menptr[SoldierId1], QUOTE_GREETING ); + + //if there isnt a second soldier + if( SoldierId2 == NOBODY ) + { + SoldierId2 = SoldierId1; + } + + //say the "darn he took the inventoruy with him" + TacticalCharacterDialogue( &Menptr[SoldierId2], QUOTE_SMALL_TALK ); + } + } +#endif // OK, check for existence of any more badguys! CheckForEndOfBattle( FALSE ); } @@ -3905,10 +4090,14 @@ void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide ) switch( pSoldier->ubProfile ) { +#ifdef JA2UB +//Ja25 No Ira, miguel, etc +#else case IRA: case DIMITRI: case MIGUEL: case CARLOS: +#endif case MADLAB: case DYNAMO: case SHANK: @@ -3989,6 +4178,16 @@ void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide ) { CheckForPotentialAddToBattleIncrement( pSoldier ); } + + + //uses Lua + PROFILLUA2_ubProfile = pSoldier->ubProfile; + PROFILLUA2_sSectorX = pSoldier->sSectorX; + PROFILLUA2_sSectorY = pSoldier->sSectorY; + PROFILLUA2_bSectorZ = pSoldier->bSectorZ; + PROFILLUA2_sGridNo = pSoldier->sGridNo; + + //LetLuaMyCustomHandleAtNewGridNo(bNewSide,NULL, 1); } UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked ) @@ -5703,6 +5902,7 @@ void CommonEnterCombatModeCode( ) gTacticalStatus.fLastBattleWon = FALSE; gTacticalStatus.fItemsSeenOnAttack = FALSE; + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; // ATE: If we have an item pointer end it! CancelItemPointer( ); @@ -5748,6 +5948,9 @@ void CommonEnterCombatModeCode( ) // carryover for this battle. So we'll hit it again. pSoldier->CalcNewActionPoints( ); + // SANDRO - Improved Interrupt System - reset interrupt counter + memset(pSoldier->aiData.ubInterruptCounter,0,sizeof(pSoldier->aiData.ubInterruptCounter)); + if ( pSoldier->ubProfile != NO_PROFILE ) { if ( pSoldier->bTeam == CIV_TEAM && pSoldier->aiData.bNeutral ) @@ -5971,6 +6174,11 @@ void ExitCombatMode( ) // since this would be the same as what would happen at the end of the turn gTacticalStatus.uiTimeSinceLastOpplistDecay = __max( 0, GetWorldTotalSeconds() - TIME_BETWEEN_RT_OPPLIST_DECAYS ); NonCombatDecayPublicOpplist( GetWorldTotalSeconds() ); + +#ifdef JA2UB + //if we are in J13 and the fan is stopped, handle it + HandleFanStartingAtEndOfCombat(); +#endif } @@ -5989,7 +6197,14 @@ void SetEnemyPresence( ) // Change music modes.. // If we are just starting game, don't do this! + +#ifdef JA2UB + //Ja25: no meanwhiles + if ( !DidGameJustStart() ) +#else if ( !DidGameJustStart() && !AreInMeanwhile( ) ) + +#endif { SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false")); @@ -6512,7 +6727,11 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) SetFactTrue( FACT_FIRST_BATTLE_FOUGHT ); SetFactFalse( FACT_FIRST_BATTLE_BEING_FOUGHT ); SetTheFirstBattleSector( (INT16) (gWorldSectorX + gWorldSectorY * MAP_WORLD_X) ); +#ifdef JA2UB +//Ja25 no meanwhile +#else HandleFirstBattleEndingWhileInTown( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE ); +#endif } if( NumEnemyInSectorExceptCreatures() ) @@ -6766,7 +6985,11 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) SetFactTrue( FACT_FIRST_BATTLE_WON ); SetFactFalse( FACT_FIRST_BATTLE_BEING_FOUGHT ); SetTheFirstBattleSector( (INT16) (gWorldSectorX + gWorldSectorY * MAP_WORLD_X) ); +#ifdef JA2UB +//Ja25 no meanwhile +#else HandleFirstBattleEndingWhileInTown( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE ); +#endif } } @@ -7932,6 +8155,10 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp } else { + +#ifdef JA2UB +//Ja25: No carmen +#else if (pTarget->ubProfile == CARMEN)// Carmen { // Special stuff for Carmen the bounty hunter @@ -7941,7 +8168,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp pTarget->aiData.bAttitude = AGGRESSIVE; } } - +#endif if ( pTarget->ubCivilianGroup && ( (pTarget->bTeam == gbPlayerNum) || pTarget->aiData.bNeutral ) ) { #ifdef JA2TESTVERSION @@ -8184,7 +8411,9 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) return( NULL ); } } - +#ifdef JA2UB +//Ja25 no queen +#else // ATE: IN MEANWHILES, we have 'combat' in realtime.... // this is so we DON'T call freeupattacker() which will cancel // the AI guy's meanwhile NPC stuff. @@ -8193,7 +8422,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) { return( NULL ); } - +#endif #if 0 // 0verhaul: This is moved to the end loop where everybody's state is reset for the next action if (pTarget) @@ -8334,7 +8563,11 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) // Go into combat! // If we are in a meanwhile... don't enter combat here... +#ifdef JA2UB +//Ja25 no meanwhiles +#else if ( !AreInMeanwhile( ) ) +#endif { EnterCombatMode( pSoldier->bTeam ); } @@ -8427,6 +8660,25 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) pSoldier->sLastTarget = pSoldier->sTargetGridNo; } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - if pending interrupt flag was set for after-shot type of interupt, try to resolve it now + if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + if ( ResolvePendingInterrupt( pSoldier, AFTERSHOT_INTERRUPT ) ) + { + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; + // "artificially" set lock ui flag + if (pSoldier->bTeam == gbPlayerNum) + { + AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, Message[STR_INTERRUPT] ); + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + } + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Reset various flags and values that should be 0 once the action is overwith for (cnt = 0; cnt < guiNumMercSlots; cnt++) { @@ -9199,3 +9451,105 @@ INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier ) return(sModifier); } + + +#ifdef JA2UB +void SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector() +{ + //if the player in the same sector as MANUEL + if( !CanMsgBoxForPlayerToBeNotifiedOfSomeoneElseInSector() ) + { + return; + } + + gJa25SaveStruct.fShouldMsgBoxComeUpSayingSomeoneImportantIsInSector = TRUE; +} + +void HandleThePlayerBeNotifiedOfSomeoneElseInSector() +{ + //if we shouldnt be here, get out + if( !gJa25SaveStruct.fShouldMsgBoxComeUpSayingSomeoneImportantIsInSector ) + { + return; + } + + //if somehting else is going on, leave + if( gTacticalStatus.fAutoBandageMode || + DialogueActive( ) || + gTacticalStatus.fAutoBandagePending || + guiPendingScreen == MSG_BOX_SCREEN || + guiCurrentScreen == MSG_BOX_SCREEN || + AreWeInAUIMenu( ) + ) + { + return; + } + + gJa25SaveStruct.fShouldMsgBoxComeUpSayingSomeoneImportantIsInSector = FALSE; + + //if the player in the same sector as MANUEL + if( !CanMsgBoxForPlayerToBeNotifiedOfSomeoneElseInSector() ) + { + return; + } + + DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TACT_MSG__SOMEONE_ELSE_IN_SECTOR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); + +} + +BOOLEAN CanMsgBoxForPlayerToBeNotifiedOfSomeoneElseInSector() +{ + // ATE: if this is a custom map, return +/* if ( gbWorldSectorZ == 0 ) + { + if ( SectorInfo[ SECTOR( gWorldSectorY, gWorldSectorX ) ].fCustomSector ) + { + return( FALSE ); + } + } +*/ + if( ( gWorldSectorX == gMercProfiles[ 60 ].sSectorX && gWorldSectorY == gMercProfiles[ 60 ].sSectorY && gbWorldSectorZ == gMercProfiles[ 60 ].bSectorZ ) ) + { + //IF MANUEL is already hired + if( gMercProfiles[ 60 ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) + { + //then we shouldnt display the message + return( FALSE ); + } + + return( TRUE ); + } + + return( FALSE ); +} + + +INT8 NumMercsOnPlayerTeam( ) +{ + INT32 cnt; + SOLDIERTYPE *pSoldier; + UINT8 ubCount = 0; + + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) + { + if( pSoldier->bActive && pSoldier->stats.bLife > 0 ) + { + ubCount++; + } + } + + return( ubCount ); +} + +void HandleDisplayingOfPlayerLostDialogue( void ) +{ + //if the laptop transmitter is broken, and the player doesnt have any other team members + if( gubQuest[ QUEST_FIX_LAPTOP ] != QUESTDONE && NumMercsOnPlayerTeam( ) == 0 && gGameUBOptions.LaptopQuestEnabled == TRUE ) + { + gJa25SaveStruct.ubDisplayPlayerLostMsgBox = 1; + } +} +#endif diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index bb14dfd1..f5c13c3b 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -179,8 +179,9 @@ typedef struct UINT8 ubMorePadding; UINT16 sCreatureTenseQuoteDelay; UINT32 uiCreatureTenseQuoteLastUpdate; - // SANDRO - added this + // SANDRO - added these UINT8 ubLastRequesterSurgeryTargetID; + UINT8 ubInterruptPending; // PADDING GONE!!!!! @@ -366,6 +367,18 @@ UINT8 NumPCsInSector( void ); void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier ); void SetSoldierNeutral( SOLDIERTYPE * pSoldier ); +#ifdef JA2UB +void HandleThePlayerBeNotifiedOfSomeoneElseInSector(); +void SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector(); + +void HandleDisplayingOfPlayerLostDialogue( void ); + +// UTILITY FUNCTIONS +INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); +UINT8 NumEnemyInSector( ); +UINT8 NumCapableEnemyInSector( ); +INT8 NumMercsOnPlayerTeam( ); +#endif extern BOOLEAN sniperwarning; extern BOOLEAN biggunwarning; diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 1f038704..dab831c3 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -3539,7 +3539,18 @@ if(!GridNoOnVisibleWorldTile(iDestination)) ubAPCost += APBPConstants[AP_MODIFIER_RUN]; //ubAPCost = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); break; break; + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: + ubAPCost += APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY]; //WALKCOST); + break; case WALKING: + ubAPCost += APBPConstants[AP_MODIFIER_WALK]; //WALKCOST); + if (!(s->MercInWater()) && ( (gAnimControl[ s->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ s->usAnimState ].uiFlags & ANIM_FIRE ) )) + { + ubAPCost += APBPConstants[AP_MODIFIER_READY]; //WALKCOST); + } + break; case ROBOT_WALK: ubAPCost += APBPConstants[AP_MODIFIER_WALK]; //WALKCOST); break; @@ -3573,6 +3584,9 @@ if(!GridNoOnVisibleWorldTile(iDestination)) { case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: // Here pessimistically assume the path will continue after hopping the fence ubAPCost += GetAPsCrouch( s, TRUE ); // SANDRO - changed break; @@ -3595,6 +3609,9 @@ if(!GridNoOnVisibleWorldTile(iDestination)) { case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: // charge crouch APs for ducking head! ubAPCost += GetAPsCrouch( s, TRUE ); // SANDRO - changed break; @@ -4452,6 +4469,9 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl { case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: // Add here cost to go from crouch to stand AFTER fence hop.... // Since it's AFTER.. make sure we will be moving after jump... @@ -4493,6 +4513,9 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl { case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: // charge crouch APs for ducking head! sExtraCostStand += GetAPsCrouch(pSold, TRUE); // changed by SANDRO break; @@ -4513,7 +4536,19 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl sMovementAPsCost = sTileCost + APBPConstants[AP_MODIFIER_RUN]; break; case WALKING: - sMovementAPsCost = sTileCost + APBPConstants[AP_MODIFIER_WALK]; + if (!(pSold->MercInWater()) && ( (gAnimControl[ pSold->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSold->usAnimState ].uiFlags & ANIM_FIRE ) )) + { + sMovementAPsCost = sTileCost + APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY]; + } + else + { + sMovementAPsCost = sTileCost + APBPConstants[AP_MODIFIER_WALK]; + } + break; + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: + sMovementAPsCost = sTileCost + APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY]; break; case SWATTING: sMovementAPsCost = sTileCost + APBPConstants[AP_MODIFIER_SWAT]; @@ -4593,6 +4628,11 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl sPointsSwat += sMovementAPsCost + APBPConstants[AP_MODIFIER_SWAT]; sPointsRun += sMovementAPsCost + APBPConstants[AP_MODIFIER_RUN]; } + // walking with weapon raised? + if (!(pSold->MercInWater()) && ( (gAnimControl[ pSold->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSold->usAnimState ].uiFlags & ANIM_FIRE ) )) + { + sPointsWalk += APBPConstants[AP_MODIFIER_READY]; + } // Check for stealth mode if ( pSold->bStealthMode || bStealth ) { diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index d2cc5177..3163978b 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -34,6 +34,8 @@ #include "Map Information.h" #include "Interface Items.h" #include "Soldier Control.h" // added by SANDRO + #include "opplist.h" // added by SANDRO + #include "lighting.h" // added by SANDRO #endif #include "connect.h" //rain @@ -275,6 +277,11 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bDir, UINT return(0); } + if ( ubMovementCost == WALKING_PISTOL_RDY || ubMovementCost == WALKING_RIFLE_RDY || ubMovementCost == WALKING_DUAL_RDY ) + { + iPoints += APBPConstants[BP_MOVEMENT_READY]; + } + iPoints = iPoints * BreathPointAdjustmentForCarriedWeight( pSoldier ) / 100; // ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER @@ -293,9 +300,15 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bDir, UINT iPoints *= APBPConstants[BP_RUN_ENERGYCOSTFACTOR]; break; case SIDE_STEP: + case SIDE_STEP_PISTOL_RDY: + case SIDE_STEP_RIFLE_RDY: + case SIDE_STEP_DUAL_RDY: case WALK_BACKWARDS: case BLOODCAT_WALK_BACKWARDS: case MONSTER_WALK_BACKWARDS: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: case WALKING : iPoints *= APBPConstants[BP_WALK_ENERGYCOSTFACTOR]; break; case START_SWAT: @@ -310,7 +323,7 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bDir, UINT // SANDRO - STOMP traits - Athletics reduce breath points spent for moving if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, ATHLETICS_NT )) { - iPoints = max(1, (INT16)((iPoints * (100 - gSkillTraitValues.ubATAPsMovementReduction) / 100) + 0.5)); + iPoints = max(1, (INT16)((iPoints * (100 - gSkillTraitValues.ubATBPsMovementReduction) / 100) + 0.5)); } // ATE: Adjust these by realtime movement @@ -378,6 +391,18 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 u case LARVAE_WALK: case WALKING : sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK]; + if ( usMovementMode == WALKING && !(pSoldier->MercInWater()) && ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) )) + { + sPoints += APBPConstants[AP_MODIFIER_READY]; + } + break; + case SIDE_STEP_PISTOL_RDY: + case SIDE_STEP_RIFLE_RDY: + case SIDE_STEP_DUAL_RDY: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: + sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY]; break; case START_SWAT: case SWAT_BACKWARDS: @@ -435,8 +460,14 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 u { case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: case LARVAE_WALK: case SIDE_STEP: + case SIDE_STEP_PISTOL_RDY: + case SIDE_STEP_RIFLE_RDY: + case SIDE_STEP_DUAL_RDY: case WALK_BACKWARDS: // charge crouch APs for ducking head! sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed @@ -501,6 +532,18 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, case LARVAE_WALK: case WALKING : sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK]; + if (!(pSoldier->MercInWater()) && ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) )) + { + sPoints += APBPConstants[AP_MODIFIER_READY]; + } + break; + case SIDE_STEP_PISTOL_RDY: + case SIDE_STEP_RIFLE_RDY: + case SIDE_STEP_DUAL_RDY: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: + sPoints = sTileCost + APBPConstants[AP_MODIFIER_WALK] + APBPConstants[AP_MODIFIER_READY]; break; case START_SWAT: case SWAT_BACKWARDS: @@ -564,9 +607,15 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, switch(usMovementMode) { case SIDE_STEP: + case SIDE_STEP_PISTOL_RDY: + case SIDE_STEP_RIFLE_RDY: + case SIDE_STEP_DUAL_RDY: case WALK_BACKWARDS: case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: // Add here cost to go from crouch to stand AFTER fence hop.... // Since it's AFTER.. make sure we will be moving after jump... @@ -596,7 +645,13 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, { case RUNNING: case WALKING : + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: case SIDE_STEP: + case SIDE_STEP_PISTOL_RDY: + case SIDE_STEP_RIFLE_RDY: + case SIDE_STEP_DUAL_RDY: case WALK_BACKWARDS: // charge crouch APs for ducking head! sPoints += GetAPsCrouch(pSoldier, TRUE); // SANDRO changed.. @@ -670,7 +725,7 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE } -void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN fProactive ) +void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, UINT8 ubInterruptType ) { INT16 sNewAP = 0; INT8 bNewBreath; @@ -733,7 +788,7 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f // Snap: award some health and strength for exertion // Do 4 StatChange rolls for health (2 for strength) per 10 breath points spent? // NB: The scale of iBPCost is 100 per breath point (APBPConstants[BP_RATIO_RED_PTS_TO_NORMAL]) - if ( PTR_OURTEAM && iBPCost >= APBPConstants[BP_MOVEMENT_GRASS] && fProactive + if ( PTR_OURTEAM && iBPCost >= APBPConstants[BP_MOVEMENT_GRASS] && ubInterruptType != DISABLED_INTERRUPT && (INT32) PreRandom( 10 * APBPConstants[BP_RATIO_RED_PTS_TO_NORMAL] ) < iBPCost ) { StatChange(pSoldier, HEALTHAMT, 4, FALSE); @@ -791,6 +846,95 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f // UPDATE BAR DirtyMercPanelInterface( pSoldier, DIRTYLEVEL1 ); + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - Interrupt counter + if( gGameExternalOptions.fImprovedInterruptSystem && sAPCost > 0 && ubInterruptType != DISABLED_INTERRUPT ) + { + UINT8 ubPointsRegistered = 0; + UINT16 uCnt = 0; + SOLDIERTYPE *pOpponent; + BOOLEAN fFoundInterrupter = FALSE; + + for ( uCnt = 0; uCnt <= MAX_NUM_SOLDIERS; uCnt++ ) + { + // first find all guys who watch us + pOpponent = MercPtrs[ uCnt ]; + if ( pOpponent == NULL) + continue; // not here or not even breathing -> next! + if ( pOpponent->stats.bLife < OKLIFE || pOpponent->bCollapsed || !pOpponent->bActive ) + continue; // not here or not even breathing -> next! + if ( pSoldier->bTeam == pOpponent->bTeam ) + continue; // same team? -> next! + if ( pSoldier->bSide == pOpponent->bSide ) + continue; // not enemy + if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) ) + continue; // neutral + + // if we see or hear him + // dunno if this is the best solution yet, probably yes + if ( pOpponent->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY || + pOpponent->aiData.bOppList[pSoldier->ubID] == HEARD_THIS_TURN) + //if (SoldierToSoldierLineOfSightTest( pOpponent, pSoldier, TRUE, CALC_FROM_WANTED_DIR ) != 0) + { + // calculate how much points do we "register" (let's try to avoid chance-based calc to not inspire save-load mania) + // Experience says how well is the observer able to notice and percieve the environment around him, i.e. gives us the actual chance per AP + if ( pOpponent->aiData.bOppList[pSoldier->ubID] == HEARD_THIS_TURN ) + { + // if we only heard him, keep it lower + ubPointsRegistered = (gGameExternalOptions.ubBasicPercentRegisterValueIIS - 20) + + (gGameExternalOptions.ubPercentRegisterValuePerLevelIIS * EffectiveExpLevel( pOpponent )); // base 40% + 4% per level + } + else + { + ubPointsRegistered = gGameExternalOptions.ubBasicPercentRegisterValueIIS + + (gGameExternalOptions.ubPercentRegisterValuePerLevelIIS * EffectiveExpLevel( pOpponent )); // base 60% + 4% per level + } + // adjust by range to target + //INT32 iRange = GetRangeInCellCoordsFromGridNoDiff( pOpponent->sGridNo, pSoldier->sGridNo ); // calculate actual range + //INT16 iDistVisible = (pOpponent->GetMaxDistanceVisible(pOpponent->sGridNo, pOpponent->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE); // how far do we see + ubPointsRegistered -= ( 25 * GetRangeInCellCoordsFromGridNoDiff( pOpponent->sGridNo, pSoldier->sGridNo ) / + (pOpponent->GetMaxDistanceVisible(pOpponent->sGridNo, pOpponent->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE) ); // -1% registered by 4% of the difference of how far we can see and how far is the target + + if ( gGameOptions.fNewTraitSystem ) + { + // Martial Arts trait reduces the points registered when moving + if ( HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && (ubInterruptType == SP_MOVEMENT_INTERRUPT || ubInterruptType == MOVEMENT_INTERRUPT )) + { + ubPointsRegistered -= gSkillTraitValues.ubMAReducedAPsRegisteredWhenMoving * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ); + } + // Stealhty trait reduced the points registered on all actions + if ( HAS_SKILL_TRAIT( pSoldier, STEALTHY_NT ) ) + { + ubPointsRegistered -= gSkillTraitValues.ubSTReducedAPsRegistered; + } + } + + // ALRIGHT! Get final value + ubPointsRegistered = max( 5, min( 100, ubPointsRegistered ) ); // 5% is minimum, 100% maximum + ubPointsRegistered = (UINT8)((sAPCost * ubPointsRegistered / 100) + 0.5); // now calc how many APs we will award and store it in ubPointsRegistered + + // increase the counter + if ( ubPointsRegistered ) + { + pOpponent->aiData.ubInterruptCounter[pSoldier->ubID] += ubPointsRegistered; + fFoundInterrupter = TRUE; + } + } + } + // if interrupted, freeze our guy and trigger interrupt situation + if (fFoundInterrupter) + { + // if we've got the special movement flag type here, pass it to after-action type + // it's only meant for martial arts bonuses + if ( ubInterruptType == SP_MOVEMENT_INTERRUPT ) + { + ubInterruptType = AFTERACTION_INTERRUPT; + } + // OK, something happened, set the interrupt pending flag + gTacticalStatus.ubInterruptPending = ubInterruptType; + } + } + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } @@ -1107,6 +1251,9 @@ INT16 GetBreathPerAP( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) break; case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: sBreathPerAP = APBPConstants[BP_PER_AP_LT_EFFORT]; break; @@ -2111,6 +2258,9 @@ INT8 MinAPsToStartMovement( SOLDIERTYPE * pSoldier, UINT16 usMovementMode ) { case RUNNING: case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE) { bAPs += GetAPsCrouch(pSoldier, TRUE) + GetAPsProne(pSoldier, TRUE); diff --git a/Tactical/Points.h b/Tactical/Points.h index 9cc24e5b..36651392 100644 --- a/Tactical/Points.h +++ b/Tactical/Points.h @@ -287,7 +287,7 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, BOOLEAN SelectedMercCanAffordMove( ); BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLEAN fDisplayMsg ); -void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLEAN fProactive = TRUE ); +void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, UINT8 ubInterruptType = 2 ); // SANDRO - change for improved interrupt system (ubInterruptType = 2 = UNDEFINED_INTERRUPT) INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost); void UnusedAPsToBreath(SOLDIERTYPE *pSold); INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT32 sGridNo,INT8 bDir, UINT16 usMovementMode); diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 6e809881..ba58e3d2 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -45,6 +45,8 @@ #include "Interface.h" #endif +#include "Animation Control.h" + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -1332,7 +1334,7 @@ void MercLooksForCorpses( SOLDIERTYPE *pSoldier ) if ( Random( 400 ) <= 2 ) { INT32 cnt; - INT16 sGridNo; + INT32 sGridNo; ROTTING_CORPSE *pCorpse; // Loop through all corpses.... diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 8dbd91a2..2753a360 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -57,6 +57,17 @@ #include "Interface Enhanced.h" #endif +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "MapScreen Quotes.h" +#include "email.h" +#include "interface Dialogue.h" +#include "Ja25_Tactical.h" +#include "ub_config.h" +#endif + #include "BuildDefines.h" #include @@ -281,13 +292,28 @@ SKIRGBCOLOR SkiGlowColorsA[]={ #define FLO_DISCOUNT_PERCENTAGE 10 +#ifdef JA2UB +#define SKI_BETTY_MINIMUM_AMOUNT_TO_SET_FACT 10 +#define SKI_RAUL_MINIMUM_AMOUNT_TO_SET_FACT 100 +#endif //////////////////////////////////////////// // // Global Variables // /////////////////////////////////////////// +#ifdef JA2UB +//ja25 UB +enum +{ + TRNSMTR_MSG_BOX__NONE, + TRNSMTR_MSG_BOX__1_FRAME_WAIT, + TRNSMTR_MSG_BOX__DISPLAY_BOX, +}; +void AskUserToAttachTransmitterToLaptop(); +void AttachLaptopTransmitterToLaptop( UINT8 ubExitValue ); +#endif UINT32 guiMainTradeScreenImage; UINT32 guiCornerWhereTacticalIsStillSeenImage; //This image is for where the corner of tactical is still seen through the shop keeper interface @@ -354,6 +380,9 @@ INT32 giPopUpBoxId=-1; BOOLEAN gfIsTheShopKeeperTalking; +#ifdef JA2UB +UINT8 gubDisplayMsgBoxAskingUserToAttachTransmitter=0; // Ja25 UB +#endif // the glow for unwanted items BOOLEAN fDeltaColorForShopkeepUnwanted = TRUE; @@ -382,6 +411,10 @@ BOOLEAN gfExitSKIDueToMessageBox=FALSE; OBJECTTYPE *pShopKeeperItemDescObject=NULL; +#ifdef JA2UB +BOOLEAN gfCanSayMakeTransactionQuote; //ja25 UB +#endif + UINT32 guiNextFreeInvSlot; BOOLEAN gfStartWithRepairsDelayedQuote = FALSE; @@ -674,7 +707,6 @@ void HatchOutInvSlot( UINT16 usPosX, UINT16 usPosY ); extern BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); - #ifdef JA2TESTVERSION BOOLEAN gfTestDisplayDealerCash = FALSE; void DisplayAllDealersCash(); @@ -1232,7 +1264,15 @@ ATM: // by default re-enable calls to PerformTransaction() gfPerformTransactionInProgress = FALSE; - +#ifdef JA2UB + //JA25 UB + //if the dealer is RAUL + if( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) + { + //set the fact the raul refreshed his inventory + SetFactFalse( FACT_RAULS_INVENTORY_CHANGED_SINCE_LAST_VISIT ); + } +#endif return( TRUE ); } @@ -1357,7 +1397,28 @@ BOOLEAN ExitShopKeeperInterface() MSYS_EnableRegion(&gRadarRegion); gfSMDisableForItems = FALSE; +#ifdef JA2UB + //JA25 UB + //Check to see if a merc should say something + //CheckForValidQuotesWhenLeavingDealer( gTalkPanel.ubCharNum ); + //if the laptop was just fixed + if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE && !( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__PLAYER_SAID_LAPTOP_FIXED_QUOTE ) ) + { + + INT8 bSoldierID=-1; + + + //Have a new merc say a quote + bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + if( bSoldierID != -1 ) + { + TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_SPARE2 ); + } + + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__PLAYER_SAID_LAPTOP_FIXED_QUOTE; + } +#endif return( TRUE ); } @@ -1483,6 +1544,24 @@ void HandleShopKeeperInterface() { DisplayTheSkiDropItemToGroundString(); } +#ifdef JA2UB + //ja25 UB + else if( gubDisplayMsgBoxAskingUserToAttachTransmitter != TRNSMTR_MSG_BOX__NONE ) + { + if( gubDisplayMsgBoxAskingUserToAttachTransmitter == TRNSMTR_MSG_BOX__1_FRAME_WAIT ) + { + gubDisplayMsgBoxAskingUserToAttachTransmitter = TRNSMTR_MSG_BOX__DISPLAY_BOX; + } + else if( gubDisplayMsgBoxAskingUserToAttachTransmitter == TRNSMTR_MSG_BOX__DISPLAY_BOX ) + { + //Tell user that they are attaching the transmitter + AskUserToAttachTransmitterToLaptop(); + + //clear the flag + gubDisplayMsgBoxAskingUserToAttachTransmitter = TRNSMTR_MSG_BOX__NONE; + } + } +#endif } @@ -3086,13 +3165,16 @@ BOOLEAN RepairIsDone(DEALER_SPECIAL_ITEM* pSpecial) } } +#ifdef JA2UB + //no UB +#else // if the item is imprinted (by anyone, even player's mercs), and it's Fredo repairing it if ( ( gbSelectedArmsDealerID == ARMS_DEALER_FREDO ) ) { // then reset the imprinting! RepairItem.ItemObject[0]->data.ubImprintID = NO_PROFILE; } - +#endif //try to add the item to the players offer area INT8 bSlotNum; bSlotNum = AddItemToPlayersOfferArea( RepairItem.ubIdOfMercWhoOwnsTheItem, &RepairItem, -1 ); @@ -3149,6 +3231,9 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, UINT32 uiTotalPrice = 0; UINT32 uiDiscountValue; // UINT32 uiDifFrom10 = 0; +#ifdef JA2UB +UINT8 ubItemsNotCounted = 0; //ja25 UB +#endif std::vector uiItemPrice; uiItemPrice.resize(pItemObject->ubNumberOfObjects); @@ -3267,6 +3352,78 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, // we're always count the first one uiTotalPrice = uiUnitPrice; + +#ifdef JA2UB + //---------------------------JA25 UB--------------- + // if NOT pricing just one + if ( !fUnitPriceOnly ) + { + // add value of all that weren't already counted + uiTotalPrice += ( ubItemsNotCounted * uiUnitPrice ); + } + + //if the dealer is Raul + if( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) + { + //if the item is the antique musket + if( usItemID == HAND_CANNON ) //4498 + { + //if the "Find anitque musket" quest is active + if( gubQuest[ QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL ] == QUESTINPROGRESS ) + { + //the price should be.... nothin ( reward for the quest ) + uiTotalPrice = 1; + + //if the player hasnt said the quote before + if( !( gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags & ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_48 ) ) + { + StartShopKeeperTalking( SK_QUOTES_NPC_SPECIFIC_48 ); + gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags |= ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_48; + gfCanSayMakeTransactionQuote = FALSE; + } + + //else if + if( gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags & ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_49 ) + { + //if the player hasnt said it before + if( !( gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags & ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_50 ) ) + { + StartShopKeeperTalking( SK_QUOTES_NPC_SPECIFIC_50 ); + gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags |= ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_50; + } + + //the price should be + uiTotalPrice = 100; + } + } + } + + //if the item is the barrat + if( usItemID == BARRETT_UB ) + { + //and if the player found the antique musket for Raul + if( IsJa25GeneralFlagSet( JA_GF__BARRETT_IS_HALF_PRICE ) ) + { + //the barrett is half off + uiTotalPrice /= 2; + } + } + } + + //JA25UB + //if the dealer is Raul + if( gbSelectedArmsDealerID == ARMS_DEALER_BETTY ) + { + //if the item is the antique musket + if( usItemID == TEX_MOVIE_ATTACK_CLYDESDALES || usItemID == TEX_MOVIE_WILD_EAST || usItemID == TEX_MOVIE_HAVE_HONDA ) + // if( usItemID == 1356 || usItemID == 1357 || usItemID == 1358 ) + { + //Make the item price top be what is listed in the item table ( 20 ) + uiTotalPrice = Item[ usItemID ].usPrice; + } + } + +#endif return( uiTotalPrice ); } @@ -3922,7 +4079,29 @@ void PerformTransaction( UINT32 uiMoneyFromPlayersAccount ) //Move all dealers offered items to the player MoveAllArmsDealersItemsInOfferAreaToPlayersOfferArea( ); +#ifdef JA2UB + //JA25 UB + //if the arms dealer is Raul + if( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) + { + //if this is the first time that the player purchased somehting form raul + if( gArmsDealerStatus[ gbSelectedArmsDealerID ].fHasSoldSomethingToPlayer == FALSE ) + { + //if RAUL doesnt have the BARRETT anymore ie the player already bought it + //if( gArmsDealersInventory[ ARMS_DEALER_PERKO ][ BARRETT ].ubTotalItems != 0 ) + //{ + if( gubQuest[ QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL ] == QUESTNOTSTARTED ) + { + //Raul Start the quest and have Raul say somehitng + StartShopKeeperTalking( SK_QUOTES_NPC_SPECIFIC_46 ); + StartShopKeeperTalking( SK_QUOTES_NPC_SPECIFIC_47 ); + StartQuest( QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL, -1, -1 ); + } + //} + } + } +#endif //if the arms dealer is the type of person to give change if( armsDealerInfo[ gbSelectedArmsDealerID ].uiFlags & ARMS_DEALER_GIVES_CHANGE ) @@ -3951,7 +4130,34 @@ void PerformTransaction( UINT32 uiMoneyFromPlayersAccount ) else if( iChangeToGiveToPlayer == 0 ) StartShopKeeperTalking( SK_QUOTES_PLAYER_HAS_EXACTLY_ENOUGH_MONEY_FOR_TRANSACTION ); } +#ifdef JA2UB + //Bought from dealer specific stuff + //if the arms dealer is Betty, set fact 403 + if( gbSelectedArmsDealerID == ARMS_DEALER_BETTY ) + { + //if the player spent more the X + if( uiMoneyFromPlayersAccount >= SKI_BETTY_MINIMUM_AMOUNT_TO_SET_FACT ) + { + //set the fact + SetFactTrue( FACT_PLAYER_PAID_BETTY_MORE_THEN_X_FOR_ITEM ); + } + } + + //if the arms dealer is Raul, set fact 407 + if( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) + { + //if the player spent more the X + if( uiMoneyFromPlayersAccount >= SKI_RAUL_MINIMUM_AMOUNT_TO_SET_FACT ) + { + //set the fact + SetFactTrue( FACT_PLAYER_BOUGHT_SOMETHING_FROM_RAUL ); + } + } + + //Remeber the fact that the player has sold somehting to the player + gArmsDealerStatus[ gbSelectedArmsDealerID ].fHasSoldSomethingToPlayer = TRUE; +#endif //if the arms dealer is tony if( gbSelectedArmsDealerID == ARMS_DEALER_TONY ) @@ -3990,19 +4196,67 @@ void MoveAllArmsDealersItemsInOfferAreaToPlayersOfferArea( ) //for all items in the dealers items offer area UINT32 uiCnt; INT16 bSlotID=0; - +#ifdef JA2UB + BOOLEAN fAddItemToPlayer=TRUE; +#endif //loop through all the slots in the shopkeeper's offer area for( uiCnt=0; uiCntdata.money.uiMoneyAmount; } +#ifdef JA2UB + else + { + fAddItemToDealer = TRUE; + + //if the dealer is raul + if( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) + { + //if the item is the cannon balls + if( PlayersOfferArea[ uiCnt ].sItemIndex == CLIP_CANNON_BALL )// 4499 ) + { + fAddItemToDealer = FALSE; + } + + //if the item is the antique musket + if( PlayersOfferArea[ uiCnt ].sItemIndex == HAND_CANNON )// 4498 ) + { + //Only do this if the player knew about the cannon offer + if( gubQuest[ QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL ] == QUESTINPROGRESS ) + { + //Have raul say a quote + StartShopKeeperTalking( SK_QUOTES_NPC_SPECIFIC_51 ); + + //Trigger Rauls action #52 + TriggerNPCRecord( PERKO, 52 ); + + //Remeber to discount the barrett + SetJa25GeneralFlag( JA_GF__BARRETT_IS_HALF_PRICE ); + } + + //Mark the quest done + EndQuest( QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL, -1, -1 ); + + fAddItemToDealer = FALSE; + } + } + + //if we ARE to transfer the item + if( fAddItemToDealer ) + { + //if the dealer doesn't strictly buy items from the player, give the item to the dealer + if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_BUYS_ONLY ) + { + // item cease to be merc-owned during this operation + AddObjectToArmsDealerInventory( gbSelectedArmsDealerID, &( PlayersOfferArea[ uiCnt ].ItemObject ) ); + PlayersOfferArea[ uiCnt ].ItemObject.initialize(); + } + + } + } +#else else { //if the dealer doesn't strictly buy items from the player, give the item to the dealer @@ -4081,6 +4390,7 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory() } } +#endif //erase the item from the player's offer area ClearPlayersOfferSlot( uiCnt ); } @@ -4191,7 +4501,26 @@ void BeginSkiItemPointer( UINT8 ubSource, INT16 bSlotNum, BOOLEAN fOfferToDealer } else gpItemPointerSoldier = gpSMCurrentMerc; - +#ifdef JA2UB + //ja25 ub + //if the dealer is Raul + if( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) + { + //if the item is the antique musket + if( gMoveingItem.ItemObject.usItem == HAND_CANNON ) //4498 ) + { + if( gubQuest[ QUEST_FIND_ANTIQUE_MUSKET_FOR_RAUL ] == QUESTINPROGRESS ) + { + //if the player hasnt said the quote before + if( !( gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags & ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_49 ) ) + { + StartShopKeeperTalking( SK_QUOTES_NPC_SPECIFIC_49 ); + gArmsDealerStatus[ gbSelectedArmsDealerID ].ubSpecificDealerFlags |= ARMS_DEALER_FLAG__RAUL_SAID_QUOTE_49; + } + } + } + } +#endif break; @@ -4648,7 +4977,50 @@ void HandleShopKeeperDialog( UINT8 ubInit ) } } } +#ifdef JA2UB + //ja25 UB + // if neither of the more precise quotes fit, or 33 percent of the time anyways + if ( ( sRandomQuoteToUse == -1 ) || Chance( 33 ) ) + { + //If the dealer is Betty, + if( gbSelectedArmsDealerID == ARMS_DEALER_BETTY ) + { + //she has 4 random quotes + UINT8 ubRandom = Random( 100 ); + if( ubRandom > 75 ) + sRandomQuoteToUse = SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_1; + else if( ubRandom > 50 ) + sRandomQuoteToUse = SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_2; + else if( ubRandom > 25 ) + sRandomQuoteToUse = SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_3; + else + sRandomQuoteToUse = SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_4; + + } + else + { + if( Chance ( 50 ) ) + sRandomQuoteToUse = SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_1; + else + sRandomQuoteToUse = SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_2; + } + } + + Assert( sRandomQuoteToUse != -1 ); + Assert( sRandomQuoteToUse < NUM_COMMON_SK_QUOTES ); + + if ( !gfCommonQuoteUsedThisSession[ sRandomQuoteToUse ] ) + { + StartShopKeeperTalking( (UINT16) sRandomQuoteToUse ); + + gfCommonQuoteUsedThisSession[ sRandomQuoteToUse ] = TRUE; + + //increase the random quote delay + guiRandomQuoteDelayTime += SKI_DEALERS_RANDOM_QUOTE_DELAY_INCREASE_RATE; + } + +#else // if neither of the more precise quotes fit, or 33 percent of the time anyways if ( ( sRandomQuoteToUse == -1 ) || Chance( 33 ) ) { @@ -4670,6 +5042,7 @@ void HandleShopKeeperDialog( UINT8 ubInit ) //increase the random quote delay guiRandomQuoteDelayTime += SKI_DEALERS_RANDOM_QUOTE_DELAY_INCREASE_RATE; } +#endif } uiLastTime = GetJA2Clock(); @@ -5981,12 +6354,16 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) // say "Hmm... Let's see" once per trading session to start evaluation // SPECIAL: Devin doesn't have this quote (he's the only one) + +#ifdef JA2UB +//no UB +#else if( !gfDealerHasSaidTheEvaluateQuoteOnceThisSession && ( gbSelectedArmsDealerID != ARMS_DEALER_DEVIN ) ) { gfDealerHasSaidTheEvaluateQuoteOnceThisSession = TRUE; StartShopKeeperTalking( SK_QUOTES_PLAYER_REQUESTED_EVALUATION ); } - +#endif //Can this particular kind of item be sold/repaired here if( WillShopKeeperRejectObjectsFromPlayer( gbSelectedArmsDealerID, bSlotID ) == FALSE ) @@ -6118,6 +6495,33 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) switch ( uiEvalResult ) { case EVAL_RESULT_DONT_HANDLE: +#ifdef JA2UB + //JA25 UB + if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_SELLS_ONLY ) + { + // then he doesn't have quotes 17, 19, or 20, always use 4. Devin doesn't have 18 either, + // while the text of 18 seems wrong for Sam & Howard if offered something they should consider valuable. + sQuoteNum = SK_QUOTES_NOT_INTERESTED_IN_THIS_ITEM; + } + else + { + //if the dealer is BETTY + if( gbSelectedArmsDealerID == ARMS_DEALER_BETTY && + ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].usItemClass == IC_AMMO || + Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].usItemClass == IC_GUN + ) + ) + { + // she accepts items, but not this one + sQuoteNum = SK_QUOTES_NPC_SPECIFIC_40; + } + else + { + // he accepts items, but not this one + sQuoteNum = SK_QUOTES_DURING_EVALUATION_STUFF_REJECTED; + } + } +#endif if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_SELLS_ONLY ) { // then he doesn't have quotes 17, 19, or 20, always use 4. Devin doesn't have 18 either, @@ -7358,7 +7762,12 @@ void HandlePossibleRepairDelays() gfStartWithRepairsDelayedQuote = FALSE; // if it's Fredo or Perko +#ifdef JA2UB + if ( ( gbSelectedArmsDealerID == ARMS_DEALER_FREDO ) || ( gbSelectedArmsDealerID == ARMS_DEALER_RAUL ) ) +#else if ( ( gbSelectedArmsDealerID == ARMS_DEALER_FREDO ) || ( gbSelectedArmsDealerID == ARMS_DEALER_PERKO ) ) +#endif + { // because the quotes are so specific, we'll only use them once per game per repairman if( !gArmsDealerStatus[ gbSelectedArmsDealerID ].fRepairDelayBeenUsed ) @@ -7841,3 +8250,21 @@ void HatchOutInvSlot( UINT16 usPosX, UINT16 usPosY ) DrawHatchOnInventory( guiRENDERBUFFER, usSlotX, usSlotY, usSlotWidth, usSlotHeight ); InvalidateRegion( usSlotX, usSlotY, usSlotX + usSlotWidth, usSlotY + usSlotHeight ); } +#ifdef JA2UB +//ja25 UB +void AskUserToAttachTransmitterToLaptop() +{ + DoSkiMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP ], SHOPKEEPER_SCREEN, MSG_BOX_FLAG_OK, AttachLaptopTransmitterToLaptop ); +} + +void AttachLaptopTransmitterToLaptop( UINT8 ubExitValue ) +{ + // + // Get the laptop working again + // + + //Mark the quest done + if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) + EndQuest( QUEST_FIX_LAPTOP, -1, -1 ); +} +#endif diff --git a/Tactical/ShopKeeper Quotes.h b/Tactical/ShopKeeper Quotes.h index 1240083a..48bd83f6 100644 --- a/Tactical/ShopKeeper Quotes.h +++ b/Tactical/ShopKeeper Quotes.h @@ -28,7 +28,44 @@ enum SK_QUOTES_PRESSED_DONE_HASNT_MADE_TRANSACTION, SK_QUOTES_PRESSED_DONE_STILL_HAS_STUFF_IN_OFFER_AREA, SK_QUOTES_CANT_AFFORD_TO_BUY_OR_TOO_MUCH_TO_REPAIR, + +#ifdef JA2UB + SK_QUOTES_BETTY_IS_ENEMY, + SK_QUOTES_NPC_HEALED_BY_PC, + //30 JA25 UB + SK_QUOTES_DEFAULT_WHEN_FIGHTING_NEARBY, + SK_QUOTES_FOLLOWS_QUOTE_1_POSITIVE, + SK_QUOTES_FOLLOWS_QUOTE_1_NEGATIVE, + SK_QUOTES_NPC_WANTS_TO_CLOSE_UP_SHOP, + SK_QUOTES_WHEN_PLAYER_BUYS_PORNO, + + //35 + SK_QUOTES_INTRO_TO_TEX, + SK_QUOTES_INTRO_TO_TEX_FOLLOW_UP_1, + SK_QUOTES_INTRO_TO_TEX_FOLLOW_UP_2, + SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_3, + SK_QUOTES_RANDOM_QUOTE_WHILE_PLAYER_DECIDING_4, + + //40 + SK_QUOTES_NPC_SPECIFIC_40, + SK_QUOTES_NPC_SPECIFIC_41, + SK_QUOTES_NPC_SPECIFIC_42, + SK_QUOTES_NPC_SPECIFIC_43, + SK_QUOTES_NPC_SPECIFIC_44, + + SK_QUOTES_NPC_SPECIFIC_45, + SK_QUOTES_NPC_SPECIFIC_46, + SK_QUOTES_NPC_SPECIFIC_47, + SK_QUOTES_NPC_SPECIFIC_48, + SK_QUOTES_NPC_SPECIFIC_49, + + SK_QUOTES_NPC_SPECIFIC_50, + SK_QUOTES_NPC_SPECIFIC_51, + SK_QUOTES_NPC_SPECIFIC_52, + SK_QUOTES_NPC_SPECIFIC_53, + SK_QUOTES_NPC_SPECIFIC_54, +#endif NUM_COMMON_SK_QUOTES, // Quotes 28+ are NPC Specific, and are not under direct control of the SKI system. The get used by .COD files diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 53411fa4..d8088475 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -23,6 +23,11 @@ #include "Exit Grids.h" #endif +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#include "ub_config.h" +#endif #include "GameSettings.h" // ary-05/05/2009 : add forced turn mode #include "text.h" // : add forced turn mode @@ -1095,6 +1100,9 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO if ( pSoldier->bActive ) { +#ifdef JA2UB +//Ja25 No meanwhiles in exp +#else // ATE: Make sure life of elliot is OK if from a meanwhile if ( AreInMeanwhile() && pSoldier->ubProfile == ELLIOT ) { @@ -1103,7 +1111,7 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO pSoldier->stats.bLife = 25; } } - +#endif // ADD SOLDIER TO SLOT! if (pSoldier->flags.uiStatusFlags & SOLDIER_OFF_MAP) { @@ -1571,6 +1579,28 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDir // default to standing on arrival if ( pSoldier->usAnimState != HELIDROP ) { +#ifdef JA2UB + // DAVE!!!! + if ( gfFirstTimeInGameHeliCrash && gGameUBOptions.InGameHeli == FALSE ) + { + //should we be on our back or tummy + if( Random( 100 ) < 50 ) + pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); + else + pSoldier->EVENT_InitNewSoldierAnim( FALLBACKHIT_STOP, 1, TRUE ); + + pSoldier->bCollapsed = TRUE; + + } + else if ( fUseAnimation ) + { + pSoldier->EVENT_InitNewSoldierAnim( usAnimState, usAnimCode, TRUE ); + } + else if ( pSoldier->ubBodyType != CROW ) + { + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); + } +#else if ( fUseAnimation ) { pSoldier->EVENT_InitNewSoldierAnim( usAnimState, usAnimCode, TRUE ); @@ -1579,6 +1609,7 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDir { pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); } +#endif } // ATE: if we are below OK life, make them lie down! diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 7fd31af9..e9a84cbd 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -597,6 +597,25 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { UnSetUIBusy( pSoldier->ubID ); } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - if pending interrupt flag was set for after-attack type of interupt, try to resolve it now + else if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + if ( ResolvePendingInterrupt( pSoldier, AFTERACTION_INTERRUPT ) ) + { + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; + // "artificially" set lock ui flag in this case + if (pSoldier->bTeam == gbPlayerNum) + { + AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, Message[STR_INTERRUPT] ); + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + } + return( TRUE ); + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// break; case 443: @@ -1013,12 +1032,12 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { //AXP 25.03.2007: MinAPsToThrow now actually returns the real cost, not 0 // ATE: Deduct points! - DeductPoints( pSoldier, MinAPsToThrow( pSoldier, pSoldier->sTargetGridNo, FALSE ), 0 ); + DeductPoints( pSoldier, MinAPsToThrow( pSoldier, pSoldier->sTargetGridNo, FALSE ), 0, AFTERACTION_INTERRUPT ); } else { // ATE: Deduct points! - DeductPoints( pSoldier, APBPConstants[AP_TOSS_ITEM], 0 ); + DeductPoints( pSoldier, APBPConstants[AP_TOSS_ITEM], 0, AFTERACTION_INTERRUPT ); } INT32 iRealObjectID = CreatePhysicalObject( pSoldier->pTempObject, pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, FALSE ); @@ -1221,7 +1240,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) } else { +#ifdef JA2UB + //Ja25 No meanwhiles + if ( fMartialArtist ) +#else if ( fMartialArtist && !AreInMeanwhile( ) ) + +#endif { pSoldier->ChangeSoldierState( NINJA_BREATH, 0, FALSE ); return( TRUE ); @@ -2025,6 +2050,29 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 498: + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - if pending interrupt flag was set for before-attack type of interupt, try to resolve it now + if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + if ( ResolvePendingInterrupt( pSoldier, BEFORESHOT_INTERRUPT ) ) + { + if ( pSoldier->flags.fTurningToShoot ) + pSoldier->flags.fTurningToShoot = FALSE; + + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; + // "artificially" set lock ui flag in this case + if (pSoldier->bTeam == gbPlayerNum) + { + AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, Message[STR_INTERRUPT] ); + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + } + return( TRUE ); + break; + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CONDITONAL JUMP // If we have a pending animation, play it, else continue if ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) @@ -2616,6 +2664,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) DebugAttackBusy( "@@@@@@@ Reducing attacker busy count for end of queen swipe" ); // ReduceAttackBusyCount( pSoldier->ubID, FALSE ); } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - if pending interrupt flag was set for after-attack type of interupt, try to resolve it now + if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + ResolvePendingInterrupt( pSoldier, AFTERACTION_INTERRUPT ); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// break; case 754: @@ -3628,6 +3684,9 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) } // OK, if we are in a meanwhile and this is elliot... +#ifdef JA2UB +//ja25: No queen +#else if ( AreInMeanwhile( ) ) { SOLDIERTYPE *pQueen; @@ -3639,7 +3698,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) TriggerNPCWithGivenApproach( QUEEN, APPROACH_DONE_SLAPPED, FALSE ); } } - +#endif // We are unconscious now, play randomly, this animation continued, or a new death if ( pSoldier->CheckSoldierHitRoof( ) ) { @@ -3649,7 +3708,11 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) // If guy is now dead, play sound! if ( pSoldier->stats.bLife == 0 ) { +#ifdef JA2UB +//Ja25 No meanwhiles +#else if ( !AreInMeanwhile() ) +#endif { pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); pSoldier->flags.fDeadSoundPlayed = TRUE; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 723d7bde..c6e345f5 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -99,6 +99,13 @@ #include "LOS.h" // added by SANDRO #endif +#include "ub_config.h" + +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#endif + #include "fresh_header.h" #include "Dialogue Control.h" @@ -2884,6 +2891,8 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // If we are NOT loading a game, continue normally if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { + usItem = this->inv[ HANDPOS ].usItem; + // CHECK IF WE ARE TRYING TO INTURRUPT A SCRIPT WHICH WE DO NOT WANT INTERRUPTED! if ( this->flags.fInNonintAnim ) { @@ -3039,7 +3048,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // We are told that we need to rasie weapon // Do so only if // 1) We have a rifle in hand... - usItem = this->inv[ HANDPOS ].usItem; + //usItem = this->inv[ HANDPOS ].usItem; if ( this->inv[ HANDPOS ].exists() == true && (Item[ usItem ].twohanded ) && !Item[usItem].rocketlauncher ) { @@ -3062,7 +3071,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // We are told that we need to rasie weapon // Do so only if // 1) We have a rifle in hand... - usItem = this->inv[ HANDPOS ].usItem; + //usItem = this->inv[ HANDPOS ].usItem; if ( this->inv[ HANDPOS ].exists() == true && (Item[ usItem ].twohanded ) && !Item[usItem].rocketlauncher ) { @@ -3125,7 +3134,8 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart } // OK....... - if ( this->ubBodyType > REGFEMALE ) + // SANDRO - removing unused code + /*if ( this->ubBodyType > REGFEMALE ) { if ( this->stats.bLife < INJURED_CHANGE_THREASHOLD ) { @@ -3135,7 +3145,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // usNewState = FROM_INJURED_TRANSITION; } } - } + }*/ // Alrighty, check if we should free buddy up! if ( usNewState == GIVING_AID ) @@ -3161,10 +3171,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { if ( usNewState == KNEEL_DOWN && this->usAnimState != BIGMERC_CROUCH_TRANS_INTO ) { - UINT16 usItem; + //UINT16 usItem; // Do we have a rifle? - usItem = this->inv[ HANDPOS ].usItem; + //usItem = this->inv[ HANDPOS ].usItem; if ( this->inv[ HANDPOS ].exists() == true ) { @@ -3181,10 +3191,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( usNewState == KNEEL_UP && this->usAnimState != BIGMERC_CROUCH_TRANS_OUTOF ) { - UINT16 usItem; + //UINT16 usItem; // Do we have a rifle? - usItem = this->inv[ HANDPOS ].usItem; + //usItem = this->inv[ HANDPOS ].usItem; if ( this->inv[ HANDPOS ].exists() == true ) { @@ -3211,15 +3221,39 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( this->ubDirection == gPurpendicularDirection[ this->ubDirection ][ this->pathing.usPathingData[ this->pathing.usPathIndex ] ] ) { // We are perpendicular! - usNewState = SIDE_STEP; + // SANDRO - wait wait wait!!! We need to determine if gonna sidestep with weapon raised + if (( (gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY ) || + (gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIRE ) ) && gGameExternalOptions.fAllowWalkingWithWeaponRaised ) + //if ( WeaponReady( this ) ) + { + if ( this->inv[ HANDPOS ].exists() == true && Item[ usItem ].usItemClass == IC_GUN && !Item[usItem].rocketlauncher) + { + if ( !(Item[ usItem ].twohanded ) ) + { + if ( this->IsValidSecondHandShot() ) + { + usNewState = SIDE_STEP_DUAL_RDY; + } + else + { + usNewState = SIDE_STEP_PISTOL_RDY; + } + } + else + { + usNewState = SIDE_STEP_RIFLE_RDY; + } + } + } + else + { + usNewState = SIDE_STEP; + } } else { if ( gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_CROUCH ) - { - //*** ddd - UINT16 usItem = this->inv[ HANDPOS ].usItem; - + { if( this->inv[ HANDPOS ].exists() == true && Item[ usItem ].usItemClass == IC_GUN && Item[ usItem ].twohanded && !Item[usItem].rocketlauncher) usNewState = SWAT_BACKWARDS; else @@ -3288,6 +3322,29 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart usNewState = WALKING; } } + // SANDRO - check if we are gonna move with weapon raised + else if (( (gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY ) || + (gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIRE ) ) && ( usNewState == WALKING ) && gGameExternalOptions.fAllowWalkingWithWeaponRaised ) + { + if ( this->inv[ HANDPOS ].exists() == true && Item[ usItem ].usItemClass == IC_GUN && !Item[usItem].rocketlauncher) + { + if ( !(Item[ usItem ].twohanded ) ) + { + if ( this->IsValidSecondHandShot() ) + { + usNewState = WALKING_DUAL_RDY; + } + else + { + usNewState = WALKING_PISTOL_RDY; + } + } + else + { + usNewState = WALKING_RIFLE_RDY; + } + } + } // Turn off anipause flag for any anim! this->flags.uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); @@ -3540,7 +3597,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( !this->flags.fDontChargeReadyAPs ) { sAPCost = GetAPsToReadyWeapon( this, usNewState ); - DeductPoints( this, sAPCost, sBPCost ); + DeductPoints( this, sAPCost, sBPCost, BEFORESHOT_INTERRUPT ); } else { @@ -3549,6 +3606,9 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart break; case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: this->usPendingAnimation = NO_PENDING_ANIMATION; this->aiData.ubPendingActionAnimCount = 0; @@ -3581,7 +3641,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart } else sAPCost = GetAPsStartRun( this ); // changed by SANDRO - DeductPoints( this, sAPCost, sBPCost ); + DeductPoints( this, sAPCost, sBPCost, MOVEMENT_INTERRUPT ); } // Set pending action count to 0 this->aiData.ubPendingActionAnimCount = 0; @@ -3679,7 +3739,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart break; case CUTTING_FENCE: - DeductPoints( this, APBPConstants[AP_USEWIRECUTTERS], APBPConstants[BP_USEWIRECUTTERS] ); + DeductPoints( this, APBPConstants[AP_USEWIRECUTTERS], APBPConstants[BP_USEWIRECUTTERS], AFTERACTION_INTERRUPT ); break; case PLANT_BOMB: @@ -3721,7 +3781,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart case USE_REMOTE: - DeductPoints( this, APBPConstants[AP_USE_REMOTE], 0 ); + DeductPoints( this, APBPConstants[AP_USE_REMOTE], 0, AFTERACTION_INTERRUPT ); break; //case PUNCH: @@ -3736,28 +3796,28 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // CHRISL // SANDRO - changed this a bit if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND ) - DeductPoints( this, GetAPsToJumpFence( this, TRUE ), GetBPsToJumpFence( this, TRUE ) ); + DeductPoints( this, GetAPsToJumpFence( this, TRUE ), GetBPsToJumpFence( this, TRUE ), SP_MOVEMENT_INTERRUPT ); else - DeductPoints( this, GetAPsToJumpFence( this, FALSE ), GetBPsToJumpFence( this, FALSE ) ); + DeductPoints( this, GetAPsToJumpFence( this, FALSE ), GetBPsToJumpFence( this, FALSE ), SP_MOVEMENT_INTERRUPT ); break; case JUMPWINDOWS: if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND ) - DeductPoints( this, GetAPsToJumpThroughWindows( this, TRUE ), GetBPsToJumpThroughWindows( this, TRUE ) ); + DeductPoints( this, GetAPsToJumpThroughWindows( this, TRUE ), GetBPsToJumpThroughWindows( this, TRUE ), SP_MOVEMENT_INTERRUPT ); else - DeductPoints( this, GetAPsToJumpThroughWindows( this, FALSE ), GetBPsToJumpThroughWindows( this, FALSE ) ); + DeductPoints( this, GetAPsToJumpThroughWindows( this, FALSE ), GetBPsToJumpThroughWindows( this, FALSE ), SP_MOVEMENT_INTERRUPT ); break; // Deduct aps for falling down.... case FALLBACK_HIT_STAND: case FALLFORWARD_FROMHIT_STAND: - DeductPoints( this, APBPConstants[AP_FALL_DOWN], APBPConstants[BP_FALL_DOWN] ); + DeductPoints( this, APBPConstants[AP_FALL_DOWN], APBPConstants[BP_FALL_DOWN], DISABLED_INTERRUPT ); break; case FALLFORWARD_FROMHIT_CROUCH: - DeductPoints( this, (APBPConstants[AP_FALL_DOWN]/2), (APBPConstants[BP_FALL_DOWN]/2) ); + DeductPoints( this, (APBPConstants[AP_FALL_DOWN]/2), (APBPConstants[BP_FALL_DOWN]/2), DISABLED_INTERRUPT ); break; case QUEEN_SWIPE: @@ -3771,7 +3831,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // disable sight gTacticalStatus.uiFlags |= DISALLOW_SIGHT; - DeductPoints( this, GetAPsToClimbRoof( this, TRUE), GetBPsToClimbRoof( this, TRUE) ); // changed by SANDRO + DeductPoints( this, GetAPsToClimbRoof( this, TRUE), GetBPsToClimbRoof( this, TRUE), SP_MOVEMENT_INTERRUPT ); // changed by SANDRO break; case CLIMBUPROOF: @@ -3779,7 +3839,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // disable sight gTacticalStatus.uiFlags |= DISALLOW_SIGHT; - DeductPoints( this, GetAPsToClimbRoof( this, FALSE), GetBPsToClimbRoof( this, FALSE) ); // changed by SANDRO + DeductPoints( this, GetAPsToClimbRoof( this, FALSE), GetBPsToClimbRoof( this, FALSE), SP_MOVEMENT_INTERRUPT ); // changed by SANDRO break; case JUMPDOWNWALL: @@ -3787,7 +3847,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // disable sight gTacticalStatus.uiFlags |= DISALLOW_SIGHT; - DeductPoints( this, GetAPsToJumpWall( this, TRUE), GetBPsToJumpWall( this, TRUE) ); + DeductPoints( this, GetAPsToJumpWall( this, TRUE), GetBPsToJumpWall( this, TRUE), SP_MOVEMENT_INTERRUPT ); break; case JUMPUPWALL: @@ -3795,7 +3855,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // disable sight gTacticalStatus.uiFlags |= DISALLOW_SIGHT; - DeductPoints( this, GetAPsToJumpWall( this, FALSE), GetBPsToJumpWall( this, FALSE) ); + DeductPoints( this, GetAPsToJumpWall( this, FALSE), GetBPsToJumpWall( this, FALSE), SP_MOVEMENT_INTERRUPT ); break; case JUMP_OVER_BLOCKING_PERSON: @@ -3804,7 +3864,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { INT32 usNewGridNo; - DeductPoints( this, GetAPsToJumpOver( this ), APBPConstants[BP_JUMP_OVER] ); // changed by SANDRO + DeductPoints( this, GetAPsToJumpOver( this ), APBPConstants[BP_JUMP_OVER], SP_MOVEMENT_INTERRUPT ); // changed by SANDRO usNewGridNo = NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ); usNewGridNo = NewGridNo( usNewGridNo, DirectionInc( this->ubDirection ) ); @@ -4451,6 +4511,9 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove ) switch( this->usAnimState ) { case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: case RUNNING: // IN deep water, swim! @@ -4637,6 +4700,27 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo ) // Ready weapon this->SoldierReadyWeapon( sTargetXPos, sTargetYPos, FALSE ); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // SANDRO - hack! - an interrupt pending before shot + if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + if ( ResolvePendingInterrupt( this, BEFORESHOT_INTERRUPT ) ) + { + this->usPendingAnimation = NO_PENDING_ANIMATION; + this->ubPendingDirection = NO_PENDING_DIRECTION; + // "artificially" set lock ui flag + if (this->bTeam == gbPlayerNum) + { + AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, Message[STR_INTERRUPT] ); + guiPendingOverrideEvent = LU_BEGINUILOCK; + HandleTacticalUI( ); + } + // return as we are not gonna shoot if interrupted + return; + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // IF WE ARE AN NPC, SLIDE VIEW TO SHOW WHO IS SHOOTING { //if ( this->flags.fDoSpread ) @@ -5408,11 +5492,15 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 } //////////////////////////////////////////////////////////////////////////// sDamage = sDamage / PUNCH_REAL_DAMAGE_PORTION; +#ifdef JA2UB +//Ja25: No meanwhiles +#else if ( AreInMeanwhile() && gCurrentMeanwhileDef.ubMeanwhileID == INTERROGATION ) { sBreathLoss = 0; sDamage /= 2; } +#endif ubReason = TAKE_DAMAGE_HANDTOHAND; } // marke added one 'or' for explosive ammo. variation of: AmmoTypes[this->inv[this->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1 @@ -6013,7 +6101,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD // HEADROCK HAM 3.2: Critical legshots cost an extra number of APs, based on shot damage. if (gGameExternalOptions.fCriticalLegshotCausesAPLoss) { - DeductPoints( pSoldier, APBPConstants[AP_LOSS_PER_LEGSHOT_DAMAGE]*sDamage, 0); + DeductPoints( pSoldier, APBPConstants[AP_LOSS_PER_LEGSHOT_DAMAGE]*sDamage, 0, DISABLED_INTERRUPT); } SoldierCollapse( pSoldier ); return; @@ -6457,7 +6545,16 @@ BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT32 sDestGridNo, UINT16 } // If we were aiming, end aim! - usAnimState = PickSoldierReadyAnimation( this, TRUE ); + // SANDRO - we may try to move with raised weapon, so don't end aim after + if ( (gAnimControl[ this->usAnimState ].uiFlags & ( ANIM_FIREREADY | ANIM_FIRE )) && + (usMoveAnimState == WALKING || usMoveAnimState == SIDE_STEP ) && !( this->MercInWater( )) ) + { + usAnimState = INVALID_ANIMATION; + } + else + { + usAnimState = PickSoldierReadyAnimation( this, TRUE ); + } // Add a pending animation first! // Only if we were standing! @@ -6649,7 +6746,8 @@ void SOLDIERTYPE::EVENT_InternalSetSoldierDestination( UINT16 usNewDirection, BO // OK, ATE: If we are side_stepping, calculate a NEW desired direction.... - if ( this->bReverse && (usAnimState == SIDE_STEP || usAnimState == ROLL_PRONE_R || usAnimState == ROLL_PRONE_L) ) + if ( this->bReverse && (usAnimState == SIDE_STEP || usAnimState == ROLL_PRONE_R || usAnimState == ROLL_PRONE_L + || usAnimState == SIDE_STEP_PISTOL_RDY || usAnimState == SIDE_STEP_RIFLE_RDY || usAnimState == SIDE_STEP_DUAL_RDY ) ) { UINT8 ubPerpDirection; @@ -6757,7 +6855,8 @@ INT8 MultiTiledTurnDirection( SOLDIERTYPE * pSoldier, INT8 bStartDirection, INT8 void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState ) { //if ( usAnimState == WALK_BACKWARDS ) - if ( pSoldier->bReverse && (usAnimState != SIDE_STEP && usAnimState != ROLL_PRONE_R && usAnimState != ROLL_PRONE_L) ) + if ( pSoldier->bReverse && (usAnimState != SIDE_STEP && usAnimState != ROLL_PRONE_R && usAnimState != ROLL_PRONE_L + && usAnimState != SIDE_STEP_PISTOL_RDY && usAnimState != SIDE_STEP_RIFLE_RDY && usAnimState != SIDE_STEP_DUAL_RDY ) ) { // OK, check if we are going to go in the exact opposite than our facing.... ubNewDirection = gOppositeDirection[ ubNewDirection ]; @@ -7055,6 +7154,9 @@ void SOLDIERTYPE::EVENT_BeginMercTurn( BOOLEAN fFromRealTime, INT32 iRealTimeCou } this->CalcNewActionPoints( ); + + // SANDRO - Improved Interrupt System - reset interrupt counter + memset(this->aiData.ubInterruptCounter,0,sizeof(this->aiData.ubInterruptCounter)); // HEADROCK HAM 3.6: If this soldier is in a "moving" animation, but has not moved any tiles // in the previous turn, then the player has apparently forgotten that he was moving. @@ -7978,6 +8080,9 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier return; case WALKING: + case WALKING_PISTOL_RDY: + case WALKING_RIFLE_RDY: + case WALKING_DUAL_RDY: // Adjust based on body type bAdditional = (UINT8)( gubAnimWalkSpeeds[ pStatsSoldier->ubBodyType ].sSpeed ); @@ -8700,13 +8805,15 @@ void SOLDIERTYPE::BeginSoldierGetup( void ) { return; } - +#ifdef JA2UB +//Ja25: No meanwhiles +#else // ATE: Don't getup if we are in a meanwhile if ( AreInMeanwhile( ) ) { return; } - +#endif if ( this->bCollapsed ) { if ( this->stats.bLife >= OKLIFE && this->bBreath >= OKBREATH && (this->bSleepDrugCounter == 0) ) @@ -8945,13 +9052,15 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr // Turn off this->flags.uiStatusFlags &= ( ~SOLDIER_NPC_SHOOTING ); } - +#ifdef JA2UB +//Ja25: No meanwhiles +#else // CJC: make sure Elliot doesn't bleed to death! if ( ubReason == TAKE_DAMAGE_BLOODLOSS && AreInMeanwhile() ) { return( 0 ); } - +#endif // Calculate bandage bBandage = this->stats.bLifeMax - this->stats.bLife - this->bBleeding; @@ -9136,7 +9245,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr // ATE: if the robot, do not deduct if ( !AM_A_ROBOT( this ) ) { - DeductPoints( this, sAPCost, sBreathLoss , FALSE); + DeductPoints( this, sAPCost, sBreathLoss, DISABLED_INTERRUPT ); } ubCombinedLoss = (UINT8) sLifeDeduct / 10 + sBreathLoss / 2000; @@ -9352,7 +9461,39 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr { DecayIndividualOpplist( this ); } + +#ifdef JA2UB + //if the attacker is MORRIS, AND he didnt kill the person + if( Menptr[ ubAttacker ].ubProfile == 75 ) //MORRIS + { + //if the soldier is hurt, but not dead + if( this->stats.bLife < bOldLife && this->stats.bLife > 0 ) + { + //if he hasnt said his quote #1 before + if( !( Menptr[ ubAttacker ].usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU ) ) + { + //said a flag so morris can say this quote next turn + gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn = TRUE; + //Remeber who Morris is saying the quote too + gJa25SaveStruct.ubPlayerMorrisHurt = this->ubProfile; + } + } + + // else if morris is to say the quote, he hasnt said it yet and he just killed the person he WAS going to say it to + else if( gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn && + gJa25SaveStruct.ubPlayerMorrisHurt == this->ubProfile && + this->stats.bLife <= 0 && + !( Menptr[ ubAttacker ].usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU ) ) + { + //said a flag so morris can say this quote next turn + gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn = FALSE; + + //Remeber who Morris is saying the quote too + gJa25SaveStruct.ubPlayerMorrisHurt = NO_PROFILE; + } + } +#endif return( ubCombinedLoss ); } @@ -11173,7 +11314,12 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio fMartialArtist = TRUE; } +//Ja25 No meanwhiles +#ifdef JA2UB + if ( fMartialArtist && !Item[usItem].crowbar && this->ubBodyType == REGMALE) +#else if ( fMartialArtist && !AreInMeanwhile( ) && !Item[usItem].crowbar && this->ubBodyType == REGMALE ) // SANDRO - added check for body type +#endif { // Are we in attack mode yet? if ( this->usAnimState != NINJA_BREATH && gAnimControl[ this->usAnimState ].ubHeight == ANIM_STAND && gAnimControl[ pTSoldier->usAnimState ].ubHeight != ANIM_PRONE ) @@ -11269,6 +11415,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginKnifeThrowAttack( INT32 sGridNo, UINT8 ubDir DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting knifethrow attack, bullets left %d", this->bBulletsLeft) ); DebugAttackBusy( String( "Begin knife throwing attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); + // SANDRO - new animation for throwing for big mercs by PasHancock if ( this->ubBodyType == BIGMALE && ((this->ubProfile != NO_PROFILE && gMercProfiles[ this->ubProfile ].bCharacterTrait == CHAR_TRAIT_SHOWOFF) || (HAS_SKILL_TRAIT( this, THROWING_NT ) && gGameOptions.fNewTraitSystem) || (HAS_SKILL_TRAIT( this, THROWING_OT ) && !gGameOptions.fNewTraitSystem) ) ) { this->EVENT_InitNewSoldierAnim( THROW_KNIFE_SP_BM, 0 , FALSE ); @@ -11963,7 +12110,7 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy ) SStopMerc.sXPos=this->sX; SStopMerc.sYPos=this->sY; //AddGameEvent( S_STOP_MERC, 0, &SStopMerc ); //hayden. - if(this->ubID>=120 || (!is_server && this->ubID >=20)) return;//hayden + if((is_networked) && (this->ubID>=120 || (!is_server && this->ubID >=20))) return;//hayden if(is_client)send_stop(&SStopMerc); // If we are a 'specialmove... ignore... @@ -13734,7 +13881,7 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid else { // Deduct points from our guy.... - DeductPoints( this, sAPCost, 0 ); + DeductPoints( this, sAPCost, 0, UNTRIGGERED_INTERRUPT ); apsDeducted = TRUE; StartCivQuote( pTSoldier ); @@ -13745,7 +13892,7 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid // WANNE: This fixes the bug, that APs for talking are not always deducted. if (!apsDeducted) { - DeductPoints( this, sAPCost, 0 ); + DeductPoints( this, sAPCost, 0, UNTRIGGERED_INTERRUPT ); apsDeducted = TRUE; } @@ -14440,11 +14587,19 @@ BOOLEAN HAS_SKILL_TRAIT( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ) return( FALSE ); INT8 bNumMajorTraitsCounted = 0; + INT8 bMaxTraits = gSkillTraitValues.ubMaxNumberOfTraits; + INT8 bMaxMajorTraits = gSkillTraitValues.ubNumberOfMajorTraitsAllowed; + // special case for Dr.Q - he's allowed to have 3 major traits and one minor for total by default + if ( pSoldier->ubProfile == 33 && gSkillTraitValues.fAllowDrQTraitsException ) + { + bMaxTraits++; + bMaxMajorTraits++; + } // check old/new traits if (gGameOptions.fNewTraitSystem) { - for ( INT8 bCnt = 0; bCnt < gSkillTraitValues.ubMaxNumberOfTraits; bCnt++ ) + for ( INT8 bCnt = 0; bCnt < min(30,bMaxTraits); bCnt++ ) { if ( uiSkillTraitNumber > 0 && uiSkillTraitNumber <= NUM_MAJOR_TRAITS ) { @@ -14457,7 +14612,7 @@ BOOLEAN HAS_SKILL_TRAIT( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ) bNumMajorTraitsCounted++; } // if we exceeded the allowed number of major traits, ignore the rest of them - if ( bNumMajorTraitsCounted >= gSkillTraitValues.ubNumberOfMajorTraitsAllowed ) + if ( bNumMajorTraitsCounted >= min(20,bMaxMajorTraits) ) { break; } @@ -14488,11 +14643,19 @@ INT8 NUM_SKILL_TRAITS( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ) INT8 bNumberOfTraits = 0; INT8 bNumMajorTraitsCounted = 0; + INT8 bMaxTraits = gSkillTraitValues.ubMaxNumberOfTraits; + INT8 bMaxMajorTraits = gSkillTraitValues.ubNumberOfMajorTraitsAllowed; + // special case for Dr.Q - he's allowed to have 3 major traits and one minor for total by default + if ( pSoldier->ubProfile == 33 && gSkillTraitValues.fAllowDrQTraitsException ) + { + bMaxTraits++; + bMaxMajorTraits++; + } // check old/new traits if (gGameOptions.fNewTraitSystem) { - for ( INT8 bCnt = 0; bCnt < gSkillTraitValues.ubMaxNumberOfTraits; bCnt++ ) + for ( INT8 bCnt = 0; bCnt < min(30,bMaxTraits); bCnt++ ) { if ( uiSkillTraitNumber > 0 && uiSkillTraitNumber <= NUM_MAJOR_TRAITS ) { @@ -14506,7 +14669,7 @@ INT8 NUM_SKILL_TRAITS( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ) bNumMajorTraitsCounted++; } // if we exceeded the allowed number of major traits, ignore the rest of them - if ( bNumMajorTraitsCounted >= gSkillTraitValues.ubNumberOfMajorTraitsAllowed ) + if ( bNumMajorTraitsCounted >= min(20,bMaxMajorTraits) ) { break; } @@ -14761,4 +14924,250 @@ UINT8 RegainDamagedStats( SOLDIERTYPE * pSoldier, UINT16 usAmountRegainedHundred // Done, return what we healed return( bStatsReturned ); } - \ No newline at end of file + +//////////////////////////////////////////////////////////////////////////////////////////// +// SANDRO - Improved Interrupt System +///////////////////////////////////////// +BOOLEAN ResolvePendingInterrupt( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType ) +{ + // real time or not in combat? disable and clear + if (!(gTacticalStatus.uiFlags & TURNBASED) || + !(gTacticalStatus.uiFlags & INCOMBAT) ) + { + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; + ClearIntList(); + return( FALSE ); + } + + // invalid guy + if ( pSoldier == NULL ) + { + //ClearIntList(); + return( FALSE ); + } + + // can't be interrupted if it's not our turn at all + if ( gTacticalStatus.ubCurrentTeam != pSoldier->bTeam ) + { + return( FALSE ); + } + + // no interrupt called or not gonna trigger it now + if ( gTacticalStatus.ubInterruptPending == DISABLED_INTERRUPT || + gTacticalStatus.ubInterruptPending == UNTRIGGERED_INTERRUPT ) + { + return( FALSE ); + } + + // if the interrupt called match the type we are trying to resolve.. + if ( gTacticalStatus.ubInterruptPending == ubInterruptType || ubInterruptType == INSTANT_INTERRUPT ) + { + ///////////////////////////// + // Gather all interrupters // + ///////////////////////////// + SOLDIERTYPE *pInterrupter; + UINT8 ubInterruptersFound = 0; + UINT8 ubaInterruptersList[64]; + UINT16 uCnt = 0, uiReactionTime; + INT16 iInjuryPenalty; + + for ( uCnt = 0; uCnt <= MAX_NUM_SOLDIERS; uCnt++ ) + { + // first find all guys who can see us + pInterrupter = MercPtrs[ uCnt ]; + if ( pInterrupter == NULL ) + continue; // not valid + if ( pInterrupter->stats.bLife < OKLIFE || pInterrupter->bCollapsed || !pInterrupter->bActive || !pInterrupter->bInSector || pInterrupter->bActionPoints < 4 ) + continue; // not active + if ( pSoldier->bTeam == pInterrupter->bTeam ) + continue; // same team + if ( pSoldier->bSide == pInterrupter->bSide ) + continue; // not enemy + if ( CONSIDERED_NEUTRAL( pSoldier, pInterrupter ) ) + continue; // neutral + + ///////////////////////////////////////////////////////////// + // Calculate Reaction Time (i.e. interrupt counter length) // + ///////////////////////////////////////////////////////////// + + // set base value ( interrupt per every X APs an enemy uses ) + if ( pInterrupter->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY ) // if we see him + { + uiReactionTime = gGameExternalOptions.ubBasicReactionTimeLengthIIS; + } + else // if not seen the length is higher (we don't want to interrupt in most cases here) + { + uiReactionTime = (gGameExternalOptions.ubBasicReactionTimeLengthIIS * 2); + } + uiReactionTime = uiReactionTime * 10; // x10 ... we will divide by 10 after all adjustments done + // adjust based on Agility + if ( pInterrupter->stats.bAgility >= 80 ) + { + uiReactionTime = (uiReactionTime * (100 - (2 * (pInterrupter->stats.bAgility - 80)))/100); + } + else if ( pInterrupter->stats.bAgility < 80 && pInterrupter->stats.bAgility > 50 ) + { + uiReactionTime = (uiReactionTime * (100 + (2 * (80 - pInterrupter->stats.bAgility)))/100); + } + else + { + uiReactionTime = (uiReactionTime * 8/5); + } + // adjust based on APs left + // at full possible APs no adjustement (100% applies), +1% length per every 2% of APs down from full + uiReactionTime = (uiReactionTime * (100 + (50 - (50 * pInterrupter->bActionPoints / pInterrupter->CalcActionPoints())) ) /100); + // adjust based on injuries + if (pInterrupter->stats.bLife < pInterrupter->stats.bLifeMax) + { + // OK, this looks a bit complicated.. + // our HP lost minus half of the bandaged part gives us 2% longer reaction time per 1% of our health down from full health + // this penalty is however slightly reduced by our experience level + iInjuryPenalty = ( 200 * (pInterrupter->stats.bLifeMax - pInterrupter->stats.bLife + ((pInterrupter->stats.bLifeMax - pInterrupter->stats.bLife - pInterrupter->bBleeding) / 2))) / (pInterrupter->stats.bLifeMax); + uiReactionTime = (uiReactionTime * (100 + iInjuryPenalty * (100 - (3 * EffectiveExpLevel( pInterrupter ))) / 100) / 100); + } + // adjust by breath down + if (pSoldier->bBreath < 100) + { + // +1% per 2 points of breath down + uiReactionTime = (uiReactionTime * (100 + ((100 - pSoldier->bBreath)/2)) /100); + } + // adjust for getting aid, being in gas or being in shock + if ( pInterrupter->flags.uiStatusFlags & SOLDIER_GASSED ) + uiReactionTime = (uiReactionTime * (100 + AIM_PENALTY_GASSED) /100); + if (pInterrupter->ubServiceCount > 0) + uiReactionTime = (uiReactionTime * (100 + AIM_PENALTY_GETTINGAID) /100); + if (pInterrupter->aiData.bShock) + uiReactionTime = (uiReactionTime * (100 + (pInterrupter->aiData.bShock * 20)) /100); // this is severe, 20% per point + // Phlegmatic characters has slightly longer reaction time + if ( pSoldier->ubProfile != NO_PROFILE ) + { + if ( gMercProfiles[ pSoldier->ubProfile ].bCharacterTrait == CHAR_TRAIT_PHLEGMATIC ) + { + uiReactionTime = ((uiReactionTime * 110) / 100); + } + } + // finally divide back by 10 to get the needed result (round properly) + uiReactionTime = ((uiReactionTime + 5) / 10); + + ///////////////////////////////////////////// + // Check if we reached reaction time value // + ///////////////////////////////////////////// + + // if we have hit the needed amount, the actual interrupt occurs for the observer + if ( pInterrupter->aiData.ubInterruptCounter[pSoldier->ubID] >= uiReactionTime ) + { + /////////////////////////// + // Success! Add to list! // + /////////////////////////// + + // the soldier to be interrupted is added to the list (once only) + if ( ubInterruptersFound == 0) + { + AddToIntList( pSoldier->ubID, FALSE, TRUE); + } + ubaInterruptersList[ubInterruptersFound] = pInterrupter->ubID; + ubInterruptersFound++; + + // add the observer who got the interrupt + AddToIntList( pInterrupter->ubID, TRUE, TRUE); + // reset the counter + pInterrupter->aiData.ubInterruptCounter[pSoldier->ubID] = 0; + } + } + if ( ubInterruptersFound > 0 ) + { + //////////////////////////////////////////////// + // Check for possible "Collective Interrupts" // + //////////////////////////////////////////////// + if ( gGameExternalOptions.fAllowCollectiveInterrupts ) + { + SOLDIERTYPE *pTeammate; + UINT16 uCnt2 = 0, usColIntChance = 0; + UINT8 ubOriginalInterruptersCount = ubInterruptersFound, uCnt3 = 0; + BOOLEAN fAlreadyIn; + + for ( uCnt = 0; uCnt < ubOriginalInterruptersCount; uCnt++ ) + { + pInterrupter = MercPtrs[ ubaInterruptersList[uCnt] ]; + + uCnt2 = gTacticalStatus.Team[ pInterrupter->bTeam ].bFirstID; + for ( pTeammate = MercPtrs[ uCnt2 ]; uCnt2 <= gTacticalStatus.Team[ pInterrupter->bTeam ].bLastID; uCnt2++,pTeammate++) + { + if ( pTeammate == NULL ) + continue; // not valid + if ( pTeammate->bTeam != pInterrupter->bTeam ) + continue; // little paranoya check here + if ( pTeammate->stats.bLife < OKLIFE || pTeammate->bCollapsed || !pTeammate->bActive || !pTeammate->bInSector || pTeammate->bActionPoints < 4 ) + continue; // not active + + // check if we haven't been added to the list already + fAlreadyIn = FALSE; + for ( uCnt3 = 0; uCnt3 < ubInterruptersFound; uCnt3++ ) + { + if ( pTeammate->ubID == ubaInterruptersList[uCnt3] ) + { + fAlreadyIn = TRUE; + break; + } + } + // if we are close enough + if ( !fAlreadyIn && PythSpacesAway( pInterrupter->sGridNo, pTeammate->sGridNo ) <= 5 ) + { + // calculate the chance + // we would have base chance 100% (if both have maxed stats) + // 0-30% is determined by Leadership of the original interrupted - i.e. how well and if he can "inform" us + // 0-20% is determined by his Experience Level + // 0-20% is determined by our Experience Level - i.e how well can we realize that we must act + // 0-20% is determined by our Agility - can our body react so swiftly at all + // 0-10% is determined by our Wisdom - do we have enough mental agility as well? + usColIntChance = 10*( ( (pInterrupter->stats.bLeadership * 3) + + (EffectiveExpLevel( pInterrupter ) * 20) + + (EffectiveExpLevel( pTeammate ) * 20) + + (pTeammate->stats.bAgility * 2) + + (pTeammate->stats.bWisdom) ) / 100 ); + // add bonus per Squadleader trait of the original interrupter + if ( HAS_SKILL_TRAIT( pInterrupter, SQUADLEADER_NT ) && gGameOptions.fNewTraitSystem ) + { + usColIntChance += gSkillTraitValues.ubSLCollectiveInterruptsBonus * NUM_SKILL_TRAITS( pInterrupter, SQUADLEADER_NT ); + } + if ( PreChance(usColIntChance)) + { + ubaInterruptersList[ubInterruptersFound] = pTeammate->ubID; + ubInterruptersFound++; + // if he can react on collective interrupt, give it to him + AddToIntList( pTeammate->ubID, TRUE, TRUE); + // reset the counter for him + pTeammate->aiData.ubInterruptCounter[pSoldier->ubID] = 0; + } + } + } + } + } + + ///////////////////////////////////////////// + // OK, done, all interrupters added, SEND! // + ///////////////////////////////////////////// + + // remove AI control from the interrupted guy just in case may not be neccessary, but it's harmless anyway + if ( (gTacticalStatus.ubCurrentTeam != pSoldier->bTeam) && !(gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bHuman) ) + { + if ( pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL ) + { + pSoldier->flags.uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); + } + } + // reset + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; + // start interrupt + DoneAddingToIntList( pSoldier, TRUE, 1 ); + + return( TRUE ); + } + else // no interrupters found, reset until next occasion + { + // reset + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; + } + } + return( FALSE ); +} \ No newline at end of file diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 4a90f7d7..6ca2bc89 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -24,7 +24,11 @@ // TEMP VALUES FOR NAMES #define MAXCIVLASTNAMES 30 extern UINT16 CivLastNames[MAXCIVLASTNAMES][10]; - + +#ifdef JA2UB +//ja25ub +#define NUM_ASSIST_SLOTS 156 //used for when the player asssists in killing the enemty +#endif // ANDREW: these are defines for OKDestanation usage - please move to approprite file #define IGNOREPEOPLE 0 @@ -133,12 +137,23 @@ INT8 NUM_SKILL_TRAITS( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ); #define SOLDIER_QUOTE_SAID_EXT_SEEN_CREATURE_ATTACK 0x0002 #define SOLDIER_QUOTE_SAID_EXT_USED_BATTLESOUND_HIT 0x0004 #define SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL 0x0008 + +//Ja25: no mike +#ifdef JA2UB +#define SOLDIER_QUOTE_SAID_EXT_MORRIS 0x0010 //Ja25 UB +#else #define SOLDIER_QUOTE_SAID_EXT_MIKE 0x0010 +#endif + #define SOLDIER_QUOTE_SAID_DONE_ASSIGNMENT 0x0020 #define SOLDIER_QUOTE_SAID_BUDDY_1_WITNESSED 0x0040 #define SOLDIER_QUOTE_SAID_BUDDY_2_WITNESSED 0x0080 #define SOLDIER_QUOTE_SAID_BUDDY_3_WITNESSED 0x0100 +#ifdef JA2UB +#define SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU 0x0200 +#endif + #define SOLDIER_CONTRACT_RENEW_QUOTE_NOT_USED 0 #define SOLDIER_CONTRACT_RENEW_QUOTE_89_USED 1 @@ -475,6 +490,7 @@ public: INT8 fAIFlags; INT16 bAimTime; //100AP INT8 bShownAimTime; + UINT8 ubInterruptCounter[MAX_NUM_SOLDIERS]; // SANDRO - interrupt counter added }; class STRUCT_Flags//last edited at version 102 @@ -1126,6 +1142,15 @@ public: // I don't know if this is a good idea at all... //INT16 filler; +#ifdef JA2UB + //ja25 + BOOLEAN fIgnoreGetupFromCollapseCheck; + TIMECOUNTER GetupFromJA25StartCounter; + BOOLEAN fWaitingToGetupFromJA25Start; + + UINT8 ubPercentDamageInflictedByTeam[NUM_ASSIST_SLOTS]; //The percent of damage inflicted by the player team. Each element corresponds to the Soldier ID. Each element contains the percent damage inflicted by that merc +#endif + char endOfPOD; // marker for end of POD (plain old data) // Note: Place all non-POD items at the end (after endOfPOD) @@ -1415,6 +1440,7 @@ void HandlePlayerTogglingLightEffects( BOOLEAN fToggleValue ); UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHigherLevel, BOOLEAN fDontCheckDistance ); UINT16 NumberOfDamagedStats( SOLDIERTYPE * pSoldier ); UINT8 RegainDamagedStats( SOLDIERTYPE * pSoldier, UINT16 usAmountRegainedHundredths ); +BOOLEAN ResolvePendingInterrupt( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType ); //typedef struct class OLDSOLDIERTYPE_101 @@ -2094,7 +2120,14 @@ public: INT8 snowCamo; INT8 wornSnowCamo; + +#ifdef JA2UB + BOOLEAN fIgnoreGetupFromCollapseCheck; + TIMECOUNTER GetupFromJA25StartCounter; + BOOLEAN fWaitingToGetupFromJA25Start; + UINT8 ubPercentDamageInflictedByTeam[NUM_ASSIST_SLOTS]; //The percent of damage inflicted by the player team. Each element corresponds to the Soldier ID. Each element contains the percent damage inflicted by that merc +#endif UINT8 bFiller[ 36 ]; // diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 037efe39..25d50e71 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -52,6 +52,11 @@ #include "message.h" #include "fresh_header.h" +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#endif + // THESE 3 DIFFICULTY FACTORS MUST ALWAYS ADD UP TO 100% EXACTLY!!! #define DIFF_FACTOR_PLAYER_PROGRESS 50 #define DIFF_FACTOR_PALACE_DISTANCE 30 @@ -566,7 +571,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * BOOLEAN fGuyAvail = FALSE; UINT8 bLastTeamID; UINT8 ubVehicleID = 0; - + *pubID = NOBODY; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("TacticalCreateSoldier")); @@ -1004,36 +1009,48 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * case ELDORADO: case ICECREAMTRUCK: case JEEP: - case TANK_NW: - case TANK_NE: + case TANK_NW: + case TANK_NE: Soldier.flags.uiStatusFlags |= SOLDIER_VEHICLE; switch( Soldier.ubBodyType ) { case HUMVEE: + case ELDORADO: + case ICECREAMTRUCK: + case JEEP: + if ( Soldier.ubProfile != HELICOPTER || Soldier.ubProfile != 0 || Soldier.ubProfile != NO_PROFILE || Soldier.ubProfile != TANK_CAR ) + { + ubVehicleID = Soldier.ubProfile; + Soldier.aiData.bNeutral = gNewVehicle[Soldier.ubProfile].bNewNeutral; + } + break; + + /* case HUMVEE: ubVehicleID = HUMMER; - Soldier.aiData.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; break; case ELDORADO: ubVehicleID = ELDORADO_CAR; - Soldier.aiData.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; break; case ICECREAMTRUCK: ubVehicleID = ICE_CREAM_TRUCK; - Soldier.aiData.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; break; - + case JEEP: ubVehicleID = JEEP_CAR; break; - + + */ case TANK_NW: case TANK_NE: @@ -2867,7 +2884,7 @@ SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType ) void RandomizeRelativeLevel( INT8 *pbRelLevel, UINT8 ubSoldierClass ) { - UINT8 ubLocationModifier; + UINT8 ubLocationModifier = 0; INT8 bRollModifier; INT8 bRoll, bAdjustedRoll; @@ -3105,6 +3122,20 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc // to provide one which doesn't work and would confuse everything. switch( pCreateStruct->ubProfile ) { +#ifdef JA2UB + case 75: //MORRIS: + if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32) + { + fRet = CreateKeyObject( &gTempObject , pProfile->bInvNumber[ cnt ], 32 ); + //CreateKeyObject( &(pSoldier->inv[ cnt ] ), pProfile->bInvNumber[ cnt ], 32 ); + } + //else + //{ + // memset( &(pSoldier->inv[cnt]), 0, sizeof( OBJECTTYPE ) ); + //} + break; +#endif + // WANNE: Changed KEY_32 to KEY_8 because we only have 8 keys defined in Items.xml case BREWSTER: if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_8){ @@ -3202,17 +3233,145 @@ void TrashAllSoldiers( ) UINT8 GetLocationModifier( UINT8 ubSoldierClass ) { - UINT8 ubLocationModifier; - UINT8 ubPalaceDistance; + UINT8 ubLocationModifier = 0; INT16 sSectorX, sSectorY, sSectorZ; + #ifdef JA2UB + #else INT8 bTownId; + UINT8 ubPalaceDistance; + #endif BOOLEAN fSuccess; // where is all this taking place? fSuccess = GetCurrentBattleSectorXYZ( &sSectorX, &sSectorY, &sSectorZ ); Assert( fSuccess ); +#ifdef JA2UB + //Ja25 UB + //switch on the sector, to determine modifer + //the modifier is based between 0 and 40. 40 being the "hardest" + switch( SECTOR( sSectorX, sSectorY ) ) + { + //Starting sector + case SEC_H7: + ubLocationModifier = 4; + break; + //First sector that has enemies in it + case SEC_H8: + ubLocationModifier = 8; + break; + + //Guard Post + case SEC_H9: + ubLocationModifier = 14; + break; + + // The 2 "empty" sectors before the town ( north and west of town ) + case SEC_H10: + case SEC_I9: + ubLocationModifier = 12; + break; + + //the town of varrez + case SEC_I10: + ubLocationModifier = 16; + break; + case SEC_I11: + ubLocationModifier = 19; + break; + + + // The 2 "empty" sectors after the town ( east and south of town ) + case SEC_I12: + case SEC_J11: + ubLocationModifier = 22; + break; + + //The abandoned mine + case SEC_I13: + ubLocationModifier = 22; + break; + + //"empty field" that player can take to avoid going through the mine + case SEC_J12: + ubLocationModifier = 22; + break; + + //The power Generator facility + case SEC_J13: + { + //the top floor + switch( sSectorZ ) + { + //Main floor + case 0: + ubLocationModifier = 26; + break; + + //Basement level + case 1: + ubLocationModifier = 15; + break; + default: + Assert( 0 ); + break; + } + } + break; + + //tunnel levels, no enemies + case SEC_J14: + case SEC_K14: + ubLocationModifier = 35; + break; + + case SEC_K15: + { + //the top floor + switch( sSectorZ ) + { + //Main floor + case 0: + ubLocationModifier = 30; + break; + + //Basement level + case 1: + ubLocationModifier = 28; + break; + case 2: + ubLocationModifier = 35; + break; + + default: + ubLocationModifier = 0; + // Assert( 0 ); + break; + } + } + break; + case SEC_L15: + { + //the top floor + switch( sSectorZ ) + { + //Basement level + case 2: + ubLocationModifier = 40; + break; + case 3: + ubLocationModifier = 40; + break; + + default: + Assert( 0 ); + break; + } + } + break; + } +#else // ignore sSectorZ - treat any underground enemies as if they were on the surface! bTownId = GetTownIdForSector( sSectorX, sSectorY ); @@ -3242,7 +3401,7 @@ UINT8 GetLocationModifier( UINT8 ubSoldierClass ) // adjust for distance from Queen's palace (P3) (0 to +30) ubLocationModifier = ( ( MAX_PALACE_DISTANCE - ubPalaceDistance ) * DIFF_FACTOR_PALACE_DISTANCE ) / MAX_PALACE_DISTANCE; - +#endif return( ubLocationModifier ); } diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 27ac1ed9..94e24815 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -707,6 +707,9 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } } } +#ifdef JA2UB +//Ja25: no queen +#else else if ( !gfInMeanwhile && gWorldSectorX == 3 && gWorldSectorY == 16 && !gbWorldSectorZ ) { //Special civilian setup for queen's palace. if( gubFact[ FACT_QUEEN_DEAD ] ) @@ -728,6 +731,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } } } +#endif else if ( gWorldSectorX == TIXA_SECTOR_X && gWorldSectorY == TIXA_SECTOR_Y && gbWorldSectorZ == 0 ) { // Tixa prison, once liberated, should not have any civs without profiles unless @@ -788,6 +792,20 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: return true")); + /* + #ifdef JA2UB + INT32 iCnt; + for( iCnt=0; iCnt< NUM_ORIGINAL_INV_SLOTS; iCnt++) + { + if ( gGameOptions.ubInventorySystem == INVENTORY_OLD && gGameOptions.ubAttachmentSystem == ATTACHMENT_OLD ) + { + if( pSoldier->inv[ iCnt ].usItem == 97 || pSoldier->inv[ iCnt ].usItem == 1346 || pSoldier->inv[ iCnt ].usItem == 99 + || pSoldier->inv[ iCnt ].usItem == 1347 || pSoldier->inv[ iCnt ].usItem == 584 || pSoldier->inv[ iCnt ].usItem == 551 ) //43 + pSoldier->inv[ iCnt ].usItem = 129; //335 + } + } + #endif + */ return TRUE; } else diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index b115c611..518f0d57 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -61,6 +61,13 @@ #include "AimFacialIndex.h" #include "mercs.h" +#ifdef JA2UB +#include "Ja25_Tactical.h" +#endif + +#include "ub_config.h" +#include "XML.h" + #include "connect.h" #ifdef JA2EDITOR extern BOOLEAN gfProfileDataLoaded; @@ -499,7 +506,9 @@ BOOLEAN LoadMercProfiles(void) // FILE *fptr; HWFILE fptr; STR8 pFileName = "BINARYDATA\\Prof.dat"; - +#ifdef JA2UB + STR8 pFileName_UB = "BINARYDATA\\JA25PROF.DAT"; +#endif STR8 pFileName1_Normal = "BINARYDATA\\Prof_Novice_NormalGuns.dat"; STR8 pFileName2_Normal = "BINARYDATA\\Prof_Experienced_NormalGuns.dat"; STR8 pFileName3_Normal = "BINARYDATA\\Prof_Expert_NormalGuns.dat"; @@ -517,6 +526,7 @@ BOOLEAN LoadMercProfiles(void) //InitNewProfiles(); // ----- WANNE.PROFILE: New Profile Loading - END + if (gGameExternalOptions.fUseDifficultyBasedProfDat == TRUE) { switch ( gGameOptions.ubDifficultyLevel) @@ -552,7 +562,17 @@ BOOLEAN LoadMercProfiles(void) } else { + +#ifdef JA2UB + fptr = FileOpen(pFileName_UB, FILE_ACCESS_READ, FALSE ); //ub + if( !fptr ) + { + fptr = FileOpen(pFileName, FILE_ACCESS_READ, FALSE ); //ja + } +#else fptr = FileOpen(pFileName, FILE_ACCESS_READ, FALSE ); +#endif + } @@ -867,6 +887,27 @@ BOOLEAN LoadMercProfiles(void) } FileClose( fptr ); + //WriteMercStartingGearStats(); + +//-------------- +/* +CHAR8 fileName[255]; + + //JA25 UB +for( int i = 0; i < NUM_PROFILES; i++ ) + { + strcpy(fileName, "TABLEDATA\\Profile\\prof03.xml"); + + //sprintf( fileName, "TABLEDATA\\Profile\\prof%03d.xml", i ); + + if ( FileExists(fileName) ) + { + ReadInMercProfiles(fileName,FALSE,i,TRUE); + } + + } +*/ +//-------------- // --------------- @@ -1061,6 +1102,9 @@ void MakeRemainingTerroristsTougher( void ) { if ( gMercProfiles[ gubTerrorists[ ubLoop ] ].bMercStatus != MERC_IS_DEAD && gMercProfiles[ gubTerrorists[ ubLoop ] ].sSectorX != 0 && gMercProfiles[ gubTerrorists[ ubLoop ] ].sSectorY != 0 ) { +#ifdef JA2UB +//no Ub +#else if ( gubTerrorists[ ubLoop ] == SLAY ) { if ( FindSoldierByProfileID( SLAY, TRUE ) != NULL ) @@ -1069,6 +1113,7 @@ void MakeRemainingTerroristsTougher( void ) continue; } } +#endif ubRemainingTerrorists++; } } @@ -1132,6 +1177,10 @@ void MakeRemainingTerroristsTougher( void ) { if ( gMercProfiles[ gubTerrorists[ ubLoop ] ].bMercStatus != MERC_IS_DEAD && gMercProfiles[ gubTerrorists[ ubLoop ] ].sSectorX != 0 && gMercProfiles[ gubTerrorists[ ubLoop ] ].sSectorY != 0 ) { + +#ifdef JA2UB +// no UB +#else if ( gubTerrorists[ ubLoop ] == SLAY ) { if ( FindSoldierByProfileID( SLAY, TRUE ) != NULL ) @@ -1140,7 +1189,7 @@ void MakeRemainingTerroristsTougher( void ) continue; } } - +#endif if ( usOldItem != NOTHING ) { RemoveObjectFromSoldierProfile( gubTerrorists[ ubLoop ], usOldItem ); @@ -1289,9 +1338,29 @@ void StartSomeMercsOnAssignment(void) } pProfile = &(gMercProfiles[ uiCnt ]); +#ifdef JA2UB + //Make sure stigie and Gaston are available at the start of the game +/* if( uiCnt == 59 || uiCnt == 58 ) + { + pProfile->bMercStatus = MERC_OK; + pProfile->uiDayBecomesAvailable = 0; + pProfile->uiPrecedentQuoteSaid = 0; + pProfile->ubDaysOfMoraleHangover = 0; + + continue; + } +*/ + //if the merc is dead, dont modify anything + if( pProfile->bMercStatus == MERC_IS_DEAD ) + { + continue; + } // calc chance to start on assignment + uiChance = 3 * pProfile->bExpLevel; //5 Ja25 UB +#else uiChance = 5 * pProfile->bExpLevel; +#endif // tais: disable mercs being on assignment (this check is just for at the start of the campaign) if (Random(100) < uiChance && gGameExternalOptions.fMercsOnAssignment < 1) @@ -1671,13 +1740,15 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) SwapObjs( pNewSoldier, bSlot, HANDPOS, TRUE ); } } - +#ifdef JA2UB +// no Ja25 UB +#else if ( ubCharNum == IRA ) { // trigger 0th PCscript line TriggerNPCRecord( IRA, 0 ); } - +#endif // Set whatkind of merc am i pNewSoldier->ubWhatKindOfMercAmI = MERC_TYPE__NPC; @@ -1695,7 +1766,10 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) //remove the merc from the Personnel screens departed list ( if they have never been hired before, its ok to call it ) RemoveNewlyHiredMercFromPersonnelDepartedList( pSoldier->ubProfile ); - +#ifdef JA2UB + //If this is a special NPC, play a quote from the team mates + HandlePlayingQuoteWhenHiringNpc( pNewSoldier->ubProfile ); +#endif return( TRUE ); } diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index d114704b..fbfbdb81 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -34,6 +34,7 @@ extern INT16 gsTerroristSector[][5][2]; extern BOOLEAN gfPotentialTeamChangeDuringDeath; extern MERCPROFILESTRUCT gMercProfiles[ NUM_PROFILES ]; + extern MERCPROFILEGEAR gMercProfileGear[ NUM_PROFILES ][ NUM_MERCSTARTINGGEAR_KITS ]; @@ -98,8 +99,11 @@ enum NPCIDs COUGAR, NUMB, BUBBA, - +#ifdef JA2UB + MIGUEL = 58, //Ja25: Was 57 +#else MIGUEL = 57, +#endif CARLOS, IRA, DIMITRI, @@ -108,7 +112,11 @@ enum NPCIDs ROBOT, HAMOUS, SLAY, +#ifdef JA2UB +// RPC65, +#else RPC65, +#endif DYNAMO, SHANK, IGGY, @@ -219,11 +227,19 @@ enum NPCIDs PROF_ICECREAM, PROF_HELICOPTER, NPC164, +#ifdef JA2UB + NPC165, + NPC166, + NPC167, + NPC168, + NPC169, +#else GASTON, STOGIE, TEX, BIGGENS, NPC169, +#endif NPC170 = NPC169 + 84, } ; diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index f0253a47..bb755ec0 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -92,6 +92,15 @@ void InitSquads( void ) BOOLEAN IsThisSquadFull( INT8 bSquadValue ) { + //SQUAD10 FIX: Number of taken slots should not exceed 6/8/10 depending on resolution + if ( NumberOfPeopleInSquad( bSquadValue ) >= gGameOptions.ubSquadSize ) + { + return( true ); + } + + return ( false ); + +/* INT32 iCounter = 0; // run through entries in the squad list, make sure there is a free entry @@ -107,6 +116,7 @@ BOOLEAN IsThisSquadFull( INT8 bSquadValue ) // no free slots - it's full return( TRUE ); +*/ } INT8 GetFirstEmptySquad( void ) @@ -127,6 +137,47 @@ INT8 GetFirstEmptySquad( void ) return( -1 ); } +void FixOversizedSquadsInSector( void ) +{ + // SQUAD10: Fix any squads in current tactical map with more people than allowed at current resolution + INT32 iCountSquad = 0; + INT8 iCountSoldier = 0; + INT8 iPeopleInSquad = 0; + + // loop through all squads + for( iCountSquad = 0; iCountSquad < NUMBER_OF_SQUADS; iCountSquad++ ) + { + // but deal only with squads in current sector + if( IsSquadOnCurrentTacticalMap( iCountSquad ) == TRUE ) + { + // found a squad in current sector...check size + iPeopleInSquad = NumberOfPeopleInSquad( iCountSquad ); + while ( iPeopleInSquad > gGameOptions.ubSquadSize ) + { + // oversized squad found -- move some people to another squad + // + // loop backwards through the squad in order to remove the last person + for( iCountSoldier = NUMBER_OF_SOLDIERS_PER_SQUAD - 1; iCountSoldier >= 0 ; iCountSoldier-- ) + { + // if squad is still oversized, and we have found a squad member + if( (Squad[ iCountSquad ][ iCountSoldier ] != NULL) && (iPeopleInSquad > gGameOptions.ubSquadSize) ) + { + // ... attempt to move him to another squad + if ( AddCharacterToAnySquad( Squad[ iCountSquad ][ iCountSoldier ] ) == TRUE ) + { + // success: we got rid of one person in this squad + iPeopleInSquad--; + } + } + } + // we've looped through all members off the squad + // reset iPeopleInSquad as there is nothing more we can do + iPeopleInSquad = 0; + } + } + } +} + BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) { INT8 bCounter =0; @@ -178,7 +229,16 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) // 'successful of sorts, if there, then he's 'added' return ( TRUE ); } + } + if ( NumberOfPeopleInSquad( bSquadValue ) >= gGameOptions.ubSquadSize ) + { + // SQUAD10: too many people in this squad + return( FALSE ); + } + + for( bCounter =0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; bCounter++ ) + { // free slot, add here if( Squad[ bSquadValue ][ bCounter ] == NULL ) { diff --git a/Tactical/Squads.h b/Tactical/Squads.h index 13ba83d0..904cc5db 100644 --- a/Tactical/Squads.h +++ b/Tactical/Squads.h @@ -6,7 +6,7 @@ #include "Overhead Types.h" // header for squad management system -#define NUMBER_OF_SOLDIERS_PER_SQUAD 6 +#define NUMBER_OF_SOLDIERS_PER_SQUAD 10 // enums for squads enum{ @@ -172,4 +172,7 @@ BOOLEAN DoesVehicleExistInSquad( INT8 bSquadValue ); // re-create any trashed squad movement groups void CheckSquadMovementGroups( void ); +//SQUAD10: Check for squads that are oversized at current resolution and move them to another squad +void FixOversizedSquadsInSector( void ); + #endif \ No newline at end of file diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index a5e686ac..9ca74be4 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -37,6 +37,12 @@ #include "Creature Spreading.h" #endif +#ifdef JA2UB +#include "Explosion Control.h" +#include "Ja25 Strategic Ai.h" +#include "Ja25_Tactical.h" +#endif + BOOLEAN gfInSectorExitMenu = FALSE; void CheckLoadMapCallback( GUI_BUTTON *btn, INT32 reason ); @@ -760,6 +766,15 @@ void RemoveSectorExitMenu( BOOLEAN fOk ) if ( fOk ) { +#ifdef JA2UB + //ja25 ub + //If this is the sector with the power fan + if( gWorldSectorX == 13 && gWorldSectorY == 10 && gbWorldSectorZ == 0 ) + { + //Remeber how the player got through + HandleHowPlayerGotThroughFan(); + } +#endif // Handle the effects here! if ( gExitDialog.fAllMove && gExitDialog.fGotoSector && gExitDialog.fGotoSectorText ) { diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index 05bfbeb8..e4bc7a46 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -47,7 +47,7 @@ #include "Queen Command.h" #include "Map Screen Interface Map Inventory.h" #endif - +#include "Animation Control.h" #include BOOLEAN gfWasInMeanwhile = FALSE; @@ -931,12 +931,15 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( ) gfWasInMeanwhile = FALSE; return TRUE; } +#ifdef JA2UB +//Ja25v No meanwhiles +#else else if( AreInMeanwhile() ) { gfInMeanwhile = FALSE; fShouldBeInMeanwhile = TRUE; } - +#endif //If we havent been to tactical yet if( ( gWorldSectorX == 0 ) && ( gWorldSectorY == 0 ) ) { @@ -1037,11 +1040,14 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( ) EnableModifiedFileSetCache(cacheResetValue); +#ifdef JA2UB +//Ja25 no meanwhile +#else if( fShouldBeInMeanwhile ) { gfInMeanwhile = TRUE; } - +#endif return( TRUE ); } @@ -1196,7 +1202,9 @@ BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile() // // Load in the sectors ITems // - +#ifdef JA2UB +//Ja25v no meanwhiles +#else if( AreInMeanwhile() ) { //There will never be a temp file for the meanwhile scene, so return TRUE. However, //set a flag to not save it either! @@ -1217,7 +1225,7 @@ BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile() } return TRUE; } - +#endif //if we are in an above ground sector //If there is a file, load in the Items array diff --git a/Tactical/Tactical Turns.cpp b/Tactical/Tactical Turns.cpp index 7d8b0040..0046d5fe 100644 --- a/Tactical/Tactical Turns.cpp +++ b/Tactical/Tactical Turns.cpp @@ -40,7 +40,10 @@ extern void DecayPublicOpplist( INT8 bTeam ); //not in overhead.h! extern UINT8 NumEnemyInSector(); +#ifdef JA2UB +//no uB +#else void HandleRPCDescription( ) { @@ -136,7 +139,7 @@ void HandleRPCDescription( ) } } } - +#endif void HandleTacticalEndTurn( ) { @@ -260,8 +263,11 @@ void HandleTacticalEndTurn( ) } } } - +#ifdef JA2UB +// HandleRPCDescription( ); +#else HandleRPCDescription( ); +#endif } diff --git a/Tactical/Tactical_VS2005.vcproj b/Tactical/Tactical_VS2005.vcproj index bf88bc28..e5edc278 100644 --- a/Tactical/Tactical_VS2005.vcproj +++ b/Tactical/Tactical_VS2005.vcproj @@ -490,6 +490,10 @@ RelativePath=".\Items.h" > + + @@ -820,6 +824,10 @@ RelativePath=".\Items.cpp" > + + @@ -1132,6 +1140,10 @@ RelativePath=".\XML_TonyInventory.cpp" > + + diff --git a/Tactical/Tactical_VS2008.vcproj b/Tactical/Tactical_VS2008.vcproj index aedf68c4..22c4e2e4 100644 --- a/Tactical/Tactical_VS2008.vcproj +++ b/Tactical/Tactical_VS2008.vcproj @@ -1,7 +1,7 @@ + + @@ -823,6 +827,10 @@ RelativePath="Items.cpp" > + + @@ -1135,6 +1143,10 @@ RelativePath="XML_TonyInventory.cpp" > + + diff --git a/Tactical/Tactical_VS2010.vcxproj b/Tactical/Tactical_VS2010.vcxproj index 20907d23..1e4ebfbd 100644 --- a/Tactical/Tactical_VS2010.vcxproj +++ b/Tactical/Tactical_VS2010.vcxproj @@ -61,6 +61,7 @@ + @@ -144,6 +145,7 @@ + @@ -222,6 +224,7 @@ + {433FBCC4-F612-489C-AA28-CCD6CF27D80C} diff --git a/Tactical/Tactical_VS2010.vcxproj.filters b/Tactical/Tactical_VS2010.vcxproj.filters index d76b6f9d..15521983 100644 --- a/Tactical/Tactical_VS2010.vcxproj.filters +++ b/Tactical/Tactical_VS2010.vcxproj.filters @@ -258,6 +258,9 @@ Header Files + + Header Files + @@ -602,5 +605,11 @@ Source Files + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index d4d50c9c..dbce1cad 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -48,6 +48,11 @@ #include "NPC.h" #endif +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#endif + // HEADROCK HAM 3.2: Gamesettings.h for external modifications to team turns. #include "GameSettings.h" #include "Reinforcement.h" @@ -257,6 +262,8 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // ATE: Reset killed on attack variable.. this is because sometimes timing is such /// that a baddie can die and still maintain it's attacker ID gTacticalStatus.fKilledEnemyOnAttack = FALSE; + + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; HandleTacticalUI( ); } @@ -342,6 +349,8 @@ void EndTurn( UINT8 ubNextTeam ) } gTacticalStatus.ubCurrentTeam = ubNextTeam; + + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; if(is_server || !is_client) BeginTeamTurn( gTacticalStatus.ubCurrentTeam ); @@ -429,6 +438,8 @@ void EndAllAITurns( void ) gTacticalStatus.ubCurrentTeam = gbPlayerNum; //BeginTeamTurn( gTacticalStatus.ubCurrentTeam ); + + gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; } } @@ -448,6 +459,16 @@ void EndTurnEvents( void ) // decay AI warning values from corpses DecayRottingCorpseAIWarnings(); + +#ifdef JA2UB + //Ja25 UB + + //increment the number of tactical turns that have gone by in turn based mode + gJa25SaveStruct.uiTacticalTurnCounter++; + + //if the fan should start up + HandleStartingFanBackUp(); +#endif } //rain @@ -676,12 +697,14 @@ void DisplayHiddenTurnbased( SOLDIERTYPE * pActingSoldier ) // This code should put the game in turn-based and give control to the AI-controlled soldier // whose pointer has been passed in as an argument (we were in non-combat and the AI is doing // something visible, i.e. making an attack) - +#ifdef JA2UB +//Ja25 No meanwhiles +#else if ( AreInMeanwhile( ) ) { return; } - +#endif if (gTacticalStatus.uiFlags & REALTIME || gTacticalStatus.uiFlags & INCOMBAT) { // pointless call here; do nothing @@ -790,7 +813,8 @@ void StartInterrupt( void ) INT32 iSquad, iCounter; // build string for display of who gets interrupt - while( 1 ) + //while( 1 ) + for( iCounter = 0; iCounter <= MAX_NUM_SOLDIERS; iCounter++ ) { MercPtrs[ubInterrupter]->aiData.bMoved = FALSE; DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("INTERRUPT: popping %d off of the interrupt queue", ubInterrupter ) ); @@ -908,9 +932,10 @@ void StartInterrupt( void ) } */ - while( 1 ) + //while( 1 ) + UINT16 usCounter; + for( usCounter = 0; usCounter <= MAX_NUM_SOLDIERS; usCounter++ ) { - MercPtrs[ubInterrupter]->aiData.bMoved = FALSE; DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("INTERRUPT: popping %d off of the interrupt queue", ubInterrupter ) ); @@ -931,7 +956,6 @@ void StartInterrupt( void ) ubFirstInterrupter = ubInterrupter; } } - { // here we have to rebuilt the AI list! BuildAIListForTeam( bTeam ); @@ -939,11 +963,15 @@ void StartInterrupt( void ) // set to the new first interrupter cnt = RemoveFirstAIListEntry(); - pSoldier = MercPtrs[ cnt ]; + pTempSoldier = MercPtrs[ cnt ]; // pSoldier = MercPtrs[ubFirstInterrupter]; //if ( gTacticalStatus.ubCurrentTeam == OUR_TEAM )//hayden - if (!is_networked && gTacticalStatus.ubCurrentTeam == OUR_TEAM ) // if ( pSoldier->bTeam > OUR_TEAM && pSoldier->bTeam < 6) // cheap disable + // if ( pSoldier->bTeam > OUR_TEAM && pSoldier->bTeam < 6) // cheap disable + // SANDRO - if we just saw the guy, don't flag it as hidden interrupt + if (!is_networked && gTacticalStatus.ubCurrentTeam == OUR_TEAM + && MercPtrs[ LATEST_INTERRUPT_GUY ]->aiData.bOppList[pTempSoldier->ubID] != SEEN_CURRENTLY + && MercPtrs[ LATEST_INTERRUPT_GUY ]->aiData.bOppList[pTempSoldier->ubID] != SEEN_THIS_TURN ) { // we're being interrupted by the computer! // we delay displaying any interrupt message until the computer @@ -953,8 +981,8 @@ void StartInterrupt( void ) } // otherwise it's the AI interrupting another AI team - if (pSoldier != NULL) - gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; + if (pTempSoldier != NULL) + gTacticalStatus.ubCurrentTeam = pTempSoldier->bTeam; if (is_networked) { @@ -963,10 +991,8 @@ void StartInterrupt( void ) #endif } - if (pSoldier != NULL) - StartNPCAI( pSoldier ); - - } + if (pTempSoldier != NULL) + StartNPCAI( pTempSoldier ); } if ( !gfHiddenInterrupt ) @@ -1106,6 +1132,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) // change team gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; + // switch appropriate messages & flags if ( pSoldier->bTeam == OUR_TEAM) { @@ -1198,6 +1225,9 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) // normal player's turn without readjusting time left in turn (for // timed turns) InitPlayerUIBar( 2 ); + + // SANDRO - shouldn't we unset ui here too? + UnSetUIBusy( pSoldier->ubID ); } } @@ -2334,6 +2364,12 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) { // add this guy to everyone's interrupt queue AddToIntList(ubIntList[ubSmallestSlot],TRUE,TRUE); + // SANDRO - for IIS, reset counter if we got here + if ( gGameExternalOptions.fImprovedInterruptSystem ) + { + // reset the counter + MercPtrs[ ubIntList[ubSmallestSlot] ]->aiData.ubInterruptCounter[pSoldier->ubID] = 0; + } if (INTERRUPTS_OVER) { // a loop was created which removed all the people in the interrupt queue! diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 01b06f06..760731ce 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -1437,6 +1437,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) static BOOLEAN fAltDown = FALSE; INT32 usMapPos; BOOLEAN fGoodCheatLevelKey = FALSE; + + CHAR16 zString[128]; GetCursorPos(&MousePos); ScreenToClient(ghWindow, &MousePos); // In window coords! @@ -1536,7 +1538,9 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) HandleShortCutExitState( ); //*puiNewEvent = I_EXIT; } - +#ifdef JA2UB +//Ja25 No meanwhiles +#else if ((InputEvent.usEvent == KEY_UP )&& ( InputEvent.usParam == ESC) ) { if ( AreInMeanwhile() && gCurrentMeanwhileDef.ubMeanwhileID != INTERROGATION ) @@ -1545,11 +1549,29 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) EndMeanwhile(); } } - - // ROMAN.MP +#endif + // It is not allowed in a network game to go to the load screen, because if you cancel the load screen it is always your turn! if (!is_networked) { + // WANNE: Just disabled for now + /* + // WANNE: If the game hangs on enemy turn, just press ALT + CTRL + E and the game will continue with enemy turn!! + if ( (InputEvent.usEvent == KEY_DOWN )&& (InputEvent.usKeyState & CTRL_DOWN) && ( InputEvent.usParam == 'e') ) + { + if( InputEvent.usKeyState & ALT_DOWN ) + { + if (gTacticalStatus.ubCurrentTeam != 0) + { + if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) + { + EndTurn( 1 ); + } + } + } + } + */ + /// Allow to load everywhere if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'l') ) { @@ -2120,43 +2142,64 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) HandleSelectMercSlot( 5, LOCATEANDSELECT_MERC ); break; -#ifdef JA2TESTVERSION case F7: - if( fAlt ) + if( fShift ) + HandleSelectMercSlot( 6, LOCATE_MERC_ONCE ); +#ifdef JA2TESTVERSION + else if( fAlt ) { TestMeanWhile( 16 ); } +#endif + else + HandleSelectMercSlot( 6, LOCATEANDSELECT_MERC ); break; - case F8: - if( fAlt ) + case F8: + if( fShift ) + HandleSelectMercSlot( 7, LOCATE_MERC_ONCE ); +#ifdef JA2TESTVERSION + else if( fAlt ) { TestMeanWhile( 7 ); } +#endif + else + HandleSelectMercSlot( 7, LOCATEANDSELECT_MERC ); break; case F9: - - if( fCtrl ) + if( fShift ) + HandleSelectMercSlot( 8, LOCATE_MERC_ONCE ); +#ifdef JA2TESTVERSION + else if( fCtrl ) { TestMeanWhile( 8 ); } +#endif else { #ifdef JA2EDITOR *puiNewEvent = I_ENTER_EDIT_MODE; gfMercResetUponEditorEntry = !fAlt; + break; #endif + HandleSelectMercSlot( 8, LOCATEANDSELECT_MERC ); } break; - case F10: - if( fAlt ) + case F10: + if( fShift ) + HandleSelectMercSlot( 9, LOCATE_MERC_ONCE ); +#ifdef JA2TESTVERSION + else if( fAlt ) { TestMeanWhile( 9 ); } - break; #endif + else + HandleSelectMercSlot( 9, LOCATEANDSELECT_MERC ); + break; case F11: @@ -3797,7 +3840,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( !MercPtrs[ gusSelectedSoldier ]->MercInWater( ) && !(MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags & SOLDIER_ROBOT ) ) { //change selected merc to run - if ( MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != RUNNING ) + if ( MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != RUNNING + && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING_PISTOL_RDY + && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING_RIFLE_RDY + && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING_DUAL_RDY ) { UIHandleSoldierStanceChange( (UINT8)gusSelectedSoldier, ANIM_STAND ); MercPtrs[ gusSelectedSoldier ]->flags.fUIMovementFast = 1; @@ -3905,7 +3951,9 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } else if ( fCtrl && fShift ) { - SaveGame( SAVE__TIMED_AUTOSAVE, L"Auto Save" ); + //SaveGame( SAVE__TIMED_AUTOSAVE_SLOT1, L"Auto Save 1" ); + swprintf( zString, L"%s %d",pMessageStrings[ 90 ],SAVE__TIMED_AUTOSAVE_SLOT1); + DoAutoSave(SAVE__TIMED_AUTOSAVE_SLOT1,zString); } else { diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index 1981ba88..b55450ef 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -55,10 +55,15 @@ UINT8 ubNumberOfVehicles = 0; extern INT8 SquadMovementGroups[ ]; +NEW_CAR gNewVehicle[NUM_PROFILES]; +BOOLEAN SaveNewVehiclesToSaveGameFile( HWFILE hFile ); +BOOLEAN LoadNewVehiclesToSaveGameFile( HWFILE hFile ); + //ATE: These arrays below should all be in a large LUT which contains // static info for each vehicle.... // the mvt groups associated with vehcile types +/* INT32 iMvtTypes[]={ CAR, // eldorado CAR, // hummer @@ -111,6 +116,7 @@ UINT8 ubVehicleTypeProfileID[ ] = { PROF_HELICOPTER }; +*/ /* // location of crits based on facing @@ -133,7 +139,7 @@ INT8 bInternalCritHitsByLocation[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ][ TANK_CAR, HELICOPTER, */ - +/* INT16 sVehicleArmourType[ NUMBER_OF_TYPES_OF_VEHICLES ] = { KEVLAR_VEST, // El Dorado @@ -143,7 +149,7 @@ INT16 sVehicleArmourType[ NUMBER_OF_TYPES_OF_VEHICLES ] = SPECTRA_VEST, // Tank - do we want this? KEVLAR_VEST, // Helicopter }; - +*/ /* INT16 sVehicleExternalOrigArmorValues[ NUMBER_OF_TYPES_OF_VEHICLES ][ NUMBER_OF_INTERNAL_HIT_LOCATIONS_IN_VEHICLE ]={ @@ -177,6 +183,32 @@ void SetDriver( INT32 iID, UINT8 ubID ); void TeleportVehicleToItsClosestSector( INT32 iVehicleId, UINT8 ubGroupID ); + +BOOLEAN SaveNewVehiclesToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + + FileWrite( hFile, &gNewVehicle, sizeof( gNewVehicle), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gNewVehicle ) ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN LoadNewVehiclesToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + FileRead( hFile, &gNewVehicle, sizeof( gNewVehicle), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gNewVehicle ) ) + { + return( FALSE ); + } + return( TRUE ); +} + void InitAVehicle(int index, int x, int y) { gubVehicleMovementGroups[ index ] = CreateNewVehicleGroupDepartingFromSector( x, y, index ); @@ -196,8 +228,9 @@ void InitAllVehicles( ) { void SetVehicleValuesIntoSoldierType( SOLDIERTYPE *pVehicle ) { - wcscpy( pVehicle->name, zVehicleName[ pVehicleList[ pVehicle->bVehicleID ].ubVehicleType ] ); - +// wcscpy( pVehicle->name, zVehicleName[ pVehicleList[ pVehicle->bVehicleID ].ubVehicleType ] ); + wcscpy( pVehicle->name, gNewVehicle[ pVehicleList[ pVehicle->bVehicleID ].ubVehicleType ].NewVehicleName ); + pVehicle->ubProfile = pVehicleList[ pVehicle->bVehicleID ].ubProfileID; // Init fuel! @@ -292,9 +325,9 @@ INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT32 sGridNo, UINT8 ubType ) pVehicleList[ iCount ].pMercPath = NULL; pVehicleList[ iCount ].fFunctional = TRUE; pVehicleList[ iCount ].fDestroyed = FALSE; - pVehicleList[ iCount ].iMoveSound = iMoveVehicleSndID[ ubType ]; - pVehicleList[ iCount ].iOutOfSound = iEnterVehicleSndID[ ubType ]; - pVehicleList[ iCount ].ubProfileID = ubVehicleTypeProfileID[ ubType ]; + pVehicleList[ iCount ].iMoveSound = gNewVehicle[ ubType ].iNewMoveVehicleSndID; + pVehicleList[ iCount ].iOutOfSound = gNewVehicle[ ubType ].iNewEnterVehicleSndID; + pVehicleList[ iCount ].ubProfileID = ubType; //gNewVehicle[ ubType ].ubNewVehicleTypeProfileID;//gNewVehicle[ ubType ].uiIndex; //gNewVehicle[ ubType ].ubNewVehicleTypeProfileID; // pVehicleList[ iCount ].ubMovementGroup = gubVehicleMovementGroups[ iCount ]; // ATE: Add movement mask to group... @@ -319,8 +352,20 @@ INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT32 sGridNo, UINT8 ubType ) pGroup->ubTransportationMask = TRUCK; } else - { - pGroup->ubTransportationMask = (UINT8)iMvtTypes[ ubType ]; + { + // WANNE: This FIXES the bug (== instead of =), that the heli could only fly on roads!! + if ( gNewVehicle[ ubType ].iNewMvtTypes == 0 ) + pGroup->ubTransportationMask = FOOT; + else if ( gNewVehicle[ ubType ].iNewMvtTypes == 1 ) + pGroup->ubTransportationMask = CAR; + else if ( gNewVehicle[ ubType ].iNewMvtTypes == 2 ) + pGroup->ubTransportationMask = TRUCK; + else if ( gNewVehicle[ ubType ].iNewMvtTypes == 3 ) + pGroup->ubTransportationMask = TRACKED; + else if ( gNewVehicle[ ubType ].iNewMvtTypes == 4 ) + pGroup->ubTransportationMask = AIR; + else + pGroup->ubTransportationMask = CAR; } // ARM: setup group movement defaults @@ -511,7 +556,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) } // check if the grunt is already here - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] == pSoldier ) { @@ -531,7 +576,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) PlayJA2Sample( pVehicleList[ pVehicleSoldier->bVehicleID ].iOutOfSound, RATE_11025, SoundVolume( HIGHVOLUME, pVehicleSoldier->sGridNo ), 1, SoundDir( pVehicleSoldier->sGridNo ) ); } - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { // check if slot free if( pVehicleList[ iId ].pPassengers[ iCounter ] == NULL ) @@ -689,7 +734,7 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) } // now look for the grunt - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] == pSoldier ) { @@ -707,7 +752,7 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) // check if anyone left in vehicle fSoldierLeft = FALSE; - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { @@ -1051,7 +1096,13 @@ BOOLEAN CopyVehiclePathToSoldier( SOLDIERTYPE *pSoldier ) BOOLEAN IsVehicle(SOLDIERTYPE *pSoldier) { - switch(pSoldier->ubProfile) + + if ( gProfilesVehicle[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile ) + return(TRUE); + else + return(FALSE); + + /*switch(pSoldier->ubProfile) { case PROF_HUMMER: case PROF_ELDERODO: @@ -1061,6 +1112,7 @@ BOOLEAN IsVehicle(SOLDIERTYPE *pSoldier) return(FALSE); } return(FALSE); + */ } @@ -1105,7 +1157,7 @@ BOOLEAN SetUpMvtGroupForVehicle( SOLDIERTYPE *pSoldier ) // add everyone in vehicle to this mvt group - //for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + //for( iCounter = 0; iCounter < gNewVehicle.iNewSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) //{ // if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) // { @@ -1181,7 +1233,7 @@ void UpdatePositionOfMercsInVehicle( INT32 iId ) } // go through list of mercs in vehicle and set all thier states as arrived - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { @@ -1235,7 +1287,7 @@ BOOLEAN AddVehicleMembersToMvtGroup( INT32 iId ) // RemoveAllPlayersFromGroup( pVehicleList[ iId ].ubMovementGroup ); // go through list of mercs in vehicle and set all thier states as arrived - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { @@ -1323,7 +1375,7 @@ BOOLEAN KillAllInVehicle( INT32 iId ) } // go through list of occupants and kill them - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { @@ -1349,7 +1401,7 @@ INT32 GetNumberInVehicle( INT32 iId ) return ( 0 ); } - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { @@ -1372,7 +1424,7 @@ INT32 GetNumberOfNonEPCsInVehicle( INT32 iId ) return ( 0 ); } - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL && !AM_AN_EPC( pVehicleList[ iId ].pPassengers[ iCounter ] ) ) { @@ -1395,7 +1447,7 @@ BOOLEAN IsRobotControllerInVehicle( INT32 iId ) return ( 0 ); } - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { pSoldier = pVehicleList[ iId ].pPassengers[ iCounter ]; if ( pSoldier != NULL && pSoldier->ControllingRobot( ) ) @@ -1442,7 +1494,7 @@ void SetDriver( INT32 iID, UINT8 ubID ) #ifdef JA2TESTVERSION void VehicleTest( void ) { - SetUpHelicopterForPlayer( 9,1, SKYRIDER ); + SetUpHelicopterForPlayer( 9,1, gNewVehicle[ HELICOPTER ].NewPilot, HELICOPTER ); } #endif @@ -1455,7 +1507,7 @@ BOOLEAN IsEnoughSpaceInVehicle( INT32 iID ) return ( FALSE ); } - if ( GetNumberInVehicle( iID ) == iSeatingCapacities[ pVehicleList[ iID ].ubVehicleType ] ) + if ( GetNumberInVehicle( iID ) == gNewVehicle[ pVehicleList[ iID ].ubVehicleType ].iNewSeatingCapacities ) { return( FALSE ); } @@ -1629,7 +1681,7 @@ void AddPassangersToTeamPanel( INT32 iId ) { INT32 cnt; - for( cnt = 0; cnt < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; cnt++ ) + for( cnt = 0; cnt < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; cnt++ ) { if( pVehicleList[ iId ].pPassengers[ cnt ] != NULL ) { @@ -1679,7 +1731,7 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridN #if 0 { // injure someone inside - iRand = Random( iSeatingCapacities[ pVehicleList[ ubID ].ubVehicleType ] ); + iRand = Random( gNewVehicle[ pVehicleList[ ubID ].ubVehicleType ].iNewSeatingCapacities ); if( pVehicleList[ ubID ].pPassengers[ iRand ] ) { // hurt this person @@ -1887,7 +1939,7 @@ void SetUpArmorForVehicle( UINT8 ubID ) */ // for armour type, store the index into the armour table itself - pVehicleList[ ubID ].sArmourType = Item[ sVehicleArmourType[ pVehicleList[ ubID ].ubVehicleType ] ].ubClassIndex; + pVehicleList[ ubID ].sArmourType = Item[ gNewVehicle[ pVehicleList[ ubID ].ubVehicleType ].sNewVehicleArmourType ].ubClassIndex; return; } @@ -2156,6 +2208,11 @@ BOOLEAN LoadVehicleInformationFromSavedGameFile( HWFILE hFile, UINT32 uiSavedGam pVehicleList[cnt].pMercPath = NULL; } } + + // WANNE: This should make savegames before the externalized vehicles compatible. + if (pVehicleList[cnt].ubVehicleType != pVehicleList[cnt].ubProfileID) + pVehicleList[cnt].ubVehicleType = pVehicleList[cnt].ubProfileID; + } } return( TRUE ); @@ -2186,7 +2243,7 @@ void UpdateAllVehiclePassengersGridNo( SOLDIERTYPE *pSoldier ) iId = pSoldier->bVehicleID; // Loop through passengers and update each guy's position - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { @@ -2561,7 +2618,7 @@ SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ) iId = pSoldier->bVehicleID; // Loop through passengers and update each guy's position - for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { diff --git a/Tactical/Vehicles.h b/Tactical/Vehicles.h index b06836f7..d268d91a 100644 --- a/Tactical/Vehicles.h +++ b/Tactical/Vehicles.h @@ -5,22 +5,228 @@ #include "Soldier Control.h" #include "Strategic Movement.h" +#include "soldier profile type.h" #define MAX_VEHICLES 10 extern std::vector gubVehicleMovementGroups; +#define MAX_MAIN_VEHICLE_CHARS 500 +typedef struct +{ + UINT8 uiIndex; + INT32 iNewMvtTypes; + INT32 iNewSeatingCapacities; + INT32 iNewEnterVehicleSndID; + INT32 iNewMoveVehicleSndID; + UINT8 ubNewVehicleTypeProfileID; + INT16 sNewVehicleArmourType; + INT8 NewVehicleBodyType; + BOOLEAN bNewNeutral; + BOOLEAN bNewVehicle; + INT8 NewPilot; + CHAR8 szIconFace[MAX_MAIN_VEHICLE_CHARS]; + CHAR16 NewVehicleStrings[128]; + CHAR16 NewVehicleName[128]; + CHAR16 NewShortVehicleStrings[128]; + INT32 NewCarPortraits; + BOOLEAN NewUsed; + +} NEW_CAR; + +extern NEW_CAR gNewVehicle[NUM_PROFILES]; + +extern BOOLEAN SaveNewVehiclesToSaveGameFile( HWFILE hFile ); +extern BOOLEAN LoadNewVehiclesToSaveGameFile( HWFILE hFile ); + // type of vehicles enum{ +/* NEW_VEHICLE1 = 0, + NEW_VEHICLE2, + NEW_VEHICLE3, + NEW_VEHICLE4, + NEW_VEHICLE5, + NEW_VEHICLE6, + NEW_VEHICLE7, + NEW_VEHICLE8, + NEW_VEHICLE9, + NEW_VEHICLE10, + NEW_VEHICLE11, + NEW_VEHICLE12, + NEW_VEHICLE13, + NEW_VEHICLE14, + NEW_VEHICLE15, + NEW_VEHICLE16, + NEW_VEHICLE17, + NEW_VEHICLE18, + NEW_VEHICLE19, + NEW_VEHICLE20, + NEW_VEHICLE21, + NEW_VEHICLE22, + NEW_VEHICLE23, + NEW_VEHICLE24, + NEW_VEHICLE25, + NEW_VEHICLE26, + NEW_VEHICLE27, + NEW_VEHICLE28, + NEW_VEHICLE29, + NEW_VEHICLE30, + NEW_VEHICLE31, + NEW_VEHICLE32, + NEW_VEHICLE33, + NEW_VEHICLE34, + NEW_VEHICLE35, + NEW_VEHICLE36, + NEW_VEHICLE37, + NEW_VEHICLE38, + NEW_VEHICLE39, + NEW_VEHICLE40, + NEW_VEHICLE41, + NEW_VEHICLE42, + NEW_VEHICLE43, + NEW_VEHICLE44, + NEW_VEHICLE45, + NEW_VEHICLE46, + NEW_VEHICLE47, + NEW_VEHICLE48, + NEW_VEHICLE49, + NEW_VEHICLE50, + NEW_VEHICLE51, + NEW_VEHICLE52, + NEW_VEHICLE53, + NEW_VEHICLE54, + NEW_VEHICLE55, + NEW_VEHICLE56, + NEW_VEHICLE57, + NEW_VEHICLE58, + NEW_VEHICLE59, + NEW_VEHICLE60, + NEW_VEHICLE61, + NEW_VEHICLE62, + NEW_VEHICLE63, + NEW_VEHICLE64, + NEW_VEHICLE65, + NEW_VEHICLE66, + NEW_VEHICLE67, + NEW_VEHICLE68, + NEW_VEHICLE69, + NEW_VEHICLE70, + NEW_VEHICLE71, + NEW_VEHICLE72, + NEW_VEHICLE73, + NEW_VEHICLE74, + NEW_VEHICLE75, + NEW_VEHICLE76, + NEW_VEHICLE77, + NEW_VEHICLE78, + NEW_VEHICLE79, + NEW_VEHICLE80, + NEW_VEHICLE81, + NEW_VEHICLE82, + NEW_VEHICLE83, + NEW_VEHICLE84, + NEW_VEHICLE85, + NEW_VEHICLE86, + NEW_VEHICLE87, + NEW_VEHICLE88, + NEW_VEHICLE89, + NEW_VEHICLE90, + NEW_VEHICLE91, + NEW_VEHICLE92, + NEW_VEHICLE93, + NEW_VEHICLE94, + NEW_VEHICLE95, + NEW_VEHICLE96, + NEW_VEHICLE97, + NEW_VEHICLE98, + NEW_VEHICLE99, + NEW_VEHICLE100, + NEW_VEHICLE101, + NEW_VEHICLE102, + NEW_VEHICLE103, + NEW_VEHICLE104, + NEW_VEHICLE105, + NEW_VEHICLE106, + NEW_VEHICLE107, + NEW_VEHICLE108, + NEW_VEHICLE109, + NEW_VEHICLE110, + NEW_VEHICLE111, + NEW_VEHICLE112, + NEW_VEHICLE113, + NEW_VEHICLE114, + NEW_VEHICLE115, + NEW_VEHICLE116, + NEW_VEHICLE117, + NEW_VEHICLE118, + NEW_VEHICLE119, + NEW_VEHICLE120, + NEW_VEHICLE121, + NEW_VEHICLE122, + NEW_VEHICLE123, + NEW_VEHICLE124, + NEW_VEHICLE125, + NEW_VEHICLE126, + NEW_VEHICLE127, + NEW_VEHICLE128, + NEW_VEHICLE129, + NEW_VEHICLE130, + NEW_VEHICLE131, + NEW_VEHICLE132, + NEW_VEHICLE133, + NEW_VEHICLE134, + NEW_VEHICLE135, + NEW_VEHICLE136, + NEW_VEHICLE137, + NEW_VEHICLE138, + NEW_VEHICLE139, + NEW_VEHICLE140, + NEW_VEHICLE141, + NEW_VEHICLE142, + NEW_VEHICLE143, + NEW_VEHICLE144, + NEW_VEHICLE145, + NEW_VEHICLE146, + NEW_VEHICLE147, + NEW_VEHICLE148, + NEW_VEHICLE149, + NEW_VEHICLE150, + NEW_VEHICLE151, + NEW_VEHICLE152, + NEW_VEHICLE153, + NEW_VEHICLE154, + NEW_VEHICLE155, + NEW_VEHICLE156, + NEW_VEHICLE157, + NEW_VEHICLE158, + NEW_VEHICLE159, + */ + NEW_VEHICLE1 = 0, + NEW_VEHICLE2 = NEW_VEHICLE1 + 159, + HUMMER = 160, + ELDORADO_CAR = 161, + ICE_CREAM_TRUCK = 162, + HELICOPTER = 163, + //JEEP_CAR = 164, + TANK_CAR = 164, + NEW_VEHICLE165 = 165, + NEW_VEHICLE166 = 166, + NEW_VEHICLE167 = 167, + NEW_VEHICLE168 = 168, + NEW_VEHICLE169 = 169, + NUMBER_OF_TYPES_OF_VEHICLES = NEW_VEHICLE169 + 84, + + /* ELDORADO_CAR = 0, HUMMER, ICE_CREAM_TRUCK, JEEP_CAR, TANK_CAR, HELICOPTER, - NUMBER_OF_TYPES_OF_VEHICLES, + + NUMBER_OF_TYPES_OF_VEHICLES, + */ }; - // external armor hit locations enum{ FRONT_EXTERNAL_HIT_LOCATION, diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 76540e33..2b8884c8 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1212,7 +1212,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) // try to unjam gun if(EnoughPoints(pSoldier, APBPConstants[AP_UNJAM], APBPConstants[BP_UNJAM], FALSE)) { - DeductPoints(pSoldier, APBPConstants[AP_UNJAM], APBPConstants[BP_UNJAM]); + DeductPoints(pSoldier, APBPConstants[AP_UNJAM], APBPConstants[BP_UNJAM] ); INT8 bChanceMod; if ( Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].EasyUnjam ) @@ -1643,7 +1643,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) */ } - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } } @@ -1655,12 +1655,12 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // only deduct APs when the main gun fires if ( pSoldier->ubAttackingHand == HANDPOS ) { - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } } else { - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } //PLAY SOUND @@ -2177,7 +2177,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) */ } - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } } @@ -2189,12 +2189,12 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // only deduct APs when the main gun fires if ( pSoldier->ubAttackingHand == HANDPOS ) { - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } } else { - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } //PLAY SOUND @@ -2674,7 +2674,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // Deduct points! sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->aiData.bAimTime ); - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERACTION_INTERRUPT ); // GET TARGET XY VALUES ConvertGridNoToCenterCellXY( sTargetGridNo, &sXMapPos, &sYMapPos ); @@ -2873,7 +2873,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea if (!fStealing) { sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->aiData.bAimTime ); - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERACTION_INTERRUPT ); } // Steal from the enemy else @@ -2949,7 +2949,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea // SANDRO - unable to steal from militia if they are not allowed to drop equipment if (SOLDIER_CLASS_MILITIA(pTargetSoldier->ubSoldierClass) && (gGameExternalOptions.ubMilitiaDropEquipment != 2) ) { - DeductPoints( pSoldier, (APBPConstants[AP_STEAL_ITEM] / 5), 0 ); + DeductPoints( pSoldier, (APBPConstants[AP_STEAL_ITEM] / 5), 0, AFTERACTION_INTERRUPT ); pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); return ( TRUE ); } @@ -2963,7 +2963,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea { // first, charge extra Aps, because it's difficlut to pickup from other soldier if (gGameExternalOptions.fEnhancedCloseCombatSystem) - DeductPoints( pSoldier, (GetBasicAPsToPickupItem( pSoldier ) * 2), 0 ); + DeductPoints( pSoldier, (GetBasicAPsToPickupItem( pSoldier ) * 2), 0, AFTERACTION_INTERRUPT ); // The item that the enemy holds in his hand before the stealing usOldItem = pTargetSoldier->inv[HANDPOS].usItem; @@ -2975,7 +2975,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea { // charge Aps if (gGameExternalOptions.fEnhancedCloseCombatSystem) - DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0 ); + DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0, AFTERACTION_INTERRUPT ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_STOLE_SOMETHING ], pSoldier->name, ShortItemNames[ pTargetSoldier->inv[ubIndexRet].usItem ] ); if (pTargetSoldier->inv[ubIndexRet].MoveThisObjectTo(gTempObject, 1) == 0) { @@ -3136,28 +3136,28 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea { if (HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && ( gGameOptions.fNewTraitSystem )) { - DeductPoints( pSoldier, max( 1, (INT16)((APBPConstants[AP_STEAL_ITEM] * (100 - gSkillTraitValues.ubMAReducedAPsToSteal * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ))/ 100) + 0.5)), 200); + DeductPoints( pSoldier, max( 1, (INT16)((APBPConstants[AP_STEAL_ITEM] * (100 - gSkillTraitValues.ubMAReducedAPsToSteal * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ))/ 100) + 0.5)), 200, AFTERACTION_INTERRUPT ); } else { - DeductPoints( pSoldier, APBPConstants[AP_STEAL_ITEM], 200 ); + DeductPoints( pSoldier, APBPConstants[AP_STEAL_ITEM], 200, AFTERACTION_INTERRUPT ); } } // Only 1/7 of original AP cost, if the enemy has nothing to steal else if ((fNoMoreItems == TRUE) || (fNoMoreItemInHand == TRUE)) { - DeductPoints( pSoldier, (APBPConstants[AP_STEAL_ITEM] / 7), 0 ); + DeductPoints( pSoldier, (APBPConstants[AP_STEAL_ITEM] / 7), 0, AFTERACTION_INTERRUPT ); } } else { if (HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && ( gGameOptions.fNewTraitSystem )) { - DeductPoints( pSoldier, max( 1, (INT16)((APBPConstants[AP_STEAL_ITEM] * (100 - gSkillTraitValues.ubMAReducedAPsToSteal * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ))/ 100) + 0.5)), 0); + DeductPoints( pSoldier, max( 1, (INT16)((APBPConstants[AP_STEAL_ITEM] * (100 - gSkillTraitValues.ubMAReducedAPsToSteal * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ))/ 100) + 0.5)), 0, AFTERACTION_INTERRUPT ); } else { - DeductPoints( pSoldier, APBPConstants[AP_STEAL_ITEM], 0 ); + DeductPoints( pSoldier, APBPConstants[AP_STEAL_ITEM], 0, AFTERACTION_INTERRUPT ); } } @@ -3424,8 +3424,12 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea } } // WDS 07/19/2008 - Random number use fix +#ifdef JA2UB +//Ja25 no meanwhiles + if ( iDiceRoll < iHitChance ) +#else if ( iDiceRoll < iHitChance || AreInMeanwhile( ) ) - +#endif { // CALCULATE DAMAGE! iImpact = HTHImpact( pSoldier, pTargetSoldier, (iHitChance - iDiceRoll), FALSE ); @@ -3580,7 +3584,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) sAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); HandleSoldierThrowItem( pSoldier, pSoldier->sTargetGridNo ); - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); pSoldier->inv[ HANDPOS ].RemoveObjectsFromStack(1); /* @@ -3710,12 +3714,12 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) // ONly deduct points once if ( pSoldier->bDoBurst == 1 ) { - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } } else { - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( pSoldier, sAPCost, 0, AFTERSHOT_INTERRUPT ); } ///////////////////////////////////////////////////////////////////////////////////// diff --git a/Tactical/XML.h b/Tactical/XML.h index 643c6fcf..c7b9a4bb 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -7,7 +7,14 @@ #include "faces.h" #include "Interface.h" #include "XML_SenderNameList.h" +#include "mainmenuscreen.h" + +#include "ub_config.h" +#include "Strategic Town Loyalty.h" #include "qarray.h" +#include "XML_Language.h" +#include "Encyclopedia_Data.h" +#include "Encyclopedia.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -69,6 +76,10 @@ typedef PARSE_STAGE; #define LBEPOCKETFILENAME "Pockets.xml" #define MERCSTARTINGGEARFILENAME "MercStartingGear.xml" +#ifdef JA2UB +#define MERCSTARTINGGEAR25FILENAME "MercStartingGear25.xml" //ja25 ub +#endif + #define TONYINVENTORYFILENAME "NPCInventory\\TonyInventory.xml" #define DEVININVENTORYFILENAME "NPCInventory\\DevinInventory.xml" #define FRANZINVENTORYFILENAME "NPCInventory\\FranzInventory.xml" @@ -89,6 +100,11 @@ typedef PARSE_STAGE; #define PERKOINVENTORYFILENAME "NPCInventory\\PerkoInventory.xml" #define FREDOINVENTORYFILENAME "NPCInventory\\FredoInventory.xml" +#ifdef JA2UB +#define BETTYINVENTORYFILENAME "NPCInventory\\BettyInventory.xml" +#define RAULINVENTORYFILENAME "NPCInventory\\RaulInventory.xml" +#endif + #define BOBBYRAYSTRINGSFILENAME "BobbyRayStrings.xml" #define AMMOCALIBERSTRINGSFILENAME "AmmoCaliberStrings.xml" @@ -172,9 +188,17 @@ typedef PARSE_STAGE; //Sender Name List #define SENDERNAMELISTFILENAME "SenderNameList.xml" +#define ACTIONITEMSFILENAME "MapAction\\Actionitems.xml" #define IMPPORTRAITS "IMPPortraits.xml" +#ifdef JA2UB +// UB +#define MERCPROFILESFILENAME25 "MercProfiles25.xml" +// UB +#define MERCOPINIONSFILENAME25 "MercOpinions25.xml" +#endif + #define SOUNDPROFILE "SoundsProfiles.xml" #define RANDOMSTATS "RandomStats.xml" @@ -183,6 +207,8 @@ typedef PARSE_STAGE; #define SECTORLEVEL2NAMESFILENAME "Map\\SectorNamesLevel_2.xml" #define SECTORLEVEL3NAMESFILENAME "Map\\SectorNamesLevel_3.xml" +#define LAYOUTMAINMENU "Layout\\LayoutMainMenu.xml" +#define INTROFILESFILENAME "IntroFiles.xml" #define MERCAVAILABILITY "MercAvailability.xml" #define AIMAVAILABILITY "AimAvailability.xml" @@ -191,6 +217,25 @@ typedef PARSE_STAGE; #define FACEGEARFILENAME "FaceGear.xml" +//Sender Name List +#define EMAILSENDERNAMELIST "Email\\EmailSenderNameList.xml" +#define EMAILMERCAVAILABLE "Email\\EmailMercAvailable.xml" +#define EMAILMERCLEVELUP "Email\\EmailMercLevelUp.xml" +#define EMAILOTHER "Email\\EmailOther.xml" +#define EMAILINSURANCE "Email\\EmailInsurance.xml" + + +#define VEHICLESFILENAME "Vehicles.xml" + +#define TEXTFILENAME "Text\\TacticalMessages.xml" + +#define ENCYCLOPEDIALOCATIONFILENAME "Encyclopedia\\EncyclopediaLocations.xml" +#define ENCYCLOPEDIAPROFILEFILENAME "Encyclopedia\\EncyclopediaProfiles.xml" +#define ENCYCLOPEDIAINVENTORYFILENAME "Encyclopedia\\EncyclopediaInventory.xml" +#define ENCYCLOPEDIAOTHERFILENAME "Encyclopedia\\EncyclopediaOthers.xml" +#define ENCYCLOPEDIAQUESTSFILENAME "Encyclopedia\\EncyclopediaQuests.xml" +#define BRIEFINGROOMFILENAME "BriefingRoom\\BriefingRoom.xml" + extern BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion); extern BOOLEAN WriteItemStats(); @@ -393,5 +438,23 @@ extern BOOLEAN ReadInQarray(QARRAY_VALUES *pQarray, STR fileName); extern BOOLEAN WriteFaceGear(); extern BOOLEAN ReadInFaceGear( FACE_GEAR_VALUES *pFaceGear, STR fileName ); +extern BOOLEAN ReadInIntroNames(STR fileName, BOOLEAN localizedVersion); +extern BOOLEAN ReadInMainMenu(MAIN_MENU_VALUES *pMainMenu, STR fileName); + +extern BOOLEAN ReadInActionItems(STR fileName, BOOLEAN localizedVersion); +extern BOOLEAN WriteInActionItems( STR fileName); + +extern BOOLEAN ReadInEmailMercAvailable(STR fileName, BOOLEAN localizedVersion); +extern BOOLEAN ReadInEmailMercLevelUp(STR fileName, BOOLEAN localizedVersion); +extern BOOLEAN ReadInEmailOther(STR fileName, BOOLEAN localizedVersion); +//extern BOOLEAN ReadInInsurance(STR fileName, BOOLEAN localizedVersion); + +extern BOOLEAN ReadInEncyclopediaLocation(STR fileName, BOOLEAN localizedVersion, ENCYCLOPEDIA_LOCATION *Ency, UINT32 FileType2 ); + +extern BOOLEAN ReadInNewVehicles(STR fileName, BOOLEAN localizedVersion); +extern BOOLEAN WriteNewVehicles(STR fileName); +extern void InitNewVehicles (); + +extern BOOLEAN ReadInLanguageLocation(STR fileName, BOOLEAN localizedVersion, LANGUAGE_LOCATION *Lang, UINT32 FileType2 ); #endif diff --git a/Tactical/XML_Vehicles.cpp b/Tactical/XML_Vehicles.cpp new file mode 100644 index 00000000..dcda0a01 --- /dev/null +++ b/Tactical/XML_Vehicles.cpp @@ -0,0 +1,306 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Vehicles.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + NEW_CAR curNewCar; + NEW_CAR * curArray; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +} +typedef newCarParseData; + +BOOLEAN NewCar_TextOnly; + +void InitNewVehicles (); + +static void XMLCALL +newCarStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + newCarParseData * pData = (newCarParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "VEHICLES") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + pData->maxReadDepth++; + } + else if(strcmp(name, "VEHICLE") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + pData->maxReadDepth++; + } + else if(pData->curElement == ELEMENT && + ( strcmp(name, "uiIndex") == 0 || + strcmp(name, "MvtTypes") == 0 || + strcmp(name, "SeatingCapacities") == 0 || + strcmp(name, "EnterVehicleSndID") == 0 || + strcmp(name, "MoveVehicleSndID") == 0 || + strcmp(name, "VehicleTypeProfileID") == 0 || + strcmp(name, "VehicleArmourType") == 0 || + strcmp(name, "VehicleBodyType") == 0 || + strcmp(name, "VehicleEnabled") == 0 || + strcmp(name, "Pilot") == 0 || + strcmp(name, "StiFaceIcon") == 0 || + strcmp(name, "Name") == 0 || + strcmp(name, "LongName") == 0 || + strcmp(name, "ShortName") == 0 || + strcmp(name, "Neutral") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + pData->maxReadDepth++; + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +newCarCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + newCarParseData * pData = (newCarParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)) + { + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +newCarEndElementHandle(void *userData, const XML_Char *name) +{ + char temp; + + newCarParseData * pData = (newCarParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "VEHICLES") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "VEHICLE") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!NewCar_TextOnly) + { + gNewVehicle[pData->curNewCar.uiIndex].uiIndex = pData->curNewCar.uiIndex; + gNewVehicle[pData->curNewCar.uiIndex].iNewMvtTypes = pData->curNewCar.iNewMvtTypes; + gNewVehicle[pData->curNewCar.uiIndex].iNewSeatingCapacities = pData->curNewCar.iNewSeatingCapacities; + gNewVehicle[pData->curNewCar.uiIndex].iNewEnterVehicleSndID = pData->curNewCar.iNewEnterVehicleSndID; + gNewVehicle[pData->curNewCar.uiIndex].iNewMoveVehicleSndID = pData->curNewCar.iNewMoveVehicleSndID; + gNewVehicle[pData->curNewCar.uiIndex].ubNewVehicleTypeProfileID = pData->curNewCar.ubNewVehicleTypeProfileID; + gNewVehicle[pData->curNewCar.uiIndex].sNewVehicleArmourType = pData->curNewCar.sNewVehicleArmourType; + gNewVehicle[pData->curNewCar.uiIndex].NewVehicleBodyType = pData->curNewCar.NewVehicleBodyType; + gNewVehicle[pData->curNewCar.uiIndex].bNewVehicle = pData->curNewCar.bNewVehicle; + gNewVehicle[pData->curNewCar.uiIndex].bNewNeutral = pData->curNewCar.bNewNeutral; + gNewVehicle[pData->curNewCar.uiIndex].NewPilot = pData->curNewCar.NewPilot; + strcpy(gNewVehicle[pData->curNewCar.uiIndex].szIconFace, pData->curNewCar.szIconFace); + gNewVehicle[ pData->curNewCar.uiIndex ].NewCarPortraits = -1; + wcscpy(gNewVehicle[pData->curNewCar.uiIndex].NewVehicleStrings, pData->curNewCar.NewVehicleStrings); + wcscpy(gNewVehicle[pData->curNewCar.uiIndex].NewVehicleName, pData->curNewCar.NewVehicleName); + wcscpy(gNewVehicle[pData->curNewCar.uiIndex].NewShortVehicleStrings, pData->curNewCar.NewShortVehicleStrings); + gNewVehicle[ pData->curNewCar.uiIndex ].NewUsed = FALSE; + } + else + { + wcscpy(gNewVehicle[pData->curNewCar.uiIndex].NewVehicleStrings, pData->curNewCar.NewVehicleStrings); + wcscpy(gNewVehicle[pData->curNewCar.uiIndex].NewVehicleName, pData->curNewCar.NewVehicleName); + wcscpy(gNewVehicle[pData->curNewCar.uiIndex].NewShortVehicleStrings, pData->curNewCar.NewShortVehicleStrings); + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.uiIndex = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "MvtTypes") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.iNewMvtTypes = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "SeatingCapacities") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.iNewSeatingCapacities = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "EnterVehicleSndID") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.iNewEnterVehicleSndID = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "MoveVehicleSndID") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.iNewMoveVehicleSndID = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "VehicleArmourType") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.sNewVehicleArmourType = (INT16) atol(pData->szCharData); + } + else if(strcmp(name, "VehicleEnabled") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.bNewVehicle = (BOOLEAN) atol(pData->szCharData); + } + else if(strcmp(name, "Neutral") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.bNewNeutral = (BOOLEAN) atol(pData->szCharData); + } + else if(strcmp(name, "Pilot") == 0) + { + pData->curElement = ELEMENT; + pData->curNewCar.NewPilot = (INT8) atol(pData->szCharData); + } + else if(strcmp(name, "Name") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curNewCar.NewVehicleName, sizeof(pData->curNewCar.NewVehicleName)/sizeof(pData->curNewCar.NewVehicleName[0]) ); + pData->curNewCar.NewVehicleName[sizeof(pData->curNewCar.NewVehicleName)/sizeof(pData->curNewCar.NewVehicleName[0]) - 1] = '\0'; + } + else if(strcmp(name, "LongName") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curNewCar.NewVehicleStrings, sizeof(pData->curNewCar.NewVehicleStrings)/sizeof(pData->curNewCar.NewVehicleStrings[0]) ); + pData->curNewCar.NewVehicleStrings[sizeof(pData->curNewCar.NewVehicleStrings)/sizeof(pData->curNewCar.NewVehicleStrings[0]) - 1] = '\0'; + } + else if(strcmp(name, "ShortName") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curNewCar.NewShortVehicleStrings, sizeof(pData->curNewCar.NewShortVehicleStrings)/sizeof(pData->curNewCar.NewShortVehicleStrings[0]) ); + pData->curNewCar.NewShortVehicleStrings[sizeof(pData->curNewCar.NewShortVehicleStrings)/sizeof(pData->curNewCar.NewShortVehicleStrings[0]) - 1] = '\0'; + } + else if(strcmp(name, "StiFaceIcon") == 0) + { + pData->curElement = ELEMENT; + + if(MAX_MAIN_VEHICLE_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curNewCar.szIconFace,pData->szCharData); + else + { + strncpy(pData->curNewCar.szIconFace,pData->szCharData,MAX_MAIN_VEHICLE_CHARS); + pData->curNewCar.szIconFace[MAX_MAIN_VEHICLE_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_MAIN_VEHICLE_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curNewCar.szIconFace[i] = temp; + } + } + + pData->maxReadDepth--; + + } + + pData->currentDepth--; +} + +BOOLEAN ReadInNewVehicles(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + newCarParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Vehicles.xml" ); + + NewCar_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + XML_SetElementHandler(parser, newCarStartElementHandle, newCarEndElementHandle); + XML_SetCharacterDataHandler(parser, newCarCharacterDataHandle); + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in Vehicles.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + XML_ParserFree(parser); + + return( TRUE ); +} + +void InitNewVehicles () +{ + UINT32 iCount; + + for( iCount=0; iCountubProfile ) { case CARMEN: +#ifdef JA2UB +// no UB +#else if (pOpponent->ubProfile == SLAY ) // 64 { // Carmen goes to war (against Slay) @@ -2209,7 +2222,11 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, EnterCombatMode( pSoldier->bTeam ); } */ + } +#endif + + break; case ELDIN: if ( pSoldier->aiData.bNeutral ) @@ -2264,6 +2281,10 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, } break; //case QUEEN: +#ifdef JA2UB +//Ja25 +//No Queen,Joe, or elliot +#else case JOE: case ELLIOT: if ( ! ( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) ) @@ -2275,6 +2296,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, } } break; +#endif default: break; } @@ -2370,6 +2392,15 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, } else if ( pSoldier->bTeam == gbPlayerNum ) { +#ifdef JA2UB + if( (pOpponent->ubProfile == 75 ) && + ( GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, NULL ) != 0 ) && + !( pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MORRIS ) && + !( gMercProfiles[ 75 ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) ) + { + gfMorrisShouldSayHi = TRUE; + } +#else if ( (pOpponent->ubProfile == MIKE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && !(pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MIKE) ) { if (gfMikeShouldSayHi == FALSE) @@ -2379,6 +2410,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, TacticalCharacterDialogue( pSoldier, QUOTE_AIM_SEEN_MIKE ); pSoldier->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_MIKE; } +#endif else if ( pOpponent->ubProfile == JOEY && gfPlayerTeamSawJoey == FALSE ) { TacticalCharacterDialogue( pSoldier, QUOTE_SPOTTED_JOEY ); @@ -3274,12 +3306,14 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin UINT8 ubNumEnemies = 0; UINT8 ubNumAllies = 0; UINT32 cnt; - +#ifdef JA2UB +//Ja25 No meanwhiles +#else if ( AreInMeanwhile( ) ) { return; } - +#endif // Check out for our under large fire quote if ( !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_IN_SHIT ) ) { @@ -6513,7 +6547,11 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGri // if the quote was faint, say something if (ubVolumeIndex == 0) { +#ifdef JA2UB +//Ja25 No meanwhiles +#else if ( !AreInMeanwhile( ) && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV) && pSoldier->ubTurnsUntilCanSayHeardNoise == 0) +#endif { TacticalCharacterDialogue( pSoldier, QUOTE_HEARD_SOMETHING ); if ( gTacticalStatus.uiFlags & INCOMBAT ) @@ -7499,3 +7537,10 @@ BOOLEAN SoldierHasLimitedVision(SOLDIERTYPE * pSoldier) else return FALSE; } + +#ifdef JA2UB +INT32 MaxDistanceVisible( void ) +{ + return( STRAIGHT * 2 ); +} +#endif diff --git a/Tactical/opplist.h b/Tactical/opplist.h index 95559a88..158f25e5 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -29,6 +29,20 @@ #define SIGHTINTERRUPT 1 #define NOISEINTERRUPT 2 +// SANDRO - enum for improved interrupt system +enum +{ + DISABLED_INTERRUPT = 0, + UNTRIGGERED_INTERRUPT, + UNDEFINED_INTERRUPT, + MOVEMENT_INTERRUPT, + SP_MOVEMENT_INTERRUPT, + BEFORESHOT_INTERRUPT, + AFTERSHOT_INTERRUPT, + AFTERACTION_INTERRUPT, + INSTANT_INTERRUPT, + MAX_INTERRUPT_TYPES +}; // noise type constants enum @@ -74,6 +88,9 @@ extern INT8 gfKnowAboutOpponents; extern BOOLEAN gfPlayerTeamSawJoey; extern BOOLEAN gfMikeShouldSayHi; +#ifdef JA2UB +extern BOOLEAN gfMorrisShouldSayHi; // JA25 UB +#endif extern INT32 gsWatchedLoc[ TOTAL_SOLDIERS ][ NUM_WATCHED_LOCS ]; extern INT8 gbWatchedLocLevel[ TOTAL_SOLDIERS ][ NUM_WATCHED_LOCS ]; @@ -152,6 +169,11 @@ extern INT8 gbLightSighting[1][16]; BOOLEAN SoldierHasLimitedVision(SOLDIERTYPE * pSoldier); + +#ifdef JA2UB +INT32 MaxDistanceVisible( void ); +#endif + // HEADROCK HAM 3.6: Moved here from cpp void MakeBloodcatsHostile( void ); #endif \ No newline at end of file diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index a3042073..fc9c5666 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -8,7 +8,13 @@ #define NUM_PROFILES_v111 170 //tais: maximum amount of starting gear kits #define NUM_MERCSTARTINGGEAR_KITS 5 + +#ifdef JA2UB +#define FIRST_RPC 60 //JA25 was 59 +#else #define FIRST_RPC 57 +#endif + #define FIRST_NPC 75 #define NAME_LENGTH 30 @@ -1026,4 +1032,211 @@ public: #define SUSPICIOUS_DEATH 1 #define VERY_SUSPICIOUS_DEATH 2 + +#ifdef WFconvertUB + +typedef struct +{ + UINT16 zName[ NAME_LENGTH ]; + UINT16 zNickname[ NICKNAME_LENGTH ]; + UINT32 uiAttnSound; + UINT32 uiCurseSound; + UINT32 uiDieSound; + UINT32 uiGoodSound; + UINT32 uiGruntSound; + UINT32 uiGrunt2Sound; + UINT32 uiOkSound; + UINT8 ubFaceIndex; + PaletteRepID PANTS; + PaletteRepID VEST; + PaletteRepID SKIN; + PaletteRepID HAIR; + INT8 bSex; + INT8 bArmourAttractiveness; + UINT8 ubMiscFlags2; + INT8 bEvolution; + UINT8 ubMiscFlags; + UINT8 bSexist; + INT8 bLearnToHate; + + // skills + INT8 bStealRate; + INT8 bVocalVolume; + UINT8 ubQuoteRecord; + INT8 bDeathRate; + INT8 bScientific; + + INT16 sExpLevelGain; + INT16 sLifeGain; + INT16 sAgilityGain; + INT16 sDexterityGain; + INT16 sWisdomGain; + INT16 sMarksmanshipGain; + INT16 sMedicalGain; + INT16 sMechanicGain; + INT16 sExplosivesGain; + + UINT8 ubBodyType; + INT8 bMedical; + + UINT16 usEyesX; + UINT16 usEyesY; + UINT16 usMouthX; + UINT16 usMouthY; + UINT32 uiEyeDelay; + UINT32 uiMouthDelay; + UINT32 uiBlinkFrequency; + UINT32 uiExpressionFrequency; + UINT16 sSectorX; + UINT16 sSectorY; + + UINT32 uiDayBecomesAvailable; //day the merc will be available. used with the bMercStatus + + INT8 bStrength; + + INT8 bLifeMax; + INT8 bExpLevelDelta; + INT8 bLifeDelta; + INT8 bAgilityDelta; + INT8 bDexterityDelta; + INT8 bWisdomDelta; + INT8 bMarksmanshipDelta; + INT8 bMedicalDelta; + INT8 bMechanicDelta; + INT8 bExplosivesDelta; + INT8 bStrengthDelta; + INT8 bLeadershipDelta; + UINT16 usKills; + UINT16 usAssists; + UINT16 usShotsFired; + UINT16 usShotsHit; + UINT16 usBattlesFought; + UINT16 usTimesWounded; + UINT16 usTotalDaysServed; + + INT16 sLeadershipGain; + INT16 sStrengthGain; + + + + // BODY TYPE SUBSITUTIONS + UINT32 uiBodyTypeSubFlags; + + INT16 sSalary; + INT8 bLife; + INT8 bDexterity; // dexterity (hand coord) value + INT8 bPersonalityTrait; + INT8 bSkillTrait; + + INT8 bReputationTolerance; + INT8 bExplosive; + INT8 bSkillTrait2; + INT8 bLeadership; + + INT8 bBuddy[5]; + INT8 bHated[5]; + INT8 bExpLevel; // general experience level + + INT8 bMarksmanship; + UINT8 bMinService; + INT8 bWisdom; + UINT8 bResigned; + UINT8 bActive; + + UINT8 bInvStatus[19]; + UINT8 bInvNumber[19]; + UINT16 usApproachFactor[4]; + + INT8 bMainGunAttractiveness; + INT8 bAgility; // agility (speed) value + + BOOLEAN fUseProfileInsertionInfo; // Set to various flags, ( contained in TacticalSave.h ) + INT16 sGridNo; // The Gridno the NPC was in before leaving the sector + UINT8 ubQuoteActionID; + INT8 bMechanical; + + UINT8 ubInvUndroppable; + UINT8 ubRoomRangeStart[2]; + UINT16 inv[19]; + INT8 bMercTownReputation[ 20 ]; + + UINT16 usStatChangeChances[ 12 ]; // used strictly for balancing, never shown! + UINT16 usStatChangeSuccesses[ 12 ]; // used strictly for balancing, never shown! + + UINT8 ubStrategicInsertionCode; + + UINT8 ubRoomRangeEnd[2]; + + INT8 bPadding[ 4 ]; + + UINT8 ubLastQuoteSaid; + + INT8 bRace; + INT8 bNationality; + INT8 bAppearance; + INT8 bAppearanceCareLevel; + INT8 bRefinement; + INT8 bRefinementCareLevel; + INT8 bHatedNationality; + INT8 bHatedNationalityCareLevel; + INT8 bRacist; + UINT32 uiWeeklySalary; + UINT32 uiBiWeeklySalary; + INT8 bMedicalDeposit; + INT8 bAttitude; + INT8 bBaseMorale; + UINT16 sMedicalDepositAmount; + + INT8 bLearnToLike; + UINT8 ubApproachVal[4]; + UINT8 ubApproachMod[3][4]; + INT8 bTown; + INT8 bTownAttachment; + UINT16 usOptionalGearCost; + INT8 bMercOpinion[75]; + INT8 bApproached; + INT8 bMercStatus; //The status of the merc. If negative, see flags at the top of this file. Positive: The number of days the merc is away for. 0: Not hired but ready to be. + INT8 bHatedTime[5]; + INT8 bLearnToLikeTime; + INT8 bLearnToHateTime; + INT8 bHatedCount[5]; + INT8 bLearnToLikeCount; + INT8 bLearnToHateCount; + UINT8 ubLastDateSpokenTo; + UINT8 bLastQuoteSaidWasSpecial; + INT8 bSectorZ; + UINT16 usStrategicInsertionData; + INT8 bFriendlyOrDirectDefaultResponseUsedRecently; + INT8 bRecruitDefaultResponseUsedRecently; + INT8 bThreatenDefaultResponseUsedRecently; + INT8 bNPCData; // NPC specific + INT32 iBalance; + INT16 sTrueSalary; // for use when the person is working for us for free but has a positive salary value + UINT8 ubCivilianGroup; + UINT8 ubNeedForSleep; + UINT32 uiMoney; + INT8 bNPCData2; // NPC specific + + UINT8 ubMiscFlags3; + + UINT8 ubDaysOfMoraleHangover; // used only when merc leaves team while having poor morale + UINT8 ubNumTimesDrugUseInLifetime; // The # times a drug has been used in the player's lifetime... + + // Flags used for the precedent to repeating oneself in Contract negotiations. Used for quote 80 - ~107. Gets reset every day + UINT32 uiPrecedentQuoteSaid; + UINT32 uiProfileChecksum; + INT16 sPreCombatGridNo; + UINT8 ubTimeTillNextHatedComplaint; + UINT8 ubSuspiciousDeath; + + INT32 iMercMercContractLength; //Used for MERC mercs, specifies how many days the merc has gone since last page + + UINT32 uiTotalCostToDate; // The total amount of money that has been paid to the merc for their salary + + UINT16 usTotalKills; // total kills the player has had ( only used if the player imported the mercs from ja2 ) + UINT16 usTotalAssists; // total assists the player has had ( only used if the player imported the mercs from ja2 ) +} MERCPROFILESTRUCT_OLD_WF; + +#endif + #endif diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 43385103..64ec12dd 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -60,6 +60,11 @@ #include "connect.h" +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#endif + extern void PauseAITemporarily( void ); extern void UpdateEnemyUIBar( void ); extern void DisplayHiddenTurnbased( SOLDIERTYPE * pActingSoldier ); @@ -855,6 +860,18 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) // If we are not in an interrupt situation! if ( (( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.uiFlags & INCOMBAT )) && gubOutOfTurnPersons == 0 ) { +#ifdef JA2UB + //JA25 UB + //if this is Morris + if( pSoldier->ubProfile == 75 ) //MORRIS + { + //if we are to say the line if we are hurt the player + if( gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn ) + { + TriggerNPCRecord( 75, 6 ); //MORRIS + } + } +#endif if( ( ( pSoldier->bVisible != -1 && pSoldier->stats.bLife) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) && ( fInValidSoldier == FALSE ) ) { // If we are on a roof, set flag for rendering... @@ -2577,19 +2594,21 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) SendNetData(ALL_NODES); */ - DeductPoints(pSoldier,APBPConstants[AP_RADIO],APBPConstants[BP_RADIO]);// pay for it! + DeductPoints(pSoldier,APBPConstants[AP_RADIO],APBPConstants[BP_RADIO], AFTERACTION_INTERRUPT); // pay for it! + RadioSightings(pSoldier,EVERYBODY,pSoldier->bTeam); // about everybody // action completed immediately, cancel it right away // ATE: Change to an animation! AIDecideRadioAnimation( pSoldier ); - //return(FALSE); // no longer in progress + break; case AI_ACTION_CREATURE_CALL: // creature calling to others - DeductPoints(pSoldier,APBPConstants[AP_RADIO],APBPConstants[BP_RADIO]);// pay for it! + + DeductPoints(pSoldier,APBPConstants[AP_RADIO],APBPConstants[BP_RADIO], AFTERACTION_INTERRUPT); // pay for it! CreatureCall( pSoldier ); - //return( FALSE ); // no longer in progress + break; case AI_ACTION_CHANGE_STANCE: // crouch diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index cc07bf05..8ccc2099 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -1226,12 +1226,15 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to raise weapons, sniper = %d",pSoldier->sniper)); if ( pSoldier->aiData.bOrders == SNIPER && pSoldier->sniper == 0 && ( pSoldier->pathing.bLevel == 1 || Random(100) < 40 ) ) { - if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) + if ( !(WeaponReady(pSoldier)) ) // SANDRO - only call this if we are not in readied position yet { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper is raising weapon, soldier = %d, sniper = %d",pSoldier->ubID,pSoldier->sniper)); - pSoldier->sniper = 1; - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper = %d",pSoldier->sniper)); - return(AI_ACTION_RAISE_GUN); + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) + { + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper is raising weapon, soldier = %d, sniper = %d",pSoldier->ubID,pSoldier->sniper)); + pSoldier->sniper = 1; + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper = %d",pSoldier->sniper)); + return(AI_ACTION_RAISE_GUN); + } } } //else if ( pSoldier->sniper == 1 ) @@ -1242,6 +1245,38 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // return(AI_ACTION_LOWER_GUN); //} + //////////////////////////////////////////////////////////////////////////// + // SANDRO - occasionally, allow regular soldiers to scan around too + if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + if (!(WeaponReady(pSoldier))) + { + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, pSoldier->usAnimState ) <= pSoldier->bActionPoints) + { + iChance = 25; + if ( pSoldier->ubSoldierClass == SOLDIER_CLASS_ELITE_MILITIA || pSoldier->ubSoldierClass == SOLDIER_CLASS_ELITE ) + iChance += 15; + else if ( pSoldier->ubSoldierClass == SOLDIER_CLASS_GREEN_MILITIA || pSoldier->ubSoldierClass == SOLDIER_CLASS_ADMINISTRATOR ) + iChance -= 15; + if ( Random(100) < iChance ) + { + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Soldier deciding to raise weapon with scope")); + return(AI_ACTION_RAISE_GUN); + } + } + } + else // if the weapon is ready already, maybe unready it + { + if ( Random(100) < 40 ) + { + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Soldier deciding to lower weapon")); + return(AI_ACTION_LOWER_GUN); + } + } + } + //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// // LOOK AROUND: determine %chance for man to turn in place @@ -1268,6 +1303,9 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if ( pSoldier->aiData.bOrders == SNIPER && pSoldier->pathing.bLevel == 1) iChance += 35; + if ( WeaponReady(pSoldier) ) // SANDRO - if readied weapon, make him more likelz to turn around + iChance += 30; + if ((INT16)PreRandom(100) < iChance) { // roll random directions (stored in actionData) until different from current @@ -1436,6 +1474,24 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; } } + //////////////////////////////////////////////////////////////////////////// + // SANDRO - allow regular soldiers to raise scoped weapons to see rather away too + if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + if (!(WeaponReady(pSoldier))) + { + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, pSoldier->usAnimState ) <= pSoldier->bActionPoints) + { + if ( Random(100) < 35 ) + { + pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; + } + } + } + } + //////////////////////////////////////////////////////////////////////////// + return(AI_ACTION_CHANGE_FACING); } } @@ -1953,10 +2009,52 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if (!gfTurnBasedAI || GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) <= pSoldier->bActionPoints) { + //////////////////////////////////////////////////////////////////////////// + // SANDRO - raise weapon maybe + if (!(WeaponReady(pSoldier)) && pSoldier->ubDirection == ubNoiseDir) // if we are facing the direction of where the noise came from + { + if (!gfTurnBasedAI || (GetAPsToReadyWeapon( pSoldier, ANIM_CROUCH ) + GetAPsToChangeStance( pSoldier, ANIM_CROUCH )) <= pSoldier->bActionPoints) + { + iChance = 20; + if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + iChance += 30; + } + if ( Random(100) < (UINT32)iChance ) + { + pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; + } + } + } + //////////////////////////////////////////////////////////////////////////// + pSoldier->aiData.usActionData = ANIM_CROUCH; return(AI_ACTION_CHANGE_STANCE); } } + else if (!fCivilian) + { + //////////////////////////////////////////////////////////////////////////// + // SANDRO - raise weapon maybe + if (!(WeaponReady(pSoldier)) && pSoldier->ubDirection == ubNoiseDir) // if we are facing the direction of where the noise came from + { + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, pSoldier->usAnimState ) <= pSoldier->bActionPoints) + { + iChance = 20; + if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + iChance += 30; + } + if ( Random(100) < (UINT32)iChance ) + { + return( AI_ACTION_RAISE_GUN ); + } + } + } + //////////////////////////////////////////////////////////////////////////// + } //////////////////////////////////////////////////////////////////////////// @@ -3351,24 +3449,62 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( pSoldier->aiData.bOrders == SNIPER ) + if ( pSoldier->aiData.bOrders == SNIPER && !(WeaponReady(pSoldier)) ) { if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) { pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; } } + //////////////////////////////////////////////////////////////////////////// + // SANDRO - allow regular soldiers to raise scoped weapons to see rather away too + else if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + if (!(WeaponReady(pSoldier))) + { + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) + { + if ( Random(100) < 35 ) + { + pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; + } + } + } + } + //////////////////////////////////////////////////////////////////////////// return(AI_ACTION_CHANGE_FACING); } } - else if ( pSoldier->ubDirection == ubOpponentDir && pSoldier->aiData.bOrders == SNIPER ) + //////////////////////////////////////////////////////////////////////////// + // SANDRO - allow regular soldiers to raise scoped weapons to see rather away too + else if ( pSoldier->ubDirection == ubOpponentDir && !(WeaponReady(pSoldier))) { - if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, pSoldier->usAnimState ) <= pSoldier->bActionPoints) { - return AI_ACTION_RAISE_GUN; + if ( pSoldier->aiData.bOrders == SNIPER ) + { + return AI_ACTION_RAISE_GUN; + } + else if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + if ( Random(100) < 40 ) + { + return AI_ACTION_RAISE_GUN; + } + } + else + { + if ( Random(100) < 20 ) + { + return AI_ACTION_RAISE_GUN; + } + } } } + //////////////////////////////////////////////////////////////////////////// } } @@ -3514,6 +3650,30 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) sprintf(tempstr,"%s CROUCHES (STATUS RED)",pSoldier->name ); AIPopMessage(tempstr); #endif + + //////////////////////////////////////////////////////////////////////////// + // SANDRO - allow regular soldiers to raise scoped weapons to see rather away too + if (!gfTurnBasedAI || (GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) + GetAPsToChangeStance( pSoldier, ANIM_CROUCH )) <= pSoldier->bActionPoints) + { + // determine direction from this soldier to the closest opponent + ubOpponentDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent)); + + if (!(WeaponReady(pSoldier)) && pSoldier->ubDirection == ubOpponentDir ) + { + iChance = 25; + if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + iChance += 25; + } + if ( Random(100) < (UINT32)iChance ) + { + pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; + } + } + } + //////////////////////////////////////////////////////////////////////////// + pSoldier->aiData.usActionData = ANIM_CROUCH; return(AI_ACTION_CHANGE_STANCE); @@ -3561,8 +3721,11 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionRed: sniper raising gun...")); if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) { - pSoldier->sniper = 1; - return AI_ACTION_RAISE_GUN; + if (!(WeaponReady(pSoldier))) + { + pSoldier->sniper = 1; + return AI_ACTION_RAISE_GUN; + } } } else @@ -3571,6 +3734,27 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) return(DecideActionYellow(pSoldier)); } } + else if (!fCivilian) + { + //////////////////////////////////////////////////////////////////////////// + // SANDRO - raise weapon maybe + if (!(WeaponReady(pSoldier))) // if we are facing the direction of where the noise came from + { + if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, pSoldier->usAnimState ) <= pSoldier->bActionPoints) + { + if ( (UsingNewCTHSystem() == false && IsScoped(&pSoldier->inv[HANDPOS])) || + (UsingNewCTHSystem() == true && NCTHIsScoped(&pSoldier->inv[HANDPOS])) ) + { + if ( Random(100) < 35 ) + { + return( AI_ACTION_RAISE_GUN ); + } + } + } + } + //////////////////////////////////////////////////////////////////////////// + + } //////////////////////////////////////////////////////////////////////////// // DO NOTHING: Not enough points left to move, so save them for next turn @@ -3803,7 +3987,8 @@ INT16 ubMinAPCost; } // offer surrender? - +#ifdef JA2UB +#else if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !( gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER ) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 ) { if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 ) @@ -3818,6 +4003,7 @@ INT16 ubMinAPCost; } } } +#endif //////////////////////////////////////////////////////////////////////////// // SOLDIER CAN ATTACK IF NOT IN WATER/GAS AND NOT DOING SOMETHING TOO FUNKY diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index f89d4dee..c6914b6e 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1986,7 +1986,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) // destroy this item! DebugAI( String( "%d decides he must drop %S first so destroys it", pSoldier->ubID, ItemNames[ pSoldier->inv[HANDPOS].usItem ] ) ); DeleteObj( &(pSoldier->inv[HANDPOS]) ); - DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0 ); + DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0, AFTERACTION_INTERRUPT ); } else { diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index 6483c671..d9b0beff 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -816,6 +816,15 @@ void SoldierTriesToContinueAlongPath(SOLDIERTYPE *pSoldier) return; } + // SANDRO - hack! interrupt issue - we don't want to recalculate our path if no new situation and we are already on move + // i.e. in case we interrupted a soldier who has no idea about us seeing him, he should move along as if nothing is happening + if ( pSoldier->aiData.bNewSituation == NOT_NEW_SITUATION && pSoldier->aiData.bActionInProgress && !TileIsOutOfBounds(pSoldier->pathing.sFinalDestination)) + { + // just set our path to previously decided final destination + NewDest(pSoldier,pSoldier->pathing.sFinalDestination); + return; + } + if (IsActionAffordable(pSoldier)) { if (pSoldier->aiData.bActionInProgress == FALSE) diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index db53f499..dad0dc08 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -52,6 +52,9 @@ #include "GameVersion.h" #endif #include "Soldier Profile.h" + + #include "Encyclopedia.h" + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -160,6 +163,10 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC ) { sprintf( zFileName, "NPCData\\%03d.npc", ubNPC ); } +#ifdef JA2UB +//Ja25: No meanwhiles +#else + // ATE: Put some stuff i here to use a different NPC file if we are in a meanwhile..... if ( AreInMeanwhile( ) ) @@ -177,7 +184,7 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC ) } } - +#endif CHECKN( FileExists( zFileName ) ); hFile = FileOpen( zFileName, FILE_ACCESS_READ, FALSE ); @@ -460,12 +467,14 @@ BOOLEAN RefreshNPCScriptRecord( UINT8 ubNPC, UINT8 ubRecord ) if ( gProfilesIMP[ubLoop].ProfilId == ubLoop || gProfilesAIM[ubLoop].ProfilId == ubLoop || gProfilesMERC[ubLoop].ProfilId == ubLoop ) RefreshNPCScriptRecord( ubLoop, ubRecord ); } - +#ifdef JA2UB +//no UB +#else //for ( ubLoop = GASTON; ubLoop < NUM_PROFILES; ubLoop++ ) // need more finesse here //{ // RefreshNPCScriptRecord( ubLoop, ubRecord ); //} - +#endif //new profiles by Jazz //for ( ubLoop = FIRST_RPC; ubLoop < FIRST_NPC; ubLoop++ ) for ( ubLoop = 0; ubLoop < NUM_PROFILES; ubLoop++ ) @@ -1852,6 +1861,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData if (zHiddenNames[ubNPC].Hidden == TRUE) { zHiddenNames[ubNPC].Hidden = FALSE; + gEncyclopediaProfilesData[ubNPC].Hidden = TRUE; //encyclopedia } @@ -3270,7 +3280,11 @@ BOOLEAN LoadNPCInfoFromSavedGameFile( HWFILE hFile, UINT32 uiSaveGameVersion ) if ( uiSaveGameVersion < 92 ) { RefreshNPCScriptRecord( MATT, 14 ); +#ifdef JA2UB +//no Ub +#else RefreshNPCScriptRecord( AUNTIE, 8 ); +#endif } if ( uiSaveGameVersion < 93 ) { @@ -3823,3 +3837,15 @@ INT8 ConsiderCivilianQuotes( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, BOO return( -1 ); } + +#ifdef JA2UB +//UB + +BOOLEAN HasNpcSaidQuoteBefore( UINT8 ubNPC, UINT8 ubRecord ) +{ + if( CHECK_FLAG( gpNPCQuoteInfoArray[ ubNPC ][ ubRecord ].fFlags, QUOTE_FLAG_SAID ) ) + return( TRUE ); + else + return( FALSE ); +} +#endif diff --git a/TacticalAI/NPC.h b/TacticalAI/NPC.h index 1bc365fc..e4d7399f 100644 --- a/TacticalAI/NPC.h +++ b/TacticalAI/NPC.h @@ -257,4 +257,9 @@ BOOLEAN NPCHasUnusedHostileRecord( UINT8 ubNPC, UINT8 ubApproach ); void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ); -#endif \ No newline at end of file +#ifdef JA2UB +//UB +extern BOOLEAN HasNpcSaidQuoteBefore( UINT8 ubNPC, UINT8 ubRecord ); +#endif + +#endif diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 82066367..42315c4a 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -74,11 +74,26 @@ #include "Soldier Macros.h" #include "connect.h" #include "debug control.h" + +#include "LuaInitNPCs.h" +#include "Luaglobal.h" + + +#ifdef JA2UB +#include "interface Dialogue.h" + +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "Dialogue Control.h" +#include "ub_config.h" +#endif + + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; - +BOOLEAN HookerInRoom( UINT8 ubRoom ); // MODULE FOR EXPLOSIONS @@ -93,6 +108,10 @@ extern void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ); extern void RecompileLocalMovementCostsForWall( INT32 sGridNo, UINT8 ubOrientation ); void FatigueCharacter( SOLDIERTYPE *pSoldier ); +#ifdef JA2UB +void HandleSeeingFortifiedDoor( UINT32 sGridNo );//Ja25 UB +#endif + #define NO_ALT_SOUND -1 EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = @@ -204,6 +223,16 @@ void RecountExplosions( void ); void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ); void HandleBuldingDestruction( INT32 sGridNo, UINT8 ubOwner ); +#ifdef JA2UB +//JA25 UB +void HavePersonAtGridnoStop( UINT32 sGridNo ); +BOOLEAN ShouldThePlayerStopWhenWalkingOnBiggensActionItem( UINT8 ubRecordNum ); +void HandleDestructionOfPowerGenFan(); +BOOLEAN IsFanGraphicInSectorAtThisGridNo( UINT32 sGridNo ); +void HandleExplosionsInTunnelSector( UINT32 sGridNo ); +void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo ); +void HandleSeeingPowerGenFan( UINT32 sGridNo ); +#endif INT32 GetFreeExplosion( void ) { @@ -615,7 +644,20 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe ChangeO3SectorStatue( TRUE ); return( TRUE ); } +#ifdef JA2UB + //JA25 UB + //should we replace the mine entrance graphic + if( IsMineEntranceInSectorI13AtThisGridNo( sGridNo ) && ubOwner == NOBODY ) + { + //Yup, replace it + ReplaceMineEntranceGraphicWithCollapsedEntrance(); + } + //ja25 ub + //Handle Explosions in the tunnel sectors + HandleExplosionsInTunnelSector( sGridNo ); +#endif + // Get xy sX = CenterX( sGridNo ); sY = CenterY( sGridNo ); @@ -647,7 +689,14 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe if ( ( bDamageReturnVal = DamageStructure( pCurrent, (UINT8)sWoundAmt, STRUCTURE_DAMAGE_EXPLOSION, sGridNo, sX, sY, NOBODY ) ) != 0 ) { fContinue = FALSE; - +#ifdef JA2UB + //Ja25 ub + //are we exploding the Fan in the power gen facility + if( IsFanGraphicInSectorAtThisGridNo( sGridNo ) ) + { + HandleDestructionOfPowerGenFan(); + } +#endif pBase = FindBaseStructure( pCurrent ); sBaseGridNo = pBase->sGridNo; @@ -3035,6 +3084,17 @@ BOOLEAN HookerInRoom( UINT8 ubRoom ) void PerformItemAction( INT32 sGridNo, OBJECTTYPE * pObj ) { + +#ifdef LUA_EXPLOSION_CONTROL + + for (UINT32 i = ACTION_ITEM_OPEN_DOOR; i <= ACTION_ITEM_NEW; i++ ) + { + if ( (*pObj)[0]->data.misc.bActionValue == i ) + LetLuaPerformItemAction( i, sGridNo, 0 ); + } + +#else + STRUCTURE * pStructure; switch( (*pObj)[0]->data.misc.bActionValue ) @@ -3419,6 +3479,53 @@ void PerformItemAction( INT32 sGridNo, OBJECTTYPE * pObj ) PlayJA2Sample( KLAXON_ALARM, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 5, SoundDir( sGridNo ) ); CallEldinTo( sGridNo ); break; +#ifdef JA2UB + case ACTION_ITEM_BIGGENS_BOMBS: + + if( ShouldThePlayerStopWhenWalkingOnBiggensActionItem( 17 ) ) + { + HavePersonAtGridnoStop( sGridNo ); + + //Make Biggens run for cover and then detonate the explosives + TriggerNPCRecord( 61 , 17 ); //BIGGENS + } + + break; + case ACTION_ITEM_BIGGENS_WARNING: + + if( ShouldThePlayerStopWhenWalkingOnBiggensActionItem( 16 ) ) + { + HavePersonAtGridnoStop( sGridNo ); + + //Have Biggens spit out a warning about the bombs + TriggerNPCRecord( 61, 16 ); //BIGGENS + } + + break; + + case ACTION_ITEM_SEE_FORTIFIED_DOOR: + HandleSeeingFortifiedDoor( sGridNo ); + break; + + case ACTION_ITEM_OPEN_FORTIFED_DOOR: + HandleSwitchToOpenFortifiedDoor( sGridNo ); + break; + + case ACTION_ITEM_SEE_POWER_GEN_FAN: + + //if the player is in the power plant + if( gWorldSectorX == 13 && gWorldSectorY == 10 && gbWorldSectorZ == 0 ) + { + HandleSeeingPowerGenFan( sGridNo ); + } + else if( gWorldSectorX == 15 && gWorldSectorY == 12 && gbWorldSectorZ == 3 ) + { + //The player is hitting the switch to launch the missles + HandlePlayerHittingSwitchToLaunchMissles(); + } + + break; +#endif default: // error message here #ifdef JA2BETAVERSION @@ -3426,6 +3533,10 @@ void PerformItemAction( INT32 sGridNo, OBJECTTYPE * pObj ) #endif break; } + +#endif + + } void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemoteClient ) @@ -4237,3 +4348,284 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL return ( FIRE_WEAPON_BLINDED_AND_DEAFENED ); } + +#ifdef JA2UB + +//-- UB + +void HavePersonAtGridnoStop( UINT32 sGridNo ) +{ + UINT8 ubID; + + //Sewe if there is a person at the gridno + ubID = WhoIsThere2( sGridNo, 0 ); + + //is it a valid person + if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) ) + { + SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; + + //Stop the merc + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); + } +} + +//JA25 UB +BOOLEAN ShouldThePlayerStopWhenWalkingOnBiggensActionItem( UINT8 ubRecordNum ) +{ + SOLDIERTYPE *pSoldier=NULL; + + pSoldier = FindSoldierByProfileID( 61, TRUE ); //BIGGENS + + //if biggens hasnt said the quote before, or is on the players team + if( HasNpcSaidQuoteBefore( 61, ubRecordNum ) || ( pSoldier != NULL || gMercProfiles[ 61 ].bLife <= 0 ) ) //BIGGENS + { + return( FALSE ); + } + else + { + return( TRUE ); + } +} + +// This function checks if we should replace the fan graphic +BOOLEAN IsFanGraphicInSectorAtThisGridNo( UINT32 sGridNo ) +{ + // First check current sector...... + if( gWorldSectorX == 13 && gWorldSectorY == MAP_ROW_J && gbWorldSectorZ == 0 ) + { + //if this is the right gridno + /*if( sGridNo == 10978 || + sGridNo == 10979 || + sGridNo == 10980 || + sGridNo == 10818 || + sGridNo == 10819 || + sGridNo == 10820 || + sGridNo == 10658 || + sGridNo == 10659 || + sGridNo == 10660 ) + */ + if( sGridNo == gGameUBOptions.FanGridNo[0] || + sGridNo == gGameUBOptions.FanGridNo[1] || + sGridNo == gGameUBOptions.FanGridNo[2] || + sGridNo == gGameUBOptions.FanGridNo[3] || + sGridNo == gGameUBOptions.FanGridNo[4] || + sGridNo == gGameUBOptions.FanGridNo[5] || + sGridNo == gGameUBOptions.FanGridNo[6] || + sGridNo == gGameUBOptions.FanGridNo[7] || + sGridNo == gGameUBOptions.FanGridNo[8] ) + { + return( TRUE ); + } + } + + return( FALSE ); +} + +void HandleDestructionOfPowerGenFan() +{ + UINT8 ubShadeLevel=0; + INT8 bID; + + //if we have already destroyed the fan + if( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH ) + { + //leave + return; + } + + //if we have already been in here + if( gJa25SaveStruct.ubStateOfFanInPowerGenSector == PGF__BLOWN_UP ) + { + return; + } + + //Remeber that the player blew up the fan + gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__BLOWN_UP; + + //Remeber how the player got through + HandleHowPlayerGotThroughFan(); + + //Since the player is making LOTS of noise, add more enemies to the tunnel sector +// AddEnemiesToJa25TunnelMaps(); + + if ( gGameUBOptions.HandleAddingEnemiesToTunnelMaps == TRUE ) + { + HandleAddingEnemiesToTunnelMaps(); + } + + //Make sure to apply these changes to the map + ApplyMapChangesToMapTempFile( TRUE ); + + //Add an exit grid to the map + AddExitGridForFanToPowerGenSector(); + + //done with the changes + ApplyMapChangesToMapTempFile( FALSE ); + + //Stop the fan sound + HandleRemovingPowerGenFanSound(); + + + // + // Have a qualified merc say a quote + // + //Get a random qualified merc to say the quote + bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + if( bID != -1 ) + { + DelayedMercQuote( Menptr[ bID ].ubProfile, QUOTE_ACCEPT_CONTRACT_RENEWAL, GetWorldTotalSeconds() + 2 ); + } +} + +void HandleExplosionsInTunnelSector( UINT32 sGridNo ) +{ + //if this isnt the tunnel sectors + if( !( gWorldSectorX == 14 && ( gWorldSectorY == MAP_ROW_J || gWorldSectorY == MAP_ROW_K ) && gbWorldSectorZ == 1 ) ) + { + //get the fuck out... + return; + } + + //Since the enemy will hear explosions in the tunnel, remember the player made a noise + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE; +} + + +void HandleSeeingFortifiedDoor( UINT32 sGridNo ) +{ + INT32 sID=0; + + //if this isnt the First level of the complex + if( !( gWorldSectorX == 15 && gWorldSectorY == MAP_ROW_K && gbWorldSectorZ == 1 ) ) + { + //get the fuck out... + return; + } + + //if the player has already seen it + if( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__PLAYER_HAS_SEEN_FORTIFIED_DOOR ) + { + //get out + return; + } + + //Remeber that we have said the quote + gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__PLAYER_HAS_SEEN_FORTIFIED_DOOR; + + //find out whos is the one walking across the trap + sID = WhoIsThere2( sGridNo, 0 ); + if( sID != NOBODY && IsSoldierQualifiedMerc( &Menptr[ sID ] ) ) + { + } + else + { + //Get a random merc to say quote + sID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + } + + if( sID != -1 ) + { + //say the quote + TacticalCharacterDialogue( &Menptr[ sID ], QUOTE_LENGTH_OF_CONTRACT ); + } +} + +void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo ) +{ + INT8 bID; + + //if the door is already opened + if( gJa25SaveStruct.ubStatusOfFortifiedDoor == FD__OPEN ) + { + return; + } + + //remeber that the switch to open the forified door on level 1, has been pulled + gJa25SaveStruct.ubStatusOfFortifiedDoor = FD__OPEN; + + bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + + if( bID != -1 ) + { + TacticalCharacterDialogue( &Menptr[ bID ], QUOTE_COMMENT_BEFORE_HANG_UP ); + } +} + +void HandleSeeingPowerGenFan( UINT32 sGridNo ) +{ +// INT8 bID; + UINT8 ubPerson; + BOOLEAN fFanIsStopped; + BOOLEAN fFanHasBeenStopped; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pOtherSoldier; + INT32 cnt; + BOOLEAN fSaidQuote=FALSE; + + //if the fan has already been seen + if( IsJa25GeneralFlagSet( JA_GF__PLAYER_SEEN_FAN_BEFORE ) ) + { + //get out + return; + } + + fFanIsStopped = ( gJa25SaveStruct.ubStateOfFanInPowerGenSector == PGF__STOPPED ); + fFanHasBeenStopped = IsJa25GeneralFlagSet( JA_GF__POWER_GEN_FAN_HAS_BEEN_STOPPED ); + + //Get the person who is at the gridno + ubPerson = WhoIsThere2( sGridNo, 0 ); + + if( ubPerson != NOBODY ) + { + pSoldier = &Menptr[ ubPerson ]; + + //if the fan is stopped And is this merc is a qualified merc but Not a power gen fan qualified merc? + if( IsSoldierQualifiedMerc( pSoldier ) && fFanIsStopped ) + { + //Have the merc say the quote + TacticalCharacterDialogue( pSoldier, QUOTE_HATE_MERC_2_ON_TEAM_WONT_RENEW ); + fSaidQuote = TRUE; + } + else if( IsSoldierQualifiedMercForSeeingPowerGenFan( pSoldier ) ) + { + //Have the merc say the quote + TacticalCharacterDialogue( pSoldier, QUOTE_HATE_MERC_2_ON_TEAM_WONT_RENEW ); + fSaidQuote = TRUE; + } + else + { + //see if there is another merc that is close by to say the quote + cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( pOtherSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pOtherSoldier++) + { + //if the soldier is in the sector + if( pOtherSoldier->bActive && pOtherSoldier->bInSector && ( pOtherSoldier->stats.bLife >= CONSCIOUSNESS ) ) + { + INT16 sDistanceAway; + + // if the soldier isnt that far away AND he is qualified merc + sDistanceAway = PythSpacesAway( pSoldier->sGridNo, pOtherSoldier->sGridNo ); + + if( sDistanceAway <= 5 && ( !InARoom( pOtherSoldier->sGridNo, NULL ) || pOtherSoldier->pathing.bLevel ) && + ( ( IsSoldierQualifiedMerc( pOtherSoldier ) && fFanIsStopped ) || + ( IsSoldierQualifiedMercForSeeingPowerGenFan( pOtherSoldier ) ) ) ) + { + //Have the merc say the quote + TacticalCharacterDialogue( pOtherSoldier, QUOTE_HATE_MERC_2_ON_TEAM_WONT_RENEW ); + fSaidQuote = TRUE; + break; + } + } + } + } + } + + //if the quote was said, dont say it again + if( fSaidQuote ) + { + //remeber that the fan has been seen + SetJa25GeneralFlag( JA_GF__PLAYER_SEEN_FAN_BEFORE ); + } +} +#endif diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index 79b205b1..e2971830 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -141,4 +141,15 @@ extern void TogglePressureActionItemsInGridNo( INT32 sGridNo ); extern BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT32 sGridNo ); extern BOOLEAN HookerInRoom( UINT8 ubRoom ); -#endif \ No newline at end of file + +#ifdef JA2UB +extern void HavePersonAtGridnoStop( UINT32 sGridNo ); +extern BOOLEAN ShouldThePlayerStopWhenWalkingOnBiggensActionItem( UINT8 ubRecordNum ); +extern void HandleDestructionOfPowerGenFan(); +extern BOOLEAN IsFanGraphicInSectorAtThisGridNo( UINT32 sGridNo ); +extern void HandleExplosionsInTunnelSector( UINT32 sGridNo ); +extern void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo ); +extern void HandleSeeingPowerGenFan( UINT32 sGridNo ); +extern void HandleSeeingFortifiedDoor( UINT32 sGridNo );//Ja25 UB +#endif +#endif diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index 8d3012b1..d2682d56 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -367,13 +367,15 @@ void RenderRadarScreen( ) RenderSquadList( ); return; } - +#ifdef JA2UB +//JA25 No meanwhiles +#else if( AreInMeanwhile( ) == TRUE ) { // in a meanwhile, don't render any map fImageLoaded = FALSE; } - +#endif if ( fInterfacePanelDirty == DIRTYLEVEL2 && fImageLoaded ) { // Set to default diff --git a/TileEngine/SaveLoadMap.cpp b/TileEngine/SaveLoadMap.cpp index a2e774a9..ea8ded45 100644 --- a/TileEngine/SaveLoadMap.cpp +++ b/TileEngine/SaveLoadMap.cpp @@ -32,8 +32,10 @@ BOOLEAN gfApplyChangesToTempFile = FALSE; // 3200 bytes * 8 bits = 25600 map elements UINT8 *gpRevealedMap; - - +#ifdef JA2UB +//Ja25 +void AddRemoveExitGridToUnloadedMapTempFile( UINT32 usGridNo, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +#endif void RemoveSavedStructFromMap( INT32 uiMapIndex, UINT16 usIndex ); void AddObjectFromMapTempFileToMap( INT32 uiMapIndex, UINT16 usIndex ); @@ -487,7 +489,15 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) uiNumberOfElementsSavedBackToFile++; } break; +#ifdef JA2UB + case SLM_REMOVE_EXIT_GRID: + //Remove the exit grid + RemoveExitGridFromWorld( pMap->usGridNo ); + // Save this struct back to the temp file + SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + break; +#endif default: AssertMsg( 0, "ERROR! Map Type not in switch when loading map changes from temp file"); break; @@ -1406,4 +1416,27 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u return( TRUE ); } +#ifdef JA2UB +//JA25 +void AddRemoveExitGridToUnloadedMapTempFile( UINT32 usGridNo, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) +{ + MODIFY_MAP Map; + if( !gfApplyChangesToTempFile ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"Called AddRemoveExitGridToUnloadedMapTempFile() without calling ApplyMapChangesToMapTempFile()" ); + return; + } + + if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) + return; + + memset( &Map, 0, sizeof( MODIFY_MAP ) ); + + Map.usGridNo = usGridNo; + + Map.ubType = SLM_REMOVE_EXIT_GRID; + + SaveModifiedMapStructToMapTempFile( &Map, sSectorX, sSectorY, ubSectorZ ); +} +#endif diff --git a/TileEngine/SaveLoadMap.h b/TileEngine/SaveLoadMap.h index 7e648c38..c8062b7e 100644 --- a/TileEngine/SaveLoadMap.h +++ b/TileEngine/SaveLoadMap.h @@ -43,6 +43,9 @@ enum // Modify window graphic & structure SLM_WINDOW_HIT, +#ifdef JA2UB + SLM_REMOVE_EXIT_GRID, +#endif }; typedef struct @@ -111,5 +114,9 @@ void AddWindowHitToMapTempFile( INT32 uiMapIndex ); BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT32 usGridNo, BOOLEAN fChangeToOpen ); +#ifdef JA2UB +//ja25 ub +void AddRemoveExitGridToUnloadedMapTempFile( UINT32 usGridNo, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +#endif #endif diff --git a/TileEngine/World Tileset Enums.h b/TileEngine/World Tileset Enums.h index 03f492e2..a9039b98 100644 --- a/TileEngine/World Tileset Enums.h +++ b/TileEngine/World Tileset Enums.h @@ -4,6 +4,89 @@ // Snap: NUM_TILESETS no longer limits the number of tilesets. // See gubNumSets in WorldDat.cpp +#ifdef JA2UBMAPS +enum +{ + TLS_GENERIC_1, + TLS_CAVES_1, + TLS_DESERT_1, + TLS_LUSH_1, + TLS_TROPICAL_1, + TLS_MOUNTAIN_1, + TLS_COASTAL_1, //7 + TLS_SWAMP_1, + TLS_FARM_1, + TLS_OMERTA_1, + + TLS_GENERIC_2, + TLS_FARM_2, + TLS_PRISON, + TLS_HOSPITAL, + TLS_TEMP_, + TLS_BURNT_TREES, + TLS_LAWLESS_1, + TLS_AIRSTRIP, + TLS_LAWLESS_2, + TLS_DEAD_AIRSTRIP, + + TEMP_1, + TEMP_2, + TEMP_3, + TEMP_4, + TEMP_5, + TEMP_6, + TEMP_7, + TEMP_8, + TEMP_9, + TEMP_10, + + TEMP_11, + TEMP_12, + TEMP_13, + TEMP_14, + TEMP_15, + TEMP_16, + TEMP_17, + TEMP_18, + TEMP_19, + TEMP_20, + + TEMP_21, + TEMP_22, + TEMP_23, + TEMP_24, + TEMP_25, + TEMP_26, + TEMP_27, + TEMP_28, + TEMP_29, + TEMP_30, + + DEFAULT_JA25_TILESET, + TEMP_32, + TEMP_33, + TEMP_34, + TEMP_35, + TEMP_36, + TEMP_37, + TEMP_38, + TEMP_39, + TEMP_40, + + TEMP_41, + TEMP_42, + TEMP_43, + TEMP_44, + TEMP_45, + TEMP_46, + TEMP_47, + TEMP_48, + TEMP_49, + TEMP_50, + + NUM_TILESETS +}; +#else enum { TLS_GENERIC_1, // 0, JA2 default @@ -85,5 +168,6 @@ enum NUM_TILESETS // 70 }; +#endif #endif \ No newline at end of file diff --git a/TileEngine/WorldDat.cpp b/TileEngine/WorldDat.cpp index 307ab1f6..a058b67f 100644 --- a/TileEngine/WorldDat.cpp +++ b/TileEngine/WorldDat.cpp @@ -117,6 +117,20 @@ void InitEngineTilesets( ) FileClose( hfile ); } + #ifdef JA2UBMAPS + gTilesets[ TLS_CAVES_1 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetTwoTerrainValues; + gTilesets[ TLS_AIRSTRIP ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TLS_DEAD_AIRSTRIP ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_14 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_18 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_19 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_26 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_27 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_28 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TEMP_29 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; + gTilesets[ TLS_TROPICAL_1 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetFourTerrainValues; + gTilesets[ TEMP_20 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetFourTerrainValues; + #else // SET CALLBACK FUNTIONS!!!!!!!!!!!!! gTilesets[ TLS_CAVES_1 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetTwoTerrainValues; gTilesets[ TLS_AIRSTRIP ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues; @@ -131,6 +145,7 @@ void InitEngineTilesets( ) gTilesets[ TLS_TROPICAL_1 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetFourTerrainValues; gTilesets[ TLS_DESERT_SAM ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetFourTerrainValues; + #endif } #ifdef USE_VFS diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 98f1ca65..3fa6cf8b 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -140,10 +140,27 @@ void InitNewOverheadDB( UINT8 ubTilesetID ) if ( hVObject == NULL ) { - // TRY loading from default directory - FilenameForBPP( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[ uiLoop ], cFileBPP); - // Adjust for tileset position - sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP ); + #ifdef JA2UBMAPS + if( ubTilesetID < DEFAULT_JA25_TILESET ) + { + // TRY loading from default directory + FilenameForBPP( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[ uiLoop ], cFileBPP); + // Adjust for tileset position + sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP ); + } + else + { + // TRY loading from default directory + FilenameForBPP( gTilesets[ DEFAULT_JA25_TILESET ].TileSurfaceFilenames[ uiLoop ], cFileBPP); + // Adjust for tileset position + sprintf( cAdjustedFile, "TILESETS\\50\\T\\%s", cFileBPP ); + } + #else + // TRY loading from default directory + FilenameForBPP( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[ uiLoop ], cFileBPP); + // Adjust for tileset position + sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP ); + #endif // LOAD ONE WE KNOW ABOUT! VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 809bcc5d..edfce86a 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1330,6 +1330,13 @@ STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT32 sGridNo, STRUCTURE return( InternalSwapStructureForPartner( sGridNo, pStructure, TRUE, TRUE ) ); } +#ifdef JA2UB +STRUCTURE * SwapStructureForPartnerForcingGraphicalChange( INT32 sGridNo, STRUCTURE * pStructure ) +{ + return( InternalSwapStructureForPartner( sGridNo, pStructure, FALSE, TRUE ) ); +} +#endif + STRUCTURE * FindStructure( INT32 sGridNo, UINT32 fFlags ) { // finds a structure that matches any of the given flags diff --git a/TileEngine/structure.h b/TileEngine/structure.h index 44516de8..68f16f75 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -56,6 +56,10 @@ STRUCTURE * FindNonBaseStructure( INT32 sGridNo, STRUCTURE * pStructure ); STRUCTURE * SwapStructureForPartner( INT32 sGridNo, STRUCTURE * pStructure ); STRUCTURE * SwapStructureForPartnerWithoutTriggeringSwitches( INT32 sGridNo, STRUCTURE * pStructure ); STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT32 sGridNo, STRUCTURE * pStructure ); + +#ifdef JA2UB +STRUCTURE * SwapStructureForPartnerForcingGraphicalChange( INT32 sGridNo, STRUCTURE * pStructure ); +#endif // // functions useful for AI that return info about heights // diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 59601b9c..6278c5fa 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -149,6 +149,10 @@ void DestroyTileSurfaces( void ); void ProcessTilesetNamesForBPP(void); BOOLEAN IsRoofVisibleForWireframe( INT32 sMapPos ); +#ifdef JA2UBMAPS +INT32 giOldTilesetUsed; +#endif + INT8 IsHiddenTileMarkerThere( INT32 sGridNo ); extern void SetInterfaceHeightLevel( ); @@ -283,6 +287,10 @@ BOOLEAN InitializeWorld( ) gTileDatabaseSize = 0; gSurfaceMemUsage = 0; giCurrentTilesetID = -1; + + #ifdef JA2UBMAPS + giOldTilesetUsed = -1; + #endif // DB Adds the _8 to the names if we're in 8 bit mode. //ProcessTilesetNamesForBPP(); @@ -407,7 +415,22 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) SetRelativeStartAndEndPercentage( 0, 1, 35, L"Tile Surfaces" ); for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++) { - + + + // ATE: Set flag indicating to use another default + // tileset + #ifdef JA2UBMAPS + // 1 ) If we are going from JA2 to JA25 + if ( giOldTilesetUsed < DEFAULT_JA25_TILESET && ubTilesetID >= DEFAULT_JA25_TILESET ) + { + gbDefaultSurfaceUsed[ uiLoop ] = FALSE; + } + // 2) From JA25 to JA2 + if ( ( giOldTilesetUsed >= DEFAULT_JA25_TILESET || giOldTilesetUsed == -1 ) && ubTilesetID < DEFAULT_JA25_TILESET ) + { + gbDefaultSurfaceUsed[ uiLoop ] = FALSE; + } + #endif uiPercentage = (uiLoop * 100) / (NUMBEROFTILETYPES-1); RenderProgressBar( 0, uiPercentage ); @@ -472,12 +495,34 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) // ATE: If here, don't load default surface if already loaded... if ( !gbDefaultSurfaceUsed[ uiLoop ] ) { + + #ifdef JA2UBMAPS + if( ubTilesetID < DEFAULT_JA25_TILESET && uiLoop != SPECIALTILES ) + { + strcpy( TileSurfaceFilenames[uiLoop], gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[uiLoop] );//(char *)(ppTileSurfaceFilenames + (65 * uiLoop)) ); + if (AddTileSurface( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[uiLoop], uiLoop, TLS_GENERIC_1, FALSE ) == FALSE) + { + DestroyTileSurfaces( ); + return( FALSE ); + } + } + else + { + strcpy( TileSurfaceFilenames[uiLoop], gTilesets[ DEFAULT_JA25_TILESET ].TileSurfaceFilenames[uiLoop] );//(char *)(ppTileSurfaceFilenames + (65 * uiLoop)) ); + if (AddTileSurface( gTilesets[ DEFAULT_JA25_TILESET ].TileSurfaceFilenames[uiLoop], uiLoop, DEFAULT_JA25_TILESET, FALSE ) == FALSE) + { + DestroyTileSurfaces( ); + return( FALSE ); + } + } + #else strcpy( TileSurfaceFilenames[uiLoop], gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[uiLoop] );//(ppTileSurfaceFilenames + (65 * uiLoop)) ); if (AddTileSurface( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[uiLoop], uiLoop, TLS_GENERIC_1, FALSE ) == FALSE) { DestroyTileSurfaces( ); return( FALSE ); } + #endif } else { @@ -533,6 +578,18 @@ BOOLEAN AddTileSurface( STR8 cFilename, UINT32 ubType, UINT8 ubTilesetID, BOOLE gTileSurfaceArray[ ubType ] = TileSurf; // OK, if we were not the default tileset, set value indicating that! + + #ifdef JA2UBMAPS + // OK, if we were not the default tileset, set value indicating that! + if ( ubTilesetID != TLS_GENERIC_1 && ubTilesetID != 0 ) + { + gbDefaultSurfaceUsed[ ubType ] = FALSE; + } + else + { + gbDefaultSurfaceUsed[ ubType ] = TRUE; + } + #else if ( ubTilesetID != TLS_GENERIC_1 ) { gbDefaultSurfaceUsed[ ubType ] = FALSE; @@ -541,7 +598,8 @@ BOOLEAN AddTileSurface( STR8 cFilename, UINT32 ubType, UINT8 ubTilesetID, BOOLE { gbDefaultSurfaceUsed[ ubType ] = TRUE; } - + #endif + gbNewTileSurfaceLoaded[ ubType ] = TRUE; return( TRUE ); @@ -710,7 +768,12 @@ void CompileWorldTerrainIDs( void ) pNode = gpWorldLevelData[ sGridNo ].pObjectHead; // ATE: CRAPOLA! Special case stuff here for the friggen pool since art was fu*ked up + + #ifdef JA2UBMAPS + if ( giCurrentTilesetID == TEMP_19 ) + #else if ( giCurrentTilesetID == TLS_BALIME_MUSEUM ) + #endif { // Get ID if ( pNode != NULL ) @@ -3276,10 +3339,12 @@ void TrashWorld( void ) //Remove the schedules DestroyAllSchedules(); - +#ifdef JA2UB +//Ja25 no meanwhiles +#else // on trash world sheck if we have to set up the first meanwhile HandleFirstMeanWhileSetUpWithTrashWorld( ); - +#endif // Create world randomly from tiles for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) { @@ -3480,6 +3545,10 @@ void TrashMapTile(INT16 MapTile) BOOLEAN LoadMapTileset( INT32 iTilesetID ) { +#ifdef JA2UBMAPS +giOldTilesetUsed = giCurrentTilesetID; +#endif + if ( iTilesetID >= gubNumSets ) { return( FALSE ); diff --git a/Utils/Text.h b/Utils/Text.h index 2b7a9dc6..fc654f55 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -4,9 +4,64 @@ #include "items.h" #include "types.h" #include "mapscreen.h" +#include "XML_Language.h" + +#include "Encyclopedia.h" #define STRING_LENGTH 255 +enum +{ + //TCTL_MSG__RANGE_TO_TARGET, + TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, + TACT_MSG__CANNOT_AFFORD_MERC, + TACT_MSG__AIMMEMBER_FEE_TEXT, + TACT_MSG__AIMMEMBER_ONE_TIME_FEE, + TACT_MSG__FEE, + TACT_MSG__SOMEONE_ELSE_IN_SECTOR, + //TCTL_MSG__GUN_RANGE_AND_CTH, + TCTL_MSG__DISPLAY_COVER, + TCTL_MSG__LOS, + TCTL_MSG__INVALID_DROPOFF_SECTOR, + TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, + TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, + TCTL_MSG__END_GAME_POPUP_TXT_1, + TCTL_MSG__END_GAME_POPUP_TXT_2, + TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, + TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, + TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, + TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, + TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, + TCTL_MSG__CAMPAIGN_LABEL, + TCTL_MSG__NEW_CAMPAIGN_CONFIRM, + TCTL_MSG__CANT_EDIT_DEFAULT, + +}; +//Ja25 UB +//enums used for zNewLaptopMessages +enum +{ + LPTP_MSG__MERC_SPECIAL_OFFER, + LPTP_MSG__TEMP_UNAVAILABLE, + LPTP_MSG__PREVIEW_TEXT, +}; + +extern CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS]; + +//Encyclopedia +extern STR16 pMenuStrings[]; +extern STR16 pLocationPageText[]; +extern STR16 pSectorPageText[]; +extern STR16 pEncyclopediaHelpText[]; +extern STR16 pEncyclopediaTypeText[]; +extern STR16 pEncyclopediaSkrotyText[]; +extern STR16 pEncyclopediaShortCharacterText[]; +extern STR16 pEncyclopediaHelpCharacterText[]; +extern STR16 pEncyclopediaShortInventoryText[]; +extern STR16 BoxFilter[]; +extern STR16 pOtherButtonsText[]; +extern STR16 pOtherButtonsHelpText[]; + //Editor //Editor Taskbar Creation.cpp extern STR16 iEditorItemStatsButtonsText[]; @@ -52,7 +107,7 @@ extern STR16 pWaitForHelpScreenResponseText[]; extern STR16 pAutoLoadMapText[]; extern STR16 pShowHighGroundText[]; //Item Statistics.cpp -extern CHAR16 gszActionItemDesc[ 34 ][ 30 ]; // NUM_ACTIONITEMS = 34 +//extern CHAR16 gszActionItemDesc[ 34 ][ 30 ]; // NUM_ACTIONITEMS = 34 extern STR16 pUpdateItemStatsPanelText[]; extern STR16 pSetupGameTypeFlagsText[]; extern STR16 pSetupGunGUIText[]; @@ -76,6 +131,8 @@ extern STR16 pDisplaySelectionWindowGraphicalInformationText[]; extern STR16 wszSelType[6]; //-- +extern STR16 gzNewLaptopMessages[]; +extern STR16 zNewTacticalMessages[]; extern CHAR16 gszAimPages[ 6 ][ 20 ]; extern CHAR16 zGrod[][500]; extern STR16 pCreditsJA2113[]; @@ -361,12 +418,26 @@ enum MSG_NORMAL_TURN_MODE, MSG_FTM_EXIT_COMBAT, MSG_FTM_ENTER_COMBAT, -#ifdef JA2BETAVERSION MSG_END_TURN_AUTO_SAVE, -#endif - MSG_MPSAVEDIRECTORY,//84 + MSG_MPSAVEDIRECTORY,//88 MSG_CLIENT, - MSG_NAS_AND_OIV_INCOMPATIBLE, + MSG_NAS_AND_OIV_INCOMPATIBLE, // 90 + + MSG_SAVE_AUTOSAVE_TEXT, // 91 + MSG_SAVE_AUTOSAVE_TEXT_INFO, // 92 + MSG_SAVE_AUTOSAVE_EMPTY_TEXT, // 93 + MSG_SAVE_AUTOSAVE_FILENAME, // 94 + MSG_SAVE_END_TURN_SAVE_TEXT, // 95 + MSG_SAVE_AUTOSAVE_SAVING_TEXT, // 96 + MSG_SAVE_END_TURN_SAVE_SAVING_TEXT, // 97 + MSG_SAVE_AUTOSAVE_ENDTURN_EMPTY_TEXT, //98 + MSG_SAVE_AUTOSAVE_ENDTURN_TEXT_INFO, //99 + MSG_SAVE_QUICKSAVE_SLOT, // 100 + MSG_SAVE_AUTOSAVE_SLOT, // 101 + MSG_SAVE_AUTOSAVE_ENDTURN_SLOT, // 102 + MSG_SAVE_NORMAL_SLOT, // 103 + + TEXT_NUM_MSG, }; extern STR16 pMessageStrings[]; @@ -565,6 +636,7 @@ extern STR16 szUDBAdvStatsExplanationsTooltipTextForWeapons[ 48 ]; // Headrock: End Externs extern STR16 sKeyDescriptionStrings[2]; extern CHAR16 zHealthStr[][13]; +extern STR16 gzHiddenHitCountStr[1]; extern STR16 zVehicleName[ 6 ]; enum @@ -1319,6 +1391,7 @@ extern STR16 zMarksMapScreenText[]; //Weapon Name and Description size +#define ITEMSTRINGFILENAME "BINARYDATA\\ITEMDESC.EDT" #define SIZE_ITEM_NAME 160 #define SIZE_SHORT_ITEM_NAME 160 #define SIZE_ITEM_INFO 480 @@ -1539,7 +1612,9 @@ enum SLG_BR_AWESOME_TEXT, SLG_INV_RES_ERROR, - SLG_INV_CUSTUM_ERROR, + SLG_INV_CUSTUM_ERROR, + + SLG_SQUAD_SIZE_RES_ERROR, TEXT_NUM_SLG_TEXT, }; @@ -1666,6 +1741,12 @@ enum GIO_INV_SETTING_NEW_TEXT, GIO_INV_SETTING_NEW_NAS_TEXT, + // WANNE: Squad size + GIO_SQUAD_SIZE_TITLE_TEXT, + GIO_SQUAD_SIZE_6_TEXT, + GIO_SQUAD_SIZE_8_TEXT, + GIO_SQUAD_SIZE_10_TEXT, + //////////////////////////////////// TEXT_NUM_GIO_TEXT }; diff --git a/Utils/Timer Control.cpp b/Utils/Timer Control.cpp index 2781c5a6..e8436fa4 100644 --- a/Utils/Timer Control.cpp +++ b/Utils/Timer Control.cpp @@ -20,6 +20,8 @@ #define WIN32_LEAN_AND_MEAN #endif +#include "Soldier Control.h" + INT32 giClockTimer = -1; INT32 giTimerDiag = 0; @@ -167,6 +169,9 @@ void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 UPDATETIMECOUNTER( gPSOLDIER->timeCounters.FadeCounter ); UPDATETIMECOUNTER( gPSOLDIER->timeCounters.NextTileCounter ); UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PanelAnimateCounter ); +#ifdef JA2UB + UPDATETIMECOUNTER( gPSOLDIER->GetupFromJA25StartCounter ); +#endif } } } @@ -349,3 +354,8 @@ void ResetJA2ClockGlobalTimers( void ) guiFlashCursorBaseTime = uiCurrentTime; giPotCharPathBaseTime = uiCurrentTime; } + +void SetTileAnimCounter( INT32 iTime ) +{ + giTimerIntervals[ ANIMATETILES ] = iTime; +} diff --git a/Utils/Timer Control.h b/Utils/Timer Control.h index 777ed2d0..816d9d75 100644 --- a/Utils/Timer Control.h +++ b/Utils/Timer Control.h @@ -18,6 +18,10 @@ enum NUM_TIMER_CALLBACKS }; +#define TILE_ANIM__NORMAL_SPEED 200 +#define TILE_ANIM__FAST_SPEED 30 + + // TIMER DEFINES enum { @@ -120,6 +124,7 @@ extern CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback; #endif +void SetTileAnimCounter( INT32 iTime ); #endif \ No newline at end of file diff --git a/Utils/Utils_VS2005.vcproj b/Utils/Utils_VS2005.vcproj index 69f47289..46f213ff 100644 --- a/Utils/Utils_VS2005.vcproj +++ b/Utils/Utils_VS2005.vcproj @@ -518,6 +518,10 @@ RelativePath=".\XML_auto_parse.h" > + + @@ -744,6 +748,10 @@ RelativePath=".\XML_Items.cpp" > + + diff --git a/Utils/Utils_VS2008.vcproj b/Utils/Utils_VS2008.vcproj index a414fa5a..fc2e0950 100644 --- a/Utils/Utils_VS2008.vcproj +++ b/Utils/Utils_VS2008.vcproj @@ -522,6 +522,10 @@ RelativePath=".\XML_auto_parse.h" > + + @@ -746,6 +750,10 @@ RelativePath="XML_Items.cpp" > + + diff --git a/Utils/Utils_VS2010.vcxproj b/Utils/Utils_VS2010.vcxproj index d54398e8..dcb77ea0 100644 --- a/Utils/Utils_VS2010.vcxproj +++ b/Utils/Utils_VS2010.vcxproj @@ -61,6 +61,7 @@ + @@ -109,6 +110,7 @@ + diff --git a/Utils/Utils_VS2010.vcxproj.filters b/Utils/Utils_VS2010.vcxproj.filters index 678a0600..dafca07f 100644 --- a/Utils/Utils_VS2010.vcxproj.filters +++ b/Utils/Utils_VS2010.vcxproj.filters @@ -147,8 +147,15 @@ Header Files - - + + Header Files + + + Header Files + + + Header Files + @@ -319,6 +326,11 @@ Source Files - + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Utils/XML_Language.cpp b/Utils/XML_Language.cpp new file mode 100644 index 00000000..8cf482c1 --- /dev/null +++ b/Utils/XML_Language.cpp @@ -0,0 +1,215 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" + #include "Editor All.h" + #include "LuaInitNPCs.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Item Statistics.h" + #include "LuaInitNPCs.h" + #include "email.h" + #include "InterfaceItemImages.h" + #include "Soldier Profile.h" + #include "aim.h" + #include "mercs.h" + #include "Encrypted File.h" + #include "GameSettings.h" + #include "Text.h" +#endif + +#include "XML_Language.h" + +typedef enum +{ + LANGUAGE_ELEMENT_NONE = 0, + LANGUAGE_ELEMENT_LIST, + LANGUAGE_ELEMENT, + LANGUAGE_ELEMENT_PROPERTY, + LANGUAGE_ELEMENT_SUBLIST, + LANGUAGE_ELEMENT_SUBLIST_PROPERTY, + + +} LANGUAGE_PARSE_STAGE; + +LANGUAGE_LOCATION zlanguageText[1000]; + +typedef struct +{ + LANGUAGE_PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + LANGUAGE_LOCATION curLanguageData; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +}languageLocationParseData; + + +BOOLEAN LanguageLocation_TextOnly; + +LANGUAGE_LOCATION *pLang; + +UINT32 FileTypeXml = 0; + +static void XMLCALL +languageLocationStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + languageLocationParseData * pData = (languageLocationParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "MESSAGES") == 0 && pData->curElement == LANGUAGE_ELEMENT_NONE) + { + pData->curElement = LANGUAGE_ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "TEXT") == 0 && pData->curElement == LANGUAGE_ELEMENT_LIST) + { + pData->curElement = LANGUAGE_ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == LANGUAGE_ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "Message") == 0 )) + { + pData->curElement = LANGUAGE_ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +languageLocationCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + languageLocationParseData * pData = (languageLocationParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + +static void XMLCALL +languageLocationEndElementHandle(void *userData, const XML_Char *name) +{ + languageLocationParseData * pData = (languageLocationParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "MESSAGES") == 0) + { + pData->curElement = LANGUAGE_ELEMENT_NONE; + } + else if(strcmp(name, "TEXT") == 0) + { + pData->curElement = LANGUAGE_ELEMENT_LIST; + + if (!LanguageLocation_TextOnly ) + { + pLang[pData->curLanguageData.uiIndex].uiIndex = pData->curLanguageData.uiIndex; + + if ( FileTypeXml == 0 ) + wcscpy(XMLTacticalMessages[pData->curLanguageData.uiIndex], pData->curLanguageData.Message); + } + else + { + if ( FileTypeXml == 0 ) + wcscpy(XMLTacticalMessages[pData->curLanguageData.uiIndex], pData->curLanguageData.Message); + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = LANGUAGE_ELEMENT; + pData->curLanguageData.uiIndex = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "Message") == 0 ) + { + pData->curElement = LANGUAGE_ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curLanguageData.Message, sizeof(pData->curLanguageData.Message)/sizeof(pData->curLanguageData.Message[0]) ); + pData->curLanguageData.Message[sizeof(pData->curLanguageData.Message)/sizeof(pData->curLanguageData.Message[0]) - 1] = '\0'; + } + + pData->maxReadDepth--; + } + pData->currentDepth--; +} + +BOOLEAN ReadInLanguageLocation(STR fileName, BOOLEAN localizedVersion, LANGUAGE_LOCATION *Lang, UINT32 FileType2 ) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + languageLocationParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading NewTacticalMessages.xml" ); + + LanguageLocation_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, languageLocationStartElementHandle, languageLocationEndElementHandle); + XML_SetCharacterDataHandler(parser, languageLocationCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + pLang = Lang; + FileTypeXml = FileType2; + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in NewTacticalMessages.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/Utils/XML_Language.h b/Utils/XML_Language.h new file mode 100644 index 00000000..3269c316 --- /dev/null +++ b/Utils/XML_Language.h @@ -0,0 +1,17 @@ +#ifndef __XML_LANGUAGE_H +#define __XML_LANGUAGE_H + +#include "Types.h" + +#define MAX_MESSAGE_NAMES_CHARS 400 + +typedef struct +{ + UINT32 uiIndex; + CHAR16 Message[MAX_MESSAGE_NAMES_CHARS]; + +} LANGUAGE_LOCATION; + +extern LANGUAGE_LOCATION zlanguageText[1000]; + +#endif \ No newline at end of file diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 401097e1..3344ae3a 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -115,6 +116,202 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - cities + L"SAM Site", //2 - SAM Site + L"Other location", //3 - other location + L"Mines", //4 - mines + L"Military complex", //5 - military complex + L"Laboratory complex", //6 - laboratory complex + L"Factory complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show all", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Pojazd", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show all", + L"Show cities", + L"Show SAM Sites", + L"Show other location", + L"Show mines", + L"Show military complex", + L"Show laboratory complex", + L"Show Factory complex", + L"Show hospital", + L"Show prison", + L"Show air port", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"All", //5 + L"Gun", + L"Ammo", + L"LBE Gear", + L"Misc", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knife", + L"Melee", + L"Grenades", + L"Bombs", + L"Med.", //30 + L"Kits", + L"Face", + L"LBE", + L"Misc.", //34 +}; +//----------- + + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -798,6 +995,7 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp +/* CHAR16 gszActionItemDesc[ 34 ][ 30 ] = { L"Klaxon Mine", @@ -835,7 +1033,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2428,6 +2626,11 @@ CHAR16 zHealthStr[][13] = L"æžå¥½", //"EXCELLENT", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -2942,7 +3145,11 @@ STR16 pMapScreenFastHelpTextList[] = L"测试文本", L"测试文本", L"测试文本", +#ifdef JA2UB + L"您尚未开始Tracona之旅,现在在这个å±å¹•上您无事å¯åšã€‚当您把队员都雇佣好åŽï¼Œè¯·å·¦å‡»å³ä¸‹æ–¹çš„â€œæ—¶é—´åŽ‹ç¼©â€æŒ‰é’®ã€‚这样在您的队ä¼åˆ°è¾¾Traconaå‰ï¼Œæ—¶é—´å°±å‰è¿›äº†ã€‚", +#else L"您尚未开始Arulco之旅,现在在这个å±å¹•上您无事å¯åšã€‚当您把队员都雇佣好åŽï¼Œè¯·å·¦å‡»å³ä¸‹æ–¹çš„â€œæ—¶é—´åŽ‹ç¼©â€æŒ‰é’®ã€‚这样在您的队ä¼åˆ°è¾¾Arulcoå‰ï¼Œæ—¶é—´å°±å‰è¿›äº†ã€‚", +#endif }; // movement menu text @@ -3277,7 +3484,11 @@ STR16 pMapErrorString[] = //6-10 L"éœ€è¦æœ‰äººæŠ¤é€æ‰èƒ½è¡Œå†›ã€‚请把他分进一个å°é˜Ÿé‡Œã€‚", // merc can't move unescorted .. for a male L"éœ€è¦æœ‰äººæŠ¤é€æ‰èƒ½è¡Œå†›ã€‚请把她分进一个å°é˜Ÿé‡Œã€‚", // for a female +#ifdef JA2UB + L"佣兵尚未到达Tracona!", +#else L"佣兵尚未到达Arulco!", +#endif L"看æ¥å¾—先谈妥åˆåŒã€‚", L"无法å‘å‡ºè¡Œå†›å‘½ä»¤ã€‚ç›®å‰æœ‰ç©ºè¢­ã€‚", //11-15 @@ -3366,8 +3577,13 @@ STR16 pMiscMapScreenMouseRegionHelpText[] = // male version of where equipment is left STR16 pMercHeLeaveString[] = { +#ifdef JA2UB + L"让%s把装备留在他现在所在的地方(%s),或者在Drassen (B13)登机飞离Tracona,把装备留在那里?", + L"让%s把装备留在他现在所在的地方(%s),或者在Omerta (A9)登机飞离Tracona,把装备留在那里?", +#else L"让%s把装备留在他现在所在的地方(%s),或者在Drassen (B13)登机飞离Arulco,把装备留在那里?", L"让%s把装备留在他现在所在的地方(%s),或者在Omerta (A9)登机飞离Arulco,把装备留在那里?", +#endif L"è¦ç¦»å¼€äº†ï¼Œä»–的装备将被留在Omerta (A9)。", L"è¦ç¦»å¼€äº†ï¼Œä»–的装备将被留在Drassen (B13)。", L"%sè¦ç¦»å¼€äº†ï¼Œä»–的装备将被留在%s。", @@ -3377,8 +3593,13 @@ STR16 pMercHeLeaveString[] = // female version STR16 pMercSheLeaveString[] = { +#ifdef JA2UB + L"让%s把装备留在她现在所在的地方(%s),或者在Drassen (B13)登机飞离Tracona,把装备留在那里?", + L"让%s把装备留在她现在所在的地方(%s),或者在Omerta (A9)登机飞离Tracona,把装备留在那里?", +#else L"让%s把装备留在她现在所在的地方(%s),或者在Drassen (B13)登机飞离Arulco,把装备留在那里?", L"让%s把装备留在她现在所在的地方(%s),或者在Omerta (A9)登机飞离Arulco,把装备留在那里?", +#endif L"è¦ç¦»å¼€äº†ï¼Œå¥¹çš„装备将被留在Omerta (A9)。", L"è¦ç¦»å¼€äº†ï¼Œå¥¹çš„装备将被留在Drassen (B13)。", L"%sè¦ç¦»å¼€äº†ï¼Œå¥¹çš„装备将被留在%s。", @@ -3463,7 +3684,11 @@ STR16 pFilesTitle[] = STR16 pFilesSenderList[] = { +#ifdef JA2UB L"侦察报告", +#else + L"侦察报告", +#endif L"1å·é€šç¼‰ä»¤", L"2å·é€šç¼‰ä»¤", L"3å·é€šç¼‰ä»¤", @@ -3623,6 +3848,9 @@ STR16 pBookMarkStrings[] = L"花店", L"M.I.S ä¿é™©å…¬å¸", L"å–æ¶ˆ", + L"Encyclopedia", + L"Briefing Room", + }; STR16 pBookmarkTitle[] = @@ -3732,8 +3960,10 @@ STR16 pWebPagesTitles[] = L"", L"无法找到URL", L"Bobby Ray's - 最近的è¿è´§", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4697,7 +4927,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"你的硬盘空间ä¸å¤Ÿã€‚ä½ çŽ°åœ¨åªæœ‰ %dM å¯ç”¨ç©ºé—´ï¼ŒJA2需è¦è‡³å°‘ %dM å¯ç”¨ç©ºé—´ã€‚", - L"ä¿å­˜...", //"Saving...", //When saving a game, a message box with this string appears on the screen + L"ä¿å­˜", //"Saving", //When saving a game, a message box with this string appears on the screen L"普通武器", //"Normal Guns", L"包括å‰åŽçº¦æ­¦å™¨", //"Tons of Guns", @@ -4715,6 +4945,8 @@ STR16 zSaveLoadText[] = L"æ–°æºè¡Œç³»ç»Ÿä¸å…¼å®¹640x480çš„å±å¹•åˆ†è¾¨çŽ‡ï¼Œè¯·é‡æ–°è®¾ç½®åˆ†è¾¨çŽ‡ã€‚", L"æ–°æºè¡Œç³»ç»Ÿæ— æ³•使用默认的 Data 文件夹,请仔细读说明。", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", // TODO.Translate }; @@ -4967,9 +5199,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"游æˆåˆå§‹è®¾ç½®", +#ifdef JA2UB + L"Random Manuel texts ", + L"Off", + L"On", +#else L"游æˆé£Žæ ¼", L"现实", L"ç§‘å¹»", +#endif L"金版", L"武器数é‡", // changed by SANDRO L"大釿­¦å™¨", @@ -5009,9 +5247,16 @@ STR16 gzGIOScreenText[] = L"敌人物å“全掉", L"å…³", L"å¼€", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"通缉犯出现几率", L"éšæœº", L"全部", + +#endif L"武器弹è¯å‚¨è—出现几率", L"éšæœº", L"全部", @@ -5025,6 +5270,12 @@ STR16 gzGIOScreenText[] = L"æ—§ / æ—§", L"æ–° / æ—§", L"æ–° / æ–°", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5323,12 +5574,26 @@ STR16 pMessageStrings[] = L"正常回åˆåˆ¶æ¨¡å¼", L"离开战斗", L"强制回åˆåˆ¶æ¨¡å¼å¯åŠ¨ï¼Œè¿›å…¥æˆ˜æ–—", -#ifdef JA2BETAVERSION L"自动储存æˆåŠŸã€‚", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved.//84 L"客户端", //"Client", L"æ—§æºè¡Œç³»ç»Ÿä¸èƒ½ä¸Žæ–°é™„ä»¶ç³»ç»ŸåŒæ—¶ä½¿ç”¨.", + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5358,7 +5623,11 @@ STR16 pMilitiaButtonsHelpText[] = STR16 pMapScreenJustStartedHelpText[] = { L"去AIM雇几个佣兵( *æç¤º* 在笔记本电脑里)", +#ifdef JA2UB + L"当你准备出å‘å‰å¾€Tracona,点击å±å¹•å³ä¸‹æ–¹çš„æ—¶é—´åŽ‹ç¼©æŒ‰é’®ã€‚", +#else L"当你准备出å‘å‰å¾€Arulco,点击å±å¹•å³ä¸‹æ–¹çš„æ—¶é—´åŽ‹ç¼©æŒ‰é’®ã€‚", +#endif }; STR16 pAntiHackerString[] = @@ -5390,6 +5659,10 @@ STR16 gzLaptopHelpText[] = L"McGillicutty公墓", L"è”åˆèб剿œåС公å¸", L"A.I.M指定ä¿é™©ä»£ç†äºº", + //New Bookmarks // TODO.Translate + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5586,8 +5859,11 @@ STR16 gzLateLocalizedString[] = L"全部佣兵已被包扎完毕。", //"All your mercs are bandaged.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", - +#endif L"屋顶", L"生命: %d/%d", @@ -6852,4 +7128,38 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// + +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"目标的è·ç¦»: %dæ ¼, 亮度: %d/%d", + L"å°†å‘æŠ¥æœºè£…åˆ°ç¬”è®°æœ¬ç”µè„‘ä¸Šã€‚", + L"你无法支付雇佣%s的费用", + L"在é™å®šæ—¶é—´å†…,以上的费用包括了整个行动和下列装备的花费。", + L"现在就雇请%så§ã€‚您å¯ä»¥äº«å—我们æä¾›çš„空å‰çš„“一次付费,全部æœåŠ¡â€çš„优惠价格。在这个难以置信的出价里,佣兵的éšèº«è£…备是å…费的哦。", + L"费用", + L"在本分区å‘现有人……", + //L"枪的射程: %d格, 命中率: %dï¼…", + L"显示覆盖物", + L"视è·", + L"新雇请的佣兵无法到达那里。", + L"ç”±äºŽä½ çš„ç¬”è®°æœ¬ç”µè„‘æ²¡æœ‰å‘æŠ¥æœºï¼Œä½ æ— æ³•é›‡è¯·æ–°çš„é˜Ÿå‘˜ã€‚ä¹Ÿè®¸ä½ å¾—è¯»å–å­˜æ¡£æˆ–è€…é‡æ–°å¼€å§‹æ¸¸æˆï¼", + L"%så¬åˆ°äº†Jerry的身体下é¢ä¼ æ¥é‡‘属的破碎的声音。å¬èµ·æ¥ä»¤äººä¸å®‰ï¼Œä¼¼ä¹Žä½ çš„笔记本电脑的天线被压断了。", + L"看完副指挥官Morris留下的备忘录åŽï¼Œ%s觉得有机会了。备忘录里有å‘Arulcoå„个城镇å‘å°„å¯¼å¼¹çš„åŸºåœ°çš„åæ ‡ã€‚它还给出了这个罪æ¶è®¡åˆ’çš„å‘æºåœ°çš„åæ ‡ —— 导弹工厂。", + L"çœ‹åˆ°äº†æŽ§åˆ¶é¢æ¿åŽï¼Œ %så‘现它正在倒计时,因此导弹会把这个工厂炸æ¯ã€‚%så¾—æ‰¾å‡ºä¸ªè„±é€ƒçš„è·¯çº¿ã€‚ä½¿ç”¨ç”µæ¢¯çœ‹èµ·æ¥æ˜¯æœ€å¿«çš„办法...", + L"现在您在é“人模å¼è¿›è¡Œæ¸¸æˆï¼Œå‘¨å›´æœ‰æ•Œäººçš„æ—¶å€™ä¸èƒ½å­˜æ¡£ã€‚", + L"(ä¸èƒ½åœ¨æˆ˜æ–—时存盘)", + L"当å‰çš„æˆ˜å½¹å称超过了30个字符。", + L"无法找到当å‰çš„æˆ˜å½¹ã€‚", // @@@ new text + L"战役: 默认 ( %S )", // @@@ new text + L"战役: %S", // @@@ new text + L"你选择了%S战役。 该战役是原版UB战役的玩家自定义游æˆç‰ˆæœ¬ã€‚你确认你è¦åœ¨ %S 战役下进行游æˆå—?", + L"如果你è¦ä½¿ç”¨ç¼–辑器的è¯ï¼Œè¯·é€‰æ‹©ä¸€ä¸ªæˆ˜å½¹ï¼Œä¸è¦ç”¨é»˜è®¤æˆ˜å½¹ã€‚", +}; #endif //CHINESE diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index ac417d20..68967b1f 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -117,6 +118,201 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - cities + L"SAM Site", //2 - SAM Site + L"Other location", //3 - other location + L"Mines", //4 - mines + L"Military complex", //5 - military complex + L"Laboratory complex", //6 - laboratory complex + L"Factory complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show all", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Pojazd", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show all", + L"Show cities", + L"Show SAM Sites", + L"Show other location", + L"Show mines", + L"Show military complex", + L"Show laboratory complex", + L"Show Factory complex", + L"Show hospital", + L"Show prison", + L"Show air port", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"All", //5 + L"Gun", + L"Ammo", + L"LBE Gear", + L"Misc", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knife", + L"Melee", + L"Grenades", + L"Bombs", + L"Med.", //30 + L"Kits", + L"Face", + L"LBE", + L"Misc.", //34 +}; +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -799,7 +995,8 @@ STR16 pShowHighGroundText[] = L"Hiding High Ground Markers", }; -//Item Statistics.cpp +//Item Statistics.cpp +/* CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 { L"Klaxon Mine", @@ -837,7 +1034,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2426,6 +2623,11 @@ CHAR16 zHealthStr[][13] = L"EXCELLENT", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -3275,7 +3477,11 @@ STR16 pMapErrorString[] = //6-10 L"heeft een escorte nodig. Plaats hem in een team.", // merc can't move unescorted .. for a male L"heeft een escorte nodig. Plaats haar in een team.", // for a female +#ifdef JA2UB + L"Huurling is nog niet in Tracona aangekomen!", +#else L"Huurling is nog niet in Arulco aangekomen!", +#endif L"Het lijkt erop dat er eerst nog contractbesprekingen gehouden moeten worden.", L"Cannot give a movement order. Air raid is going on.", //11-15 @@ -3364,8 +3570,13 @@ STR16 pMiscMapScreenMouseRegionHelpText[] = // male version of where equipment is left STR16 pMercHeLeaveString[] = { +#ifdef JA2UB + L"Laat %s zijn uitrusting achterlaten waar hij nu is (%s) of in Drassen (B13) bij het nemen van de vlucht uit Tracona?", + L"Laat %s zijn uitrusting achterlaten waar hij nu is (%s) of later in Omerta (A9) bij het nemen van de vlucht uit Tracona?", +#else L"Laat %s zijn uitrusting achterlaten waar hij nu is (%s) of in Drassen (B13) bij het nemen van de vlucht uit Arulco?", L"Laat %s zijn uitrusting achterlaten waar hij nu is (%s) of later in Omerta (A9) bij het nemen van de vlucht uit Arulco?", +#endif L"gaat binnenkort weg en laat zijn uitrusting achter in Omerta (A9).", L"gaat binnenkort weg en laat zijn uitrusting achter in Drassen (B13).", L"%s gaat binnenkort weg en laat zijn uitrusting achter in %s.", @@ -3375,8 +3586,13 @@ STR16 pMercHeLeaveString[] = // female version STR16 pMercSheLeaveString[] = { +#ifdef JA2UB + L"Laat %s haar uitrusting achterlaten waar ze nu is (%s) of in Drassen (B13) bij het nemen van de vlucht uit Tracona?", + L"Laat %s haar uitrusting achterlaten waar ze nu is (%s) of later in Omerta (A9) bij het nemen van de vlucht uit Tracona?", +#else L"Laat %s haar uitrusting achterlaten waar ze nu is (%s) of in Drassen (B13) bij het nemen van de vlucht uit Arulco?", L"Laat %s haar uitrusting achterlaten waar ze nu is (%s) of later in Omerta (A9) bij het nemen van de vlucht uit Arulco?", +#endif L"gaat binnenkort weg en laat haar uitrusting achter in Omerta (A9).", L"gaat binnenkort weg en laat haar uitrusting achter in Drassen (B13).", L"%s gaat binnenkort weg en laat haar uitrusting achter in %s.", @@ -3459,7 +3675,11 @@ STR16 pFilesTitle[] = STR16 pFilesSenderList[] = { +#ifdef JA2UB L"Int. Verslag", // the recon report sent to the player. Recon is an abbreviation for reconissance +#else + L"Int. Verslag", // the recon report sent to the player. Recon is an abbreviation for reconissance +#endif L"Intercept.#1", // first intercept file .. Intercept is the title of the organization sending the file...similar in function to INTERPOL/CIA/KGB..refer to fist record in files.txt for the translated title L"Intercept.#2", // second intercept file L"Intercept.#3", // third intercept file @@ -3619,6 +3839,8 @@ STR16 pBookMarkStrings[] = L"Bloemist", L"Verzekering", L"Stop", + L"Encyclopedia", + L"Briefing Room", }; STR16 pBookmarkTitle[] = @@ -3728,8 +3950,10 @@ STR16 pWebPagesTitles[] = L"", L"URL niet gevonden.", L"Bobby Ray's - Recentelijke Zendingen", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4694,7 +4918,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"Er is te weinig ruimte op de harde schijf. Er is maar %d MB vrij en Jagged heeft tenminste %d MB nodig.", - L"Bewaren...", //When saving a game, a message box with this string appears on the screen + L"Bewaren", //When saving a game, a message box with this string appears on the screen L"Normale Wapens", L"Stapels Wapens", @@ -4710,8 +4934,10 @@ STR16 zSaveLoadText[] = L"Excellent Selection", L"Awesome Selection", - L"New Inventory does not work in 640x480 screen size. Please resize and try again.", + L"New Inventory does not work in 640x480 screen resolution. Please increase the screen resolution and try again.", L"New Inventory does not work from the default 'Data' folder.", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", }; @@ -4931,7 +5157,7 @@ STR16 zOptionsScreenHelpText[] = L"When ON, you will hear rain noises when it is raining.", L"When ON, the crows are present in game.", L"When ON, a tooltip window is shown when pressing |A|l|t and hovering cursor over an enemy.", - L"When ON, game will be saved after each players turn.", + L"When ON, game will be saved in 2 alternate save slots after each players turn.", L"When ON, Skyrider will not talk anymore.", //L"When ON, game will run with much lower CPU usage.", L"When ON, enhanced descriptions will be shown for items and weapons.", @@ -4964,9 +5190,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"SPEL-INSTELLINGEN", +#ifdef JA2UB + L"Random Manuel texts ", + L"Off", + L"On", +#else L"Speelstijl", L"Realistisch", L"SF", +#endif L"Platinum", //Placeholder English L"Wapenopties", L"Extra wapens", @@ -5006,9 +5238,15 @@ STR16 gzGIOScreenText[] = L"Enemies Drop All Items", L"Off", L"On", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"Number of Terrorists", L"Random", L"All", +#endif L"Secret Weapon Caches", L"Random", L"All", @@ -5023,6 +5261,12 @@ STR16 gzGIOScreenText[] = L"Old / Old", L"New / Old", L"New / New", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5307,7 +5551,7 @@ STR16 pMessageStrings[] = L"Je kunt %s's dagelijkse salaris van %s niet betalen", //first %s is the mercs name, the seconds is a string containing the salary L"Overslaan", L"%s kan niet alleen weggaan.", - L"Een spel is bewaard onder de naam SaveGame99.sav. Indien nodig, hernoem het naar SaveGame10 zodat je het kan aanroepen in het Laden-scherm.", + L"Een spel is bewaard onder de naam SaveGame249.sav. Indien nodig, hernoem het naar SaveGame10 zodat je het kan aanroepen in het Laden-scherm.", L"%s dronk wat %s", L"Een pakket is in Drassen gearriveerd.", L"%s zou moeten arriveren op het aangewezen punt (sector %s) op dag %d, om ongeveer %s.", @@ -5323,14 +5567,28 @@ STR16 pMessageStrings[] = L"Normal turn mode", L"Exit combat mode", L"Forced Turn Mode Active, Entering Combat", -#ifdef JA2BETAVERSION L"Spel succesvol bewaard in de Einde Beurt Auto Bewaar Slot.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved. L"Client", // TODO.Translate L"You cannot use the Old Inventory and the New Attachment System at the same time.", + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5360,7 +5618,11 @@ STR16 pMilitiaButtonsHelpText[] = STR16 pMapScreenJustStartedHelpText[] = { L"Ga naar AIM en huur wat huurlingen in ( *Hint* dat kan bij Laptop )", +#ifdef JA2UB L"Als je klaar bent om naar Arulco te gaan, klik dan op TijdVersneller onder rechts op het scherm.", // to inform the player to hit time compression to get the game underway +#else + L"Als je klaar bent om naar Tracona te gaan, klik dan op TijdVersneller onder rechts op het scherm.", // to inform the player to hit time compression to get the game underway +#endif }; STR16 pAntiHackerString[] = @@ -5392,6 +5654,10 @@ STR16 gzLaptopHelpText[] = L"McGillicutty's Mortuarium", L"United Floral Service", L"Verzekeringsagenten voor A.I.M. contracten", + //New Bookmarks + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5587,8 +5853,11 @@ STR16 gzLateLocalizedString[] = L"Al je huurlingen zijn verbonden.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", - +#endif L"(dak)", L"Gezondheid: %d/%d", @@ -6846,4 +7115,37 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + //L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; #endif //DUTCH diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index a0287e73..61a1b4ba 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -115,6 +116,202 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; + +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - city + L"SAM Site", //2 - SAM Site + L"Other Location", //3 - other location + L"Mine", //4 - mines + L"Military Complex", //5 - military complex + L"Laboratory Complex", //6 - laboratory complex + L"Factory Complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - airport +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show All", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Vehicle", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show All", + L"Show City", + L"Show SAM Site", + L"Show Other Location", + L"Show Mine", + L"Show Military Complex", + L"Show Laboratory Complex", + L"Show Factory Complex", + L"Show Hospital", + L"Show Prison", + L"Show Airport", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"Show All", //5 + L"Show Gun", + L"Show Ammo", + L"Show LBE Gear", + L"Show Misc", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotg.", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotg.", + + // Used + L"Gun", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmet", + L"Vest", + L"Legging", + L"Plate", + + // Misc + L"Blade", + L"Th. Kn.", + L"Melee", + L"Grena.", + L"Bomb", + L"Med.", //30 + L"Kit", + L"Face", + L"LBE", + L"Misc", //34 +}; +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -798,7 +995,7 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp -CHAR16 gszActionItemDesc[ 34 ][ 30 ] = +/*CHAR16 gszActionItemDesc[ 34 ][ 30 ] = { L"Klaxon Mine", L"Flare Mine", @@ -835,7 +1032,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2429,6 +2626,11 @@ CHAR16 zHealthStr[][13] = L"EXCELLENT", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -3278,7 +3480,11 @@ STR16 pMapErrorString[] = //6-10 L"needs an escort to move. Place him on a squad with one.", // merc can't move unescorted .. for a male L"needs an escort to move. Place her on a squad with one.", // for a female +#ifdef JA2UB + L"Merc hasn't yet arrived in Tracona!", +#else L"Merc hasn't yet arrived in Arulco!", +#endif L"Looks like there's some contract negotiations to settle first.", L"Cannot give a movement order. Air raid is going on.", //11-15 @@ -3367,8 +3573,13 @@ STR16 pMiscMapScreenMouseRegionHelpText[] = // male version of where equipment is left STR16 pMercHeLeaveString[] = { +#ifdef JA2UB + L"Have %s leave his equipment where he is now (%s) or later on in Drassen (B13) upon catching flight out of Tracona?", + L"Have %s leave his equipment where he is now (%s) or later on in Omerta (A9) upon catching flight out of Tracona?", +#else L"Have %s leave his equipment where he is now (%s) or later on in Drassen (B13) upon catching flight out of Arulco?", L"Have %s leave his equipment where he is now (%s) or later on in Omerta (A9) upon catching flight out of Arulco?", +#endif L"is about to leave and will drop off his equipment in Omerta (A9).", L"is about to leave and will drop off his equipment in Drassen (B13).", L"%s is about to leave and will drop off his equipment in %s.", @@ -3378,8 +3589,13 @@ STR16 pMercHeLeaveString[] = // female version STR16 pMercSheLeaveString[] = { +#ifdef JA2UB + L"Have %s leave her equipment where she is now (%s) or later on in Drassen (B13) upon catching flight out of Tracona?", + L"Have %s leave her equipment where she is now (%s) or later on in Omerta (A9) upon catching flight out of Tracona?", +#else L"Have %s leave her equipment where she is now (%s) or later on in Drassen (B13) upon catching flight out of Arulco?", L"Have %s leave her equipment where she is now (%s) or later on in Omerta (A9) upon catching flight out of Arulco?", +#endif L"is about to leave and will drop off her equipment in Omerta (A9).", L"is about to leave and will drop off her equipment in Drassen (B13).", L"%s is about to leave and will drop off her equipment in %s.", @@ -3624,6 +3840,8 @@ STR16 pBookMarkStrings[] = L"Florist", L"Insurance", L"Cancel", + L"Encyclopedia", + L"Briefing Room", }; STR16 pBookmarkTitle[] = @@ -3733,8 +3951,10 @@ STR16 pWebPagesTitles[] = L"", L"URL not found.", L"Bobby Ray's - Recent Shipments", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4698,7 +4918,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"You are running low on disk space. You only have %d Megs free and Jagged should have at least %d Megs free.", - L"Saving...", //When saving a game, a message box with this string appears on the screen + L"Saving", //When saving a game, a message box with this string appears on the screen L"Normal Guns", L"Tons of Guns", @@ -4714,8 +4934,10 @@ STR16 zSaveLoadText[] = L"Excellent Selection", L"Awesome Selection", - L"New Inventory does not work in 640x480 screen size. Please resize and try again.", + L"New Inventory does not work in 640x480 screen resolution. Please increase the screen resolution and try again.", L"New Inventory does not work from the default 'Data' folder.", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", }; @@ -4830,7 +5052,7 @@ STR16 zOptionsToggleText[] = L"Rain Noises", L"Allow Crows", L"Show Soldier Tooltips", - L"Auto Save", + L"Tactical End-Turn Save", L"Silent Skyrider", //L"Low CPU usage", L"Enhanced Description Box", @@ -4935,7 +5157,7 @@ STR16 zOptionsScreenHelpText[] = L"When ON, you will hear rain noises when it is raining.", L"When ON, the crows are present in game.", L"When ON, a tooltip window is shown when pressing |A|l|t and hovering cursor over an enemy.", - L"When ON, game will be saved in 2 alternate save slots after each players turn.\nTo load, press |C|t|r|l+|L (to open the Load Game screen) and then |A|l|t+|A or |A|l|t+|B.", + L"When ON, game will be saved in 2 alternate save slots after each players turn.", L"When ON, Skyrider will not talk anymore.", //L"When ON, game will run with much lower CPU usage.", L"When ON, enhanced descriptions will be shown for items and weapons.", @@ -4968,9 +5190,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"INITIAL GAME SETTINGS", +#ifdef JA2UB + L"Random Manuel texts ", + L"Off", + L"On", +#else L"Game Style", L"Realistic", L"Sci Fi", +#endif L"Platinum", L"Available Arsenal", // changed by SANDRO L"Tons of Guns", @@ -5010,9 +5238,15 @@ STR16 gzGIOScreenText[] = L"Enemies Drop All Items", L"Off", L"On", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"Number of Terrorists", L"Random", L"All", +#endif L"Secret Weapon Caches", L"Random", L"All", @@ -5026,6 +5260,12 @@ STR16 gzGIOScreenText[] = L"Old / Old", L"New / Old", L"New / New", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5308,7 +5548,7 @@ STR16 pMessageStrings[] = L"You cannot afford to pay for %s's daily salary of %s", //first %s is the mercs name, the seconds is a string containing the salary L"Skip", // 70 L"%s cannot leave alone.", - L"A save has been created called, SaveGame99.sav. If needed, rename it to SaveGame01 - SaveGame10 and then you will have access to it in the Load screen.", + L"A save has been created called, SaveGame249.sav. If needed, rename it to SaveGame01 - SaveGame10 and then you will have access to it in the Load screen.", L"%s drank some %s", L"A package has arrived in Drassen.", L"%s should arrive at the designated drop-off point (sector %s) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival @@ -5324,12 +5564,25 @@ STR16 pMessageStrings[] = L"Normal turn mode", L"Exit combat mode", L"Forced Turn Mode Active, Entering Combat", -#ifdef JA2BETAVERSION L"Successfully Saved the Game into the End Turn Auto Save slot.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved.//84 L"Client", - L"You cannot use the Old Inventory and the New Attachment System at the same time.", + L"You cannot use the Old Inventory and the New Attachment System at the same time.", // 90 + + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5359,7 +5612,11 @@ STR16 pMilitiaButtonsHelpText[] = STR16 pMapScreenJustStartedHelpText[] = { L"Go to AIM and hire some mercs ( *Hint* it's in the Laptop )", // to inform the player to hired some mercs to get things going +#ifdef JA2UB + L"When you're ready to travel to Tracona, click on the Time Compression button at the bottom right of the screen.", // to inform the player to hit time compression to get the game underway +#else L"When you're ready to travel to Arulco, click on the Time Compression button at the bottom right of the screen.", // to inform the player to hit time compression to get the game underway +#endif }; STR16 pAntiHackerString[] = @@ -5391,6 +5648,10 @@ STR16 gzLaptopHelpText[] = L"McGillicutty's Mortuary", L"United Floral Service", L"Insurance Brokers for A.I.M. contracts", + //New Bookmarks + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5587,7 +5848,11 @@ STR16 gzLateLocalizedString[] = L"All your mercs are bandaged.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", +#endif L"(roof)", @@ -6845,4 +7110,37 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + //L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; #endif //ENGLISH diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 7eaa7122..bbb5d22b 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -115,6 +116,202 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; + +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - cities + L"SAM Site", //2 - SAM Site + L"Other location", //3 - other location + L"Mines", //4 - mines + L"Military complex", //5 - military complex + L"Laboratory complex", //6 - laboratory complex + L"Factory complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show all", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Pojazd", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show all", + L"Show cities", + L"Show SAM Sites", + L"Show other location", + L"Show mines", + L"Show military complex", + L"Show laboratory complex", + L"Show Factory complex", + L"Show hospital", + L"Show prison", + L"Show air port", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"All", //5 + L"Gun", + L"Ammo", + L"LBE Gear", + L"Misc", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knife", + L"Melee", + L"Grenades", + L"Bombs", + L"Med.", //30 + L"Kits", + L"Face", + L"LBE", + L"Misc.", //34 +}; +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -2428,6 +2625,11 @@ CHAR16 zHealthStr[][13] = L"EXCELLENT", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"1000", @@ -3464,7 +3666,11 @@ STR16 pFilesTitle[] = STR16 pFilesSenderList[] = { +#ifdef JA2UB +L"Rapport Tracona", // the recon report sent to the player. Recon is an abbreviation for reconissance +#else L"Rapport Arulco", // the recon report sent to the player. Recon is an abbreviation for reconissance +#endif L"Interception #1", // first intercept file .. Intercept is the title of the organization sending the file...similar in function to INTERPOL/CIA/KGB..refer to fist record in files.txt for the translated title L"Interception #2", // second intercept file L"Interception #3", // third intercept file @@ -3624,6 +3830,8 @@ STR16 pBookMarkStrings[] = L"Fleuriste", L"Assurance", L"Annuler", + L"Encyclopedia", + L"Briefing Room", }; STR16 pBookmarkTitle[] = @@ -3733,8 +3941,10 @@ STR16 pWebPagesTitles[] = L"", L"URL introuvable.", L"Bobby Ray - Dernières commandes", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4698,7 +4908,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"Votre risquez de manquer d'espace disque. Il ne vous reste que %d Mo de libre alors que le jeu nécessite %d Mo d'espace libre.", - L"Enregistrement...", //When saving a game, a message box with this string appears on the screen + L"Enregistrement", //When saving a game, a message box with this string appears on the screen L"Quelques Armes", L"Toutes Armes", @@ -4716,6 +4926,8 @@ STR16 zSaveLoadText[] = L"Le nouvel inventaire (NIV) ne peut se lancer en 640x480. Changez de résolution.", L"Le nouvel inventaire (NIV) ne fonctionne pas depuis le dossier \"data\" original.", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", // TODO.Translate }; @@ -4968,9 +5180,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"CONFIGURATION DU JEU", +#ifdef JA2UB + L"Random Manuel texts ", + L"Off", + L"On", +#else L"Style de jeu", L"Réaliste", L"S-F", +#endif L"Platinum", //Placeholder English L"Armes disponibles", L"Toutes", @@ -5010,9 +5228,15 @@ STR16 gzGIOScreenText[] = L"Objets lachés par les ennemis", L"Off", L"On", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"Nombre de terroristes", L"Aléatoire", - L"Tous", + L"Tout", +#endif L"Cachettes d'armes secrètes", L"Aléatoire", L"Toutes", @@ -5025,6 +5249,12 @@ STR16 gzGIOScreenText[] = L"Ancien / Ancien", L"Nouveau / Ancien", L"Nouveau / Nouveau", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5308,7 +5538,7 @@ STR16 pMessageStrings[] = L"Vous ne pouvez pas payer le salaire de %s qui se monte à %s", //first %s is the mercs name, the seconds is a string containing the salary L"Passer", L"%s ne peut sortir seul.", - L"Une sauvegarde a été crée (Partie99.sav). Renommez-la (Partie01 - Partie10) pour pouvoir la charger ultérieurement.", + L"Une sauvegarde a été crée (Partie249.sav). Renommez-la (Partie01 - Partie10) pour pouvoir la charger ultérieurement.", L"%s a bu %s", L"Un colis vient d'arriver à Drassen.", L"%s devrait arriver au point d'entrée (secteur %s) au jour %d vers %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival @@ -5324,13 +5554,27 @@ STR16 pMessageStrings[] = L"Mode tour par tour normal", L"Mode de combat quitté", L"Mode tour par tour forcé activé, mode de combat activé", -#ifdef JA2BETAVERSION L"Partie enregistrée dans l'emplacement de sauvegarde automatique.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved. L"Client", - + L"Vous ne pouvez pas utiliser l'ancien système d'inventaire et le nouveau système d'accessoire en même temps.", + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5392,6 +5636,10 @@ STR16 gzLaptopHelpText[] = L"Morgue McGillicutty", L"Service des Fleuristes Associés", L"Courtiers d'Assurance des Mercenaires de l'A.I.M.", + //New Bookmarks + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5587,8 +5835,11 @@ STR16 gzLateLocalizedString[] = L"Tous vos mercenaires ont été soignés.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", - +#endif L"(toit)", L"Santé : %d/%d", @@ -6839,4 +7090,37 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"Distance cible: %d tiles, Brightness: %d/%d", + L"Attachez le transpondeur à votre PC portable.", + L"Vous n'avez pas les moyens d'engager %s", + L"Pour une durée limitée, les frais ci-dessus couvrent la mission entière, équipement ci-dessous compris.", + L"Engagez %s et découvrez dès à présent notre prix \"tout compris\". Aussi inclus dans cette incroyable offre, l'équipement personnel du mercenaire sans frais supplémentaires.", + L"Frais", + L"Il y a quelqu'un d'autre dans le secteur...", + //L"Portée arme: %d tiles, de chances: %d pourcent", + L"Afficher couverture", + L"Ligne de vision", + L"Les nouvelles recrues ne peuvent arriver ici.", + L"Comme votre PC n'a pas de transpondeur, vous ne pouvez engager de nouvelles recrues. Revenez à une sauvegarde précédente et réessayez.", + L"%s entend le son de métal broyé provenant d'en dessous du corps de Jerry. On dirait que l'antenne de votre PC ne sers plus à rien.", //the %s is the name of a merc. @@@ Modified + L"Apres avoir scanné la note laissée par le Deputy Commander Morris, %s sent une oppurtinité. La note contient les coordonnées pour le lancement de missiles sur Arulco. Elle contient aussi l'emplacement de l'usine d'où les missiles proviennent.", + L"En examinant le panneau de contrôle, %s s'aperçoît que les chiffres peuvent être inversés pour que les missiles détruisent cette même usine. %s a besoin de trouver un chemin pour s'enfuir. L'ascenseur semble être la solution la plus rapide...", + L"Ceci est un jeu IRON MAN et vous ne pouvez pas sauvegarder s'il ya des ennemis dans les parages.", // @@@ new text + L"(ne peut sauvegarder en plein combat)", //@@@@ new text + L"Le nom de la campagne actuelle est supérieur à 30 lettres.", // @@@ new text + L"La campagne actuelle est introuvable.", // @@@ new text + L"Campagne: Par défaut ( %S )", // @@@ new text + L"Campagne: %S", // @@@ new text + L"Vous avez choisi la campagne %S. Cette campagne est un mod d'Unfinished Business. Etes-vous sûr de vouloir jouer la campagne %S ?", // @@@ new text + L"Pour pouvoir utiliser l'éditeur, veuillez choisir une autre campagne que celle par défaut.", ///@@new +}; #endif //FRENCH diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index af5ac1a2..e727ed15 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -139,6 +140,202 @@ Remove any LOOTF comment that has been checked, except maybe for "alt." (alterna 07/2010 LootFragg */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; + +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Orte", // 0 + L"Personen", + L"Gegenstände", + L"Aufträge", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Beenden", +}; + +STR16 pOtherButtonsText[] = +{ + L"Auftrag", + L"Akzep.", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Einsatzbesprechung", + L"Auftrag annehmen", +}; + + +STR16 pLocationPageText[] = +{ + L"Vorherige Seite", + L"Foto", + L"Nächste Seite", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Hauptseite", + L">>", + L"Typ: ", + L"Keine Daten", + L"Es gibt keine Missionen. Fügen Sie Missionen zu der Datei TableData\\BriefingRoom\\BriefingRoom.xml hinzu. Die erste Mission muss SICHTBAR sein. Setzen Sie den Wert Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unbekannt",// 0 - unknown + L"Stadt", //1 - cities + L"Luftwaffen Stützpunkt", //2 - SAM Site + L"Andere Örtlichkeiten", //3 - other location + L"Minen", //4 - mines + L"Militärstützpunkt", //5 - military complex + L"Labor", //6 - laboratory complex + L"Fabrik", //7 - factory complex + L"Spital", //8 - hospital + L"Gefängnis", //9 - prison + L"Flughafen", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Alle anzeigen", + L"AIM anzeigen", + L"MERC anzeigen", + L"RPC anzeigen", + L"NPC anzeigen", + L"Fahrzeuge anzeigen", + L"BSE anzeigen", + L"EPC anzeigen", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"Alle", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"BSE", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Alles anzeigen", + L"Städte anzeigen", + L"Luftwaffenstützpunkte anzeigen", + L"Andere Örtlichkeiten anzeigen", + L"Minen anzeigen", + L"Militärstützpunkte anzeigen", + L"Labor-Komplexe anzeigen", + L"Fabriken anzeigen", + L"Spitäler anzeigen", + L"Gefängnisse anzeigen", + L"Flughäfen anzeigen", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"Alle", + L"Stadt", + L"SAM", + L"Andere", + L"Mine", + L"Mil.", + L"Lab.", + L"Fabr.", + L"Spit.", + L"Gefän.", + L"Flugh.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"Alle", //0 + L"Waffen", + L"Mun.", + L"LBE", + L"Sonst.", + + L"Alle", //5 + L"Waffen", + L"Munition", + L"LBE Gegenstände", + L"Sonstige", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Schwer", + L"Pistole", + L"M. Pist.", + L"SMG", + L"Gewehr", + L"S.Gew.", + L"A.Gew.", + L"MG", + L"Schrot.", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Gewehr", + L"S.Gew", + L"A.Gew.", + L"MG", + L"Schrot.", + + // Used + L"Waffen", + L"Panz.", + L"LBE Ausr.", + L"Sonst.", //20 + + // Armour + L"Helme", + L"Westen", + L"Hosen", + L"Platten", + + // Misc + L"Klingen", + L"Wurfm.", + L"Nah.", + L"Gran.", + L"Bomb.", + L"Med.", //30 + L"Kits", + L"Gesicht", + L"LBE", + L"Sonst.", //34 +}; +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -822,7 +1019,7 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp -CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 +/*CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 { L"Klaxon Mine", L"Flare Mine", @@ -859,7 +1056,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2434,6 +2631,11 @@ CHAR16 zHealthStr[][13] = //used to be 10 L"SEHR GUT", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -3244,7 +3446,11 @@ STR16 pMapErrorString[] = //6-10 L"braucht eine Eskorte. Platzieren Sie ihn in einem Trupp mit Eskorte.", // merc can't move unescorted .. for a male L"braucht eine Eskorte. Platzieren Sie sie in einem Trupp mit Eskorte.", // for a female +#ifdef JA2UB + L"Söldner ist noch nicht in Tracona!", +#else L"Söldner ist noch nicht in Arulco!", +#endif L"Erst mal Vertrag aushandeln!", L"Marschbefehl ist nicht möglich. Luftangriffe finden statt.", //11-15 @@ -3328,8 +3534,13 @@ STR16 pMiscMapScreenMouseRegionHelpText[] = // male version of where equipment is left STR16 pMercHeLeaveString[] = { +#ifdef JA2UB + L"Soll %s seine Ausrüstung hier lassen (%s) oder in Drassen (B13), wenn er Tracona verlässt?", + L"Soll %s seine Ausrüstung hier lassen (%s) oder in Omerta (A9), wenn er Tracona verlässt?", +#else L"Soll %s seine Ausrüstung hier lassen (%s) oder in Drassen (B13), wenn er Arulco verlässt?", L"Soll %s seine Ausrüstung hier lassen (%s) oder in Omerta (A9), wenn er Arulco verlässt?", +#endif L"geht bald und lässt seine Ausrüstung in Omerta (A9).", L"geht bald und lässt seine Ausrüstung in Drassen (B13).", L"%s geht bald und lässt seine Ausrüstung in %s.", @@ -3338,8 +3549,13 @@ STR16 pMercHeLeaveString[] = // female version STR16 pMercSheLeaveString[] = { +#ifdef JA2UB + L"Soll %s ihre Ausrüstung hier lassen (%s) oder in Drassen (B13), bevor sie Tracona verlässt?", + L"Soll %s ihre Ausrüstung hier lassen (%s) oder in Omerta (A9), bevor sie Tracona verlässt?", +#else L"Soll %s ihre Ausrüstung hier lassen (%s) oder in Drassen (B13), bevor sie Arulco verlässt?", L"Soll %s ihre Ausrüstung hier lassen (%s) oder in Omerta (A9), bevor sie Arulco verlässt?", +#endif L"geht bald und lässt ihre Ausrüstung in Omerta (A9).", L"geht bald und lässt ihre Ausrüstung in Drassen (B13).", L"%s geht bald und lässt ihre Ausrüstung in %s.", @@ -3575,6 +3791,8 @@ STR16 pBookMarkStrings[] = L"Florist", L"Versicherung", L"Abbruch", + L"Enzyklopädie", + L"Einsatzbesprechung", }; STR16 pBookmarkTitle[] = @@ -3676,8 +3894,12 @@ STR16 pWebPagesTitles[] = L"", L"URL nicht gefunden.", L"Bobby Rays - Letzte Lieferungen", - L"", - L"", + L"Enzyklopädie", + L"Enzyklopädie - Daten", + L"Einsatzbesprechung", + + L"Einsatzbesprechung - Daten", + }; STR16 pShowBookmarkString[] = @@ -4547,7 +4769,7 @@ STR16 zSaveLoadText[] = L"Sie haben zu wenig Festplattenspeicher. Sie haben nur %d MB frei und JA2 benötigt mindestens %d MB.", - L"Speichere...", //While the game is saving this message appears. + L"Speichere", //While the game is saving this message appears. L"Normale Waffen", L"Zusatzwaffen", @@ -4561,8 +4783,10 @@ STR16 zSaveLoadText[] = L"Ausgezeichnete Auswahl", L"Fantastische Auswahl", - L"Neues Inventar funktioniert nicht in 640x480 Auflösung. Wählen Sie eine andere Auflösung und versuchen Sie es erneut.", + L"Neues Inventar funktioniert nicht in 640x480 Bildschirmauflösung. Wählen Sie eine höhere Bildschirmauflösung und versuchen Sie es erneut.", L"Neues Inventar funktioniert nicht mit dem ausgewählten 'Data' Ordner.", + + L"Die gespeicherte Truppengröße im Spielstand wird nicht unterstützt bei der aktullen Bildschirmauflösung. Wählen Sie eine höhere Bildschirmauflösung und versuchen Sie es erneut.", }; //MapScreen @@ -4783,7 +5007,7 @@ STR16 zOptionsScreenHelpText[] = L"Wenn diese Funktion aktiviert ist, werden Regengeräusche hörbar, sobald es regnet.", L"Wenn diese Funktion aktiviert ist, sind Krähen im Spiel vorhanden und hacken lautstark an manchen Leichen herum, haben aber sonst keine großen Auswirkungen auf das Spiel.", L"Wenn diese Funktion aktiviert ist, werden mit Druck auf |A|l|t Informationen über den Gegner eingeblendet, auf dem sich der Maus-Cursor befindet.", - L"Wenn diese Funktion aktiviert ist, wird nach jeder Runde automatisch abwechselnd in zwei speziellen Autosave-Spielständen gespeichert.\nLadebildschirm mit |C|t|r|l+|L anzeigen. Danach |A|l|t+|A bzw. |A|l|t+|B.", + L"Wenn diese Funktion aktiviert ist, wird nach jeder Runde automatisch abwechselnd in zwei speziellen Autosave-Spielständen gespeichert.", L"Wenn diese Funktion aktiviert ist, wird Skyrider nichts mehr sagen. Verwenden Sie diese Option, wenn er Ihnen auf die Nüsse geht.", //L"Aktivieren Sie diese Funktion, wenn Ihr Rechner steinalt ist und anderenfalls Probleme auftreten würden.", L"Wenn diese Funktion aktiviert ist, werden erweiterte Beschreibungen und Werte zu den Waffen und Gegenständen angezeigt.", @@ -4815,9 +5039,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"GRUNDEINSTELLUNGEN", +#ifdef JA2UB + L"Random Manuel texts", + L"Off", + L"On", +#else L"Spielmodus", L"Realistisch", L"SciFi", +#endif L"Platinum", //Placeholder English L"Waffen", L"Zus. Waffen", @@ -4857,9 +5087,15 @@ STR16 gzGIOScreenText[] = L"Tote Gegner lassen alles fallen", L"Aus", L"An", +#ifdef JA2UB + L"Tex and John", + L"Zufällig", + L"Alle vorhanden", +#else L"Anzahl der Terroristen", L"Zufällig", L"Alle vorhanden", +#endif L"Geheime Waffenlager", L"Zufällig", L"Alle vorhanden", @@ -4872,6 +5108,12 @@ STR16 gzGIOScreenText[] = L"Alt / Alt", L"Neu / Alt", L"Neu / Neu", + + // Squad Size + L"Max. Truppengröße", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5152,7 +5394,7 @@ STR16 pMessageStrings[] = L"Sie können %ss Tagessold von %s nicht zahlen", //first %s is the mercs name, the second is a string containing the salary L"Abbruch", // 70 L"%s kann alleine nicht gehen.", - L"Spielstand namens Spielstand99.sav kreiert. Wenn nötig, in Spielstand01 - Spielstand10 umbennen und über die Option 'Laden' aufrufen.", + L"Spielstand namens Spielstand249.sav kreiert. Wenn nötig, in Spielstand01 - Spielstand10 umbennen und über die Option 'Laden' aufrufen.", L"%s hat %s getrunken.", L"Paket in Drassen angekommen.", L"%s kommt am %d. um ca. %s am Zielort an (Sektor %s).", //first %s is mercs name(OK), next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival !!!7 It should be like this: first one is merc (OK), next is day of arrival (OK) , next is time of the day for ex. 07:00 (not OK, now it is still sector), next should be sector (not OK, now it is still time of the day) //LOOTF - is this still valid? I assume it's not. @@ -5168,13 +5410,25 @@ STR16 pMessageStrings[] = L"Normaler Rundenmodus", L"Verlasse Kampfmodus", L"Erzwungener Rundenmodus ist aktiv, gehe in Kampfmodus", -#ifdef JA2BETAVERSION L"Spiel erfolgreich in Position End Turn Auto Save gespeichert.", // 83 -#endif L"..\\Spielstände\\MP_Spielstände", //The name of the directory where games are saved. L"Client", L"Sie können nicht altes Inventar und neues Attachment System gleichzeitig verwenden.", + L"Automatischer Spielstandspeicherung #", //91 // Text des Auto Saves im Load Screen mit ID + L"Dieser Platz ist reserviert für Spielstände die automatisch gespeichert werden. Dies kann ein/ausgeschaltet werden in der Datei ja2_options.ini (AUTO_SAVE_EVERY_N_HOURS).", //92 // The text, when the user clicks on the save screen on an auto save + L"Leerer Platz für automatische Spielstandspeicherung #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSpielstand", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"Zugende Spielstand #", // 95 // The text for the tactical end turn auto save + L"Speichere Automatischen Spielstand #", // 96 // The message box, when doing auto save + L"Speichere", // 97 // The message box, when doing end turn auto save + L"Leere Platz für Spieler-Zugende Spielstandspeicherung #", // 98 // The message box, when doing auto save + L"Dieser Platz ist reserviert für Spielstände am Ende eines Spieler Zuges. Dies kann ein/ausgeschaltet werden in den Spieleinstellungen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSpielstand%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"Spielstand%02d.sav", //103 }; CHAR16 ItemPickupHelpPopup[][40] = @@ -5235,6 +5489,10 @@ STR16 gzLaptopHelpText[] = L"McGillicuttys Bestattungen", L"Fleuropa", L"Versicherungsmakler für A.I.M.-Verträge", + //New Bookmarks + L"", + L"Enzyklopädie", + L"Einsatzbesprechung", }; STR16 gzHelpScreenText[] = @@ -5423,7 +5681,11 @@ STR16 gzLateLocalizedString[] = L"Alle Söldner verarztet.", //14-16 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", +#endif L"(Dach)", L"Gesundheit: %d/%d", @@ -6681,4 +6943,37 @@ STR16 gzNCTHlabels[]= ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"Entfernung zum Ziel: %d Felder, Helligkeit: %d/%d", + L"Verbinden Sie den Transmitter mit Ihrem Laptop-Computer.", + L"Sie haben nicht genug Geld, um %s anzuheuern", + L"Das obenstehende Honorar deckt für einen begrenzten Zeitraum die Kosten der Gesamtmission, und schließt untenstehendes Equipment mit ein.", + L"Engagieren Sie %s jetzt und nutzen Sie den Vorteil unseres beispiellosen 'Ein Betrag für alles'-Honorars. Das persönliche Equipment des Söldners ist gratis in diesem Preis mit inbegriffen.", + L"Honorar", + L"Da ist noch jemand im Sektor...", + //L"Waffen-Rchwt.: %d Felder, Trefferwahrsch.: %d Prozent", + L"Deckung anzeigen", + L"Sichtfeld", + L"Neue Rekruten können dort nicht hinkommen.", + L"Da Ihr Laptop keinen Transmitter besitzt, können Sie keine neuen Teammitglieder anheuern. Vielleicht ist dies eine guter Zeitpunkt, ein gespeichertes Spiel zu laden oder ein neues zu starten!", + L"%s hört das Geräusch knirschenden Metalls unter Jerry hervordringen. Es klingt grässlich - die Antenne ihres Laptop-Computers ist zerstört.", //the %s is the name of a merc. @@@ Modified + L"Nach Ansehen des Hinweises, den Commander Morris hinterließ, erkennt %s eine einmalige Gelegenheit. Der Hinweis enthält Koordinaten für den Start von Raketen gegen verschiedene Städte in Arulco. Aber er enthält auch die Koordinaten des Startpunktes - der Raketenanlage.", + L"Das Kontroll-Board studierend, entdeckt %s, dass die Zahlen umgedreht werden könnten, so dass die Raketen diese Anlage selbst zerstören. %s muss nun einen Fluchtweg finden. Der Aufzug scheint die schnellstmögliche Route zu bieten...", //!!! The original reads: L"Noticing the control panel %s, figures the numbers can be reversed..." That sounds odd for me, but I think the comma is placed one word too late... (correct?) + L"Dies ist ein IRON MAN-Spiel, und es kann nicht gespeichert werden, wenn sich Gegner in der Nähe befinden.", + L"(Kann während Kampf nicht speichern)", + L"Der Name der aktuellen Kampagne enthält mehr als 30 Buchstaben.", + L"Die aktuelle Kampagne kann nicht gefunden werden.", + L"Kampagne: Standard ( %S )", + L"Kampagne: %S", + L"Sie haben die Kampagne %S gewählt. Diese ist eine vom Spieler modifizierte Version der Originalkampagne von JA2UB. Möchten Sie die Kampagne %S spielen?", + L"Um den Editor zu benutzen, müssen Sie eine andere als die Standardkampgane auswählen.", +}; #endif //GERMAN diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 3f4cc082..4306e8ab 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -115,6 +116,201 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - cities + L"SAM Site", //2 - SAM Site + L"Other location", //3 - other location + L"Mines", //4 - mines + L"Military complex", //5 - military complex + L"Laboratory complex", //6 - laboratory complex + L"Factory complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show all", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Pojazd", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show all", + L"Show cities", + L"Show SAM Sites", + L"Show other location", + L"Show mines", + L"Show military complex", + L"Show laboratory complex", + L"Show Factory complex", + L"Show hospital", + L"Show prison", + L"Show air port", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"All", //5 + L"Gun", + L"Ammo", + L"LBE Gear", + L"Misc", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knife", + L"Melee", + L"Grenades", + L"Bombs", + L"Med.", //30 + L"Kits", + L"Face", + L"LBE", + L"Misc.", //34 +}; +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -798,6 +994,7 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp +/* CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 { L"Klaxon Mine", @@ -835,7 +1032,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2421,6 +2618,11 @@ CHAR16 zHealthStr[][13] = L"ECCELLENTE", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -3270,7 +3472,11 @@ STR16 pMapErrorString[] = //6-10 L"ha bisogno di una scorta per muoversi. Inseritelo in una squadra che ne è provvista.", // merc can't move unescorted .. for a male L"ha bisogno di una scorta per muoversi. Inseritela in una squadra che ne è provvista.", // for a female +#ifdef JA2UB + L"Il mercenario non è ancora arrivato ad Tracona!", +#else L"Il mercenario non è ancora arrivato ad Arulco!", +#endif L"Sembra che ci siano negoziazioni di contratto da stabilire.", L"", //11-15 @@ -3359,8 +3565,13 @@ STR16 pMiscMapScreenMouseRegionHelpText[] = // male version of where equipment is left STR16 pMercHeLeaveString[] = { +#ifdef JA2UB + L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Drassen (B13) dopo aver preso il volo da Tracona?", + L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Omerta (A9) dopo aver preso il volo da Tracona?", +#else L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Drassen (B13) dopo aver preso il volo da Arulco?", L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Omerta (A9) dopo aver preso il volo da Arulco?", +#endif L"sta per partire e spedirà il suo equipaggiamento a Omerta (A9).", L"sta per partire e spedirà il suo equipaggiamento a Drassen (B13).", L"%s sta per partire e spedirà il suo equipaggiamento a %s.", @@ -3370,8 +3581,13 @@ STR16 pMercHeLeaveString[] = // female version STR16 pMercSheLeaveString[] = { +#ifdef JA2UB + L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Drassen (B13) dopo aver preso il volo da Tracona?", + L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Omerta (A9) dopo aver preso il volo da Tracona?", +#else L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Drassen (B13) dopo aver preso il volo da Arulco?", L"Volete che %s lasci il suo equipaggiamento dove si trova ora (%s) o in seguito a Omerta (A9) dopo aver preso il volo da Arulco?", +#endif L"sta per partire e spedirà il suo equipaggiamento a Omerta (A9).", L"sta per partire e spedirà il suo equipaggiamento a Drassen (B13).", L"%s sta per partire e spedirà il suo equipaggiamento a %s.", @@ -3723,8 +3939,10 @@ STR16 pWebPagesTitles[] = L"", L"URL non ritrovato.", L"Bobby Ray - Spedizioni recenti", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4688,7 +4906,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"Lo spazio su disco si sta esaurendo. Sono disponibili solo %d MB, mentre per giocare a Jagged dovrebbero esserci almeno %d MB liberi .", - L"Salvataggio in corso...", //When saving a game, a message box with this string appears on the screen + L"Salvataggio in corso", //When saving a game, a message box with this string appears on the screen L"Armi normali", L"Tonn. di armi", @@ -4703,8 +4921,10 @@ STR16 zSaveLoadText[] = L"Excellent Selection", L"Awesome Selection", - L"New Inventory does not work in 640x480 screen size. Please resize and try again.", + L"New Inventory does not work in 640x480 screen resolution. Please increase the screen resolution and try again.", L"New Inventory does not work from the default 'Data' folder.", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", }; @@ -4923,7 +5143,7 @@ STR16 zOptionsScreenHelpText[] = L"When ON, you will hear rain noises when it is raining.", L"When ON, the crows are present in game.", L"When ON, a tooltip window is shown when pressing |A|l|t and hovering cursor over an enemy.", - L"When ON, game will be saved after each players turn.", + L"When ON, game will be saved in 2 alternate save slots after each players turn.", L"When ON, Skyrider will not talk anymore.", //L"When ON, game will run with much lower CPU usage.", L"When ON, enhanced descriptions will be shown for items and weapons.", @@ -4956,9 +5176,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"INSTALLAZIONE INIZIALE DEL GIOCO", +#ifdef JA2UB + L"Random Manuel texts", + L"Off", + L"On", +#else L"Versione del gioco", L"Realistica", L"Fantascientifica", +#endif L"Platinum", //Placeholder English L"Opzioni delle armi", L"Available Arsenal", // changed by SANDRO @@ -4999,9 +5225,15 @@ STR16 gzGIOScreenText[] = L"Enemies Drop All Items", L"Off", L"On", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"Number of Terrorists", L"Random", L"All", +#endif L"Secret Weapon Caches", L"Random", L"All", @@ -5016,6 +5248,12 @@ STR16 gzGIOScreenText[] = L"Old / Old", L"New / Old", L"New / New", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5300,7 +5538,7 @@ STR16 pMessageStrings[] = L"Non potete permettervi di pagare a %s un salario giornaliero di %s", //first %s is the mercs name, the seconds is a string containing the salary L"Salta", L"%s non può andarsene da solo.", - L"Un salvataggio è stato chiamato SaveGame99.sav. Se necessario, rinominatelo da SaveGame01 a SaveGame10 e così potrete accedervi nella schermata di caricamento.", + L"Un salvataggio è stato chiamato SaveGame249.sav. Se necessario, rinominatelo da SaveGame01 a SaveGame10 e così potrete accedervi nella schermata di caricamento.", L"%s ha bevuto del %s", L"Un pacco è arivato a Drassen.", L"%s dovrebbe arrivare al punto designato di partenza (settore %s) nel giorno %d, approssimativamente alle ore %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival @@ -5316,14 +5554,28 @@ STR16 pMessageStrings[] = L"Normal turn mode", L"Exit combat mode", L"Forced Turn Mode Active, Entering Combat", -#ifdef JA2BETAVERSION L"Salvataggio riuscito della partita nello slot End Turn Auto Save.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved. L"Client", // TODO.Translate L"You cannot use the Old Inventory and the New Attachment System at the same time.", + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5385,6 +5637,10 @@ STR16 gzLaptopHelpText[] = L"Impresa di pompe funebri McGillicutty", L"Servizio Fioristi Riuniti", L"Contratti assicurativi per agenti A.I.M.", + //New Bookmarks + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5586,8 +5842,11 @@ STR16 gzLateLocalizedString[] = L"Tutti i vostri mercenari sono stati bendati.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", - +#endif L"(tetto)", L"Salute: %d/%d", @@ -6845,4 +7104,37 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"Distanza dal bersaglio: %d caselle, Luminosità: %d/%d", + L"Colleghi il trasmettitore al tuo computer portatile.", + L"Non puoi permetterti di ingaggiare %s", + L"Per un periodo limitato, la tariffa qui sopra includerà i costi dell'intera missione, oltre all'equipaggiamento indicato sotto.", + L"Assolda %s adesso e approfitta della nostra nuova tariffa 'tutto incluso'. Compreso in questa incredibile offerta anche l'equipaggiamento personale del mercenario, senza alcun costo aggiuntivo.", + L"Tariffa", + L"C'è qualcun altro nel settore...", + //L"Gittata dell'arma: %d caselle, Probabilità di colpire: %d percent", + L"Mostra nascondigli", + L"Linea di Vista", + L"Le nuove reclute non possono arrivare qui.", + L"Poiché il tuo portatile non ha un trasmettitore, non potrai assoldare nuovi mercenari. Forse questo sarebbe un buon momento per caricare una partita salvata o ricominciare daccapo!", + L"%s sente venire da sotto al corpo di Jerry il rumore di metallo che si accartoccia. E' un suono fastidioso, come se l'antenna del tuo portatile venisse schiacciata.", //the %s is the name of a merc. + L"Dopo aver dato un'occhiata al biglietto lasciato dal Vice Comandante Morris, %s vede una possibilità. La nota contiene le coordinate per il lancio di missili contro diverse città ad Arulco. C'è anche la locazione della base di lancio: la fabbrica di missili.", + L"Guardando il pannello di controllo %s immagina che i numeri possano essere invertiti, cosicché il missile distrugga proprio questa fabbrica. %s deve trovare una via di fuga. L'ascensore sembra offrire la soluzione più rapida...", + L"Questa è una partita a livello IRON MAN: non puoi salvare quando ci sono nemici nei dintorni.", + L"(Non puoi salvare durante il combattimento.)", + L"Il nome della campagna è più grande di 30 caratteri", + L"Campagna non trovata.", + L"Campagna: Default ( %S )", + L"Campagna: %S", + L"Hai selezionato la campagna %S. Questa campagna è una versione amatoriale della campagna originale di Unfinished Business. Sei sicuro di voler giocare la campagna %S?", + L"Per usare l'editor, selezionare una campagna diversa da quella di default.", +}; #endif //ITALIAN diff --git a/Utils/_Ja25ChineseText.cpp b/Utils/_Ja25ChineseText.cpp index aaa0e047..1931812d 100644 --- a/Utils/_Ja25ChineseText.cpp +++ b/Utils/_Ja25ChineseText.cpp @@ -19,35 +19,6 @@ void this_is_the_Ja25ChineseText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"目标的è·ç¦»: %dæ ¼, 亮度: %d/%d", - L"å°†å‘æŠ¥æœºè£…åˆ°ç¬”è®°æœ¬ç”µè„‘ä¸Šã€‚", - L"你无法支付雇佣%s的费用", - L"在é™å®šæ—¶é—´å†…,以上的费用包括了整个行动和下列装备的花费。", - L"现在就雇请%så§ã€‚您å¯ä»¥äº«å—我们æä¾›çš„空å‰çš„“一次付费,全部æœåŠ¡â€çš„优惠价格。在这个难以置信的出价里,佣兵的éšèº«è£…备是å…费的哦。", - L"费用", - L"在本分区å‘现有人……", - //L"枪的射程: %d格, 命中率: %dï¼…", - L"显示覆盖物", - L"视è·", - L"新雇请的佣兵无法到达那里。", - L"ç”±äºŽä½ çš„ç¬”è®°æœ¬ç”µè„‘æ²¡æœ‰å‘æŠ¥æœºï¼Œä½ æ— æ³•é›‡è¯·æ–°çš„é˜Ÿå‘˜ã€‚ä¹Ÿè®¸ä½ å¾—è¯»å–å­˜æ¡£æˆ–è€…é‡æ–°å¼€å§‹æ¸¸æˆï¼", - L"%så¬åˆ°äº†Jerry的身体下é¢ä¼ æ¥é‡‘属的破碎的声音。å¬èµ·æ¥ä»¤äººä¸å®‰ï¼Œä¼¼ä¹Žä½ çš„笔记本电脑的天线被压断了。", - L"看完副指挥官Morris留下的备忘录åŽï¼Œ%s觉得有机会了。备忘录里有å‘Arulcoå„个城镇å‘å°„å¯¼å¼¹çš„åŸºåœ°çš„åæ ‡ã€‚它还给出了这个罪æ¶è®¡åˆ’çš„å‘æºåœ°çš„åæ ‡ —— 导弹工厂。", - L"çœ‹åˆ°äº†æŽ§åˆ¶é¢æ¿åŽï¼Œ %så‘现它正在倒计时,因此导弹会把这个工厂炸æ¯ã€‚%så¾—æ‰¾å‡ºä¸ªè„±é€ƒçš„è·¯çº¿ã€‚ä½¿ç”¨ç”µæ¢¯çœ‹èµ·æ¥æ˜¯æœ€å¿«çš„办法...", - L"现在您在é“人模å¼è¿›è¡Œæ¸¸æˆï¼Œå‘¨å›´æœ‰æ•Œäººçš„æ—¶å€™ä¸èƒ½å­˜æ¡£ã€‚", - L"(ä¸èƒ½åœ¨æˆ˜æ–—时存盘)", - L"当å‰çš„æˆ˜å½¹å称超过了30个字符。", - L"无法找到当å‰çš„æˆ˜å½¹ã€‚", // @@@ new text - L"战役: 默认 ( %S )", // @@@ new text - L"战役: %S", // @@@ new text - L"你选择了%S战役。 该战役是原版UB战役的玩家自定义游æˆç‰ˆæœ¬ã€‚你确认你è¦åœ¨ %S 战役下进行游æˆå—?", - L"如果你è¦ä½¿ç”¨ç¼–辑器的è¯ï¼Œè¯·é€‰æ‹©ä¸€ä¸ªæˆ˜å½¹ï¼Œä¸è¦ç”¨é»˜è®¤æˆ˜å½¹ã€‚", -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp STR16 gzIMPSkillTraitsText[]= { @@ -219,6 +190,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"上/下房顶所需行动点 -%d%s\n",// L"-%d%s APs needed to climb on/off roof and jump obstacles\n", L"踢门æˆåŠŸçŽ‡ +%d%s\n",// L"+%d%s chance to kick doors\n", L"ä½ çš„è‚‰ææ”»å‡»å°†æœ‰ç‰¹æ®Šçš„动画效果\n",// L"You gain special animations for hand to hand combat\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -234,6 +206,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(å åŠ æ•ˆæžœæœ€å¤šæ˜¯ %d 次)\n",// L"(Max simultaneous bonuses for one soldier is %d)\n", L"+%d%s %sçš„ææƒ§æŠµæŠ—力 (程åºå‚数问题åªèƒ½ç”¨è¿™ä¸ªè¯­åº)\n",// L"+%d%s fear resistence of %s\n", L"缺陷: ä¼šç»™å…¶ä»–äººé€ æˆ %d å€çš„士气下é™, 如果 %s çš„é˜µäº¡çš„è¯ (程åºå‚数问题åªèƒ½ç”¨è¿™ä¸ªè¯­åº)\n",// L"Drawback: %dx morale loss for %s's death for all other mercs\n", + L"+%d%s chance to trigger collective interrupts\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -322,6 +295,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"æ½œè¡Œä¿æŒæ— å£°çš„几率 +%d%s\n",// L"+%d%s chance to move quietly\n", L"éšè”½æ€§ +%d%s (没被å‘现时就是“éšå½¢â€çжæ€)\n",// L"+%d%s stealth (being 'invisible' if unnoticed)\n", L"é™ä½Žç§»åŠ¨ç»™éšè”½ç¨‹åº¦ %d%s 的惩罚\n",// L"Reduced cover penalty for movement by %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25DutchText.cpp b/Utils/_Ja25DutchText.cpp index 10cd1be0..580d7085 100644 --- a/Utils/_Ja25DutchText.cpp +++ b/Utils/_Ja25DutchText.cpp @@ -19,33 +19,6 @@ void this_is_the_Ja25DutchText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"Range to target: %d tiles, Brightness: %d/%d", - L"Attaching the transmitter to your laptop computer.", - L"You cannot afford to hire %s", - L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", - L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", - L"Fee", - L"There is someone else in the sector...", - //L"Gun Range: %d tiles, Chance to hit: %d percent", - L"Display Cover", - L"Line of Sight", - L"New Recruits cannot arrive there.", - L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", - L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified - L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", - L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", - L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text - L"(Cannot save during combat)", //@@@@ new text - L"The current campaign name is greater than 30 characters.", // @@@ new text - L"The current campaign cannot be found.", // @@@ new text - L"Campaign: Default ( %S )", // @@@ new text - L"Campaign: %S", // @@@ new text - L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text - L"In order to use the editor, please select a campaign other than the default.", ///@@new -}; - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp @@ -219,6 +192,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s APs needed to climb on/off roof and jump obstacles\n", L"+%d%s chance to kick doors\n", L"You gain special animations for hand to hand combat\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -234,6 +208,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Max simultaneous bonuses for one soldier is %d)\n", L"+%d%s fear resistence of %s\n", L"Drawback: %dx morale loss for %s's death for all other mercs\n", + L"+%d%s chance to trigger collective interrupts\n", }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -322,6 +297,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s chance to move quietly\n", L"+%d%s stealth (being 'invisible' if unnoticed)\n", L"Reduced cover penalty for movement by %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25DutchText.h b/Utils/_Ja25DutchText.h index 5badfb39..ad6e5688 100644 --- a/Utils/_Ja25DutchText.h +++ b/Utils/_Ja25DutchText.h @@ -1,35 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - // TCTL_MSG__GUN_RANGE_AND_CTH, - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25EnglishText.cpp b/Utils/_Ja25EnglishText.cpp index fa5da795..b8349db2 100644 --- a/Utils/_Ja25EnglishText.cpp +++ b/Utils/_Ja25EnglishText.cpp @@ -19,33 +19,6 @@ void this_is_the_Ja25EnglishText_public_symbol(void); // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"Range to target: %d tiles, Brightness: %d/%d", - L"Attaching the transmitter to your laptop computer.", - L"You cannot afford to hire %s", - L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", - L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", - L"Fee", - L"There is someone else in the sector...", - //L"Gun Range: %d tiles, Chance to hit: %d percent", - L"Display Cover", - L"Line of Sight", - L"New Recruits cannot arrive there.", - L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", - L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified - L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", - L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", - L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text - L"(Cannot save during combat)", //@@@@ new text - L"The current campaign name is greater than 30 characters.", // @@@ new text - L"The current campaign cannot be found.", // @@@ new text - L"Campaign: Default ( %S )", // @@@ new text - L"Campaign: %S", // @@@ new text - L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text - L"In order to use the editor, please select a campaign other than the default.", ///@@new -}; - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp @@ -219,6 +192,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s APs needed to climb on/off roof and jump obstacles\n", L"+%d%s chance to kick doors in\n", // MINTY - Changed to "kick doors in" L"You gain special animations for hand to hand combat\n", + L"-%d%s chance to be interrupted when moving\n", }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -234,6 +208,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Max simultaneous bonuses for one soldier is %d)\n", L"+%d%s fear resistence of %s\n", L"Drawback: %dx morale loss for %s's death for all other mercs\n", + L"+%d%s chance to trigger collective interrupts\n", }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -322,6 +297,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s chance to move quietly\n", L"+%d%s stealth (being 'invisible' if unnoticed)\n", L"Reduced cover penalty for movement by %d%s\n", + L"-%d%s chance to be interrupted\n", }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25EnglishText.h b/Utils/_Ja25EnglishText.h index aaf91910..fd29cc75 100644 --- a/Utils/_Ja25EnglishText.h +++ b/Utils/_Ja25EnglishText.h @@ -1,36 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, // CPT: not used anymore moved to other array - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, // CPT: not used, moved to other array - //TCTL_MSG__RANGE_TO_TARGET_AND_GUN_RANGE, // WANNE: Not used - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25FrenchText.cpp b/Utils/_Ja25FrenchText.cpp index 18a3ef0a..ebe94f2f 100644 --- a/Utils/_Ja25FrenchText.cpp +++ b/Utils/_Ja25FrenchText.cpp @@ -19,32 +19,6 @@ void this_is_the_Ja25FrenchText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"Distance cible: %d tiles, Brightness: %d/%d", - L"Attachez le transpondeur à votre PC portable.", - L"Vous n'avez pas les moyens d'engager %s", - L"Pour une durée limitée, les frais ci-dessus couvrent la mission entière, équipement ci-dessous compris.", - L"Engagez %s et découvrez dès à présent notre prix \"tout compris\". Aussi inclus dans cette incroyable offre, l'équipement personnel du mercenaire sans frais supplémentaires.", - L"Frais", - L"Il y a quelqu'un d'autre dans le secteur...", - //L"Portée arme: %d tiles, de chances: %d pourcent", - L"Afficher couverture", - L"Ligne de vision", - L"Les nouvelles recrues ne peuvent arriver ici.", - L"Comme votre PC n'a pas de transpondeur, vous ne pouvez engager de nouvelles recrues. Revenez à une sauvegarde précédente et réessayez.", - L"%s entend le son de métal broyé provenant d'en dessous du corps de Jerry. On dirait que l'antenne de votre PC ne sers plus à rien.", //the %s is the name of a merc. @@@ Modified - L"Apres avoir scanné la note laissée par le Deputy Commander Morris, %s sent une oppurtinité. La note contient les coordonnées pour le lancement de missiles sur Arulco. Elle contient aussi l'emplacement de l'usine d'où les missiles proviennent.", - L"En examinant le panneau de contrôle, %s s'aperçoît que les chiffres peuvent être inversés pour que les missiles détruisent cette même usine. %s a besoin de trouver un chemin pour s'enfuir. L'ascenseur semble être la solution la plus rapide...", - L"Ceci est un jeu IRON MAN et vous ne pouvez pas sauvegarder s'il ya des ennemis dans les parages.", // @@@ new text - L"(ne peut sauvegarder en plein combat)", //@@@@ new text - L"Le nom de la campagne actuelle est supérieur à 30 lettres.", // @@@ new text - L"La campagne actuelle est introuvable.", // @@@ new text - L"Campagne: Par défaut ( %S )", // @@@ new text - L"Campagne: %S", // @@@ new text - L"Vous avez choisi la campagne %S. Cette campagne est un mod d'Unfinished Business. Etes-vous sûr de vouloir jouer la campagne %S ?", // @@@ new text - L"Pour pouvoir utiliser l'éditeur, veuillez choisir une autre campagne que celle par défaut.", ///@@new -}; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings @@ -218,6 +192,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s du nombre de PA nécessaire pour monter/descendre du toit et sauter les obstacles\n", L"+%d%s de chance d'ouvrir la porte\n", L"Vous obtenez une animation spéciale pour votre combat au corps-à-corps\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -233,6 +208,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Le maximum de bonus simultanés pour un joueur est de %d)\n", L"+%d%s de crainte de résistance à %s\n", L"Inconvénient: %dx perte de moral à la mort de %s pour les autres mercenaires\n", + L"+%d%s chance to trigger collective interrupts\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -321,6 +297,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s de chance de bouger silencieusement\n", L"+%d%s en discrétion (étant 'invisible si inaperçu)\n", L"Réduit la pénalité dû au déplacement silencieux de %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25FrenchText.h b/Utils/_Ja25FrenchText.h index 9f4599a0..ad6e5688 100644 --- a/Utils/_Ja25FrenchText.h +++ b/Utils/_Ja25FrenchText.h @@ -1,35 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25GermanText.cpp b/Utils/_Ja25GermanText.cpp index 3a07e6b1..28fd2317 100644 --- a/Utils/_Ja25GermanText.cpp +++ b/Utils/_Ja25GermanText.cpp @@ -19,35 +19,6 @@ void this_is_the_Ja25GermanText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"Entfernung zum Ziel: %d Felder, Helligkeit: %d/%d", - L"Verbinden Sie den Transmitter mit Ihrem Laptop-Computer.", - L"Sie haben nicht genug Geld, um %s anzuheuern", - L"Das obenstehende Honorar deckt für einen begrenzten Zeitraum die Kosten der Gesamtmission, und schließt untenstehendes Equipment mit ein.", - L"Engagieren Sie %s jetzt und nutzen Sie den Vorteil unseres beispiellosen 'Ein Betrag für alles'-Honorars. Das persönliche Equipment des Söldners ist gratis in diesem Preis mit inbegriffen.", - L"Honorar", - L"Da ist noch jemand im Sektor...", - //L"Waffen-Rchwt.: %d Felder, Trefferwahrsch.: %d Prozent", - L"Deckung anzeigen", - L"Sichtfeld", - L"Neue Rekruten können dort nicht hinkommen.", - L"Da Ihr Laptop keinen Transmitter besitzt, können Sie keine neuen Teammitglieder anheuern. Vielleicht ist dies eine guter Zeitpunkt, ein gespeichertes Spiel zu laden oder ein neues zu starten!", - L"%s hört das Geräusch knirschenden Metalls unter Jerry hervordringen. Es klingt grässlich - die Antenne ihres Laptop-Computers ist zerstört.", //the %s is the name of a merc. @@@ Modified - L"Nach Ansehen des Hinweises, den Commander Morris hinterließ, erkennt %s eine einmalige Gelegenheit. Der Hinweis enthält Koordinaten für den Start von Raketen gegen verschiedene Städte in Arulco. Aber er enthält auch die Koordinaten des Startpunktes - der Raketenanlage.", - L"Das Kontroll-Board studierend, entdeckt %s, dass die Zahlen umgedreht werden könnten, so dass die Raketen diese Anlage selbst zerstören. %s muss nun einen Fluchtweg finden. Der Aufzug scheint die schnellstmögliche Route zu bieten...", //!!! The original reads: L"Noticing the control panel %s, figures the numbers can be reversed..." That sounds odd for me, but I think the comma is placed one word too late... (correct?) - L"Dies ist ein IRON MAN-Spiel, und es kann nicht gespeichert werden, wenn sich Gegner in der Nähe befinden.", - L"(Kann während Kampf nicht speichern)", - L"Der Name der aktuellen Kampagne enthält mehr als 30 Buchstaben.", - L"Die aktuelle Kampagne kann nicht gefunden werden.", - L"Kampagne: Standard ( %S )", - L"Kampagne: %S", - L"Sie haben die Kampagne %S gewählt. Diese ist eine vom Spieler modifizierte Version der Originalkampagne von JA2UB. Möchten Sie die Kampagne %S spielen?", - L"Um den Editor zu benutzen, müssen Sie eine andere als die Standardkampgane auswählen.", -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp STR16 gzIMPSkillTraitsText[]= { @@ -219,6 +190,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s APs benötigt um auf oder von Dächern zu klettern und Hindernisse zu überspringen\n", L"+%d%s Chance eine Tür erfolgreich einzutreten\n", L"Sie erhalten besondere Kung-Fu-Animationen für den Nahkampf\n", + L"-%d%s Wahrscheinlichkeit um unterbrochen zu werden wenn man sich bewegt\n", }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -234,6 +206,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Maximal auf einen Söldner wirkende Boni: %d )\n", L"+%d%s Resistenz gegen Angst für %s\n", L"Nachteil: %dx Moralverlust bei Tod des %ss für alle anderen Söldner\n", + L"+%d%s Wahrscheinlichkeit für kollektive Unterbrechungen\n", }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -322,6 +295,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s Chance beim Schleichen kein Geräusch zu erzeugen zu sein\n", L"+%d%s Chance, 'unsichtbar' zu sein wenn man sich nicht verrät (schleichen)\n", L"Der Abzug der berechneten Sichtdeckung beim Bewegen ist %d%s geringer\n", + L"-%d%s Wahrscheinlichkeit um unterbrochen zu werden\n", }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25GermanText.h b/Utils/_Ja25GermanText.h index 5f2291e7..ba76eaed 100644 --- a/Utils/_Ja25GermanText.h +++ b/Utils/_Ja25GermanText.h @@ -1,36 +1,6 @@ #ifndef _JA25GERMANTEXT__H_ #define _JA25GERMANTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, - //TCTL_MSG__RANGE_TO_TARGET_AND_GUN_RANGE, // WANNE: Not used - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25ItalianText.cpp b/Utils/_Ja25ItalianText.cpp index cef8a653..5e2a62f3 100644 --- a/Utils/_Ja25ItalianText.cpp +++ b/Utils/_Ja25ItalianText.cpp @@ -19,33 +19,6 @@ void this_is_the_Ja25ItalianText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"Distanza dal bersaglio: %d caselle, Luminosità: %d/%d", - L"Colleghi il trasmettitore al tuo computer portatile.", - L"Non puoi permetterti di ingaggiare %s", - L"Per un periodo limitato, la tariffa qui sopra includerà i costi dell'intera missione, oltre all'equipaggiamento indicato sotto.", - L"Assolda %s adesso e approfitta della nostra nuova tariffa 'tutto incluso'. Compreso in questa incredibile offerta anche l'equipaggiamento personale del mercenario, senza alcun costo aggiuntivo.", - L"Tariffa", - L"C'è qualcun altro nel settore...", - //L"Gittata dell'arma: %d caselle, Probabilità di colpire: %d percent", - L"Mostra nascondigli", - L"Linea di Vista", - L"Le nuove reclute non possono arrivare qui.", - L"Poiché il tuo portatile non ha un trasmettitore, non potrai assoldare nuovi mercenari. Forse questo sarebbe un buon momento per caricare una partita salvata o ricominciare daccapo!", - L"%s sente venire da sotto al corpo di Jerry il rumore di metallo che si accartoccia. E' un suono fastidioso, come se l'antenna del tuo portatile venisse schiacciata.", //the %s is the name of a merc. - L"Dopo aver dato un'occhiata al biglietto lasciato dal Vice Comandante Morris, %s vede una possibilità. La nota contiene le coordinate per il lancio di missili contro diverse città ad Arulco. C'è anche la locazione della base di lancio: la fabbrica di missili.", - L"Guardando il pannello di controllo %s immagina che i numeri possano essere invertiti, cosicché il missile distrugga proprio questa fabbrica. %s deve trovare una via di fuga. L'ascensore sembra offrire la soluzione più rapida...", - L"Questa è una partita a livello IRON MAN: non puoi salvare quando ci sono nemici nei dintorni.", - L"(Non puoi salvare durante il combattimento.)", - L"Il nome della campagna è più grande di 30 caratteri", - L"Campagna non trovata.", - L"Campagna: Default ( %S )", - L"Campagna: %S", - L"Hai selezionato la campagna %S. Questa campagna è una versione amatoriale della campagna originale di Unfinished Business. Sei sicuro di voler giocare la campagna %S?", - L"Per usare l'editor, selezionare una campagna diversa da quella di default.", -}; - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp @@ -217,6 +190,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s APs needed to climb on/off roof and jump obstacles\n", L"+%d%s chance to kick doors\n", L"You gain special animations for hand to hand combat\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -232,6 +206,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Max simultaneous bonuses for one soldier is %d)\n", L"+%d%s fear resistence of %s\n", L"Drawback: %dx morale loss for %s's death for all other mercs\n", + L"+%d%s chance to trigger collective interrupts\n", }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -320,6 +295,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s chance to move quietly\n", L"+%d%s stealth (being 'invisible' if unnoticed)\n", L"Reduced cover penalty for movement by %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25ItalianText.h b/Utils/_Ja25ItalianText.h index 9f4599a0..ad6e5688 100644 --- a/Utils/_Ja25ItalianText.h +++ b/Utils/_Ja25ItalianText.h @@ -1,35 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25PolishText.cpp b/Utils/_Ja25PolishText.cpp index 11d0cc94..566398c4 100644 --- a/Utils/_Ja25PolishText.cpp +++ b/Utils/_Ja25PolishText.cpp @@ -20,33 +20,6 @@ void this_is_the_Ja25PolishText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"OdlegÅ‚ość od celu (w polach): %d, Jasność = %d/%d", - L"Nadajnik zostaÅ‚ podłączony do twojego laptopa.", - L"Nie mo¿esz zatrudnić %s(a)", - L"Na okreÅ›lony czas, poni¿sze honorarium pokryje koszt caÅ‚ej misji razem z wyposażeniem zamieszonym poniżej.", - L"Zatrudnij %s(a) już teraz i weź udziaÅ‚ naszej promocji 'jedno honorarium pokrywa wszystko'. Ponadto w tej niewiarygodnej ofercie caÅ‚y ekwipunek najemnika dostaniesz za darmo.", - L"Honorarium", - L"KtoÅ› jest w sektorze...", - //L"ZasiÄ™g broni (w polach): %d, Szansa na trafienie: %d procent", - L"Pokaż osÅ‚onÄ™", - L"ZasiÄ™g wzroku", - L"Nowi rekruci nie mogÄ… tam przybyć.", - L"Dopóki twój laprop bÄ™dzie bez nadajnika, nie bÄ™dziesz mógÅ‚ zatrudniać nowych czÅ‚onków zespoÅ‚u. Możliwe, że to odpowiedni moment żeby odczytać zapisany stan gry lub zacząć grać od nowa!", - L"%s sÅ‚yszy dźwiÄ™k zgniatanego metalu dochodzÄ…cy spod ciaÅ‚a Jerrego. To niestety zabrzmiaÅ‚o jak dźwiÄ™k zgniatanej anteny od twojego laptopa.", //the %s is the name of a merc. @@@ Modified - L"Po przejżeniu notatki zostawionej przez zastÄ™pce dowódcy Morris'a, %s zauważa pewnÄ… możliwość. Notatka zawiera koordynaty do wystrzelenia pocisków w dwa miasteczka w Arulco. SÄ… na niej również koordynaty z których te pociski zostanÄ… wystrzelone - wojskowej placówki.", - L"PrzyglÄ…dajÄ…c siÄ™ panelowi kontrolnemu, %s zauważa, że cyfry można odwrócić, tak, że pociski mogÄ… zniszczyć tÄ… placówkÄ™. %s musi znaleźć drogÄ™ ucieczki. Wydaje siÄ™, że winda jest najszybszym rozwiÄ…zaniem...", - L"To jest tryb CZ£OWIEK ZE STALI i nie możesz zapisywać gry gdy wróg jest w sektorze.", // @@@ new text - L"(Nie można zapisywać gry podczas walki)", //@@@@ new text - L"Kampania ma wiÄ™cej niż 30 postaci.", // @@@ new text - L"Nie można odnaleźć kampanii.", // @@@ new text - L"Kampania: Standardowa ( %S )", // @@@ new text - L"Kampania: %S", // @@@ new text - L"WybraÅ‚eÅ› kampaniÄ™ %S. Ta kampania zostaÅ‚a stworzona przez fanów gry. Czy jesteÅ› pewien, że chcesz w niÄ… zagrać?", // @@@ new text - L"Å»eby użyć edytora powinieneÅ› wczeÅ›niej wybrać kampaniÄ™ innÄ… niż standardowa.", ///@@new -}; - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp @@ -219,6 +192,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s APs needed to climb on/off roof and jump obstacles\n", L"+%d%s chance to kick doors in\n", // MINTY - Changed to "kick doors in" L"You gain special animations for hand to hand combat\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -234,6 +208,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Max simultaneous bonuses for one soldier is %d)\n", L"+%d%s fear resistence of %s\n", L"Drawback: %dx morale loss for %s's death for all other mercs\n", + L"+%d%s chance to trigger collective interrupts\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -322,6 +297,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s chance to move quietly\n", L"+%d%s stealth (being 'invisible' if unnoticed)\n", L"Reduced cover penalty for movement by %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25PolishText.h b/Utils/_Ja25PolishText.h index 9f4599a0..ad6e5688 100644 --- a/Utils/_Ja25PolishText.h +++ b/Utils/_Ja25PolishText.h @@ -1,35 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25RussianText.cpp b/Utils/_Ja25RussianText.cpp index 7c2222c7..ef617b14 100644 --- a/Utils/_Ja25RussianText.cpp +++ b/Utils/_Ja25RussianText.cpp @@ -19,33 +19,6 @@ void this_is_the_Ja25RussianText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"РаÑÑтоÑние до цели: %d ед., ОÑвещенноÑть: %d/%d", - L"Передатчик подключен к вашему ноутбуку.", - L"Ð’Ñ‹ не можете нанÑть %s", - L"Предложение дейÑтвует ограниченное Ð²Ñ€ÐµÐ¼Ñ Ð¸ покрывает ÑтоимоÑть найма на вÑÑŽ миÑÑию, Ð¿Ð»ÑŽÑ Ð²Ñ‹ так же получите оборудование, перечиÑленное ниже.", - L"Ðаемник %s - наше невероÑтное Ñуперпредложение 'одна плата за вÑе'. Ð’Ñ‹ также беÑплатно получите его перÑональную Ñкипировку.", - L"Гонорар", - L"Ð’ Ñекторе кто-то еÑть...", - //L"ДальнобойноÑть оружиÑ: %d ед., Ð¨Ð°Ð½Ñ Ð¿Ð¾Ð¿Ð°Ñть: %d%%", - L"Показать укрытиÑ", - L"Ð›Ð¸Ð½Ð¸Ñ Ð¿Ñ€Ð¸Ñ†ÐµÐ»Ð°", - L"Ðовые наемники не могут выÑадитьÑÑ Ð·Ð´ÐµÑÑŒ.", - L"Так как ваш ноутбук лишилÑÑ Ð°Ð½Ñ‚ÐµÐ½Ð½Ñ‹, то вы не Ñможете нанÑть новых наемников. Возможно, ÑÐµÐ¹Ñ‡Ð°Ñ Ð²Ð°Ð¼ Ñтоит загрузить одну из Ñохраненных игр, или начать игру заново!", - L"%s Ñлышит металличеÑкий хруÑÑ‚ под телом Джерри. КажетÑÑ, Ñто чмо Ñломало антенну вашего ноутбука.", //the %s is the name of a merc. - L"ПоÑле Ð¿Ñ€Ð¾Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿Ð¸Ñей, оÑтавленных помощником командира МорриÑа, %s видит, что не вÑе еще потерÑно. Ð’ запиÑке ÑодержатÑÑ ÐºÐ¾Ð¾Ñ€Ð´Ð¸Ð½Ð°Ñ‚Ñ‹ городов Ðрулько Ð´Ð»Ñ Ð·Ð°Ð¿ÑƒÑка по ним ракет. Кроме того, там также указаны координаты Ñамой ракетной базы.", - L"Изучив панель управлениÑ, %s понимает, что координаты цели можно изменить, и тогда ракета уничтожит Ñту базу. %s не ÑобираетÑÑ ÑƒÐ¼Ð¸Ñ€Ð°Ñ‚ÑŒ, а значит нужно быÑтрее отÑюда выбиратьÑÑ. Похоже, что Ñамый быÑтрый ÑпоÑоб Ñто лифт...", - L"Ð’ начале игры вы выбрали Ñохранение лишь в \"мирное времÑ\" и теперь не можете запиÑыватьÑÑ Ð²Ð¾ Ð²Ñ€ÐµÐ¼Ñ Ð±Ð¾Ñ.", - L"(ÐÐµÐ»ÑŒÐ·Ñ ÑохранÑтьÑÑ Ð²Ð¾ Ð²Ñ€ÐµÐ¼Ñ Ð±Ð¾Ñ)", - L"Ð¢ÐµÐºÑƒÑ‰Ð°Ñ ÐºÐ°Ð¼Ð¿Ð°Ð½Ð¸Ñ Ð´Ð»Ð¸Ð½Ð½ÐµÐµ 30 Ñимволов.", - L"Ð¢ÐµÐºÑƒÑ‰Ð°Ñ ÐºÐ°Ð¼Ð¿Ð°Ð½Ð¸Ñ Ð½Ðµ найдена.", - L"КампаниÑ: По умолчанию ( %S )", - L"КампаниÑ: %S", - L"Ð’Ñ‹ выбрали кампанию %S. Эта ÐºÐ°Ð¼Ð¿Ð°Ð½Ð¸Ñ ÑвлÑетÑÑ Ð¼Ð¾Ð´Ð¸Ñ„Ð¸ÐºÐ°Ñ†Ð¸ÐµÐ¹ оригинальной кампании Unfinished Business. Ð’Ñ‹ уверены, что хотите играть кампанию %S?", - L"Чтобы воÑпользоватьÑÑ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¾Ñ€Ð¾Ð¼, Ñмените кампанию по умолчанию на другую.", -}; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings //these strings match up with the defines in IMP Skill trait.cpp @@ -218,6 +191,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"нужно на %d%s ОД меньше чтобы Ñлезть/залезть на крышу и перепрыгнуть препÑÑ‚Ñтвие\n", L"+%d%s к шанÑу выбить дверь ногой\n", L"Ð’Ñ‹ получаете Ñпециальные Ð´Ð²Ð¸Ð¶ÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð°Ñ‚Ð°Ðº в ближнем бою\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -233,6 +207,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(МакÑимальное количеÑтво одновременных бонуÑов Ð´Ð»Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ Ñолдата %d)\n", L"+%d%s Ñопротивление Ñтраху у %s\n", L"ÐедоÑтаток: %dx кратное ухудшение боевого духа у наёмников еÑли погибает %s\n", + L"+%d%s chance to trigger collective interrupts\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -321,6 +296,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s двигатьÑÑ Ñ‚Ð¸Ñ…Ð¾\n", L"+%d%s к ÑкрытноÑти (быть 'невидимым' еÑли Ð²Ð°Ñ Ð½Ðµ обнаружили)\n", L"Уменьшение штрафа на видимоÑть в укрытии на %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25RussianText.h b/Utils/_Ja25RussianText.h index 9f4599a0..ad6e5688 100644 --- a/Utils/_Ja25RussianText.h +++ b/Utils/_Ja25RussianText.h @@ -1,35 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_Ja25TaiwaneseText.cpp b/Utils/_Ja25TaiwaneseText.cpp index 16baceca..8312bf67 100644 --- a/Utils/_Ja25TaiwaneseText.cpp +++ b/Utils/_Ja25TaiwaneseText.cpp @@ -19,32 +19,6 @@ void this_is_the_Ja25TaiwaneseText_public_symbol(void){;} // VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD -STR16 zNewTacticalMessages[]= -{ - //L"Range to target: %d tiles, Brightness: %d/%d", - L"Attaching the transmitter to your laptop computer.", - L"You cannot afford to hire %s", - L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", - L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", - L"Fee", - L"There is someone else in the sector...", - //L"Gun Range: %d tiles, Chance to hit: %d percent", - L"Display Cover", - L"Line of Sight", - L"New Recruits cannot arrive there.", - L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", - L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified - L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", - L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", - L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text - L"(Cannot save during combat)", //@@@@ new text - L"The current campaign name is greater than 30 characters.", // @@@ new text - L"The current campaign cannot be found.", // @@@ new text - L"Campaign: Default ( %S )", // @@@ new text - L"Campaign: %S", // @@@ new text - L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text - L"In order to use the editor, please select a campaign other than the default.", ///@@new -}; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - New STOMP laptop strings @@ -219,6 +193,7 @@ STR16 gzIMPMajorTraitsHelpTextsMartialArts[]= L"-%d%s APs needed to climb on/off roof and jump obstacles\n", L"+%d%s chance to kick doors\n", L"You gain special animations for hand to hand combat\n", + L"-%d%s chance to be interrupted when moving\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= @@ -234,6 +209,7 @@ STR16 gzIMPMajorTraitsHelpTextsSquadleader[]= L"(Max simultaneous bonuses for one soldier is %d)\n", L"+%d%s fear resistence of %s\n", L"Drawback: %dx morale loss for %s's death for all other mercs\n", + L"+%d%s chance to trigger collective interrupts\n", // TODO.Translate }; STR16 gzIMPMajorTraitsHelpTextsTechnician[]= @@ -322,6 +298,7 @@ STR16 gzIMPMinorTraitsHelpTextsStealthy[]= L"+%d%s chance to move quietly\n", L"+%d%s stealth (being 'invisible' if unnoticed)\n", L"Reduced cover penalty for movement by %d%s\n", + L"-%d%s chance to be interrupted\n", // TODO.Translate }; STR16 gzIMPMinorTraitsHelpTextsAthletics[]= diff --git a/Utils/_Ja25TaiwaneseText.h b/Utils/_Ja25TaiwaneseText.h index 9f4599a0..ad6e5688 100644 --- a/Utils/_Ja25TaiwaneseText.h +++ b/Utils/_Ja25TaiwaneseText.h @@ -1,35 +1,6 @@ #ifndef _JA25ENGLISHTEXT__H_ #define _JA25ENGLISHTEXT__H_ - -enum -{ - //TCTL_MSG__RANGE_TO_TARGET, - TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, - TACT_MSG__CANNOT_AFFORD_MERC, - TACT_MSG__AIMMEMBER_FEE_TEXT, - TACT_MSG__AIMMEMBER_ONE_TIME_FEE, - TACT_MSG__FEE, - TACT_MSG__SOMEONE_ELSE_IN_SECTOR, - //TCTL_MSG__GUN_RANGE_AND_CTH, - TCTL_MSG__DISPLAY_COVER, - TCTL_MSG__LOS, - TCTL_MSG__INVALID_DROPOFF_SECTOR, - TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, - TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, - TCTL_MSG__END_GAME_POPUP_TXT_1, - TCTL_MSG__END_GAME_POPUP_TXT_2, - TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, - TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, - TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, - TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, - TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, - TCTL_MSG__CAMPAIGN_LABEL, - TCTL_MSG__NEW_CAMPAIGN_CONFIRM, - TCTL_MSG__CANT_EDIT_DEFAULT, - -}; -extern STR16 zNewTacticalMessages[]; extern STR16 gzIMPSkillTraitsText[]; //////////////////////////////////////////////////////// diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 4af9bda4..0235d155 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -12,6 +12,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -116,6 +117,207 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; + +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Lokalizacje", //0 + L"Postacie", + L"Przedmioty", + L"Zadania", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"WejÅ“cie", +}; + +STR16 pOtherButtonsText[] = +{ + L"Odprawa", + L"Akceptuj", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Odprawa", + L"Akceptuj misje", +}; + + +STR16 pLocationPageText[] = +{ + L"Poprzednia str.", + L"ZdjÄ™cia", + L"NastÄ™pna str.", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Strona główna", + L">>", + L"Typ: ", + L"Brak danych", + L"Brak zdefiniowanych misji. Dodaj misje do pliku TableData\\BriefingRoom\\BriefingRoom.xml. Pierwsza misja ma byæ widoczna. Ustaw Hidden = 0", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Nieznane",// 0 - unknown + L"Miasto", //1 - cities + L"Wyrzutnia rakiet", //2 - SAM Site + L"Inna lokacja", //3 - other location + L"Kopalnia", //4 - mines + L"Kompleks militarny", //5 - military complex + L"Laboratorium", //6 - laboratory complex + L"Fabryka", //7 - factory complex + L"Szpital", //8 - hospital + L"WiÄ™zienie", //9 - prison + L"Port lotniczy", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Pokaż wszystko", + L"Pokaż AIM", + L"Pokaż MERC", + L"Pokaż RPC", + L"Pokaż NPC", + L"Pokaż Pojazd", + L"Pokaż IMP", + L"Pokaż EPC", + L"Filtr", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"Wszy.", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Pojazd", + L"IMP", + L"EPC", + L"Filtr", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Pokaż wszystko", + L"Pokaż miasta", + L"Pokaż wyrzutnie rakiet", + L"Pokaż inne lokacje", + L"Pokaż kopalnie", + L"Pokaż lokacje militarne", + L"Pokaż laboratoria", + L"Pokaż fabryki", + L"Pokaż szpitale", + L"Pokaż wiÄ™zienie", + L"Pokaż porty lotnicze", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"Wszy.", + L"Miasta", + L"W-R", + L"Inne", + L"Kop.", + L"Kom.M.", + L"Lab.", + L"Fabry.", + L"Szpit.", + L"WiÄ™z.", + L"Por.L.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"Wszystko", //0 + L"BroÅ„", + L"Amu.", + L"Oporz.", + L"Różne", + + L"Wszystko", //5 + L"BroÅ„", + L"Amunicja", + L"Oporz¹dzenie", + L"Różne", +}; + + +STR16 BoxFilter[] = +{ + // Guns + L"Inny", //0 + L"Pist.", + L"P.masz.", + L"K.masz.", + L"Kar.", + L"K.snaj.", + L"K.boj.", + L"L.k.m.", + L"Strz.", //8 + + // Ammo + L"Pist.", + L"P.masz.", + L"K.masz.", + L"Kar.", + L"K.snaj.", + L"K.boj.", + L"L.k.masz.", + L"Strz.", //16 + + // Used + L"BroÅ„", + L"Panc.", + L"Oporz.", + L"Różne", //20 + + // Armour + L"HeÅ‚my", + L"Kami.", + L"G.ochr.", + L"P.cer.", + + // Misc + L"Ostrza", + L"N.do.rzu.", + L"Punch.W.", + L"Gr.", + L"Bomby", + L"Apt.", + L"Ekwi.", + L"N.twa.", + L"Oporz.", //LBE Gear + L"Inne", +}; + + + + +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -799,10 +1001,11 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp +/* CHAR16 gszActionItemDesc[ 34 ][ 30 ] = { L"Mina klaksonowa", - L"Mina oÅšwietlajÄ…ca", + L"Mina oÅ›wietlajÄ…ca", L"Eksplozja gazu Åzaw.", L"Eksplozja granatu OszaÅ‚am.", L"Eksplozja granatu dymnego", @@ -813,15 +1016,15 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = L"3x3 Hidden Pit", L"5x5 Hidden Pit", L"MaÅ‚a eksplozja", - L"Åšrednia eksplozja", + L"Å›rednia eksplozja", L"Duża eksplozja", L"Otwórz/Zamknij drzwi", L"Przełącz wszystkie Akcje1", L"Przełącz wszystkie Akcje2", L"Przełącz wszystkie Akcje3", L"Przełącz wszystkie Akcje4", - L"WejÅšcie do burdelu", - L"WyjÅšcie z burdelu", + L"WejÅ›cie do burdelu", + L"WyjÅ›cie z burdelu", L"Alarm Kingpin'a", L"Seks z prostytutkÄ…", L"Pokaż pokój", @@ -836,7 +1039,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = L"Alarm dzikich kotów", L"Duży gaz Å‚zawiÄ…cy", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Chowanie flagi", //0 @@ -2430,6 +2633,11 @@ CHAR16 zHealthStr[][13] = L"DOSKONAÅY", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -3279,7 +3487,11 @@ STR16 pMapErrorString[] = //6-10 L"musi mieć eskortÄ™, aby siÄ™ przemieszczać. UmieŚć go w oddziale z eskortÄ….", // merc can't move unescorted .. for a male L"musi mieć eskortÄ™, aby siÄ™ przemieszczać. UmieŚć jÄ… w oddziale z eskortÄ….", // for a female +#ifdef JA2UB + L"Najemnik nie przybyÅ‚ jeszcze do Tracony!", +#else L"Najemnik nie przybyÅ‚ jeszcze do Arulco!", +#endif L"WyglÄ…da na to, że trzeba wpierw uregulować sprawy kontraktu.", L"Nie można przemieÅšcić najemnika. Trwa nalot powietrzny.", //11-15 @@ -4722,6 +4934,7 @@ STR16 zSaveLoadText[] = L"Nowy inwentarz nie dziaÅ‚a w rozdzielczoÅšci 640x480. Aby z niego korzystać zmieÅ„ rozdzielczoŚć i spróbuj ponownie.", L"Nowy inwentarz nie korzysta z domyÅšlnego folderu 'Data'.", + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", // TODO.Translate }; @@ -4973,9 +5186,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"POCZÂ¥TKOWE USTAWIENIA GRY", +#ifdef JA2UB + L"Dialogi Manuel'a", + L"Off", + L"On", +#else L"Styl gry", L"Realistyczny", L"S-F", +#endif L"Platynowy", //Placeholder English L"Opcje broni", L"Mnóstwo", @@ -5015,9 +5234,15 @@ STR16 gzGIOScreenText[] = L"Wrogowie upuszczajÄ… caÅ‚oŚć ekwipunku", L"Wyłączone", L"Włączone", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"Liczba terrorystów", L"Losowe", L"Wszystkie", +#endif L"Tajne skÅ‚ady proni", L"Losowe", L"Wszystkie", @@ -5032,6 +5257,11 @@ STR16 gzGIOScreenText[] = L"Nowe / Stare", L"Nowe / Nowe", + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5332,13 +5562,27 @@ STR16 pMessageStrings[] = L"Normal turn mode", L"Exit combat mode", L"Forced Turn Mode Active, Entering Combat", -#ifdef JA2BETAVERSION L"Automatyczny zapis zostaÅ‚ pomyÅšlnie wykonany.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved. L"Client", L"Nie możesz używać nowego trybu wyposażenia i nowego systemu dodatków jednoczeÅšnie.", + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5368,7 +5612,11 @@ STR16 pMilitiaButtonsHelpText[] = STR16 pMapScreenJustStartedHelpText[] = { L"Zajrzyj do A.I.M. i zatrudnij kilku najemników (*Wskazówka* musisz otworzyć laptopa)", // to inform the player to hired some mercs to get things going - L"JeÅšli chcesz już udać siÄ™ do Arulco, kliknij przycisk kompresji czasu, w prawym dolnym rogu ekranu.", // to inform the player to hit time compression to get the game underway +#ifdef JA2UB + L"JeÅ›li chcesz już udać siÄ™ do Tracony, kliknij przycisk kompresji czasu, w prawym dolnym rogu ekranu.", // to inform the player to hit time compression to get the game underway +#else + L"JeÅ›li chcesz już udać siÄ™ do Arulco, kliknij przycisk kompresji czasu, w prawym dolnym rogu ekranu.", // to inform the player to hit time compression to get the game underway +#endif }; STR16 pAntiHackerString[] = @@ -5400,6 +5648,10 @@ STR16 gzLaptopHelpText[] = L"McGillicutty's - ZakÅ‚ad pogrzebowy", L"United Floral Service", L"Brokerzy ubezpieczeniowi", + //New Bookmarks + L"", + L"Encyklopedia", + L"Briefing Room", }; @@ -5595,7 +5847,11 @@ STR16 gzLateLocalizedString[] = L"Wszystkim twoim najemnikom zaÅ‚ożono opatrunki.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", +#endif L"(dach)", @@ -6857,4 +7113,40 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +//Ja25 UB + +STR16 gzNewLaptopMessages[]= +{ + L"Zapytaj o naszÄ… specjalnÄ… ofertÄ™", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"OdlegÅ‚ość od celu (w polach): %d, Jasność = %d/%d", + L"Nadajnik zostaÅ‚ podłączony do twojego laptopa.", + L"Nie mo¿esz zatrudnić %s(a)", + L"Na okreÅ›lony czas, poni¿sze honorarium pokryje koszt caÅ‚ej misji razem z wyposażeniem zamieszonym poniżej.", + L"Zatrudnij %s(a) już teraz i weź udziaÅ‚ naszej promocji 'jedno honorarium pokrywa wszystko'. Ponadto w tej niewiarygodnej ofercie caÅ‚y ekwipunek najemnika dostaniesz za darmo.", + L"Honorarium", + L"KtoÅ› jest w sektorze...", + //L"ZasiÄ™g broni (w polach): %d, Szansa na trafienie: %d procent", + L"Pokaż osÅ‚onÄ™", + L"ZasiÄ™g wzroku", + L"Nowi rekruci nie mogÄ… tam przybyć.", + L"Dopóki twój laprop bÄ™dzie bez nadajnika, nie bÄ™dziesz mógÅ‚ zatrudniać nowych czÅ‚onków zespoÅ‚u. Możliwe, że to odpowiedni moment żeby odczytać zapisany stan gry lub zacząć grać od nowa!", + L"%s sÅ‚yszy dźwiÄ™k zgniatanego metalu dochodzÄ…cy spod ciaÅ‚a Jerrego. To niestety zabrzmiaÅ‚o jak dźwiÄ™k zgniatanej anteny od twojego laptopa.", //the %s is the name of a merc. @@@ Modified + L"Po przejżeniu notatki zostawionej przez zastÄ™pce dowódcy Morris'a, %s zauważa pewnÄ… możliwość. Notatka zawiera koordynaty do wystrzelenia pocisków w dwa miasteczka w Arulco. SÄ… na niej również koordynaty z których te pociski zostanÄ… wystrzelone - wojskowej placówki.", + L"PrzyglÄ…dajÄ…c siÄ™ panelowi kontrolnemu, %s zauważa, że cyfry można odwrócić, tak, że pociski mogÄ… zniszczyć tÄ… placówkÄ™. %s musi znaleźć drogÄ™ ucieczki. Wydaje siÄ™, że winda jest najszybszym rozwiÄ…zaniem...", + L"To jest tryb CZ£OWIEK ZE STALI i nie możesz zapisywać gry gdy wróg jest w sektorze.", // @@@ new text + L"(Nie można zapisywać gry podczas walki)", //@@@@ new text + L"Kampania ma wiÄ™cej niż 30 postaci.", // @@@ new text + L"Nie można odnaleźć kampanii.", // @@@ new text + L"Kampania: Standardowa ( %S )", // @@@ new text + L"Kampania: %S", // @@@ new text + L"WybraÅ‚eÅ› kampaniÄ™ %S. Ta kampania zostaÅ‚a stworzona przez fanów gry. Czy jesteÅ› pewien, że chcesz w niÄ… zagrać?", // @@@ new text + L"Å»eby użyć edytora powinieneÅ› wczeÅ›niej wybrać kampaniÄ™ innÄ… niż standardowa.", ///@@new +}; + #endif //POLISH diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 31016055..aa9505e0 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -115,6 +116,203 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; + +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - cities + L"SAM Site", //2 - SAM Site + L"Other location", //3 - other location + L"Mines", //4 - mines + L"Military complex", //5 - military complex + L"Laboratory complex", //6 - laboratory complex + L"Factory complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show all", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Pojazd", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show all", + L"Show cities", + L"Show SAM Sites", + L"Show other location", + L"Show mines", + L"Show military complex", + L"Show laboratory complex", + L"Show Factory complex", + L"Show hospital", + L"Show prison", + L"Show air port", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"All", //5 + L"Gun", + L"Ammo", + L"LBE Gear", + L"Misc", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knife", + L"Melee", + L"Grenades", + L"Bombs", + L"Med.", //30 + L"Kits", + L"Face", + L"LBE", + L"Misc.", //34 +}; +//----------- + + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -798,7 +996,7 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp -CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 +/*CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 { L"Klaxon Mine", L"Flare Mine", @@ -835,7 +1033,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2428,6 +2626,11 @@ CHAR16 zHealthStr[][13] = L"ОТЛИЧÐО", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"1000$", @@ -3277,7 +3480,11 @@ STR16 pMapErrorString[] = //6-10 L"нуждаетÑÑ Ð² Ñопровождении чтобы идти. Ðазначьте его Ñ ÐºÐµÐ¼-нибудь в отрÑд.", // merc can't move unescorted .. for a male L"нуждаетÑÑ Ð² Ñопровождении чтобы идти. Ðазначьте ее Ñ ÐºÐµÐ¼-нибудь в отрÑд.", // for a female +#ifdef JA2UB + L"Ðаёмник ещё не прибыл в Tracona!", +#else L"Ðаёмник ещё не прибыл в Ðрулько!", +#endif L"КажетÑÑ, Ñначала надо уладить проблемы Ñ ÐºÐ¾Ð½Ñ‚Ñ€Ð°ÐºÑ‚Ð¾Ð¼.", L"Бежать от Ñамолета? Только поÑле ваÑ!", // Cannot give a movement order. Air raid is going on. //11-15 @@ -3621,6 +3828,8 @@ STR16 pBookMarkStrings[] = L"Цветы", L"Страховка", L"Oтмeнa", + L"Encyclopedia", + L"Briefing Room", }; STR16 pBookmarkTitle[] = @@ -3730,8 +3939,10 @@ STR16 pWebPagesTitles[] = L"", L"ÐÐ´Ñ€ÐµÑ Ð½Ðµ найден.", L"Бобби РÑй - поÑледние поÑтуплениÑ", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4689,7 +4900,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"У Ð²Ð°Ñ Ð·Ð°ÐºÐ°Ð½Ñ‡Ð¸Ð²Ð°ÐµÑ‚ÑÑ Ñвободное меÑто на жеÑтком диÑке. Ð¡ÐµÐ¹Ñ‡Ð°Ñ Ñвободно %d Мб, а требуетÑÑ %d Мб Ñвободного меÑта Ð´Ð»Ñ JA.", - L"СохранÑÑŽ...", //When saving a game, a message box with this string appears on the screen + L"СохранÑÑŽ", //When saving a game, a message box with this string appears on the screen L"Ðормальный", L"Огромный", @@ -4706,6 +4917,8 @@ STR16 zSaveLoadText[] = L"Ð¡Ð¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð½Ð°Ñ Ð¸Ð³Ñ€Ð° была начата в режиме \"Ðового ИнвентарÑ\", Ñтот режим не работат при разрешении Ñкрана 640Ñ…480. Измените разрешение и загрузите игру Ñнова.", L"Загрузка игры, начатой в режиме \"Ðового ИнвентарÑ\", невозможна. УÑтановите в Ja2.ini игровую папку 'Data-1.13' и повторите попытку.", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", // TODO.Translate }; @@ -4957,9 +5170,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"УСТÐÐОВКИ ÐÐЧÐЛРИГРЫ", +#ifdef JA2UB + L"Random Manuel texts ", + L"Off", + L"On", +#else L"Элементы фантаÑтики", L"нет", L"еÑть", +#endif L"ÐŸÐ»Ð°Ñ‚Ð¸Ð½Ð¾Ð²Ð°Ñ ÑериÑ", L"ÐÑÑортимент Ð¾Ñ€ÑƒÐ¶Ð¸Ñ Ð² игре", L"вÑÑ‘ доÑтупное", @@ -4999,9 +5218,15 @@ STR16 gzGIOScreenText[] = L"Враг оÑтавлÑет вÑÑ‘ ÑнарÑжение", L"нет", L"да", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"ЧиÑло террориÑтов", L"Ñлучайное", L"вÑе Ñразу", +#endif L"СпрÑтанное оружие Ñекторов", //Secret Weapon Caches L"выборочно", L"вÑÑ‘ возможное", @@ -5015,6 +5240,12 @@ STR16 gzGIOScreenText[] = L"Ñтарый / ÑтараÑ", L"новый / ÑтараÑ", L"новый / новаÑ", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5296,7 +5527,7 @@ STR16 pMessageStrings[] = L"Ðе хватает денег, чтобы заплатить %s ежедневный гонорар %s", //first %s is the mercs name, the seconds is a string containing the salary L"Ðет", //Skip L"%s не может уйти в одиночку.", - L"Файл ÑÐ¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð±Ñ‹Ð» запиÑан под названием SaveGame99.sav. ЕÑли необходимо, переименуйте его в SaveGame01 - SaveGame10 и тогда, он Ñтанет доÑтупен в ÑпиÑке Ñохранений.", + L"Файл ÑÐ¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð±Ñ‹Ð» запиÑан под названием SaveGame249.sav. ЕÑли необходимо, переименуйте его в SaveGame01 - SaveGame10 и тогда, он Ñтанет доÑтупен в ÑпиÑке Ñохранений.", L"%s: выпил(а) немного %s.", L"ПоÑылка прибыла в ДраÑÑен.", L"%s прибудет в точку Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ (Ñектор %s) в %dй день, примерно в %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival @@ -5312,12 +5543,26 @@ STR16 pMessageStrings[] = L"Режим реального времени", //Normal turn mode L"Выход из пошагового режима", //Exit combat mode L"Включен только пошаговый режим. Ð’Ñтупаем в бой!", //Forced Turn Mode Active, Entering Combat -#ifdef JA2BETAVERSION L"Игра Ñохранена в поле авто-ÑохранениÑ.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved. L"Клиент", //Client L"ÐÐµÐ»ÑŒÐ·Ñ Ð¾Ð´Ð½Ð¾Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ð¾ уÑтановить \"Старый\" инвентарь и \"Ðовую СиÑтему ÐавеÑки\".", //You cannot use the Old Inventory and the New Attachment System at the same time. + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5347,7 +5592,11 @@ STR16 pMilitiaButtonsHelpText[] = STR16 pMapScreenJustStartedHelpText[] = { L"ОтправлÑйтеÑÑŒ в A.I.M. и наймите бойцов (*ПодÑказка* - Ñто в лÑптопе).", // to inform the player to hired some mercs to get things going +#ifdef JA2UB + L"Когда будете готовы отправитьÑÑ Ð² Tracona, включите Ñжатие времени в правом нижнем углу Ñкрана.", // to inform the player to hit time compression to get the game underway +#else L"Когда будете готовы отправитьÑÑ Ð² Ðрулько, включите Ñжатие времени в правом нижнем углу Ñкрана.", // to inform the player to hit time compression to get the game underway +#endif }; STR16 pAntiHackerString[] = @@ -5379,6 +5628,10 @@ STR16 gzLaptopHelpText[] = L"ÐŸÐ¾Ñ…Ð¾Ñ€Ð¾Ð½Ð½Ð°Ñ Ñлужба Макгилликатти", L"'Цветы по вÑему миру'", L"Страховые агенты по контрактам A.I.M.", + //New Bookmarks + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5574,8 +5827,11 @@ STR16 gzLateLocalizedString[] = L"Ð’Ñе ваши наемники перевÑзаны.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Ðрулько", - +#endif L"(на крыше)", L"Здоровье: %d/%d", @@ -6825,4 +7081,38 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"РаÑÑтоÑние до цели: %d ед., ОÑвещенноÑть: %d/%d", + L"Передатчик подключен к вашему ноутбуку.", + L"Ð’Ñ‹ не можете нанÑть %s", + L"Предложение дейÑтвует ограниченное Ð²Ñ€ÐµÐ¼Ñ Ð¸ покрывает ÑтоимоÑть найма на вÑÑŽ миÑÑию, Ð¿Ð»ÑŽÑ Ð²Ñ‹ так же получите оборудование, перечиÑленное ниже.", + L"Ðаемник %s - наше невероÑтное Ñуперпредложение 'одна плата за вÑе'. Ð’Ñ‹ также беÑплатно получите его перÑональную Ñкипировку.", + L"Гонорар", + L"Ð’ Ñекторе кто-то еÑть...", + //L"ДальнобойноÑть оружиÑ: %d ед., Ð¨Ð°Ð½Ñ Ð¿Ð¾Ð¿Ð°Ñть: %d%%", + L"Показать укрытиÑ", + L"Ð›Ð¸Ð½Ð¸Ñ Ð¿Ñ€Ð¸Ñ†ÐµÐ»Ð°", + L"Ðовые наемники не могут выÑадитьÑÑ Ð·Ð´ÐµÑÑŒ.", + L"Так как ваш ноутбук лишилÑÑ Ð°Ð½Ñ‚ÐµÐ½Ð½Ñ‹, то вы не Ñможете нанÑть новых наемников. Возможно, ÑÐµÐ¹Ñ‡Ð°Ñ Ð²Ð°Ð¼ Ñтоит загрузить одну из Ñохраненных игр, или начать игру заново!", + L"%s Ñлышит металличеÑкий хруÑÑ‚ под телом Джерри. КажетÑÑ, Ñто чмо Ñломало антенну вашего ноутбука.", //the %s is the name of a merc. + L"ПоÑле Ð¿Ñ€Ð¾Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿Ð¸Ñей, оÑтавленных помощником командира МорриÑа, %s видит, что не вÑе еще потерÑно. Ð’ запиÑке ÑодержатÑÑ ÐºÐ¾Ð¾Ñ€Ð´Ð¸Ð½Ð°Ñ‚Ñ‹ городов Ðрулько Ð´Ð»Ñ Ð·Ð°Ð¿ÑƒÑка по ним ракет. Кроме того, там также указаны координаты Ñамой ракетной базы.", + L"Изучив панель управлениÑ, %s понимает, что координаты цели можно изменить, и тогда ракета уничтожит Ñту базу. %s не ÑобираетÑÑ ÑƒÐ¼Ð¸Ñ€Ð°Ñ‚ÑŒ, а значит нужно быÑтрее отÑюда выбиратьÑÑ. Похоже, что Ñамый быÑтрый ÑпоÑоб Ñто лифт...", + L"Ð’ начале игры вы выбрали Ñохранение лишь в \"мирное времÑ\" и теперь не можете запиÑыватьÑÑ Ð²Ð¾ Ð²Ñ€ÐµÐ¼Ñ Ð±Ð¾Ñ.", + L"(ÐÐµÐ»ÑŒÐ·Ñ ÑохранÑтьÑÑ Ð²Ð¾ Ð²Ñ€ÐµÐ¼Ñ Ð±Ð¾Ñ)", + L"Ð¢ÐµÐºÑƒÑ‰Ð°Ñ ÐºÐ°Ð¼Ð¿Ð°Ð½Ð¸Ñ Ð´Ð»Ð¸Ð½Ð½ÐµÐµ 30 Ñимволов.", + L"Ð¢ÐµÐºÑƒÑ‰Ð°Ñ ÐºÐ°Ð¼Ð¿Ð°Ð½Ð¸Ñ Ð½Ðµ найдена.", + L"КампаниÑ: По умолчанию ( %S )", + L"КампаниÑ: %S", + L"Ð’Ñ‹ выбрали кампанию %S. Эта ÐºÐ°Ð¼Ð¿Ð°Ð½Ð¸Ñ ÑвлÑетÑÑ Ð¼Ð¾Ð´Ð¸Ñ„Ð¸ÐºÐ°Ñ†Ð¸ÐµÐ¹ оригинальной кампании Unfinished Business. Ð’Ñ‹ уверены, что хотите играть кампанию %S?", + L"Чтобы воÑпользоватьÑÑ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¾Ñ€Ð¾Ð¼, Ñмените кампанию по умолчанию на другую.", +}; + #endif //RUSSIAN diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index eee887a3..23bae4ae 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -11,6 +11,7 @@ #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" + #include "Encyclopedia.h" #endif #endif @@ -115,6 +116,201 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ +CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] = +{ + L"", +}; +//Encyclopedia + +STR16 pMenuStrings[] = +{ + //Encyclopedia + L"Locations", // 0 + L"Characters", + L"Items", + L"Quests", + L"Menu 5", + L"Menu 6", //5 + L"Menu 7", + L"Menu 8", + L"Menu 9", + L"Menu 10", + L"Menu 11", //10 + L"Menu 12", + L"Menu 13", + L"Menu 14", + L"Menu 15", + L"Menu 15", // 15 + + //Briefing Room + L"Exit", +}; + +STR16 pOtherButtonsText[] = +{ + L"Briefing", + L"Accept", +}; + +STR16 pOtherButtonsHelpText[] = +{ + L"Briefing", + L"Accept missions", +}; + + +STR16 pLocationPageText[] = +{ + L"Prev page", + L"Photo", + L"Next page", +}; + +STR16 pSectorPageText[] = +{ + L"<<", + L"Main page", + L">>", + L"Type: ", + L"Empty data", +}; + +STR16 pEncyclopediaTypeText[] = +{ + L"Unknown",// 0 - unknown + L"City", //1 - cities + L"SAM Site", //2 - SAM Site + L"Other location", //3 - other location + L"Mines", //4 - mines + L"Military complex", //5 - military complex + L"Laboratory complex", //6 - laboratory complex + L"Factory complex", //7 - factory complex + L"Hospital", //8 - hospital + L"Prison", //9 - prison + L"Airport", //10 - air port +}; + +STR16 pEncyclopediaHelpCharacterText[] = +{ + L"Show all", + L"Show AIM", + L"Show MERC", + L"Show RPC", + L"Show NPC", + L"Show Pojazd", + L"Show IMP", + L"Show EPC", + L"Filter", +}; + +STR16 pEncyclopediaShortCharacterText[] = +{ + L"All", + L"AIM", + L"MERC", + L"RPC", + L"NPC", + L"Veh.", + L"IMP", + L"EPC", + L"Filter", +}; + +STR16 pEncyclopediaHelpText[] = +{ + L"Show all", + L"Show cities", + L"Show SAM Sites", + L"Show other location", + L"Show mines", + L"Show military complex", + L"Show laboratory complex", + L"Show Factory complex", + L"Show hospital", + L"Show prison", + L"Show air port", +}; + +STR16 pEncyclopediaSkrotyText[] = +{ + L"All", + L"City", + L"SAM", + L"Other", + L"Mine", + L"Mil.", + L"Lab.", + L"Fact.", + L"Hosp.", + L"Prison", + L"Air.", +}; + +STR16 pEncyclopediaShortInventoryText[] = +{ + L"All", //0 + L"Gun", + L"Ammo", + L"LBE", + L"Misc", + + L"All", //5 + L"Gun", + L"Ammo", + L"LBE Gear", + L"Misc", + L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.", +}; + +STR16 BoxFilter[] = +{ + // Guns + L"Heavy", + L"Pistol", + L"M. Pist.", + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pist.", //10 + L"SMG", + L"Rifle", + L"S. Rifle", + L"A. Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", //20 + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knife", + L"Melee", + L"Grenades", + L"Bombs", + L"Med.", //30 + L"Kits", + L"Face", + L"LBE", + L"Misc.", //34 +}; +//----------- + // Editor //Editor Taskbar Creation.cpp STR16 iEditorItemStatsButtonsText[] = @@ -798,6 +994,7 @@ STR16 pShowHighGroundText[] = }; //Item Statistics.cpp +/* CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 { L"Klaxon Mine", @@ -835,7 +1032,7 @@ CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34 L"Bloodcat alarm", L"Big teargas", }; - +*/ STR16 pUpdateItemStatsPanelText[] = { L"Toggle hide flag", //0 @@ -2430,6 +2627,11 @@ CHAR16 zHealthStr[][13] = L"EXCELLENT", // >= 90 }; +STR16 gzHiddenHitCountStr[1] = +{ + L"?", +}; + STR16 gzMoneyAmounts[6] = { L"$1000", @@ -3279,7 +3481,11 @@ STR16 pMapErrorString[] = //6-10 L"needs an escort to move. Place him on a squad with one.", // merc can't move unescorted .. for a male L"needs an escort to move. Place her on a squad with one.", // for a female +#ifdef JA2UB + L"Merc hasn't yet arrived in Tracona!", +#else L"Merc hasn't yet arrived in Arulco!", +#endif L"Looks like there's some contract negotiations to settle first.", L"Cannot give a movement order. Air raid is going on.", //11-15 @@ -3368,8 +3574,13 @@ STR16 pMiscMapScreenMouseRegionHelpText[] = // male version of where equipment is left STR16 pMercHeLeaveString[] = { +#ifdef JA2UB + L"Have %s leave his equipment where he is now (%s) or later on in Drassen (B13) upon catching flight out of Tracona?", + L"Have %s leave his equipment where he is now (%s) or later on in Omerta (A9) upon catching flight out of Tracona?", +#else L"Have %s leave his equipment where he is now (%s) or later on in Drassen (B13) upon catching flight out of Arulco?", L"Have %s leave his equipment where he is now (%s) or later on in Omerta (A9) upon catching flight out of Arulco?", +#endif L"is about to leave and will drop off his equipment in Omerta (A9).", L"is about to leave and will drop off his equipment in Drassen (B13).", L"%s is about to leave and will drop off his equipment in %s.", @@ -3379,8 +3590,13 @@ STR16 pMercHeLeaveString[] = // female version STR16 pMercSheLeaveString[] = { +#ifdef JA2UB + L"Have %s leave her equipment where she is now (%s) or later on in Drassen (B13) upon catching flight out of Tracona?", + L"Have %s leave her equipment where she is now (%s) or later on in Omerta (A9) upon catching flight out of Tracona?", +#else L"Have %s leave her equipment where she is now (%s) or later on in Drassen (B13) upon catching flight out of Arulco?", L"Have %s leave her equipment where she is now (%s) or later on in Omerta (A9) upon catching flight out of Arulco?", +#endif L"is about to leave and will drop off her equipment in Omerta (A9).", L"is about to leave and will drop off her equipment in Drassen (B13).", L"%s is about to leave and will drop off her equipment in %s.", @@ -3625,6 +3841,8 @@ STR16 pBookMarkStrings[] = L"Florist", L"Insurance", L"Cancel", + L"Encyclopedia", + L"Briefing Room", }; STR16 pBookmarkTitle[] = @@ -3734,8 +3952,10 @@ STR16 pWebPagesTitles[] = L"", L"URL not found.", L"Bobby Ray's - Recent Shipments", - L"", - L"", + L"Encyclopedia", + L"Encyclopedia - Data", + L"Briefing Room", + L"Briefing Room - Data", }; STR16 pShowBookmarkString[] = @@ -4699,7 +4919,7 @@ STR16 zSaveLoadText[] = //the second is the recommended amount of free space. L"You are running low on disk space. You only have %d Megs free and Jagged should have at least %d Megs free.", - L"Saving...", //When saving a game, a message box with this string appears on the screen + L"Saving", //When saving a game, a message box with this string appears on the screen L"Normal Guns", L"Tons of Guns", @@ -4715,8 +4935,10 @@ STR16 zSaveLoadText[] = L"Excellent Selection", L"Awesome Selection", - L"New Inventory does not work in 640x480 screen size. Please resize and try again.", + L"New Inventory does not work in 640x480 screen resolution. Please increase the screen resolution and try again.", L"New Inventory does not work from the default 'Data' folder.", + + L"The squad size from the savegame is not supported by the current screen resolution. Please increase the screen resolution and try again.", }; @@ -4936,7 +5158,7 @@ STR16 zOptionsScreenHelpText[] = L"When ON, you will hear rain noises when it is raining.", L"When ON, the crows are present in game.", L"When ON, a tooltip window is shown when pressing |A|l|t and hovering cursor over an enemy.", - L"When ON, game will be saved after each players turn.", + L"When ON, game will be saved in 2 alternate save slots after each players turn.", L"When ON, Skyrider will not talk anymore.", //L"When ON, game will run with much lower CPU usage.", L"When ON, enhanced descriptions will be shown for items and weapons.", @@ -4969,9 +5191,15 @@ STR16 zOptionsScreenHelpText[] = STR16 gzGIOScreenText[] = { L"INITIAL GAME SETTINGS", +#ifdef JA2UB + L"Random Manuel texts", + L"Off", + L"On", +#else L"Game Style", L"Realistic", L"Sci Fi", +#endif L"Platinum", L"Available Arsenal", // changed by SANDRO L"Tons of Guns", @@ -5012,9 +5240,15 @@ STR16 gzGIOScreenText[] = L"Enemies Drop All Items", L"Off", L"On", +#ifdef JA2UB + L"Tex and John", + L"Random", + L"All", +#else L"Number of Terrorists", L"Random", L"All", +#endif L"Secret Weapon Caches", L"Random", L"All", @@ -5029,6 +5263,12 @@ STR16 gzGIOScreenText[] = L"Old / Old", L"New / Old", L"New / New", + + // Squad Size + L"Max. Squad Size", + L"6", + L"8", + L"10", }; STR16 gzMPJScreenText[] = @@ -5313,7 +5553,7 @@ STR16 pMessageStrings[] = L"You cannot afford to pay for %s's daily salary of %s", //first %s is the mercs name, the seconds is a string containing the salary L"Skip", // 70 L"%s cannot leave alone.", - L"A save has been created called, SaveGame99.sav. If needed, rename it to SaveGame01 - SaveGame10 and then you will have access to it in the Load screen.", + L"A save has been created called, SaveGame249.sav. If needed, rename it to SaveGame01 - SaveGame10 and then you will have access to it in the Load screen.", L"%s drank some %s", L"A package has arrived in Drassen.", L"%s should arrive at the designated drop-off point (sector %s) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival @@ -5329,14 +5569,28 @@ STR16 pMessageStrings[] = L"Normal turn mode", L"Exit combat mode", L"Forced Turn Mode Active, Entering Combat", -#ifdef JA2BETAVERSION L"Successfully Saved the Game into the End Turn Auto Save slot.", -#endif L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved. L"Client", // TODO.Translate L"You cannot use the Old Inventory and the New Attachment System at the same time.", + + // TODO.Translate + L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID + L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save + L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet) + L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05 + L"End-Turn Save #", // 95 // The text for the tactical end turn auto save + L"Saving Auto Save #", // 96 // The message box, when doing auto save + L"Saving", // 97 // The message box, when doing end turn auto save + L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save + L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save + // Mouse tooltips + L"QuickSave.sav", // 100 + L"AutoSaveGame%02d.sav", // 101 + L"Auto%02d.sav", // 102 + L"SaveGame%02d.sav", //103 }; @@ -5366,7 +5620,11 @@ STR16 pMilitiaButtonsHelpText[] = STR16 pMapScreenJustStartedHelpText[] = { L"Go to AIM and hire some mercs ( *Hint* it's in the Laptop )", // to inform the player to hired some mercs to get things going +#ifdef JA2UB + L"When you're ready to travel to Tracona, click on the Time Compression button at the bottom right of the screen.", // to inform the player to hit time compression to get the game underway +#else L"When you're ready to travel to Arulco, click on the Time Compression button at the bottom right of the screen.", // to inform the player to hit time compression to get the game underway +#endif }; STR16 pAntiHackerString[] = @@ -5398,6 +5656,10 @@ STR16 gzLaptopHelpText[] = L"McGillicutty's Mortuary", L"United Floral Service", L"Insurance Brokers for A.I.M. contracts", + //New Bookmarks + L"", + L"Encyclopedia", + L"Briefing Room", }; @@ -5593,8 +5855,11 @@ STR16 gzLateLocalizedString[] = L"All your mercs are bandaged.", //14 +#ifdef JA2UB + L"Tracona", +#else L"Arulco", - +#endif L"(roof)", L"Health: %d/%d", @@ -6853,4 +7118,37 @@ STR16 gzNCTHlabels[]= // HEADROCK HAM 4: End new UDB texts and tooltips ////////////////////////////////////////////////////// +STR16 gzNewLaptopMessages[]= +{ + L"Ask about our special offer!", + L"Temporarily Unavailable", + L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.", +}; + +STR16 zNewTacticalMessages[]= +{ + //L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + //L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; #endif //TAIWANESE diff --git a/XML_IntroFiles.cpp b/XML_IntroFiles.cpp new file mode 100644 index 00000000..967d03a9 --- /dev/null +++ b/XML_IntroFiles.cpp @@ -0,0 +1,183 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Intro.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + INTRO_NAMES_VALUES curIntroNames; + INTRO_NAMES_VALUES * curArray; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; + //CHAR16 gzEnemyNames[MAX_ENEMY_NAMES_CHARS]; +} +typedef introNamesParseData; + +BOOLEAN IntroName_TextOnly; + +static void XMLCALL +introNamesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + introNamesParseData * pData = (introNamesParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "INTRO_FILES") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "FILE") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "szFile") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +introNamesCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + introNamesParseData * pData = (introNamesParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +introNamesEndElementHandle(void *userData, const XML_Char *name) +{ + introNamesParseData * pData = (introNamesParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "VIDEO_FILES") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "FILE") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!IntroName_TextOnly) + { + wcscpy(zVideoFile[pData->curIntroNames.uiIndex].szFile, pData->curIntroNames.szFile); + } + else + { + wcscpy(zVideoFile[pData->curIntroNames.uiIndex].szFile, pData->curIntroNames.szFile); + } + + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curIntroNames.uiIndex = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "szFile") == 0 ) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curIntroNames.szFile, sizeof(pData->curIntroNames.szFile)/sizeof(pData->curIntroNames.szFile[0]) ); + pData->curIntroNames.szFile[sizeof(pData->curIntroNames.szFile)/sizeof(pData->curIntroNames.szFile[0]) - 1] = '\0'; + } + pData->maxReadDepth--; + } + pData->currentDepth--; +} + + + + +BOOLEAN ReadInIntroNames(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + introNamesParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading IntroFiles.xml" ); + + IntroName_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, introNamesStartElementHandle, introNamesEndElementHandle); + XML_SetCharacterDataHandler(parser, introNamesCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in IntroFiles.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/XML_Layout_MainMenu.cpp b/XML_Layout_MainMenu.cpp new file mode 100644 index 00000000..91c9d6f0 --- /dev/null +++ b/XML_Layout_MainMenu.cpp @@ -0,0 +1,322 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "mainmenuscreen.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + MAIN_MENU_VALUES curMainMenu; + MAIN_MENU_VALUES * curArray; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; +} +typedef mainMenuParseData; + +static void XMLCALL +mainMenuStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + mainMenuParseData * pData = (mainMenuParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "MAINMENU") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + memset(pData->curArray,0,sizeof(MAIN_MENU_VALUES)*pData->maxArraySize); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "IMAGE") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + memset(&pData->curMainMenu,0,sizeof(MAIN_MENU_VALUES)); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "Visible") == 0 || + strcmp(name, "FileName") == 0 || + strcmp(name, "FileName800x600") == 0 || + strcmp(name, "FileName1024x768") == 0 || + strcmp(name, "ImagePositionX") == 0 || + strcmp(name, "ImagePositionY") == 0 || + strcmp(name, "ImagePosition800x600X") == 0 || + strcmp(name, "ImagePosition800x600Y") == 0 || + strcmp(name, "ImagePosition1024x768X") == 0 || + strcmp(name, "ImagePosition1024x768Y") == 0 || + strcmp(name, "MainMenuY") == 0 || + strcmp(name, "MainMenu800x600Y") == 0 || + strcmp(name, "MainMenu1024x768Y") == 0 || + strcmp(name, "MainMenuX") == 0 || + strcmp(name, "MainMenu800x600X") == 0 || + strcmp(name, "MainMenu1024x768X") == 0 || + strcmp(name, "MainMenuYSpace") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +mainMenuCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + mainMenuParseData * pData = (mainMenuParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +mainMenuEndElementHandle(void *userData, const XML_Char *name) +{ + char temp; + mainMenuParseData * pData = (mainMenuParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "MAINMENU") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "IMAGE") == 0) + { + pData->curElement = ELEMENT_LIST; + + if(pData->curMainMenu.uiIndex < pData->maxArraySize) + { + pData->curArray[pData->curMainMenu.uiIndex] = pData->curMainMenu; + } + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.uiIndex = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "Visible") == 0) + { + pData->curElement = ELEMENT; + if (pData->curMainMenu.uiIndex == 0 ) pData->curMainMenu.Visible = 0; + + else pData->curMainMenu.Visible = (BOOLEAN) atol(pData->szCharData); + } + else if(strcmp(name, "FileName") == 0 && pData->curMainMenu.uiIndex > 0) + { + + pData->curElement = ELEMENT; + + if(MAX_MAIN_MENU_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curMainMenu.FileName,pData->szCharData); + else + { + strncpy(pData->curMainMenu.FileName,pData->szCharData,MAX_MAIN_MENU_CHARS); + pData->curMainMenu.FileName[MAX_MAIN_MENU_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_MAIN_MENU_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curMainMenu.FileName[i] = temp; + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szLocation[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szLocation[i],&temp)); + } + } + else if(strcmp(name, "FileName800x600") == 0 && pData->curMainMenu.uiIndex > 0) + { + + pData->curElement = ELEMENT; + + if(MAX_MAIN_MENU_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curMainMenu.FileName800x600,pData->szCharData); + else + { + strncpy(pData->curMainMenu.FileName800x600,pData->szCharData,MAX_MAIN_MENU_CHARS); + pData->curMainMenu.FileName800x600[MAX_MAIN_MENU_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_MAIN_MENU_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curMainMenu.FileName800x600[i] = temp; + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szLocation[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szLocation[i],&temp)); + } + } + else if(strcmp(name, "FileName1024x768") == 0 && pData->curMainMenu.uiIndex > 0) + { + + pData->curElement = ELEMENT; + + if(MAX_MAIN_MENU_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curMainMenu.FileName1024x768,pData->szCharData); + else + { + strncpy(pData->curMainMenu.FileName1024x768,pData->szCharData,MAX_MAIN_MENU_CHARS); + pData->curMainMenu.FileName1024x768[MAX_MAIN_MENU_CHARS] = '\0'; + } + + for(int i=0;iszCharData),MAX_MAIN_MENU_CHARS);i++) + { + temp = pData->szCharData[i]; + pData->curMainMenu.FileName1024x768[i] = temp; + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szLocation[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szLocation[i],&temp)); + } } + + else if(strcmp(name, "ImagePositionX") == 0 && pData->curMainMenu.uiIndex > 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.ImagePositionX = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePositionY") == 0 && pData->curMainMenu.uiIndex > 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.ImagePositionY = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition800x600X") == 0 && pData->curMainMenu.uiIndex > 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.ImagePosition800x600X = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition800x600Y") == 0 && pData->curMainMenu.uiIndex > 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.ImagePosition800x600Y = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition1024x768X") == 0 && pData->curMainMenu.uiIndex > 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.ImagePosition1024x768X = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "ImagePosition1024x768Y") == 0 && pData->curMainMenu.uiIndex > 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.ImagePosition1024x768Y = (INT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenuY") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_Y = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenu800x600Y") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_800x600Y = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenu1024x768Y") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_1024x768Y = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenuX") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_X = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenu800x600X") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_800x600X = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenu1024x768X") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_1024x768X = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "MainMenuYSpace") == 0 && pData->curMainMenu.uiIndex == 0) + { + pData->curElement = ELEMENT; + pData->curMainMenu.MAINMENU_Y_SPACE = (UINT32) atol(pData->szCharData); + } + pData->maxReadDepth--; + } + + pData->currentDepth--; +} + + + + +BOOLEAN ReadInMainMenu(MAIN_MENU_VALUES *pMainMenu, STR fileName) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + mainMenuParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Layout\LayoutMainMenu.xml" ); + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( FALSE ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, mainMenuStartElementHandle, mainMenuEndElementHandle); + XML_SetCharacterDataHandler(parser, mainMenuCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + pData.curArray = pMainMenu; + pData.maxArraySize = MAX_MAIN_MENU_IMAGE; + + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in MainMenu.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/builddefines.h b/builddefines.h index ebe4b098..b7be9b99 100644 --- a/builddefines.h +++ b/builddefines.h @@ -4,6 +4,21 @@ #include "Language Defines.h" +// ----------------------------- +// ***************************** +// WANNE: Enable those 2 defines, if you want to build UB-Version!! + +//JA2/Unfinished Business +//#define JA2UB + +//Unfinished Business - Titles (ja2set.dat) +//#define JA2UBMAPS +// ***************************** +// ----------------------------- + + + + // Map Editor version - you should use the MapEditor configuration instead of messing with these defines (ChrisL) //#define JA2BETAVERSION //#define JA2EDITOR diff --git a/gameloop.cpp b/gameloop.cpp index 6667a45c..743393ce 100644 --- a/gameloop.cpp +++ b/gameloop.cpp @@ -41,6 +41,11 @@ #pragma comment (lib, "gdi32.lib") #pragma comment (lib, "advapi32.lib") #pragma comment (lib, "shell32.lib") + +#ifdef JA2UB +#include "ub_config.h" +#endif + // rain #include "Rain.h" // end rain @@ -130,6 +135,10 @@ BOOLEAN InitializeGame(void) // HEADROCK HAM 4: Read CTH values LoadCTHConstants(); +#ifdef JA2UB + LoadGameUBOptions(); // JA25 UB +#endif + InitSightRange(); //lal // Initlaize mouse subsystems diff --git a/gamescreen.cpp b/gamescreen.cpp index d9324f36..81b82751 100644 --- a/gamescreen.cpp +++ b/gamescreen.cpp @@ -90,6 +90,12 @@ #include "connect.h" +#ifdef JA2UB +#include "Ja25_Tactical.h" +#include "Ja25 Strategic Ai.h" +#include "ub_config.h" +#endif + #define ARE_IN_FADE_IN( ) ( gfFadeIn || gfFadeInitialized ) BOOLEAN fDirtyRectangleMode = FALSE; @@ -126,7 +132,10 @@ extern BOOLEAN gfFailedToSaveGameWhenInsideAMessageBox; extern BOOLEAN gfFirstHeliRun; extern BOOLEAN gfRenderFullThisFrame; - +#ifdef JA2UB +extern void HandleCannotAffordNpcMsgBox(); +extern BOOLEAN gfDisplayMsgBoxSayingCantAffordNPC; +#endif // The InitializeGame function is responsible for setting up all data and Gaming Engine // tasks which will run the game @@ -307,6 +316,10 @@ void EnterTacticalScreen( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: settacticalinterfaceflags")); SetTacticalInterfaceFlags( 0 ); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: fix oversized squads")); + //SQUAD10: Check for squads that are oversized at current resolution and move them to another squad + FixOversizedSquadsInSector( ); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: set default squad on sector entry")); // set default squad on sector entry SetDefaultSquadOnSectorEntry( FALSE ); @@ -326,11 +339,16 @@ void EnterTacticalScreen( ) //gfGameScreenLocateToSoldier = TRUE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: check meanwhile")); + +#ifdef JA2UB +/* Ja25 No meanwhiles */ +#else // Locate if in meanwhile... if ( AreInMeanwhile( ) ) { LocateToMeanwhileCharacter( ); } +#endif if ( gTacticalStatus.uiFlags & IN_DEIDRANNA_ENDGAME ) { @@ -454,6 +472,12 @@ UINT32 MainGameScreenHandle(void) #endif } +#ifdef JA2UB + //jA25 UB + //Handle the strategic AI + JA25_HandleUpdateOfStrategicAi(); +#endif + #if 0 { PTR pData, pDestBuf; @@ -596,12 +620,31 @@ UINT32 MainGameScreenHandle(void) if ( gfTacticalDoHeliRun ) { gfGameScreenLocateToSoldier = FALSE; - //InternalLocateGridNo( gMapInformation.sNorthGridNo, TRUE ); - InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE ); +#ifdef JA2UB + //if it is the first time in the game, and we are doing the heli crash code, locate to a different spot + if( gfFirstTimeInGameHeliCrash && gGameUBOptions.InGameHeli == FALSE ) + { + InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE ); // 15427 + } + else + { + if ( gGameUBOptions.InGameHeliCrash == TRUE ) + //InternalLocateGridNo( gMapInformation.sNorthGridNo, TRUE ); + InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE ); + else + InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE ); + } +#else + InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE ); +#endif // Start heli Run... +#ifdef JA2UB + StartHelicopterRun( gGameUBOptions.LOCATEGRIDNO ); //gMapInformation.sNorthGridNo ); +#else //StartHelicopterRun( gMapInformation.sNorthGridNo ); StartHelicopterRun( gGameExternalOptions.iInitialMercArrivalLocation ); +#endif // Update clock by one so that our DidGameJustStatrt() returns now false for things like LAPTOP, etc... SetGameTimeCompressionLevel( TIME_COMPRESS_X1 ); @@ -617,12 +660,16 @@ UINT32 MainGameScreenHandle(void) HandleOverheadMap( ); return( GAME_SCREEN ); } -/* + +#ifdef JA2UB if ( !ARE_IN_FADE_IN( ) ) { - HandleAirRaid( ); + // HandleAirRaid( ); + + HandlePowerGenAlarm(); } -*/ +#endif + if ( gfGameScreenLocateToSoldier ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("maingamescreenhandle: tacticalscreenlocatetosoldier")); @@ -670,6 +717,13 @@ UINT32 MainGameScreenHandle(void) } } +#ifdef JA2UB + //if we are to display a mesg box about cant afford biggens + if( gfDisplayMsgBoxSayingCantAffordNPC ) + { + HandleCannotAffordNpcMsgBox(); + } +#endif #ifdef JA2BETAVERSION if( gfDoDialogOnceGameScreenFadesIn ) @@ -681,9 +735,13 @@ UINT32 MainGameScreenHandle(void) HandleHeliDrop( ); if ( !ARE_IN_FADE_IN( ) ) - { + { HandleAutoBandagePending( ); - } + + #ifdef JA2UB + HandleThePlayerBeNotifiedOfSomeoneElseInSector(); + #endif + } // ATE: CHRIS_C LOOK HERE FOR GETTING AI CONSTANTLY GOING @@ -891,8 +949,14 @@ UINT32 MainGameScreenHandle(void) // Display Framerate DisplayFrameRate( ); - + + +//UB +#ifdef JA2UB + /* JA2UB */ +#else CheckForMeanwhileOKStart( ); +#endif ScrollString( ); @@ -1146,7 +1210,10 @@ void InitHelicopterEntranceByMercs( void ) // Madd - nevermind initial air strike. It just seems silly, since Deidranna doesn't know the mercs are there. //if ( gGameOptions.fAirStrikes ) // ScheduleAirRaid( &AirRaidDef ); - +#ifdef JA2UB + if ( gGameUBOptions.InGameHeli == FALSE ) + HandleInitialEventsInHeliCrash(); //JA25 UB +#endif gfTacticalDoHeliRun = TRUE; gfFirstHeliRun = TRUE; diff --git a/ja2_VS2005.vcproj b/ja2_VS2005.vcproj index 1e3e7b20..7cd68a63 100644 --- a/ja2_VS2005.vcproj +++ b/ja2_VS2005.vcproj @@ -66,7 +66,7 @@ + + @@ -560,6 +564,18 @@ RelativePath=".\Sys Globals.cpp" > + + + + + + + + @@ -714,6 +734,10 @@ RelativePath=".\Sys Globals.h" > + + diff --git a/ja2_VS2005Linker.vsprops b/ja2_VS2005Linker.vsprops index c3218958..e538a723 100644 --- a/ja2_VS2005Linker.vsprops +++ b/ja2_VS2005Linker.vsprops @@ -7,6 +7,6 @@ diff --git a/ja2_VS2008.vcproj b/ja2_VS2008.vcproj index 43f51505..81307f20 100644 --- a/ja2_VS2008.vcproj +++ b/ja2_VS2008.vcproj @@ -488,6 +488,10 @@ RelativePath="ja2.h" > + + @@ -568,6 +572,10 @@ RelativePath="Sys Globals.h" > + + @@ -686,6 +694,10 @@ RelativePath="JA2 Splash.cpp" > + + @@ -754,6 +766,18 @@ RelativePath="Sys Globals.cpp" > + + + + + + diff --git a/ja2_VS2010.vcxproj b/ja2_VS2010.vcxproj index fc03b4c3..5b478543 100644 --- a/ja2_VS2010.vcxproj +++ b/ja2_VS2010.vcxproj @@ -242,6 +242,7 @@ + @@ -262,6 +263,9 @@ + + + @@ -281,6 +285,7 @@ + @@ -306,6 +311,7 @@ + diff --git a/ja2_VS2010.vcxproj.filters b/ja2_VS2010.vcxproj.filters index b0742e29..c675ad72 100644 --- a/ja2_VS2010.vcxproj.filters +++ b/ja2_VS2010.vcxproj.filters @@ -117,6 +117,18 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + @@ -248,6 +260,12 @@ Multiplayer\Header Files + + Header Files + + + Header Files + diff --git a/legion cfg.cpp b/legion cfg.cpp new file mode 100644 index 00000000..ed93e71a --- /dev/null +++ b/legion cfg.cpp @@ -0,0 +1,316 @@ +//legion 2 +#ifdef PRECOMPILEDHEADERS + #include "Types.h" + #include "types.h" + #include "Strategic All.h" + #include "XML.h" + #include "INIReader.h" + #include "GameSettings.h" + #include "Soldier Profile.h" + #include "XML.h" + #include "Item Types.h" + #include "Items.h" + #include "Game Event Hook.h" + #include "faces.h" + #include "Language Defines.h" + #include "Types.h" + #include "Map Screen Interface Map.h" + #include "legion cfg.h" //legion2 + //#include "XMLWriter.h" +#else + #include "Types.h" + #include "types.h" + #include "Campaign Init.h" + #include "Random.h" + #include "Campaign Types.h" + #include "Queen Command.h" + #include "overhead.h" + #include "Strategic Movement.h" + #include "Strategic Status.h" + #include "GameSettings.h" + #include "Creature Spreading.h" + #include "Strategic AI.h" + #include "XML.h" + #include "INIReader.h" + #include "Game init.h" + #include "Game Event Hook.h" + #include "sgp.h" + #include "jascreens.h" + #include "laptop.h" + #include "worlddef.h" + #include "Soldier Control.h" + #include "overhead.h" + #include "fade screen.h" + #include "gamescreen.h" + #include "email.h" + #include "Game Clock.h" + #include "soldier profile.h" + #include "strategicmap.h" + #include "game init.h" + #include "animation data.h" + #include "finances.h" + #include "soldier create.h" + #include "Soldier Init List.h" + #include "music control.h" + #include "strategic.h" + #include "history.h" + #include "merc entering.h" + #include "Squads.h" + #include "Campaign Init.h" + #include "Strategic Town Loyalty.h" + #include "Strategic Mines.h" + #include "gameloop.h" + #include "Random.h" + #include "Map Screen Interface.h" + #include "Tactical Save.h" + #include "Campaign Types.h" + #include "Message.h" + #include "Game Event Hook.h" + #include "Strategic Movement.h" + #include "Creature Spreading.h" + #include "Quests.h" + #include "Strategic AI.h" + #include "sound control.h" + #include "Laptopsave.h" + #include "AimMembers.h" + #include "dialogue control.h" + #include "npc.h" + #include "Init.h" + #include "GameSettings.h" + #include "INIReader.h" + #include "Soldier Profile.h" + #include "XML.h" + #include "Item Types.h" + #include "Items.h" + #include "text.h" + #include "GameSettings.h" +#endif + +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25Update.h" +#endif + +#include "legion cfg.h" //legion2 +#include "Campaign Types.h" +#include "Interface.h" +#include "Map Screen Interface Map.h" +#include "renderworld.h" +#include "aim.h" +#include "connect.h" +#include "expat.h" +#include "XMLWriter.h" +#include "Debug Control.h" +#include + +GAME_LEGION_OPTIONS gGameLegionOptions; + +#define GAME_LEGION_OPTIONS_FILE "UB_Options.ini" + +void LoadGameLegionOptions(); + +#ifdef JA2UB +void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ); +#endif + +void RandomStats (); + +#ifdef JA2UB + +void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ) +{ +UNDERGROUND_SECTORINFO *pSector; +UINT8 ubNumAdmins = 0; +UINT8 ubNumTroops = 0; +UINT8 ubNumElites = 0; + + if ( Level != 0 ) + { + pSector = FindUnderGroundSector( SectorX, SectorY, Level ); + if ( pSector ) + { + if ( pSector->fVisited != TRUE ) + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = Random( 0 ); + ubNumTroops = 10 + Random( 5 ); + ubNumElites = Random( 4 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = Random( 0 ); + ubNumTroops = 15 + Random( 8 ); + ubNumElites = 1 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = Random( 0 ); + ubNumTroops = 20 + Random( 7 ); + ubNumElites = 2 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = Random( 0 ); + ubNumTroops = 20 + Random( 3 ); + ubNumElites = 6 + Random( 3 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + } + } + } + } + else + { + if ( !GetSectorFlagStatus( SectorX, SectorY, Level, SF_ALREADY_VISITED ) ) + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = Random( 0 ); + ubNumTroops = 10 + Random( 5 ); + ubNumElites = Random( 4 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = Random( 0 ); + ubNumTroops = 15 + Random( 8 ); + ubNumElites = 1 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = Random( 0 ); + ubNumTroops = 23 + Random( 7); + ubNumElites = 2 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = Random( 0 ); + ubNumTroops = 20 + Random( 3 ); + ubNumElites = 6 + Random( 3 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + } + } + } +} + +#endif + +void LoadGameLegionOptions() +{ +#ifdef JA2UB + JA2_5_START_SECTOR_X = gGameExternalOptions.ubDefaultArrivalSectorX; + JA2_5_START_SECTOR_Y = gGameExternalOptions.ubDefaultArrivalSectorY; +#endif + + gGameLegionOptions.MercStartingGear25XML = TRUE; + gGameLegionOptions.LOCATEGRIDNO = gGameExternalOptions.iInitialMercArrivalLocation; + gGameLegionOptions.LOCATEGRIDNO2 = 0; + gGameLegionOptions.OLDUBInventory = FALSE; + + CIniReader iniReader(GAME_LEGION_OPTIONS_FILE); + + // ----------------------- + // Unfinished Business + // ----------------------- + + gGameLegionOptions.BorderTown = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TOWN", TRUE); + gGameLegionOptions.BorderMine = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MINE", TRUE); + gGameLegionOptions.BorderTeams = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TEAMS", TRUE); + gGameLegionOptions.BorderMilitia = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MILITIA", FALSE); + gGameLegionOptions.BorderAirspace = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_AIRSPACE", TRUE); + gGameLegionOptions.BorderItem = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_ITEM", TRUE); + + gGameLegionOptions.EventAttackInitialSectorIfPlayerStillThere = iniReader.ReadBoolean("Unfinished Business Settings","EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE", TRUE); + gGameLegionOptions.HandleAddingEnemiesToTunnelMaps = iniReader.ReadBoolean("Unfinished Business Settings","HANDLE_ADDING_ENEMIES_TO_TUNNEL_MAPS", TRUE); + gGameLegionOptions.ubEndDefaultSectorX = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_X", 16, 1, 16); + gGameLegionOptions.ubEndDefaultSectorY = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Y", 11, 1, 16); + gGameLegionOptions.ubEndDefaultSectorZ = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Z", 0, 0, 16); + gGameLegionOptions.AutoResolove = iniReader.ReadBoolean("Unfinished Business Settings","AUTO_RESOLVE", FALSE); + + gGameLegionOptions.InitialHeliGridNo[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_1", 14947); + gGameLegionOptions.InitialHeliGridNo[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_2", 15584); + gGameLegionOptions.InitialHeliGridNo[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_3", 15754); + gGameLegionOptions.InitialHeliGridNo[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_4", 16232); + gGameLegionOptions.InitialHeliGridNo[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_5", 16067); + gGameLegionOptions.InitialHeliGridNo[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_6", 16230); + gGameLegionOptions.InitialHeliGridNo[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_7", 15272); + + gGameLegionOptions.InitalHeliRandomTimes[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_1", 1300); + gGameLegionOptions.InitalHeliRandomTimes[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_2", 2000); + gGameLegionOptions.InitalHeliRandomTimes[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_3", 2750); + gGameLegionOptions.InitalHeliRandomTimes[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_4", 3400); + gGameLegionOptions.InitalHeliRandomTimes[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_5", 4160); + gGameLegionOptions.InitalHeliRandomTimes[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_6", 4700); + gGameLegionOptions.InitalHeliRandomTimes[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_7", 5630); + + gGameLegionOptions.InGameHeliCrash = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_UB_HELICOPTER_CRASH", TRUE); + gGameLegionOptions.JerryQuotes = iniReader.ReadBoolean("Unfinished Business Settings","JERRY_QUOTES", TRUE); + gGameLegionOptions.InJerry = iniReader.ReadBoolean("Unfinished Business Settings","JERRY", TRUE); + gGameLegionOptions.JerryGridNo = iniReader.ReadInteger("Unfinished Business Settings","JERRY_GRIDNO", 15109); + gGameLegionOptions.InGameHeli = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_JA2_HELICOPTER_LANDING", FALSE); + + gGameLegionOptions.SwitchInMorrisAreaGridNo = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_IN_MORRIS_AREA_GRIDNO", 15231); + gGameLegionOptions.SwitchToLaunchMisslesGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_1", 14268); + gGameLegionOptions.SwitchToLaunchMisslesGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_2", 15708); + gGameLegionOptions.RadioLocatorsGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_1", 15070); + gGameLegionOptions.RadioLocatorsGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_2", 14744); + gGameLegionOptions.PowergenSectorGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_1", 15100); + gGameLegionOptions.PowergenSectorGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_2", 12220); + gGameLegionOptions.PowergenSectorGridNo3 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_3", 14155); + gGameLegionOptions.PowergenSectorGridNo4 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_4", 13980); + + gGameLegionOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749); + gGameLegionOptions.PowergenFanSoundGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_1", 10979); + gGameLegionOptions.PowergenFanSoundGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_2", 19749); + gGameLegionOptions.StartFanbackupAgainGridNo = iniReader.ReadInteger("Unfinished Business Settings","START_FANBACKUP_AGAIN_GRIDNO", 10980); + gGameLegionOptions.StopPowergenFanGridNo = iniReader.ReadInteger("Unfinished Business Settings","STOP_POWERGEN_FAN_GRIDNO", 10980); + + //sec J13 + gGameLegionOptions.FanGridNo[0] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_1", 10978); + gGameLegionOptions.FanGridNo[1] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_2", 10979); + gGameLegionOptions.FanGridNo[2] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_3", 10980); + gGameLegionOptions.FanGridNo[3] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_4", 10818); + gGameLegionOptions.FanGridNo[4] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_5", 10819); + gGameLegionOptions.FanGridNo[5] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_6", 10820); + gGameLegionOptions.FanGridNo[6] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_7", 10658); + gGameLegionOptions.FanGridNo[7] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_8", 10659); + gGameLegionOptions.FanGridNo[8] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_9", 10660); + + if ( gGameLegionOptions.InGameHeli == TRUE ) + gGameLegionOptions.InGameHeliCrash = FALSE; + + if ( gGameLegionOptions.InGameHeliCrash == TRUE ) + gGameLegionOptions.InGameHeli = FALSE; + + if ( gGameLegionOptions.InGameHeli == TRUE && gGameLegionOptions.InGameHeliCrash == TRUE ) + { + gGameLegionOptions.InGameHeliCrash = TRUE; + gGameLegionOptions.InGameHeli = FALSE; + } + + // ----------------------- + // Campaign + // ----------------------- + + gGameLegionOptions.EnemyXML = iniReader.ReadBoolean("Campaign Settings","USE_ENEMY_ARMY_XMLS", TRUE); + gGameLegionOptions.AddRandomEnemyToSector = iniReader.ReadBoolean("Campaign Settings","ADD_RANDOM_ENEMY_TO_SECTOR", FALSE); + gGameLegionOptions.StrategicMovementCostsXML = iniReader.ReadBoolean("Campaign Settings","STRATEGIC_MOVEMENT_COSTS_XML", FALSE); + gGameLegionOptions.MakeStrategicMovementCosts = iniReader.ReadBoolean("Campaign Settings","MAKE_STRATEGIC_MOVEMENT_COSTS", FALSE); + gGameLegionOptions.LaptopQuestEnabled = iniReader.ReadBoolean("Campaign Settings","LAPTOP_QUEST", TRUE); + gGameLegionOptions.pJA2UB = iniReader.ReadBoolean("Campaign Settings","JA2UB", TRUE); + gGameLegionOptions.fDeadMerc = iniReader.ReadBoolean("Campaign Settings","NOTIFY_ON_DEAD_AIM_MERCS", FALSE); + + // ----------------------- + // Laptop + // ----------------------- + + gGameLegionOptions.LaptopIMPPassJA2 = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_JA2", FALSE); + gGameLegionOptions.LaptopIMPPassUB = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_UB", TRUE); + gGameLegionOptions.LaptopLinkInsurance = iniReader.ReadBoolean("Laptop Settings","LINK_INSURANCE", FALSE); + gGameLegionOptions.LaptopLinkFuneral = iniReader.ReadBoolean("Laptop Settings","LINK_FUNERAL", TRUE); + gGameLegionOptions.LaptopLinkBobby = iniReader.ReadBoolean("Laptop Settings","LINK_BOBBY", FALSE); + gGameLegionOptions.fBobbyRSite = iniReader.ReadBoolean("Laptop Settings","BOBBY_SITE_ACCESSED", FALSE); +} \ No newline at end of file diff --git a/legion cfg.h b/legion cfg.h new file mode 100644 index 00000000..c8317c2b --- /dev/null +++ b/legion cfg.h @@ -0,0 +1,105 @@ +#ifndef _LEGION_CFG_H +#define _LEGION_CFG_H + +#include "soldier profile type.h" + +extern void LoadGameLegionOptions(); + +typedef struct +{ + BOOLEAN BorderTown; + BOOLEAN BorderMine; + BOOLEAN BorderTeams; + BOOLEAN BorderMilitia; + BOOLEAN BorderAirspace; + BOOLEAN BorderItem; + + BOOLEAN EnemyXML; + BOOLEAN EventAttackInitialSectorIfPlayerStillThere; + BOOLEAN HandleAddingEnemiesToTunnelMaps; + BOOLEAN BobbyRayInventory_UB; + BOOLEAN InitTownLoyalty_UB; + BOOLEAN AutoResolove; + BOOLEAN AddRandomEnemyToSector; + BOOLEAN StrategicMovementCostsXML; + BOOLEAN MakeStrategicMovementCosts; + BOOLEAN MercStartingGear25XML; + UINT32 InitialHeliGridNo[ 7 ]; + INT16 InitalHeliRandomTimes[ 7 ]; + UINT32 LOCATEGRIDNO; + BOOLEAN LaptopIMPPassJA2; + BOOLEAN LaptopIMPPassUB; + + UINT8 ubDefaultArrivalSectorX; + UINT8 ubDefaultArrivalSectorY; + + INT32 iStartingCashNovice; + INT32 iStartingCashExperienced; + INT32 iStartingCashExpert; + INT32 iStartingCashInsane; + + BOOLEAN TEX_AND_JOHN; + + BOOLEAN Random_Manuel_Text; + + BOOLEAN RISRAPORT; + + BOOLEAN LaptopQuestEnabled; + + BOOLEAN InGameHeliCrash; + + BOOLEAN InGameHeli; + + UINT32 LOCATEGRIDNO2; + + BOOLEAN JerryQuotes; + + BOOLEAN InJerry; + + UINT32 JerryGridNo; + + UINT32 SwitchInMorrisAreaGridNo; + UINT32 SwitchToLaunchMisslesGridNo1; + UINT32 SwitchToLaunchMisslesGridNo2; + UINT32 RadioLocatorsGridNo1; + UINT32 RadioLocatorsGridNo2; + UINT32 PowergenSectorGridNo1; + UINT32 PowergenSectorGridNo2; + UINT32 PowergenSectorGridNo3; + UINT32 PowergenSectorGridNo4; + UINT32 PowergenSectorExitgridGridNo; + UINT32 PowergenFanSoundGridNo1; + UINT32 PowergenFanSoundGridNo2; + UINT32 StartFanbackupAgainGridNo; + UINT32 StopPowergenFanGridNo; + + BOOLEAN TestUB; + + BOOLEAN LaptopLinkInsurance; + BOOLEAN LaptopLinkFuneral; + BOOLEAN LaptopLinkBobby; + + UINT32 FanGridNo[9]; + + UINT8 ubEndDefaultSectorX; + UINT8 ubEndDefaultSectorY; + UINT8 ubEndDefaultSectorZ; + + BOOLEAN pJA2UB; + + BOOLEAN fBobbyRSite; + BOOLEAN fDeadMerc; + + BOOLEAN OLDUBInventory; + +} GAME_LEGION_OPTIONS; + +extern GAME_LEGION_OPTIONS gGameLegionOptions; + +#ifdef JA2UB +extern void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ); +extern void RandomStats (); +#endif + +extern void RandomStats (); +#endif \ No newline at end of file diff --git a/mainmenuscreen.h b/mainmenuscreen.h index 1da1d813..d69f50b4 100644 --- a/mainmenuscreen.h +++ b/mainmenuscreen.h @@ -1,6 +1,43 @@ #ifndef _MAINMENU_H #define _MAINMENU_H +//MainMenu by Jazz +#define MAX_MAIN_MENU_IMAGE 200 +#define MAX_MAIN_MENU_CHARS 500 +#define MAX_ELEMENT 20 + +typedef struct +{ + UINT32 uiIndex; // add + BOOLEAN Visible; + CHAR8 Description[MAX_MAIN_MENU_CHARS]; + CHAR8 FileName[MAX_MAIN_MENU_CHARS]; + CHAR8 FileName800x600[MAX_MAIN_MENU_CHARS]; + CHAR8 FileName1024x768[MAX_MAIN_MENU_CHARS]; + INT32 ImagePositionX; + INT32 ImagePositionY; + INT32 ImagePosition800x600X; + INT32 ImagePosition800x600Y; + INT32 ImagePosition1024x768X; + INT32 ImagePosition1024x768Y; + + UINT32 MAINMENU_Y; + UINT32 MAINMENU_800x600Y; + UINT32 MAINMENU_1024x768Y; + UINT32 MAINMENU_Y_SPACE; + + UINT32 MAINMENU_X; + UINT32 MAINMENU_800x600X; + UINT32 MAINMENU_1024x768X; + +} MAIN_MENU_VALUES; + +//Main Menu layout by Jazz +extern MAIN_MENU_VALUES gMainMenulayout[MAX_MAIN_MENU_IMAGE]; + +extern UINT32 MAINMENU_Y; +extern UINT32 MAINMENU_X; +extern UINT32 MAINMENU_Y_SPACE; BOOLEAN InitMainMenu( ); void ClearMainMenu( ); diff --git a/readme.txt b/readme.txt new file mode 100644 index 00000000..37b3c0d0 --- /dev/null +++ b/readme.txt @@ -0,0 +1,21 @@ +Compilation of UB : + +Set #define JA2UB and #define JA2UBMAPS in file builddefines.h. + +Compilation of JA2 : + +Rem #define JA2UB and #define JA2UBMAPS in file builddefines.h. + + +Example : + +UB : + +#define JA2UB +#define JA2UBMAPS + +JA2 : + +//#define JA2UB +//#define JA2UBMAPS + diff --git a/ub_config.cpp b/ub_config.cpp new file mode 100644 index 00000000..57e87e80 --- /dev/null +++ b/ub_config.cpp @@ -0,0 +1,312 @@ +#ifdef PRECOMPILEDHEADERS + #include "Types.h" + #include "types.h" + #include "Strategic All.h" + #include "XML.h" + #include "INIReader.h" + #include "GameSettings.h" + #include "Soldier Profile.h" + #include "XML.h" + #include "Item Types.h" + #include "Items.h" + #include "Game Event Hook.h" + #include "faces.h" + #include "Language Defines.h" + #include "Types.h" + #include "Map Screen Interface Map.h" + #include "ub_config.h" //legion2 +#else + #include "Types.h" + #include "types.h" + #include "Campaign Init.h" + #include "Random.h" + #include "Campaign Types.h" + #include "Queen Command.h" + #include "overhead.h" + #include "Strategic Movement.h" + #include "Strategic Status.h" + #include "GameSettings.h" + #include "Creature Spreading.h" + #include "Strategic AI.h" + #include "XML.h" + #include "INIReader.h" + #include "Game init.h" + #include "Game Event Hook.h" + #include "sgp.h" + #include "jascreens.h" + #include "laptop.h" + #include "worlddef.h" + #include "Soldier Control.h" + #include "overhead.h" + #include "fade screen.h" + #include "gamescreen.h" + #include "email.h" + #include "Game Clock.h" + #include "soldier profile.h" + #include "strategicmap.h" + #include "game init.h" + #include "animation data.h" + #include "finances.h" + #include "soldier create.h" + #include "Soldier Init List.h" + #include "music control.h" + #include "strategic.h" + #include "history.h" + #include "merc entering.h" + #include "Squads.h" + #include "Campaign Init.h" + #include "Strategic Town Loyalty.h" + #include "Strategic Mines.h" + #include "gameloop.h" + #include "Random.h" + #include "Map Screen Interface.h" + #include "Tactical Save.h" + #include "Campaign Types.h" + #include "Message.h" + #include "Game Event Hook.h" + #include "Strategic Movement.h" + #include "Creature Spreading.h" + #include "Quests.h" + #include "Strategic AI.h" + #include "sound control.h" + #include "Laptopsave.h" + #include "AimMembers.h" + #include "dialogue control.h" + #include "npc.h" + #include "Init.h" + #include "GameSettings.h" + #include "INIReader.h" + #include "Soldier Profile.h" + #include "XML.h" + #include "Item Types.h" + #include "Items.h" + #include "text.h" + #include "GameSettings.h" +#endif + +#ifdef JA2UB +#include "Ja25 Strategic Ai.h" +#include "Ja25Update.h" +#endif + +#include "ub_config.h" //legion2 +#include "Campaign Types.h" +#include "Interface.h" +#include "Map Screen Interface Map.h" +#include "renderworld.h" +#include "aim.h" +#include "connect.h" +#include "expat.h" +#include "XMLWriter.h" +#include "Debug Control.h" +#include + +GAME_UB_OPTIONS gGameUBOptions; + +#define GAME_UB_OPTIONS_FILE "UB_Options.ini" + +void LoadGameUBOptions(); + +#ifdef JA2UB +void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ); +#endif + +void RandomStats (); + +#ifdef JA2UB + +void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ) +{ +UNDERGROUND_SECTORINFO *pSector; +UINT8 ubNumAdmins = 0; +UINT8 ubNumTroops = 0; +UINT8 ubNumElites = 0; + + if ( Level != 0 ) + { + pSector = FindUnderGroundSector( SectorX, SectorY, Level ); + if ( pSector ) + { + if ( pSector->fVisited != TRUE ) + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = Random( 0 ); + ubNumTroops = 10 + Random( 5 ); + ubNumElites = Random( 4 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = Random( 0 ); + ubNumTroops = 15 + Random( 8 ); + ubNumElites = 1 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = Random( 0 ); + ubNumTroops = 20 + Random( 7 ); + ubNumElites = 2 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = Random( 0 ); + ubNumTroops = 20 + Random( 3 ); + ubNumElites = 6 + Random( 3 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + } + } + } + } + else + { + if ( !GetSectorFlagStatus( SectorX, SectorY, Level, SF_ALREADY_VISITED ) ) + { + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + ubNumAdmins = Random( 0 ); + ubNumTroops = 10 + Random( 5 ); + ubNumElites = Random( 4 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_MEDIUM: + ubNumAdmins = Random( 0 ); + ubNumTroops = 15 + Random( 8 ); + ubNumElites = 1 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_HARD: + ubNumAdmins = Random( 0 ); + ubNumTroops = 23 + Random( 7); + ubNumElites = 2 + Random( 2 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + case DIF_LEVEL_INSANE: + ubNumAdmins = Random( 0 ); + ubNumTroops = 20 + Random( 3 ); + ubNumElites = 6 + Random( 3 ); + SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites ); + break; + } + } + } +} + +#endif + +void LoadGameUBOptions() +{ +#ifdef JA2UB + JA2_5_START_SECTOR_X = gGameExternalOptions.ubDefaultArrivalSectorX; + JA2_5_START_SECTOR_Y = gGameExternalOptions.ubDefaultArrivalSectorY; +#endif + + gGameUBOptions.LOCATEGRIDNO = gGameExternalOptions.iInitialMercArrivalLocation; + gGameUBOptions.LOCATEGRIDNO2 = 0; + + CIniReader iniReader(GAME_UB_OPTIONS_FILE); + + // ----------------------- + // Unfinished Business + // ----------------------- + + gGameUBOptions.BorderTown = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TOWN", TRUE); + gGameUBOptions.BorderMine = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MINE", TRUE); + gGameUBOptions.BorderTeams = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TEAMS", TRUE); + gGameUBOptions.BorderMilitia = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MILITIA", FALSE); + gGameUBOptions.BorderAirspace = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_AIRSPACE", TRUE); + gGameUBOptions.BorderItem = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_ITEM", TRUE); + + gGameUBOptions.EventAttackInitialSectorIfPlayerStillThere = iniReader.ReadBoolean("Unfinished Business Settings","EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE", TRUE); + gGameUBOptions.HandleAddingEnemiesToTunnelMaps = iniReader.ReadBoolean("Unfinished Business Settings","HANDLE_ADDING_ENEMIES_TO_TUNNEL_MAPS", TRUE); + gGameUBOptions.ubEndDefaultSectorX = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_X", 16, 1, 16); + gGameUBOptions.ubEndDefaultSectorY = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Y", 11, 1, 16); + gGameUBOptions.ubEndDefaultSectorZ = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Z", 0, 0, 16); + gGameUBOptions.AutoResolve = iniReader.ReadBoolean("Unfinished Business Settings","AUTO_RESOLVE", FALSE); + + gGameUBOptions.InitialHeliGridNo[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_1", 14947); + gGameUBOptions.InitialHeliGridNo[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_2", 15584); + gGameUBOptions.InitialHeliGridNo[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_3", 15754); + gGameUBOptions.InitialHeliGridNo[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_4", 16232); + gGameUBOptions.InitialHeliGridNo[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_5", 16067); + gGameUBOptions.InitialHeliGridNo[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_6", 16230); + gGameUBOptions.InitialHeliGridNo[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_7", 15272); + + gGameUBOptions.InitalHeliRandomTimes[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_1", 1300); + gGameUBOptions.InitalHeliRandomTimes[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_2", 2000); + gGameUBOptions.InitalHeliRandomTimes[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_3", 2750); + gGameUBOptions.InitalHeliRandomTimes[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_4", 3400); + gGameUBOptions.InitalHeliRandomTimes[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_5", 4160); + gGameUBOptions.InitalHeliRandomTimes[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_6", 4700); + gGameUBOptions.InitalHeliRandomTimes[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_7", 5630); + + gGameUBOptions.InGameHeliCrash = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_UB_HELICOPTER_CRASH", TRUE); + gGameUBOptions.JerryQuotes = iniReader.ReadBoolean("Unfinished Business Settings","JERRY_QUOTES", TRUE); + gGameUBOptions.InJerry = iniReader.ReadBoolean("Unfinished Business Settings","JERRY", TRUE); + gGameUBOptions.JerryGridNo = iniReader.ReadInteger("Unfinished Business Settings","JERRY_GRIDNO", 15109); + gGameUBOptions.InGameHeli = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_JA2_HELICOPTER_LANDING", FALSE); + + gGameUBOptions.SwitchInMorrisAreaGridNo = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_IN_MORRIS_AREA_GRIDNO", 15231); + gGameUBOptions.SwitchToLaunchMisslesGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_1", 14268); + gGameUBOptions.SwitchToLaunchMisslesGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_2", 15708); + gGameUBOptions.RadioLocatorsGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_1", 15070); + gGameUBOptions.RadioLocatorsGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_2", 14744); + gGameUBOptions.PowergenSectorGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_1", 15100); + gGameUBOptions.PowergenSectorGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_2", 12220); + gGameUBOptions.PowergenSectorGridNo3 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_3", 14155); + gGameUBOptions.PowergenSectorGridNo4 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_4", 13980); + + gGameUBOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749); + gGameUBOptions.PowergenFanSoundGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_1", 10979); + gGameUBOptions.PowergenFanSoundGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_2", 19749); + gGameUBOptions.StartFanbackupAgainGridNo = iniReader.ReadInteger("Unfinished Business Settings","START_FANBACKUP_AGAIN_GRIDNO", 10980); + gGameUBOptions.StopPowergenFanGridNo = iniReader.ReadInteger("Unfinished Business Settings","STOP_POWERGEN_FAN_GRIDNO", 10980); + + //sec J13 + gGameUBOptions.FanGridNo[0] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_1", 10978); + gGameUBOptions.FanGridNo[1] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_2", 10979); + gGameUBOptions.FanGridNo[2] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_3", 10980); + gGameUBOptions.FanGridNo[3] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_4", 10818); + gGameUBOptions.FanGridNo[4] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_5", 10819); + gGameUBOptions.FanGridNo[5] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_6", 10820); + gGameUBOptions.FanGridNo[6] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_7", 10658); + gGameUBOptions.FanGridNo[7] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_8", 10659); + gGameUBOptions.FanGridNo[8] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_9", 10660); + + if ( gGameUBOptions.InGameHeli == TRUE ) + gGameUBOptions.InGameHeliCrash = FALSE; + + if ( gGameUBOptions.InGameHeliCrash == TRUE ) + gGameUBOptions.InGameHeli = FALSE; + + if ( gGameUBOptions.InGameHeli == TRUE && gGameUBOptions.InGameHeliCrash == TRUE ) + { + gGameUBOptions.InGameHeliCrash = TRUE; + gGameUBOptions.InGameHeli = FALSE; + } + + // ----------------------- + // Campaign + // ----------------------- + + gGameUBOptions.EnemyXML = iniReader.ReadBoolean("Campaign Settings","USE_ENEMY_ARMY_XMLS", TRUE); + gGameUBOptions.AddRandomEnemyToSector = iniReader.ReadBoolean("Campaign Settings","ADD_RANDOM_ENEMY_TO_SECTOR", FALSE); + gGameUBOptions.StrategicMovementCostsXML = iniReader.ReadBoolean("Campaign Settings","STRATEGIC_MOVEMENT_COSTS_XML", FALSE); + gGameUBOptions.MakeStrategicMovementCosts = iniReader.ReadBoolean("Campaign Settings","MAKE_STRATEGIC_MOVEMENT_COSTS", FALSE); + gGameUBOptions.LaptopQuestEnabled = iniReader.ReadBoolean("Campaign Settings","LAPTOP_QUEST", TRUE); + gGameUBOptions.pJA2UB = iniReader.ReadBoolean("Campaign Settings","JA2UB", TRUE); + gGameUBOptions.fDeadMerc = iniReader.ReadBoolean("Campaign Settings","NOTIFY_ON_DEAD_AIM_MERCS", FALSE); + + // ----------------------- + // Laptop + // ----------------------- + + gGameUBOptions.LaptopIMPPassJA2 = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_JA2", FALSE); + gGameUBOptions.LaptopIMPPassUB = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_UB", TRUE); + gGameUBOptions.LaptopLinkInsurance = iniReader.ReadBoolean("Laptop Settings","LINK_INSURANCE", FALSE); + gGameUBOptions.LaptopLinkFuneral = iniReader.ReadBoolean("Laptop Settings","LINK_FUNERAL", TRUE); + gGameUBOptions.LaptopLinkBobby = iniReader.ReadBoolean("Laptop Settings","LINK_BOBBY", FALSE); + gGameUBOptions.fBobbyRSite = iniReader.ReadBoolean("Laptop Settings","BOBBY_SITE_ACCESSED", FALSE); +} \ No newline at end of file diff --git a/ub_config.h b/ub_config.h new file mode 100644 index 00000000..1c3924d2 --- /dev/null +++ b/ub_config.h @@ -0,0 +1,104 @@ +#ifndef _UB_CONFIG_CFG_H +#define _UB_CONFIG_CFG_H + +#include "soldier profile type.h" + +extern void LoadGameUBOptions(); + +typedef struct +{ + BOOLEAN BorderTown; + BOOLEAN BorderMine; + BOOLEAN BorderTeams; + BOOLEAN BorderMilitia; + BOOLEAN BorderAirspace; + BOOLEAN BorderItem; + + BOOLEAN EnemyXML; + BOOLEAN EventAttackInitialSectorIfPlayerStillThere; + BOOLEAN HandleAddingEnemiesToTunnelMaps; + BOOLEAN BobbyRayInventory_UB; + BOOLEAN InitTownLoyalty_UB; + BOOLEAN AutoResolve; + BOOLEAN AddRandomEnemyToSector; + BOOLEAN StrategicMovementCostsXML; + BOOLEAN MakeStrategicMovementCosts; + UINT32 InitialHeliGridNo[ 7 ]; + INT16 InitalHeliRandomTimes[ 7 ]; + UINT32 LOCATEGRIDNO; + BOOLEAN LaptopIMPPassJA2; + BOOLEAN LaptopIMPPassUB; + + UINT8 ubDefaultArrivalSectorX; + UINT8 ubDefaultArrivalSectorY; + + INT32 iStartingCashNovice; + INT32 iStartingCashExperienced; + INT32 iStartingCashExpert; + INT32 iStartingCashInsane; + + BOOLEAN fTexAndJohn; + + BOOLEAN fRandomManuelText; + + BOOLEAN RISRAPORT; + + BOOLEAN LaptopQuestEnabled; + + BOOLEAN InGameHeliCrash; + + BOOLEAN InGameHeli; + + UINT32 LOCATEGRIDNO2; + + BOOLEAN JerryQuotes; + + BOOLEAN InJerry; + + UINT32 JerryGridNo; + + UINT32 SwitchInMorrisAreaGridNo; + UINT32 SwitchToLaunchMisslesGridNo1; + UINT32 SwitchToLaunchMisslesGridNo2; + UINT32 RadioLocatorsGridNo1; + UINT32 RadioLocatorsGridNo2; + UINT32 PowergenSectorGridNo1; + UINT32 PowergenSectorGridNo2; + UINT32 PowergenSectorGridNo3; + UINT32 PowergenSectorGridNo4; + UINT32 PowergenSectorExitgridGridNo; + UINT32 PowergenFanSoundGridNo1; + UINT32 PowergenFanSoundGridNo2; + UINT32 StartFanbackupAgainGridNo; + UINT32 StopPowergenFanGridNo; + + BOOLEAN TestUB; + + BOOLEAN LaptopLinkInsurance; + BOOLEAN LaptopLinkFuneral; + BOOLEAN LaptopLinkBobby; + + UINT32 FanGridNo[9]; + + UINT8 ubEndDefaultSectorX; + UINT8 ubEndDefaultSectorY; + UINT8 ubEndDefaultSectorZ; + + BOOLEAN pJA2UB; + + BOOLEAN fBobbyRSite; + BOOLEAN fDeadMerc; + + UINT8 MaxNumberOfMercs; + +} GAME_UB_OPTIONS; + +extern GAME_UB_OPTIONS gGameUBOptions; + +#ifdef JA2UB +extern void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ); +extern void RandomStats (); +#endif + +extern void RandomStats (); +#endif \ No newline at end of file