mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- Blood: JSON serializer for triggers
Also renaming members of struct BUSY.
This commit is contained in:
parent
f73ca55c79
commit
b2a7a0635b
6 changed files with 47 additions and 45 deletions
|
@ -51,7 +51,7 @@ static void aiPodChase(spritetype *, XSPRITE *);
|
||||||
AISTATE podIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL };
|
AISTATE podIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL };
|
||||||
AISTATE podMove = { kAiStateMove, 7, -1, 3600, NULL, aiMoveTurn, aiPodMove, &podSearch };
|
AISTATE podMove = { kAiStateMove, 7, -1, 3600, NULL, aiMoveTurn, aiPodMove, &podSearch };
|
||||||
AISTATE podSearch = { kAiStateSearch, 0, -1, 3600, NULL, aiMoveTurn, aiPodSearch, &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 podRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &podChase };
|
||||||
AISTATE podChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, aiPodChase, NULL };
|
AISTATE podChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, aiPodChase, NULL };
|
||||||
AISTATE tentacleIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, 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 tentacle13A6FC = { kAiStateOther, -1, -1, 0, NULL, NULL, NULL, &tentacleIdle };
|
||||||
AISTATE tentacleMove = { kAiStateOther, 8, -1, 3600, NULL, aiMoveTurn, aiPodMove, &tentacleSearch };
|
AISTATE tentacleMove = { kAiStateOther, 8, -1, 3600, NULL, aiMoveTurn, aiPodMove, &tentacleSearch };
|
||||||
AISTATE tentacleSearch = { kAiStateOther, 0, -1, 3600, NULL, aiMoveTurn, aiPodSearch, NULL };
|
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 tentacleRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &tentacleChase };
|
||||||
AISTATE tentacleChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, aiPodChase, NULL };
|
AISTATE tentacleChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, aiPodChase, NULL };
|
||||||
|
|
||||||
|
|
|
@ -727,7 +727,6 @@ void LevelsLoadSaveConstruct(void);
|
||||||
void MessagesLoadSaveConstruct(void);
|
void MessagesLoadSaveConstruct(void);
|
||||||
void MirrorLoadSaveConstruct(void);
|
void MirrorLoadSaveConstruct(void);
|
||||||
void PlayerLoadSaveConstruct(void);
|
void PlayerLoadSaveConstruct(void);
|
||||||
void TriggersLoadSaveConstruct(void);
|
|
||||||
void ViewLoadSaveConstruct(void);
|
void ViewLoadSaveConstruct(void);
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
void NNLoadSaveConstruct(void);
|
void NNLoadSaveConstruct(void);
|
||||||
|
@ -744,7 +743,6 @@ void LoadSaveSetup(void)
|
||||||
MessagesLoadSaveConstruct();
|
MessagesLoadSaveConstruct();
|
||||||
MirrorLoadSaveConstruct();
|
MirrorLoadSaveConstruct();
|
||||||
PlayerLoadSaveConstruct();
|
PlayerLoadSaveConstruct();
|
||||||
TriggersLoadSaveConstruct();
|
|
||||||
ViewLoadSaveConstruct();
|
ViewLoadSaveConstruct();
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
NNLoadSaveConstruct();
|
NNLoadSaveConstruct();
|
||||||
|
@ -755,6 +753,7 @@ void LoadSaveSetup(void)
|
||||||
void SerializeEvents(FSerializer& arc);
|
void SerializeEvents(FSerializer& arc);
|
||||||
void SerializeSequences(FSerializer& arc);
|
void SerializeSequences(FSerializer& arc);
|
||||||
void SerializeWarp(FSerializer& arc);
|
void SerializeWarp(FSerializer& arc);
|
||||||
|
void SerializeTriggers(FSerializer& arc);
|
||||||
|
|
||||||
void GameInterface::SerializeGameState(FSerializer& arc)
|
void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
{
|
{
|
||||||
|
@ -770,6 +769,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
SerializeEvents(arc);
|
SerializeEvents(arc);
|
||||||
SerializeSequences(arc);
|
SerializeSequences(arc);
|
||||||
SerializeWarp(arc);
|
SerializeWarp(arc);
|
||||||
|
SerializeTriggers(arc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ enum
|
||||||
nJumpClient,
|
nJumpClient,
|
||||||
nHoundBiteClient,
|
nHoundBiteClient,
|
||||||
nHoundBurnClient,
|
nHoundBurnClient,
|
||||||
dword_279B34,
|
nPodStartChaseClient,
|
||||||
dword_279B38,
|
nTentacleStartSearchClient,
|
||||||
dword_279B3C,
|
dword_279B3C,
|
||||||
dword_279B40,
|
dword_279B40,
|
||||||
nRatBiteClient,
|
nRatBiteClient,
|
||||||
|
|
|
@ -167,10 +167,10 @@ enum BUSYID {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BUSY {
|
struct BUSY {
|
||||||
int TotalKills;
|
int index;
|
||||||
int Kills;
|
int delta;
|
||||||
int at8;
|
int busy;
|
||||||
BUSYID atc;
|
int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
BUSY gBusy[128];
|
BUSY gBusy[128];
|
||||||
|
@ -181,19 +181,19 @@ void AddBusy(int a1, BUSYID a2, int nDelta)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < gBusyCount; 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;
|
break;
|
||||||
}
|
}
|
||||||
if (i == gBusyCount)
|
if (i == gBusyCount)
|
||||||
{
|
{
|
||||||
if (gBusyCount == 128)
|
if (gBusyCount == 128)
|
||||||
return;
|
return;
|
||||||
gBusy[i].TotalKills = a1;
|
gBusy[i].index = a1;
|
||||||
gBusy[i].atc = a2;
|
gBusy[i].type = a2;
|
||||||
gBusy[i].at8 = nDelta > 0 ? 0 : 65536;
|
gBusy[i].busy = nDelta > 0 ? 0 : 65536;
|
||||||
gBusyCount++;
|
gBusyCount++;
|
||||||
}
|
}
|
||||||
gBusy[i].Kills = nDelta;
|
gBusy[i].delta = nDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReverseBusy(int a1, BUSYID a2)
|
void ReverseBusy(int a1, BUSYID a2)
|
||||||
|
@ -201,9 +201,9 @@ void ReverseBusy(int a1, BUSYID a2)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < gBusyCount; 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2005,16 +2005,16 @@ void trProcessBusy(void)
|
||||||
memset(velCeil, 0, sizeof(velCeil));
|
memset(velCeil, 0, sizeof(velCeil));
|
||||||
for (int i = gBusyCount-1; i >= 0; i--)
|
for (int i = gBusyCount-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
int oldBusy = gBusy[i].at8;
|
int oldBusy = gBusy[i].busy;
|
||||||
gBusy[i].at8 = ClipRange(oldBusy+gBusy[i].Kills*4, 0, 65536);
|
gBusy[i].busy = ClipRange(oldBusy+gBusy[i].delta*4, 0, 65536);
|
||||||
int nStatus = gBusyProc[gBusy[i].atc](gBusy[i].TotalKills, gBusy[i].at8);
|
int nStatus = gBusyProc[gBusy[i].type](gBusy[i].index, gBusy[i].busy);
|
||||||
switch (nStatus) {
|
switch (nStatus) {
|
||||||
case 1:
|
case 1:
|
||||||
gBusy[i].at8 = oldBusy;
|
gBusy[i].busy = oldBusy;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
gBusy[i].at8 = oldBusy;
|
gBusy[i].busy = oldBusy;
|
||||||
gBusy[i].Kills = -gBusy[i].Kills;
|
gBusy[i].delta = -gBusy[i].delta;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
gBusy[i] = gBusy[--gBusyCount];
|
gBusy[i] = gBusy[--gBusyCount];
|
||||||
|
@ -2317,30 +2317,35 @@ void MGunOpenSeqCallback(int, int nXSprite)
|
||||||
seqSpawn(39, 3, nXSprite, nMGunFireClient);
|
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));
|
if (arc.BeginObject(keyname))
|
||||||
Read(gBusy, sizeof(gBusy));
|
{
|
||||||
Read(basePath, sizeof(basePath));
|
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));
|
if (arc.BeginObject("triggers"))
|
||||||
Write(gBusy, sizeof(gBusy));
|
{
|
||||||
Write(basePath, sizeof(basePath));
|
arc("busycount", gBusyCount)
|
||||||
}
|
.Array("busy", gBusy, gBusyCount)
|
||||||
|
.Array("basepath", basePath, numsectors)
|
||||||
void TriggersLoadSaveConstruct(void)
|
.EndObject();
|
||||||
{
|
}
|
||||||
new TriggersLoadSave();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_BLD_NS
|
END_BLD_NS
|
||||||
|
|
|
@ -66,8 +66,6 @@ struct zdemoheader_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class FArchive;
|
|
||||||
|
|
||||||
// When transmitted, the above message is preceded by a uint8_t
|
// When transmitted, the above message is preceded by a uint8_t
|
||||||
// indicating which fields are actually present in the message.
|
// indicating which fields are actually present in the message.
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -9,4 +9,3 @@ struct ticcmd_t
|
||||||
uint16_t consistency; // checks for net game
|
uint16_t consistency; // checks for net game
|
||||||
};
|
};
|
||||||
|
|
||||||
FArchive &operator<< (FArchive &arc, ticcmd_t &cmd);
|
|
||||||
|
|
Loading…
Reference in a new issue