- moved all remaining fields from PClassActor to FActorInfo.

- added a few access functions for FActorInfo variables.

With PClassActor now empty the class descriptors can finally be converted back to static data outside the class hierarchy, like they were before the scripting merge, and untangle the game data from VM internals.
This commit is contained in:
Christoph Oelckers 2017-04-12 00:07:41 +02:00
parent 854053a14f
commit e4d2380775
25 changed files with 122 additions and 118 deletions

View file

@ -1984,7 +1984,7 @@ static int PatchMisc (int dummy)
player->health = deh.StartHealth;
// Hm... I'm not sure that this is the right way to change this info...
FDropItem *di = PClass::FindActor(NAME_DoomPlayer)->DropItems;
FDropItem *di = PClass::FindActor(NAME_DoomPlayer)->ActorInfo()->DropItems;
while (di != NULL)
{
if (di->Name == NAME_Clip)
@ -3045,7 +3045,7 @@ void FinishDehPatch ()
if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
// If this is a hacked non-inventory item we must also copy AInventory's special states
statedef.AddStateDefines(RUNTIME_CLASS(AInventory)->StateList);
statedef.AddStateDefines(RUNTIME_CLASS(AInventory)->GetStateLabels());
}
statedef.InstallStates(subclass, defaults2);

View file

@ -158,7 +158,7 @@ int D_PlayerClassToInt (const char *classname)
{
auto type = PlayerClasses[i].Type;
if (type->DisplayName.IsNotEmpty() && stricmp(type->DisplayName, classname) == 0)
if (type->GetDisplayName().IsNotEmpty() && stricmp(type->GetDisplayName(), classname) == 0)
{
return i;
}
@ -737,7 +737,7 @@ void D_WriteUserInfoStrings (int pnum, uint8_t **stream, bool compact)
case NAME_PlayerClass:
*stream += sprintf(*((char **)stream), "\\%s", info->GetPlayerClassNum() == -1 ? "Random" :
D_EscapeUserInfo(info->GetPlayerClassType()->DisplayName.GetChars()).GetChars());
D_EscapeUserInfo(info->GetPlayerClassType()->GetDisplayName().GetChars()).GetChars());
break;
case NAME_Skin:
@ -915,7 +915,7 @@ void WriteUserInfo(FSerializer &arc, userinfo_t &info)
case NAME_PlayerClass:
i = info.GetPlayerClassNum();
string = (i == -1 ? "Random" : PlayerClasses[i].Type->DisplayName.GetChars());
string = (i == -1 ? "Random" : PlayerClasses[i].Type->GetDisplayName().GetChars());
break;
default:
@ -1001,7 +1001,7 @@ CCMD (playerinfo)
Printf("%20s: %s (%d)\n", "Skin", Skins[ui->GetSkin()].Name.GetChars(), ui->GetSkin());
Printf("%20s: %s (%d)\n", "Gender", GenderNames[ui->GetGender()], ui->GetGender());
Printf("%20s: %s (%d)\n", "PlayerClass",
ui->GetPlayerClassNum() == -1 ? "Random" : ui->GetPlayerClassType()->DisplayName.GetChars(),
ui->GetPlayerClassNum() == -1 ? "Random" : ui->GetPlayerClassType()->GetDisplayName().GetChars(),
ui->GetPlayerClassNum());
// Print generic info

View file

