- resorted some of thingdef.cpp's contents into more appropriate files.

- split FinishActor into several functions. While DECORATE can, ZSCRIPT cannot do all this in one go.
- split the state finalization into several class-specific virtual functions.
This commit is contained in:
Christoph Oelckers 2016-10-12 20:42:41 +02:00
commit 59ed26c0b6
10 changed files with 286 additions and 220 deletions

View file

@ -67,6 +67,38 @@ void PClassWeapon::ReplaceClassRef(PClass *oldclass, PClass *newclass)
}
}
void PClassWeapon::Finalize(FStateDefinitions &statedef)
{
Super::Finalize(statedef);
FState *ready = FindState(NAME_Ready);
FState *select = FindState(NAME_Select);
FState *deselect = FindState(NAME_Deselect);
FState *fire = FindState(NAME_Fire);
// Consider any weapon without any valid state abstract and don't output a warning
// This is for creating base classes for weapon groups that only set up some properties.
if (ready || select || deselect || fire)
{
if (!ready)
{
I_Error("Weapon %s doesn't define a ready state.", TypeName.GetChars());
}
if (!select)
{
I_Error("Weapon %s doesn't define a select state.", TypeName.GetChars());
}
if (!deselect)
{
I_Error("Weapon %s doesn't define a deselect state.", TypeName.GetChars());
}
if (!fire)
{
I_Error("Weapon %s doesn't define a fire state.", TypeName.GetChars());
}
}
}
//===========================================================================
//
// AWeapon :: Serialize