diff --git a/GameVersion.h b/GameVersion.h index 1f304676..bdce3346 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -20,10 +20,11 @@ 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 121 //114 //113 //112 //111 //110 //109 //108 //107 //106 //105 //104 //103 //102 //101 //100 // 99 +#define SAVE_GAME_VERSION 122 //114 //113 //112 //111 //110 //109 //108 //107 //106 //105 //104 //103 //102 //101 //100 // 99 -#define CURRENT_SAVEGAME_DATATYPE_VERSION 121 +#define CURRENT_SAVEGAME_DATATYPE_VERSION 122 +#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. #define MOVED_GENERAL_INFO 120 // Before this, general game information was saved much later in the save game process. #define NCTH_AUTOFIRE_UPDATE 119 // Before this, we didn't track the original autofire offsets diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 7a92745f..3f7e096b 100644 Binary files a/Laptop/mercs Files.cpp and b/Laptop/mercs Files.cpp differ diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index d29529a5..6a1ee236 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -8127,7 +8127,7 @@ void AssignPersonnelKillsHelpText( INT32 IMercId ) if (gMercProfiles[Menptr[IMercId].ubProfile].records.usKillsCreatures > 0 || fShowRecordsIfZero) { // WANNE: Only display the monster info, when we play with monsters! - if (gGameExternalOptions.fEnableCrepitus) + if (gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus) { swprintf(atStr, pPersonnelRecordsHelpTexts[ 4 ], gMercProfiles[Menptr[IMercId].ubProfile].records.usKillsCreatures ); wcscat( apStr, atStr ); diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index b421796c..239b8e55 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -5027,6 +5027,25 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) CancelAllPendingBRPurchaseOrders(); } + // WANNE: THis should fix the bug with initializing problem in GameInit.lua on startup, in which we could meet crepitus in Tixa underground map + if(guiCurrentSaveGameVersion < FIXED_CREPITUS_IN_REALISTIC_GAME_MODE) + { + if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus ) + { + // Nothing to do here + } + else + { //not scifi, so use alternate map in Tixa's b1 level that doesn't have the stairs going down to the caves. + UNDERGROUND_SECTORINFO *pSector; + pSector = FindUnderGroundSector( 9, 10, 1 ); //j9_b1 + if( pSector ) + { + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + } + } + } + + // --------------------------------------------------------------------------- //if the world is loaded, apply the temp files to the loaded map if( SaveGameHeader.fWorldLoaded || guiCurrentSaveGameVersion < 50 ) @@ -5319,11 +5338,6 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) } - - - - - BOOLEAN SaveMercProfiles( HWFILE hFile ) { UINT16 cnt; diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index a40f8760..fe50bf06 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -965,9 +965,15 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) //Called by campaign init. void ChooseCreatureQuestStartDay() { + if (gGameOptions.ubGameStyle == STYLE_REALISTIC || !gGameExternalOptions.fEnableCrepitus) + return; + + /* // INT32 iRandom, iDay; if( !(gGameOptions.ubGameStyle == STYLE_SCIFI) || !gGameExternalOptions.fEnableCrepitus) return; //only available in science fiction mode. + */ + //Post the event. Once it becomes due, it will setup the queen monster's location, and //begin spreading and attacking towns from there. switch( gGameOptions.ubDifficultyLevel ) @@ -1435,8 +1441,15 @@ void CheckConditionsForTriggeringCreatureQuest( INT16 sSectorX, INT16 sSectorY, // move to Scripts/StrategicTownLoyalty.lua UINT8 ubValidMines = 0; + + if (gGameOptions.ubGameStyle == STYLE_REALISTIC || !gGameExternalOptions.fEnableCrepitus) + return; + + /* if( !(gGameOptions.ubGameStyle == STYLE_SCIFI) || !gGameExternalOptions.fEnableCrepitus) return; //No scifi, no creatures... + */ + if( giLairID ) return; //Creature quest already begun diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index 70ae65f2..b5e35d9f 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -76,6 +76,7 @@ #include "aim.h" #include "LuaInitNPCs.h" +#include "Luaglobal.h" class OBJECTTYPE; class SOLDIERTYPE; @@ -94,9 +95,10 @@ UINT8 gubScreenCount=0; void InitNPCs( void ) { + +#ifdef LUA_GAME_INIT_NPCS LetLuaGameInit(1); - - #if 0 +#else MERCPROFILESTRUCT * pProfile; @@ -139,7 +141,6 @@ void InitNPCs( void ) pProfile->bSectorZ = 0; } - #ifdef JA2TESTVERSION ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Skyrider in %c %d", 'A' + pProfile->sSectorY - 1, pProfile->sSectorX ); #endif @@ -147,7 +148,6 @@ void InitNPCs( void ) // use alternate map, with Skyrider's shack, in this sector SectorInfo[ SECTOR( pProfile->sSectorX, pProfile->sSectorY ) ].uiFlags |= SF_USE_ALTERNATE_MAP; - // set up Madlab's secret lab (he'll be added when the meanwhile scene occurs) if (!is_networked) @@ -228,7 +228,7 @@ void InitNPCs( void ) gfPlayerTeamSawJoey = FALSE; - if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus ) + if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus ) { // add Bob pProfile = &(gMercProfiles[BOB]); @@ -623,9 +623,61 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) // this is for the "mercs climbing down from a rope" animation, NOT Skyrider!! ResetHeliSeats( ); - - LetLuaGameInit(0); - + +#ifdef LUA_GAME_INIT_NEW_GAME + LetLuaGameInit(0); +#else + INT32 iStartingCash; + + // Setup two new messages! + AddPreReadEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddPreReadEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddPreReadEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin() ); + AddPreReadEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1, -1); + //AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + if(gGameExternalOptions.fMercDayOne) + { + AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1, 1 ); + } + + // ATE: Set starting cash.... + switch( gGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + + iStartingCash = gGameExternalOptions.iStartingCashNovice; + //iStartingCash = 45000; + break; + + case DIF_LEVEL_MEDIUM: + + iStartingCash = gGameExternalOptions.iStartingCashExperienced; + //iStartingCash = 35000; + break; + + case DIF_LEVEL_HARD: + + iStartingCash = gGameExternalOptions.iStartingCashExpert; + //iStartingCash = 30000; + break; + + case DIF_LEVEL_INSANE: + + iStartingCash = gGameExternalOptions.iStartingCashInsane; + // iStartingCash = 15000; + break; + + default: + Assert(0); + return( FALSE ); + } + + // Setup initial money + AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash ); + +#endif + UINT32 uiDaysTimeMercSiteAvailable = Random( 2 ) + 1; // schedule email for message from spec at 7am 3 days in the future diff --git a/Strategic/Luaglobal.h b/Strategic/Luaglobal.h index 3cde6a89..d056b9ed 100644 --- a/Strategic/Luaglobal.h +++ b/Strategic/Luaglobal.h @@ -11,6 +11,8 @@ 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 diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 988b1e73..45920834 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -1782,11 +1782,16 @@ void HandleRPCDescriptionOfSector( INT16 sSectorX, INT16 sSectorY, INT16 sSector { if ( sSectorX == ubSectorDescription[ cnt ][ 1 ] && sSectorY == ubSectorDescription[ cnt ][ 0 ] ) { + if ((gGameOptions.ubGameStyle == STYLE_REALISTIC || !gGameExternalOptions.fEnableCrepitus) && cnt == 3) + continue; + + /* // If we're not scifi, skip some if ( !(gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus) && cnt == 3 ) { continue; } + */ SetSectorFlag( sSectorX, sSectorY, ( UINT8 )sSectorZ, SF_HAVE_USED_GUIDE_QUOTE ); diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index d9f950ca..a1402bbd 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -2618,7 +2618,19 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum EndMeanwhile( ); break; case NPC_ACTION_NO_SCI_FI_END_MEANWHILE: - + if (gGameOptions.ubGameStyle == STYLE_REALISTIC || !gGameExternalOptions.fEnableCrepitus) + { + // End meanwhile.... + // End meanwhile.... + DeleteTalkingMenu(); + EndMeanwhile( ); + } + else + { + TriggerNPCRecord( QUEEN, 8 ); + } + + /* if ( !( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus) ) { // End meanwhile.... @@ -2630,6 +2642,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { TriggerNPCRecord( QUEEN, 8 ); } + */ break; case NPC_ACTION_TRIGGER_MARRY_DARYL_PROMPT: DeleteTalkingMenu();