From 9521b6cd1fa13b00ab4069816d2e38cade785131 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Jan 2019 22:05:49 +0100 Subject: [PATCH] - removed all remaining native parts of APlayerPawn. Unlike the other classes, the places where variables from this class were accessed were quite scattered so there isn't much scriptified code. Instead, most of these places are now using the script variable access methods. This was the last remaining subclass of AActor, meaning that class Actor can now be opened for user-side extensions. --- src/actor.h | 7 +-- src/b_think.cpp | 2 +- src/c_dispatch.cpp | 8 +-- src/c_dispatch.h | 20 +++---- src/d_dehacked.cpp | 2 +- src/d_net.cpp | 4 +- src/d_player.h | 7 +-- src/dobject.cpp | 2 +- src/fragglescript/t_func.cpp | 2 +- src/g_game.cpp | 12 ++-- src/g_inventory/a_weapons.cpp | 4 +- src/g_inventory/a_weapons.h | 3 +- src/g_level.cpp | 14 ++--- src/g_shared/a_action.cpp | 2 +- src/g_shared/a_dynlight.cpp | 2 +- src/g_statusbar/sbar_mugshot.cpp | 2 +- src/intermission/intermission.cpp | 8 +-- src/m_cheat.cpp | 14 ++--- src/p_acs.cpp | 14 ++--- src/p_interaction.cpp | 4 +- src/p_local.h | 3 +- src/p_mobj.cpp | 19 +++---- src/p_pspr.cpp | 6 +- src/p_teleport.cpp | 4 +- src/p_user.cpp | 42 +++++++------- src/r_data/r_translate.cpp | 2 +- src/r_data/sprites.cpp | 2 +- src/s_advsound.cpp | 2 +- src/scripting/thingdef.h | 7 +-- src/scripting/thingdef_data.cpp | 4 +- src/scripting/thingdef_properties.cpp | 56 +++++++++---------- src/scripting/vmthunks.cpp | 2 +- src/scripting/vmthunks_actors.cpp | 4 +- src/v_blend.cpp | 2 +- wadsrc/static/zscript/shared/player.txt | 26 ++++----- .../zscript/shared/player_inventory.txt | 8 +-- 36 files changed, 154 insertions(+), 168 deletions(-) diff --git a/src/actor.h b/src/actor.h index 904544a0a..a89f0a744 100644 --- a/src/actor.h +++ b/src/actor.h @@ -742,11 +742,6 @@ public: bool CallOkayToSwitchTarget(AActor *other); bool OkayToSwitchTarget (AActor *other); - // Note: Although some of the inventory functions are virtual, this - // is not exposed to scripts, as the only class overriding them is - // APlayerPawn for some specific handling for players. None of this - // should ever be overridden by custom classes. - // Uses an item and removes it from the inventory. bool UseInventory (AActor *item); @@ -1108,7 +1103,7 @@ public: int32_t threshold; // if > 0, the target will be chased int32_t DefThreshold; // [MC] Default threshold which the actor will reset its threshold to after switching targets // no matter what (even if shot) - player_t *player; // only valid if type of APlayerPawn + player_t *player; // only valid if type of PlayerPawn TObjPtr LastLookActor; // Actor last looked for (if TIDtoHate != 0) DVector3 SpawnPoint; // For nightmare respawn uint16_t SpawnAngle; diff --git a/src/b_think.cpp b/src/b_think.cpp index 574c86d87..74aa3a6ac 100644 --- a/src/b_think.cpp +++ b/src/b_think.cpp @@ -342,7 +342,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) old = player->mo->Pos(); } -int P_GetRealMaxHealth(APlayerPawn *actor, int max); +int P_GetRealMaxHealth(AActor *actor, int max); //BOT_WhatToGet // diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index cbca6acb8..b046f4467 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -1039,12 +1039,12 @@ FConsoleCommand::~FConsoleCommand () delete[] m_Name; } -void FConsoleCommand::Run (FCommandLine &argv, APlayerPawn *who, int key) +void FConsoleCommand::Run (FCommandLine &argv, AActor *who, int key) { m_RunFunc (argv, who, key); } -void FUnsafeConsoleCommand::Run (FCommandLine &args, APlayerPawn *instigator, int key) +void FUnsafeConsoleCommand::Run (FCommandLine &args, AActor *instigator, int key) { if (UnsafeExecutionContext) { @@ -1455,7 +1455,7 @@ bool FConsoleAlias::IsAlias () return true; } -void FConsoleAlias::Run (FCommandLine &args, APlayerPawn *who, int key) +void FConsoleAlias::Run (FCommandLine &args, AActor *who, int key) { if (bRunning) { @@ -1519,7 +1519,7 @@ void FConsoleAlias::SafeDelete () } } -void FUnsafeConsoleAlias::Run (FCommandLine &args, APlayerPawn *instigator, int key) +void FUnsafeConsoleAlias::Run (FCommandLine &args, AActor *instigator, int key) { UnsafeExecutionScope scope; FConsoleAlias::Run(args, instigator, key); diff --git a/src/c_dispatch.h b/src/c_dispatch.h index aa82e20ba..101bd8c63 100644 --- a/src/c_dispatch.h +++ b/src/c_dispatch.h @@ -37,7 +37,6 @@ #include "doomtype.h" class FConfigFile; -class APlayerPawn; // Class that can parse command lines class FCommandLine @@ -96,7 +95,8 @@ void C_ClearAliases (); // build a single string out of multiple strings FString BuildString (int argc, FString *argv); -typedef void (*CCmdRun) (FCommandLine &argv, APlayerPawn *instigator, int key); +class AActor; +typedef void (*CCmdRun) (FCommandLine &argv, AActor *instigator, int key); class FConsoleCommand { @@ -106,7 +106,7 @@ public: virtual bool IsAlias (); void PrintCommand () { Printf ("%s\n", m_Name); } - virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key); + virtual void Run (FCommandLine &args, AActor *instigator, int key); static FConsoleCommand* FindByName (const char* name); FConsoleCommand *m_Next, **m_Prev; @@ -123,9 +123,9 @@ protected: }; #define CCMD(n) \ - void Cmd_##n (FCommandLine &, APlayerPawn *, int key); \ + void Cmd_##n (FCommandLine &, AActor *, int key); \ FConsoleCommand Cmd_##n##_Ref (#n, Cmd_##n); \ - void Cmd_##n (FCommandLine &argv, APlayerPawn *who, int key) + void Cmd_##n (FCommandLine &argv, AActor *who, int key) class FUnsafeConsoleCommand : public FConsoleCommand { @@ -135,13 +135,13 @@ public: { } - virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key) override; + virtual void Run (FCommandLine &args, AActor *instigator, int key) override; }; #define UNSAFE_CCMD(n) \ - static void Cmd_##n (FCommandLine &, APlayerPawn *, int key); \ + static void Cmd_##n (FCommandLine &, AActor *, int key); \ static FUnsafeConsoleCommand Cmd_##n##_Ref (#n, Cmd_##n); \ - void Cmd_##n (FCommandLine &argv, APlayerPawn *who, int key) + void Cmd_##n (FCommandLine &argv, AActor *who, int key) const int KEY_DBLCLICKED = 0x8000; @@ -150,7 +150,7 @@ class FConsoleAlias : public FConsoleCommand public: FConsoleAlias (const char *name, const char *command, bool noSave); ~FConsoleAlias (); - void Run (FCommandLine &args, APlayerPawn *Instigator, int key); + void Run (FCommandLine &args, AActor *instigator, int key); bool IsAlias (); void PrintAlias (); void Archive (FConfigFile *f); @@ -171,7 +171,7 @@ public: { } - virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key) override; + virtual void Run (FCommandLine &args, AActor *instigator, int key) override; }; // Actions diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 0cc6e6e4c..ca72aaddd 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1989,7 +1989,7 @@ static int PatchMisc (int dummy) health->IntVar(NAME_Amount) = health->IntVar(NAME_MaxAmount) = deh.MegasphereHealth; } - APlayerPawn *player = static_cast (GetDefaultByName ("DoomPlayer")); + AActor *player = GetDefaultByName ("DoomPlayer"); if (player != NULL) { player->health = deh.StartHealth; diff --git a/src/d_net.cpp b/src/d_net.cpp index 3f911ed64..2fc7c81c3 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -127,7 +127,7 @@ void G_BuildTiccmd (ticcmd_t *cmd); void D_DoAdvanceDemo (void); static void SendSetup (uint32_t playersdetected[MAXNETNODES], uint8_t gotsetup[MAXNETNODES], int len); -static void RunScript(uint8_t **stream, APlayerPawn *pawn, int snum, int argn, int always); +static void RunScript(uint8_t **stream, AActor *pawn, int snum, int argn, int always); int reboundpacket; uint8_t reboundstore[MAX_MSGLEN]; @@ -2688,7 +2688,7 @@ void Net_DoCommand (int type, uint8_t **stream, int player) } // Used by DEM_RUNSCRIPT, DEM_RUNSCRIPT2, and DEM_RUNNAMEDSCRIPT -static void RunScript(uint8_t **stream, APlayerPawn *pawn, int snum, int argn, int always) +static void RunScript(uint8_t **stream, AActor *pawn, int snum, int argn, int always) { int arg[4] = { 0, 0, 0, 0 }; int i; diff --git a/src/d_player.h b/src/d_player.h index 0132800dc..f89d66550 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -79,11 +79,6 @@ extern ColorSetList ColorSets; FString GetPrintableDisplayName(PClassActor *cls); -class APlayerPawn : public AActor -{ - DECLARE_CLASS(APlayerPawn, AActor) -}; - void PlayIdle(AActor *player); @@ -296,7 +291,7 @@ public: void SetLogText (const char *text); void SendPitchLimits() const; - APlayerPawn *mo = nullptr; + AActor *mo = nullptr; uint8_t playerstate = 0; ticcmd_t cmd = {}; usercmd_t original_cmd; diff --git a/src/dobject.cpp b/src/dobject.cpp index 783272096..9e2e01a3a 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -503,7 +503,7 @@ void DObject::StaticPointerSubstitution (AActor *old, AActor *notOld) { if (playeringame[i]) { - APlayerPawn *replacement = static_cast(notOld); + AActor *replacement = notOld; auto &p = players[i]; if (p.mo == old) p.mo = replacement, changed++; diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 487335835..79117972e 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -285,7 +285,7 @@ static int T_GetPlayerNum(const svalue_t &arg) return playernum; } -APlayerPawn *T_GetPlayerActor(const svalue_t &arg) +AActor *T_GetPlayerActor(const svalue_t &arg) { int num = T_GetPlayerNum(arg); return num == -1 ? nullptr : players[num].mo; diff --git a/src/g_game.cpp b/src/g_game.cpp index 4edec607c..a25ae1959 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -285,7 +285,7 @@ CCMD (slot) if (slot < NUM_WEAPON_SLOTS && mo) { // Needs to be redone - IFVIRTUALPTR(mo, APlayerPawn, PickWeapon) + IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickWeapon) { VMValue param[] = { mo, slot, !(dmflags2 & DF2_DONTCHECKAMMO) }; VMReturn ret((void**)&SendItemUse); @@ -326,7 +326,7 @@ CCMD (weapnext) if (mo) { // Needs to be redone - IFVIRTUALPTR(mo, APlayerPawn, PickNextWeapon) + IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickNextWeapon) { VMValue param[] = { mo }; VMReturn ret((void**)&SendItemUse); @@ -352,7 +352,7 @@ CCMD (weapprev) if (mo) { // Needs to be redone - IFVIRTUALPTR(mo, APlayerPawn, PickPrevWeapon) + IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickPrevWeapon) { VMValue param[] = { mo }; VMReturn ret((void**)&SendItemUse); @@ -470,7 +470,7 @@ CCMD (drop) CCMD (useflechette) { if (who == nullptr) return; - IFVIRTUALPTR(who, APlayerPawn, GetFlechetteItem) + IFVIRTUALPTRNAME(who, NAME_PlayerPawn, GetFlechetteItem) { VMValue params[] = { who }; AActor *cls; @@ -1243,7 +1243,7 @@ void G_PlayerReborn (int player) int chasecam; uint8_t currclass; userinfo_t userinfo; // [RH] Save userinfo - APlayerPawn *actor; + AActor *actor; PClassActor *cls; FString log; DBot *Bot; //Added by MC: @@ -1291,7 +1291,7 @@ void G_PlayerReborn (int player) { // [GRB] Give inventory specified in DECORATE - IFVIRTUALPTR(actor, APlayerPawn, GiveDefaultInventory) + IFVIRTUALPTRNAME(actor, NAME_PlayerPawn, GiveDefaultInventory) { VMValue params[1] = { actor }; VMCall(func, params, 1, nullptr, 0); diff --git a/src/g_inventory/a_weapons.cpp b/src/g_inventory/a_weapons.cpp index 5d87b4c37..8bb2aace3 100644 --- a/src/g_inventory/a_weapons.cpp +++ b/src/g_inventory/a_weapons.cpp @@ -756,7 +756,7 @@ void P_PlaybackKeyConfWeapons(FWeaponSlots *slots) //=========================================================================== // -// APlayerPawn :: SetupWeaponSlots +// SetupWeaponSlots // // Sets up the default weapon slots for this player. If this is also the // local player, determines local modifications and sends those across the @@ -764,7 +764,7 @@ void P_PlaybackKeyConfWeapons(FWeaponSlots *slots) // //=========================================================================== -void FWeaponSlots::SetupWeaponSlots(APlayerPawn *pp) +void FWeaponSlots::SetupWeaponSlots(AActor *pp) { auto player = pp->player; if (player != nullptr && player->mo == pp) diff --git a/src/g_inventory/a_weapons.h b/src/g_inventory/a_weapons.h index ac2c9f14d..82cfd2999 100644 --- a/src/g_inventory/a_weapons.h +++ b/src/g_inventory/a_weapons.h @@ -2,7 +2,6 @@ #include "a_pickups.h" class PClassActor; -class APlayerPawn; class FWeaponSlot { @@ -69,7 +68,7 @@ public: void SendDifferences(int playernum, const FWeaponSlots &other); int RestoreSlots (FConfigFile *config, const char *section); void PrintSettings(); - static void SetupWeaponSlots(APlayerPawn *pp); + static void SetupWeaponSlots(AActor *pp); void AddSlot(int slot, PClassActor *type, bool feedback); void AddSlotDefault(int slot, PClassActor *type, bool feedback); diff --git a/src/g_level.cpp b/src/g_level.cpp index d5bafd79e..5239177bf 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -341,8 +341,8 @@ void G_NewInit () int i; // Destory all old player refrences that may still exist - TThinkerIterator it(STAT_TRAVELLING); - APlayerPawn *pawn, *next; + TThinkerIterator it(NAME_PlayerPawn, STAT_TRAVELLING); + AActor *pawn, *next; next = it.Next(); while ((pawn = next) != NULL) @@ -1325,15 +1325,15 @@ void G_StartTravel () int G_FinishTravel () { - TThinkerIterator it (STAT_TRAVELLING); - APlayerPawn *pawn, *pawndup, *oldpawn, *next; + TThinkerIterator it (NAME_PlayerPawn, STAT_TRAVELLING); + AActor *pawn, *pawndup, *oldpawn, *next; AActor *inv; FPlayerStart *start; int pnum; int failnum = 0; // - APlayerPawn* pawns[MAXPLAYERS]; + AActor* pawns[MAXPLAYERS]; int pawnsnum = 0; next = it.Next (); @@ -1684,8 +1684,8 @@ void G_UnSnapshotLevel (bool hubLoad) G_SerializeLevel (arc, hubLoad); level.FromSnapshot = true; - TThinkerIterator it; - APlayerPawn *pawn, *next; + TThinkerIterator it(NAME_PlayerPawn); + AActor *pawn, *next; next = it.Next(); while ((pawn = next) != 0) diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 39a924135..a8fc47fe0 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -60,7 +60,7 @@ void A_Unblock(AActor *self, bool drop) self->Conversation = NULL; // If the actor has attached metadata for items to drop, drop those. - if (drop && !self->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB] + if (drop && !self->IsKindOf(NAME_PlayerPawn)) // [GRB] { auto di = self->GetDropItems(); diff --git a/src/g_shared/a_dynlight.cpp b/src/g_shared/a_dynlight.cpp index 4b3845fdc..09b1a233d 100644 --- a/src/g_shared/a_dynlight.cpp +++ b/src/g_shared/a_dynlight.cpp @@ -80,7 +80,7 @@ CVAR (Bool, gl_attachedlights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(type, S, DynamicLight) +DEFINE_CLASS_PROPERTY(type, S, DynamicLight) { PROP_STRING_PARM(str, 0); static const char * ltype_names[]={ diff --git a/src/g_statusbar/sbar_mugshot.cpp b/src/g_statusbar/sbar_mugshot.cpp index 69d367bda..0da401a0f 100644 --- a/src/g_statusbar/sbar_mugshot.cpp +++ b/src/g_statusbar/sbar_mugshot.cpp @@ -477,7 +477,7 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu if (CurrentState != NULL) { int skin = player->userinfo.GetSkin(); - const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? ((APlayerPawn*)GetDefaultByType(player->MorphedPlayerClass))->NameVar(NAME_Face).GetChars() : Skins[skin].Face.GetChars()); + const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? (GetDefaultByType(player->MorphedPlayerClass))->NameVar(NAME_Face).GetChars() : Skins[skin].Face.GetChars()); return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle); } return NULL; diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 4b3826261..b93e4872c 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -376,7 +376,7 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first) mCastSounds[i].mSound = static_cast(desc)->mCastSounds[i].mSound; } caststate = mDefaults->SeeState; - if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn))) + if (mClass->IsDescendantOf(NAME_PlayerPawn)) { advplayerstate = mDefaults->MissileState; casttranslation = TRANSLATION(TRANSLATION_Players, consoleplayer); @@ -419,7 +419,7 @@ int DIntermissionScreenCast::Responder (event_t *ev) castframes = 0; castattacking = false; - if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn))) + if (mClass->IsDescendantOf(NAME_PlayerPawn)) { int snd = S_FindSkinnedSound(players[consoleplayer].mo, "*death"); if (snd != 0) S_Sound (CHAN_VOICE | CHAN_UI, snd, 1, ATTN_NONE); @@ -479,7 +479,7 @@ int DIntermissionScreenCast::Ticker () { // go into attack frame castattacking = true; - if (!mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn))) + if (!mClass->IsDescendantOf(NAME_PlayerPawn)) { if (castonmelee) basestate = caststate = mDefaults->MeleeState; @@ -546,7 +546,7 @@ void DIntermissionScreenCast::Drawer () if (!(mDefaults->flags4 & MF4_NOSKIN) && mDefaults->SpawnState != NULL && caststate->sprite == mDefaults->SpawnState->sprite && - mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)) && + mClass->IsDescendantOf(NAME_PlayerPawn) && Skins.Size() > 0) { // Only use the skin sprite if this class has not been removed from the diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index acb88294b..1ce0fac07 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -536,7 +536,7 @@ FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo) { if (player->mo == nullptr) return ""; - IFVIRTUALPTR(player->mo, APlayerPawn, CheatMorph) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, CheatMorph) { FString message; VMReturn msgret(&message); @@ -550,7 +550,7 @@ FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo) void cht_SetInv(player_t *player, const char *string, int amount, bool beyond) { if (!player->mo) return; - IFVIRTUALPTR(player->mo, APlayerPawn, CheatTakeInv) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, CheatTakeInv) { FString message = string; VMValue params[] = { player->mo, &message, amount, beyond }; @@ -561,7 +561,7 @@ void cht_SetInv(player_t *player, const char *string, int amount, bool beyond) void cht_Give (player_t *player, const char *name, int amount) { if (!player->mo) return; - IFVIRTUALPTR(player->mo, APlayerPawn, CheatGive) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, CheatGive) { FString namestr = name; VMValue params[3] = { player->mo, &namestr, amount }; @@ -572,7 +572,7 @@ void cht_Give (player_t *player, const char *name, int amount) void cht_Take (player_t *player, const char *name, int amount) { if (!player->mo) return; - IFVIRTUALPTR(player->mo, APlayerPawn, CheatTake) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, CheatTake) { FString namestr = name; VMValue params[3] = { player->mo, &namestr, amount }; @@ -583,7 +583,7 @@ void cht_Take (player_t *player, const char *name, int amount) void cht_Takeweaps(player_t *player) { if (!player->mo) return; - IFVIRTUALPTR(player->mo, APlayerPawn, CheatTakeWeaps) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, CheatTakeWeaps) { VMValue params[3] = { player->mo }; VMCall(func, params, 1, nullptr, 0); @@ -595,7 +595,7 @@ class DSuicider : public DThinker DECLARE_CLASS(DSuicider, DThinker) HAS_OBJECT_POINTERS; public: - TObjPtr Pawn; + TObjPtr Pawn; void Tick() { @@ -644,7 +644,7 @@ void cht_Suicide (player_t *plyr) DEFINE_ACTION_FUNCTION(APlayerPawn, CheatSuicide) { - PARAM_SELF_PROLOGUE(APlayerPawn); + PARAM_SELF_PROLOGUE(AActor); cht_Suicide(self->player); return 0; } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 4246ad923..2786015c9 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4230,7 +4230,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) break; case APROP_JumpZ: - if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + if (actor->IsKindOf(NAME_PlayerPawn)) actor->FloatVar(NAME_JumpZ) = ACSToDouble(value); break; // [GRB] @@ -4263,7 +4263,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) case APROP_SpawnHealth: - if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + if (actor->IsKindOf(NAME_PlayerPawn)) { actor->IntVar(NAME_MaxHealth) = value; } @@ -4348,7 +4348,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) break; case APROP_ViewHeight: - if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + if (actor->IsKindOf(NAME_PlayerPawn)) { actor->FloatVar(NAME_ViewHeight) = ACSToDouble(value); if (actor->player != NULL) @@ -4359,7 +4359,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) break; case APROP_AttackZOffset: - if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + if (actor->IsKindOf(NAME_PlayerPawn)) actor->FloatVar(NAME_AttackZOffset) = ACSToDouble(value); break; @@ -4427,7 +4427,7 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_Dormant: return !!(actor->flags2 & MF2_DORMANT); case APROP_SpawnHealth: return actor->GetMaxHealth(); - case APROP_JumpZ: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + case APROP_JumpZ: if (actor->IsKindOf(NAME_PlayerPawn)) { return DoubleToACS(actor->FloatVar(NAME_JumpZ)); } @@ -4449,7 +4449,7 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_Radius: return DoubleToACS(actor->radius); case APROP_ReactionTime:return actor->reactiontime; case APROP_MeleeRange: return DoubleToACS(actor->meleerange); - case APROP_ViewHeight: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + case APROP_ViewHeight: if (actor->IsKindOf(NAME_PlayerPawn)) { return DoubleToACS(actor->player->DefaultViewHeight()); } @@ -4459,7 +4459,7 @@ int DLevelScript::GetActorProperty (int tid, int property) } case APROP_AttackZOffset: // Note that this is inconsistent with every other place, where the return for monsters is 8, not 0! - if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + if (actor->IsKindOf(NAME_PlayerPawn)) { return DoubleToACS(actor->FloatVar(NAME_AttackZOffset)); } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index e1ddba3ba..9ec48bec6 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -358,7 +358,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); if (!(flags4 & MF4_DONTFALL)) flags&=~MF_NOGRAVITY; flags |= MF_DROPOFF; - if ((flags3 & MF3_ISMONSTER) || FindState(NAME_Raise) != NULL || IsKindOf(RUNTIME_CLASS(APlayerPawn))) + if ((flags3 & MF3_ISMONSTER) || FindState(NAME_Raise) != NULL || IsKindOf(NAME_PlayerPawn)) { // [RH] Only monsters get to be corpses. // Objects with a raise state should get the flag as well so they can // be revived by an Arch-Vile. Batman Doom needs this. @@ -986,7 +986,7 @@ DEFINE_ACTION_FUNCTION(AActor, TriggerPainChance) //=========================================================================== // -// APlayerPawn :: hasBuddha +// // //=========================================================================== diff --git a/src/p_local.h b/src/p_local.h index 80f4770e7..fbec34e4a 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -42,7 +42,6 @@ class player_t; class AActor; struct FPlayerStart; class PClassActor; -class APlayerPawn; struct line_t; struct sector_t; struct msecnode_t; @@ -98,7 +97,7 @@ void P_PredictionLerpReset(); #define SPF_TEMPPLAYER 1 // spawning a short-lived dummy player #define SPF_WEAPONFULLYUP 2 // spawn with weapon already raised -APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0); +AActor *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0); int P_FaceMobj (AActor *source, AActor *target, DAngle *delta); bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise = false, bool usecurspeed=false); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index dce991972..0cc89e1b5 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -821,7 +821,7 @@ DEFINE_ACTION_FUNCTION(AActor, CopyFriendliness) // //--------------------------------------------------------------------------- -int P_GetRealMaxHealth(APlayerPawn *actor, int max) +int P_GetRealMaxHealth(AActor *actor, int max) { // Max is 0 by default, preserving default behavior for P_GiveBody() // calls while supporting health pickups. @@ -4462,7 +4462,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a actor->SetZ(actor->ceilingz - actor->Height); } - if (SpawningMapThing || !type->IsDescendantOf (RUNTIME_CLASS(APlayerPawn))) + if (SpawningMapThing || !type->IsDescendantOf (NAME_PlayerPawn)) { // Check if there's something solid to stand on between the current position and the // current sector's floor. For map spawns this must be delayed until after setting the @@ -4906,10 +4906,10 @@ EXTERN_CVAR(Float, fov) extern bool demonew; -APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) +AActor *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) { player_t *p; - APlayerPawn *mobj, *oldactor; + AActor *mobj, *oldactor; uint8_t state; DVector3 spawn; DAngle SpawnAngle; @@ -4990,8 +4990,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) spawn.Z = ONFLOORZ; } - mobj = static_cast - (Spawn (p->cls, spawn, NO_REPLACE)); + mobj = Spawn (p->cls, spawn, NO_REPLACE); if (level.flags & LEVEL_USEPLAYERSTARTZ) { @@ -5070,7 +5069,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) p->MUSINFOtics = -1; p->Vel.Zero(); // killough 10/98: initialize bobbing to 0. - IFVIRTUALPTR(p->mo, APlayerPawn, ResetAirSupply) + IFVIRTUALPTRNAME(p->mo, NAME_PlayerPawn, ResetAirSupply) { VMValue params[] = { p->mo, false }; VMCall(func, params, 2, nullptr, 0); @@ -5096,7 +5095,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) if (deathmatch) { // Give all cards in death match mode. - IFVIRTUALPTR(p->mo, APlayerPawn, GiveDeathmatchInventory) + IFVIRTUALPTRNAME(p->mo, NAME_PlayerPawn, GiveDeathmatchInventory) { VMValue params[1] = { p->mo }; VMCall(func, params, 1, nullptr, 0); @@ -5119,7 +5118,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) // [BC] Handle temporary invulnerability when respawned if (state == PST_REBORN || state == PST_ENTER) { - IFVIRTUALPTR(p->mo, APlayerPawn, OnRespawn) + IFVIRTUALPTRNAME(p->mo, NAME_PlayerPawn, OnRespawn) { VMValue param = p->mo; VMCall(func, ¶m, 1, nullptr, 0); @@ -7112,7 +7111,7 @@ FState *AActor::GetRaiseState() return NULL; } - if (IsKindOf(RUNTIME_CLASS(APlayerPawn))) + if (IsKindOf(NAME_PlayerPawn)) { return NULL; // do not resurrect players } diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 0a0299b81..5b5881940 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -187,7 +187,7 @@ DPSprite::DPSprite(player_t *owner, AActor *caller, int id) if (Next && Next->ID == ID && ID != 0) Next->Destroy(); // Replace it. - if (Caller->IsKindOf(NAME_Weapon) || Caller->IsKindOf(RUNTIME_CLASS(APlayerPawn))) + if (Caller->IsKindOf(NAME_Weapon) || Caller->IsKindOf(NAME_PlayerPawn)) Flags = (PSPF_ADDWEAPON|PSPF_ADDBOB|PSPF_POWDOUBLE|PSPF_CVARFAST); } @@ -577,7 +577,7 @@ void P_BringUpWeapon (player_t *player) void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac) { - IFVIRTUALPTR(player->mo, APlayerPawn, BobWeapon) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, BobWeapon) { VMValue param[] = { player->mo, ticfrac }; DVector2 result; @@ -631,7 +631,7 @@ static void P_CheckWeaponButtons (player_t *player) DEFINE_ACTION_FUNCTION(APlayerPawn, CheckWeaponButtons) { - PARAM_SELF_PROLOGUE(APlayerPawn); + PARAM_SELF_PROLOGUE(AActor); P_CheckWeaponButtons(self->player); return 0; } diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index e8de24ff7..2dfc754ab 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -202,7 +202,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags) if (thing->player && ((flags & TELF_DESTFOG) || !(flags & TELF_KEEPORIENTATION)) && !(flags & TELF_KEEPVELOCITY)) { int time = 18; - IFVIRTUALPTR(thing, APlayerPawn, GetTeleportFreezeTime) + IFVIRTUALPTRNAME(thing, NAME_PlayerPawn, GetTeleportFreezeTime) { VMValue param = thing; VMReturn ret(&time); @@ -583,7 +583,7 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO player->deltaviewheight = 0; // Set player's view according to the newly set parameters - IFVIRTUALPTR(player->mo, APlayerPawn, CalcHeight) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, CalcHeight) { VMValue param = player->mo; VMCall(func, ¶m, 1, nullptr, 0); diff --git a/src/p_user.cpp b/src/p_user.cpp index e457ebd39..1932ac1b3 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -129,7 +129,8 @@ struct PredictPos static int PredictionLerptics; static player_t PredictionPlayerBackup; -static uint8_t PredictionActorBackup[sizeof(APlayerPawn)]; +static AActor *PredictionActor; +static TArray PredictionActorBackupArray; static TArray PredictionSectorListBackup; static TArray PredictionTouchingSectorsBackup; @@ -202,7 +203,7 @@ bool ValidatePlayerClass(PClassActor *ti, const char *name) Printf("Unknown player class '%s'\n", name); return false; } - else if (!ti->IsDescendantOf(RUNTIME_CLASS(APlayerPawn))) + else if (!ti->IsDescendantOf(NAME_PlayerPawn)) { Printf("Invalid player class '%s'\n", name); return false; @@ -787,17 +788,10 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetStillBob) ACTION_RETURN_FLOAT(self->userinfo.GetStillBob()); } -//=========================================================================== -// -// APlayerPawn -// -//=========================================================================== - -IMPLEMENT_CLASS(APlayerPawn, false, false) //=========================================================================== // -// APlayerPawn :: BeginPlay +// // //=========================================================================== @@ -859,7 +853,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(APlayerPawn, SetupCrouchSprite, SetupCrouchSprite) void PlayIdle (AActor *player) { - IFVIRTUALPTR(player, APlayerPawn, PlayIdle) + IFVIRTUALPTRNAME(player, NAME_PlayerPawn, PlayIdle) { VMValue params[1] = { (DObject*)player }; VMCall(func, params, 1, nullptr, 0); @@ -1135,7 +1129,7 @@ void P_CheckMusicChange(player_t *player) DEFINE_ACTION_FUNCTION(APlayerPawn, CheckMusicChange) { - PARAM_SELF_PROLOGUE(APlayerPawn); + PARAM_SELF_PROLOGUE(AActor); P_CheckMusicChange(self->player); return 0; } @@ -1171,7 +1165,7 @@ void P_CheckEnvironment(player_t *player) DEFINE_ACTION_FUNCTION(APlayerPawn, CheckEnvironment) { - PARAM_SELF_PROLOGUE(APlayerPawn); + PARAM_SELF_PROLOGUE(AActor); P_CheckEnvironment(self->player); return 0; } @@ -1205,7 +1199,7 @@ void P_CheckUse(player_t *player) DEFINE_ACTION_FUNCTION(APlayerPawn, CheckUse) { - PARAM_SELF_PROLOGUE(APlayerPawn); + PARAM_SELF_PROLOGUE(AActor); P_CheckUse(self->player); return 0; } @@ -1240,7 +1234,7 @@ void P_PlayerThink (player_t *player) // Don't interpolate the view for more than one tic player->cheats &= ~CF_INTERPVIEW; - IFVIRTUALPTR(player->mo, APlayerPawn, PlayerThink) + IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, PlayerThink) { VMValue param = player->mo; VMCall(func, ¶m, 1, nullptr, 0); @@ -1391,8 +1385,10 @@ void P_PredictPlayer (player_t *player) // Save original values for restoration later PredictionPlayerBackup = *player; - APlayerPawn *act = player->mo; - memcpy(PredictionActorBackup, &act->snext, sizeof(APlayerPawn) - ((uint8_t *)&act->snext - (uint8_t *)act)); + auto act = player->mo; + PredictionActor = player->mo; + PredictionActorBackupArray.Resize(act->GetClass()->Size); + memcpy(PredictionActorBackupArray.Data(), &act->snext, act->GetClass()->Size - ((uint8_t *)&act->snext - (uint8_t *)act)); act->flags &= ~MF_PICKUP; act->flags2 &= ~MF2_PUSHWALL; @@ -1498,7 +1494,13 @@ void P_UnPredictPlayer () if (player->cheats & CF_PREDICTING) { unsigned int i; - APlayerPawn *act = player->mo; + AActor *act = player->mo; + + if (act != PredictionActor) + { + // Q: Can this happen? If yes, can we continue? + } + AActor *savedcamera = player->camera; auto &actInvSel = act->PointerVar(NAME_InvSel); @@ -1514,14 +1516,14 @@ void P_UnPredictPlayer () player->camera = savedcamera; FLinkContext ctx; - // Unlink from all list, includeing those which are not being handled by UnlinkFromWorld. + // Unlink from all list, including those which are not being handled by UnlinkFromWorld. auto sectorportal_list = act->touching_sectorportallist; auto lineportal_list = act->touching_lineportallist; act->touching_sectorportallist = nullptr; act->touching_lineportallist = nullptr; act->UnlinkFromWorld(&ctx); - memcpy(&act->snext, PredictionActorBackup, sizeof(APlayerPawn) - ((uint8_t *)&act->snext - (uint8_t *)act)); + memcpy(&act->snext, PredictionActorBackupArray.Data(), PredictionActorBackupArray.Size() - ((uint8_t *)&act->snext - (uint8_t *)act)); // The blockmap ordering needs to remain unchanged, too. // Restore sector links and refrences. diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index 5264095e7..cb3cd28fd 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -1191,7 +1191,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC table->Palette[i].a = 255; } - // [GRB] Don't translate skins with color range 0-0 (APlayerPawn default) + // [GRB] Don't translate skins with color range 0-0 (PlayerPawn default) if (start == 0 && end == 0) { table->Inactive = true; diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 8c5af7464..2a5224b4f 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -1010,7 +1010,7 @@ void R_InitSprites () // [GRB] Each player class has its own base skin for (i = 0; i < PlayerClasses.Size (); i++) { - auto basetype = ((APlayerPawn*)GetDefaultByType(PlayerClasses[i].Type)); + auto basetype = GetDefaultByType(PlayerClasses[i].Type); Skins[i].Name = "Base"; auto face = basetype->NameVar(NAME_Face); diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 51ec33f3f..51d9e206e 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -1891,7 +1891,7 @@ bool S_AreSoundsEquivalent (AActor *actor, int id1, int id2) //=========================================================================== // -// APlayerPawn :: GetSoundClass +//PlayerPawn :: GetSoundClass // //=========================================================================== diff --git a/src/scripting/thingdef.h b/src/scripting/thingdef.h index 6e6737282..4a2384538 100644 --- a/src/scripting/thingdef.h +++ b/src/scripting/thingdef.h @@ -308,11 +308,8 @@ int MatchString (const char *in, const char **strings); #define DEFINE_PROPERTY(name, paramlist, clas) DEFINE_PROPERTY_BASE(name, paramlist, clas, CAT_PROPERTY) #define DEFINE_INFO_PROPERTY(name, paramlist, clas) DEFINE_PROPERTY_BASE(name, paramlist, clas, CAT_INFO) -#define DEFINE_CLASS_PROPERTY(name, paramlist, clas) DEFINE_PREFIXED_PROPERTY_BASE(clas, name, paramlist, clas, CAT_PROPERTY) -#define DEFINE_CLASS_PROPERTY_PREFIX(prefix, name, paramlist, clas) DEFINE_PREFIXED_PROPERTY_BASE(prefix, name, paramlist, clas, CAT_PROPERTY) - -#define DEFINE_SCRIPTED_PROPERTY(name, paramlist, clas) DEFINE_PREFIXED_SCRIPTED_PROPERTY_BASE(clas, name, paramlist, clas, CAT_PROPERTY) -#define DEFINE_SCRIPTED_PROPERTY_PREFIX(prefix, name, paramlist, clas) DEFINE_PREFIXED_SCRIPTED_PROPERTY_BASE(prefix, name, paramlist, clas, CAT_PROPERTY) +#define DEFINE_CLASS_PROPERTY(name, paramlist, clas) DEFINE_PREFIXED_SCRIPTED_PROPERTY_BASE(clas, name, paramlist, clas, CAT_PROPERTY) +#define DEFINE_CLASS_PROPERTY_PREFIX(prefix, name, paramlist, clas) DEFINE_PREFIXED_SCRIPTED_PROPERTY_BASE(prefix, name, paramlist, clas, CAT_PROPERTY) #define PROP_PARM_COUNT (params[0].i) diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index a2990c615..4a73214ab 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -110,8 +110,8 @@ static FFlagDef InternalActorFlagDefs[]= static FFlagDef ActorFlagDefs[]= { - DEFINE_FLAG(MF, PICKUP, APlayerPawn, flags), - DEFINE_FLAG(MF, SPECIAL, APlayerPawn, flags), + DEFINE_FLAG(MF, PICKUP, AActor, flags), + DEFINE_FLAG(MF, SPECIAL, AActor, flags), DEFINE_FLAG(MF, SOLID, AActor, flags), DEFINE_FLAG(MF, SHOOTABLE, AActor, flags), DEFINE_PROTECTED_FLAG(MF, NOSECTOR, AActor, flags), diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 0e3206cda..d494ff835 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -1040,7 +1040,7 @@ DEFINE_PROPERTY(visibletoplayerclass, Ssssssssssssssssssss, Actor) { PROP_STRING_PARM(n, i); if (*n != 0) - info->ActorInfo()->VisibleToPlayerClass.Push(FindClassTentative(n, RUNTIME_CLASS(APlayerPawn))); + info->ActorInfo()->VisibleToPlayerClass.Push(FindClassTentative(n, RUNTIME_CLASS(AActor))); } } @@ -1076,7 +1076,7 @@ DEFINE_PROPERTY(distancecheck, S, Actor) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory) +DEFINE_CLASS_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory) { auto restrictarray = (TArray*)defaults->ScriptVar(NAME_RestrictedToPlayerClass, nullptr); @@ -1085,14 +1085,14 @@ DEFINE_SCRIPTED_PROPERTY(restrictedto, Ssssssssssssssssssss, Inventory) { PROP_STRING_PARM(n, i); if (*n != 0) - restrictarray->Push(FindClassTentative(n, RUNTIME_CLASS(APlayerPawn))); + restrictarray->Push(FindClassTentative(n, RUNTIME_CLASS(AActor))); } } //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory) +DEFINE_CLASS_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory) { auto forbidarray = (TArray*)defaults->ScriptVar(NAME_ForbiddenToPlayerClass, nullptr); @@ -1101,7 +1101,7 @@ DEFINE_SCRIPTED_PROPERTY(forbiddento, Ssssssssssssssssssss, Inventory) { PROP_STRING_PARM(n, i); if (*n != 0) - forbidarray->Push(FindClassTentative(n, RUNTIME_CLASS(APlayerPawn))); + forbidarray->Push(FindClassTentative(n, RUNTIME_CLASS(AActor))); } } @@ -1134,7 +1134,7 @@ static void SetIcon(FTextureID &icon, Baggage &bag, const char *i) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(icon, S, Inventory) +DEFINE_CLASS_PROPERTY(icon, S, Inventory) { PROP_STRING_PARM(i, 0); SetIcon(defaults->TextureIDVar(NAME_Icon), bag, i); @@ -1143,7 +1143,7 @@ DEFINE_SCRIPTED_PROPERTY(icon, S, Inventory) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(althudicon, S, Inventory) +DEFINE_CLASS_PROPERTY(althudicon, S, Inventory) { PROP_STRING_PARM(i, 0); SetIcon(defaults->TextureIDVar(NAME_AltHUDIcon), bag, i); @@ -1152,7 +1152,7 @@ DEFINE_SCRIPTED_PROPERTY(althudicon, S, Inventory) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(defmaxamount, 0, Inventory) +DEFINE_CLASS_PROPERTY(defmaxamount, 0, Inventory) { defaults->IntVar(NAME_MaxAmount) = gameinfo.definventorymaxamount; } @@ -1160,14 +1160,14 @@ DEFINE_SCRIPTED_PROPERTY(defmaxamount, 0, Inventory) //========================================================================== // Dummy for Skulltag compatibility... //========================================================================== -DEFINE_SCRIPTED_PROPERTY(pickupannouncerentry, S, Inventory) +DEFINE_CLASS_PROPERTY(pickupannouncerentry, S, Inventory) { } //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(defaultkickback, 0, Weapon) +DEFINE_CLASS_PROPERTY(defaultkickback, 0, Weapon) { defaults->IntVar(NAME_Kickback) = gameinfo.defKickback; } @@ -1175,7 +1175,7 @@ DEFINE_SCRIPTED_PROPERTY(defaultkickback, 0, Weapon) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(bobstyle, S, Weapon) +DEFINE_CLASS_PROPERTY(bobstyle, S, Weapon) { static const char *names[] = { "Normal", "Inverse", "Alpha", "InverseAlpha", "Smooth", "InverseSmooth", NULL }; static const EBobStyle styles[] = { EBobStyle::BobNormal, @@ -1194,7 +1194,7 @@ DEFINE_SCRIPTED_PROPERTY(bobstyle, S, Weapon) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(preferredskin, S, Weapon) +DEFINE_CLASS_PROPERTY(preferredskin, S, Weapon) { PROP_STRING_PARM(str, 0); // NoOp - only for Skulltag compatibility @@ -1203,7 +1203,7 @@ DEFINE_SCRIPTED_PROPERTY(preferredskin, S, Weapon) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, color, C_f, Inventory) +DEFINE_CLASS_PROPERTY_PREFIX(powerup, color, C_f, Inventory) { static const char *specialcolormapnames[] = { "INVERSEMAP", "GOLDMAP", "REDMAP", "GREENMAP", "BLUEMAP", NULL }; @@ -1258,7 +1258,7 @@ DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, color, C_f, Inventory) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory) +DEFINE_CLASS_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory) { PalEntry BlendColor; @@ -1295,7 +1295,7 @@ DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, duration, I, Inventory) +DEFINE_CLASS_PROPERTY_PREFIX(powerup, duration, I, Inventory) { if (!info->IsDescendantOf(NAME_Powerup) && !info->IsDescendantOf(NAME_PowerupGiver)) { @@ -1310,7 +1310,7 @@ DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, duration, I, Inventory) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY_PREFIX(powerup, type, S, PowerupGiver) +DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver) { PROP_STRING_PARM(str, 0); @@ -1701,16 +1701,16 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, weaponslot, ISsssssssssssssssssssssssssssss //========================================================================== // (non-fatal with non-existent types only in DECORATE) //========================================================================== -DEFINE_SCRIPTED_PROPERTY(playerclass, S, MorphProjectile) +DEFINE_CLASS_PROPERTY(playerclass, S, MorphProjectile) { PROP_STRING_PARM(str, 0); - defaults->PointerVar(NAME_PlayerClass) = FindClassTentative(str, RUNTIME_CLASS(APlayerPawn), bag.fromDecorate); + defaults->PointerVar(NAME_PlayerClass) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); } //========================================================================== // (non-fatal with non-existent types only in DECORATE) //========================================================================== -DEFINE_SCRIPTED_PROPERTY(monsterclass, S, MorphProjectile) +DEFINE_CLASS_PROPERTY(monsterclass, S, MorphProjectile) { PROP_STRING_PARM(str, 0); defaults->PointerVar(NAME_MonsterClass) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); @@ -1719,7 +1719,7 @@ DEFINE_SCRIPTED_PROPERTY(monsterclass, S, MorphProjectile) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(duration, I, MorphProjectile) +DEFINE_CLASS_PROPERTY(duration, I, MorphProjectile) { PROP_INT_PARM(i, 0); defaults->IntVar(NAME_Duration) = i >= 0 ? i : -i*TICRATE; @@ -1728,7 +1728,7 @@ DEFINE_SCRIPTED_PROPERTY(duration, I, MorphProjectile) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(morphstyle, M, MorphProjectile) +DEFINE_CLASS_PROPERTY(morphstyle, M, MorphProjectile) { PROP_INT_PARM(i, 0); defaults->IntVar(NAME_MorphStyle) = i; @@ -1737,7 +1737,7 @@ DEFINE_SCRIPTED_PROPERTY(morphstyle, M, MorphProjectile) //========================================================================== // (non-fatal with non-existent types only in DECORATE) //========================================================================== -DEFINE_SCRIPTED_PROPERTY(morphflash, S, MorphProjectile) +DEFINE_CLASS_PROPERTY(morphflash, S, MorphProjectile) { PROP_STRING_PARM(str, 0); defaults->PointerVar(NAME_MorphFlash) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); @@ -1746,7 +1746,7 @@ DEFINE_SCRIPTED_PROPERTY(morphflash, S, MorphProjectile) //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, MorphProjectile) +DEFINE_CLASS_PROPERTY(unmorphflash, S, MorphProjectile) { PROP_STRING_PARM(str, 0); defaults->PointerVar(NAME_UnMorphFlash) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); @@ -1755,16 +1755,16 @@ DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, MorphProjectile) //========================================================================== // (non-fatal with non-existent types only in DECORATE) //========================================================================== -DEFINE_SCRIPTED_PROPERTY(playerclass, S, PowerMorph) +DEFINE_CLASS_PROPERTY(playerclass, S, PowerMorph) { PROP_STRING_PARM(str, 0); - defaults->PointerVar(NAME_PlayerClass) = FindClassTentative(str, RUNTIME_CLASS(APlayerPawn), bag.fromDecorate); + defaults->PointerVar(NAME_PlayerClass) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); } //========================================================================== // //========================================================================== -DEFINE_SCRIPTED_PROPERTY(morphstyle, M, PowerMorph) +DEFINE_CLASS_PROPERTY(morphstyle, M, PowerMorph) { PROP_INT_PARM(i, 0); defaults->IntVar(NAME_MorphStyle) = i; @@ -1773,7 +1773,7 @@ DEFINE_SCRIPTED_PROPERTY(morphstyle, M, PowerMorph) //========================================================================== // (non-fatal with non-existent types only in DECORATE) //========================================================================== -DEFINE_SCRIPTED_PROPERTY(morphflash, S, PowerMorph) +DEFINE_CLASS_PROPERTY(morphflash, S, PowerMorph) { PROP_STRING_PARM(str, 0); defaults->PointerVar(NAME_MorphFlash) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); @@ -1782,7 +1782,7 @@ DEFINE_SCRIPTED_PROPERTY(morphflash, S, PowerMorph) //========================================================================== // (non-fatal with non-existent types only in DECORATE) //========================================================================== -DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, PowerMorph) +DEFINE_CLASS_PROPERTY(unmorphflash, S, PowerMorph) { PROP_STRING_PARM(str, 0); defaults->PointerVar(NAME_UnMorphFlash) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 9d529d29d..0f66fc266 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -1945,7 +1945,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, SlotSize, SlotSize) DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, SetupWeaponSlots, FWeaponSlots::SetupWeaponSlots) { PARAM_PROLOGUE; - PARAM_OBJECT(pawn, APlayerPawn); + PARAM_OBJECT(pawn, AActor); FWeaponSlots::SetupWeaponSlots(pawn); return 0; } diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index 17718e024..73b737fcf 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -1651,13 +1651,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFor3DCeilingHit, CheckFor3DCeilingHit //=========================================================================== // -// APlayerPawn functions +// PlayerPawn functions // //=========================================================================== DEFINE_ACTION_FUNCTION_NATIVE(APlayerPawn, MarkPlayerSounds, S_MarkPlayerSounds) { - PARAM_SELF_PROLOGUE(APlayerPawn); + PARAM_SELF_PROLOGUE(AActor); S_MarkPlayerSounds(self); return 0; } diff --git a/src/v_blend.cpp b/src/v_blend.cpp index b0cd1c060..94a40b832 100644 --- a/src/v_blend.cpp +++ b/src/v_blend.cpp @@ -125,7 +125,7 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int } PalEntry painFlash = 0; - IFVIRTUALPTR(CPlayer->mo, APlayerPawn, GetPainFlash) + IFVIRTUALPTRNAME(CPlayer->mo, NAME_PlayerPawn, GetPainFlash) { VMValue param = CPlayer->mo; VMReturn ret((int*)&painFlash.d); diff --git a/wadsrc/static/zscript/shared/player.txt b/wadsrc/static/zscript/shared/player.txt index 63497400b..04d3ec715 100644 --- a/wadsrc/static/zscript/shared/player.txt +++ b/wadsrc/static/zscript/shared/player.txt @@ -10,7 +10,7 @@ struct UserCmd native native int16 upmove; } -class PlayerPawn : Actor native +class PlayerPawn : Actor { const CROUCHSPEED = (1./12); // [RH] # of ticks to complete a turn180 @@ -123,7 +123,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: Tick + // PlayerPawn :: Tick // //=========================================================================== @@ -156,7 +156,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: PostBeginPlay + // PlayerPawn :: PostBeginPlay // //=========================================================================== @@ -181,7 +181,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: MarkPrecacheSounds + // PlayerPawn :: MarkPrecacheSounds // //=========================================================================== @@ -303,7 +303,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: CheckWeaponSwitch + // PlayerPawn :: CheckWeaponSwitch // // Checks if weapons should be changed after picking up ammo // @@ -748,7 +748,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: Die + // PlayerPawn :: Die // //=========================================================================== @@ -827,7 +827,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: FilterCoopRespawnInventory + // PlayerPawn :: FilterCoopRespawnInventory // // When respawning in coop, this function is called to walk through the dead // player's inventory and modify it according to the current game flags so @@ -1174,7 +1174,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: TweakSpeeds + // PlayerPawn :: TweakSpeeds // //=========================================================================== @@ -1709,7 +1709,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: BestWeapon + // PlayerPawn :: BestWeapon // // Returns the best weapon a player has, possibly restricted to a single // type of ammo. @@ -1793,7 +1793,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: PickNewWeapon + // PlayerPawn :: PickNewWeapon // // Picks a new weapon for this player. Used mostly for running out of ammo, // but it also works when an ACS script explicitly takes the ready weapon @@ -1822,7 +1822,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: GiveDefaultInventory + // PlayerPawn :: GiveDefaultInventory // //=========================================================================== @@ -1912,7 +1912,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: GiveDeathmatchInventory + // PlayerPawn :: GiveDeathmatchInventory // // Gives players items they should have in addition to their default // inventory when playing deathmatch. (i.e. all keys) @@ -2420,7 +2420,7 @@ class PlayerPawn : Actor native //=========================================================================== // - // APlayerPawn :: ResetAirSupply + // PlayerPawn :: ResetAirSupply // // Gives the player a full "tank" of air. If they had previously completely // run out of air, also plays the *gasp sound. Returns true if the player diff --git a/wadsrc/static/zscript/shared/player_inventory.txt b/wadsrc/static/zscript/shared/player_inventory.txt index bcaa31be1..bd01a59a8 100644 --- a/wadsrc/static/zscript/shared/player_inventory.txt +++ b/wadsrc/static/zscript/shared/player_inventory.txt @@ -87,7 +87,7 @@ extend class PlayerPawn //=========================================================================== // - // APlayerPawn :: InvPrev + // PlayerPawn :: InvPrev // //=========================================================================== @@ -123,7 +123,7 @@ extend class PlayerPawn //=========================================================================== // - // APlayerPawn :: AddInventory + // PlayerPawn :: AddInventory // //=========================================================================== @@ -146,7 +146,7 @@ extend class PlayerPawn //=========================================================================== // - // APlayerPawn :: RemoveInventory + // PlayerPawn :: RemoveInventory // //=========================================================================== @@ -198,7 +198,7 @@ extend class PlayerPawn //=========================================================================== // - // APlayerPawn :: UseInventory + // PlayerPawn :: UseInventory // //===========================================================================