mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- added an indexer for Blood's AI states.
These seem to be the only pointer variables that need to be written out to a savegame, but to restore them they need to be turned into indices before saving.
This commit is contained in:
parent
29e51a677f
commit
fd384a5f47
8 changed files with 421 additions and 10 deletions
|
@ -77,7 +77,7 @@ DUDEEXTRA gDudeExtra[kMaxXSprites];
|
|||
AISTATE genIdle = {kAiStateGenIdle, 0, -1, 0, NULL, NULL, NULL, NULL };
|
||||
AISTATE genRecoil = {kAiStateRecoil, 5, -1, 20, NULL, NULL, NULL, &genIdle };
|
||||
|
||||
int dword_138BB0[5] = {0x2000, 0x4000, 0x8000, 0xa000, 0xe000};
|
||||
const int dword_138BB0[5] = {0x2000, 0x4000, 0x8000, 0xa000, 0xe000};
|
||||
|
||||
bool sub_5BDA8(spritetype *pSprite, int nSeq)
|
||||
{
|
||||
|
@ -1771,12 +1771,16 @@ void AILoadSave::Load(void)
|
|||
{
|
||||
Read(cumulDamage, sizeof(cumulDamage));
|
||||
Read(gDudeSlope, sizeof(gDudeSlope));
|
||||
Read(gDudeExtra, sizeof(gDudeExtra));
|
||||
Read(gGenDudeExtra, sizeof(gGenDudeExtra));
|
||||
}
|
||||
|
||||
void AILoadSave::Save(void)
|
||||
{
|
||||
Write(cumulDamage, sizeof(cumulDamage));
|
||||
Write(gDudeSlope, sizeof(gDudeSlope));
|
||||
Write(gDudeExtra, sizeof(gDudeExtra));
|
||||
Write(gGenDudeExtra, sizeof(gGenDudeExtra));
|
||||
}
|
||||
|
||||
static AILoadSave *myLoadSave;
|
||||
|
|
|
@ -85,7 +85,7 @@ struct TARGETTRACK {
|
|||
int at10; // Move predict
|
||||
};
|
||||
|
||||
extern int dword_138BB0[5];
|
||||
extern const int dword_138BB0[5];
|
||||
extern DUDEEXTRA gDudeExtra[];
|
||||
extern int gDudeSlope[];
|
||||
extern int cumulDamage[];
|
||||
|
|
|
@ -49,7 +49,7 @@ extern AISTATE cultistSFire;
|
|||
extern AISTATE cultistTFire;
|
||||
extern AISTATE cultistTsFire;
|
||||
extern AISTATE cultistSProneFire;
|
||||
extern AISTATE cultistTProneFir;
|
||||
extern AISTATE cultistTProneFire;
|
||||
extern AISTATE cultistTsProneFire;
|
||||
extern AISTATE cultistRecoil;
|
||||
extern AISTATE cultistProneRecoil;
|
||||
|
|
|
@ -31,6 +31,6 @@ extern AISTATE ratChase;
|
|||
extern AISTATE ratDodge;
|
||||
extern AISTATE ratRecoil;
|
||||
extern AISTATE ratGoto;
|
||||
extern AISTATE ratBit;
|
||||
extern AISTATE ratBite;
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -119,7 +119,7 @@ AISTATE genDudeThrow2 = { kAiStateChase, 7, nGenDudeThrow2, 0, NULL, NULL, NULL,
|
|||
AISTATE genDudePunch = { kAiStateChase,10, nGenDudePunch, 0, NULL, NULL, forcePunch, &genDudeChaseL };
|
||||
// ---------------------
|
||||
|
||||
GENDUDESND gCustomDudeSnd[] = {
|
||||
const GENDUDESND gCustomDudeSnd[] = {
|
||||
{ 1003, 2, 0, true, false }, // spot sound
|
||||
{ 1013, 2, 2, true, true }, // pain sound
|
||||
{ 1018, 2, 4, false, true }, // death sound
|
||||
|
@ -133,7 +133,7 @@ GENDUDESND gCustomDudeSnd[] = {
|
|||
{ 9008, 0, 17, false, false }, // transforming in other dude
|
||||
};
|
||||
|
||||
GENDUDEEXTRA gGenDudeExtra[kMaxSprites];
|
||||
GENDUDEEXTRA gGenDudeExtra[kMaxSprites]; // savegame handling in ai.cpp
|
||||
|
||||
static void forcePunch(spritetype* pSprite, XSPRITE*) {
|
||||
if (gGenDudeExtra[pSprite->index].forcePunch && seqGetStatus(3, pSprite->extra) == -1)
|
||||
|
@ -1118,7 +1118,7 @@ void aiGenDudeNewState(spritetype* pSprite, AISTATE* pAIState) {
|
|||
bool playGenDudeSound(spritetype* pSprite, int mode) {
|
||||
|
||||
if (mode < kGenDudeSndTargetSpot || mode >= kGenDudeSndMax) return false;
|
||||
GENDUDESND* sndInfo =& gCustomDudeSnd[mode]; bool gotSnd = false;
|
||||
const GENDUDESND* sndInfo =& gCustomDudeSnd[mode]; bool gotSnd = false;
|
||||
short sndStartId = xsprite[pSprite->extra].sysData1; int rand = sndInfo->randomRange;
|
||||
int sndId = (sndStartId <= 0) ? sndInfo->defaultSndId : sndStartId + sndInfo->sndIdOffset;
|
||||
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite);
|
||||
|
|
|
@ -138,6 +138,8 @@ extern AISTATE genDudeSearchNoWalkW;
|
|||
extern AISTATE genDudeChaseNoWalkL;
|
||||
extern AISTATE genDudeChaseNoWalkD;
|
||||
extern AISTATE genDudeChaseNoWalkW;
|
||||
extern AISTATE genDudeSearchShortL;
|
||||
extern AISTATE genDudeSearchShortW;
|
||||
|
||||
struct GENDUDESND
|
||||
{
|
||||
|
@ -148,7 +150,7 @@ struct GENDUDESND
|
|||
bool interruptable;
|
||||
};
|
||||
|
||||
extern GENDUDESND gCustomDudeSnd[];
|
||||
extern const GENDUDESND gCustomDudeSnd[];
|
||||
|
||||
// temporary, until normal DUDEEXTRA gets refactored
|
||||
struct GENDUDEEXTRA {
|
||||
|
|
|
@ -51,8 +51,408 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "z_music.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
#include "aibat.h"
|
||||
#include "aibeast.h"
|
||||
#include "aiboneel.h"
|
||||
#include "aiburn.h"
|
||||
#include "aicaleb.h"
|
||||
#include "aicerber.h"
|
||||
#include "aicult.h"
|
||||
#include "aigarg.h"
|
||||
#include "aighost.h"
|
||||
#include "aigilbst.h"
|
||||
#include "aihand.h"
|
||||
#include "aihound.h"
|
||||
#include "aiinnoc.h"
|
||||
#include "aipod.h"
|
||||
#include "airat.h"
|
||||
#include "aispid.h"
|
||||
#include "aitchern.h"
|
||||
#include "aizomba.h"
|
||||
#include "aizombf.h"
|
||||
#include "aiunicult.h"
|
||||
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
// All AI states for assigning an index.
|
||||
static AISTATE* allAIStates[] =
|
||||
{
|
||||
nullptr,
|
||||
&genIdle,
|
||||
&genRecoil,
|
||||
&batIdle,
|
||||
&batFlyIdle,
|
||||
&batChase,
|
||||
&batPonder,
|
||||
&batGoto,
|
||||
&batBite,
|
||||
&batRecoil,
|
||||
&batSearch,
|
||||
&batSwoop,
|
||||
&batFly,
|
||||
&batTurn,
|
||||
&batHide,
|
||||
&batDodgeUp,
|
||||
&batDodgeUpRight,
|
||||
&batDodgeUpLeft,
|
||||
&batDodgeDown,
|
||||
&batDodgeDownRight,
|
||||
&batDodgeDownLeft,
|
||||
&beastIdle,
|
||||
&beastChase,
|
||||
&beastDodge,
|
||||
&beastGoto,
|
||||
&beastSlash,
|
||||
&beastStomp,
|
||||
&beastSearch,
|
||||
&beastRecoil,
|
||||
&beastTeslaRecoil,
|
||||
&beastSwimIdle,
|
||||
&beastSwimChase,
|
||||
&beastSwimDodge,
|
||||
&beastSwimGoto,
|
||||
&beastSwimSearch,
|
||||
&beastSwimSlash,
|
||||
&beastSwimRecoil,
|
||||
&beastMorphToBeast,
|
||||
&beastMorphFromCultist,
|
||||
&beast138FB4,
|
||||
&beast138FD0,
|
||||
&beast138FEC,
|
||||
&eelIdle,
|
||||
&eelFlyIdle,
|
||||
&eelChase,
|
||||
&eelPonder,
|
||||
&eelGoto,
|
||||
&eelBite,
|
||||
&eelRecoil,
|
||||
&eelSearch,
|
||||
&eelSwoop,
|
||||
&eelFly,
|
||||
&eelTurn,
|
||||
&eelHide,
|
||||
&eelDodgeUp,
|
||||
&eelDodgeUpRight,
|
||||
&eelDodgeUpLeft,
|
||||
&eelDodgeDown,
|
||||
&eelDodgeDownRight,
|
||||
&eelDodgeDownLeft,
|
||||
&cultistBurnIdle,
|
||||
&cultistBurnChase,
|
||||
&cultistBurnGoto,
|
||||
&cultistBurnSearch,
|
||||
&cultistBurnAttack,
|
||||
&zombieABurnChase,
|
||||
&zombieABurnGoto,
|
||||
&zombieABurnSearch,
|
||||
&zombieABurnAttack,
|
||||
&zombieFBurnChase,
|
||||
&zombieFBurnGoto,
|
||||
&zombieFBurnSearch,
|
||||
&zombieFBurnAttack,
|
||||
&innocentBurnChase,
|
||||
&innocentBurnGoto,
|
||||
&innocentBurnSearch,
|
||||
&innocentBurnAttack,
|
||||
&beastBurnChase,
|
||||
&beastBurnGoto,
|
||||
&beastBurnSearch,
|
||||
&beastBurnAttack,
|
||||
&tinycalebBurnChase,
|
||||
&tinycalebBurnGoto,
|
||||
&tinycalebBurnSearch,
|
||||
&tinycalebBurnAttack,
|
||||
&genDudeBurnIdle,
|
||||
&genDudeBurnChase,
|
||||
&genDudeBurnGoto,
|
||||
&genDudeBurnSearch,
|
||||
&genDudeBurnAttack,
|
||||
&tinycalebIdle,
|
||||
&tinycalebChase,
|
||||
&tinycalebDodge,
|
||||
&tinycalebGoto,
|
||||
&tinycalebAttack,
|
||||
&tinycalebSearch,
|
||||
&tinycalebRecoil,
|
||||
&tinycalebTeslaRecoil,
|
||||
&tinycalebSwimIdle,
|
||||
&tinycalebSwimChase,
|
||||
&tinycalebSwimDodge,
|
||||
&tinycalebSwimGoto,
|
||||
&tinycalebSwimSearch,
|
||||
&tinycalebSwimAttack,
|
||||
&tinycalebSwimRecoil,
|
||||
&tinycaleb139660,
|
||||
&tinycaleb13967C,
|
||||
&tinycaleb139698,
|
||||
&cerberusIdle,
|
||||
&cerberusSearch,
|
||||
&cerberusChase,
|
||||
&cerberusRecoil,
|
||||
&cerberusTeslaRecoil,
|
||||
&cerberusGoto,
|
||||
&cerberusBite,
|
||||
&cerberusBurn,
|
||||
&cerberus3Burn,
|
||||
&cerberus2Idle,
|
||||
&cerberus2Search,
|
||||
&cerberus2Chase,
|
||||
&cerberus2Recoil,
|
||||
&cerberus2Goto,
|
||||
&cerberus2Bite,
|
||||
&cerberus2Burn,
|
||||
&cerberus4Burn,
|
||||
&cerberus139890,
|
||||
&cerberus1398AC,
|
||||
&cultistIdle,
|
||||
&cultistProneIdle,
|
||||
&fanaticProneIdle,
|
||||
&cultistProneIdle3,
|
||||
&cultistChase,
|
||||
&fanaticChase,
|
||||
&cultistDodge,
|
||||
&cultistGoto,
|
||||
&cultistProneChase,
|
||||
&cultistProneDodge,
|
||||
&cultistTThrow,
|
||||
&cultistSThrow,
|
||||
&cultistTsThrow,
|
||||
&cultistDThrow,
|
||||
&cultist139A78,
|
||||
&cultist139A94,
|
||||
&cultist139AB0,
|
||||
&cultist139ACC,
|
||||
&cultist139AE8,
|
||||
&cultistSearch,
|
||||
&cultistSFire,
|
||||
&cultistTFire,
|
||||
&cultistTsFire,
|
||||
&cultistSProneFire,
|
||||
&cultistTProneFire,
|
||||
&cultistTsProneFire,
|
||||
&cultistRecoil,
|
||||
&cultistProneRecoil,
|
||||
&cultistTeslaRecoil,
|
||||
&cultistSwimIdle,
|
||||
&cultistSwimChase,
|
||||
&cultistSwimDodge,
|
||||
&cultistSwimGoto,
|
||||
&cultistSwimSearch,
|
||||
&cultistSSwimFire,
|
||||
&cultistTSwimFire,
|
||||
&cultistTsSwimFire,
|
||||
&cultistSwimRecoil,
|
||||
&gargoyleFIdle,
|
||||
&gargoyleStatueIdle,
|
||||
&gargoyleFChase,
|
||||
&gargoyleFGoto,
|
||||
&gargoyleFSlash,
|
||||
&gargoyleFThrow,
|
||||
&gargoyleSThrow,
|
||||
&gargoyleSBlast,
|
||||
&gargoyleFRecoil,
|
||||
&gargoyleFSearch,
|
||||
&gargoyleFMorph2,
|
||||
&gargoyleFMorph,
|
||||
&gargoyleSMorph2,
|
||||
&gargoyleSMorph,
|
||||
&gargoyleSwoop,
|
||||
&gargoyleFly,
|
||||
&gargoyleTurn,
|
||||
&gargoyleDodgeUp,
|
||||
&gargoyleFDodgeUpRight,
|
||||
&gargoyleFDodgeUpLeft,
|
||||
&gargoyleDodgeDown,
|
||||
&gargoyleFDodgeDownRight,
|
||||
&gargoyleFDodgeDownLeft,
|
||||
&statueFBreakSEQ,
|
||||
&statueSBreakSEQ,
|
||||
&ghostIdle,
|
||||
&ghostChase,
|
||||
&ghostGoto,
|
||||
&ghostSlash,
|
||||
&ghostThrow,
|
||||
&ghostBlast,
|
||||
&ghostRecoil,
|
||||
&ghostTeslaRecoil,
|
||||
&ghostSearch,
|
||||
&ghostSwoop,
|
||||
&ghostFly,
|
||||
&ghostTurn,
|
||||
&ghostDodgeUp,
|
||||
&ghostDodgeUpRight,
|
||||
&ghostDodgeUpLeft,
|
||||
&ghostDodgeDown,
|
||||
&ghostDodgeDownRight,
|
||||
&ghostDodgeDownLeft,
|
||||
&gillBeastIdle,
|
||||
&gillBeastChase,
|
||||
&gillBeastDodge,
|
||||
&gillBeastGoto,
|
||||
&gillBeastBite,
|
||||
&gillBeastSearch,
|
||||
&gillBeastRecoil,
|
||||
&gillBeastSwimIdle,
|
||||
&gillBeastSwimChase,
|
||||
&gillBeastSwimDodge,
|
||||
&gillBeastSwimGoto,
|
||||
&gillBeastSwimSearch,
|
||||
&gillBeastSwimBite,
|
||||
&gillBeastSwimRecoil,
|
||||
&gillBeast13A138,
|
||||
&gillBeast13A154,
|
||||
&gillBeast13A170,
|
||||
&handIdle,
|
||||
&hand13A3B4,
|
||||
&handSearch,
|
||||
&handChase,
|
||||
&handRecoil,
|
||||
&handGoto,
|
||||
&handJump,
|
||||
&houndIdle,
|
||||
&houndSearch,
|
||||
&houndChase,
|
||||
&houndRecoil,
|
||||
&houndTeslaRecoil,
|
||||
&houndGoto,
|
||||
&houndBite,
|
||||
&houndBurn,
|
||||
&innocentIdle,
|
||||
&innocentSearch,
|
||||
&innocentChase,
|
||||
&innocentRecoil,
|
||||
&innocentTeslaRecoil,
|
||||
&innocentGoto,
|
||||
&podIdle,
|
||||
&pod13A600,
|
||||
&podSearch,
|
||||
&pod13A638,
|
||||
&podRecoil,
|
||||
&podChase,
|
||||
&tentacleIdle,
|
||||
&tentacle13A6A8,
|
||||
&tentacle13A6C4,
|
||||
&tentacle13A6E0,
|
||||
&tentacle13A6FC,
|
||||
&tentacle13A718,
|
||||
&tentacleSearch,
|
||||
&tentacle13A750,
|
||||
&tentacleRecoil,
|
||||
&tentacleChase,
|
||||
&ratIdle,
|
||||
&ratSearch,
|
||||
&ratChase,
|
||||
&ratDodge,
|
||||
&ratRecoil,
|
||||
&ratGoto,
|
||||
&ratBite,
|
||||
&spidIdle,
|
||||
&spidChase,
|
||||
&spidDodge,
|
||||
&spidGoto,
|
||||
&spidSearch,
|
||||
&spidBite,
|
||||
&spidJump,
|
||||
&spid13A92C,
|
||||
&tchernobogIdle,
|
||||
&tchernobogSearch,
|
||||
&tchernobogChase,
|
||||
&tchernobogRecoil,
|
||||
&tcherno13A9B8,
|
||||
&tcherno13A9D4,
|
||||
&tcherno13A9F0,
|
||||
&tcherno13AA0C,
|
||||
&tcherno13AA28,
|
||||
&genDudeIdleL,
|
||||
&genDudeIdleW,
|
||||
&genDudeSearchL,
|
||||
&genDudeSearchW,
|
||||
&genDudeSearchShortL,
|
||||
&genDudeSearchShortW,
|
||||
&genDudeSearchNoWalkL,
|
||||
&genDudeSearchNoWalkW,
|
||||
&genDudeGotoL,
|
||||
&genDudeGotoW,
|
||||
&genDudeDodgeL,
|
||||
&genDudeDodgeD,
|
||||
&genDudeDodgeW,
|
||||
&genDudeDodgeShortL,
|
||||
&genDudeDodgeShortD,
|
||||
&genDudeDodgeShortW,
|
||||
&genDudeDodgeShorterL,
|
||||
&genDudeDodgeShorterD,
|
||||
&genDudeDodgeShorterW,
|
||||
&genDudeChaseL,
|
||||
&genDudeChaseD,
|
||||
&genDudeChaseW,
|
||||
&genDudeChaseNoWalkL,
|
||||
&genDudeChaseNoWalkD,
|
||||
&genDudeChaseNoWalkW,
|
||||
&genDudeFireL,
|
||||
&genDudeFireD,
|
||||
&genDudeFireW,
|
||||
&genDudeRecoilL,
|
||||
&genDudeRecoilD,
|
||||
&genDudeRecoilW,
|
||||
&genDudeRecoilTesla,
|
||||
&genDudeThrow,
|
||||
&genDudeThrow2,
|
||||
&genDudePunch,
|
||||
&zombieAIdle,
|
||||
&zombieAChase,
|
||||
&zombieAPonder,
|
||||
&zombieAGoto,
|
||||
&zombieAHack,
|
||||
&zombieASearch,
|
||||
&zombieARecoil,
|
||||
&zombieATeslaRecoil,
|
||||
&zombieARecoil2,
|
||||
&zombieAStand,
|
||||
&zombieEIdle,
|
||||
&zombieEUp2,
|
||||
&zombieEUp,
|
||||
&zombie2Idle,
|
||||
&zombie2Search,
|
||||
&zombieSIdle,
|
||||
&zombie13AC2C,
|
||||
&zombieFIdle,
|
||||
&zombieFChase,
|
||||
&zombieFGoto,
|
||||
&zombieFDodge,
|
||||
&zombieFHack,
|
||||
&zombieFPuke,
|
||||
&zombieFThrow,
|
||||
&zombieFSearch,
|
||||
&zombieFRecoil,
|
||||
&zombieFTeslaRecoil,
|
||||
};
|
||||
|
||||
void IndexAIState(AISTATE*& state)
|
||||
{
|
||||
int i = 0;
|
||||
for (auto cstate : allAIStates)
|
||||
{
|
||||
if (state == cstate)
|
||||
{
|
||||
state = (AISTATE*)(intptr_t)i;
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
state = nullptr;
|
||||
}
|
||||
|
||||
void UnindexAIState(AISTATE*& state)
|
||||
{
|
||||
auto index = intptr_t(state);
|
||||
if (index >= 0 && index < countof(allAIStates))
|
||||
{
|
||||
state = allAIStates[index];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *gSaveGamePic[10];
|
||||
unsigned int gSavedOffset = 0;
|
||||
|
||||
|
@ -292,7 +692,10 @@ void MyLoadSave::Load(void)
|
|||
{
|
||||
int nXSprite = sprite[nSprite].extra;
|
||||
if (nXSprite > 0)
|
||||
{
|
||||
Read(&xsprite[nXSprite], sizeof(XSPRITE));
|
||||
UnindexAIState(xsprite[nXSprite].aiState);
|
||||
}
|
||||
}
|
||||
}
|
||||
memset(xwall, 0, sizeof(xwall));
|
||||
|
@ -377,7 +780,11 @@ void MyLoadSave::Save(void)
|
|||
{
|
||||
int nXSprite = sprite[nSprite].extra;
|
||||
if (nXSprite > 0)
|
||||
{
|
||||
IndexAIState(xsprite[nXSprite].aiState);
|
||||
Write(&xsprite[nXSprite], sizeof(XSPRITE));
|
||||
UnindexAIState(xsprite[nXSprite].aiState);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int nWall = 0; nWall < numwalls; nWall++)
|
||||
|
|
|
@ -3720,7 +3720,6 @@ class NNLoadSave : public LoadSave
|
|||
|
||||
void NNLoadSave::Load(void)
|
||||
{
|
||||
Read(&gModernMap, sizeof(gModernMap));
|
||||
Read(gSpriteMass, sizeof(gSpriteMass));
|
||||
Read(&gProxySpritesCount, sizeof(gProxySpritesCount));
|
||||
Read(gProxySpritesList, sizeof(gProxySpritesList));
|
||||
|
@ -3732,7 +3731,6 @@ void NNLoadSave::Load(void)
|
|||
|
||||
void NNLoadSave::Save(void)
|
||||
{
|
||||
Write(&gModernMap, sizeof(gModernMap));
|
||||
Write(gSpriteMass, sizeof(gSpriteMass));
|
||||
Write(&gProxySpritesCount, sizeof(gProxySpritesCount));
|
||||
Write(gProxySpritesList, sizeof(gProxySpritesList));
|
||||
|
|
Loading…
Reference in a new issue