- Fixed Tixa problem: When playing Realistic you could go down to underground level where crepitus are

o When loading such a buggy savegame, we will fix it automatically

- Simplified (reworked) IF-conditions with crepitus

- new define in luaglobal.h: LUA_GAME_INIT_NEW_GAME, LUA_GAME_INIT_NPCS.
o So we can select if we want to use lua script (GameInit.lua) or the hardcoded JA2 stuff

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4475 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-06-06 19:04:56 +00:00
parent bfbe6b0311
commit 75b4d43964
9 changed files with 117 additions and 17 deletions
+3 -2
View File
@@ -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
Binary file not shown.
+1 -1
View File
@@ -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 );
+19 -5
View File
@@ -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;
+13
View File
@@ -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
+60 -8
View File
@@ -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
+2
View File
@@ -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
+5
View File
@@ -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 );
+14 -1
View File
@@ -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();