@ -102,7 +102,7 @@ CCMD (dumpactors)
Printf("%s\t%i\t%i\t%s\t%s\n",
acls->TypeName.GetChars(), ainfo->DoomEdNum,
ainfo->SpawnID, filters[ainfo->GameFilter & 31],
acls->SourceLumpName.GetChars());
acls->ActorInfo()->SourceLumpName.GetChars());
}
else if (cls != NULL)
{

View file

@ -476,7 +476,7 @@ const char * G_SkillName()
const char *name = AllSkills[gameskill].MenuName;
player_t *player = &players[consoleplayer];
const char *playerclass = player->mo->GetClass()->DisplayName;
const char *playerclass = player->mo->GetInfo()->DisplayName;
if (playerclass != NULL)
{

View file

@ -2925,7 +2925,7 @@ class CommandPlayerClass : public SBarInfoCommandFlowControl
bool foundClass = false;
for(unsigned int c = 0;c < PlayerClasses.Size();c++)
{
if(stricmp(sc.String, PlayerClasses[c].Type->DisplayName) == 0)
if(stricmp(sc.String, PlayerClasses[c].Type->GetDisplayName()) == 0)
{
foundClass = true;
classes.Push(PlayerClasses[c].Type);

View file

@ -360,7 +360,7 @@ void GLSceneDrawer::RenderThings(subsector_t * sub, sector_t * sector)
if (thing->validcount == validcount) continue;
thing->validcount = validcount;
FIntCVar *cvar = thing->GetClass()->distancecheck;
FIntCVar *cvar = thing->GetInfo()->distancecheck;
if (cvar != NULL && *cvar >= 0)
{
double dist = (thing->Pos() - r_viewpoint.Pos).LengthSquared();
@ -378,7 +378,7 @@ void GLSceneDrawer::RenderThings(subsector_t * sub, sector_t * sector)
for (msecnode_t *node = sec->sectorportal_thinglist; node; node = node->m_snext)
{
AActor *thing = node->m_thing;
FIntCVar *cvar = thing->GetClass()->distancecheck;
FIntCVar *cvar = thing->GetInfo()->distancecheck;
if (cvar != NULL && *cvar >= 0)
{
double dist = (thing->Pos() - r_viewpoint.Pos).LengthSquared();

View file

@ -841,9 +841,9 @@ void gl_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
PClassActor *cls = pair->Key;
int gltrans = GLTranslationPalette::GetInternalTranslation(GetDefaultByType(cls)->Translation);
for (int i = 0; i < cls->ActorInfo()->NumOwnedStates; i++)
for (int i = 0; i < cls->GetStateCount(); i++)
{
auto &state = cls->ActorInfo()->OwnedStates[i];
auto &state = cls->GetStates()[i];
spritelist[state.sprite].Insert(gltrans, true);
FSpriteModelFrame * smf = gl_FindModelFrame(cls, state.sprite, state.Frame, false);
if (smf != NULL)

View file

@ -294,10 +294,6 @@ void PClassActor::StaticSetActorNums()
PClassActor::PClassActor()
{
StateList = NULL;
DropItems = NULL;
// Record this in the master list.
AllActorClasses.Push(this);
}
@ -309,11 +305,6 @@ PClassActor::PClassActor()
PClassActor::~PClassActor()
{
if (StateList != NULL)
{
StateList->Destroy();
M_Free(StateList);
}
}
//==========================================================================
@ -326,16 +317,6 @@ void PClassActor::DeriveData(PClass *newclass)
{
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassActor)));
PClassActor *newa = static_cast<PClassActor *>(newclass);
newa->distancecheck = distancecheck;
newa->DropItems = DropItems;
newa->VisibleToPlayerClass = VisibleToPlayerClass;
newa->DamageFactors = DamageFactors;
newa->PainChances = PainChances;
newa->DisplayName = DisplayName;
}
//==========================================================================
@ -367,20 +348,6 @@ bool PClassActor::SetReplacement(FName replaceName)
return true;
}
//==========================================================================
//
// PClassActor :: SetDropItems
//
// Sets a new drop item list
//
//==========================================================================
void PClassActor::SetDropItems(FDropItem *drops)
{
DropItems = drops;
}
//==========================================================================
//
// PClassActor :: Finalize
@ -580,12 +547,12 @@ DEFINE_ACTION_FUNCTION(AActor, GetReplacee)
void PClassActor::SetDamageFactor(FName type, double factor)
{
for (auto & p : DamageFactors)
for (auto & p : ActorInfo()->DamageFactors)
{
if (p.first == type) p.second = factor;
return;
}
DamageFactors.Push({ type, factor });
ActorInfo()->DamageFactors.Push({ type, factor });
}
//==========================================================================
@ -596,7 +563,7 @@ void PClassActor::SetDamageFactor(FName type, double factor)
void PClassActor::SetPainChance(FName type, int chance)
{
for (auto & p : PainChances)
for (auto & p : ActorInfo()->PainChances)
{
if (p.first == type) p.second = chance;
return;
@ -604,7 +571,7 @@ void PClassActor::SetPainChance(FName type, int chance)
if (chance >= 0)
{
PainChances.Push({ type, MIN(chance, 256) });
ActorInfo()->PainChances.Push({ type, MIN(chance, 256) });
}
}

View file

@ -248,14 +248,42 @@ struct FActorInfo
uint16_t SpawnID = 0;
uint16_t ConversationID = 0;
int16_t DoomEdNum = 0;
FString SourceLumpName;
FStateLabels *StateList = nullptr;
DmgFactors DamageFactors;
PainChanceList PainChances;
TArray<PClassActor *> VisibleToPlayerClass;
FDropItem *DropItems;
FIntCVar *distancecheck;
// This is from PClassPlayerPawn
FString DisplayName;
uint8_t DefaultStateUsage = 0; // state flag defaults for blocks without a qualifier.
FActorInfo() {}
FActorInfo(const FActorInfo & other)
{
LightAssociations = other.LightAssociations;
// only copy the fields that get inherited
DefaultStateUsage = other.DefaultStateUsage;
DamageFactors = other.DamageFactors;
PainChances = other.PainChances;
VisibleToPlayerClass = other.VisibleToPlayerClass;
DropItems = other.DropItems;
distancecheck = other.distancecheck;
DisplayName = other.DisplayName;
}
~FActorInfo()
{
if (StateList != NULL)
{
StateList->Destroy();
M_Free(StateList);
}
}
};
@ -277,13 +305,37 @@ public:
void SetDamageFactor(FName type, double factor);
void SetPainChance(FName type, int chance);
bool SetReplacement(FName replaceName);
void SetDropItems(FDropItem *drops);
FActorInfo *ActorInfo() const
{
return (FActorInfo*)Meta;
}
void SetDropItems(FDropItem *drops)
{
ActorInfo()->DropItems = drops;
}
const FString &GetDisplayName() const
{
return ActorInfo()->DisplayName;
}
FState *GetStates() const
{
return ActorInfo()->OwnedStates;
}
unsigned GetStateCount() const
{
return ActorInfo()->NumOwnedStates;
}
FStateLabels *GetStateLabels() const
{
return ActorInfo()->StateList;
}
FState *FindState(int numnames, FName *names, bool exact=false) const;
FState *FindStateByString(const char *name, bool exact=false);
FState *FindState(FName name) const
@ -300,19 +352,6 @@ public:
PClassActor *GetReplacement(bool lookskill=true);
PClassActor *GetReplacee(bool lookskill=true);
FStateLabels *StateList;
DmgFactors DamageFactors;
PainChanceList PainChances;
TArray<PClassActor *> VisibleToPlayerClass;
FDropItem *DropItems;
FString SourceLumpName;
FIntCVar *distancecheck;
// This is from PClassPlayerPawn
FString DisplayName;
// For those times when being able to scan every kind of actor is convenient
static TArray<PClassActor *> AllActorClasses;
};

View file

@ -1500,7 +1500,7 @@ fakepain: //Needed so we can skip the rest of the above, but still obey the orig
(target->player != NULL || !G_SkillProperty(SKILLP_NoPain)) && !(target->flags & MF_SKULLFLY))
{
painchance = target->PainChance;
for (auto & pc : target->GetClass()->PainChances)
for (auto & pc : target->GetInfo()->PainChances)
{
if (pc.first == mod)
{

View file

@ -1607,20 +1607,16 @@ bool AActor::IsVisibleToPlayer() const
const player_t* pPlayer = players[consoleplayer].camera->player;
if (pPlayer && pPlayer->mo && GetClass()->VisibleToPlayerClass.Size() > 0)
if (pPlayer)
{
bool visible = false;
for(unsigned int i = 0;i < GetClass()->VisibleToPlayerClass.Size();++i)
for(auto cls : GetInfo()->VisibleToPlayerClass)
{
auto cls = GetClass()->VisibleToPlayerClass[i];
if (cls && pPlayer->mo->GetClass()->IsDescendantOf(cls))
{
visible = true;
break;
return true;
}
}
if (!visible)
return false;
return false;
}
// [BB] Passed all checks.
@ -7685,7 +7681,7 @@ DEFINE_ACTION_FUNCTION(AActor, GetCameraHeight)
FDropItem *AActor::GetDropItems() const
{
return GetClass()->DropItems;
return GetInfo()->DropItems;
}
DEFINE_ACTION_FUNCTION(AActor, GetDropItems)
@ -7822,7 +7818,7 @@ int AActor::ApplyDamageFactor(FName damagetype, int damage) const
damage = int(damage * DamageFactor);
if (damage > 0)
{
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, damagetype, &GetClass()->DamageFactors);
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, damagetype, &GetInfo()->DamageFactors);
}
return damage;
}
@ -8273,7 +8269,7 @@ DEFINE_ACTION_FUNCTION(AActor, ApplyDamageFactors)
PARAM_INT(damage);
PARAM_INT(defdamage);
DmgFactors &df = itemcls->DamageFactors;
DmgFactors &df = itemcls->ActorInfo()->DamageFactors;
if (df.Size() != 0)
{
ACTION_RETURN_INT(df.Apply(damagetype, damage));

View file

@ -852,7 +852,7 @@ void CopyPlayer(player_t *dst, player_t *src, const char *name)
{
dst->userinfo.TransferFrom(uibackup);
// The player class must come from the save, so that the menu reflects the currently playing one.
dst->userinfo.PlayerClassChanged(src->mo->GetClass()->DisplayName);
dst->userinfo.PlayerClassChanged(src->mo->GetInfo()->DisplayName);
}
// Validate the skin

View file

@ -133,7 +133,7 @@ PClassActor *FState::StaticFindStateOwner (const FState *state, PClassActor *inf
FString FState::StaticGetStateName(const FState *state)
{
auto so = FState::StaticFindStateOwner(state);
return FStringf("%s.%d", so->TypeName.GetChars(), int(state - so->ActorInfo()->OwnedStates));
return FStringf("%s.%d", so->TypeName.GetChars(), int(state - so->GetStates()));
}
//==========================================================================
@ -172,9 +172,9 @@ bool AActor::HasSpecialDeathStates () const
{
const PClassActor *info = static_cast<PClassActor *>(GetClass());
if (info->StateList != NULL)
if (info->GetStateLabels() != NULL)
{
FStateLabel *slabel = info->StateList->FindLabel (NAME_Death);
FStateLabel *slabel = info->GetStateLabels()->FindLabel (NAME_Death);
if (slabel != NULL && slabel->Children != NULL)
{
for(int i = 0; i < slabel->Children->NumLabels; i++)
@ -257,7 +257,7 @@ TArray<FName> &MakeStateNameList(const char * fname)
//===========================================================================
FState *PClassActor::FindState(int numnames, FName *names, bool exact) const
{
FStateLabels *labels = StateList;
FStateLabels *labels = GetStateLabels();
FState *best = NULL;
if (labels != NULL)
@ -581,12 +581,13 @@ void FStateDefinitions::InstallStates(PClassActor *info, AActor *defaults)
SetStateLabel("Spawn", GetDefault<AActor>()->SpawnState);
}
if (info->StateList != NULL)
auto &sl = info->ActorInfo()->StateList;
if (sl != NULL)
{
info->StateList->Destroy();
M_Free(info->StateList);
sl->Destroy();
M_Free(sl);
}
info->StateList = CreateStateLabelList(StateLabels);
sl = CreateStateLabelList(StateLabels);
// Cache these states as member veriables.
defaults->SpawnState = info->FindState(NAME_Spawn);
@ -631,9 +632,9 @@ void FStateDefinitions::MakeStateDefines(const PClassActor *cls)
laststatebeforelabel = NULL;
lastlabel = -1;
if (cls != NULL && cls->StateList != NULL)
if (cls != NULL && cls->GetStateLabels() != NULL)
{
MakeStateList(cls->StateList, StateLabels);
MakeStateList(cls->GetStateLabels(), StateLabels);
}
else
{
@ -816,7 +817,7 @@ void FStateDefinitions::FixStatePointers (PClassActor *actor, TArray<FStateDefin
if (list[i].DefineFlags == SDF_INDEX)
{
size_t v = (size_t)list[i].State;
list[i].State = actor->ActorInfo()->OwnedStates + v - 1;
list[i].State = actor->GetStates() + v - 1;
list[i].DefineFlags = SDF_STATE;
}
if (list[i].Children.Size() > 0)
@ -1095,7 +1096,7 @@ CCMD(dumpstates)
{
PClassActor *info = PClassActor::AllActorClasses[i];
Printf(PRINT_LOG, "State labels for %s\n", info->TypeName.GetChars());
DumpStateHelper(info->StateList, "");
DumpStateHelper(info->GetStateLabels(), "");
Printf(PRINT_LOG, "----------------------------\n");
}
}

View file

@ -170,14 +170,14 @@ FString GetPrintableDisplayName(PClassActor *cls)
{
// Fixme; This needs a decent way to access the string table without creating a mess.
// [RH] ????
return cls->DisplayName;
return cls->GetDisplayName();
}
DEFINE_ACTION_FUNCTION(APlayerPawn, GetPrintableDisplayName)
{
PARAM_PROLOGUE;
PARAM_CLASS(type, AActor);
ACTION_RETURN_STRING(type->DisplayName);
ACTION_RETURN_STRING(type->GetDisplayName());
}
bool ValidatePlayerClass(PClassActor *ti, const char *name)
@ -192,7 +192,7 @@ bool ValidatePlayerClass(PClassActor *ti, const char *name)
Printf("Invalid player class '%s'\n", name);
return false;
}
else if (ti->DisplayName.IsEmpty())
else if (ti->GetDisplayName().IsEmpty())
{
Printf ("Missing displayname for player class '%s'\n", name);
return false;
@ -267,7 +267,7 @@ CCMD (playerclasses)
{
Printf ("%3d: Class = %s, Name = %s\n", i,
PlayerClasses[i].Type->TypeName.GetChars(),
PlayerClasses[i].Type->DisplayName.GetChars());
PlayerClasses[i].Type->GetDisplayName().GetChars());
}
}

View file

@ -154,7 +154,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const PolyClipPlane
bool RenderPolySprite::IsThingCulled(AActor *thing)
{
FIntCVar *cvar = thing->GetClass()->distancecheck;
FIntCVar *cvar = thing->GetInfo()->distancecheck;
if (cvar != nullptr && *cvar >= 0)
{
double dist = (thing->Pos() - PolyRenderer::Instance()->Viewpoint.Pos).LengthSquared();

View file

@ -10838,16 +10838,16 @@ FxExpression *FxStateByIndex::Resolve(FCompileContext &ctx)
auto aclass = dyn_cast<PClassActor>(ctx.Class);
// This expression type can only be used from actors, for everything else it has already produced a compile error.
assert(aclass != nullptr && aclass->ActorInfo()->NumOwnedStates > 0);
assert(aclass != nullptr && aclass->GetStateCount() > 0);
if (aclass->ActorInfo()->NumOwnedStates <= index)
if (aclass->GetStateCount() <= index)
{
ScriptPosition.Message(MSG_ERROR, "%s: Attempt to jump to non existing state index %d",
ctx.Class->TypeName.GetChars(), index);
delete this;
return nullptr;
}
int symlabel = StateLabels.AddPointer(aclass->ActorInfo()->OwnedStates + index);
int symlabel = StateLabels.AddPointer(aclass->GetStates() + index);
FxExpression *x = new FxConstant(symlabel, ScriptPosition);
x->ValueType = TypeStateLabel;
delete this;
@ -10912,8 +10912,8 @@ FxExpression *FxRuntimeStateIndex::Resolve(FCompileContext &ctx)
SAFE_RESOLVE(Index, ctx);
}
auto aclass = dyn_cast<PClassActor>(ctx.Class);
assert(aclass != nullptr && aclass->ActorInfo()->NumOwnedStates > 0);
symlabel = StateLabels.AddPointer(aclass->ActorInfo()->OwnedStates + ctx.StateIndex);
assert(aclass != nullptr && aclass->GetStateCount() > 0);
symlabel = StateLabels.AddPointer(aclass->GetStates() + ctx.StateIndex);
ValueType = TypeStateLabel;
return this;
}

View file

@ -2004,7 +2004,7 @@ public:
class FxStateByIndex : public FxExpression
{
int index;
unsigned index;
public:

View file

@ -156,7 +156,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def, PNamespace *ns)
}
FState *states;
states = type->ActorInfo()->OwnedStates = (FState*)ClassDataAllocator.Alloc(StateArray.Size() * sizeof(FState));
states = (FState*)ClassDataAllocator.Alloc(StateArray.Size() * sizeof(FState));
SaveStateSourceLines(states, SourceLines);
memcpy (states, &StateArray[0], StateArray.Size() * sizeof(states[0]));
if (StateArray.Size() == 1)
@ -306,6 +306,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def, PNamespace *ns)
}
bag.statedef.SetStateLabel("Spawn", &states[extra.SpawnStart]);
bag.statedef.InstallStates (type, ((AActor *)(type->Defaults)));
bag.Info->ActorInfo()->OwnedStates = states;
bag.Info->ActorInfo()->NumOwnedStates = StateArray.Size();
}

View file

@ -1109,7 +1109,7 @@ static PClassActor *ParseActorHeader(FScanner &sc, Baggage *bag)
{
PClassActor *info = CreateNewActor(sc, typeName, parentName);
info->ActorInfo()->DoomEdNum = DoomEdNum > 0 ? DoomEdNum : -1;
info->SourceLumpName = Wads.GetLumpFullPath(sc.LumpNum);
info->ActorInfo()->SourceLumpName = Wads.GetLumpFullPath(sc.LumpNum);
if (!info->SetReplacement(replaceName))
{

View file

@ -323,7 +323,7 @@ static void CheckLabel(PClassActor *obj, FStateLabel *slb, int useflag, FName st
static void CheckStateLabels(PClassActor *obj, ENamedName *test, int useflag, const char *descript)
{
FStateLabels *labels = obj->StateList;
FStateLabels *labels = obj->GetStateLabels();
for (; *test != NAME_None; test++)
{
@ -353,9 +353,9 @@ static void CheckStates(PClassActor *obj)
{
CheckStateLabels(obj, pickupstates, SUF_ITEM, "CustomInventory state chain");
}
for (int i = 0; i < obj->ActorInfo()->NumOwnedStates; i++)
for (unsigned i = 0; i < obj->GetStateCount(); i++)
{
auto state = obj->ActorInfo()->OwnedStates + i;
auto state = obj->GetStates() + i;
if (state->NextState && (state->UseFlags & state->NextState->UseFlags) != state->UseFlags)
{
GetStateSource(state).Message(MSG_ERROR, TEXTCOLOR_RED "State %s links to a state with incompatible restrictions.\n",

View file

@ -391,7 +391,7 @@ bool CheckDeprecatedFlags(const AActor *actor, PClassActor *info, int index)
case DEPF_QUARTERGRAVITY:
return actor->Gravity == 1./4;
case DEPF_FIRERESIST:
for (auto &df : info->DamageFactors)
for (auto &df : info->ActorInfo()->DamageFactors)
{
if (df.first == NAME_Fire) return df.second == 0.5;
}
@ -1048,12 +1048,12 @@ DEFINE_PROPERTY(visibletoteam, I, Actor)
//==========================================================================
DEFINE_PROPERTY(visibletoplayerclass, Ssssssssssssssssssss, Actor)
{
info->VisibleToPlayerClass.Clear();
info->ActorInfo()->VisibleToPlayerClass.Clear();
for(int i = 0;i < PROP_PARM_COUNT;++i)
{
PROP_STRING_PARM(n, i);
if (*n != 0)
info->VisibleToPlayerClass.Push(FindClassTentative(n, RUNTIME_CLASS(APlayerPawn)));
info->ActorInfo()->VisibleToPlayerClass.Push(FindClassTentative(n, RUNTIME_CLASS(APlayerPawn)));
}
}
@ -1071,7 +1071,7 @@ DEFINE_PROPERTY(distancecheck, S, Actor)
}
else if (cv->GetRealType() == CVAR_Int)
{
static_cast<PClassActor*>(info)->distancecheck = static_cast<FIntCVar *>(cv);
static_cast<PClassActor*>(info)->ActorInfo()->distancecheck = static_cast<FIntCVar *>(cv);
}
else
{
@ -1367,7 +1367,7 @@ DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
DEFINE_CLASS_PROPERTY_PREFIX(player, displayname, S, PlayerPawn)
{
PROP_STRING_PARM(str, 0);
info->DisplayName = str;
info->ActorInfo()->DisplayName = str;
}
//==========================================================================

View file

@ -626,7 +626,7 @@ void ZCCCompiler::CreateClassTypes()
}
c->cls->Type = me;
auto ac = dyn_cast<PClassActor>(me);
if (ac != nullptr) ac->SourceLumpName = *c->cls->SourceName;
if (ac != nullptr) ac->ActorInfo()->SourceLumpName = *c->cls->SourceName;
}
else
{

View file

@ -1877,7 +1877,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState
{
arc.w->StartArray();
arc.w->String(info->TypeName.GetChars());
arc.w->Uint((uint32_t)(state - info->ActorInfo()->OwnedStates));
arc.w->Uint((uint32_t)(state - info->GetStates()));
arc.w->EndArray();
}
else
@ -1908,9 +1908,9 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState
if (cls.IsString() && ndx.IsUint())
{
PClassActor *clas = PClass::FindActor(UnicodeToString(cls.GetString()));
if (clas && ndx.GetUint() < (unsigned)clas->ActorInfo()->NumOwnedStates)
if (clas && ndx.GetUint() < (unsigned)clas->GetStateCount())
{
state = clas->ActorInfo()->OwnedStates + ndx.GetUint();
state = clas->GetStates() + ndx.GetUint();
}
else
{

View file

@ -132,9 +132,9 @@ void FSoftwareRenderer::Precache(uint8_t *texhitlist, TMap<PClassActor*, bool> &
{
PClassActor *cls = pair->Key;
for (int i = 0; i < cls->ActorInfo()->NumOwnedStates; i++)
for (unsigned i = 0; i < cls->GetStateCount(); i++)
{
spritelist[cls->ActorInfo()->OwnedStates[i].sprite] = true;
spritelist[cls->GetStates()[i].sprite] = true;
}
}

View file

@ -844,7 +844,7 @@ namespace swrenderer
//if (thing->validcount == validcount) continue;
//thing->validcount = validcount;
FIntCVar *cvar = thing->GetClass()->distancecheck;
FIntCVar *cvar = thing->GetInfo()->distancecheck;
if (cvar != nullptr && *cvar >= 0)
{
double dist = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared();