diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index da68bafe4..0a360648b 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -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); diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 70413496c..74258e3ae 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -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 diff --git a/src/dobject.cpp b/src/dobject.cpp index 85e5697f6..f581091bd 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -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) { diff --git a/src/g_skill.cpp b/src/g_skill.cpp index 04ac2f290..befd1115b 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -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) { diff --git a/src/g_statusbar/sbarinfo_commands.cpp b/src/g_statusbar/sbarinfo_commands.cpp index 458208b96..cffe67b11 100644 --- a/src/g_statusbar/sbarinfo_commands.cpp +++ b/src/g_statusbar/sbarinfo_commands.cpp @@ -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); diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 804311bc6..5222e46f3 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -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(); diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index a7260879b..978dd1696 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -841,9 +841,9 @@ void gl_PrecacheTexture(uint8_t *texhitlist, TMap &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) diff --git a/src/info.cpp b/src/info.cpp index 203a60d7a..ead6fa2d0 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -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(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) }); } } diff --git a/src/info.h b/src/info.h index 406cc845b..dc1c26fa4 100644 --- a/src/info.h +++ b/src/info.h @@ -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 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 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 AllActorClasses; }; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 9368a504a..b6bf36a08 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -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) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 83233a1f0..70c714650 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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)); diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index f191afe5d..b20e9af09 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -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 diff --git a/src/p_states.cpp b/src/p_states.cpp index b6593613a..8d10cc7a9 100644 --- a/src/p_states.cpp +++ b/src/p_states.cpp @@ -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(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 &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()->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, TArrayActorInfo()->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"); } } diff --git a/src/p_user.cpp b/src/p_user.cpp index 932c5fd72..2a4f000e8 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -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()); } } diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index ae7295f1e..2ddf46df3 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -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(); diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 6b38999d3..7f2db4d77 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -10838,16 +10838,16 @@ FxExpression *FxStateByIndex::Resolve(FCompileContext &ctx) auto aclass = dyn_cast(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(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; } diff --git a/src/scripting/backend/codegen.h b/src/scripting/backend/codegen.h index f90a03a53..0a6b6cc44 100644 --- a/src/scripting/backend/codegen.h +++ b/src/scripting/backend/codegen.h @@ -2004,7 +2004,7 @@ public: class FxStateByIndex : public FxExpression { - int index; + unsigned index; public: diff --git a/src/scripting/decorate/olddecorations.cpp b/src/scripting/decorate/olddecorations.cpp index 1984f3a97..7dc12d017 100644 --- a/src/scripting/decorate/olddecorations.cpp +++ b/src/scripting/decorate/olddecorations.cpp @@ -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(); } diff --git a/src/scripting/decorate/thingdef_parse.cpp b/src/scripting/decorate/thingdef_parse.cpp index 8950a7067..d13c869d1 100644 --- a/src/scripting/decorate/thingdef_parse.cpp +++ b/src/scripting/decorate/thingdef_parse.cpp @@ -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)) { diff --git a/src/scripting/thingdef.cpp b/src/scripting/thingdef.cpp index 0b7e35aba..0fbac19b9 100644 --- a/src/scripting/thingdef.cpp +++ b/src/scripting/thingdef.cpp @@ -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", diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index aededa99f..fcfcb9b6b 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -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(info)->distancecheck = static_cast(cv); + static_cast(info)->ActorInfo()->distancecheck = static_cast(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; } //========================================================================== diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index e3e72b03c..94c54dc43 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -626,7 +626,7 @@ void ZCCCompiler::CreateClassTypes() } c->cls->Type = me; auto ac = dyn_cast(me); - if (ac != nullptr) ac->SourceLumpName = *c->cls->SourceName; + if (ac != nullptr) ac->ActorInfo()->SourceLumpName = *c->cls->SourceName; } else { diff --git a/src/serializer.cpp b/src/serializer.cpp index d5b3e286b..c41fec1f3 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -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 { diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index 11f4d801b..9f6da2a14 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -132,9 +132,9 @@ void FSoftwareRenderer::Precache(uint8_t *texhitlist, TMap & { 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; } } diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 23876235f..12bb95513 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -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();