mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- Exhumed: Runlist and Rand.
This commit is contained in:
parent
c1b478bf83
commit
6475d772ca
4 changed files with 58 additions and 39 deletions
|
@ -383,8 +383,13 @@ struct RunStruct
|
|||
int nMoves;
|
||||
struct
|
||||
{
|
||||
#if B_BIG_ENDIAN == 1
|
||||
short nRef;
|
||||
short nVal;
|
||||
#else
|
||||
short nVal;
|
||||
short nRef;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -402,7 +407,7 @@ struct RunChannel
|
|||
|
||||
typedef void(*AiFunc)(int, int, int nRun);
|
||||
|
||||
extern RunStruct RunData[kMaxRuns];
|
||||
extern FreeListArray<RunStruct, kMaxRuns> RunData;
|
||||
extern RunChannel sRunChannels[kMaxChannels];
|
||||
extern short NewRun;
|
||||
extern int nRadialOwner;
|
||||
|
|
|
@ -25,12 +25,16 @@ int randA = 0;
|
|||
int randB = 0x11111111;
|
||||
int randC = 0x1010101;
|
||||
|
||||
static SavegameHelper sghrandom("rand",
|
||||
SV(randA),
|
||||
SV(randB),
|
||||
SV(randC),
|
||||
nullptr);
|
||||
|
||||
void SerializeRand(FSerializer& arc)
|
||||
{
|
||||
if (arc.BeginObject("rand"))
|
||||
{
|
||||
arc("a", randA)
|
||||
("b", randB)
|
||||
("c", randC)
|
||||
.EndObject();
|
||||
}
|
||||
}
|
||||
|
||||
void InitRandom()
|
||||
{
|
||||
|
|
|
@ -32,7 +32,6 @@ enum
|
|||
};
|
||||
|
||||
|
||||
short RunCount = -1;
|
||||
short nRadialSpr = -1;
|
||||
short nStackCount = 0;
|
||||
short word_966BE = 0;
|
||||
|
@ -46,9 +45,42 @@ short RunChain;
|
|||
short NewRun;
|
||||
|
||||
int sRunStack[kMaxRunStack];
|
||||
short RunFree[kMaxRuns];
|
||||
RunChannel sRunChannels[kMaxChannels];
|
||||
RunStruct RunData[kMaxRuns];
|
||||
FreeListArray<RunStruct, kMaxRuns> RunData;
|
||||
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* keyname, RunStruct& w, RunStruct* def)
|
||||
{
|
||||
if (arc.BeginObject(keyname))
|
||||
{
|
||||
arc("moves", w.nMoves)
|
||||
("_4", w._4)
|
||||
("_6", w._6)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
void SerializeRunList(FSerializer& arc)
|
||||
{
|
||||
if (arc.BeginObject("runlist"))
|
||||
{
|
||||
arc("data", RunData)
|
||||
("radialspr", nRadialSpr)
|
||||
("stackcount", nStackCount)
|
||||
("w966be", word_966BE)
|
||||
("list", ChannelList)
|
||||
("last", ChannelLast)
|
||||
("radialowner", nRadialOwner)
|
||||
("damageradius", nDamageRadius)
|
||||
("radialdamage", nRadialDamage)
|
||||
("runchain", RunChain)
|
||||
("newrun", NewRun)
|
||||
.Array("runstack", sRunStack, nStackCount)
|
||||
.Array("runchannels", &sRunChannels[0].a, 4 * kMaxChannels) // save this in a more compact form than an array of structs.
|
||||
.EndObject();
|
||||
}
|
||||
}
|
||||
|
||||
AiFunc aiFunctions[kFuncMax] = {
|
||||
FuncElev,
|
||||
|
@ -95,25 +127,17 @@ AiFunc aiFunctions[kFuncMax] = {
|
|||
|
||||
int runlist_GrabRun()
|
||||
{
|
||||
assert(RunCount > 0 && RunCount <= kMaxRuns);
|
||||
|
||||
RunCount--;
|
||||
|
||||
return RunFree[RunCount];
|
||||
return RunData.Get();
|
||||
}
|
||||
|
||||
int runlist_FreeRun(int nRun)
|
||||
{
|
||||
assert(RunCount >= 0 && RunCount < kMaxRuns);
|
||||
assert(nRun >= 0 && nRun < kMaxRuns);
|
||||
|
||||
RunFree[RunCount] = nRun;
|
||||
RunCount++;
|
||||
|
||||
RunData[nRun]._6 = -1;
|
||||
RunData[nRun].nMoves = -1;
|
||||
RunData[nRun]._4 = RunData[nRun]._6;
|
||||
|
||||
RunData.Release(nRun);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -131,14 +155,13 @@ void runlist_InitRun()
|
|||
{
|
||||
int i;
|
||||
|
||||
RunCount = kMaxRuns;
|
||||
RunData.Clear();
|
||||
nStackCount = 0;
|
||||
|
||||
for (i = 0; i < kMaxRuns; i++)
|
||||
{
|
||||
RunData[i].nMoves = -1;
|
||||
RunData[i]._6 = -1;
|
||||
RunFree[i] = i;
|
||||
RunData[i]._4 = -1;
|
||||
}
|
||||
|
||||
|
@ -1669,22 +1692,5 @@ void runlist_DamageEnemy(int nSprite, int nSprite2, short nDamage)
|
|||
}
|
||||
}
|
||||
|
||||
static SavegameHelper sghrunlist("runlist",
|
||||
SV(RunCount),
|
||||
SV(nRadialSpr),
|
||||
SV(nStackCount),
|
||||
SV(word_966BE),
|
||||
SV(ChannelList),
|
||||
SV(ChannelLast),
|
||||
SV(nRadialOwner),
|
||||
SV(nDamageRadius),
|
||||
SV(nRadialDamage),
|
||||
SV(RunChain),
|
||||
SV(NewRun),
|
||||
SA(sRunStack),
|
||||
SA(RunFree),
|
||||
SA(sRunChannels),
|
||||
SA(RunData),
|
||||
nullptr);
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
void SerializeRand(FSerializer& arc);
|
||||
void SerializeRunList(FSerializer& arc);
|
||||
void SerializeSequence(FSerializer& arc);
|
||||
void SerializeSnake(FSerializer& arc);
|
||||
void SerializeSwitch(FSerializer& arc);
|
||||
|
@ -63,6 +65,8 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
{
|
||||
if (arc.BeginObject("exhumed"))
|
||||
{
|
||||
SerializeRand(arc);
|
||||
SerializeRunList(arc);
|
||||
SerializeSequence(arc);
|
||||
SerializeSnake(arc);
|
||||
SerializeSwitch(arc);
|
||||
|
|
Loading…
Reference in a new issue