- Used the one unused byte in the state structure as a flag to tell what type
the NextState parameter is. The code did some rather unsafe checks with it to determine its type. - moved all state related code into a new file: p_states.cpp. - merged all FindState functions. All the different variations are now inlined and call the same function to do the real work. SVN r1243 (trunk)
This commit is contained in:
parent
b523ebd2a7
commit
954955c5a5
16 changed files with 1001 additions and 904 deletions
|
|
@ -682,6 +682,7 @@ static int PatchThing (int thingy)
|
|||
bool hadHeight = false;
|
||||
bool hadTranslucency = false;
|
||||
bool hadStyle = false;
|
||||
FStateDefinitions statedef;
|
||||
bool patchedStates = false;
|
||||
int oldflags;
|
||||
const PClass *type;
|
||||
|
|
@ -813,36 +814,36 @@ static int PatchThing (int thingy)
|
|||
|
||||
if (type != NULL && !patchedStates)
|
||||
{
|
||||
MakeStateDefines(type->ActorInfo->StateList);
|
||||
statedef.MakeStateDefines(type);
|
||||
patchedStates = true;
|
||||
}
|
||||
|
||||
if (!strnicmp (Line1, "Initial", 7))
|
||||
AddState("Spawn", state ? state : GetDefault<AActor>()->SpawnState);
|
||||
statedef.AddState("Spawn", state ? state : GetDefault<AActor>()->SpawnState);
|
||||
else if (!strnicmp (Line1, "First moving", 12))
|
||||
AddState("See", state);
|
||||
statedef.AddState("See", state);
|
||||
else if (!strnicmp (Line1, "Injury", 6))
|
||||
AddState("Pain", state);
|
||||
statedef.AddState("Pain", state);
|
||||
else if (!strnicmp (Line1, "Close attack", 12))
|
||||
{
|
||||
if (thingy != 1) // Not for players!
|
||||
{
|
||||
AddState("Melee", state);
|
||||
statedef.AddState("Melee", state);
|
||||
}
|
||||
}
|
||||
else if (!strnicmp (Line1, "Far attack", 10))
|
||||
{
|
||||
if (thingy != 1) // Not for players!
|
||||
{
|
||||
AddState("Missile", state);
|
||||
statedef.AddState("Missile", state);
|
||||
}
|
||||
}
|
||||
else if (!strnicmp (Line1, "Death", 5))
|
||||
AddState("Death", state);
|
||||
statedef.AddState("Death", state);
|
||||
else if (!strnicmp (Line1, "Exploding", 9))
|
||||
AddState("XDeath", state);
|
||||
statedef.AddState("XDeath", state);
|
||||
else if (!strnicmp (Line1, "Respawn", 7))
|
||||
AddState("Raise", state);
|
||||
statedef.AddState("Raise", state);
|
||||
}
|
||||
else if (stricmp (Line1 + linelen - 6, " sound") == 0)
|
||||
{
|
||||
|
|
@ -1048,7 +1049,7 @@ static int PatchThing (int thingy)
|
|||
}
|
||||
if (patchedStates)
|
||||
{
|
||||
InstallStates(type->ActorInfo, info);
|
||||
statedef.InstallStates(type->ActorInfo, info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1359,6 +1360,7 @@ static int PatchWeapon (int weapNum)
|
|||
AWeapon *info;
|
||||
BYTE dummy[sizeof(AWeapon)];
|
||||
bool patchedStates = false;
|
||||
FStateDefinitions statedef;
|
||||
|
||||
if (weapNum >= 0 && weapNum < 9)
|
||||
{
|
||||
|
|
@ -1385,20 +1387,20 @@ static int PatchWeapon (int weapNum)
|
|||
|
||||
if (type != NULL && !patchedStates)
|
||||
{
|
||||
MakeStateDefines(type->ActorInfo->StateList);
|
||||
statedef.MakeStateDefines(type);
|
||||
patchedStates = true;
|
||||
}
|
||||
|
||||
if (strnicmp (Line1, "Deselect", 8) == 0)
|
||||
AddState("Select", state);
|
||||
statedef.AddState("Select", state);
|
||||
else if (strnicmp (Line1, "Select", 6) == 0)
|
||||
AddState("Deselect", state);
|
||||
statedef.AddState("Deselect", state);
|
||||
else if (strnicmp (Line1, "Bobbing", 7) == 0)
|
||||
AddState("Ready", state);
|
||||
statedef.AddState("Ready", state);
|
||||
else if (strnicmp (Line1, "Shooting", 8) == 0)
|
||||
AddState("Fire", state);
|
||||
statedef.AddState("Fire", state);
|
||||
else if (strnicmp (Line1, "Firing", 6) == 0)
|
||||
AddState("Flash", state);
|
||||
statedef.AddState("Flash", state);
|
||||
}
|
||||
else if (stricmp (Line1, "Ammo type") == 0)
|
||||
{
|
||||
|
|
@ -1455,7 +1457,7 @@ static int PatchWeapon (int weapNum)
|
|||
|
||||
if (patchedStates)
|
||||
{
|
||||
InstallStates(type->ActorInfo, info);
|
||||
statedef.InstallStates(type->ActorInfo, info);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -2582,13 +2584,14 @@ void FinishDehPatch ()
|
|||
memcpy (defaults2, defaults1, sizeof(AActor));
|
||||
|
||||
// Make a copy the state labels
|
||||
MakeStateDefines(type->ActorInfo->StateList);
|
||||
if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory)))
|
||||
{
|
||||
// If this is a hacked non-inventory item we must also copy AInventory's special states
|
||||
AddStateDefines(RUNTIME_CLASS(AInventory)->ActorInfo->StateList);
|
||||
FStateDefinitions statedef;
|
||||
statedef.MakeStateDefines(type);
|
||||
statedef.AddStateDefines(RUNTIME_CLASS(AInventory)->ActorInfo->StateList);
|
||||
statedef.InstallStates(subclass->ActorInfo, defaults2);
|
||||
}
|
||||
InstallStates(subclass->ActorInfo, defaults2);
|
||||
|
||||
// Use the DECORATE replacement feature to redirect all spawns
|
||||
// of the original class to the new one.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue