Removed option AI_DECISION_INFO.

Added quest debug logging to Logs\QuestInfo.txt

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9177 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-10-14 08:35:32 +00:00
parent 9f787dd73d
commit 0a717c2697
13 changed files with 107 additions and 12 deletions
-1
View File
@@ -2349,7 +2349,6 @@ void LoadGameExternalOptions()
gGameExternalOptions.fAITacticalRetreat = iniReader.ReadBoolean("Tactical AI Settings", "AI_TACTICAL_RETREAT", FALSE); gGameExternalOptions.fAITacticalRetreat = iniReader.ReadBoolean("Tactical AI Settings", "AI_TACTICAL_RETREAT", FALSE);
gGameExternalOptions.fAIMovementMode = iniReader.ReadBoolean("Tactical AI Settings", "AI_MOVEMENT_MODE", TRUE); gGameExternalOptions.fAIMovementMode = iniReader.ReadBoolean("Tactical AI Settings", "AI_MOVEMENT_MODE", TRUE);
gGameExternalOptions.fAIPathTweaks = iniReader.ReadBoolean("Tactical AI Settings", "AI_PATH_TWEAKS", TRUE); gGameExternalOptions.fAIPathTweaks = iniReader.ReadBoolean("Tactical AI Settings", "AI_PATH_TWEAKS", TRUE);
gGameExternalOptions.fAIDecisionInfo = iniReader.ReadBoolean("Tactical AI Settings", "AI_DECISION_INFO", FALSE);
gGameExternalOptions.fAIShootUnseen = iniReader.ReadBoolean("Tactical AI Settings", "AI_SHOOT_UNSEEN", FALSE); gGameExternalOptions.fAIShootUnseen = iniReader.ReadBoolean("Tactical AI Settings", "AI_SHOOT_UNSEEN", FALSE);
gGameExternalOptions.fAISafeSuppression = iniReader.ReadBoolean("Tactical AI Settings", "AI_SAFE_SUPPRESSION", TRUE); gGameExternalOptions.fAISafeSuppression = iniReader.ReadBoolean("Tactical AI Settings", "AI_SAFE_SUPPRESSION", TRUE);
-1
View File
@@ -1578,7 +1578,6 @@ typedef struct
BOOLEAN fAITacticalRetreat; BOOLEAN fAITacticalRetreat;
BOOLEAN fAIMovementMode; BOOLEAN fAIMovementMode;
BOOLEAN fAIPathTweaks; BOOLEAN fAIPathTweaks;
BOOLEAN fAIDecisionInfo;
BOOLEAN fAIShootUnseen; BOOLEAN fAIShootUnseen;
BOOLEAN fAISafeSuppression; BOOLEAN fAISafeSuppression;
+2
View File
@@ -6847,6 +6847,8 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
fclose( fp_timelog ); fclose( fp_timelog );
#endif #endif
DebugQuestInfo("\n--------- Game loaded ---------");
return( TRUE ); return( TRUE );
} }
+2 -2
View File
@@ -538,6 +538,8 @@ void ShutdownStrategicLayer()
ClearTacticalMessageQueue(); ClearTacticalMessageQueue();
} }
extern void DebugQuestInfo(STR szOutput);
BOOLEAN InitNewGame( BOOLEAN fReset ) BOOLEAN InitNewGame( BOOLEAN fReset )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame"); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame");
@@ -833,8 +835,6 @@ fFirstTimeInMapScreen = TRUE;
return( TRUE ); return( TRUE );
} }
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame done"); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame done");
return( TRUE ); return( TRUE );
} }
+12 -1
View File
@@ -3584,8 +3584,11 @@ static int l_gubBoxerID(lua_State *L)
UINT8 val = lua_tointeger( L, 1 ); UINT8 val = lua_tointeger( L, 1 );
UINT8 val2 = lua_tointeger( L, 2 ); UINT8 val2 = lua_tointeger( L, 2 );
if ( val <= 2 ) if (val <= 2)
{
gubBoxerID[val] = val2; gubBoxerID[val] = val2;
DebugQuestInfo(String("Lua: set gubBoxerID[%d] %d", val, gubBoxerID[val]));
}
} }
return 0; return 0;
@@ -8195,6 +8198,7 @@ static int l_SetgfBoxerFought (lua_State *L)
BOOLEAN Bool = lua_toboolean( L, 2 ); BOOLEAN Bool = lua_toboolean( L, 2 );
gfBoxerFought[id] = Bool; gfBoxerFought[id] = Bool;
DebugQuestInfo(String("lua: set gfBoxerFought[%d] %d ", id, Bool));
} }
return 0; return 0;
@@ -8203,7 +8207,10 @@ static int l_SetgfBoxerFought (lua_State *L)
static int l_SetgfBoxersResting(lua_State *L) static int l_SetgfBoxersResting(lua_State *L)
{ {
if (lua_gettop(L)) if (lua_gettop(L))
{
gfBoxersResting = lua_toboolean(L, 1); gfBoxersResting = lua_toboolean(L, 1);
DebugQuestInfo(String("lua: set gfBoxersResting %d", gfBoxersResting));
}
return 0; return 0;
} }
@@ -8211,7 +8218,10 @@ static int l_SetgfBoxersResting(lua_State *L)
static int l_SetgubBoxersRests(lua_State *L) static int l_SetgubBoxersRests(lua_State *L)
{ {
if (lua_gettop(L)) if (lua_gettop(L))
{
gubBoxersRests = lua_tointeger(L, 1); gubBoxersRests = lua_tointeger(L, 1);
DebugQuestInfo(String("lua: set gubBoxersRests %d ", gubBoxersRests));
}
return 0; return 0;
} }
@@ -10605,6 +10615,7 @@ static int l_ResetBoxers( lua_State *L )
gubBoxerID[i] = NOBODY; gubBoxerID[i] = NOBODY;
// sevenfm: keep gfBoxerFought[] unchanged as it will be reset every day at 16:00 by HourlyQuestUpdate(), HourlyUpdate.lua // sevenfm: keep gfBoxerFought[] unchanged as it will be reset every day at 16:00 by HourlyQuestUpdate(), HourlyUpdate.lua
//gfBoxerFought[i] = FALSE; //gfBoxerFought[i] = FALSE;
DebugQuestInfo(String("Lua: reset boxer gubBoxerID[%d] %d", i, gubBoxerID[i]));
} }
return 0; return 0;
+10 -1
View File
@@ -70,17 +70,19 @@ extern void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemInde
extern void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpReward, UINT8 bException ); extern void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpReward, UINT8 bException );
extern void DebugQuestInfo(STR szOutput);
void SetFactTrue( UINT16 usFact ) void SetFactTrue( UINT16 usFact )
{ {
// This function is here just for control flow purposes (debug breakpoints) // This function is here just for control flow purposes (debug breakpoints)
// and code is more readable that way // and code is more readable that way
// must intercept when Jake is first trigered to start selling fuel // must intercept when Jake is first triggered to start selling fuel
if ( ( usFact == FACT_ESTONI_REFUELLING_POSSIBLE ) && ( CheckFact( usFact, 0 ) == FALSE ) ) if ( ( usFact == FACT_ESTONI_REFUELLING_POSSIBLE ) && ( CheckFact( usFact, 0 ) == FALSE ) )
{ {
// give him some gas... // give him some gas...
GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_JAKE, GAS_CAN, ( UINT8 ) ( 4 + Random( 3 ) ) ); GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_JAKE, GAS_CAN, ( UINT8 ) ( 4 + Random( 3 ) ) );
DebugQuestInfo(String("guarantee X items of %d (GAS_CAN) for dealer %d (ARMS_DEALER_JAKE)", GAS_CAN, ARMS_DEALER_JAKE));
} }
gubFact[usFact] = TRUE; gubFact[usFact] = TRUE;
@@ -89,6 +91,7 @@ void SetFactTrue( UINT16 usFact )
void SetFactFalse( UINT16 usFact ) void SetFactFalse( UINT16 usFact )
{ {
gubFact[usFact] = FALSE; gubFact[usFact] = FALSE;
DebugQuestInfo(String("fact %d false", usFact));
} }
BOOLEAN CheckForNewShipment( void ) BOOLEAN CheckForNewShipment( void )
@@ -1381,6 +1384,7 @@ UINT8 GetFact( UINT16 usFact )
void StartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY ) void StartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY )
{ {
DebugQuestInfo(String("start quest %d sector %d %d", ubQuest, sSectorX, sSectorY));
InternalStartQuest( ubQuest, sSectorX, sSectorY, TRUE ); InternalStartQuest( ubQuest, sSectorX, sSectorY, TRUE );
} }
@@ -1409,6 +1413,7 @@ void InternalStartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN
void EndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY ) void EndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY )
{ {
DebugQuestInfo(String("end quest %d sector %d %d", ubQuest, sSectorX, sSectorY));
InternalEndQuest( ubQuest, sSectorX, sSectorY, TRUE ); InternalEndQuest( ubQuest, sSectorX, sSectorY, TRUE );
} }
@@ -1565,6 +1570,8 @@ void InitQuestEngine()
memset(gubQuest, 0, sizeof(gubQuest)); memset(gubQuest, 0, sizeof(gubQuest));
memset(gubFact, 0, sizeof(gubFact)); memset(gubFact, 0, sizeof(gubFact));
DebugQuestInfo(String("\nInit Quest Engine"));
// semi-hack to make the letter quest start right away // semi-hack to make the letter quest start right away
CheckForQuests( 1 ); CheckForQuests( 1 );
@@ -1583,6 +1590,8 @@ void InitQuestEngine()
gfBoxersResting = FALSE; gfBoxersResting = FALSE;
InitLUAModderData( ); InitLUAModderData( );
DebugQuestInfo(String("reset gubBoxersRests 0, gubBoxingMatchesWon 0, gfBoxersResting FALSE gubCambriaMedicalObjects %d", gubCambriaMedicalObjects));
} }
+3 -1
View File
@@ -3162,7 +3162,7 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
//Moa: removed this function and replaced by the handling function. //Moa: removed this function and replaced by the handling function.
//SectorInventoryCooldownFunctions(sSectorX, sSectorY, bSectorZ); //SectorInventoryCooldownFunctions(sSectorX, sSectorY, bSectorZ);
//moved from SectorInventoryCooldownFunctions. Invisible items are handled as well. //moved from SectorInventoryCooldownFunctions. Invisible items are handled as well.
//Since we have allready loaded the items previously we can use the globals here. //Since we have already loaded the items previously we can use the globals here.
HandleSectorCooldownFunctions( sSectorX, sSectorY, (INT8)bSectorZ, gWorldItems, guiNumWorldItems, TRUE ); HandleSectorCooldownFunctions( sSectorX, sSectorY, (INT8)bSectorZ, gWorldItems, guiNumWorldItems, TRUE );
//Update LastTimePlayerWasInSector //Update LastTimePlayerWasInSector
SetLastTimePlayerWasInSector( ); SetLastTimePlayerWasInSector( );
@@ -3170,6 +3170,8 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
//Save to tempfile //Save to tempfile
SaveWorldItemsToTempItemFile( sSectorX, sSectorY, (INT8)bSectorZ, guiNumWorldItems, gWorldItems ); SaveWorldItemsToTempItemFile( sSectorX, sSectorY, (INT8)bSectorZ, guiNumWorldItems, gWorldItems );
DebugQuestInfo(String("--- Enter Sector %s%s Level %d ---", pVertStrings[sSectorY], pHortStrings[sSectorX], bSectorZ));
return TRUE; //because the map was loaded. return TRUE; //because the map was loaded.
} }
+7
View File
@@ -145,6 +145,7 @@ void EndBoxingMatch( SOLDIERTYPE * pLoser )
SetBoxingState( WON_ROUND ); SetBoxingState( WON_ROUND );
gfLastBoxingMatchWonByPlayer = TRUE; gfLastBoxingMatchWonByPlayer = TRUE;
gubBoxingMatchesWon++; gubBoxingMatchesWon++;
DebugQuestInfo(String("EndBoxingMatch: gubBoxingMatchesWon %d gfLastBoxingMatchWonByPlayer %d", gubBoxingMatchesWon, gfLastBoxingMatchWonByPlayer));
} }
TriggerNPCRecord( DARREN, 22 ); TriggerNPCRecord( DARREN, 22 );
} }
@@ -303,6 +304,7 @@ void CountPeopleInBoxingRingAndDoActions( void )
// start match! // start match!
SetBoxingState(BOXING); SetBoxingState(BOXING);
gfLastBoxingMatchWonByPlayer = FALSE; gfLastBoxingMatchWonByPlayer = FALSE;
DebugQuestInfo(String("Start Match: gfLastBoxingMatchWonByPlayer %d", gfLastBoxingMatchWonByPlayer));
#ifdef JA2TESTVERSION #ifdef JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Boxer APs %d %d", pInRing[0]->bActionPoints, pInRing[1]->bActionPoints ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Boxer APs %d %d", pInRing[0]->bActionPoints, pInRing[1]->bActionPoints );
@@ -347,6 +349,7 @@ BOOLEAN CheckOnBoxers( void )
{ {
// no weapon and not a civilian so this guy is a boxer // no weapon and not a civilian so this guy is a boxer
gubBoxerID[ uiLoop ] = ubID; gubBoxerID[ uiLoop ] = ubID;
DebugQuestInfo(String("CheckOnBoxers: set gubBoxerID[%d] %d", ubID, gubBoxerID[uiLoop]));
} }
} }
} }
@@ -401,6 +404,7 @@ BOOLEAN PickABoxer( void )
CancelAIAction( pBoxer, TRUE ); CancelAIAction( pBoxer, TRUE );
RESETTIMECOUNTER( pBoxer->timeCounters.AICounter, 0 ); RESETTIMECOUNTER( pBoxer->timeCounters.AICounter, 0 );
gfBoxerFought[ uiLoop ] = TRUE; gfBoxerFought[ uiLoop ] = TRUE;
DebugQuestInfo(String("PickABoxer: set gfBoxerFought[%d] %d", uiLoop, gfBoxerFought[uiLoop]));
// improve stats based on the # of rests these guys have had // improve stats based on the # of rests these guys have had
pBoxer->stats.bStrength = __min( 100, pBoxer->stats.bStrength + gubBoxersRests * 5 ); pBoxer->stats.bStrength = __min( 100, pBoxer->stats.bStrength + gubBoxersRests * 5 );
pBoxer->stats.bDexterity = __min( 100, pBoxer->stats.bDexterity + gubBoxersRests * 5 ); pBoxer->stats.bDexterity = __min( 100, pBoxer->stats.bDexterity + gubBoxersRests * 5 );
@@ -529,6 +533,8 @@ void BoxingMovementCheck( SOLDIERTYPE * pSoldier )
void SetBoxingState( INT8 bNewState ) void SetBoxingState( INT8 bNewState )
{ {
DebugQuestInfo(String("SetBoxingState: %d", bNewState));
if ( gTacticalStatus.bBoxingState == NOT_BOXING ) if ( gTacticalStatus.bBoxingState == NOT_BOXING )
{ {
if ( bNewState != NOT_BOXING ) if ( bNewState != NOT_BOXING )
@@ -549,6 +555,7 @@ void SetBoxingState( INT8 bNewState )
// set one boxer to be set as boxed so that the game will allow another // set one boxer to be set as boxed so that the game will allow another
// fight to occur // fight to occur
gfBoxerFought[ 0 ] = TRUE; gfBoxerFought[ 0 ] = TRUE;
DebugQuestInfo(String("SetBoxingState: set one boxer to be set as boxed so that the game will allow another, gfBoxerFought[ 0 ] %d", gfBoxerFought[0]));
} }
} }
} }
+11 -1
View File
@@ -275,6 +275,8 @@ enum
BOOLEAN InitiateConversation( SOLDIERTYPE *pDestSoldier, SOLDIERTYPE *pSrcSoldier, INT8 bApproach, UINT32 uiApproachData ) BOOLEAN InitiateConversation( SOLDIERTYPE *pDestSoldier, SOLDIERTYPE *pSrcSoldier, INT8 bApproach, UINT32 uiApproachData )
{ {
DebugQuestInfo(String("InitiateConversation: from [%d] to [%d] %d data %d", pSrcSoldier->ubID, pDestSoldier->ubID, bApproach, uiApproachData));
// ATE: OK, let's check the status of the Q // ATE: OK, let's check the status of the Q
// If it has something in it....delay this until after.... // If it has something in it....delay this until after....
if ( DialogueQueueIsEmptyOrSomebodyTalkingNow( ) ) if ( DialogueQueueIsEmptyOrSomebodyTalkingNow( ) )
@@ -1404,6 +1406,7 @@ BOOLEAN NPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, UINT8 ubTargetAp
{ {
//CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_TRIGGER_NPC, ubTargetNPC, ubTargetRecord, fShowDialogueMenu, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); //CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_TRIGGER_NPC, ubTargetNPC, ubTargetRecord, fShowDialogueMenu, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE );
CHECKF( SpecialCharacterDialogueEventWithExtraParam( DIALOGUE_SPECIAL_EVENT_TRIGGER_NPC, ubTargetNPC, ubTargetRecord, fShowDialogueMenu, ubTargetApproach, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); CHECKF( SpecialCharacterDialogueEventWithExtraParam( DIALOGUE_SPECIAL_EVENT_TRIGGER_NPC, ubTargetNPC, ubTargetRecord, fShowDialogueMenu, ubTargetApproach, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE );
DebugQuestInfo(String("NPCTriggerNPC: <%d>, record %d, %d, display %d", ubTargetNPC, ubTargetRecord, ubTargetApproach, fShowDialogueMenu));
return( TRUE ); return( TRUE );
} }
@@ -1412,6 +1415,7 @@ BOOLEAN NPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, UINT8 ubTargetAp
BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, INT32 usGridNo, UINT8 ubRecordNum ) BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, INT32 usGridNo, UINT8 ubRecordNum )
{ {
CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_GOTO_GRIDNO, ubTargetNPC, usGridNo, ubRecordNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_GOTO_GRIDNO, ubTargetNPC, usGridNo, ubRecordNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE );
DebugQuestInfo(String("NPCGotoGridNo: <%d>, rec %d, usGridNo %d", ubTargetNPC, ubRecordNum, usGridNo));
return( TRUE ); return( TRUE );
} }
@@ -1420,6 +1424,7 @@ BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, INT32 usGridNo, UINT8 ubRecordNum )
BOOLEAN NPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ) BOOLEAN NPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum )
{ {
CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_DO_ACTION, ubTargetNPC, usActionCode, ubQuoteNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_DO_ACTION, ubTargetNPC, usActionCode, ubQuoteNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE );
DebugQuestInfo(String("NPCDoAction:<%d>, action code %d, quote num %d", ubTargetNPC, usActionCode, ubQuoteNum));
return( TRUE ); return( TRUE );
} }
@@ -1427,6 +1432,7 @@ BOOLEAN NPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum )
BOOLEAN NPCClosePanel( ) BOOLEAN NPCClosePanel( )
{ {
CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CLOSE_PANEL, 0, 0, 0, 0, DIALOGUE_NPC_UI ) != FALSE ); CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CLOSE_PANEL, 0, 0, 0, 0, DIALOGUE_NPC_UI ) != FALSE );
DebugQuestInfo(String("NPCClosePanel"));
return( TRUE ); return( TRUE );
} }
@@ -1471,7 +1477,7 @@ BOOLEAN SourceSoldierPointerIsValidAndReachableForGive( SOLDIERTYPE * pGiver )
void HandleNPCItemGiven( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos ) void HandleNPCItemGiven( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos )
{ {
DebugQuestInfo(String("HandleNPCItemGiven: <%d> item %d inv %d", ubNPC, pObject->usItem, bInvPos));
// Give it to the NPC soldier // Give it to the NPC soldier
// AutoPlaceObject( gpDestSoldier, pObject, FALSE ); // AutoPlaceObject( gpDestSoldier, pObject, FALSE );
@@ -1504,6 +1510,8 @@ void HandleNPCItemGiven( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos )
void HandleNPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, BOOLEAN fShowDialogueMenu, UINT8 ubTargetApproach ) void HandleNPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, BOOLEAN fShowDialogueMenu, UINT8 ubTargetApproach )
{ {
DebugQuestInfo(String("HandleNPCTriggerNPC: <%d>, record %d, %d, display %d", ubTargetNPC, ubTargetRecord, ubTargetApproach, fShowDialogueMenu));
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE );
@@ -1668,6 +1676,8 @@ void HandleWaitTimerForNPCTrigger( )
void HandleNPCGotoGridNo( UINT8 ubTargetNPC, INT32 usGridNo, UINT8 ubQuoteNum ) void HandleNPCGotoGridNo( UINT8 ubTargetNPC, INT32 usGridNo, UINT8 ubQuoteNum )
{ {
DebugQuestInfo(String("HandleNPCItemGiven:<%d> GridNo %d quote num %d", ubTargetNPC, usGridNo, ubQuoteNum));
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
// OK, Move to gridNo! // OK, Move to gridNo!
+49 -3
View File
@@ -216,6 +216,7 @@ STR szAction[] = {
// sevenfm // sevenfm
UINT32 guiAIStartCounter = 0, guiAILastCounter = 0; UINT32 guiAIStartCounter = 0, guiAILastCounter = 0;
//UINT8 gubAISelectedSoldier = NOBODY; //UINT8 gubAISelectedSoldier = NOBODY;
BOOLEAN gfLogsEnabled = TRUE;
void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction ) void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )
{ {
@@ -223,10 +224,8 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )
CHAR8 msg[1024]; CHAR8 msg[1024];
CHAR8 buf[1024]; CHAR8 buf[1024];
if (!gGameExternalOptions.fAIDecisionInfo) if (!gfLogsEnabled)
{
return; return;
}
memset(buf, 0, 1024 * sizeof(char)); memset(buf, 0, 1024 * sizeof(char));
@@ -307,6 +306,12 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )
fputs("\n", DebugFile); fputs("\n", DebugFile);
fclose(DebugFile); fclose(DebugFile);
} }
else
{
// cannot open file in Logs folder, stop logging
gfLogsEnabled = FALSE;
return;
}
// also log to individual file for selected soldier // also log to individual file for selected soldier
sprintf(buf, "Logs\\AI_Decisions [%d].txt", pSoldier->ubID); sprintf(buf, "Logs\\AI_Decisions [%d].txt", pSoldier->ubID);
@@ -322,6 +327,46 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )
} }
} }
extern UINT32 guiDay;
extern UINT32 guiHour;
extern UINT32 guiMin;
void DebugQuestInfo(STR szOutput)
{
/*CHAR16 buf16[1024];
memset(buf16, 0, 1024 * sizeof(wchar_t));
if (strlen(szOutput) > 0)
{
mbstowcs(buf16, szOutput, 1024 - 1);
AddTacticalDebugMessage(buf16);
}*/
CHAR8 buf[1024];
if (!gfLogsEnabled)
return;
FILE* DebugFile;
DebugFile = fopen("Logs\\QuestInfo.txt", "a+t");
if (DebugFile != NULL)
{
// first write game clock and date/time
sprintf(buf, "%d Day %d %d:%d ", GetJA2Clock(), guiDay, guiHour, guiMin);
fputs(buf, DebugFile);
fputs(szOutput, DebugFile);
fputs("\n", DebugFile);
fclose(DebugFile);
}
else
{
// cannot open file in Logs folder, stop logging
gfLogsEnabled = FALSE;
return;
}
}
BOOLEAN InitAI( void ) BOOLEAN InitAI( void )
{ {
@@ -354,6 +399,7 @@ BOOLEAN InitAI( void )
// sevenfm: Clear the AI debug txt file to prevent it from getting huge // sevenfm: Clear the AI debug txt file to prevent it from getting huge
remove("Logs\\AI_Decisions.txt"); remove("Logs\\AI_Decisions.txt");
//remove("Logs\\QuestInfo.txt");
// remove all individual files // remove all individual files
CHAR8 buf[1024]; CHAR8 buf[1024];
+9
View File
@@ -1871,6 +1871,7 @@ void ResetOncePerConvoRecordsForNPC( UINT8 ubNPC )
return; return;
} }
ResetOncePerConvoRecords( gpNPCQuoteInfoArray[ ubNPC ] ); ResetOncePerConvoRecords( gpNPCQuoteInfoArray[ ubNPC ] );
DebugQuestInfo(String("reset QUOTE_FLAG_SAID for profile %d", ubNPC));
} }
void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ) void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void )
@@ -1933,6 +1934,8 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData
SOLDIERTYPE * pNPC; SOLDIERTYPE * pNPC;
BOOLEAN fAttemptingToGiveItem; BOOLEAN fAttemptingToGiveItem;
DebugQuestInfo(String("Converse: merc<%d> to NPC <%d> %d data %d", ubMerc, ubNPC, bApproach, uiApproachData));
// we have to record whether an item is being given in order to determine whether, // we have to record whether an item is being given in order to determine whether,
// in the case where the approach is overridden, we need to return the item to the // in the case where the approach is overridden, we need to return the item to the
// player // player
@@ -1986,6 +1989,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData
{ {
case NPC_INITIAL_QUOTE: case NPC_INITIAL_QUOTE:
// reset stuff // reset stuff
DebugQuestInfo(String("ResetOncePerConvoRecords for <%d>", ubNPC));
ResetOncePerConvoRecords( pNPCQuoteInfoArray ); ResetOncePerConvoRecords( pNPCQuoteInfoArray );
// CHEAP HACK // CHEAP HACK
@@ -1994,6 +1998,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData
if ( ubNPC == DARREN && CheckFact( 281, DARREN ) == FALSE ) if ( ubNPC == DARREN && CheckFact( 281, DARREN ) == FALSE )
{ {
TURN_FLAG_OFF( pNPCQuoteInfoArray[11].fFlags, QUOTE_FLAG_SAID ); TURN_FLAG_OFF( pNPCQuoteInfoArray[11].fFlags, QUOTE_FLAG_SAID );
DebugQuestInfo(String("reset QUOTE_FLAG_SAID for <%d> 'DARREN'", ubNPC));
} }
// turn the NPC to face us // turn the NPC to face us
@@ -2769,6 +2774,8 @@ void TriggerNPCRecord( UINT8 ubTriggerNPC, UINT8 ubTriggerNPCRec )
NPCQuoteInfo *pQuotePtr; NPCQuoteInfo *pQuotePtr;
BOOLEAN fDisplayDialogue = TRUE; BOOLEAN fDisplayDialogue = TRUE;
DebugQuestInfo(String("TriggerNPCRecord: <%d> record %d", ubTriggerNPC, ubTriggerNPCRec));
if (EnsureQuoteFileLoaded( ubTriggerNPC ) == FALSE) if (EnsureQuoteFileLoaded( ubTriggerNPC ) == FALSE)
{ {
// error!!! // error!!!
@@ -2797,6 +2804,8 @@ void TriggerNPCRecordImmediately( UINT8 ubTriggerNPC, UINT8 ubTriggerNPCRec )
NPCQuoteInfo *pQuotePtr; NPCQuoteInfo *pQuotePtr;
BOOLEAN fDisplayDialogue = TRUE; BOOLEAN fDisplayDialogue = TRUE;
DebugQuestInfo(String("TriggerNPCRecordImmediately: <%d> record %d", ubTriggerNPC, ubTriggerNPCRec));
if (EnsureQuoteFileLoaded( ubTriggerNPC ) == FALSE) if (EnsureQuoteFileLoaded( ubTriggerNPC ) == FALSE)
{ {
// error!!! // error!!!
+1
View File
@@ -183,6 +183,7 @@ BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck );
void DebugAI( STR szOutput ); void DebugAI( STR szOutput );
enum { AI_MSG_START, AI_MSG_DECIDE, AI_MSG_INFO, AI_MSG_TOPIC }; enum { AI_MSG_START, AI_MSG_DECIDE, AI_MSG_INFO, AI_MSG_TOPIC };
void DebugAI(INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction = -1); void DebugAI(INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction = -1);
void DebugQuestInfo(STR szOutput);
INT8 DecideAction(SOLDIERTYPE *pSoldier); INT8 DecideAction(SOLDIERTYPE *pSoldier);
INT8 DecideActionBlack(SOLDIERTYPE *pSoldier); INT8 DecideActionBlack(SOLDIERTYPE *pSoldier);
INT8 DecideActionEscort(SOLDIERTYPE *pSoldier); INT8 DecideActionEscort(SOLDIERTYPE *pSoldier);
+1 -1
View File
@@ -2004,7 +2004,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
} }
} }
else if ( pExplosive->ubType == EXPLOSV_SMOKE || pExplosive->ubType == EXPLOSV_SMOKE_DEBRIS | pExplosive->ubType == EXPLOSV_SMOKE_FIRERETARDANT )//dnl ch40 200909 else if ( pExplosive->ubType == EXPLOSV_SMOKE || pExplosive->ubType == EXPLOSV_SMOKE_DEBRIS || pExplosive->ubType == EXPLOSV_SMOKE_FIRERETARDANT )//dnl ch40 200909
{ {
// robots are unaffected by smoke // robots are unaffected by smoke
if( AM_A_ROBOT(pSoldier) ) if( AM_A_ROBOT(pSoldier) )