- adapted AActor to use TFlags

This commit is contained in:
Teemu Piippo 2015-04-04 19:40:43 +03:00
commit ca012bc9be
17 changed files with 127 additions and 92 deletions

View file

@ -60,7 +60,7 @@ static TArray<FVariableInfo*> variables;
#define DEFINE_DEPRECATED_FLAG(name) { DEPF_##name, #name, -1, 0 }
#define DEFINE_DUMMY_FLAG(name) { DEPF_UNUSED, #name, -1, 0 }
static FFlagDef ActorFlags[]=
static FFlagDef ActorFlagDefs[]=
{
DEFINE_FLAG(MF, PICKUP, APlayerPawn, flags),
DEFINE_FLAG(MF, SPECIAL, APlayerPawn, flags),
@ -302,7 +302,7 @@ static FFlagDef ActorFlags[]=
DEFINE_DUMMY_FLAG(EXPLODEONDEATH), // seems useless
};
static FFlagDef InventoryFlags[] =
static FFlagDef InventoryFlagDefs[] =
{
// Inventory flags
DEFINE_FLAG(IF, QUIET, AInventory, ItemFlags),
@ -329,7 +329,7 @@ static FFlagDef InventoryFlags[] =
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),};
static FFlagDef WeaponFlags[] =
static FFlagDef WeaponFlagDefs[] =
{
// Weapon flags
DEFINE_FLAG(WIF, NOAUTOFIRE, AWeapon, WeaponFlags),
@ -356,7 +356,7 @@ static FFlagDef WeaponFlags[] =
DEFINE_DUMMY_FLAG(ALLOW_WITH_RESPAWN_INVUL),
};
static FFlagDef PlayerPawnFlags[] =
static FFlagDef PlayerPawnFlagDefs[] =
{
// PlayerPawn flags
DEFINE_FLAG(PPF, NOTHRUSTWHENINVUL, APlayerPawn, PlayerFlags),
@ -364,7 +364,7 @@ static FFlagDef PlayerPawnFlags[] =
DEFINE_FLAG(PPF, CROUCHABLEMORPH, APlayerPawn, PlayerFlags),
};
static FFlagDef PowerSpeedFlags[] =
static FFlagDef PowerSpeedFlagDefs[] =
{
// PowerSpeed flags
DEFINE_FLAG(PSF, NOTRAIL, APowerSpeed, SpeedFlags),
@ -372,11 +372,11 @@ static FFlagDef PowerSpeedFlags[] =
static const struct FFlagList { const PClass *Type; FFlagDef *Defs; int NumDefs; } FlagLists[] =
{
{ RUNTIME_CLASS(AActor), ActorFlags, countof(ActorFlags) },
{ RUNTIME_CLASS(AInventory), InventoryFlags, countof(InventoryFlags) },
{ RUNTIME_CLASS(AWeapon), WeaponFlags, countof(WeaponFlags) },
{ RUNTIME_CLASS(APlayerPawn), PlayerPawnFlags,countof(PlayerPawnFlags) },
{ RUNTIME_CLASS(APowerSpeed), PowerSpeedFlags,countof(PowerSpeedFlags) },
{ RUNTIME_CLASS(AActor), ActorFlagDefs, countof(ActorFlagDefs) },
{ RUNTIME_CLASS(AInventory), InventoryFlagDefs, countof(InventoryFlagDefs) },
{ RUNTIME_CLASS(AWeapon), WeaponFlagDefs, countof(WeaponFlagDefs) },
{ RUNTIME_CLASS(APlayerPawn), PlayerPawnFlagDefs, countof(PlayerPawnFlagDefs) },
{ RUNTIME_CLASS(APowerSpeed), PowerSpeedFlagDefs, countof(PowerSpeedFlagDefs) },
};
#define NUM_FLAG_LISTS (countof(FlagLists))
@ -463,11 +463,11 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2)
const char *GetFlagName(unsigned int flagnum, int flagoffset)
{
for(unsigned i = 0; i < countof(ActorFlags); i++)
for(unsigned i = 0; i < countof(ActorFlagDefs); i++)
{
if (ActorFlags[i].flagbit == flagnum && ActorFlags[i].structoffset == flagoffset)
if (ActorFlagDefs[i].flagbit == flagnum && ActorFlagDefs[i].structoffset == flagoffset)
{
return ActorFlags[i].name;
return ActorFlagDefs[i].name;
}
}
return "(unknown)"; // return something printable