diff --git a/source/blood/src/aipod.cpp b/source/blood/src/aipod.cpp index b3ea95dc8..b2ee2be26 100644 --- a/source/blood/src/aipod.cpp +++ b/source/blood/src/aipod.cpp @@ -51,7 +51,7 @@ static void aiPodChase(spritetype *, XSPRITE *); AISTATE podIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE podMove = { kAiStateMove, 7, -1, 3600, NULL, aiMoveTurn, aiPodMove, &podSearch }; AISTATE podSearch = { kAiStateSearch, 0, -1, 3600, NULL, aiMoveTurn, aiPodSearch, &podSearch }; -AISTATE podStartChase = { kAiStateChase, 8, dword_279B34, 600, NULL, NULL, NULL, &podChase }; +AISTATE podStartChase = { kAiStateChase, 8, nPodStartChaseClient, 600, NULL, NULL, NULL, &podChase }; AISTATE podRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &podChase }; AISTATE podChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, aiPodChase, NULL }; AISTATE tentacleIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; @@ -61,7 +61,7 @@ AISTATE tentacle13A6E0 = { kAiStateOther, 8, dword_279B40, 0, NULL, NULL, NULL, AISTATE tentacle13A6FC = { kAiStateOther, -1, -1, 0, NULL, NULL, NULL, &tentacleIdle }; AISTATE tentacleMove = { kAiStateOther, 8, -1, 3600, NULL, aiMoveTurn, aiPodMove, &tentacleSearch }; AISTATE tentacleSearch = { kAiStateOther, 0, -1, 3600, NULL, aiMoveTurn, aiPodSearch, NULL }; -AISTATE tentacleStartChase = { kAiStateOther, 6, dword_279B38, 120, NULL, NULL, NULL, &tentacleChase }; +AISTATE tentacleStartChase = { kAiStateOther, 6, nTentacleStartSearchClient, 120, NULL, NULL, NULL, &tentacleChase }; AISTATE tentacleRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &tentacleChase }; AISTATE tentacleChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, aiPodChase, NULL }; diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index da8f7497e..be28ec8b7 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -727,7 +727,6 @@ void LevelsLoadSaveConstruct(void); void MessagesLoadSaveConstruct(void); void MirrorLoadSaveConstruct(void); void PlayerLoadSaveConstruct(void); -void TriggersLoadSaveConstruct(void); void ViewLoadSaveConstruct(void); #ifdef NOONE_EXTENSIONS void NNLoadSaveConstruct(void); @@ -744,7 +743,6 @@ void LoadSaveSetup(void) MessagesLoadSaveConstruct(); MirrorLoadSaveConstruct(); PlayerLoadSaveConstruct(); - TriggersLoadSaveConstruct(); ViewLoadSaveConstruct(); #ifdef NOONE_EXTENSIONS NNLoadSaveConstruct(); @@ -755,6 +753,7 @@ void LoadSaveSetup(void) void SerializeEvents(FSerializer& arc); void SerializeSequences(FSerializer& arc); void SerializeWarp(FSerializer& arc); +void SerializeTriggers(FSerializer& arc); void GameInterface::SerializeGameState(FSerializer& arc) { @@ -770,6 +769,7 @@ void GameInterface::SerializeGameState(FSerializer& arc) SerializeEvents(arc); SerializeSequences(arc); SerializeWarp(arc); + SerializeTriggers(arc); } diff --git a/source/blood/src/seqcb.h b/source/blood/src/seqcb.h index 56dc87340..5319107cb 100644 --- a/source/blood/src/seqcb.h +++ b/source/blood/src/seqcb.h @@ -96,8 +96,8 @@ enum nJumpClient, nHoundBiteClient, nHoundBurnClient, - dword_279B34, - dword_279B38, + nPodStartChaseClient, + nTentacleStartSearchClient, dword_279B3C, dword_279B40, nRatBiteClient, diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index 8138aacbe..32dfc53ab 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -167,10 +167,10 @@ enum BUSYID { }; struct BUSY { - int TotalKills; - int Kills; - int at8; - BUSYID atc; + int index; + int delta; + int busy; + int type; }; BUSY gBusy[128]; @@ -181,19 +181,19 @@ void AddBusy(int a1, BUSYID a2, int nDelta) int i; for (i = 0; i < gBusyCount; i++) { - if (gBusy[i].TotalKills == a1 && gBusy[i].atc == a2) + if (gBusy[i].index == a1 && gBusy[i].type == a2) break; } if (i == gBusyCount) { if (gBusyCount == 128) return; - gBusy[i].TotalKills = a1; - gBusy[i].atc = a2; - gBusy[i].at8 = nDelta > 0 ? 0 : 65536; + gBusy[i].index = a1; + gBusy[i].type = a2; + gBusy[i].busy = nDelta > 0 ? 0 : 65536; gBusyCount++; } - gBusy[i].Kills = nDelta; + gBusy[i].delta = nDelta; } void ReverseBusy(int a1, BUSYID a2) @@ -201,9 +201,9 @@ void ReverseBusy(int a1, BUSYID a2) int i; for (i = 0; i < gBusyCount; i++) { - if (gBusy[i].TotalKills == a1 && gBusy[i].atc == a2) + if (gBusy[i].index == a1 && gBusy[i].type == a2) { - gBusy[i].Kills = -gBusy[i].Kills; + gBusy[i].delta = -gBusy[i].delta; break; } } @@ -2005,16 +2005,16 @@ void trProcessBusy(void) memset(velCeil, 0, sizeof(velCeil)); for (int i = gBusyCount-1; i >= 0; i--) { - int oldBusy = gBusy[i].at8; - gBusy[i].at8 = ClipRange(oldBusy+gBusy[i].Kills*4, 0, 65536); - int nStatus = gBusyProc[gBusy[i].atc](gBusy[i].TotalKills, gBusy[i].at8); + int oldBusy = gBusy[i].busy; + gBusy[i].busy = ClipRange(oldBusy+gBusy[i].delta*4, 0, 65536); + int nStatus = gBusyProc[gBusy[i].type](gBusy[i].index, gBusy[i].busy); switch (nStatus) { case 1: - gBusy[i].at8 = oldBusy; + gBusy[i].busy = oldBusy; break; case 2: - gBusy[i].at8 = oldBusy; - gBusy[i].Kills = -gBusy[i].Kills; + gBusy[i].busy = oldBusy; + gBusy[i].delta = -gBusy[i].delta; break; case 3: gBusy[i] = gBusy[--gBusyCount]; @@ -2317,30 +2317,35 @@ void MGunOpenSeqCallback(int, int nXSprite) seqSpawn(39, 3, nXSprite, nMGunFireClient); } -class TriggersLoadSave : public LoadSave -{ -public: - virtual void Load(); - virtual void Save(); -}; -void TriggersLoadSave::Load() +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +FSerializer& Serialize(FSerializer& arc, const char* keyname, BUSY& w, BUSY* def) { - Read(&gBusyCount, sizeof(gBusyCount)); - Read(gBusy, sizeof(gBusy)); - Read(basePath, sizeof(basePath)); + if (arc.BeginObject(keyname)) + { + arc("index", w.index) + ("type", w.type) + ("delta", w.delta) + ("busy", w.busy) + .EndObject(); + } + return arc; } -void TriggersLoadSave::Save() +void SerializeTriggers(FSerializer& arc) { - Write(&gBusyCount, sizeof(gBusyCount)); - Write(gBusy, sizeof(gBusy)); - Write(basePath, sizeof(basePath)); -} - -void TriggersLoadSaveConstruct(void) -{ - new TriggersLoadSave(); + if (arc.BeginObject("triggers")) + { + arc("busycount", gBusyCount) + .Array("busy", gBusy, gBusyCount) + .Array("basepath", basePath, numsectors) + .EndObject(); + } } END_BLD_NS diff --git a/source/core/d_protocol.h b/source/core/d_protocol.h index 6fe43f16f..50cc29555 100644 --- a/source/core/d_protocol.h +++ b/source/core/d_protocol.h @@ -66,8 +66,6 @@ struct zdemoheader_s { }; -class FArchive; - // When transmitted, the above message is preceded by a uint8_t // indicating which fields are actually present in the message. enum diff --git a/source/core/d_ticcmd.h b/source/core/d_ticcmd.h index a338c3736..d38a2c569 100644 --- a/source/core/d_ticcmd.h +++ b/source/core/d_ticcmd.h @@ -9,4 +9,3 @@ struct ticcmd_t uint16_t consistency; // checks for net game }; -FArchive &operator<< (FArchive &arc, ticcmd_t &cmd);