mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Forgot to commit the source changes in the last commit. Sorry. So, here they are.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5999 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+8056
-8240
File diff suppressed because it is too large
Load Diff
+176
-226
@@ -6,215 +6,193 @@
|
||||
#include "Soldier Control.h"
|
||||
#include "overhead types.h"
|
||||
#include "soldier find.h"
|
||||
#define ADD_SOLDIER_NO_PROFILE_ID 200
|
||||
#define ADD_SOLDIER_NO_PROFILE_ID 200
|
||||
|
||||
#define MAX_REALTIME_SPEED_VAL 10
|
||||
|
||||
/*
|
||||
enum
|
||||
{
|
||||
TOPTION_SUBTITLES,
|
||||
TOPTION_SPEECH,
|
||||
TOPTION_KEY_ADVANCE_SPEECH,
|
||||
TOPTION_RTCONFIRM,
|
||||
TOPTION_HIDE_BULLETS,
|
||||
TOPTION_TRACKING_MODE,
|
||||
TOPTION_CONFIRM_MOVE,
|
||||
TOPTION_MUTE_CONFIRMATIONS,
|
||||
TOPTION_SHADOWS,
|
||||
TOPTION_BLOOD_N_GORE,
|
||||
|
||||
NUM_TOPTIONS
|
||||
};
|
||||
*/
|
||||
#define MAX_REALTIME_SPEED_VAL 10
|
||||
|
||||
// Enums for waiting for mercs to finish codes
|
||||
enum
|
||||
{
|
||||
NO_WAIT_EVENT = 0,
|
||||
WAIT_FOR_MERCS_TO_WALKOFF_SCREEN,
|
||||
WAIT_FOR_MERCS_TO_WALKON_SCREEN,
|
||||
WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO
|
||||
{
|
||||
NO_WAIT_EVENT = 0,
|
||||
WAIT_FOR_MERCS_TO_WALKOFF_SCREEN,
|
||||
WAIT_FOR_MERCS_TO_WALKON_SCREEN,
|
||||
WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO
|
||||
};
|
||||
|
||||
|
||||
|
||||
// TACTICAL ENGINE STATUS FLAGS
|
||||
typedef struct
|
||||
{
|
||||
UINT8 bFirstID;
|
||||
UINT8 bLastID;
|
||||
COLORVAL RadarColor;
|
||||
INT8 bSide;
|
||||
INT8 bMenInSector;
|
||||
UINT8 ubLastMercToRadio;
|
||||
INT8 bTeamActive;
|
||||
INT8 bAwareOfOpposition;
|
||||
INT8 bHuman;
|
||||
UINT8 bFirstID;
|
||||
UINT8 bLastID;
|
||||
COLORVAL RadarColor;
|
||||
INT8 bSide;
|
||||
INT8 bMenInSector;
|
||||
UINT8 ubLastMercToRadio;
|
||||
INT8 bTeamActive;
|
||||
INT8 bAwareOfOpposition;
|
||||
INT8 bHuman;
|
||||
} TacticalTeamType;
|
||||
|
||||
//for use with TacticalStatusType.ubEnemyIntention
|
||||
enum
|
||||
{
|
||||
INTENTION_SCOUTING,
|
||||
INTENTION_PATROLLING,
|
||||
INTENTION_ATTACKING,
|
||||
INTENTION_DEFENDING,
|
||||
INTENTION_RETREATING
|
||||
INTENTION_SCOUTING,
|
||||
INTENTION_PATROLLING,
|
||||
INTENTION_ATTACKING,
|
||||
INTENTION_DEFENDING,
|
||||
INTENTION_RETREATING
|
||||
};
|
||||
|
||||
//for use with TacticalStatusType.ubEnemyIntendedRetreatDirection
|
||||
enum
|
||||
{
|
||||
RETREAT_NORTH,
|
||||
RETREAT_EAST,
|
||||
RETREAT_SOUTH,
|
||||
RETREAT_WEST
|
||||
RETREAT_NORTH,
|
||||
RETREAT_EAST,
|
||||
RETREAT_SOUTH,
|
||||
RETREAT_WEST
|
||||
};
|
||||
|
||||
#define PANIC_BOMBS_HERE 0x01
|
||||
#define PANIC_TRIGGERS_HERE 0x02
|
||||
|
||||
#define NUM_PANIC_TRIGGERS 3
|
||||
|
||||
#define PANIC_BOMBS_HERE 0x01
|
||||
#define PANIC_TRIGGERS_HERE 0x02
|
||||
#define NUM_PANIC_TRIGGERS 3
|
||||
#define ENEMY_OFFERED_SURRENDER 0x01
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiFlags;
|
||||
TacticalTeamType Team[ MAXTEAMS ];
|
||||
UINT8 ubCurrentTeam;
|
||||
INT32 sSlideTarget;
|
||||
INT16 sSlideReason;
|
||||
UINT32 uiTimeSinceMercAIStart;
|
||||
INT8 fPanicFlags;
|
||||
INT32 sPanicTriggerGridNoUnused;
|
||||
INT16 sHandGrid;
|
||||
UINT8 ubSpottersCalledForBy;
|
||||
UINT8 ubTheChosenOne;
|
||||
UINT32 uiTimeOfLastInput;
|
||||
UINT32 uiTimeSinceDemoOn;
|
||||
UINT32 uiCountdownToRestart;
|
||||
BOOLEAN fGoingToEnterDemo;
|
||||
BOOLEAN fNOTDOLASTDEMO;
|
||||
BOOLEAN fMultiplayer;
|
||||
BOOLEAN fCivGroupHostile[ NUM_CIV_GROUPS ];
|
||||
UINT8 ubLastBattleSectorX;
|
||||
UINT8 ubLastBattleSectorY;
|
||||
BOOLEAN fLastBattleWon;
|
||||
INT8 bOriginalSizeOfEnemyForce;
|
||||
INT8 bPanicTriggerIsAlarmUnused;
|
||||
BOOLEAN fVirginSector;
|
||||
BOOLEAN fEnemyInSector;
|
||||
BOOLEAN fInterruptOccurred;
|
||||
INT8 bRealtimeSpeed;
|
||||
UINT8 ubEnemyIntention;
|
||||
UINT8 ubEnemyIntendedRetreatDirection;
|
||||
UINT8 ubEnemySightingOnTheirTurnEnemyID;
|
||||
UINT8 ubEnemySightingOnTheirTurnPlayerID;
|
||||
BOOLEAN fEnemySightingOnTheirTurn;
|
||||
BOOLEAN fAutoBandageMode;
|
||||
UINT8 ubAttackBusyCount;
|
||||
INT8 bNumEnemiesFoughtInBattleUnused;
|
||||
UINT8 ubEngagedInConvFromActionMercID;
|
||||
UINT16 usTactialTurnLimitCounter;
|
||||
BOOLEAN fInTopMessage;
|
||||
UINT8 ubTopMessageType;
|
||||
CHAR16 zTopMessageString[20];
|
||||
UINT16 usTactialTurnLimitMax;
|
||||
UINT32 uiTactialTurnLimitClock;
|
||||
BOOLEAN fTactialTurnLimitStartedBeep;
|
||||
INT8 bBoxingState;
|
||||
INT8 bConsNumTurnsNotSeen;
|
||||
UINT8 ubArmyGuysKilled;
|
||||
UINT32 uiFlags;
|
||||
TacticalTeamType Team[ MAXTEAMS ];
|
||||
UINT8 ubCurrentTeam;
|
||||
INT32 sSlideTarget;
|
||||
INT16 sSlideReason;
|
||||
UINT32 uiTimeSinceMercAIStart;
|
||||
INT8 fPanicFlags;
|
||||
INT32 sPanicTriggerGridNoUnused;
|
||||
INT16 sHandGrid;
|
||||
UINT8 ubSpottersCalledForBy;
|
||||
UINT8 ubTheChosenOne;
|
||||
UINT32 uiTimeOfLastInput;
|
||||
UINT32 uiTimeSinceDemoOn;
|
||||
UINT32 uiCountdownToRestart;
|
||||
BOOLEAN fGoingToEnterDemo;
|
||||
BOOLEAN fNOTDOLASTDEMO;
|
||||
BOOLEAN fMultiplayer;
|
||||
BOOLEAN fCivGroupHostile[ NUM_CIV_GROUPS ];
|
||||
UINT8 ubLastBattleSectorX;
|
||||
UINT8 ubLastBattleSectorY;
|
||||
BOOLEAN fLastBattleWon;
|
||||
INT8 bOriginalSizeOfEnemyForce;
|
||||
INT8 bPanicTriggerIsAlarmUnused;
|
||||
BOOLEAN fVirginSector;
|
||||
BOOLEAN fEnemyInSector;
|
||||
BOOLEAN fInterruptOccurred;
|
||||
INT8 bRealtimeSpeed;
|
||||
UINT8 ubEnemyIntention;
|
||||
UINT8 ubEnemyIntendedRetreatDirection;
|
||||
UINT8 ubEnemySightingOnTheirTurnEnemyID;
|
||||
UINT8 ubEnemySightingOnTheirTurnPlayerID;
|
||||
BOOLEAN fEnemySightingOnTheirTurn;
|
||||
BOOLEAN fAutoBandageMode;
|
||||
UINT8 ubAttackBusyCount;
|
||||
INT8 bNumEnemiesFoughtInBattleUnused;
|
||||
UINT8 ubEngagedInConvFromActionMercID;
|
||||
UINT16 usTactialTurnLimitCounter;
|
||||
BOOLEAN fInTopMessage;
|
||||
UINT8 ubTopMessageType;
|
||||
CHAR16 zTopMessageString[20];
|
||||
UINT16 usTactialTurnLimitMax;
|
||||
UINT32 uiTactialTurnLimitClock;
|
||||
BOOLEAN fTactialTurnLimitStartedBeep;
|
||||
INT8 bBoxingState;
|
||||
INT8 bConsNumTurnsNotSeen;
|
||||
UINT8 ubArmyGuysKilled;
|
||||
|
||||
INT32 sPanicTriggerGridNo[ NUM_PANIC_TRIGGERS ];
|
||||
INT8 bPanicTriggerIsAlarm[ NUM_PANIC_TRIGGERS ];
|
||||
UINT8 ubPanicTolerance[ NUM_PANIC_TRIGGERS ];
|
||||
BOOLEAN fAtLeastOneGuyOnMultiSelect;
|
||||
BOOLEAN fSaidCreatureFlavourQuote;
|
||||
BOOLEAN fHaveSeenCreature;
|
||||
BOOLEAN fKilledEnemyOnAttack;
|
||||
UINT8 ubEnemyKilledOnAttack;
|
||||
INT8 bEnemyKilledOnAttackLevel;
|
||||
UINT16 ubEnemyKilledOnAttackLocation;
|
||||
BOOLEAN fItemsSeenOnAttack;
|
||||
BOOLEAN ubItemsSeenOnAttackSoldier;
|
||||
BOOLEAN fBeenInCombatOnce;
|
||||
BOOLEAN fSaidCreatureSmellQuote;
|
||||
UINT32 usItemsSeenOnAttackGridNo;
|
||||
BOOLEAN fLockItemLocators;
|
||||
UINT8 ubLastQuoteSaid;
|
||||
UINT8 ubLastQuoteProfileNUm;
|
||||
BOOLEAN fCantGetThrough;
|
||||
INT32 sCantGetThroughGridNo;
|
||||
INT32 sCantGetThroughSoldierGridNo;
|
||||
UINT8 ubCantGetThroughID;
|
||||
BOOLEAN fDidGameJustStart;
|
||||
BOOLEAN fStatChangeCheatOn;
|
||||
UINT8 ubLastRequesterTargetID;
|
||||
BOOLEAN fGoodToAllowCrows;
|
||||
UINT8 ubNumCrowsPossible;
|
||||
UINT32 uiTimeCounterForGiveItemSrc;
|
||||
BOOLEAN fUnLockUIAfterHiddenInterrupt;
|
||||
INT8 bNumFoughtInBattle[ MAXTEAMS ];
|
||||
UINT32 uiDecayBloodLastUpdate;
|
||||
UINT32 uiTimeSinceLastInTactical;
|
||||
BOOLEAN fHasAGameBeenStarted;
|
||||
INT8 bConsNumTurnsWeHaventSeenButEnemyDoes;
|
||||
BOOLEAN fSomeoneHit;
|
||||
UINT8 ubPaddingSmall;
|
||||
UINT32 uiTimeSinceLastOpplistDecay;
|
||||
INT8 bMercArrivingQuoteBeingUsed;
|
||||
UINT8 ubEnemyKilledOnAttackKiller;
|
||||
BOOLEAN fCountingDownForGuideDescription;
|
||||
INT8 bGuideDescriptionCountDown;
|
||||
UINT8 ubGuideDescriptionToUse;
|
||||
INT8 bGuideDescriptionSectorX;
|
||||
INT8 bGuideDescriptionSectorY;
|
||||
INT8 fEnemyFlags;
|
||||
BOOLEAN fAutoBandagePending;
|
||||
BOOLEAN fHasEnteredCombatModeSinceEntering;
|
||||
BOOLEAN fDontAddNewCrows;
|
||||
UINT8 ubMorePadding;
|
||||
UINT16 sCreatureTenseQuoteDelay;
|
||||
UINT32 uiCreatureTenseQuoteLastUpdate;
|
||||
// SANDRO - added these
|
||||
UINT8 ubLastRequesterSurgeryTargetID;
|
||||
UINT8 ubInterruptPending;
|
||||
INT32 sPanicTriggerGridNo[ NUM_PANIC_TRIGGERS ];
|
||||
INT8 bPanicTriggerIsAlarm[ NUM_PANIC_TRIGGERS ];
|
||||
UINT8 ubPanicTolerance[ NUM_PANIC_TRIGGERS ];
|
||||
BOOLEAN fAtLeastOneGuyOnMultiSelect;
|
||||
BOOLEAN fSaidCreatureFlavourQuote;
|
||||
BOOLEAN fHaveSeenCreature;
|
||||
BOOLEAN fKilledEnemyOnAttack;
|
||||
UINT8 ubEnemyKilledOnAttack;
|
||||
INT8 bEnemyKilledOnAttackLevel;
|
||||
UINT16 ubEnemyKilledOnAttackLocation;
|
||||
BOOLEAN fItemsSeenOnAttack;
|
||||
BOOLEAN ubItemsSeenOnAttackSoldier;
|
||||
BOOLEAN fBeenInCombatOnce;
|
||||
BOOLEAN fSaidCreatureSmellQuote;
|
||||
UINT32 usItemsSeenOnAttackGridNo;
|
||||
BOOLEAN fLockItemLocators;
|
||||
UINT8 ubLastQuoteSaid;
|
||||
UINT8 ubLastQuoteProfileNUm;
|
||||
BOOLEAN fCantGetThrough;
|
||||
INT32 sCantGetThroughGridNo;
|
||||
INT32 sCantGetThroughSoldierGridNo;
|
||||
UINT8 ubCantGetThroughID;
|
||||
BOOLEAN fDidGameJustStart;
|
||||
BOOLEAN fStatChangeCheatOn;
|
||||
UINT8 ubLastRequesterTargetID;
|
||||
BOOLEAN fGoodToAllowCrows;
|
||||
UINT8 ubNumCrowsPossible;
|
||||
UINT32 uiTimeCounterForGiveItemSrc;
|
||||
BOOLEAN fUnLockUIAfterHiddenInterrupt;
|
||||
INT8 bNumFoughtInBattle[ MAXTEAMS ];
|
||||
UINT32 uiDecayBloodLastUpdate;
|
||||
UINT32 uiTimeSinceLastInTactical;
|
||||
BOOLEAN fHasAGameBeenStarted;
|
||||
INT8 bConsNumTurnsWeHaventSeenButEnemyDoes;
|
||||
BOOLEAN fSomeoneHit;
|
||||
UINT8 ubPaddingSmall;
|
||||
UINT32 uiTimeSinceLastOpplistDecay;
|
||||
INT8 bMercArrivingQuoteBeingUsed;
|
||||
UINT8 ubEnemyKilledOnAttackKiller;
|
||||
BOOLEAN fCountingDownForGuideDescription;
|
||||
INT8 bGuideDescriptionCountDown;
|
||||
UINT8 ubGuideDescriptionToUse;
|
||||
INT8 bGuideDescriptionSectorX;
|
||||
INT8 bGuideDescriptionSectorY;
|
||||
INT8 fEnemyFlags;
|
||||
BOOLEAN fAutoBandagePending;
|
||||
BOOLEAN fHasEnteredCombatModeSinceEntering;
|
||||
BOOLEAN fDontAddNewCrows;
|
||||
UINT8 ubMorePadding;
|
||||
UINT16 sCreatureTenseQuoteDelay;
|
||||
UINT32 uiCreatureTenseQuoteLastUpdate;
|
||||
// SANDRO - added these
|
||||
UINT8 ubLastRequesterSurgeryTargetID;
|
||||
UINT8 ubInterruptPending;
|
||||
|
||||
// PADDING GONE!!!!!
|
||||
// PADDING GONE!!!!!
|
||||
|
||||
} TacticalStatusType;
|
||||
|
||||
|
||||
extern UINT8 gbPlayerNum;
|
||||
extern INT8 gbShowEnemies;
|
||||
extern UINT8 gbPlayerNum;
|
||||
extern INT8 gbShowEnemies;
|
||||
|
||||
extern UINT16 gusSelectedSoldier;
|
||||
extern UINT16 gusOldSelectedSoldier;
|
||||
extern UINT16 gusSelectedSoldier;
|
||||
extern UINT16 gusOldSelectedSoldier;
|
||||
|
||||
extern CHAR8 gzAlertStr[][ 30 ];
|
||||
extern CHAR8 gzActionStr[][ 30 ];
|
||||
extern CHAR8 gzDirectionStr[][ 30 ];
|
||||
extern CHAR8 gzAlertStr[][ 30 ];
|
||||
extern CHAR8 gzActionStr[][ 30 ];
|
||||
extern CHAR8 gzDirectionStr[][ 30 ];
|
||||
|
||||
// TEMP FOR E3
|
||||
extern UINT8 gubCurrentScene;
|
||||
extern CHAR8 *GetSceneFilename( );
|
||||
extern INT8 ubLevelMoveLink[ 10 ];
|
||||
extern UINT8 gubCurrentScene;
|
||||
extern CHAR8 *GetSceneFilename( );
|
||||
extern INT8 ubLevelMoveLink[ 10 ];
|
||||
|
||||
// Soldier List used for all soldier overhead interaction
|
||||
extern SOLDIERTYPE Menptr[ TOTAL_SOLDIERS ];
|
||||
extern SOLDIERTYPE *MercPtrs[ TOTAL_SOLDIERS ];
|
||||
extern SOLDIERTYPE Menptr[ TOTAL_SOLDIERS ];
|
||||
extern SOLDIERTYPE *MercPtrs[ TOTAL_SOLDIERS ];
|
||||
|
||||
// MERC SLOTS - A LIST OF ALL ACTIVE MERCS
|
||||
extern SOLDIERTYPE *MercSlots[ TOTAL_SOLDIERS ];
|
||||
extern UINT32 guiNumMercSlots;
|
||||
extern SOLDIERTYPE *MercSlots[ TOTAL_SOLDIERS ];
|
||||
extern UINT32 guiNumMercSlots;
|
||||
|
||||
extern BOOLEAN gfMovingAnimation;
|
||||
extern BOOLEAN gfMovingAnimation;
|
||||
|
||||
|
||||
extern TacticalStatusType gTacticalStatus;
|
||||
extern TacticalStatusType gTacticalStatus;
|
||||
|
||||
|
||||
|
||||
@@ -226,7 +204,7 @@ BOOLEAN InitOverhead( );
|
||||
BOOLEAN ShutdownOverhead( );
|
||||
BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex );
|
||||
|
||||
UINT32 CountNonVehiclesOnPlayerTeam( void );
|
||||
UINT32 CountNonVehiclesOnPlayerTeam( );
|
||||
|
||||
INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel );
|
||||
|
||||
@@ -237,7 +215,7 @@ extern BOOLEAN FlatRoofAboveGridNo( INT32 iMapIndex );
|
||||
|
||||
|
||||
BOOLEAN ExecuteOverhead( );
|
||||
BOOLEAN ResetAllAnimationCache( );
|
||||
BOOLEAN ResetAllAnimationCache( );
|
||||
|
||||
void EndTurn( );
|
||||
void EndTurn( UINT8 ubNextTeam );
|
||||
@@ -245,7 +223,7 @@ void EndTurn( UINT8 ubNextTeam );
|
||||
void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode );
|
||||
void EndTacticalDemo( );
|
||||
|
||||
void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect );
|
||||
void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect );
|
||||
|
||||
//Kaiden: Function declaration from UB to reveal all items after combat.
|
||||
void RevealAllDroppedEnemyItems();
|
||||
@@ -282,93 +260,66 @@ void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange);
|
||||
BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID );
|
||||
|
||||
|
||||
|
||||
|
||||
// FUNCTIONS FOR MANIPULATING MERC SLOTS - A LIST OF ALL ACTIVE MERCS
|
||||
INT32 GetFreeMercSlot(void);
|
||||
void RecountMercSlots(void);
|
||||
INT32 AddMercSlot( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN RemoveMercSlot( SOLDIERTYPE *pSoldier );
|
||||
INT32 GetFreeMercSlot( );
|
||||
INT32 AddMercSlot( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN RemoveMercSlot( SOLDIERTYPE *pSoldier );
|
||||
|
||||
INT32 AddAwaySlot( SOLDIERTYPE *pSoldier );
|
||||
INT32 AddAwaySlot( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN RemoveAwaySlot( SOLDIERTYPE *pSoldier );
|
||||
INT32 MoveSoldierFromMercToAwaySlot( SOLDIERTYPE * pSoldier );
|
||||
INT32 MoveSoldierFromAwayToMercSlot( SOLDIERTYPE * pSoldier );
|
||||
INT32 MoveSoldierFromMercToAwaySlot( SOLDIERTYPE * pSoldier );
|
||||
INT32 MoveSoldierFromAwayToMercSlot( SOLDIERTYPE * pSoldier );
|
||||
|
||||
void EnterCombatMode( UINT8 ubStartingTeam );
|
||||
void ExitCombatMode( );
|
||||
|
||||
void HandleTeamServices( UINT8 ubTeamNum );
|
||||
void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier );
|
||||
|
||||
void SetEnemyPresence( );
|
||||
|
||||
void CycleThroughKnownEnemies( );
|
||||
|
||||
BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen );
|
||||
|
||||
SOLDIERTYPE * FreeUpAttacker( );
|
||||
|
||||
BOOLEAN PlayerTeamFull( );
|
||||
|
||||
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 );
|
||||
|
||||
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 );
|
||||
void ResetAllMercSpeeds( );
|
||||
|
||||
BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLEAN fInitialMove, UINT16 usAnimState );
|
||||
|
||||
SOLDIERTYPE * ReduceAttackBusyCount( );
|
||||
|
||||
// HEADROCK HAM B2.6: Made this public so it can be used elsewhere.
|
||||
INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier );
|
||||
// HEADROCK HAM 3.2: A new function for checking the condition of nearby friendlies and returning a modifier.
|
||||
INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void CommonEnterCombatModeCode( );
|
||||
|
||||
void CheckForPotentialAddToBattleIncrement( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void CencelAllActionsForTimeCompression( void );
|
||||
|
||||
void CencelAllActionsForTimeCompression( );
|
||||
BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated );
|
||||
|
||||
void AddManToTeam( INT8 bTeam );
|
||||
|
||||
void RemoveManFromTeam( INT8 bTeam );
|
||||
|
||||
void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSelected );
|
||||
|
||||
void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide );
|
||||
|
||||
#define REASON_NORMAL_ATTACK 1
|
||||
#define REASON_EXPLOSION 2
|
||||
#define REASON_NORMAL_ATTACK 1
|
||||
#define REASON_EXPLOSION 2
|
||||
|
||||
BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** ppTarget, INT8 bReason );
|
||||
|
||||
INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier, INT32 * psAdjustedTargetGridNo, UINT8 * pubDirection );
|
||||
|
||||
SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked );
|
||||
void CivilianGroupChangesSides( UINT8 ubCivilianGroup );
|
||||
|
||||
void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier );
|
||||
UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked );
|
||||
|
||||
void PauseAITemporarily( void );
|
||||
void PauseAIUntilManuallyUnpaused( void );
|
||||
void UnPauseAI( void );
|
||||
|
||||
void DoPOWPathChecks( void );
|
||||
|
||||
BOOLEAN HostileCiviliansWithGunsPresent( void );
|
||||
BOOLEAN HostileCiviliansPresent( void );
|
||||
BOOLEAN HostileBloodcatsPresent( void );
|
||||
void PauseAITemporarily( );
|
||||
void PauseAIUntilManuallyUnpaused( );
|
||||
void UnPauseAI( );
|
||||
void DoPOWPathChecks( );
|
||||
BOOLEAN HostileCiviliansWithGunsPresent( );
|
||||
BOOLEAN HostileCiviliansPresent( );
|
||||
BOOLEAN HostileBloodcatsPresent( );
|
||||
|
||||
#ifdef ENABLE_ZOMBIES
|
||||
BOOLEAN HostileZombiesPresent( void );
|
||||
BOOLEAN HostileZombiesPresent( );
|
||||
#endif
|
||||
|
||||
UINT8 NumPCsInSector( void );
|
||||
|
||||
UINT8 NumPCsInSector( );
|
||||
void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier );
|
||||
void SetSoldierNeutral( SOLDIERTYPE * pSoldier );
|
||||
|
||||
@@ -376,13 +327,13 @@ void SetSoldierNeutral( SOLDIERTYPE * pSoldier );
|
||||
void HandleThePlayerBeNotifiedOfSomeoneElseInSector();
|
||||
void SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector();
|
||||
|
||||
void HandleDisplayingOfPlayerLostDialogue( void );
|
||||
void HandleDisplayingOfPlayerLostDialogue( );
|
||||
|
||||
// UTILITY FUNCTIONS
|
||||
INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam );
|
||||
INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam );
|
||||
UINT8 NumEnemyInSector( );
|
||||
UINT8 NumCapableEnemyInSector( );
|
||||
INT8 NumMercsOnPlayerTeam( );
|
||||
INT8 NumMercsOnPlayerTeam( );
|
||||
#endif
|
||||
|
||||
extern BOOLEAN sniperwarning;
|
||||
@@ -395,18 +346,17 @@ extern BOOLEAN gogglewarning;
|
||||
|
||||
// will a sam site under the players control shoot down an airraid?
|
||||
BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY );
|
||||
|
||||
// HEADROCK HAM 3.5: Externalized for First Arrival enemy check
|
||||
extern UINT8 NumEnemyInSector();
|
||||
|
||||
#ifdef ENABLE_ZOMBIES
|
||||
// Flugente
|
||||
extern UINT8 NumZombiesInSector();
|
||||
// Flugente
|
||||
extern UINT8 NumZombiesInSector();
|
||||
#endif
|
||||
|
||||
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); // Flugente: offer the enemy the chance to surrender
|
||||
|
||||
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); // Flugente: offer the enemy the chance to surrender
|
||||
// setting fForce to TRUE allows dropping of gear in combat (used in auto-resolve instances)
|
||||
void TeamDropAll(UINT8 bTeam, BOOLEAN fForce = FALSE);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
#endif
|
||||
|
||||
#include "ub_config.h"
|
||||
#include "../ModularizedTacticalAI/include/Plan.h" // for plan destructor call
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "Ja25_Tactical.h"
|
||||
@@ -1023,11 +1024,16 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src)
|
||||
this->bDrinkLevel = 0;
|
||||
this->usStarveDamageHealth = 0;
|
||||
this->usStarveDamageStrength = 0;
|
||||
this->bAIIndex = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
SOLDIERTYPE::~SOLDIERTYPE() {}
|
||||
SOLDIERTYPE::~SOLDIERTYPE()
|
||||
{
|
||||
if(ai_masterplan_)
|
||||
delete ai_masterplan_;
|
||||
}
|
||||
|
||||
SOLDIERTYPE::SOLDIERTYPE() {
|
||||
initialize();
|
||||
@@ -1061,38 +1067,6 @@ UINT32 SOLDIERTYPE::GetChecksum( )
|
||||
return( uiChecksum );
|
||||
}
|
||||
|
||||
|
||||
// Copy Constructor
|
||||
SOLDIERTYPE::SOLDIERTYPE(const SOLDIERTYPE& src)
|
||||
{
|
||||
memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD);
|
||||
inv = src.inv;
|
||||
aiData = src.aiData;
|
||||
flags = src.flags;
|
||||
timeChanges = src.timeChanges;
|
||||
timeCounters = src.timeCounters;
|
||||
drugs = src.drugs;
|
||||
stats = src.stats;
|
||||
pathing = src.pathing;
|
||||
}
|
||||
|
||||
// Assignment operator
|
||||
SOLDIERTYPE& SOLDIERTYPE::operator=(const SOLDIERTYPE& src)
|
||||
{
|
||||
if (this != &src) {
|
||||
memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD);
|
||||
aiData = src.aiData;
|
||||
flags = src.flags;
|
||||
timeChanges = src.timeChanges;
|
||||
timeCounters = src.timeCounters;
|
||||
drugs = src.drugs;
|
||||
stats = src.stats;
|
||||
pathing = src.pathing;
|
||||
inv = src.inv;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Initialize the soldier.
|
||||
// Use this instead of the old method of calling memset!
|
||||
// Note that the constructor does this automatically.
|
||||
@@ -1100,6 +1074,7 @@ void SOLDIERTYPE::initialize()
|
||||
{
|
||||
memset( this, 0, SIZEOF_SOLDIERTYPE_POD);
|
||||
inv.clear();
|
||||
ai_masterplan_ = 0;
|
||||
|
||||
memset( &aiData, 0, sizeof(STRUCT_AIData) );
|
||||
memset( &flags, 0, sizeof(STRUCT_Flags) );
|
||||
@@ -19270,4 +19245,5 @@ BOOLEAN DecideAltAnimForBigMerc( SOLDIERTYPE * pSoldier )
|
||||
BOOLEAN TwoStagedTrait( UINT8 uiSkillTraitNumber )
|
||||
{
|
||||
return( uiSkillTraitNumber > 0 && (uiSkillTraitNumber <= NUM_ORIGINAL_MAJOR_TRAITS || uiSkillTraitNumber == COVERT_NT) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -723,6 +723,15 @@ public:
|
||||
TIMECOUNTER NextTileCounter;
|
||||
};
|
||||
|
||||
// forward declaration for modularized tactical ai
|
||||
namespace AI
|
||||
{
|
||||
namespace tactical
|
||||
{
|
||||
class Plan;
|
||||
}
|
||||
}
|
||||
|
||||
class STRUCT_Statistics//last edited at version 102
|
||||
{
|
||||
public:
|
||||
@@ -775,10 +784,6 @@ public:
|
||||
|
||||
// Constructor
|
||||
SOLDIERTYPE();
|
||||
// Copy Constructor
|
||||
SOLDIERTYPE(const SOLDIERTYPE&);
|
||||
// Assignment operator
|
||||
SOLDIERTYPE& operator=(const SOLDIERTYPE&);
|
||||
// Destructor
|
||||
~SOLDIERTYPE();
|
||||
|
||||
@@ -1265,8 +1270,9 @@ public:
|
||||
INT32 sMTActionGridNo; // gridno on which we perfrom our multi-turn action
|
||||
UINT8 usMultiTurnAction; // specifies which multi-turn action we are currently performing, 0: none
|
||||
|
||||
INT16 bAIIndex; // PlanFactory from the modularized tactical AI that shall be used
|
||||
// Flugente: Decrease this filler by 1 for each new UINT8 / BOOLEAN variable, so we can maintain savegame compatibility!!
|
||||
UINT8 ubFiller[13];
|
||||
UINT8 ubFiller[11];
|
||||
|
||||
#ifdef JA2UB
|
||||
//ja25
|
||||
@@ -1285,6 +1291,7 @@ public:
|
||||
// properly until it is all fixed and the files updated.
|
||||
|
||||
Inventory inv;
|
||||
AI::tactical::Plan* ai_masterplan_; // Interface object for ModularizedTacticalAI
|
||||
|
||||
//data from version 101 wrapped into structs
|
||||
STRUCT_AIData aiData;
|
||||
|
||||
+150
-220
@@ -1,272 +1,202 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Tactical All.h"
|
||||
#include "Tactical All.h"
|
||||
#else
|
||||
#include "sgp.h"
|
||||
#include "overhead types.h"
|
||||
#include "Sound Control.h"
|
||||
#include "overhead.h"
|
||||
#include "Event Pump.h"
|
||||
#include "weapons.h"
|
||||
#include "Animation Control.h"
|
||||
#include "sys globals.h"
|
||||
#include "Handle UI.h"
|
||||
#include "Isometric Utils.h"
|
||||
#include "worldman.h"
|
||||
#include "math.h"
|
||||
#include "points.h"
|
||||
#include "ai.h"
|
||||
#include "los.h"
|
||||
#include "renderworld.h"
|
||||
#include "opplist.h"
|
||||
#include "interface.h"
|
||||
#include "message.h"
|
||||
#include "campaign.h"
|
||||
#include "items.h"
|
||||
#include "text.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "tile animation.h"
|
||||
#include "Dialogue Control.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "explosion control.h"
|
||||
#include "Quests.h"
|
||||
#include "Physics.h"
|
||||
#include "Random.h"
|
||||
#include "Vehicles.h"
|
||||
#include "bullets.h"
|
||||
#include "morale.h"
|
||||
#include "meanwhile.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "gamesettings.h"
|
||||
#include "SaveLoadMap.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include <string.h>
|
||||
#include "sgp.h"
|
||||
#include "Sound Control.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#endif
|
||||
|
||||
extern char szSoundEffects[MAX_SAMPLES][255];
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
PARSE_STAGE curElement;
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef soundParseData;
|
||||
|
||||
static void XMLCALL
|
||||
soundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
soundParseData * pData = (soundParseData *)userData;
|
||||
soundParseData * pData = (soundParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "SOUNDLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "SOUNDLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "SOUND") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "SOUND") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
pData->curIndex++;
|
||||
}
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
pData->curIndex++;
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
soundCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
soundParseData * pData = (soundParseData *)userData;
|
||||
soundParseData * pData = (soundParseData *)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)));
|
||||
}
|
||||
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
|
||||
soundEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
soundParseData * pData = (soundParseData *)userData;
|
||||
soundParseData * pData = (soundParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "SOUNDLIST") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "SOUND") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "SOUNDLIST") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "SOUND") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curIndex < pData->maxArraySize)
|
||||
{
|
||||
char temp;
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),255);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
szSoundEffects[pData->curIndex][i] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
if(pData->curIndex < pData->maxArraySize)
|
||||
{
|
||||
char temp;
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),255);i++)
|
||||
{
|
||||
temp = pData->szCharData[i];
|
||||
szSoundEffects[pData->curIndex][i] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ReadInSoundArray(STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
soundParseData pData;
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) );
|
||||
|
||||
soundParseData pData;
|
||||
// Open sounds file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) );
|
||||
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 );
|
||||
|
||||
// Open sounds 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, soundStartElementHandle, soundEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, soundCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.maxArraySize = MAX_SAMPLES;
|
||||
pData.curIndex = -1;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in %s.xml: %s at line %d", SOUNDSFILENAME, XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
return( TRUE );
|
||||
XML_SetElementHandler(parser, soundStartElementHandle, soundEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, soundCharacterDataHandle);
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.maxArraySize = MAX_SAMPLES;
|
||||
pData.curIndex = -1;
|
||||
XML_SetUserData(parser, &pData);
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
sprintf(errorBuf, "XML Parser Error in %s.xml: %s at line %d", SOUNDSFILENAME, XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
MemFree(lpcBuffer);
|
||||
XML_ParserFree(parser);
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN WriteSoundArray()
|
||||
{
|
||||
HWFILE hFile;
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("WriteSoundArray"));
|
||||
//Debug code; make sure that what we got from the file is the same as what's there
|
||||
// Open a new file
|
||||
hFile = FileOpen( "TABLEDATA\\Sounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
HWFILE hFile;
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("WriteSoundArray"));
|
||||
//Debug code; make sure that what we got from the file is the same as what's there
|
||||
// Open a new file
|
||||
hFile = FileOpen( "TABLEDATA\\Sounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
UINT32 cnt;
|
||||
|
||||
{
|
||||
UINT32 cnt;
|
||||
FilePrintf(hFile,"<SOUNDLIST>\r\n");
|
||||
for(cnt = 0;cnt < NUM_SAMPLES;cnt++)
|
||||
{
|
||||
FilePrintf(hFile,"\t<SOUND>");
|
||||
STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML)
|
||||
while(szRemainder[0] != '\0')
|
||||
{
|
||||
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
|
||||
char invChar = szRemainder[uiCharLoc];
|
||||
|
||||
FilePrintf(hFile,"<SOUNDLIST>\r\n");
|
||||
for(cnt = 0;cnt < NUM_SAMPLES;cnt++)
|
||||
{
|
||||
FilePrintf(hFile,"\t<SOUND>");
|
||||
if(uiCharLoc)
|
||||
{
|
||||
szRemainder[uiCharLoc] = '\0';
|
||||
FilePrintf(hFile,"%s",szRemainder);
|
||||
szRemainder[uiCharLoc] = invChar;
|
||||
}
|
||||
szRemainder += uiCharLoc;
|
||||
switch(invChar)
|
||||
{
|
||||
case '&':
|
||||
FilePrintf(hFile,"&");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML)
|
||||
case '<':
|
||||
FilePrintf(hFile,"<");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
while(szRemainder[0] != '\0')
|
||||
{
|
||||
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
|
||||
char invChar = szRemainder[uiCharLoc];
|
||||
case '>':
|
||||
FilePrintf(hFile,">");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
if(uiCharLoc)
|
||||
{
|
||||
szRemainder[uiCharLoc] = '\0';
|
||||
FilePrintf(hFile,"%s",szRemainder);
|
||||
szRemainder[uiCharLoc] = invChar;
|
||||
}
|
||||
case '\'':
|
||||
FilePrintf(hFile,"'");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
szRemainder += uiCharLoc;
|
||||
|
||||
switch(invChar)
|
||||
{
|
||||
case '&':
|
||||
FilePrintf(hFile,"&");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
FilePrintf(hFile,"<");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '>':
|
||||
FilePrintf(hFile,">");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
FilePrintf(hFile,"'");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '\"':
|
||||
FilePrintf(hFile,""");
|
||||
szRemainder++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// FilePrintf(hFile,"\t\t<SOUND>%s</SOUND>\r\n", szSoundEffects[cnt]);
|
||||
|
||||
FilePrintf(hFile,"</SOUND>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</SOUNDLIST>\r\n");
|
||||
}
|
||||
FileClose( hFile );
|
||||
|
||||
return( TRUE );
|
||||
case '\"':
|
||||
FilePrintf(hFile,""");
|
||||
szRemainder++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
FilePrintf(hFile,"</SOUND>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</SOUNDLIST>\r\n");
|
||||
FileClose( hFile );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user