diff --git a/source/core/coreplayer.h b/source/core/coreplayer.h index d42cf328d..c9db183fb 100644 --- a/source/core/coreplayer.h +++ b/source/core/coreplayer.h @@ -4,15 +4,30 @@ #include "packet.h" #include "gameinput.h" -struct CorePlayer +class DCorePlayer : public DObject { + DECLARE_CLASS(DCorePlayer, DObject) + HAS_OBJECT_POINTERS +protected: + DCorePlayer() = default; + void Clear() + { + memset(&lastcmd, 0, sizeof(lastcmd)); + memset(&cmd, 0, sizeof(cmd)); + memset(&Angles, 0, sizeof(Angles)); + actor = nullptr; + pnum = 0; + } + +public: ticcmd_t lastcmd, cmd; PlayerAngles Angles; DCoreActor* actor; uint8_t pnum; - virtual ~CorePlayer() { if (actor) actor->Destroy(); }; + DCorePlayer(uint8_t p) : pnum(p) {} + void OnDestroy() override { if (actor) actor->Destroy(); actor = nullptr; } virtual DCoreActor* GetActor() = 0; }; -extern CorePlayer* PlayerArray[MAXPLAYERS]; +extern DCorePlayer* PlayerArray[MAXPLAYERS]; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index f0e03e801..d88b56cfe 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -166,6 +166,7 @@ void HudScaleChanged(); bool M_SetSpecialMenu(FName& menu, int param); void OnMenuOpen(bool makeSound); void DestroyAltHUD(); +void MarkPlayers(); DStatusBarCore* StatusBar; @@ -637,7 +638,7 @@ int GameMain() gi->FreeLevelData(); for (int i = 0; i < MAXPLAYERS; i++) { - delete PlayerArray[i]; + PlayerArray[i]->Destroy(); PlayerArray[i] = nullptr; } } @@ -1154,6 +1155,7 @@ int RunGame() StartWindow->Progress(); GC::AddMarkerFunc(MarkMap); + GC::AddMarkerFunc(MarkPlayers); gi->app_init(); StartWindow->Progress(); G_ParseMapInfo(); diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 9c604943e..287b453cf 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -101,7 +101,17 @@ static uint64_t stabilityticduration = 0; static uint64_t stabilitystarttime = 0; static double inputScale; -CorePlayer* PlayerArray[MAXPLAYERS]; +DCorePlayer* PlayerArray[MAXPLAYERS]; + +IMPLEMENT_CLASS(DCorePlayer, true, true) +IMPLEMENT_POINTERS_START(DCorePlayer) +IMPLEMENT_POINTER(actor) +IMPLEMENT_POINTERS_END + +void MarkPlayers() +{ + GC::MarkArray(PlayerArray, MAXPLAYERS); +} bool r_NoInterpolate; int entertic; diff --git a/source/core/vmexports.cpp b/source/core/vmexports.cpp index bab61cff0..6a683dc89 100644 --- a/source/core/vmexports.cpp +++ b/source/core/vmexports.cpp @@ -39,6 +39,7 @@ #include "raze_sound.h" #include "texturemanager.h" #include "texinfo.h" +#include "coreplayer.h" #include "buildtiles.h" @@ -816,6 +817,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setSpritePic, tspritetype_setSpriteP //============================================================================= +DEFINE_FIELD(DCorePlayer, pnum) + DEFINE_FIELD_NAMED(DCoreActor, spr.sectp, sector) DEFINE_FIELD_NAMED(DCoreActor, spr.cstat, cstat) DEFINE_FIELD_NAMED(DCoreActor, spr.cstat2, cstat2) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 3b6050cc6..841023ef8 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -3053,7 +3053,7 @@ static void checkAddFrag(DBloodActor* killerActor, DBloodActor* actor) { if (killerActor->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(killerActor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(killerActor->spr.type - kDudePlayer1); if (gGameOptions.nGameType == 1) pPlayer->fragCount++; } @@ -3068,7 +3068,7 @@ static void checkAddFrag(DBloodActor* killerActor, DBloodActor* actor) case kDudeBurningInnocent: break; default: - BloodPlayer* pKillerPlayer = getPlayer(killerActor->spr.type - kDudePlayer1); + DBloodPlayer* pKillerPlayer = getPlayer(killerActor->spr.type - kDudePlayer1); pKillerPlayer->fragCount++; break; } @@ -3616,7 +3616,7 @@ static int actDamageDude(DBloodActor* source, DBloodActor* actor, int damage, DA } else { - BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); if (actor->xspr.health > 0 || playerSeqPlaying(pPlayer, 16)) damage = playerDamageSprite(source, pPlayer, damageType, damage); @@ -3630,7 +3630,7 @@ static int actDamageDude(DBloodActor* source, DBloodActor* actor, int damage, DA // //--------------------------------------------------------------------------- -static int actDamageThing(DBloodActor* source, DBloodActor* actor, int damage, DAMAGE_TYPE damageType, BloodPlayer* pSourcePlayer) +static int actDamageThing(DBloodActor* source, DBloodActor* actor, int damage, DAMAGE_TYPE damageType, DBloodPlayer* pSourcePlayer) { assert(actor->spr.type >= kThingBase && actor->spr.type < kThingMax); int nType = actor->spr.type - kThingBase; @@ -3739,7 +3739,7 @@ int actDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE damageT if (source == nullptr) source = actor; - BloodPlayer* pSourcePlayer = nullptr; + DBloodPlayer* pSourcePlayer = nullptr; if (source->IsPlayerActor()) pSourcePlayer = getPlayer(source->spr.type - kDudePlayer1); if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pSourcePlayer, actor)) return 0; @@ -4334,7 +4334,7 @@ static void checkFloorHit(DBloodActor* actor) } #endif - BloodPlayer* pPlayer = nullptr; + DBloodPlayer* pPlayer = nullptr; if (actor->IsPlayerActor()) pPlayer = getPlayer(actor->spr.type - kDudePlayer1); switch (actor2->spr.type) @@ -4691,7 +4691,7 @@ static Collision MoveThing(DBloodActor* actor) void MoveDude(DBloodActor* actor) { - BloodPlayer* pPlayer = nullptr; + DBloodPlayer* pPlayer = nullptr; if (actor->IsPlayerActor()) pPlayer = getPlayer(actor->spr.type - kDudePlayer1); if (!(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax)) { @@ -5543,8 +5543,8 @@ static void actCheckProximity() auto Owner = actor->GetOwner(); if (!Owner->IsPlayerActor()) continue; - BloodPlayer* pPlayer = getPlayer(Owner->spr.type - kDudePlayer1); - BloodPlayer* pPlayer2 = dudeactor->IsPlayerActor() ? getPlayer(dudeactor->spr.type - kDudePlayer1) : nullptr; + auto pPlayer = getPlayer(Owner); + DBloodPlayer* pPlayer2 = dudeactor->IsPlayerActor() ? getPlayer(dudeactor) : nullptr; if (dudeactor == Owner || dudeactor->spr.type == kDudeZombieAxeBuried || dudeactor->spr.type == kDudeRat || dudeactor->spr.type == kDudeBat) continue; if (gGameOptions.nGameType == 3 && pPlayer2 && pPlayer->teamId == pPlayer2->teamId) continue; @@ -5975,7 +5975,7 @@ static void actCheckDudes() } if (actor->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); if (pPlayer->voodooTargets) voodooTarget(pPlayer); if (pPlayer->hand && Chance(0x8000)) actDamageSprite(actor, actor, kDamageDrown, 12); @@ -6049,7 +6049,7 @@ static void actCheckDudes() if (actor->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); double nDrag = FixedToFloat(gDudeDrag); if (actor->xspr.height > 0) nDrag -= Scale(nDrag, (double)actor->xspr.height, 256.); @@ -6624,7 +6624,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 if (!gGameOptions.bFriendlyFire && IsTargetTeammate(shooter, hitactor)) return; if (hitactor->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(hitactor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(hitactor->spr.type - kDudePlayer1); if (powerupCheck(pPlayer, kPwUpReflectShots)) { gHitInfo.hitActor = shooter; diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index af6f9d63b..006f174d6 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -971,7 +971,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType { aiPatrolStop(actor, source, actor->xspr.dudeAmbush); - BloodPlayer* pPlayer = getPlayerById(source->spr.type); + DBloodPlayer* pPlayer = getPlayerById(source->spr.type); if (!pPlayer) return nDamage; //if (powerupCheck(pPlayer, kPwUpShadowCloak)) pPlayer->pwUpTime[kPwUpShadowCloak] = 0; if (readyForCrit(source, actor)) @@ -1491,7 +1491,7 @@ void aiThinkTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (actor->GetOwner() == pPlayer->GetActor() || pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; @@ -1536,7 +1536,7 @@ void aiLookForTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (actor->GetOwner() == pPlayer->GetActor() || pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 28a721825..dfc778d4e 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -94,7 +94,7 @@ static void batThinkTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 7b64bf07d..f32c6e658 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -106,7 +106,7 @@ static void eelThinkTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index eeef1970a..f715e7d0d 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -237,7 +237,7 @@ static void cerberusThinkTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index 0ca7c5a19..e4d40ebff 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -193,7 +193,7 @@ static void gargThinkTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index 8ec2437a3..5587b9b59 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -174,7 +174,7 @@ static void ghostThinkTarget(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aihand.cpp b/source/games/blood/src/aihand.cpp index daa93a68c..c5999e524 100644 --- a/source/games/blood/src/aihand.cpp +++ b/source/games/blood/src/aihand.cpp @@ -47,7 +47,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor) auto target = actor->GetTarget(); if (target->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1); if (!pPlayer->hand) { pPlayer->hand = 1; diff --git a/source/games/blood/src/aispid.cpp b/source/games/blood/src/aispid.cpp index d134ad015..41fb7628e 100644 --- a/source/games/blood/src/aispid.cpp +++ b/source/games/blood/src/aispid.cpp @@ -49,7 +49,7 @@ static void spidBlindEffect(DBloodActor* actor, int nBlind, int max) { nBlind <<= 4; max <<= 4; - BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); if (pPlayer->blindEffect < max) { pPlayer->blindEffect = ClipHigh(pPlayer->blindEffect + nBlind, max); @@ -74,7 +74,7 @@ void SpidBiteSeqCallback(int, DBloodActor* actor) if (hit == 3 && gHitInfo.actor()->IsPlayerActor()) { vec.Z += target->spr.pos.Z - actor->spr.pos.Z; - BloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1); switch (actor->spr.type) { case kDudeSpiderBrown: diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index 0a293bd51..5b176eea6 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -198,7 +198,7 @@ static void sub_725A4(DBloodActor* actor) { for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); if (pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; auto ppos = pPlayer->GetActor()->spr.pos; diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 821b98a0f..b6b231518 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -461,7 +461,7 @@ static void unicultThinkChase(DBloodActor* actor) if (target->xspr.health <= 0) // target is dead { - BloodPlayer* pPlayer = NULL; + DBloodPlayer* pPlayer = NULL; if ((!target->IsPlayerActor()) || ((pPlayer = getPlayerById(target->spr.type)) != NULL && pPlayer->fragger == actor)) { playGenDudeSound(actor, kGenDudeSndTargetDead); @@ -498,7 +498,7 @@ static void unicultThinkChase(DBloodActor* actor) } else if (target->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1); if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) { if (spriteIsUnderwater(actor, false)) aiGenDudeNewState(actor, &genDudeSearchShortW); @@ -1758,7 +1758,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event) { if (actTarget->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(actTarget->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actTarget->spr.type - kDudePlayer1); if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) return; } double top, bottom; diff --git a/source/games/blood/src/aizomba.cpp b/source/games/blood/src/aizomba.cpp index 9a5035614..ce2156b20 100644 --- a/source/games/blood/src/aizomba.cpp +++ b/source/games/blood/src/aizomba.cpp @@ -209,7 +209,7 @@ static void myThinkTarget(DBloodActor* actor) DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type); for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); auto owneractor = actor->GetOwner(); if (owneractor == nullptr || owneractor == pPlayer->GetActor() || pPlayer->GetActor()->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index f6293b737..111904cf2 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -490,7 +490,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF case kViewEffectShowWeapon: { assert(pTSprite->type >= kDudePlayer1 && pTSprite->type <= kDudePlayer8); - BloodPlayer* pPlayer = getPlayer(pTSprite->type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(pTSprite->type - kDudePlayer1); WEAPONICON weaponIcon = gWeaponIcon[pPlayer->curWeapon]; auto nTex = weaponIcon.textureID(); if (!nTex.isValid()) break; @@ -555,7 +555,7 @@ static int GetOctant(const DVector2& dPos) void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA, double interpfrac) { - BloodPlayer* pPlayer = getPlayer(gViewIndex); + DBloodPlayer* pPlayer = getPlayer(gViewIndex); int nViewSprites = tsprites.Size(); // shift before interpolating to increase precision. DAngle myclock = DAngle::fromBuild((PlayClock << 3) + (4 << 3) * interpfrac); @@ -841,7 +841,7 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA, if (powerupCheck(pPlayer, kPwUpBeastVision) > 0) pTSprite->shade = -128; if (IsPlayerSprite(pTSprite)) { - BloodPlayer* thisPlayer = getPlayer(pTSprite->type - kDudePlayer1); + DBloodPlayer* thisPlayer = getPlayer(pTSprite->type - kDudePlayer1); if (powerupCheck(thisPlayer, kPwUpShadowCloak) && !powerupCheck(pPlayer, kPwUpBeastVision)) { pTSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pTSprite->pal = 5; diff --git a/source/games/blood/src/asound.cpp b/source/games/blood/src/asound.cpp index a4512c918..30861d6e0 100644 --- a/source/games/blood/src/asound.cpp +++ b/source/games/blood/src/asound.cpp @@ -43,7 +43,7 @@ int nAmbChannels = 0; // //--------------------------------------------------------------------------- -void ambProcess(BloodPlayer* pPlayer) +void ambProcess(DBloodPlayer* pPlayer) { if (!SoundEnabled()) return; diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 97243b58a..b35a45885 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -70,6 +70,31 @@ IMPLEMENT_POINTER(xspr.burnSource) IMPLEMENT_POINTER(xspr.target) IMPLEMENT_POINTERS_END +IMPLEMENT_CLASS(DBloodPlayer, false, true) +IMPLEMENT_POINTERS_START(DBloodPlayer) +IMPLEMENT_POINTER(ctfFlagState[0]) +IMPLEMENT_POINTER(ctfFlagState[1]) +IMPLEMENT_POINTER(aimTarget) +IMPLEMENT_POINTER(fragger) +IMPLEMENT_POINTER(voodooTarget) +IMPLEMENT_POINTER(aimTargets[0]) +IMPLEMENT_POINTER(aimTargets[1]) +IMPLEMENT_POINTER(aimTargets[2]) +IMPLEMENT_POINTER(aimTargets[3]) +IMPLEMENT_POINTER(aimTargets[4]) +IMPLEMENT_POINTER(aimTargets[5]) +IMPLEMENT_POINTER(aimTargets[6]) +IMPLEMENT_POINTER(aimTargets[7]) +IMPLEMENT_POINTER(aimTargets[8]) +IMPLEMENT_POINTER(aimTargets[9]) +IMPLEMENT_POINTER(aimTargets[10]) +IMPLEMENT_POINTER(aimTargets[11]) +IMPLEMENT_POINTER(aimTargets[12]) +IMPLEMENT_POINTER(aimTargets[13]) +IMPLEMENT_POINTER(aimTargets[14]) +IMPLEMENT_POINTER(aimTargets[15]) +IMPLEMENT_POINTERS_END + //--------------------------------------------------------------------------- // // @@ -96,19 +121,6 @@ static void markgcroots() GC::MarkArray(gPhysSpritesList, gPhysSpritesCount); GC::MarkArray(gImpactSpritesList, gImpactSpritesCount); MarkSprInSect(); - for (int i = 0; i < MAXPLAYERS; i++) - { - auto plr = getPlayer(i); - if (plr) - { - GC::Mark(plr->actor); - GC::MarkArray(plr->ctfFlagState, 2); - GC::Mark(plr->aimTarget); - GC::MarkArray(plr->aimTargets, 16); - GC::Mark(plr->fragger); - GC::Mark(plr->voodooTarget); - } - } for (auto& evobj : rxBucket) { evobj.Mark(); @@ -127,7 +139,7 @@ bool bNoDemo = false; int gNetPlayers; int gChokeCounter = 0; int blood_globalflags; -BloodPlayer gPlayerTemp[kMaxPlayers]; +PlayerSave gPlayerTemp[kMaxPlayers]; int gHealthTemp[kMaxPlayers]; int16_t startang; sectortype* startsector; @@ -343,19 +355,10 @@ void StartLevel(MapRecord* level, bool newgame) { for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - BloodPlayer* pPlayer = getPlayer(i); + DBloodPlayer* pPlayer = getPlayer(i); pPlayer->GetActor()->xspr.health &= 0xf000; pPlayer->GetActor()->xspr.health |= gHealthTemp[i]; - pPlayer->weaponQav = gPlayerTemp[i].weaponQav; - pPlayer->curWeapon = gPlayerTemp[i].curWeapon; - pPlayer->weaponState = gPlayerTemp[i].weaponState; - pPlayer->weaponAmmo = gPlayerTemp[i].weaponAmmo; - pPlayer->qavCallback = gPlayerTemp[i].qavCallback; - pPlayer->qavLoop = gPlayerTemp[i].qavLoop; - pPlayer->weaponTimer = gPlayerTemp[i].weaponTimer; - pPlayer->nextWeapon = gPlayerTemp[i].nextWeapon; - pPlayer->qavLastTick = gPlayerTemp[i].qavLastTick; - pPlayer->qavTimer = gPlayerTemp[i].qavTimer; + gPlayerTemp[i].CopyToPlayer(pPlayer); } } PreloadCache(); @@ -425,7 +428,7 @@ void GameInterface::Ticker() thinktime.Reset(); thinktime.Clock(); - BloodPlayer* pPlayer = getPlayer(myconnectindex); + DBloodPlayer* pPlayer = getPlayer(myconnectindex); // disable synchronised input if set by game. resetForcedSyncInput(); @@ -592,8 +595,8 @@ void GameInterface::app_init() // Initialise player array. for (unsigned i = 0; i < MAXPLAYERS; i++) { - PlayerArray[i] = new BloodPlayer; - *getPlayer(i) = {}; + PlayerArray[i] = Create(i); + GC::WriteBarrier(PlayerArray[i]); } mirrortile = tileGetTextureID(504); @@ -772,13 +775,13 @@ DEFINE_ACTION_FUNCTION(_Blood, GetViewPlayer) DEFINE_ACTION_FUNCTION(_BloodPlayer, GetHealth) { - PARAM_SELF_STRUCT_PROLOGUE(BloodPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DBloodPlayer); ACTION_RETURN_INT(self->GetActor()->xspr.health); } DEFINE_ACTION_FUNCTION_NATIVE(_BloodPlayer, powerupCheck, powerupCheck) { - PARAM_SELF_STRUCT_PROLOGUE(BloodPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DBloodPlayer); PARAM_INT(pwup); ACTION_RETURN_INT(powerupCheck(self, pwup)); } diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index 450f3afa6..1e8ffe0a9 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -159,13 +159,27 @@ public: }; -struct BloodPlayer final : public CorePlayer +class DBloodPlayer final : public DCorePlayer { - DUDEINFO* pDudeInfo; + DECLARE_CLASS(DBloodPlayer, DCorePlayer) + HAS_OBJECT_POINTERS + DBloodPlayer() = default; +public: + DBloodPlayer(uint8_t p) : DCorePlayer(p) {} + void Clear() + { + Super::Clear(); + // Quick'n dirty clear + memset(&startOfMem, 0, sizeof(DBloodPlayer) - myoffsetof(DBloodPlayer, startOfMem)); + } + + uint8_t startOfMem; // only for Clear uint8_t newWeapon; + bool isRunning; + + DUDEINFO* pDudeInfo; int weaponQav; int qavCallback; - bool isRunning; int posture; // stand, crouch, swim int sceneQav; // by NoOne: used to keep qav id double bobPhase; @@ -258,11 +272,59 @@ struct BloodPlayer final : public CorePlayer } }; -inline BloodPlayer* getPlayer(int index) +inline DBloodPlayer* getPlayer(int index) { - return static_cast(PlayerArray[index]); + return static_cast(PlayerArray[index]); } +inline DBloodPlayer* getPlayer(DBloodActor* ac) +{ + return static_cast(PlayerArray[ac->spr.type - kDudePlayer1]); +} + +struct PlayerSave +{ + int weaponQav; + int8_t curWeapon; + int weaponState; + int weaponAmmo; + int qavCallback; + bool qavLoop; + int weaponTimer; + int8_t nextWeapon; + int qavLastTick; + int qavTimer; + + void CopyFromPlayer(DBloodPlayer* p) + { + weaponQav = p->weaponQav; + curWeapon = p->curWeapon; + weaponState = p->weaponState; + weaponAmmo = p->weaponAmmo; + qavCallback = p->qavCallback; + qavLoop = p->qavLoop; + weaponTimer = p->weaponTimer; + nextWeapon = p->nextWeapon; + qavLastTick = p->qavLastTick; + qavTimer = p->qavTimer; + + } + + void CopyToPlayer(DBloodPlayer* p) + { + p->weaponQav = weaponQav; + p->curWeapon = curWeapon; + p->weaponState = weaponState; + p->weaponAmmo = weaponAmmo; + p->qavCallback = qavCallback; + p->qavLoop = qavLoop; + p->weaponTimer = weaponTimer; + p->nextWeapon = nextWeapon; + p->qavLastTick = qavLastTick; + p->qavTimer = qavTimer; + } +}; + // subclassed to add a game specific actor() method extern HitInfo gHitInfo; @@ -288,7 +350,7 @@ inline bool IsTargetTeammate(DBloodActor* pSource, DBloodActor* pTarget) { if (!pSource->IsPlayerActor()) return false; - BloodPlayer* pSourcePlayer = getPlayer(pSource->spr.type - kDudePlayer1); + DBloodPlayer* pSourcePlayer = getPlayer(pSource->spr.type - kDudePlayer1); return IsTargetTeammate(pSourcePlayer, pTarget); } diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 77238c318..7875a8963 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -337,7 +337,7 @@ void PlayerBubble(DBloodActor* actor, sectortype*) // 10 if (!actor) return; if (actor->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); if (!pPlayer->bubbleTime) return; double top, bottom; @@ -694,7 +694,7 @@ void LeechStateTimer(DBloodActor* actor, sectortype*) // 20 // //--------------------------------------------------------------------------- -void sub_76A08(DBloodActor* actor, DBloodActor* actor2, BloodPlayer* pPlayer) // ??? +void sub_76A08(DBloodActor* actor, DBloodActor* actor2, DBloodPlayer* pPlayer) // ??? { double top, bottom; GetActorExtents(actor, &top, &bottom); @@ -726,7 +726,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused evPostActor(actor, 0, kCallbackRemove); return; } - BloodPlayer* pPlayer; + DBloodPlayer* pPlayer; if (Owner->IsPlayerActor()) pPlayer = getPlayer(Owner->spr.type - kDudePlayer1); else @@ -753,7 +753,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused continue; if (actor2->hasX()) { - BloodPlayer* pPlayer2; + DBloodPlayer* pPlayer2; if (actor2->IsPlayerActor()) pPlayer2 = getPlayer(actor2->spr.type - kDudePlayer1); else diff --git a/source/games/blood/src/choke.cpp b/source/games/blood/src/choke.cpp index 85b47a56d..999c9c8f0 100644 --- a/source/games/blood/src/choke.cpp +++ b/source/games/blood/src/choke.cpp @@ -35,7 +35,7 @@ BEGIN_BLD_NS // //--------------------------------------------------------------------------- -void CChoke::init(int a1, void(*a2)(BloodPlayer*)) +void CChoke::init(int a1, void(*a2)(DBloodPlayer*)) { callback = a2; if (!qav && a1 != -1) @@ -82,7 +82,7 @@ void CChoke::animateChoke(int x, int y, double interpfrac) // //--------------------------------------------------------------------------- -void chokeCallback(BloodPlayer* pPlayer) +void chokeCallback(DBloodPlayer* pPlayer) { int t = gGameOptions.nDifficulty + 2; if (pPlayer->handTime < 64) diff --git a/source/games/blood/src/choke.h b/source/games/blood/src/choke.h index 48e2930e0..e6fe6beb4 100644 --- a/source/games/blood/src/choke.h +++ b/source/games/blood/src/choke.h @@ -40,7 +40,7 @@ public: x = 0; y = 0; }; - void init(int a1, void(*a2)(BloodPlayer*)); + void init(int a1, void(*a2)(DBloodPlayer*)); void animateChoke(int x, int y, double interpfrac); void reset() { time = 0; } QAV* qav; @@ -48,10 +48,10 @@ public: int time; int x; int y; - void(*callback)(BloodPlayer*); + void(*callback)(DBloodPlayer*); }; -void chokeCallback(BloodPlayer*); +void chokeCallback(DBloodPlayer*); extern CChoke gChoke; diff --git a/source/games/blood/src/endgame.cpp b/source/games/blood/src/endgame.cpp index b08d3f782..50fbed800 100644 --- a/source/games/blood/src/endgame.cpp +++ b/source/games/blood/src/endgame.cpp @@ -37,7 +37,7 @@ void GameInterface::LevelCompleted(MapRecord* map, int skill) { if (getPlayer(i)->GetActor()) { - memcpy(&gPlayerTemp[i], getPlayer(i), sizeof(BloodPlayer)); + gPlayerTemp[i].CopyFromPlayer(getPlayer(i)); gHealthTemp[i] = getPlayer(i)->GetActor()->xspr.health; } } diff --git a/source/games/blood/src/eventq.cpp b/source/games/blood/src/eventq.cpp index 5c0559c36..2fe83a0d9 100644 --- a/source/games/blood/src/eventq.cpp +++ b/source/games/blood/src/eventq.cpp @@ -311,7 +311,7 @@ void evSend(EventObject& eob, int rxId, COMMAND_ID command, DBloodActor* initiat if (gModernMap) { // allow to send commands on player sprites - BloodPlayer* pPlayer = NULL; + DBloodPlayer* pPlayer = NULL; if (playerRXRngIsFine(rxId)) { if ((pPlayer = getPlayerById((rxId - kChannelPlayer7) + kMaxPlayers)) != nullptr) diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index f58e6ed78..8954e5be9 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -100,7 +100,7 @@ static void viewBurnTime(int gScale) // //--------------------------------------------------------------------------- -void hudDraw(BloodPlayer* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, DAngle angle, int basepal, double interpfrac) +void hudDraw(DBloodPlayer* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, DAngle angle, int basepal, double interpfrac) { if (gViewPos == 0) { @@ -169,7 +169,7 @@ void hudDraw(BloodPlayer* pPlayer, sectortype* pSector, double bobx, double boby } int zn = int(((pPlayer->zWeapon - pPlayer->zView - 12) * 2.) + 220); - BloodPlayer* pPSprite = getPlayer(pPlayer->GetActor()->spr.type - kDudePlayer1); + DBloodPlayer* pPSprite = getPlayer(pPlayer->GetActor()->spr.type - kDudePlayer1); if (pPlayer->GetActor()->IsPlayerActor() && pPSprite->hand == 1) { gChoke.animateChoke(160, zn, interpfrac); diff --git a/source/games/blood/src/messages.cpp b/source/games/blood/src/messages.cpp index 3d4a7a93f..46dd3fde5 100644 --- a/source/games/blood/src/messages.cpp +++ b/source/games/blood/src/messages.cpp @@ -46,7 +46,7 @@ void sub_5A928(void) buttonMap.ClearButton(i); } -const char* SetGodMode(BloodPlayer* pPlayer, bool god) +const char* SetGodMode(DBloodPlayer* pPlayer, bool god) { playerSetGodMode(pPlayer, god); bPlayerCheated = true; @@ -60,13 +60,13 @@ const char* SetClipMode(bool noclip) return gNoClip ? GStrings("TXTB_NOCLIP") : GStrings("TXTB_NOCLIPOFF"); } -void packStuff(BloodPlayer* pPlayer) +void packStuff(DBloodPlayer* pPlayer) { for (int i = 0; i < 5; i++) packAddItem(pPlayer, i); } -void packClear(BloodPlayer* pPlayer) +void packClear(DBloodPlayer* pPlayer) { pPlayer->packItemId = 0; for (int i = 0; i < 5; i++) @@ -76,7 +76,7 @@ void packClear(BloodPlayer* pPlayer) } } -void SetAmmo(BloodPlayer* pPlayer, bool stat) +void SetAmmo(DBloodPlayer* pPlayer, bool stat) { if (stat) { @@ -92,7 +92,7 @@ void SetAmmo(BloodPlayer* pPlayer, bool stat) } } -void SetWeapons(BloodPlayer* pPlayer, bool stat) +void SetWeapons(DBloodPlayer* pPlayer, bool stat) { for (int i = 0; i < 14; i++) { @@ -114,7 +114,7 @@ void SetWeapons(BloodPlayer* pPlayer, bool stat) } } -void SetToys(BloodPlayer* pPlayer, bool stat) +void SetToys(DBloodPlayer* pPlayer, bool stat) { if (stat) { @@ -128,7 +128,7 @@ void SetToys(BloodPlayer* pPlayer, bool stat) } } -void SetArmor(BloodPlayer* pPlayer, bool stat) +void SetArmor(DBloodPlayer* pPlayer, bool stat) { int nAmount; if (stat) @@ -145,7 +145,7 @@ void SetArmor(BloodPlayer* pPlayer, bool stat) pPlayer->armor[i] = nAmount; } -void SetKeys(BloodPlayer* pPlayer, bool stat) +void SetKeys(DBloodPlayer* pPlayer, bool stat) { for (int i = 1; i <= 7; i++) pPlayer->hasKey[i] = stat; @@ -173,7 +173,7 @@ void SetMap(bool stat) viewSetMessage(GStrings("TXTB_NOALLMAP")); } -void SetWooMode(BloodPlayer* pPlayer, bool stat) +void SetWooMode(DBloodPlayer* pPlayer, bool stat) { if (stat) { @@ -191,12 +191,12 @@ void SetWooMode(BloodPlayer* pPlayer, bool stat) } } -void ToggleWooMode(BloodPlayer* pPlayer) +void ToggleWooMode(DBloodPlayer* pPlayer) { SetWooMode(pPlayer, !(powerupCheck(pPlayer, kPwUpTwoGuns) != 0)); } -void ToggleBoots(BloodPlayer* pPlayer) +void ToggleBoots(DBloodPlayer* pPlayer) { if (powerupCheck(pPlayer, kPwUpJumpBoots)) { @@ -217,7 +217,7 @@ void ToggleBoots(BloodPlayer* pPlayer) } } -void ToggleInvisibility(BloodPlayer* pPlayer) +void ToggleInvisibility(DBloodPlayer* pPlayer) { if (powerupCheck(pPlayer, kPwUpShadowCloak)) { @@ -233,7 +233,7 @@ void ToggleInvisibility(BloodPlayer* pPlayer) } } -void ToggleInvulnerability(BloodPlayer* pPlayer) +void ToggleInvulnerability(DBloodPlayer* pPlayer) { if (powerupCheck(pPlayer, kPwUpDeathMask)) { @@ -249,7 +249,7 @@ void ToggleInvulnerability(BloodPlayer* pPlayer) } } -void ToggleDelirium(BloodPlayer* pPlayer) +void ToggleDelirium(DBloodPlayer* pPlayer) { if (powerupCheck(pPlayer, kPwUpDeliriumShroom)) { @@ -292,7 +292,7 @@ static int parseArgs(char* pzArgs, int* nArg1, int* nArg2) const char* GameInterface::GenericCheat(int player, int cheat) { // message processing is not perfect because many cheats output multiple messages. - BloodPlayer* pPlayer = getPlayer(player); + DBloodPlayer* pPlayer = getPlayer(player); if (gGameOptions.nGameType != 0 || numplayers > 1) // sp only for now. return nullptr; @@ -512,7 +512,7 @@ static cheatseq_t s_CheatInfo[] = { void cheatReset(void) { - BloodPlayer* pPlayer = getPlayer(myconnectindex); + DBloodPlayer* pPlayer = getPlayer(myconnectindex); bPlayerCheated = 0; playerSetGodMode(pPlayer, 0); gNoClip = 0; @@ -530,7 +530,7 @@ void cheatReset(void) static void cmd_Give(int player, uint8_t** stream, bool skip) { - BloodPlayer* pPlayer = getPlayer(player); + DBloodPlayer* pPlayer = getPlayer(player); int type = ReadByte(stream); if (skip) return; diff --git a/source/games/blood/src/misc.h b/source/games/blood/src/misc.h index 6433a70f2..06494e7cd 100644 --- a/source/games/blood/src/misc.h +++ b/source/games/blood/src/misc.h @@ -48,16 +48,16 @@ void processSpritesOnOtherSideOfPortal(int x, int y, int interpolation); void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int viewPlayer); int qanimateoffs(int a1, int a2); -struct BloodPlayer; +class DBloodPlayer; -bool checkLitSprayOrTNT(BloodPlayer* pPlayer); +bool checkLitSprayOrTNT(DBloodPlayer* pPlayer); void WeaponInit(void); -void WeaponDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle); -void WeaponRaise(BloodPlayer* pPlayer); -void WeaponLower(BloodPlayer* pPlayer); -int WeaponUpgrade(BloodPlayer* pPlayer, int newWeapon); -void WeaponProcess(BloodPlayer* pPlayer); -void WeaponUpdateState(BloodPlayer* pPlayer); +void WeaponDraw(DBloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle); +void WeaponRaise(DBloodPlayer* pPlayer); +void WeaponLower(DBloodPlayer* pPlayer); +int WeaponUpgrade(DBloodPlayer* pPlayer, int newWeapon); +void WeaponProcess(DBloodPlayer* pPlayer); +void WeaponUpdateState(DBloodPlayer* pPlayer); void teslaHit(DBloodActor* pMissile, int a2); void WeaponPrecache(); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index ebec372ae..7812a579b 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1175,7 +1175,7 @@ void nnExtProcessSuperSprites() { for (int a = connecthead; a >= 0; a = connectpoint2[a]) { - BloodPlayer* pPlayer = getPlayer(a); + DBloodPlayer* pPlayer = getPlayer(a); if (!pPlayer || !xsprIsFine(pPlayer->GetActor()) || pPlayer->GetActor()->xspr.health <= 0) continue; @@ -1213,7 +1213,7 @@ void nnExtProcessSuperSprites() for (int a = connecthead; a >= 0; a = connectpoint2[a]) { - BloodPlayer* pPlayer = getPlayer(a); + DBloodPlayer* pPlayer = getPlayer(a); if (!pPlayer || !xsprIsFine(pPlayer->GetActor()) || pPlayer->GetActor()->xspr.health <= 0) continue; @@ -1300,7 +1300,7 @@ void nnExtProcessSuperSprites() if (debrisactor->xspr.physAttr & kPhysDebrisTouch) { - BloodPlayer* pPlayer = NULL; + DBloodPlayer* pPlayer = NULL; for (int a = connecthead; a != -1; a = connectpoint2[a]) { pPlayer = getPlayer(a); @@ -1940,7 +1940,7 @@ void windGenStopWindOnSectors(DBloodActor* sourceactor) // //--------------------------------------------------------------------------- -void trPlayerCtrlStartScene(DBloodActor* sourceactor, BloodPlayer* pPlayer, bool force) +void trPlayerCtrlStartScene(DBloodActor* sourceactor, DBloodPlayer* pPlayer, bool force) { TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->pnum]; @@ -1982,7 +1982,7 @@ void trPlayerCtrlStartScene(DBloodActor* sourceactor, BloodPlayer* pPlayer, bool // //--------------------------------------------------------------------------- -void trPlayerCtrlStopScene(BloodPlayer* pPlayer) +void trPlayerCtrlStopScene(DBloodPlayer* pPlayer) { TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->pnum]; auto initiator = pCtrl->qavScene.initiator; @@ -2014,7 +2014,7 @@ void trPlayerCtrlStopScene(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlLink(DBloodActor* sourceactor, BloodPlayer* pPlayer, bool checkCondition) +void trPlayerCtrlLink(DBloodActor* sourceactor, DBloodPlayer* pPlayer, bool checkCondition) { // save player's sprite index to let the tracking condition know it after savegame loading... auto actor = pPlayer->GetActor(); @@ -2074,7 +2074,7 @@ void trPlayerCtrlLink(DBloodActor* sourceactor, BloodPlayer* pPlayer, bool check // //--------------------------------------------------------------------------- -void trPlayerCtrlSetRace(int value, BloodPlayer* pPlayer) +void trPlayerCtrlSetRace(int value, DBloodPlayer* pPlayer) { playerSetRace(pPlayer, value); switch (pPlayer->lifeMode) @@ -2098,7 +2098,7 @@ void trPlayerCtrlSetRace(int value, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlSetMoveSpeed(int value, BloodPlayer* pPlayer) +void trPlayerCtrlSetMoveSpeed(int value, DBloodPlayer* pPlayer) { int speed = ClipRange(value, 0, 500); for (int i = 0; i < kModeMax; i++) @@ -2119,7 +2119,7 @@ void trPlayerCtrlSetMoveSpeed(int value, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlSetJumpHeight(int value, BloodPlayer* pPlayer) +void trPlayerCtrlSetJumpHeight(int value, DBloodPlayer* pPlayer) { int jump = ClipRange(value, 0, 500); for (int i = 0; i < kModeMax; i++) @@ -2136,7 +2136,7 @@ void trPlayerCtrlSetJumpHeight(int value, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlSetScreenEffect(int value, int timeval, BloodPlayer* pPlayer) +void trPlayerCtrlSetScreenEffect(int value, int timeval, DBloodPlayer* pPlayer) { int eff = ClipLow(value, 0); int time = (eff > 0) ? timeval : 0; @@ -2179,7 +2179,7 @@ void trPlayerCtrlSetScreenEffect(int value, int timeval, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlSetLookAngle(int value, BloodPlayer* pPlayer) +void trPlayerCtrlSetLookAngle(int value, DBloodPlayer* pPlayer) { static constexpr double upAngle = 289; static constexpr double downAngle = -347; @@ -2199,7 +2199,7 @@ void trPlayerCtrlSetLookAngle(int value, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlEraseStuff(int value, BloodPlayer* pPlayer) +void trPlayerCtrlEraseStuff(int value, DBloodPlayer* pPlayer) { switch (value) @@ -2251,7 +2251,7 @@ void trPlayerCtrlEraseStuff(int value, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void trPlayerCtrlGiveStuff(int data2, int weapon, int data4, BloodPlayer* pPlayer, TRPLAYERCTRL* pCtrl) +void trPlayerCtrlGiveStuff(int data2, int weapon, int data4, DBloodPlayer* pPlayer, TRPLAYERCTRL* pCtrl) { switch (data2) { @@ -2321,7 +2321,7 @@ void trPlayerCtrlGiveStuff(int data2, int weapon, int data4, BloodPlayer* pPlaye // //--------------------------------------------------------------------------- -void trPlayerCtrlUsePackItem(int data2, int data3, int data4, BloodPlayer* pPlayer, int evCmd) +void trPlayerCtrlUsePackItem(int data2, int data3, int data4, DBloodPlayer* pPlayer, int evCmd) { unsigned int invItem = data2 - 1; switch (evCmd) @@ -2357,7 +2357,7 @@ void trPlayerCtrlUsePackItem(int data2, int data3, int data4, BloodPlayer* pPlay // //--------------------------------------------------------------------------- -void trPlayerCtrlUsePowerup(DBloodActor* sourceactor, BloodPlayer* pPlayer, int evCmd) +void trPlayerCtrlUsePowerup(DBloodActor* sourceactor, DBloodPlayer* pPlayer, int evCmd) { bool relative = (sourceactor->spr.flags & kModernTypeFlag1); @@ -2891,7 +2891,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe if (iactor->spr.statnum != kStatDude || !iactor->IsDudeActor() || !iactor->hasX()) continue; - BloodPlayer* pPlayer = getPlayerById(iactor->spr.type); + DBloodPlayer* pPlayer = getPlayerById(iactor->spr.type); if (pXSector->Underwater) { if (aLower) @@ -3138,7 +3138,7 @@ void useVelocityChanger(DBloodActor* actor, sectortype* sect, DBloodActor* initi void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) { - BloodPlayer* pPlayer = getPlayerById(actor->spr.type); + DBloodPlayer* pPlayer = getPlayerById(actor->spr.type); XSECTOR* pXSector = (sourceactor->sector()->hasX()) ? &sourceactor->sector()->xs() : nullptr; bool isDude = (!pPlayer && actor->IsDudeActor()); @@ -3559,7 +3559,7 @@ void damageSprites(DBloodActor* sourceactor, DBloodActor* actor) int health = 0; - BloodPlayer* pPlayer = getPlayerById(actor->spr.type); + DBloodPlayer* pPlayer = getPlayerById(actor->spr.type); int dmgType = (sourceactor->xspr.data2 >= kDmgFall) ? ClipHigh(sourceactor->xspr.data2, kDmgElectric) : -1; int dmg = actor->xspr.health << 4; int armor[3]; @@ -4304,7 +4304,7 @@ bool condCheckWall(DBloodActor* aCond, int cmpOp, bool PUSH) bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH) { int var = -1; - BloodPlayer* pPlayer = NULL; + DBloodPlayer* pPlayer = NULL; int cond = aCond->xspr.data1 - kCondPlayerBase; int arg1 = aCond->xspr.data2; int arg2 = aCond->xspr.data3; @@ -4550,7 +4550,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH) bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH) { - int var = -1, var2 = -1, var3 = -1; BloodPlayer* pPlayer = NULL; bool retn = false; + int var = -1, var2 = -1, var3 = -1; DBloodPlayer* pPlayer = NULL; bool retn = false; int cond = aCond->xspr.data1 - kCondSpriteBase; int arg1 = aCond->xspr.data2; int arg2 = aCond->xspr.data3; int arg3 = aCond->xspr.data4; @@ -5727,7 +5727,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) else if (actor->xspr.data1 >= 666 && actor->xspr.data1 < 669) useSpriteDamager(actor, -1, nullptr, nullptr); else { - BloodPlayer* pPlayer = getPlayerById(actor->xspr.data1); + DBloodPlayer* pPlayer = getPlayerById(actor->xspr.data1); if (pPlayer != NULL) useSpriteDamager(actor, OBJ_SPRITE, 0, pPlayer->GetActor()); } @@ -5746,7 +5746,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) case kMarkerWarpDest: if (actor->xspr.txID <= 0) { - BloodPlayer* pPlayer = getPlayerById(actor->xspr.data1); + DBloodPlayer* pPlayer = getPlayerById(actor->xspr.data1); if (pPlayer != NULL && SetSpriteState(actor, actor->xspr.state ^ 1, initiator) == 1) useTeleportTarget(actor, pPlayer->GetActor()); return true; @@ -5981,7 +5981,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) return true; case kModernPlayerControl: { // WIP - BloodPlayer* pPlayer = NULL; + DBloodPlayer* pPlayer = NULL; int cmd = (event.cmd >= kCmdNumberic) ? event.cmd : actor->xspr.command; @@ -7252,7 +7252,7 @@ QAV* playerQavSceneLoad(int qavId) // //--------------------------------------------------------------------------- -void playerQavSceneProcess(BloodPlayer* pPlayer, QAVSCENE* pQavScene) +void playerQavSceneProcess(DBloodPlayer* pPlayer, QAVSCENE* pQavScene) { auto initiator = pQavScene->initiator; if (initiator->hasX()) @@ -7303,7 +7303,7 @@ void playerQavSceneProcess(BloodPlayer* pPlayer, QAVSCENE* pQavScene) // //--------------------------------------------------------------------------- -void playerQavSceneDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle) +void playerQavSceneDraw(DBloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle) { if (pPlayer == NULL || pPlayer->sceneQav == -1) return; @@ -7347,7 +7347,7 @@ void playerQavSceneDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypo // //--------------------------------------------------------------------------- -void playerQavScenePlay(BloodPlayer* pPlayer) +void playerQavScenePlay(DBloodPlayer* pPlayer) { if (pPlayer == NULL) return; @@ -7363,7 +7363,7 @@ void playerQavScenePlay(BloodPlayer* pPlayer) } } -void playerQavSceneReset(BloodPlayer* pPlayer) +void playerQavSceneReset(DBloodPlayer* pPlayer) { QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->pnum].qavScene; pQavScene->initiator = nullptr; @@ -7371,28 +7371,28 @@ void playerQavSceneReset(BloodPlayer* pPlayer) pQavScene->qavResrc = NULL; } -bool playerSizeShrink(BloodPlayer* pPlayer, int divider) +bool playerSizeShrink(DBloodPlayer* pPlayer, int divider) { pPlayer->GetActor()->xspr.scale = 256 / divider; playerSetRace(pPlayer, kModeHumanShrink); return true; } -bool playerSizeGrow(BloodPlayer* pPlayer, int multiplier) +bool playerSizeGrow(DBloodPlayer* pPlayer, int multiplier) { pPlayer->GetActor()->xspr.scale = 256 * multiplier; playerSetRace(pPlayer, kModeHumanGrown); return true; } -bool playerSizeReset(BloodPlayer* pPlayer) +bool playerSizeReset(DBloodPlayer* pPlayer) { playerSetRace(pPlayer, kModeHuman); pPlayer->GetActor()->xspr.scale = 0; return true; } -void playerDeactivateShrooms(BloodPlayer* pPlayer) +void playerDeactivateShrooms(DBloodPlayer* pPlayer) { powerupDeactivate(pPlayer, kPwUpGrowShroom); pPlayer->pwUpTime[kPwUpGrowShroom] = 0; @@ -7407,7 +7407,7 @@ void playerDeactivateShrooms(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -BloodPlayer* getPlayerById(int id) +DBloodPlayer* getPlayerById(int id) { // relative to connected players if (id >= 1 && id <= kMaxPlayers) @@ -8380,8 +8380,8 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor) enum { kMaxPatrolFoundSounds = 256 }; // should be the maximum amount of sound channels the engine can play at the same time. PATROL_FOUND_SOUNDS patrolBonkles[kMaxPatrolFoundSounds]; - assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); - DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type); BloodPlayer* pPlayer = NULL; + assert(actor->IsDudeActor()); + DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type - kDudeBase); DBloodPlayer* pPlayer = NULL; for (int i = 0; i < kMaxPatrolFoundSounds; i++) { @@ -9286,7 +9286,7 @@ void changeSpriteAngle(DBloodActor* pSpr, DAngle nAng) pSpr->spr.Angles.Yaw = nAng; else { - BloodPlayer* pPlayer = getPlayerById(pSpr->spr.type); + DBloodPlayer* pPlayer = getPlayerById(pSpr->spr.type); if (pPlayer) pPlayer->GetActor()->spr.Angles.Yaw = nAng; else @@ -9349,7 +9349,7 @@ void killEffectGenCallbacks(DBloodActor* actor) else if (actor->xspr.txID >= kChannelPlayer0 && actor->xspr.txID < kChannelPlayer0 + kMaxPlayers) { // player sprites - BloodPlayer* pPlayer = getPlayerById(actor->xspr.txID - kChannelPlayer0); + DBloodPlayer* pPlayer = getPlayerById(actor->xspr.txID - kChannelPlayer0); if (pPlayer && pPlayer->GetActor() != nullptr) dokillEffectGenCallbacks(pPlayer->GetActor()); } diff --git a/source/games/blood/src/nnexts.h b/source/games/blood/src/nnexts.h index da3c60d0c..e5380ec1a 100644 --- a/source/games/blood/src/nnexts.h +++ b/source/games/blood/src/nnexts.h @@ -331,8 +331,8 @@ void useCustomDudeSpawn(DBloodActor* pXSource, DBloodActor* pSprite); void useVelocityChanger(DBloodActor* pXSource, sectortype* sect, DBloodActor* causerID, DBloodActor* pSprite); void seqTxSendCmdAll(DBloodActor* pXSource, DBloodActor* nIndex, COMMAND_ID cmd, bool modernSend, DBloodActor* initiator); // ------------------------------------------------------------------------- // -void trPlayerCtrlLink(DBloodActor* pXSource, BloodPlayer* pPlayer, bool checkCondition); -void trPlayerCtrlStopScene(BloodPlayer* pPlayer); +void trPlayerCtrlLink(DBloodActor* pXSource, DBloodPlayer* pPlayer, bool checkCondition); +void trPlayerCtrlStopScene(DBloodPlayer* pPlayer); // ------------------------------------------------------------------------- // void modernTypeTrigger(int type, sectortype* sect, walltype* wal, DBloodActor* actor, EVENT& event); bool modernTypeOperateSector(sectortype* pSector, const EVENT& event); @@ -340,22 +340,22 @@ bool modernTypeOperateSprite(DBloodActor*, EVENT& event); bool modernTypeOperateWall(walltype* pWall, const EVENT& event); void modernTypeSendCommand(DBloodActor* nSprite, int channel, COMMAND_ID command, DBloodActor* initiator); // ------------------------------------------------------------------------- // -bool playerSizeShrink(BloodPlayer* pPlayer, int divider); -bool playerSizeGrow(BloodPlayer* pPlayer, int multiplier); -bool playerSizeReset(BloodPlayer* pPlayer); -void playerDeactivateShrooms(BloodPlayer* pPlayer); +bool playerSizeShrink(DBloodPlayer* pPlayer, int divider); +bool playerSizeGrow(DBloodPlayer* pPlayer, int multiplier); +bool playerSizeReset(DBloodPlayer* pPlayer); +void playerDeactivateShrooms(DBloodPlayer* pPlayer); // ------------------------------------------------------------------------- // QAV* playerQavSceneLoad(int qavId); -void playerQavSceneProcess(BloodPlayer* pPlayer, QAVSCENE* pQavScene); -void playerQavScenePlay(BloodPlayer* pPlayer); -void playerQavSceneDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle); -void playerQavSceneReset(BloodPlayer* pPlayer); +void playerQavSceneProcess(DBloodPlayer* pPlayer, QAVSCENE* pQavScene); +void playerQavScenePlay(DBloodPlayer* pPlayer); +void playerQavSceneDraw(DBloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle); +void playerQavSceneReset(DBloodPlayer* pPlayer); // ------------------------------------------------------------------------- // void callbackUniMissileBurst(DBloodActor* actor, sectortype* nSprite); void callbackMakeMissileBlocking(DBloodActor* actor, sectortype* nSprite); void callbackGenDudeUpdate(DBloodActor* actor, sectortype* nSprite); // ------------------------------------------------------------------------- // -BloodPlayer* getPlayerById(int id); +DBloodPlayer* getPlayerById(int id); bool isGrown(DBloodActor* pSprite); bool isShrinked(DBloodActor* pSprite); bool IsBurningDude(DBloodActor* pSprite); diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 0aa1ac01e..aed6b565f 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -228,7 +228,7 @@ DAMAGEINFO damageInfo[7] = { // //--------------------------------------------------------------------------- -inline bool IsTargetTeammate(BloodPlayer* pSourcePlayer, DBloodActor* target) +inline bool IsTargetTeammate(DBloodPlayer* pSourcePlayer, DBloodActor* target) { if (pSourcePlayer == nullptr) return false; @@ -236,7 +236,7 @@ inline bool IsTargetTeammate(BloodPlayer* pSourcePlayer, DBloodActor* target) return false; if (gGameOptions.nGameType == 1 || gGameOptions.nGameType == 3) { - BloodPlayer* pTargetPlayer = getPlayer(target->spr.type - kDudePlayer1); + DBloodPlayer* pTargetPlayer = getPlayer(target->spr.type - kDudePlayer1); if (pSourcePlayer != pTargetPlayer) { if (gGameOptions.nGameType == 1) @@ -256,7 +256,7 @@ inline bool IsTargetTeammate(BloodPlayer* pSourcePlayer, DBloodActor* target) // //--------------------------------------------------------------------------- -int powerupCheck(BloodPlayer* pPlayer, int nPowerUp) +int powerupCheck(DBloodPlayer* pPlayer, int nPowerUp) { assert(pPlayer != NULL); assert(nPowerUp >= 0 && nPowerUp < kMaxPowerUps); @@ -273,7 +273,7 @@ int powerupCheck(BloodPlayer* pPlayer, int nPowerUp) // //--------------------------------------------------------------------------- -bool powerupActivate(BloodPlayer* pPlayer, int nPowerUp) +bool powerupActivate(DBloodPlayer* pPlayer, int nPowerUp) { if (powerupCheck(pPlayer, nPowerUp) > 0 && gPowerUpInfo[nPowerUp].pickupOnce) return 0; @@ -346,7 +346,7 @@ bool powerupActivate(BloodPlayer* pPlayer, int nPowerUp) // //--------------------------------------------------------------------------- -void powerupDeactivate(BloodPlayer* pPlayer, int nPowerUp) +void powerupDeactivate(DBloodPlayer* pPlayer, int nPowerUp) { int nPack = powerupToPackItem(nPowerUp); if (nPack >= 0) @@ -401,7 +401,7 @@ void powerupDeactivate(BloodPlayer* pPlayer, int nPowerUp) // //--------------------------------------------------------------------------- -void powerupSetState(BloodPlayer* pPlayer, int nPowerUp, bool bState) +void powerupSetState(DBloodPlayer* pPlayer, int nPowerUp, bool bState) { if (!bState) powerupActivate(pPlayer, nPowerUp); @@ -415,7 +415,7 @@ void powerupSetState(BloodPlayer* pPlayer, int nPowerUp, bool bState) // //--------------------------------------------------------------------------- -void powerupProcess(BloodPlayer* pPlayer) +void powerupProcess(DBloodPlayer* pPlayer) { pPlayer->packItemTime = ClipLow(pPlayer->packItemTime - 4, 0); for (int i = kMaxPowerUps - 1; i >= 0; i--) @@ -451,7 +451,7 @@ void powerupProcess(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void powerupClear(BloodPlayer* pPlayer) +void powerupClear(DBloodPlayer* pPlayer) { for (int i = kMaxPowerUps - 1; i >= 0; i--) { @@ -517,7 +517,7 @@ int powerupToPackItem(int nPowerUp) // //--------------------------------------------------------------------------- -bool packAddItem(BloodPlayer* pPlayer, unsigned int nPack) +bool packAddItem(DBloodPlayer* pPlayer, unsigned int nPack) { if (nPack <= 4) { @@ -543,12 +543,12 @@ bool packAddItem(BloodPlayer* pPlayer, unsigned int nPack) // //--------------------------------------------------------------------------- -int packCheckItem(BloodPlayer* pPlayer, int nPack) +int packCheckItem(DBloodPlayer* pPlayer, int nPack) { return pPlayer->packSlots[nPack].curAmount; } -bool packItemActive(BloodPlayer* pPlayer, int nPack) +bool packItemActive(DBloodPlayer* pPlayer, int nPack) { return pPlayer->packSlots[nPack].isActive; } @@ -559,7 +559,7 @@ bool packItemActive(BloodPlayer* pPlayer, int nPack) // //--------------------------------------------------------------------------- -void packUseItem(BloodPlayer* pPlayer, int nPack) +void packUseItem(DBloodPlayer* pPlayer, int nPack) { bool v4 = 0; int nPowerUp = -1; @@ -612,7 +612,7 @@ void packUseItem(BloodPlayer* pPlayer, int nPack) // //--------------------------------------------------------------------------- -void packPrevItem(BloodPlayer* pPlayer) +void packPrevItem(DBloodPlayer* pPlayer) { if (pPlayer->packItemTime > 0) { @@ -641,7 +641,7 @@ void packPrevItem(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void packNextItem(BloodPlayer* pPlayer) +void packNextItem(DBloodPlayer* pPlayer) { if (pPlayer->packItemTime > 0) { @@ -669,7 +669,7 @@ void packNextItem(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -bool playerSeqPlaying(BloodPlayer* pPlayer, int nSeq) +bool playerSeqPlaying(DBloodPlayer* pPlayer, int nSeq) { int nCurSeq = seqGetID(pPlayer->GetActor()); if (pPlayer->pDudeInfo->seqStartID + nSeq == nCurSeq && seqGetStatus(pPlayer->GetActor()) >= 0) @@ -683,7 +683,7 @@ bool playerSeqPlaying(BloodPlayer* pPlayer, int nSeq) // //--------------------------------------------------------------------------- -void playerSetRace(BloodPlayer* pPlayer, int nLifeMode) +void playerSetRace(DBloodPlayer* pPlayer, int nLifeMode) { assert(nLifeMode >= kModeHuman && nLifeMode <= kModeHumanGrown); DUDEINFO* pDudeInfo = pPlayer->pDudeInfo; @@ -703,12 +703,12 @@ void playerSetRace(BloodPlayer* pPlayer, int nLifeMode) // //--------------------------------------------------------------------------- -void playerSetGodMode(BloodPlayer* pPlayer, bool bGodMode) +void playerSetGodMode(DBloodPlayer* pPlayer, bool bGodMode) { pPlayer->godMode = bGodMode; } -void playerResetInertia(BloodPlayer* pPlayer) +void playerResetInertia(DBloodPlayer* pPlayer) { POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; pPlayer->zView = pPlayer->GetActor()->spr.pos.Z - pPosture->eyeAboveZ; @@ -717,7 +717,7 @@ void playerResetInertia(BloodPlayer* pPlayer) viewBackupView(pPlayer->pnum); } -void playerCorrectInertia(BloodPlayer* pPlayer, const DVector3& oldpos) +void playerCorrectInertia(DBloodPlayer* pPlayer, const DVector3& oldpos) { auto zAdj = pPlayer->GetActor()->spr.pos.Z - oldpos.Z; pPlayer->zView += zAdj; @@ -727,7 +727,7 @@ void playerCorrectInertia(BloodPlayer* pPlayer, const DVector3& oldpos) pPlayer->GetActor()->opos.Z += zAdj; } -void playerResetPowerUps(BloodPlayer* pPlayer) +void playerResetPowerUps(DBloodPlayer* pPlayer) { for (int i = 0; i < kMaxPowerUps; i++) { if (!VanillaMode() && (i == kPwUpJumpBoots || i == kPwUpDivingSuit || i == kPwUpCrystalBall || i == kPwUpBeastVision)) @@ -736,7 +736,7 @@ void playerResetPowerUps(BloodPlayer* pPlayer) } } -void playerResetPosture(BloodPlayer* pPlayer) { +void playerResetPosture(DBloodPlayer* pPlayer) { memcpy(pPlayer->pPosture, gPostureDefaults, sizeof(gPostureDefaults)); if (!VanillaMode()) { pPlayer->bobPhase = 0; @@ -757,7 +757,7 @@ void playerResetPosture(BloodPlayer* pPlayer) { void playerStart(int nPlayer, int bNewLevel) { - BloodPlayer* pPlayer = getPlayer(nPlayer); + DBloodPlayer* pPlayer = getPlayer(nPlayer); InputPacket* pInput = &pPlayer->cmd.ucmd; ZONE* pStartZone = NULL; @@ -916,7 +916,7 @@ void playerStart(int nPlayer, int bNewLevel) // //--------------------------------------------------------------------------- -void playerReset(BloodPlayer* pPlayer) +void playerReset(DBloodPlayer* pPlayer) { static int dword_136400[] = { 3, 4, 2, 8, 9, 10, 7, 1, 1, 1, 1, 1, 1, 1 @@ -980,9 +980,9 @@ int team_ticker[8]; void playerInit(int nPlayer, unsigned int a2) { if (!(a2 & 1)) - *getPlayer(nPlayer) = {}; + getPlayer(nPlayer)->Clear(); - BloodPlayer* pPlayer = getPlayer(nPlayer); + DBloodPlayer* pPlayer = getPlayer(nPlayer); pPlayer->pnum = nPlayer; pPlayer->teamId = nPlayer; if (gGameOptions.nGameType == 3) @@ -1002,7 +1002,7 @@ void playerInit(int nPlayer, unsigned int a2) // //--------------------------------------------------------------------------- -bool findDroppedLeech(BloodPlayer* a1, DBloodActor* a2) +bool findDroppedLeech(DBloodPlayer* a1, DBloodActor* a2) { BloodStatIterator it(kStatThing); while (auto actor = it.Next()) @@ -1021,7 +1021,7 @@ bool findDroppedLeech(BloodPlayer* a1, DBloodActor* a2) // //--------------------------------------------------------------------------- -bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor) +bool PickupItem(DBloodPlayer* pPlayer, DBloodActor* itemactor) { char buffer[80]; int pickupSnd = 775; @@ -1254,7 +1254,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor) // //--------------------------------------------------------------------------- -bool PickupAmmo(BloodPlayer* pPlayer, DBloodActor* ammoactor) +bool PickupAmmo(DBloodPlayer* pPlayer, DBloodActor* ammoactor) { const AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[ammoactor->spr.type - kItemAmmoBase]; int nAmmoType = pAmmoItemData->type; @@ -1278,7 +1278,7 @@ bool PickupAmmo(BloodPlayer* pPlayer, DBloodActor* ammoactor) // //--------------------------------------------------------------------------- -bool PickupWeapon(BloodPlayer* pPlayer, DBloodActor* weaponactor) +bool PickupWeapon(DBloodPlayer* pPlayer, DBloodActor* weaponactor) { const WEAPONITEMDATA* pWeaponItemData = &gWeaponItemData[weaponactor->spr.type - kItemWeaponBase]; int nWeaponType = pWeaponItemData->type; @@ -1323,7 +1323,7 @@ bool PickupWeapon(BloodPlayer* pPlayer, DBloodActor* weaponactor) // //--------------------------------------------------------------------------- -void PickUp(BloodPlayer* pPlayer, DBloodActor* actor) +void PickUp(DBloodPlayer* pPlayer, DBloodActor* actor) { const char* msg = nullptr; int nType = actor->spr.type; @@ -1374,7 +1374,7 @@ void PickUp(BloodPlayer* pPlayer, DBloodActor* actor) // //--------------------------------------------------------------------------- -void CheckPickUp(BloodPlayer* pPlayer) +void CheckPickUp(DBloodPlayer* pPlayer) { auto plActor = pPlayer->GetActor(); auto ppos = plActor->spr.pos; @@ -1415,7 +1415,7 @@ void CheckPickUp(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -int ActionScan(BloodPlayer* pPlayer, HitInfo* out) +int ActionScan(DBloodPlayer* pPlayer, HitInfo* out) { auto plActor = pPlayer->GetActor(); *out = {}; @@ -1507,7 +1507,7 @@ unsigned GameInterface::getCrouchState() // //--------------------------------------------------------------------------- -void ProcessInput(BloodPlayer* pPlayer) +void ProcessInput(DBloodPlayer* pPlayer) { enum { @@ -1762,7 +1762,7 @@ void ProcessInput(BloodPlayer* pPlayer) CheckPickUp(pPlayer); } -void playerProcess(BloodPlayer* pPlayer) +void playerProcess(DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; @@ -1890,12 +1890,12 @@ void playerProcess(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -DBloodActor* playerFireMissile(BloodPlayer* pPlayer, double xyoff, const DVector3& dv, int nType) +DBloodActor* playerFireMissile(DBloodPlayer* pPlayer, double xyoff, const DVector3& dv, int nType) { return actFireMissile(pPlayer->GetActor(), xyoff, pPlayer->zWeapon - pPlayer->GetActor()->spr.pos.Z, dv, nType); } -DBloodActor* playerFireThing(BloodPlayer* pPlayer, double xyoff, double zvel, int thingType, double nSpeed) +DBloodActor* playerFireThing(DBloodPlayer* pPlayer, double xyoff, double zvel, int thingType, double nSpeed) { return actFireThing(pPlayer->GetActor(), xyoff, pPlayer->zWeapon - pPlayer->GetActor()->spr.pos.Z, pPlayer->slope * 0.25 + zvel, thingType, nSpeed); } @@ -1906,7 +1906,7 @@ DBloodActor* playerFireThing(BloodPlayer* pPlayer, double xyoff, double zvel, in // //--------------------------------------------------------------------------- -void playerFrag(BloodPlayer* pKiller, BloodPlayer* pVictim) +void playerFrag(DBloodPlayer* pKiller, DBloodPlayer* pVictim) { assert(pKiller != NULL); assert(pVictim != NULL); @@ -1972,11 +1972,11 @@ void playerFrag(BloodPlayer* pKiller, BloodPlayer* pVictim) // //--------------------------------------------------------------------------- -void FragPlayer(BloodPlayer* pPlayer, DBloodActor* killer) +void FragPlayer(DBloodPlayer* pPlayer, DBloodActor* killer) { if (killer && killer->IsPlayerActor()) { - BloodPlayer* pKiller = getPlayer(killer->spr.type - kDudePlayer1); + DBloodPlayer* pKiller = getPlayer(killer->spr.type - kDudePlayer1); playerFrag(pKiller, pPlayer); int nTeam1 = pKiller->teamId & 1; int nTeam2 = pPlayer->teamId & 1; @@ -2003,7 +2003,7 @@ void FragPlayer(BloodPlayer* pPlayer, DBloodActor* killer) // //--------------------------------------------------------------------------- -int playerDamageArmor(BloodPlayer* pPlayer, DAMAGE_TYPE nType, int nDamage) +int playerDamageArmor(DBloodPlayer* pPlayer, DAMAGE_TYPE nType, int nDamage) { DAMAGEINFO* pDamageInfo = &damageInfo[nType]; int nArmorType = pDamageInfo->armorType; @@ -2030,7 +2030,7 @@ int playerDamageArmor(BloodPlayer* pPlayer, DAMAGE_TYPE nType, int nDamage) // //--------------------------------------------------------------------------- -void flagDropped(BloodPlayer* pPlayer, int a2) +void flagDropped(DBloodPlayer* pPlayer, int a2) { DBloodActor* playeractor = pPlayer->GetActor(); DBloodActor* actor; @@ -2064,7 +2064,7 @@ void flagDropped(BloodPlayer* pPlayer, int a2) // //--------------------------------------------------------------------------- -int playerDamageSprite(DBloodActor* source, BloodPlayer* pPlayer, DAMAGE_TYPE nDamageType, int nDamage) +int playerDamageSprite(DBloodActor* source, DBloodPlayer* pPlayer, DAMAGE_TYPE nDamageType, int nDamage) { assert(pPlayer != NULL); if (pPlayer->damageControl[nDamageType] || pPlayer->godMode) @@ -2232,7 +2232,7 @@ int playerDamageSprite(DBloodActor* source, BloodPlayer* pPlayer, DAMAGE_TYPE nD // //--------------------------------------------------------------------------- -int UseAmmo(BloodPlayer* pPlayer, int nAmmoType, int nDec) +int UseAmmo(DBloodPlayer* pPlayer, int nAmmoType, int nDec) { if (gInfiniteAmmo) return 9999; @@ -2248,7 +2248,7 @@ int UseAmmo(BloodPlayer* pPlayer, int nAmmoType, int nDec) // //--------------------------------------------------------------------------- -void voodooTarget(BloodPlayer* pPlayer) +void voodooTarget(DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); double aimz = pPlayer->aim.Z; @@ -2275,7 +2275,7 @@ void voodooTarget(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void playerLandingSound(BloodPlayer* pPlayer) +void playerLandingSound(DBloodPlayer* pPlayer) { static int surfaceSound[] = { -1, @@ -2320,7 +2320,7 @@ void PlayerSurvive(int, DBloodActor* actor) sfxPlay3DSound(actor, 3009, 0, 6); if (actor->IsPlayerActor()) { - BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); + DBloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1); if (pPlayer->pnum == myconnectindex) viewSetMessage(GStrings("TXT_LIVEAGAIM")); else @@ -2345,7 +2345,7 @@ void PlayerKneelsOver(int, DBloodActor* actor) { if (getPlayer(p)->GetActor() == actor) { - BloodPlayer* pPlayer = getPlayer(p); + DBloodPlayer* pPlayer = getPlayer(p); playerDamageSprite(pPlayer->fragger, pPlayer, kDamageSpirit, 500 << 4); return; } @@ -2394,7 +2394,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, POSTURE& w, POSTUR return arc; } -FSerializer& Serialize(FSerializer& arc, const char* keyname, BloodPlayer& w, BloodPlayer* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, DBloodPlayer& w, DBloodPlayer* def) { if (arc.BeginObject(keyname)) { @@ -2562,76 +2562,77 @@ void SerializePlayers(FSerializer& arc) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, newWeapon) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, weaponQav) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, qavCallback) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, isRunning) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, posture) // stand, crouch, swim -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, sceneQav) // by NoOne: used to keep qav id -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, bobPhase) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, bobAmp) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, bobHeight) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, bobWidth) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, swayAmp) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, swayHeight) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, swayWidth) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, pnum) // Connect id -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, lifeMode) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, zView) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, zViewVel) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, zWeapon) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, zWeaponVel) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, slope) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, isUnderwater) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, hasKey) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, hasFlag) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, damageControl) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, curWeapon) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, nextWeapon) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, weaponTimer) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, weaponState) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, weaponAmmo) //rename -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, hasWeapon) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, weaponMode) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, weaponOrder) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, ammoCount) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, qavLoop) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, fuseTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, throwTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, throwPower) -//DEFINE_FIELD_X(BloodPlayer, PLAYER, aim) // world -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, aimTargetsCount) -//DEFINE_FIELD_X(BloodPlayer, PLAYER, aimTargets) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, deathTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, pwUpTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, teamId) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, fragCount) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, fragInfo) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, underwaterTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, bubbleTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, restTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, kickPower) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, laughCount) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, godMode) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, fallScream) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, cantJump) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, packItemTime) // pack timer -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, packItemId) // pack id 1: diving suit, 2: crystal ball, 3: -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, packSlots) // at325 1]: diving suit, [2]: crystal ball, -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, armor) // armor -//DEFINE_FIELD_X(BloodPlayer, PLAYER, voodooTarget) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, flickerEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, tiltEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, visibility) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, painEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, blindEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, chokeEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, handTime) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, hand) // if true, there is hand start choking the player -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, pickupEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, flashEffect) // if true, reduce pPlayer->visibility counter -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, quakeEffect) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, player_par) -DEFINE_FIELD_X(BloodPlayer, BloodPlayer, nWaterPal) +DEFINE_FIELD(DBloodPlayer, actor) +DEFINE_FIELD(DBloodPlayer, newWeapon) +DEFINE_FIELD(DBloodPlayer, weaponQav) +DEFINE_FIELD(DBloodPlayer, qavCallback) +DEFINE_FIELD(DBloodPlayer, isRunning) +DEFINE_FIELD(DBloodPlayer, posture) // stand, crouch, swim +DEFINE_FIELD(DBloodPlayer, sceneQav) // by NoOne: used to keep qav id +DEFINE_FIELD(DBloodPlayer, bobPhase) +DEFINE_FIELD(DBloodPlayer, bobAmp) +DEFINE_FIELD(DBloodPlayer, bobHeight) +DEFINE_FIELD(DBloodPlayer, bobWidth) +DEFINE_FIELD(DBloodPlayer, swayAmp) +DEFINE_FIELD(DBloodPlayer, swayHeight) +DEFINE_FIELD(DBloodPlayer, swayWidth) +DEFINE_FIELD(DBloodPlayer, pnum) // Connect id +DEFINE_FIELD(DBloodPlayer, lifeMode) +DEFINE_FIELD(DBloodPlayer, zView) +DEFINE_FIELD(DBloodPlayer, zViewVel) +DEFINE_FIELD(DBloodPlayer, zWeapon) +DEFINE_FIELD(DBloodPlayer, zWeaponVel) +DEFINE_FIELD(DBloodPlayer, slope) +DEFINE_FIELD(DBloodPlayer, isUnderwater) +DEFINE_FIELD(DBloodPlayer, hasKey) +DEFINE_FIELD(DBloodPlayer, hasFlag) +DEFINE_FIELD(DBloodPlayer, damageControl) +DEFINE_FIELD(DBloodPlayer, curWeapon) +DEFINE_FIELD(DBloodPlayer, nextWeapon) +DEFINE_FIELD(DBloodPlayer, weaponTimer) +DEFINE_FIELD(DBloodPlayer, weaponState) +DEFINE_FIELD(DBloodPlayer, weaponAmmo) //rename +DEFINE_FIELD(DBloodPlayer, hasWeapon) +DEFINE_FIELD(DBloodPlayer, weaponMode) +DEFINE_FIELD(DBloodPlayer, weaponOrder) +DEFINE_FIELD(DBloodPlayer, ammoCount) +DEFINE_FIELD(DBloodPlayer, qavLoop) +DEFINE_FIELD(DBloodPlayer, fuseTime) +DEFINE_FIELD(DBloodPlayer, throwTime) +DEFINE_FIELD(DBloodPlayer, throwPower) +//DEFINE_FIELD(DBloodPlayer, aim) // world +DEFINE_FIELD(DBloodPlayer, aimTargetsCount) +//DEFINE_FIELD(DBloodPlayer, aimTargets) +DEFINE_FIELD(DBloodPlayer, deathTime) +DEFINE_FIELD(DBloodPlayer, pwUpTime) +DEFINE_FIELD(DBloodPlayer, teamId) +DEFINE_FIELD(DBloodPlayer, fragCount) +DEFINE_FIELD(DBloodPlayer, fragInfo) +DEFINE_FIELD(DBloodPlayer, underwaterTime) +DEFINE_FIELD(DBloodPlayer, bubbleTime) +DEFINE_FIELD(DBloodPlayer, restTime) +DEFINE_FIELD(DBloodPlayer, kickPower) +DEFINE_FIELD(DBloodPlayer, laughCount) +DEFINE_FIELD(DBloodPlayer, godMode) +DEFINE_FIELD(DBloodPlayer, fallScream) +DEFINE_FIELD(DBloodPlayer, cantJump) +DEFINE_FIELD(DBloodPlayer, packItemTime) // pack timer +DEFINE_FIELD(DBloodPlayer, packItemId) // pack id 1: diving suit, 2: crystal ball, 3: +DEFINE_FIELD(DBloodPlayer, packSlots) // at325 1]: diving suit, [2]: crystal ball, +DEFINE_FIELD(DBloodPlayer, armor) // armor +//DEFINE_FIELD(DBloodPlayer, voodooTarget) +DEFINE_FIELD(DBloodPlayer, flickerEffect) +DEFINE_FIELD(DBloodPlayer, tiltEffect) +DEFINE_FIELD(DBloodPlayer, visibility) +DEFINE_FIELD(DBloodPlayer, painEffect) +DEFINE_FIELD(DBloodPlayer, blindEffect) +DEFINE_FIELD(DBloodPlayer, chokeEffect) +DEFINE_FIELD(DBloodPlayer, handTime) +DEFINE_FIELD(DBloodPlayer, hand) // if true, there is hand start choking the player +DEFINE_FIELD(DBloodPlayer, pickupEffect) +DEFINE_FIELD(DBloodPlayer, flashEffect) // if true, reduce pPlayer->visibility counter +DEFINE_FIELD(DBloodPlayer, quakeEffect) +DEFINE_FIELD(DBloodPlayer, player_par) +DEFINE_FIELD(DBloodPlayer, nWaterPal) END_BLD_NS diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index 6c5470648..36cc82bb3 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -78,7 +78,7 @@ struct POSTURE extern POSTURE gPostureDefaults[kModeMax][kPostureMax]; -struct BloodPlayer; +class DBloodPlayer; struct AMMOINFO { @@ -95,7 +95,7 @@ struct POWERUPINFO FTextureID textureID() const { return tileGetTextureID(picno); } }; -void playerResetPosture(BloodPlayer* pPlayer); +void playerResetPosture(DBloodPlayer* pPlayer); extern bool gBlueFlagDropped; extern bool gRedFlagDropped; @@ -105,40 +105,40 @@ extern int team_ticker[kMaxPlayers]; extern AMMOINFO gAmmoInfo[]; extern POWERUPINFO gPowerUpInfo[kMaxPowerUps]; -bool IsTargetTeammate(BloodPlayer* pSourcePlayer, DBloodActor* target); -int powerupCheck(BloodPlayer* pPlayer, int nPowerUp); -bool powerupActivate(BloodPlayer* pPlayer, int nPowerUp); -void powerupDeactivate(BloodPlayer* pPlayer, int nPowerUp); -void powerupSetState(BloodPlayer* pPlayer, int nPowerUp, bool bState); -void powerupProcess(BloodPlayer* pPlayer); -void powerupClear(BloodPlayer* pPlayer); +bool IsTargetTeammate(DBloodPlayer* pSourcePlayer, DBloodActor* target); +int powerupCheck(DBloodPlayer* pPlayer, int nPowerUp); +bool powerupActivate(DBloodPlayer* pPlayer, int nPowerUp); +void powerupDeactivate(DBloodPlayer* pPlayer, int nPowerUp); +void powerupSetState(DBloodPlayer* pPlayer, int nPowerUp, bool bState); +void powerupProcess(DBloodPlayer* pPlayer); +void powerupClear(DBloodPlayer* pPlayer); int packItemToPowerup(int nPack); int powerupToPackItem(int nPowerUp); -bool packAddItem(BloodPlayer* pPlayer, unsigned int nPack); -int packCheckItem(BloodPlayer* pPlayer, int nPack); -bool packItemActive(BloodPlayer* pPlayer, int nPack); -void packUseItem(BloodPlayer* pPlayer, int nPack); -void packPrevItem(BloodPlayer* pPlayer); -void packNextItem(BloodPlayer* pPlayer); -bool playerSeqPlaying(BloodPlayer* pPlayer, int nSeq); -void playerSetRace(BloodPlayer* pPlayer, int nLifeMode); -void playerSetGodMode(BloodPlayer* pPlayer, bool bGodMode); -void playerResetInertia(BloodPlayer* pPlayer); -void playerCorrectInertia(BloodPlayer* pPlayer, const DVector3& oldpos); +bool packAddItem(DBloodPlayer* pPlayer, unsigned int nPack); +int packCheckItem(DBloodPlayer* pPlayer, int nPack); +bool packItemActive(DBloodPlayer* pPlayer, int nPack); +void packUseItem(DBloodPlayer* pPlayer, int nPack); +void packPrevItem(DBloodPlayer* pPlayer); +void packNextItem(DBloodPlayer* pPlayer); +bool playerSeqPlaying(DBloodPlayer* pPlayer, int nSeq); +void playerSetRace(DBloodPlayer* pPlayer, int nLifeMode); +void playerSetGodMode(DBloodPlayer* pPlayer, bool bGodMode); +void playerResetInertia(DBloodPlayer* pPlayer); +void playerCorrectInertia(DBloodPlayer* pPlayer, const DVector3& oldpos); void playerStart(int nPlayer, int bNewLevel = 0); -void playerReset(BloodPlayer* pPlayer); +void playerReset(DBloodPlayer* pPlayer); void playerInit(int nPlayer, unsigned int a2); -void CheckPickUp(BloodPlayer* pPlayer); -void ProcessInput(BloodPlayer* pPlayer); -void playerProcess(BloodPlayer* pPlayer); -DBloodActor* playerFireMissile(BloodPlayer* pPlayer, double xyoff, const DVector3& vec, int nType); -DBloodActor* playerFireThing(BloodPlayer* pPlayer, double xyoff, double zvel, int thingType, double nSpeed); -void playerFrag(BloodPlayer* pKiller, BloodPlayer* pVictim); -int playerDamageArmor(BloodPlayer* pPlayer, DAMAGE_TYPE nType, int nDamage); -int playerDamageSprite(DBloodActor* nSource, BloodPlayer* pPlayer, DAMAGE_TYPE nDamageType, int nDamage); -int UseAmmo(BloodPlayer* pPlayer, int nAmmoType, int nDec); -void voodooTarget(BloodPlayer* pPlayer); -void playerLandingSound(BloodPlayer* pPlayer); +void CheckPickUp(DBloodPlayer* pPlayer); +void ProcessInput(DBloodPlayer* pPlayer); +void playerProcess(DBloodPlayer* pPlayer); +DBloodActor* playerFireMissile(DBloodPlayer* pPlayer, double xyoff, const DVector3& vec, int nType); +DBloodActor* playerFireThing(DBloodPlayer* pPlayer, double xyoff, double zvel, int thingType, double nSpeed); +void playerFrag(DBloodPlayer* pKiller, DBloodPlayer* pVictim); +int playerDamageArmor(DBloodPlayer* pPlayer, DAMAGE_TYPE nType, int nDamage); +int playerDamageSprite(DBloodActor* nSource, DBloodPlayer* pPlayer, DAMAGE_TYPE nDamageType, int nDamage); +int UseAmmo(DBloodPlayer* pPlayer, int nAmmoType, int nDec); +void voodooTarget(DBloodPlayer* pPlayer); +void playerLandingSound(DBloodPlayer* pPlayer); void PlayerSurvive(int, DBloodActor*); END_BLD_NS diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index d621d6eb8..d7e66e168 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -void fakePlayerProcess(BloodPlayer* pPlayer, InputPacket* pInput); +void fakePlayerProcess(DBloodPlayer* pPlayer, InputPacket* pInput); void fakeActProcessSprites(void); bool gPrediction = true; @@ -98,7 +98,7 @@ void viewUpdatePrediction(InputPacket* pInput) #endif } -static void fakeProcessInput(BloodPlayer* pPlayer, InputPacket* pInput) +static void fakeProcessInput(DBloodPlayer* pPlayer, InputPacket* pInput) { #if 0 POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][predict.posture]; @@ -253,7 +253,7 @@ static void fakeProcessInput(BloodPlayer* pPlayer, InputPacket* pInput) #endif } -void fakePlayerProcess(BloodPlayer* pPlayer, InputPacket* pInput) +void fakePlayerProcess(DBloodPlayer* pPlayer, InputPacket* pInput) { #if 0 auto pSprite = pPlayer->actor; diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index a1357a3bb..c2817b198 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -227,7 +227,7 @@ void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double // //--------------------------------------------------------------------------- -void QAV::Play(int start, int end, int nCallback, BloodPlayer* pData) +void QAV::Play(int start, int end, int nCallback, DBloodPlayer* pData) { auto pActor = pData ? pData->GetActor() : nullptr; assert(ticksPerFrame > 0); @@ -326,7 +326,7 @@ void qavProcessTicker(QAV* const pQAV, int* duration, int* lastTick) // //--------------------------------------------------------------------------- -void qavProcessTimer(BloodPlayer* const pPlayer, QAV* const pQAV, int* duration, double* interpfrac, bool const fixedduration, bool const ignoreWeaponTimer) +void qavProcessTimer(DBloodPlayer* const pPlayer, QAV* const pQAV, int* duration, double* interpfrac, bool const fixedduration, bool const ignoreWeaponTimer) { // Process clock based on QAV's ticrate and last tick value. if (!paused) diff --git a/source/games/blood/src/qav.h b/source/games/blood/src/qav.h index 8d4257ac2..a251fce42 100644 --- a/source/games/blood/src/qav.h +++ b/source/games/blood/src/qav.h @@ -230,13 +230,13 @@ struct QAV uint16_t res_id; FRAMEINFO frames[1]; // 24 void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const interpfrac, DAngle angle = nullAngle); - void Play(int, int, int, BloodPlayer*); + void Play(int, int, int, DBloodPlayer*); void Precache(int palette = 0); }; QAV* getQAV(int res_id); void qavProcessTicker(QAV* const pQAV, int* duration, int* lastTick); -void qavProcessTimer(BloodPlayer* const pPlayer, QAV* const pQAV, int* duration, double* interpfrac, bool const fixedduration = false, bool const ignoreWeaponTimer = false); +void qavProcessTimer(DBloodPlayer* const pPlayer, QAV* const pQAV, int* duration, double* interpfrac, bool const fixedduration = false, bool const ignoreWeaponTimer = false); inline bool qavIsOriginal(const int res_id) { diff --git a/source/games/blood/src/sbar.cpp b/source/games/blood/src/sbar.cpp index ee04ca48e..3ac223357 100644 --- a/source/games/blood/src/sbar.cpp +++ b/source/games/blood/src/sbar.cpp @@ -73,7 +73,7 @@ static void UpdateFrame(void) // //--------------------------------------------------------------------------- -void UpdateStatusBar(BloodPlayer* pPlayer) +void UpdateStatusBar(DBloodPlayer* pPlayer) { if (automapMode == am_off && hud_size <= Hud_Stbar) { diff --git a/source/games/blood/src/sfx.cpp b/source/games/blood/src/sfx.cpp index d11c0ee3d..f819470e2 100644 --- a/source/games/blood/src/sfx.cpp +++ b/source/games/blood/src/sfx.cpp @@ -63,7 +63,7 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3 { if (pos != nullptr && type != SOURCE_None) { - BloodPlayer* pPlayer = getPlayer(myconnectindex); + DBloodPlayer* pPlayer = getPlayer(myconnectindex); FVector3 camera; if (pPlayer && pPlayer->GetActor()) camera = GetSoundPos(pPlayer->GetActor()->spr.pos); @@ -105,7 +105,7 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3 void GameInterface::UpdateSounds() { - BloodPlayer* pPlayer = getPlayer(myconnectindex); + DBloodPlayer* pPlayer = getPlayer(myconnectindex); SoundListener listener; if (pPlayer->GetActor()) diff --git a/source/games/blood/src/sound.h b/source/games/blood/src/sound.h index 34779fa0b..0fa681801 100644 --- a/source/games/blood/src/sound.h +++ b/source/games/blood/src/sound.h @@ -36,7 +36,7 @@ void sfxKillAllSounds(void); void sfxSetReverb(bool toggle); void sfxSetReverb2(bool toggle); -void ambProcess(BloodPlayer* pPlayer); +void ambProcess(DBloodPlayer* pPlayer); void ambKillAll(void); void ambInit(void); diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index db30e1a95..d93fdfda9 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -237,7 +237,7 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event) int nPlayer = actor->xspr.data4; if (nPlayer >= 0 && nPlayer < kMaxPlayers && playeringame[nPlayer]) { - BloodPlayer* pPlayer = getPlayer(nPlayer); + DBloodPlayer* pPlayer = getPlayer(nPlayer); if (pPlayer->GetActor()->xspr.health > 0) { evKillActor(actor); @@ -598,7 +598,7 @@ void OperateSprite(DBloodActor* actor, EVENT event) case kSoundPlayer: if (gGameOptions.nGameType == 0) { - BloodPlayer* pPlayer = getPlayer(myconnectindex); + DBloodPlayer* pPlayer = getPlayer(myconnectindex); if (pPlayer->GetActor()->xspr.health <= 0) break; @@ -1596,7 +1596,7 @@ void OperateTeleport(sectortype* pSector) { if (actor->spr.statnum == kStatDude) { - BloodPlayer* pPlayer; + DBloodPlayer* pPlayer; bool bPlayer = actor->IsPlayerActor(); if (bPlayer) pPlayer = getPlayer(actor->spr.type - kDudePlayer1); diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 8be43a403..cff8a1626 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -58,7 +58,7 @@ int gViewIndex; void viewBackupView(int nPlayer) { - BloodPlayer* pPlayer = getPlayer(nPlayer); + DBloodPlayer* pPlayer = getPlayer(nPlayer); pPlayer->ozView = pPlayer->zView; pPlayer->ozWeapon = pPlayer->zWeapon - pPlayer->zView - 12; pPlayer->obobHeight = pPlayer->bobHeight; @@ -100,7 +100,7 @@ void viewDrawText(FFont* pFont, const char* pString, int x, int y, int nShade, i // //--------------------------------------------------------------------------- -void viewDrawAimedPlayerName(BloodPlayer* pPlayer) +void viewDrawAimedPlayerName(DBloodPlayer* pPlayer) { if (!cl_idplayers || (pPlayer->aim.XY().isZero())) return; @@ -280,7 +280,7 @@ void UpdateDacs(int nPalette, bool bNoTint) // //--------------------------------------------------------------------------- -void UpdateBlend(BloodPlayer* pPlayer) +void UpdateBlend(DBloodPlayer* pPlayer) { int nRed = 0; int nGreen = 0; @@ -324,7 +324,7 @@ int gShowFrameRate = 1; // //--------------------------------------------------------------------------- -void viewUpdateDelirium(BloodPlayer* pPlayer) +void viewUpdateDelirium(DBloodPlayer* pPlayer) { gScreenTiltO = gScreenTilt; deliriumTurnO = deliriumTurn; @@ -371,7 +371,7 @@ void viewUpdateDelirium(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void viewUpdateShake(BloodPlayer* pPlayer, DVector3& cPos, DRotator& cAngles, double& pshakeX, double& pshakeY) +void viewUpdateShake(DBloodPlayer* pPlayer, DVector3& cPos, DRotator& cAngles, double& pshakeX, double& pshakeY) { auto doEffect = [&](const int& effectType) { @@ -404,7 +404,7 @@ int32_t g_frameRate; // //--------------------------------------------------------------------------- -static void DrawMap(BloodPlayer* pPlayer, const double interpfrac) +static void DrawMap(DBloodPlayer* pPlayer, const double interpfrac) { int tm = 0; if (viewport3d.Left() > 0) @@ -423,7 +423,7 @@ static void DrawMap(BloodPlayer* pPlayer, const double interpfrac) // //--------------------------------------------------------------------------- -static void SetupView(BloodPlayer* pPlayer, DVector3& cPos, DRotator& cAngles, sectortype*& pSector, double& zDelta, double& shakeX, double& shakeY, const double interpfrac) +static void SetupView(DBloodPlayer* pPlayer, DVector3& cPos, DRotator& cAngles, sectortype*& pSector, double& zDelta, double& shakeX, double& shakeY, const double interpfrac) { double bobWidth, bobHeight; @@ -558,7 +558,7 @@ void renderCrystalBall() void viewDrawScreen(bool sceneonly) { - BloodPlayer* pPlayer = getPlayer(gViewIndex); + DBloodPlayer* pPlayer = getPlayer(gViewIndex); FireProcess(); diff --git a/source/games/blood/src/view.h b/source/games/blood/src/view.h index 0a98bb3c2..d5afbea9b 100644 --- a/source/games/blood/src/view.h +++ b/source/games/blood/src/view.h @@ -73,13 +73,13 @@ extern DAngle gScreenTiltO, gScreenTilt; extern int gShowFrameRate; extern int gLastPal; -void hudDraw(BloodPlayer* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, DAngle angle, int basepal, double interpfrac); +void hudDraw(DBloodPlayer* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, DAngle angle, int basepal, double interpfrac); void viewInitializePrediction(void); void viewUpdatePrediction(InputPacket* pInput); void viewCorrectPrediction(void); void viewBackupView(int nPlayer); void InitStatusBar(void); -void UpdateStatusBar(BloodPlayer* pPlayer); +void UpdateStatusBar(DBloodPlayer* pPlayer); void viewInit(void); void viewprocessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth); void viewSetMessage(const char* pMessage, const char* color = nullptr, const MESSAGE_PRIORITY priority = MESSAGE_PRIORITY_NORMAL); @@ -89,7 +89,7 @@ void viewSetErrorMessage(const char* pMessage); void DoLensEffect(void); void UpdateDacs(int nPalette, bool bNoTint = false); void viewDrawScreen(bool sceneonly = false); -void viewUpdateDelirium(BloodPlayer* pPlayer); +void viewUpdateDelirium(DBloodPlayer* pPlayer); void viewSetSystemMessage(const char* pMessage, ...); inline void viewInterpolateSector(sectortype* pSector) diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 7bf17782a..f545dec35 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -32,38 +32,38 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -void FirePitchfork(int, BloodPlayer* pPlayer); -void FireSpray(int, BloodPlayer* pPlayer); -void ThrowCan(int, BloodPlayer* pPlayer); -void DropCan(int, BloodPlayer* pPlayer); -void ExplodeCan(int, BloodPlayer* pPlayer); -void ThrowBundle(int, BloodPlayer* pPlayer); -void DropBundle(int, BloodPlayer* pPlayer); -void ExplodeBundle(int, BloodPlayer* pPlayer); -void ThrowProx(int, BloodPlayer* pPlayer); -void DropProx(int, BloodPlayer* pPlayer); -void ThrowRemote(int, BloodPlayer* pPlayer); -void DropRemote(int, BloodPlayer* pPlayer); -void FireRemote(int, BloodPlayer* pPlayer); -void FireShotgun(int nTrigger, BloodPlayer* pPlayer); -void EjectShell(int, BloodPlayer* pPlayer); -void FireTommy(int nTrigger, BloodPlayer* pPlayer); -void FireSpread(int nTrigger, BloodPlayer* pPlayer); -void AltFireSpread(int nTrigger, BloodPlayer* pPlayer); -void AltFireSpread2(int nTrigger, BloodPlayer* pPlayer); -void FireFlare(int nTrigger, BloodPlayer* pPlayer); -void AltFireFlare(int nTrigger, BloodPlayer* pPlayer); -void FireVoodoo(int nTrigger, BloodPlayer* pPlayer); -void AltFireVoodoo(int nTrigger, BloodPlayer* pPlayer); -void DropVoodoo(int nTrigger, BloodPlayer* pPlayer); -void FireTesla(int nTrigger, BloodPlayer* pPlayer); -void AltFireTesla(int nTrigger, BloodPlayer* pPlayer); -void FireNapalm(int nTrigger, BloodPlayer* pPlayer); -void FireNapalm2(int nTrigger, BloodPlayer* pPlayer); -void AltFireNapalm(int nTrigger, BloodPlayer* pPlayer); -void FireLifeLeech(int nTrigger, BloodPlayer* pPlayer); -void AltFireLifeLeech(int nTrigger, BloodPlayer* pPlayer); -void FireBeast(int nTrigger, BloodPlayer* pPlayer); +void FirePitchfork(int, DBloodPlayer* pPlayer); +void FireSpray(int, DBloodPlayer* pPlayer); +void ThrowCan(int, DBloodPlayer* pPlayer); +void DropCan(int, DBloodPlayer* pPlayer); +void ExplodeCan(int, DBloodPlayer* pPlayer); +void ThrowBundle(int, DBloodPlayer* pPlayer); +void DropBundle(int, DBloodPlayer* pPlayer); +void ExplodeBundle(int, DBloodPlayer* pPlayer); +void ThrowProx(int, DBloodPlayer* pPlayer); +void DropProx(int, DBloodPlayer* pPlayer); +void ThrowRemote(int, DBloodPlayer* pPlayer); +void DropRemote(int, DBloodPlayer* pPlayer); +void FireRemote(int, DBloodPlayer* pPlayer); +void FireShotgun(int nTrigger, DBloodPlayer* pPlayer); +void EjectShell(int, DBloodPlayer* pPlayer); +void FireTommy(int nTrigger, DBloodPlayer* pPlayer); +void FireSpread(int nTrigger, DBloodPlayer* pPlayer); +void AltFireSpread(int nTrigger, DBloodPlayer* pPlayer); +void AltFireSpread2(int nTrigger, DBloodPlayer* pPlayer); +void FireFlare(int nTrigger, DBloodPlayer* pPlayer); +void AltFireFlare(int nTrigger, DBloodPlayer* pPlayer); +void FireVoodoo(int nTrigger, DBloodPlayer* pPlayer); +void AltFireVoodoo(int nTrigger, DBloodPlayer* pPlayer); +void DropVoodoo(int nTrigger, DBloodPlayer* pPlayer); +void FireTesla(int nTrigger, DBloodPlayer* pPlayer); +void AltFireTesla(int nTrigger, DBloodPlayer* pPlayer); +void FireNapalm(int nTrigger, DBloodPlayer* pPlayer); +void FireNapalm2(int nTrigger, DBloodPlayer* pPlayer); +void AltFireNapalm(int nTrigger, DBloodPlayer* pPlayer); +void FireLifeLeech(int nTrigger, DBloodPlayer* pPlayer); +void AltFireLifeLeech(int nTrigger, DBloodPlayer* pPlayer); +void FireBeast(int nTrigger, DBloodPlayer* pPlayer); typedef void(*QAVTypeCast)(int, void*); @@ -146,12 +146,12 @@ enum // //--------------------------------------------------------------------------- -double getThrowPower(BloodPlayer* pPlayer) +double getThrowPower(DBloodPlayer* pPlayer) { return pPlayer->throwPower * 23.46666 + 6.4; } -void setThrowPower(BloodPlayer* pPlayer) +void setThrowPower(DBloodPlayer* pPlayer) { pPlayer->throwPower = min((PlayClock - pPlayer->throwTime) / 240., 1.); } @@ -162,7 +162,7 @@ void setThrowPower(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -bool checkLitSprayOrTNT(BloodPlayer* pPlayer) +bool checkLitSprayOrTNT(DBloodPlayer* pPlayer) { switch (pPlayer->curWeapon) { @@ -208,7 +208,7 @@ static bool BannedUnderwater(int nWeapon) // //--------------------------------------------------------------------------- -static bool CheckWeaponAmmo(BloodPlayer* pPlayer, int weapon, int ammotype, int count) +static bool CheckWeaponAmmo(DBloodPlayer* pPlayer, int weapon, int ammotype, int count) { if (gInfiniteAmmo) return 1; @@ -227,7 +227,7 @@ static bool CheckWeaponAmmo(BloodPlayer* pPlayer, int weapon, int ammotype, int // //--------------------------------------------------------------------------- -static bool CheckAmmo(BloodPlayer* pPlayer, int ammotype, int count) +static bool CheckAmmo(DBloodPlayer* pPlayer, int ammotype, int count) { if (gInfiniteAmmo) return 1; @@ -246,7 +246,7 @@ static bool CheckAmmo(BloodPlayer* pPlayer, int ammotype, int count) // //--------------------------------------------------------------------------- -static bool checkAmmo2(const BloodPlayer* pPlayer, int ammotype, int amount) +static bool checkAmmo2(const DBloodPlayer* pPlayer, int ammotype, int amount) { if (gInfiniteAmmo) return 1; @@ -261,7 +261,7 @@ static bool checkAmmo2(const BloodPlayer* pPlayer, int ammotype, int amount) // //--------------------------------------------------------------------------- -void SpawnBulletEject(BloodPlayer* pPlayer, double dist, int rdist) +void SpawnBulletEject(DBloodPlayer* pPlayer, double dist, int rdist) { POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; pPlayer->zView = pPlayer->GetActor()->spr.pos.Z - pPosture->eyeAboveZ; @@ -269,7 +269,7 @@ void SpawnBulletEject(BloodPlayer* pPlayer, double dist, int rdist) fxSpawnEjectingBrass(pPlayer->GetActor(), dz, dist, rdist); } -void SpawnShellEject(BloodPlayer* pPlayer, double dist, int rdist) +void SpawnShellEject(DBloodPlayer* pPlayer, double dist, int rdist) { POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; pPlayer->zView = pPlayer->GetActor()->spr.pos.Z - pPosture->eyeAboveZ; @@ -328,7 +328,7 @@ void WeaponPrecache() // //--------------------------------------------------------------------------- -void WeaponDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle) +void WeaponDraw(DBloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle) { assert(pPlayer != NULL); if (pPlayer->weaponQav == kQAVNone) @@ -357,7 +357,7 @@ void WeaponDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypos, int p // //--------------------------------------------------------------------------- -void WeaponPlay(BloodPlayer* pPlayer) +void WeaponPlay(DBloodPlayer* pPlayer) { assert(pPlayer != NULL); if (pPlayer->weaponQav == kQAVNone) @@ -373,7 +373,7 @@ void WeaponPlay(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -static void StartQAV(BloodPlayer* pPlayer, int nWeaponQAV, int callback = -1, bool looped = false) +static void StartQAV(DBloodPlayer* pPlayer, int nWeaponQAV, int callback = -1, bool looped = false) { assert(nWeaponQAV < kQAVEnd); auto res_id = qavGetCorrectID(nWeaponQAV); @@ -389,7 +389,7 @@ static void StartQAV(BloodPlayer* pPlayer, int nWeaponQAV, int callback = -1, bo pPlayer->weaponTimer -= 4; } -static void SetQAV(BloodPlayer* pPlayer, int nWeaponQAV) +static void SetQAV(DBloodPlayer* pPlayer, int nWeaponQAV) { assert(nWeaponQAV < kQAVEnd); pPlayer->weaponQav = qavGetCorrectID(nWeaponQAV); @@ -436,7 +436,7 @@ WEAPONTRACK gWeaponTrack[] = { // //--------------------------------------------------------------------------- -void UpdateAimVector(BloodPlayer* pPlayer) +void UpdateAimVector(DBloodPlayer* pPlayer) { assert(pPlayer != NULL); auto plActor = pPlayer->GetActor(); @@ -590,7 +590,7 @@ t_WeaponModes weaponModes[] = { { 0, -1 }, }; -void WeaponRaise(BloodPlayer* pPlayer) +void WeaponRaise(DBloodPlayer* pPlayer) { assert(pPlayer != NULL); int prevWeapon = pPlayer->curWeapon; @@ -746,7 +746,7 @@ void WeaponRaise(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void WeaponLower(BloodPlayer* pPlayer) +void WeaponLower(DBloodPlayer* pPlayer) { assert(pPlayer != NULL); if (checkLitSprayOrTNT(pPlayer)) @@ -939,7 +939,7 @@ void WeaponLower(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void WeaponUpdateState(BloodPlayer* pPlayer) +void WeaponUpdateState(DBloodPlayer* pPlayer) { static int lastWeapon = 0; static int lastState = 0; @@ -1162,7 +1162,7 @@ void WeaponUpdateState(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FirePitchfork(int, BloodPlayer* pPlayer) +void FirePitchfork(int, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); double r1 = Random2F(2000, 14); @@ -1178,7 +1178,7 @@ void FirePitchfork(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FireSpray(int, BloodPlayer* pPlayer) +void FireSpray(int, DBloodPlayer* pPlayer) { playerFireMissile(pPlayer, 0, pPlayer->aim, kMissileFlameSpray); UseAmmo(pPlayer, 6, 4); @@ -1194,7 +1194,7 @@ void FireSpray(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void ThrowCan(int, BloodPlayer* pPlayer) +void ThrowCan(int, DBloodPlayer* pPlayer) { sfxKill3DSound(pPlayer->GetActor(), -1, 441); double nSpeed = getThrowPower(pPlayer); @@ -1217,7 +1217,7 @@ void ThrowCan(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void DropCan(int, BloodPlayer* pPlayer) +void DropCan(int, DBloodPlayer* pPlayer) { sfxKill3DSound(pPlayer->GetActor(), -1, 441); auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0); @@ -1234,7 +1234,7 @@ void DropCan(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void ExplodeCan(int, BloodPlayer* pPlayer) +void ExplodeCan(int, DBloodPlayer* pPlayer) { sfxKill3DSound(pPlayer->GetActor(), -1, 441); auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0); @@ -1254,7 +1254,7 @@ void ExplodeCan(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void ThrowBundle(int, BloodPlayer* pPlayer) +void ThrowBundle(int, DBloodPlayer* pPlayer) { sfxKill3DSound(pPlayer->GetActor(), 16, -1); double nSpeed = getThrowPower(pPlayer); @@ -1277,7 +1277,7 @@ void ThrowBundle(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void DropBundle(int, BloodPlayer* pPlayer) +void DropBundle(int, DBloodPlayer* pPlayer) { sfxKill3DSound(pPlayer->GetActor(), 16, -1); auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0); @@ -1294,7 +1294,7 @@ void DropBundle(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void ExplodeBundle(int, BloodPlayer* pPlayer) +void ExplodeBundle(int, DBloodPlayer* pPlayer) { sfxKill3DSound(pPlayer->GetActor(), 16, -1); auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0); @@ -1314,7 +1314,7 @@ void ExplodeBundle(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void ThrowProx(int, BloodPlayer* pPlayer) +void ThrowProx(int, DBloodPlayer* pPlayer) { double nSpeed = getThrowPower(pPlayer); sfxPlay3DSound(pPlayer->GetActor(), 455, 1, 0); @@ -1333,7 +1333,7 @@ void ThrowProx(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void DropProx(int, BloodPlayer* pPlayer) +void DropProx(int, DBloodPlayer* pPlayer) { auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0); if (spawned) @@ -1349,7 +1349,7 @@ void DropProx(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void ThrowRemote(int, BloodPlayer* pPlayer) +void ThrowRemote(int, DBloodPlayer* pPlayer) { double nSpeed = getThrowPower(pPlayer); sfxPlay3DSound(pPlayer->GetActor(), 455, 1, 0); @@ -1368,7 +1368,7 @@ void ThrowRemote(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void DropRemote(int, BloodPlayer* pPlayer) +void DropRemote(int, DBloodPlayer* pPlayer) { auto spawned = playerFireThing(pPlayer, 0, 0, kThingArmedRemoteBomb, 0); if (spawned) @@ -1378,7 +1378,7 @@ void DropRemote(int, BloodPlayer* pPlayer) } } -void FireRemote(int, BloodPlayer* pPlayer) +void FireRemote(int, DBloodPlayer* pPlayer) { evSendGame(90 + (pPlayer->GetActor()->spr.type - kDudePlayer1), kCmdOn); } @@ -1391,7 +1391,7 @@ void FireRemote(int, BloodPlayer* pPlayer) enum { kMaxShotgunBarrels = 4 }; -void FireShotgun(int nTrigger, BloodPlayer* pPlayer) +void FireShotgun(int nTrigger, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); assert(nTrigger > 0 && nTrigger <= kMaxShotgunBarrels); @@ -1438,13 +1438,13 @@ void FireShotgun(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void EjectShell(int, BloodPlayer* pPlayer) +void EjectShell(int, DBloodPlayer* pPlayer) { SpawnShellEject(pPlayer, 25 / 16., 35); SpawnShellEject(pPlayer, 3, 35); } -void FireTommy(int nTrigger, BloodPlayer* pPlayer) +void FireTommy(int nTrigger, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); sfxPlay3DSound(pPlayer->GetActor(), 431, -1, 0); @@ -1490,7 +1490,7 @@ enum { kMaxSpread = 14 }; static constexpr DAngle DAngle10 = DAngle::fromDeg(10); static constexpr DAngle DAngle20 = DAngle::fromDeg(20); -void FireSpread(int nTrigger, BloodPlayer* pPlayer) +void FireSpread(int nTrigger, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); assert(nTrigger > 0 && nTrigger <= kMaxSpread); @@ -1518,7 +1518,7 @@ void FireSpread(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireSpread(int nTrigger, BloodPlayer* pPlayer) +void AltFireSpread(int nTrigger, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); assert(nTrigger > 0 && nTrigger <= kMaxSpread); @@ -1554,7 +1554,7 @@ void AltFireSpread(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireSpread2(int nTrigger, BloodPlayer* pPlayer) +void AltFireSpread2(int nTrigger, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); assert(nTrigger > 0 && nTrigger <= kMaxSpread); @@ -1612,7 +1612,7 @@ void AltFireSpread2(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FireFlare(int nTrigger, BloodPlayer* pPlayer) +void FireFlare(int nTrigger, DBloodPlayer* pPlayer) { auto plActor = pPlayer->GetActor(); double offset = 0; @@ -1638,7 +1638,7 @@ void FireFlare(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireFlare(int nTrigger, BloodPlayer* pPlayer) +void AltFireFlare(int nTrigger, DBloodPlayer* pPlayer) { auto plActor = pPlayer->GetActor(); double offset = 0; @@ -1664,7 +1664,7 @@ void AltFireFlare(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FireVoodoo(int nTrigger, BloodPlayer* pPlayer) +void FireVoodoo(int nTrigger, DBloodPlayer* pPlayer) { nTrigger--; DBloodActor* actor = pPlayer->GetActor(); @@ -1713,7 +1713,7 @@ void FireVoodoo(int nTrigger, BloodPlayer* pPlayer) int nDamage = actDamageSprite(actor, targetactor, kDamageSpirit, 11 << 4); if (targetactor->IsPlayerActor()) { - BloodPlayer* pOtherPlayer = getPlayer(targetactor->spr.type - kDudePlayer1); + DBloodPlayer* pOtherPlayer = getPlayer(targetactor->spr.type - kDudePlayer1); pOtherPlayer->blindEffect = 128; } UseAmmo(pPlayer, 9, nDamage / 4); @@ -1728,7 +1728,7 @@ void FireVoodoo(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireVoodoo(int nTrigger, BloodPlayer* pPlayer) +void AltFireVoodoo(int nTrigger, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); if (nTrigger == 2) { @@ -1756,7 +1756,7 @@ void AltFireVoodoo(int nTrigger, BloodPlayer* pPlayer) if (targetactor->IsPlayerActor()) { - BloodPlayer* pOtherPlayer = getPlayer(targetactor->spr.type - kDudePlayer1); + DBloodPlayer* pOtherPlayer = getPlayer(targetactor->spr.type - kDudePlayer1); if (!pOtherPlayer->godMode || !powerupCheck(pOtherPlayer, kPwUpDeathMask)) powerupActivate(pOtherPlayer, kPwUpDeliriumShroom); } @@ -1794,7 +1794,7 @@ void AltFireVoodoo(int nTrigger, BloodPlayer* pPlayer) UseAmmo(pPlayer, 9, nDamage); if (targetactor->IsPlayerActor()) { - BloodPlayer* pOtherPlayer = getPlayer(targetactor->spr.type - kDudePlayer1); + DBloodPlayer* pOtherPlayer = getPlayer(targetactor->spr.type - kDudePlayer1); if (!pOtherPlayer->godMode || !powerupCheck(pOtherPlayer, kPwUpDeathMask)) powerupActivate(pOtherPlayer, kPwUpDeliriumShroom); } @@ -1814,7 +1814,7 @@ void AltFireVoodoo(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void DropVoodoo(int, BloodPlayer* pPlayer) +void DropVoodoo(int, DBloodPlayer* pPlayer) { sfxPlay3DSound(pPlayer->GetActor(), 455, 2, 0); auto spawned = playerFireThing(pPlayer, 0, -4730 / 65536., kThingVoodooHead, 12.8); @@ -1850,7 +1850,7 @@ struct TeslaMissile // //--------------------------------------------------------------------------- -void FireTesla(int nTrigger, BloodPlayer* pPlayer) +void FireTesla(int nTrigger, DBloodPlayer* pPlayer) { TeslaMissile teslaMissile[6] = { @@ -1891,7 +1891,7 @@ void FireTesla(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireTesla(int, BloodPlayer* pPlayer) +void AltFireTesla(int, DBloodPlayer* pPlayer) { auto plActor = pPlayer->GetActor(); playerFireMissile(pPlayer, 0., pPlayer->aim, kMissileTeslaAlt); @@ -1907,7 +1907,7 @@ void AltFireTesla(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FireNapalm(int nTrigger, BloodPlayer* pPlayer) +void FireNapalm(int nTrigger, DBloodPlayer* pPlayer) { auto plActor = pPlayer->GetActor(); double offset = 0; @@ -1926,7 +1926,7 @@ void FireNapalm(int nTrigger, BloodPlayer* pPlayer) pPlayer->flashEffect = 1; } -void FireNapalm2(int, BloodPlayer* pPlayer) +void FireNapalm2(int, DBloodPlayer* pPlayer) { auto plActor = pPlayer->GetActor(); playerFireMissile(pPlayer, -7.5, pPlayer->aim, kMissileFireballNapalm); @@ -1942,7 +1942,7 @@ void FireNapalm2(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireNapalm(int, BloodPlayer* pPlayer) +void AltFireNapalm(int, DBloodPlayer* pPlayer) { auto missile = playerFireThing(pPlayer, 0, -4730 / 65536., kThingNapalmBall, 18.13333); if (missile) @@ -1964,7 +1964,7 @@ void AltFireNapalm(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FireLifeLeech(int nTrigger, BloodPlayer* pPlayer) +void FireLifeLeech(int nTrigger, DBloodPlayer* pPlayer) { if (!CheckAmmo(pPlayer, 8, 1)) return; @@ -1991,7 +1991,7 @@ void FireLifeLeech(int nTrigger, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void AltFireLifeLeech(int, BloodPlayer* pPlayer) +void AltFireLifeLeech(int, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); sfxPlay3DSound(pPlayer->GetActor(), 455, 2, 0); @@ -2030,7 +2030,7 @@ void AltFireLifeLeech(int, BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void FireBeast(int, BloodPlayer* pPlayer) +void FireBeast(int, DBloodPlayer* pPlayer) { DBloodActor* actor = pPlayer->GetActor(); double r1 = Random2F(2000, 14); @@ -2061,9 +2061,9 @@ static const uint8_t gWeaponUpgrade[][13] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, }; -int WeaponUpgrade(BloodPlayer* pPlayer, int newWeapon) +int WeaponUpgrade(DBloodPlayer* pPlayer, int newWeapon) { - int weaponswitch = WeaponSwitch(pPlayer - (BloodPlayer*)PlayerArray); + int weaponswitch = WeaponSwitch(pPlayer->pnum); int weapon = pPlayer->curWeapon; if (!checkLitSprayOrTNT(pPlayer) && (weaponswitch & 1) && (gWeaponUpgrade[pPlayer->curWeapon][newWeapon] || (weaponswitch & 2))) weapon = newWeapon; @@ -2079,7 +2079,7 @@ int WeaponUpgrade(BloodPlayer* pPlayer, int newWeapon) static const int OrderNext[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 1 }; static const int OrderPrev[] = { 12, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 }; -static int WeaponFindNext(BloodPlayer* pPlayer, int* a2, int bDir) +static int WeaponFindNext(DBloodPlayer* pPlayer, int* a2, int bDir) { int weapon = pPlayer->curWeapon; do @@ -2118,7 +2118,7 @@ static int WeaponFindNext(BloodPlayer* pPlayer, int* a2, int bDir) // //--------------------------------------------------------------------------- -static int WeaponFindLoaded(BloodPlayer* pPlayer, int* a2) +static int WeaponFindLoaded(DBloodPlayer* pPlayer, int* a2) { int v4 = 1; int v14 = 0; @@ -2165,7 +2165,7 @@ static int WeaponFindLoaded(BloodPlayer* pPlayer, int* a2) // //--------------------------------------------------------------------------- -int processSprayCan(BloodPlayer* pPlayer) +int processSprayCan(DBloodPlayer* pPlayer) { const char bUseShootAsThrow = !VanillaMode() && (pPlayer->cmd.ucmd.actions & SB_FIRE); switch (pPlayer->weaponState) @@ -2210,7 +2210,7 @@ int processSprayCan(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -static bool processTNT(BloodPlayer* pPlayer) +static bool processTNT(DBloodPlayer* pPlayer) { const char bUseShootAsThrow = !VanillaMode() && (pPlayer->cmd.ucmd.actions & SB_FIRE); switch (pPlayer->weaponState) @@ -2255,7 +2255,7 @@ static bool processTNT(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -static bool processProxy(BloodPlayer* pPlayer) +static bool processProxy(DBloodPlayer* pPlayer) { switch (pPlayer->weaponState) { @@ -2279,7 +2279,7 @@ static bool processProxy(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -static bool processRemote(BloodPlayer* pPlayer) +static bool processRemote(DBloodPlayer* pPlayer) { switch (pPlayer->weaponState) { @@ -2301,7 +2301,7 @@ static bool processRemote(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -static bool processLeech(BloodPlayer* pPlayer) +static bool processLeech(DBloodPlayer* pPlayer) { switch (pPlayer->weaponState) { @@ -2331,7 +2331,7 @@ static bool processLeech(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -static bool processTesla(BloodPlayer* pPlayer) +static bool processTesla(DBloodPlayer* pPlayer) { switch (pPlayer->weaponState) { @@ -2370,7 +2370,7 @@ static bool processTesla(BloodPlayer* pPlayer) // //--------------------------------------------------------------------------- -void WeaponProcess(BloodPlayer* pPlayer) { +void WeaponProcess(DBloodPlayer* pPlayer) { pPlayer->flashEffect = ClipLow(pPlayer->flashEffect - 1, 0); diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index f52c4d285..510c0911b 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -212,7 +212,7 @@ void RANDOMSCRAP(DDukeActor* origin) // //--------------------------------------------------------------------------- -void addammo(int weapon, DukePlayer* player, int amount) +void addammo(int weapon, DDukePlayer* player, int amount) { player->ammo_amount[weapon] += amount; @@ -226,7 +226,7 @@ void addammo(int weapon, DukePlayer* player, int amount) // //--------------------------------------------------------------------------- -void checkavailinven(DukePlayer* player) +void checkavailinven(DDukePlayer* player) { if (player->firstaid_amount > 0) @@ -252,7 +252,7 @@ void checkavailinven(DukePlayer* player) // //--------------------------------------------------------------------------- -void checkavailweapon(DukePlayer* player) +void checkavailweapon(DDukePlayer* player) { int i, snum; int weap; @@ -273,7 +273,7 @@ void checkavailweapon(DukePlayer* player) weap = player->curr_weapon; if (player->gotweapon[weap]) { - if (player->ammo_amount[weap] > 0 || (WeaponSwitch(player - (DukePlayer*)PlayerArray) & 2) == 0) + if (player->ammo_amount[weap] > 0 || (WeaponSwitch(player->pnum) & 2) == 0) return; } @@ -330,7 +330,7 @@ void checkavailweapon(DukePlayer* player) // //--------------------------------------------------------------------------- -void clearcamera(DukePlayer* ps) +void clearcamera(DDukePlayer* ps) { const auto pact = ps->GetActor(); ps->newOwner = nullptr; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 4c3ece0f3..ead3f7064 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -49,7 +49,7 @@ BEGIN_DUKE_NS // //--------------------------------------------------------------------------- -void addweapon_d(DukePlayer *p, int weapon, bool wswitch) +void addweapon_d(DDukePlayer *p, int weapon, bool wswitch) { if (p->gotweapon[weapon] == 0 ) { diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index 2e3b1d709..2d6d23257 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -453,7 +453,7 @@ void moveminecart(void) void thunder(void) { - DukePlayer* p; + DDukePlayer* p; int r1, r2; int i = 0; uint8_t shade; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 0cbd8faaa..9549a4f0e 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -42,7 +42,7 @@ void moveminecart(); // //--------------------------------------------------------------------------- -void addweapon_r(DukePlayer* p, int weapon, bool wswitch) +void addweapon_r(DDukePlayer* p, int weapon, bool wswitch) { int cw = p->curr_weapon; if (p->OnMotorcycle || p->OnBoat) @@ -819,7 +819,7 @@ void moveeffectors_r(void) //STATNUM 3 // //--------------------------------------------------------------------------- -void fakebubbaspawn(DDukeActor *actor, DukePlayer* p) +void fakebubbaspawn(DDukeActor *actor, DDukePlayer* p) { fakebubba_spawn++; switch (fakebubba_spawn) diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index a7dc84205..8357f5e20 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -39,18 +39,18 @@ void activatebysector_r(sectortype* sect, DDukeActor* j); void checksectors_d(int snum); void checksectors_r(int snum); -void addweapon_d(DukePlayer* p, int weapon, bool wswitch); -void addweapon_r(DukePlayer* p, int weapon, bool wswitch); +void addweapon_d(DDukePlayer* p, int weapon, bool wswitch); +void addweapon_r(DDukePlayer* p, int weapon, bool wswitch); int ifhitbyweapon_r(DDukeActor* sn); int ifhitbyweapon_d(DDukeActor* sn); -void incur_damage_d(DukePlayer* p); -void incur_damage_r(DukePlayer* p); +void incur_damage_d(DDukePlayer* p); +void incur_damage_r(DDukePlayer* p); void selectweapon_d(int snum, int j); void selectweapon_r(int snum, int j); -int doincrements_d(DukePlayer* p); -int doincrements_r(DukePlayer* p); -void checkweapons_d(DukePlayer* p); -void checkweapons_r(DukePlayer* p); +int doincrements_d(DDukePlayer* p); +int doincrements_r(DDukePlayer* p); +void checkweapons_d(DDukePlayer* p); +void checkweapons_r(DDukePlayer* p); void processinput_d(int snum); void processinput_r(int snum); void displayweapon_d(int snum, double interpfrac); diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 6b0dbf801..640e08f36 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -74,14 +74,14 @@ struct Dispatcher void (*activatebysector)(sectortype* sect, DDukeActor* j); void (*checksectors)(int low); - void (*addweapon)(DukePlayer *p, int weapon, bool wswitch); + void (*addweapon)(DDukePlayer *p, int weapon, bool wswitch); int (*ifhitbyweapon)(DDukeActor* sectnum); // player - void (*incur_damage)(DukePlayer* p); + void (*incur_damage)(DDukePlayer* p); void (*selectweapon)(int snum, int j); - int (*doincrements)(DukePlayer* p); - void (*checkweapons)(DukePlayer* p); + int (*doincrements)(DDukePlayer* p); + void (*checkweapons)(DDukePlayer* p); void (*processinput)(int snum); void (*displayweapon)(int snum, double interpfrac); void (*displaymasks)(int snum, int p, double interpfrac); @@ -98,18 +98,18 @@ void CallTick(DDukeActor* actor); bool CallOperate(DDukeActor* actor, int plnum); void CallAction(DDukeActor* actor); void checkhitsprite(DDukeActor* actor, DDukeActor* hitter); -void CallOnHurt(DDukeActor* actor, DukePlayer* hitter); -void CallOnTouch(DDukeActor* actor, DukePlayer* hitter); -bool CallOnUse(DDukeActor* actor, DukePlayer* user); -void CallOnMotoSmash(DDukeActor* actor, DukePlayer* hitter); +void CallOnHurt(DDukeActor* actor, DDukePlayer* hitter); +void CallOnTouch(DDukeActor* actor, DDukePlayer* hitter); +bool CallOnUse(DDukeActor* actor, DDukePlayer* user); +void CallOnMotoSmash(DDukeActor* actor, DDukePlayer* hitter); void CallOnRespawn(DDukeActor* actor, int low); bool CallAnimate(DDukeActor* actor, tspritetype* hitter); bool CallShootThis(DDukeActor* clsdef, DDukeActor* actor, int pn, const DVector3& spos, DAngle sang); void CallStaticSetup(DDukeActor* actor); void CallPlayFTASound(DDukeActor* actor, int mode = 0); -void CallStandingOn(DDukeActor* actor, DukePlayer* p); +void CallStandingOn(DDukeActor* actor, DDukePlayer* p); void CallRunState(DDukeActor* actor); -int CallTriggerSwitch(DDukeActor* actor, DukePlayer* p); +int CallTriggerSwitch(DDukeActor* actor, DDukePlayer* p); PClassActor* CallGetRadiusDamageType(DDukeActor* actor, int targhealth); diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index 6cd8c6582..5c506270c 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -9,12 +9,12 @@ using DukeStatIterator = TStatIterator; using DukeSectIterator = TSectIterator; using DukeSpriteIterator = TSpriteIterator; -inline DDukeActor* DukePlayer::GetActor() +inline DDukeActor* DDukePlayer::GetActor() { return static_cast(actor); } -inline int DukePlayer::GetPlayerNum() +inline int DDukePlayer::GetPlayerNum() { return GetActor()->PlayerIndex(); } diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 80691d935..8e6a17897 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -39,7 +39,7 @@ void operaterespawns(int low); void moveclouds(double interpfrac); void movefta(); -void clearcameras(DukePlayer* p); +void clearcameras(DDukePlayer* p); void RANDOMSCRAP(DDukeActor* i); void detonate(DDukeActor* i, PClassActor* explosion); void hitradius(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4); @@ -88,8 +88,8 @@ void handle_se130(DDukeActor* i, int countmax); int dodge(DDukeActor*); void alterang(int ang, DDukeActor* actor, int g_p); -void checkavailweapon(DukePlayer* p); -void addammo(int weapon, DukePlayer* p, int amount); +void checkavailweapon(DDukePlayer* p); +void addammo(int weapon, DDukePlayer* p, int amount); int ssp(DDukeActor* i, unsigned int cliptype); //The set sprite function void insertspriteq(DDukeActor *i); @@ -114,35 +114,35 @@ void playerAimDown(int snum, ESyncBits actions); DDukeActor* aim(DDukeActor* s, int aang, bool force = true, bool* b = nullptr); DDukeActor* aim_(DDukeActor* actor, DDukeActor* weapon, double aimangle, bool* b = nullptr); void shoot(DDukeActor* actor, PClass* cls); -void checkweapons(DukePlayer* const p); +void checkweapons(DDukePlayer* const p); int findotherplayer(int p, double* d); -void quickkill(DukePlayer* p); -int setpal(DukePlayer* p); +void quickkill(DDukePlayer* p); +int setpal(DDukePlayer* p); int madenoise(int playerNum); int haslock(sectortype* sect, int snum); -void purplelavacheck(DukePlayer* p); -void addphealth(DukePlayer* p, int amount, bool bigitem); -int playereat(DukePlayer* p, int amount, bool bigitem); -void playerdrink(DukePlayer* p, int amount); -int playeraddammo(DukePlayer* p, int weaponindex, int amount); -int playeraddweapon(DukePlayer* p, int weaponindex, int amount); -void playeraddinventory(DukePlayer* p, DDukeActor* item, int type, int amount); +void purplelavacheck(DDukePlayer* p); +void addphealth(DDukePlayer* p, int amount, bool bigitem); +int playereat(DDukePlayer* p, int amount, bool bigitem); +void playerdrink(DDukePlayer* p, int amount); +int playeraddammo(DDukePlayer* p, int weaponindex, int amount); +int playeraddweapon(DDukePlayer* p, int weaponindex, int amount); +void playeraddinventory(DDukePlayer* p, DDukeActor* item, int type, int amount); void actorsizeto(DDukeActor* actor, double x, double y); void spawndebris(DDukeActor* g_ac, int dnum, int count); -int checkp(DDukeActor* self, DukePlayer* p, int flags); -int playercheckinventory(DukePlayer* p, DDukeActor* item, int type, int amount); -void playerstomp(DukePlayer* p, DDukeActor* stomped); -void playerreset(DukePlayer* p, DDukeActor* g_ac); -void wackplayer(DukePlayer* p); +int checkp(DDukeActor* self, DDukePlayer* p, int flags); +int playercheckinventory(DDukePlayer* p, DDukeActor* item, int type, int amount); +void playerstomp(DDukePlayer* p, DDukeActor* stomped); +void playerreset(DDukePlayer* p, DDukeActor* g_ac); +void wackplayer(DDukePlayer* p); void actoroperate(DDukeActor* g_ac); -void playerkick(DukePlayer* p, DDukeActor* g_ac); +void playerkick(DDukePlayer* p, DDukeActor* g_ac); void garybanjo(DDukeActor* g_ac); int ifsquished(DDukeActor* i, int p); -void fakebubbaspawn(DDukeActor* actor, DukePlayer* p); +void fakebubbaspawn(DDukeActor* actor, DDukePlayer* p); void tearitup(sectortype* sect); void destroyit(DDukeActor* actor); void mamaspawn(DDukeActor* actor); -void forceplayerangle(DukePlayer* snum); +void forceplayerangle(DDukePlayer* snum); bool checkhitceiling(sectortype* sectp); @@ -156,7 +156,7 @@ void allignwarpelevators(void); bool isablockdoor(int tileNum); bool activatewarpelevators(DDukeActor* s, int w); int check_activator_motion(int lotag); -void operateactivators(int l, DukePlayer* w); +void operateactivators(int l, DDukePlayer* w); void operateforcefields(DDukeActor* s, int low); void operatemasterswitches(int lotag); void operatesectors(sectortype* s, DDukeActor* i); @@ -168,11 +168,11 @@ int setanimation(sectortype* animsect, int animtype, walltype* animtarget, doubl int setanimation(sectortype* animsect, int animtype, sectortype* animtarget, double thegoal, double thevel); void dofurniture(walltype* wallNum, sectortype* sectnum, int playerNum); void dotorch(); -double hitawall(DukePlayer* pl, walltype** hitWall); +double hitawall(DDukePlayer* pl, walltype** hitWall); double hits(DDukeActor* snum); DDukeActor* LocateTheLocator(int n, sectortype* sectnum); -void clearcamera(DukePlayer* ps); +void clearcamera(DDukePlayer* ps); void LoadActor(DDukeActor* i, int p, int x); bool execute(DDukeActor* s, int p, double d, int* killit_flag = nullptr); @@ -189,14 +189,14 @@ void ceilingglass(DDukeActor* snum, sectortype* sectnum, int cnt); void spriteglass(DDukeActor* snum, int cnt); void lotsofcolourglass(DDukeActor* snum, walltype* wallNum, int cnt); void lotsofglass(DDukeActor* snum, walltype* wal, int cnt); -void checkplayerhurt_d(DukePlayer* p, const Collision& coll); -void checkplayerhurt_r(DukePlayer* p, const Collision& coll); +void checkplayerhurt_d(DDukePlayer* p, const Collision& coll); +void checkplayerhurt_r(DDukePlayer* p, const Collision& coll); DDukeActor* dospawnsprite(DDukeActor* actj, int pn); void spriteinit(DDukeActor*, TArray& actors); DDukeActor* spawninit(DDukeActor* actj, DDukeActor* act, TArray* actors); -void checkavailinven(DukePlayer* p); +void checkavailinven(DDukePlayer* p); bool initspriteforspawn(DDukeActor* spn); void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell); void spawneffector(DDukeActor* actor, TArray* actors); @@ -204,18 +204,18 @@ int startrts(int lumpNum, int localPlayer); void pickrandomspot(int pn); void premapcontroller(DDukeActor* ac); -void resetinventory(DukePlayer* pn); +void resetinventory(DDukePlayer* pn); void resetplayerstats(int pn); -void resetweapons(DukePlayer* pn); +void resetweapons(DDukePlayer* pn); void resetprestat(int snum, int g); void prelevel_common(int g); void cacheit(); -void FTA(int q, DukePlayer* p); -void OnMotorcycle(DukePlayer *pl); -void OffMotorcycle(DukePlayer *pl); -void OnBoat(DukePlayer *pl); -void OffBoat(DukePlayer *pl); +void FTA(int q, DDukePlayer* p); +void OnMotorcycle(DDukePlayer *pl); +void OffMotorcycle(DDukePlayer *pl); +void OnBoat(DDukePlayer *pl); +void OffBoat(DDukePlayer *pl); void cameratext(DDukeActor* i); void dobonus(int bonusonly, const CompletionFunc& completion); @@ -236,7 +236,7 @@ void enterlevel(MapRecord* mi, int gm); void donewgame(MapRecord* map, int sk); int playercolor2lookup(int color); void PlayerColorChanged(void); -bool movementBlocked(DukePlayer *p); +bool movementBlocked(DDukePlayer *p); void underwater(int snum, ESyncBits actions, double floorz, double ceilingz); void loadcons(); void DrawStatusBar(); diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 723368cce..a284b2731 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -68,6 +68,27 @@ IMPLEMENT_POINTER(temp_actor) IMPLEMENT_POINTER(seek_actor) IMPLEMENT_POINTERS_END +IMPLEMENT_CLASS(DDukePlayer, false, true) +IMPLEMENT_POINTERS_START(DDukePlayer) +IMPLEMENT_POINTER(actorsqu) +IMPLEMENT_POINTER(wackedbyactor) +IMPLEMENT_POINTER(on_crane) +IMPLEMENT_POINTER(holoduke_on) +IMPLEMENT_POINTER(somethingonplayer) +IMPLEMENT_POINTER(access_spritenum) +IMPLEMENT_POINTER(dummyplayersprite) +IMPLEMENT_POINTER(newOwner) +IMPLEMENT_POINTERS_END + +size_t DDukePlayer::PropagateMark() +{ + for (auto& var : uservars) + { + var.Mark(); + } + return Super::PropagateMark(); +} + size_t DDukeActor::PropagateMark() { for (auto& var : uservars) @@ -83,26 +104,6 @@ static void markgcroots() GC::MarkArray(spriteq, 1024); GC::Mark(currentCommentarySprite); GC::Mark(ud.cameraactor); - for (int i = 0; i < MAXPLAYERS; i++) - { - auto plr = getPlayer(i); - if (plr) - { - GC::Mark(plr->actor); - GC::Mark(plr->actorsqu); - GC::Mark(plr->wackedbyactor); - GC::Mark(plr->on_crane); - GC::Mark(plr->holoduke_on); - GC::Mark(plr->somethingonplayer); - GC::Mark(plr->access_spritenum); - GC::Mark(plr->dummyplayersprite); - GC::Mark(plr->newOwner); - for (auto& var : plr->uservars) - { - var.Mark(); - } - } - } } //--------------------------------------------------------------------------- @@ -393,8 +394,8 @@ void GameInterface::app_init() // Initialise player array. for (unsigned i = 0; i < MAXPLAYERS; i++) { - PlayerArray[i] = new DukePlayer; - *getPlayer(i) = {}; + PlayerArray[i] = Create(i); + GC::WriteBarrier(PlayerArray[i]); } RegisterClasses(); @@ -645,7 +646,7 @@ void checkhitsprite(DDukeActor* actor, DDukeActor* hitter) } } -void CallOnHurt(DDukeActor* actor, DukePlayer* hitter) +void CallOnHurt(DDukeActor* actor, DDukePlayer* hitter) { IFVIRTUALPTR(actor, DDukeActor, onHurt) { @@ -654,7 +655,7 @@ void CallOnHurt(DDukeActor* actor, DukePlayer* hitter) } } -void CallOnTouch(DDukeActor* actor, DukePlayer* hitter) +void CallOnTouch(DDukeActor* actor, DDukePlayer* hitter) { IFVIRTUALPTR(actor, DDukeActor, onTouch) { @@ -664,7 +665,7 @@ void CallOnTouch(DDukeActor* actor, DukePlayer* hitter) } -bool CallOnUse(DDukeActor* actor, DukePlayer* user) +bool CallOnUse(DDukeActor* actor, DDukePlayer* user) { int nval = false; IFVIRTUALPTR(actor, DDukeActor, onUse) @@ -676,7 +677,7 @@ bool CallOnUse(DDukeActor* actor, DukePlayer* user) return nval; } -void CallOnMotoSmash(DDukeActor* actor, DukePlayer* hitter) +void CallOnMotoSmash(DDukeActor* actor, DDukePlayer* hitter) { IFVIRTUALPTR(actor, DDukeActor, onMotoSmash) { @@ -737,7 +738,7 @@ void CallPlayFTASound(DDukeActor* actor, int mode) } } -void CallStandingOn(DDukeActor* actor, DukePlayer* p) +void CallStandingOn(DDukeActor* actor, DDukePlayer* p) { IFVIRTUALPTR(actor, DDukeActor, StandingOn) { @@ -746,7 +747,7 @@ void CallStandingOn(DDukeActor* actor, DukePlayer* p) } } -int CallTriggerSwitch(DDukeActor* actor, DukePlayer* p) +int CallTriggerSwitch(DDukeActor* actor, DDukePlayer* p) { int nval = false; IFVIRTUALPTR(actor, DDukeActor, TriggerSwitch) diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 7333ff785..75975fc73 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -96,7 +96,7 @@ void GameInterface::ExitFromMenu() // //--------------------------------------------------------------------------- -void FTA(int q, DukePlayer* p) +void FTA(int q, DDukePlayer* p) { if (q < 0 || gamestate != GS_LEVEL) return; @@ -211,7 +211,7 @@ void V_AddBlend (float r, float g, float b, float a, float v_blend[4]) void drawoverlays(double interpfrac) { - DukePlayer* pp; + DDukePlayer* pp; DVector2 cposxy; DAngle cang; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 86edf67dd..8de819794 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1298,7 +1298,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, // //--------------------------------------------------------------------------- -int CheckWeapRec(DukePlayer* p, DDukeActor* g_ac, int testonly) +int CheckWeapRec(DDukePlayer* p, DDukeActor* g_ac, int testonly) { int j; for (j = 0; j < p->weapreccnt; j++) @@ -1416,7 +1416,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x) // //--------------------------------------------------------------------------- -int ifcansee(DDukeActor* actor, DukePlayer* p) +int ifcansee(DDukeActor* actor, DDukePlayer* p) { int j; DDukeActor* tosee; diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index c53929158..212d257ff 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -61,7 +61,7 @@ inline static void hud_drawpal(double x, double y, const char* tilenum, int shad // //--------------------------------------------------------------------------- -static void displayloogie(DukePlayer* p, double const interpfrac) +static void displayloogie(DDukePlayer* p, double const interpfrac) { if (p->loogcnt == 0) return; @@ -84,7 +84,7 @@ static void displayloogie(DukePlayer* p, double const interpfrac) // //--------------------------------------------------------------------------- -static bool animatefist(int gs, DukePlayer* p, double xoffset, double yoffset, int fistpal, double const interpfrac) +static bool animatefist(int gs, DDukePlayer* p, double xoffset, double yoffset, int fistpal, double const interpfrac) { const double fisti = min(interpolatedvalue(p->ofist_incs, p->fist_incs, interpfrac), 32.); if (fisti <= 0) return false; @@ -103,7 +103,7 @@ static bool animatefist(int gs, DukePlayer* p, double xoffset, double yoffset, i // //--------------------------------------------------------------------------- -static bool animateknee(int gs, DukePlayer* p, double xoffset, double yoffset, int pal, double const interpfrac, DAngle angle) +static bool animateknee(int gs, DDukePlayer* p, double xoffset, double yoffset, int pal, double const interpfrac, DAngle angle) { if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->spr.extra <= 0) return false; @@ -121,7 +121,7 @@ static bool animateknee(int gs, DukePlayer* p, double xoffset, double yoffset, i // //--------------------------------------------------------------------------- -static bool animateknuckles(int gs, DukePlayer* p, double xoffset, double yoffset, int pal, DAngle angle) +static bool animateknuckles(int gs, DDukePlayer* p, double xoffset, double yoffset, int pal, DAngle angle) { if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->spr.extra <= 0) return false; static const char* const frames[] = { "CRACKKNUCKLES0", "CRACKKNUCKLES1", "CRACKKNUCKLES2", "CRACKKNUCKLES3" }; @@ -158,7 +158,7 @@ void displaymasks_d(int snum, int p, double interpfrac) // //--------------------------------------------------------------------------- -static bool animatetip(int gs, DukePlayer* p, double xoffset, double yoffset, int pal, double const interpfrac, DAngle angle) +static bool animatetip(int gs, DDukePlayer* p, double xoffset, double yoffset, int pal, double const interpfrac, DAngle angle) { if (p->tipincs == 0) return false; @@ -177,7 +177,7 @@ static bool animatetip(int gs, DukePlayer* p, double xoffset, double yoffset, in // //--------------------------------------------------------------------------- -static bool animateaccess(int gs, DukePlayer* p, double xoffset, double yoffset, double const interpfrac, DAngle angle) +static bool animateaccess(int gs, DDukePlayer* p, double xoffset, double yoffset, double const interpfrac, DAngle angle) { if (p->access_incs == 0 || p->GetActor()->spr.extra <= 0) return false; @@ -201,7 +201,7 @@ static bool animateaccess(int gs, DukePlayer* p, double xoffset, double yoffset, // //--------------------------------------------------------------------------- -void animateshrunken(DukePlayer* p, double xoffset, double yoffset, int8_t shade, int o, double interpfrac) +void animateshrunken(DDukePlayer* p, double xoffset, double yoffset, int8_t shade, int o, double interpfrac) { const double fistsign = BobVal(interpolatedvalue(p->ofistsign, p->fistsign, interpfrac)) * 16; int pal = getPlayer(screenpeek)->cursector->floorpal; @@ -220,7 +220,7 @@ void animateshrunken(DukePlayer* p, double xoffset, double yoffset, int8_t shade void displayweapon_d(int snum, double interpfrac) { int pal, pal2; - DukePlayer* p = getPlayer(snum); + DDukePlayer* p = getPlayer(snum); if (p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->spr.pal != 1 && p->GetActor()->spr.extra <= 0)) return; diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 8772f1c5f..27fa1108b 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -208,7 +208,7 @@ void DrawBoat(int const kb, const DVector2& offsets, DAngle angle, int shade, in // // //--------------------------------------------------------------------------- -void animateshrunken(DukePlayer* p, double xoffset, double yoffset, int8_t shade, int o, double interpfrac); +void animateshrunken(DDukePlayer* p, double xoffset, double yoffset, int8_t shade, int o, double interpfrac); void displayweapon_r(int snum, double interpfrac) { diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 11d79d6f3..b3fc192b2 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -10,9 +10,9 @@ // all inline functions. BEGIN_DUKE_NS -inline DukePlayer* getPlayer(int index) +inline DDukePlayer* getPlayer(int index) { - return static_cast(PlayerArray[index]); + return static_cast(PlayerArray[index]); } inline int rnd(int X) @@ -165,7 +165,7 @@ inline void clearfriction() } } -inline void SetPlayerPal(DukePlayer* p, PalEntry pe) +inline void SetPlayerPal(DDukePlayer* p, PalEntry pe) { p->pals = pe; } @@ -175,7 +175,7 @@ inline bool playrunning() return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1))); } -inline void doslopetilting(DukePlayer* p) +inline void doslopetilting(DDukePlayer* p) { p->Angles.doViewPitch(p->aim_mode == 0 && p->on_ground && p->cursector->lotag != ST_2_UNDERWATER); } @@ -343,7 +343,7 @@ inline void subkill(DDukeActor* actor) } } -inline void dokill(DukePlayer* p, DDukeActor* g_ac, int amount) +inline void dokill(DDukePlayer* p, DDukeActor* g_ac, int amount) { if (g_ac->spriteextra < 1 || g_ac->spriteextra == 128 || !isRR()) { diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index cddf4ef59..1feaa8b3e 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -54,7 +54,7 @@ void hud_input(int plnum) { int i, k; uint8_t dainv; - DukePlayer* p; + DDukePlayer* p; p = getPlayer(plnum); auto pact = p->GetActor(); diff --git a/source/games/duke/src/noise.cpp b/source/games/duke/src/noise.cpp index d83f7a61e..c571dd711 100644 --- a/source/games/duke/src/noise.cpp +++ b/source/games/duke/src/noise.cpp @@ -32,7 +32,7 @@ BEGIN_DUKE_NS int madenoise(int snum) { - DukePlayer *p; + DDukePlayer *p; p = getPlayer(snum); p->donoise = 1; p->noise = p->GetActor()->spr.pos.XY(); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 79f3ec1d6..e84d66bcf 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -78,7 +78,7 @@ void PlayerColorChanged(void) // //--------------------------------------------------------------------------- -int setpal(DukePlayer* p) +int setpal(DDukePlayer* p) { int palette; if (p->DrugMode) palette = DRUGPAL; @@ -96,7 +96,7 @@ int setpal(DukePlayer* p) // //--------------------------------------------------------------------------- -void quickkill(DukePlayer* p) +void quickkill(DDukePlayer* p) { SetPlayerPal(p, PalEntry(48, 48, 48, 48)); @@ -113,7 +113,7 @@ void quickkill(DukePlayer* p) // //--------------------------------------------------------------------------- -void forceplayerangle(DukePlayer* p) +void forceplayerangle(DDukePlayer* p) { const auto ang = (DAngle22_5 - randomAngle(45)) / 2.; @@ -174,7 +174,7 @@ double hitasprite(DDukeActor* actor, DDukeActor** hitsp) // //--------------------------------------------------------------------------- -double hitawall(DukePlayer* p, walltype** hitw) +double hitawall(DDukePlayer* p, walltype** hitw) { HitInfo hit{}; @@ -708,7 +708,7 @@ void playerJump(int snum, double floorz, double ceilingz) // //--------------------------------------------------------------------------- -void DukePlayer::apply_seasick() +void DDukePlayer::apply_seasick() { if (isRRRA() && SeaSick && (dead_flag == 0)) { @@ -736,7 +736,7 @@ void DukePlayer::apply_seasick() // //--------------------------------------------------------------------------- -void DukePlayer::backuppos(bool noclipping) +void DDukePlayer::backuppos(bool noclipping) { if (!noclipping) { @@ -758,7 +758,7 @@ void DukePlayer::backuppos(bool noclipping) // //--------------------------------------------------------------------------- -void DukePlayer::backupweapon() +void DDukePlayer::backupweapon() { oweapon_sway = weapon_sway; oweapon_pos = weapon_pos; @@ -779,7 +779,7 @@ void DukePlayer::backupweapon() // //--------------------------------------------------------------------------- -void DukePlayer::checkhardlanding() +void DDukePlayer::checkhardlanding() { if (hard_landing > 0) { @@ -788,7 +788,7 @@ void DukePlayer::checkhardlanding() } } -void DukePlayer::playerweaponsway(double xvel) +void DDukePlayer::playerweaponsway(double xvel) { if (cl_weaponsway) { @@ -966,7 +966,7 @@ void shoot(DDukeActor* actor, PClass* cls) // //--------------------------------------------------------------------------- -bool movementBlocked(DukePlayer *p) +bool movementBlocked(DDukePlayer *p) { auto blockingweapon = [=]() { @@ -1026,7 +1026,7 @@ int haslock(sectortype* sectp, int snum) // //--------------------------------------------------------------------------- -void purplelavacheck(DukePlayer* p) +void purplelavacheck(DDukePlayer* p) { auto pact = p->GetActor(); if (p->spritebridge == 0 && pact->insector()) @@ -1060,7 +1060,7 @@ void purplelavacheck(DukePlayer* p) // //--------------------------------------------------------------------------- -void addphealth(DukePlayer* p, int amount, bool bigitem) +void addphealth(DDukePlayer* p, int amount, bool bigitem) { if (p->newOwner != nullptr) { @@ -1124,7 +1124,7 @@ void addphealth(DukePlayer* p, int amount, bool bigitem) // //--------------------------------------------------------------------------- -int playereat(DukePlayer* p, int amount, bool bigitem) +int playereat(DDukePlayer* p, int amount, bool bigitem) { p->eat += amount; if (p->eat > 100) @@ -1181,7 +1181,7 @@ int playereat(DukePlayer* p, int amount, bool bigitem) // //--------------------------------------------------------------------------- -void playerdrink(DukePlayer* p, int amount) +void playerdrink(DDukePlayer* p, int amount) { p->drink_amt += amount; int curhealth = p->GetActor()->spr.extra; @@ -1221,7 +1221,7 @@ void playerdrink(DukePlayer* p, int amount) // //--------------------------------------------------------------------------- -int playeraddammo(DukePlayer* p, int weaponindex, int amount) +int playeraddammo(DDukePlayer* p, int weaponindex, int amount) { if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex]) { @@ -1229,21 +1229,21 @@ int playeraddammo(DukePlayer* p, int weaponindex, int amount) } addammo(weaponindex, p, amount); if (p->curr_weapon == KNEE_WEAPON) - if (p->gotweapon[weaponindex] && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 1)) + if (p->gotweapon[weaponindex] && (WeaponSwitch(p->pnum) & 1)) fi.addweapon(p, weaponindex, true); return true; } -int playeraddweapon(DukePlayer* p, int weaponindex, int amount) +int playeraddweapon(DDukePlayer* p, int weaponindex, int amount) { - if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p - (DukePlayer*)PlayerArray) & 1)); + if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p->pnum) & 1)); else if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex]) { return false; } addammo(weaponindex, p, amount); if (p->curr_weapon == KNEE_WEAPON) - if (p->gotweapon[weaponindex] && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 1)) + if (p->gotweapon[weaponindex] && (WeaponSwitch(p->pnum) & 1)) fi.addweapon(p, weaponindex, true); return true; @@ -1255,7 +1255,7 @@ int playeraddweapon(DukePlayer* p, int weaponindex, int amount) // //--------------------------------------------------------------------------- -void playeraddinventory(DukePlayer* p, DDukeActor* item, int type, int amount) +void playeraddinventory(DDukePlayer* p, DDukeActor* item, int type, int amount) { switch (type) { @@ -1322,12 +1322,12 @@ void playeraddinventory(DukePlayer* p, DDukeActor* item, int type, int amount) // //--------------------------------------------------------------------------- -int checkp(DDukeActor* self, DukePlayer* p, int flags) +int checkp(DDukeActor* self, DDukePlayer* p, int flags) { bool j = 0; double vel = self->vel.X; - unsigned plindex = unsigned(p - (DukePlayer*)PlayerArray); + unsigned plindex = unsigned(p->pnum); // sigh.. this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable. if ((flags & pducking) && p->on_ground && PlayerInput(plindex, SB_CROUCH)) @@ -1381,7 +1381,7 @@ int checkp(DDukeActor* self, DukePlayer* p, int flags) // //--------------------------------------------------------------------------- -int playercheckinventory(DukePlayer* p, DDukeActor* item, int type, int amount) +int playercheckinventory(DDukePlayer* p, DDukeActor* item, int type, int amount) { bool j = 0; switch (type) @@ -1457,7 +1457,7 @@ int playercheckinventory(DukePlayer* p, DDukeActor* item, int type, int amount) // //--------------------------------------------------------------------------- -void playerstomp(DukePlayer* p, DDukeActor* stomped) +void playerstomp(DDukePlayer* p, DDukeActor* stomped) { if (p->knee_incs == 0 && p->GetActor()->spr.scale.X >= (isRR() ? 0.140625 : 0.625)) if (cansee(stomped->spr.pos.plusZ(-4), stomped->sector(), p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector())) @@ -1475,7 +1475,7 @@ void playerstomp(DukePlayer* p, DDukeActor* stomped) // //--------------------------------------------------------------------------- -void playerreset(DukePlayer* p, DDukeActor* g_ac) +void playerreset(DDukePlayer* p, DDukeActor* g_ac) { if (ud.multimode < 2) { @@ -1484,7 +1484,7 @@ void playerreset(DukePlayer* p, DDukeActor* g_ac) else { // I am not convinced this is even remotely smart to be executed from here.. - pickrandomspot(int(p - (DukePlayer*)PlayerArray)); + pickrandomspot(p->pnum); g_ac->spr.pos = p->GetActor()->getPosWithOffsetZ(); p->GetActor()->backuppos(); p->setbobpos(); @@ -1504,7 +1504,7 @@ void playerreset(DukePlayer* p, DDukeActor* g_ac) p->wantweaponfire = -1; p->GetActor()->PrevAngles.Pitch = p->GetActor()->spr.Angles.Pitch = nullAngle; p->on_crane = nullptr; - p->frag_ps = int(p - (DukePlayer*)PlayerArray); + p->frag_ps = p->pnum; p->Angles.PrevViewAngles.Pitch = p->Angles.ViewAngles.Pitch = nullAngle; p->opyoff = 0; p->wackedbyactor = nullptr; @@ -1540,7 +1540,7 @@ void playerreset(DukePlayer* p, DDukeActor* g_ac) // //--------------------------------------------------------------------------- -void wackplayer(DukePlayer* p) +void wackplayer(DDukePlayer* p) { if (!isRR()) forceplayerangle(p); @@ -1559,7 +1559,7 @@ void wackplayer(DukePlayer* p) // //--------------------------------------------------------------------------- -void playerkick(DukePlayer* p, DDukeActor* g_ac) +void playerkick(DDukePlayer* p, DDukeActor* g_ac) { if (ud.multimode > 1 && g_ac->isPlayer()) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 18be8f50a..e4144767e 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -49,7 +49,7 @@ void operateweapon_ww(int snum, ESyncBits actions); // //--------------------------------------------------------------------------- -void incur_damage_d(DukePlayer* p) +void incur_damage_d(DDukePlayer* p) { int damage = 0L, shield_damage = 0L; @@ -337,7 +337,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum // //--------------------------------------------------------------------------- -int doincrements_d(DukePlayer* p) +int doincrements_d(DDukePlayer* p) { int snum; @@ -536,7 +536,7 @@ int doincrements_d(DukePlayer* p) // //--------------------------------------------------------------------------- -void checkweapons_d(DukePlayer* p) +void checkweapons_d(DDukePlayer* p) { static PClassActor* const * const weapon_sprites[MAX_WEAPONS] = { &DukeMeleeAttackClass, &DukeFirstgunSpriteClass, &DukeShotgunSpriteClass, &DukeChaingunSpriteClass, &DukeRPGSpriteClass, &DukePipeBombClass, &DukeShrinkerSpriteClass, &DukeDevastatorSpriteClass, @@ -1536,7 +1536,7 @@ void processinput_d(int snum) Collision chz, clz; bool shrunk; int psectlotag; - DukePlayer* p; + DDukePlayer* p; p = getPlayer(snum); auto pact = p->GetActor(); @@ -1952,7 +1952,7 @@ HORIZONLY: if (p->show_empty_weapon > 0) { p->show_empty_weapon--; - if (p->show_empty_weapon == 0 && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 2)) + if (p->show_empty_weapon == 0 && (WeaponSwitch(p->pnum) & 2)) { if (p->last_full_weapon == GROW_WEAPON) p->subweapon |= (1 << GROW_WEAPON); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 70450a3a0..481b06d8a 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -43,7 +43,7 @@ BEGIN_DUKE_NS // //--------------------------------------------------------------------------- -void incur_damage_r(DukePlayer* p) +void incur_damage_r(DDukePlayer* p) { int damage = 0, shield_damage = 0; int gut = 0; @@ -343,7 +343,7 @@ void selectweapon_r(int snum, int weap) // //--------------------------------------------------------------------------- -int doincrements_r(DukePlayer* p) +int doincrements_r(DDukePlayer* p) { int snum; auto pact = p->GetActor(); @@ -600,7 +600,7 @@ int doincrements_r(DukePlayer* p) // //--------------------------------------------------------------------------- -void checkweapons_r(DukePlayer* p) +void checkweapons_r(DDukePlayer* p) { static PClassActor* const* const weapon_sprites[MAX_WEAPONS] = { &DukeMeleeAttackClass, &RedneckRevolverClass, &RedneckShotgunClass, &RedneckRiflegunClass, &RedneckDynamiteClass, &RedneckCrossbowClass, &RedneckRipsawClass, &RedneckBlasterClass, @@ -709,7 +709,7 @@ enum : unsigned VEH_FWDBRAKING = VEH_FORWARD|VEH_BRAKING, }; -static unsigned outVehicleFlags(DukePlayer* p, ESyncBits& actions) +static unsigned outVehicleFlags(DDukePlayer* p, ESyncBits& actions) { unsigned flags = 0; flags += VEH_FORWARD * (p->cmd.ucmd.fvel > 0); @@ -727,7 +727,7 @@ static unsigned outVehicleFlags(DukePlayer* p, ESyncBits& actions) // //--------------------------------------------------------------------------- -static void doVehicleTilting(DukePlayer* const p, const bool canTilt) +static void doVehicleTilting(DDukePlayer* const p, const bool canTilt) { auto adj = DAngle::fromDeg(p->cmd.ucmd.avel * (545943. / 3200000.) * canTilt); if (p->OnMotorcycle) adj *= 5 * Sgn(p->MotoSpeed); @@ -744,7 +744,7 @@ static void doVehicleTilting(DukePlayer* const p, const bool canTilt) // //--------------------------------------------------------------------------- -static void doVehicleBumping(DukePlayer* p, DDukeActor* pact, unsigned flags, bool bumptest, int bumpscale) +static void doVehicleBumping(DDukePlayer* p, DDukeActor* pact, unsigned flags, bool bumptest, int bumpscale) { if (p->MotoSpeed != 0 && p->on_ground == 1) { @@ -805,7 +805,7 @@ static void doVehicleBumping(DukePlayer* p, DDukeActor* pact, unsigned flags, bo // //--------------------------------------------------------------------------- -static void doVehicleDrunk(DukePlayer* const p) +static void doVehicleDrunk(DDukePlayer* const p) { if (p->drink_amt > 88 && p->moto_drink == 0) { @@ -831,7 +831,7 @@ static void doVehicleDrunk(DukePlayer* const p) // //--------------------------------------------------------------------------- -static void doVehicleSounds(DukePlayer* p, DDukeActor* pact, unsigned flags, unsigned sound1, unsigned sound2, unsigned sound3, unsigned sound4) +static void doVehicleSounds(DDukePlayer* p, DDukeActor* pact, unsigned flags, unsigned sound1, unsigned sound2, unsigned sound3, unsigned sound4) { if ((p->OnBoat && (flags & VEH_FWDBRAKING) == VEH_FORWARD) || flags & VEH_FORWARD) { @@ -883,7 +883,7 @@ static void doVehicleSounds(DukePlayer* p, DDukeActor* pact, unsigned flags, uns // //--------------------------------------------------------------------------- -static void doVehicleThrottling(DukePlayer* p, DDukeActor* pact, unsigned& flags, int fwdSpeed, int revSpeed, int brakeSpeed, int vBmpFwd, int vBmpBrake) +static void doVehicleThrottling(DDukePlayer* p, DDukeActor* pact, unsigned& flags, int fwdSpeed, int revSpeed, int brakeSpeed, int vBmpFwd, int vBmpBrake) { if (p->on_ground == 1) { @@ -2910,7 +2910,7 @@ HORIZONLY: { p->show_empty_weapon--; - if (p->show_empty_weapon == 0 && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 2)) + if (p->show_empty_weapon == 0 && (WeaponSwitch(p->pnum) & 2)) { fi.addweapon(p, p->last_full_weapon, true); return; @@ -2946,7 +2946,7 @@ HORIZONLY: // //--------------------------------------------------------------------------- -void OnMotorcycle(DukePlayer *p) +void OnMotorcycle(DDukePlayer *p) { if (!p->OnMotorcycle && p->cursector->lotag != ST_2_UNDERWATER) { @@ -2969,7 +2969,7 @@ void OnMotorcycle(DukePlayer *p) // //--------------------------------------------------------------------------- -void OffMotorcycle(DukePlayer *p) +void OffMotorcycle(DDukePlayer *p) { auto pact = p->GetActor(); if (p->OnMotorcycle) @@ -3013,7 +3013,7 @@ void OffMotorcycle(DukePlayer *p) // //--------------------------------------------------------------------------- -void OnBoat(DukePlayer *p) +void OnBoat(DDukePlayer *p) { if (!p->OnBoat) { @@ -3034,7 +3034,7 @@ void OnBoat(DukePlayer *p) // //--------------------------------------------------------------------------- -void OffBoat(DukePlayer *p) +void OffBoat(DDukePlayer *p) { if (p->OnBoat) { diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 9e0685c84..ef65efbc5 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -48,7 +48,7 @@ int operateTripbomb(int snum); // //--------------------------------------------------------------------------- -void DoFire(DukePlayer* p, int snum) +void DoFire(DDukePlayer* p, int snum) { int i; @@ -105,7 +105,7 @@ void DoFire(DukePlayer* p, int snum) // //--------------------------------------------------------------------------- -void DoSpawn(DukePlayer *p, int snum) +void DoSpawn(DDukePlayer *p, int snum) { if(!aplWeaponSpawn(p->curr_weapon, snum)) return; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index d83f9800c..02b8b37cd 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -60,7 +60,7 @@ void premapcontroller(DDukeActor* ac) void pickrandomspot(int snum) { - DukePlayer* p; + DDukePlayer* p; int i; p = getPlayer(snum); @@ -85,7 +85,7 @@ void pickrandomspot(int snum) void resetplayerstats(int snum) { - DukePlayer* p; + DDukePlayer* p; p = getPlayer(snum); @@ -259,7 +259,7 @@ void resetplayerstats(int snum) // //--------------------------------------------------------------------------- -void resetweapons(DukePlayer* p) +void resetweapons(DDukePlayer* p) { for (int weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) { @@ -293,7 +293,7 @@ void resetweapons(DukePlayer* p) p->gotweapon[SLINGBLADE_WEAPON] = true; p->ammo_amount[SLINGBLADE_WEAPON] = 1; } - OnEvent(EVENT_RESETWEAPONS, int(p - (DukePlayer*)PlayerArray), nullptr, -1); + OnEvent(EVENT_RESETWEAPONS, p->pnum, nullptr, -1); } //--------------------------------------------------------------------------- @@ -302,7 +302,7 @@ void resetweapons(DukePlayer* p) // //--------------------------------------------------------------------------- -void resetinventory(DukePlayer* p) +void resetinventory(DDukePlayer* p) { p->inven_icon = 0; p->boot_amount = 0; @@ -362,7 +362,7 @@ void resetinventory(DukePlayer* p) ufocnt = 0; hulkspawn = 2; } - OnEvent(EVENT_RESETINVENTORY, int(p - (DukePlayer*)PlayerArray), p->GetActor()); + OnEvent(EVENT_RESETINVENTORY, p->pnum, p->GetActor()); } @@ -374,7 +374,7 @@ void resetinventory(DukePlayer* p) void resetprestat(int snum,int g) { - DukePlayer* p; + DDukePlayer* p; p = getPlayer(snum); @@ -1058,7 +1058,7 @@ void cacheit(void) // //--------------------------------------------------------------------------- -static int LoadTheMap(MapRecord *mi, DukePlayer*p, int gamemode) +static int LoadTheMap(MapRecord *mi, DDukePlayer*p, int gamemode) { int16_t lbang; if (isShareware() && (mi->flags & MI_USERMAP)) diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index cf85a8643..848369094 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -42,7 +42,7 @@ BEGIN_DUKE_NS void prelevel_r(int g, TArray& actors) { - DukePlayer* p; + DDukePlayer* p; int j; int lotaglist; TArray lotags; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 2a94f941a..b628104c3 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -129,7 +129,7 @@ bool GameInterface::GetGeoEffect(GeoEffect* eff, sectortype* viewsector) //--------------------------------------------------------------------------- int DrugTimer; -static int getdrugmode(DukePlayer *p, int oyrepeat) +static int getdrugmode(DDukePlayer *p, int oyrepeat) { int now = I_GetBuildTime() >> 1; // this function works on a 60 fps setup. if (playrunning() && p->DrugMode > 0) @@ -218,7 +218,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) DVector3 cpos; DRotator cangles; - DukePlayer* p = getPlayer(snum); + DDukePlayer* p = getPlayer(snum); // update render angles. p->Angles.updateCameraAngles(interpfrac); diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 199400a67..7343d2734 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -103,7 +103,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_orig& w, pl return arc; } -FSerializer& Serialize(FSerializer& arc, const char* keyname, DukePlayer& w, DukePlayer* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, DDukePlayer& w, DDukePlayer* def) { if (arc.BeginObject(keyname)) { diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 0b9b26c03..92132d62f 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1126,7 +1126,7 @@ void operatesectors(sectortype* sptr, DDukeActor *actor) // //--------------------------------------------------------------------------- -void operateactivators(int low, DukePlayer* plr) +void operateactivators(int low, DDukePlayer* plr) { int i, j, k; Cycler * p; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index d22bd831c..81165c682 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -117,7 +117,7 @@ void activatebysector_d(sectortype* sect, DDukeActor* activator) // //--------------------------------------------------------------------------- -void checkplayerhurt_d(DukePlayer* p, const Collision& coll) +void checkplayerhurt_d(DDukePlayer* p, const Collision& coll) { if (coll.type == kHitSprite) { @@ -158,7 +158,7 @@ void checkplayerhurt_d(DukePlayer* p, const Collision& coll) // //--------------------------------------------------------------------------- -void clearcameras(DukePlayer* p) +void clearcameras(DDukePlayer* p) { p->GetActor()->restorepos(); p->newOwner = nullptr; @@ -181,7 +181,7 @@ void clearcameras(DukePlayer* p) void checksectors_d(int snum) { int i = -1; - DukePlayer* p; + DDukePlayer* p; walltype* hitscanwall; HitInfo near; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 2c5ea0640..6ab9f94fa 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -127,7 +127,7 @@ void activatebysector_r(sectortype* sect, DDukeActor* activator) // //--------------------------------------------------------------------------- -void checkplayerhurt_r(DukePlayer* p, const Collision &coll) +void checkplayerhurt_r(DDukePlayer* p, const Collision &coll) { if (coll.type == kHitSprite) { @@ -160,7 +160,7 @@ void checkplayerhurt_r(DukePlayer* p, const Collision &coll) void checksectors_r(int snum) { - DukePlayer* p; + DDukePlayer* p; walltype* hitscanwall; HitInfo near; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index eb5ce5397..7e36dd865 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -224,8 +224,14 @@ struct player_orig sectortype* os; }; -struct DukePlayer final : public CorePlayer +class DDukePlayer final : public DCorePlayer { + DECLARE_CLASS(DDukePlayer, DCorePlayer) + HAS_OBJECT_POINTERS + size_t PropagateMark() override; + DDukePlayer() = default; +public: + DDukePlayer(uint8_t p) : DCorePlayer(p) {} DVector3 vel; DVector2 bobpos; DVector2 fric; diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index df13d1c1f..7d54354a0 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -33,7 +33,7 @@ void resetswitch(int tag); // //--------------------------------------------------------------------------- -DukePlayer* duke_getviewplayer() +DDukePlayer* duke_getviewplayer() { return getPlayer(screenpeek); } @@ -44,7 +44,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, getviewplayer, duke_getviewplayer) ACTION_RETURN_POINTER(duke_getviewplayer()); } -DukePlayer* duke_getlocalplayer() +DDukePlayer* duke_getlocalplayer() { return getPlayer(myconnectindex); } @@ -117,7 +117,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, CheckSoundPlaying, duke_CheckSoundPlaying) ACTION_RETURN_INT(duke_CheckSoundPlaying(snd)); } -DukePlayer* duke_checkcursectnums(sectortype* sector) +DDukePlayer* duke_checkcursectnums(sectortype* sector) { if (!sector) return nullptr; int pp = checkcursectnums(sector); @@ -196,16 +196,16 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, StopCommentary, StopCommentary) return 0; } -int getPlayerIndex(DukePlayer* p) +int getPlayerIndex(DDukePlayer* p) { if (!p) return -1; - return int(p - (DukePlayer*)PlayerArray); + return p->pnum; } DEFINE_ACTION_FUNCTION_NATIVE(_Duke, getPlayerIndex, getPlayerIndex) { PARAM_PROLOGUE; - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); ACTION_RETURN_INT(getPlayerIndex(p)); } @@ -355,7 +355,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, getglobalz, getglobalz) return 0; } -DukePlayer* DukeActor_findplayer(DDukeActor* self, double* dist) +DDukePlayer* DukeActor_findplayer(DDukeActor* self, double* dist) { double a; return getPlayer(findplayer(self, dist? dist : &a)); @@ -371,7 +371,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, findplayer, DukeActor_findplayer) return min(numret, 2); } -DukePlayer* DukeActor_getplayer(DDukeActor* self) +DDukePlayer* DukeActor_getplayer(DDukeActor* self) { return self->isPlayer() ? getPlayer(self->PlayerIndex()) : nullptr; } @@ -713,7 +713,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, restoreloc, DukeActor_restoreloc) DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, fakebubbaspawn, fakebubbaspawn) { PARAM_SELF_PROLOGUE(DDukeActor); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); fakebubbaspawn(self, p); return 0; } @@ -790,7 +790,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, SetAI, Duke_SetAI) DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, checkp, checkp) { PARAM_SELF_PROLOGUE(DDukeActor); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); PARAM_INT(n); ACTION_RETURN_INT(checkp(self, p, n)); } @@ -798,7 +798,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, checkp, checkp) DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, cansee, ifcansee) { PARAM_SELF_PROLOGUE(DDukeActor); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); PARAM_INT(n); ACTION_RETURN_INT(ifcansee(self, p)); } @@ -813,7 +813,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, actoroperate, actoroperate) DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ifsquished, ifsquished) { PARAM_SELF_PROLOGUE(DDukeActor); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); ACTION_RETURN_INT(ifcansee(self, p)); } @@ -830,7 +830,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ChangeType, Duke_ChangeType) return 0; } -void Duke_fall(DDukeActor* self, DukePlayer* p) +void Duke_fall(DDukeActor* self, DDukePlayer* p) { fall(self, p->GetPlayerNum()); } @@ -838,7 +838,7 @@ void Duke_fall(DDukeActor* self, DukePlayer* p) DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, fall, Duke_fall) { PARAM_SELF_PROLOGUE(DDukeActor); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); Duke_fall(self, p); return 0; } @@ -858,14 +858,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, dodge, dodge) ACTION_RETURN_INT(dodge(self)); } -int Duke_ifcanshoottarget(DDukeActor* self, DukePlayer* p, double dist) +int Duke_ifcanshoottarget(DDukeActor* self, DDukePlayer* p, double dist) { return ifcanshoottarget(self, p->GetPlayerNum(), int(dist * worldtoint)); } DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ifcanshoottarget, Duke_ifcanshoottarget) { PARAM_SELF_PROLOGUE(DDukeActor); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); PARAM_FLOAT(x); ACTION_RETURN_INT(Duke_ifcanshoottarget(self, p, x)); } @@ -972,208 +972,208 @@ DEFINE_ACTION_FUNCTION(DDukeActor, killit) // //--------------------------------------------------------------------------- -DEFINE_FIELD_X(DukePlayer, DukePlayer, gotweapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, pals) -DEFINE_FIELD_X(DukePlayer, DukePlayer, weapon_sway) -DEFINE_FIELD_X(DukePlayer, DukePlayer, oweapon_sway) -DEFINE_FIELD_X(DukePlayer, DukePlayer, weapon_pos) -DEFINE_FIELD_X(DukePlayer, DukePlayer, kickback_pic) -DEFINE_FIELD_X(DukePlayer, DukePlayer, random_club_frame) -DEFINE_FIELD_X(DukePlayer, DukePlayer, oweapon_pos) -DEFINE_FIELD_X(DukePlayer, DukePlayer, okickback_pic) -DEFINE_FIELD_X(DukePlayer, DukePlayer, orandom_club_frame) -DEFINE_FIELD_X(DukePlayer, DukePlayer, hard_landing) -DEFINE_FIELD_X(DukePlayer, DukePlayer, ohard_landing) -DEFINE_FIELD_X(DukePlayer, DukePlayer, psectlotag) -//DEFINE_FIELD_X(DukePlayer, player_struct, exitx) -//DEFINE_FIELD_X(DukePlayer, player_struct, exity) -DEFINE_FIELD_UNSIZED(DukePlayer, DukePlayer, loogie) -DEFINE_FIELD_X(DukePlayer, DukePlayer, numloogs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, loogcnt) -DEFINE_FIELD_X(DukePlayer, DukePlayer, invdisptime) -//DEFINE_FIELD_X(DukePlayer, player_struct, bobposx) -//DEFINE_FIELD_X(DukePlayer, player_struct, bobposy) -DEFINE_FIELD_X(DukePlayer, DukePlayer, pyoff) -DEFINE_FIELD_X(DukePlayer, DukePlayer, opyoff) -DEFINE_FIELD_X(DukePlayer, DukePlayer, vel) -DEFINE_FIELD_X(DukePlayer, DukePlayer, last_pissed_time) -DEFINE_FIELD_X(DukePlayer, DukePlayer, truefz) -DEFINE_FIELD_X(DukePlayer, DukePlayer, truecz) -DEFINE_FIELD_X(DukePlayer, DukePlayer, player_par) -DEFINE_FIELD_X(DukePlayer, DukePlayer, visibility) -DEFINE_FIELD_X(DukePlayer, DukePlayer, bobcounter) -DEFINE_FIELD_X(DukePlayer, DukePlayer, randomflamex) -DEFINE_FIELD_X(DukePlayer, DukePlayer, crack_time) -DEFINE_FIELD_X(DukePlayer, DukePlayer, aim_mode) -DEFINE_FIELD_X(DukePlayer, DukePlayer, ftt) -DEFINE_FIELD_X(DukePlayer, DukePlayer, cursector) -DEFINE_FIELD_X(DukePlayer, DukePlayer, last_extra) -DEFINE_FIELD_X(DukePlayer, DukePlayer, subweapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, ammo_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, frag) -DEFINE_FIELD_X(DukePlayer, DukePlayer, fraggedself) -DEFINE_FIELD_X(DukePlayer, DukePlayer, curr_weapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, last_weapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, tipincs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, wantweaponfire) -DEFINE_FIELD_X(DukePlayer, DukePlayer, holoduke_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, hurt_delay) -DEFINE_FIELD_X(DukePlayer, DukePlayer, hbomb_hold_delay) -DEFINE_FIELD_X(DukePlayer, DukePlayer, jumping_counter) -DEFINE_FIELD_X(DukePlayer, DukePlayer, airleft) -DEFINE_FIELD_X(DukePlayer, DukePlayer, knee_incs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, access_incs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, ftq) -DEFINE_FIELD_X(DukePlayer, DukePlayer, access_wall) -DEFINE_FIELD_X(DukePlayer, DukePlayer, got_access) -DEFINE_FIELD_X(DukePlayer, DukePlayer, weapon_ang) -DEFINE_FIELD_X(DukePlayer, DukePlayer, firstaid_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, actor) -DEFINE_FIELD_X(DukePlayer, DukePlayer, one_parallax_sectnum) -DEFINE_FIELD_X(DukePlayer, DukePlayer, over_shoulder_on) -DEFINE_FIELD_X(DukePlayer, DukePlayer, fist_incs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, cheat_phase) -DEFINE_FIELD_X(DukePlayer, DukePlayer, extra_extra8) -DEFINE_FIELD_X(DukePlayer, DukePlayer, quick_kick) -DEFINE_FIELD_X(DukePlayer, DukePlayer, last_quick_kick) -DEFINE_FIELD_X(DukePlayer, DukePlayer, heat_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, timebeforeexit) -DEFINE_FIELD_X(DukePlayer, DukePlayer, customexitsound) -DEFINE_FIELD_X(DukePlayer, DukePlayer, interface_toggle_flag) -DEFINE_FIELD_X(DukePlayer, DukePlayer, dead_flag) -DEFINE_FIELD_X(DukePlayer, DukePlayer, show_empty_weapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, scuba_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, jetpack_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, steroids_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, shield_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, pycount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, frag_ps) -DEFINE_FIELD_X(DukePlayer, DukePlayer, transporter_hold) -DEFINE_FIELD_X(DukePlayer, DukePlayer, last_full_weapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, footprintshade) -DEFINE_FIELD_X(DukePlayer, DukePlayer, boot_amount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, on_warping_sector) -DEFINE_FIELD_X(DukePlayer, DukePlayer, footprintcount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, hbomb_on) -DEFINE_FIELD_X(DukePlayer, DukePlayer, jumping_toggle) -DEFINE_FIELD_X(DukePlayer, DukePlayer, rapid_fire_hold) -DEFINE_FIELD_X(DukePlayer, DukePlayer, on_ground) -DEFINE_FIELD_X(DukePlayer, DukePlayer, inven_icon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, buttonpalette) -DEFINE_FIELD_X(DukePlayer, DukePlayer, jetpack_on) -DEFINE_FIELD_X(DukePlayer, DukePlayer, spritebridge) -DEFINE_FIELD_X(DukePlayer, DukePlayer, lastrandomspot) -DEFINE_FIELD_X(DukePlayer, DukePlayer, scuba_on) -DEFINE_FIELD_X(DukePlayer, DukePlayer, footprintpal) -DEFINE_FIELD_X(DukePlayer, DukePlayer, heat_on) -DEFINE_FIELD_X(DukePlayer, DukePlayer, holster_weapon) -DEFINE_FIELD_X(DukePlayer, DukePlayer, falling_counter) -DEFINE_FIELD_X(DukePlayer, DukePlayer, refresh_inventory) -DEFINE_FIELD_X(DukePlayer, DukePlayer, toggle_key_flag) -DEFINE_FIELD_X(DukePlayer, DukePlayer, knuckle_incs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, walking_snd_toggle) -DEFINE_FIELD_X(DukePlayer, DukePlayer, palookup) -DEFINE_FIELD_X(DukePlayer, DukePlayer, quick_kick_msg) -DEFINE_FIELD_X(DukePlayer, DukePlayer, stairs) -DEFINE_FIELD_X(DukePlayer, DukePlayer, detonate_count) -//DEFINE_FIELD_X(DukePlayer, player_struct, noise.X) -//DEFINE_FIELD_X(DukePlayer, player_struct, noise.Y) -DEFINE_FIELD_X(DukePlayer, DukePlayer, noise_radius) -DEFINE_FIELD_X(DukePlayer, DukePlayer, drink_timer) -DEFINE_FIELD_X(DukePlayer, DukePlayer, eat_timer) -DEFINE_FIELD_X(DukePlayer, DukePlayer, SlotWin) -DEFINE_FIELD_X(DukePlayer, DukePlayer, recoil) -DEFINE_FIELD_X(DukePlayer, DukePlayer, detonate_time) -DEFINE_FIELD_X(DukePlayer, DukePlayer, yehaa_timer) -DEFINE_FIELD_X(DukePlayer, DukePlayer, drink_amt) -DEFINE_FIELD_X(DukePlayer, DukePlayer, eat) -DEFINE_FIELD_X(DukePlayer, DukePlayer, drunkang) -DEFINE_FIELD_X(DukePlayer, DukePlayer, eatang) -DEFINE_FIELD_X(DukePlayer, DukePlayer, shotgun_state) -DEFINE_FIELD_X(DukePlayer, DukePlayer, donoise) -DEFINE_FIELD_X(DukePlayer, DukePlayer, keys) -DEFINE_FIELD_X(DukePlayer, DukePlayer, drug_aspect) -DEFINE_FIELD_X(DukePlayer, DukePlayer, drug_timer) -DEFINE_FIELD_X(DukePlayer, DukePlayer, SeaSick) -DEFINE_FIELD_X(DukePlayer, DukePlayer, MamaEnd) -DEFINE_FIELD_X(DukePlayer, DukePlayer, moto_drink) -DEFINE_FIELD_X(DukePlayer, DukePlayer, TiltStatus) -DEFINE_FIELD_X(DukePlayer, DukePlayer, oTiltStatus) -DEFINE_FIELD_X(DukePlayer, DukePlayer, VBumpNow) -DEFINE_FIELD_X(DukePlayer, DukePlayer, VBumpTarget) -DEFINE_FIELD_X(DukePlayer, DukePlayer, TurbCount) -DEFINE_FIELD_X(DukePlayer, DukePlayer, drug_stat) -DEFINE_FIELD_X(DukePlayer, DukePlayer, DrugMode) -DEFINE_FIELD_X(DukePlayer, DukePlayer, lotag800kill) -DEFINE_FIELD_X(DukePlayer, DukePlayer, sea_sick_stat) -DEFINE_FIELD_X(DukePlayer, DukePlayer, hurt_delay2) -DEFINE_FIELD_X(DukePlayer, DukePlayer, nocheat) -DEFINE_FIELD_X(DukePlayer, DukePlayer, OnMotorcycle) -DEFINE_FIELD_X(DukePlayer, DukePlayer, OnBoat) -DEFINE_FIELD_X(DukePlayer, DukePlayer, moto_underwater) -DEFINE_FIELD_X(DukePlayer, DukePlayer, NotOnWater) -DEFINE_FIELD_X(DukePlayer, DukePlayer, MotoOnGround) -DEFINE_FIELD_X(DukePlayer, DukePlayer, moto_do_bump) -DEFINE_FIELD_X(DukePlayer, DukePlayer, moto_bump_fast) -DEFINE_FIELD_X(DukePlayer, DukePlayer, moto_on_oil) -DEFINE_FIELD_X(DukePlayer, DukePlayer, moto_on_mud) -DEFINE_FIELD_X(DukePlayer, DukePlayer, MotoSpeed) -DEFINE_FIELD_X(DukePlayer, DukePlayer, holoduke_on) -DEFINE_FIELD_X(DukePlayer, DukePlayer, actorsqu) -DEFINE_FIELD_X(DukePlayer, DukePlayer, wackedbyactor) -DEFINE_FIELD_X(DukePlayer, DukePlayer, on_crane) -DEFINE_FIELD_X(DukePlayer, DukePlayer, somethingonplayer) -DEFINE_FIELD_X(DukePlayer, DukePlayer, access_spritenum) -DEFINE_FIELD_X(DukePlayer, DukePlayer, dummyplayersprite) -DEFINE_FIELD_X(DukePlayer, DukePlayer, newOwner) -DEFINE_FIELD_X(DukePlayer, DukePlayer, fric) +DEFINE_FIELD(DDukePlayer, actor) +DEFINE_FIELD(DDukePlayer, gotweapon) +DEFINE_FIELD(DDukePlayer, pals) +DEFINE_FIELD(DDukePlayer, weapon_sway) +DEFINE_FIELD(DDukePlayer, oweapon_sway) +DEFINE_FIELD(DDukePlayer, weapon_pos) +DEFINE_FIELD(DDukePlayer, kickback_pic) +DEFINE_FIELD(DDukePlayer, random_club_frame) +DEFINE_FIELD(DDukePlayer, oweapon_pos) +DEFINE_FIELD(DDukePlayer, okickback_pic) +DEFINE_FIELD(DDukePlayer, orandom_club_frame) +DEFINE_FIELD(DDukePlayer, hard_landing) +DEFINE_FIELD(DDukePlayer, ohard_landing) +DEFINE_FIELD(DDukePlayer, psectlotag) +DEFINE_FIELD(DDukePlayer, loogie) +DEFINE_FIELD(DDukePlayer, numloogs) +DEFINE_FIELD(DDukePlayer, loogcnt) +DEFINE_FIELD(DDukePlayer, invdisptime) +//DEFINE_FIELD(DukePlayer, exitx) +//DEFINE_FIELD(DukePlayer, exity) +//DEFINE_FIELD(DukePlayer, bobposx) +//DEFINE_FIELD(DukePlayer, bobposy) +DEFINE_FIELD(DDukePlayer, pyoff) +DEFINE_FIELD(DDukePlayer, opyoff) +DEFINE_FIELD(DDukePlayer, vel) +DEFINE_FIELD(DDukePlayer, last_pissed_time) +DEFINE_FIELD(DDukePlayer, truefz) +DEFINE_FIELD(DDukePlayer, truecz) +DEFINE_FIELD(DDukePlayer, player_par) +DEFINE_FIELD(DDukePlayer, visibility) +DEFINE_FIELD(DDukePlayer, bobcounter) +DEFINE_FIELD(DDukePlayer, randomflamex) +DEFINE_FIELD(DDukePlayer, crack_time) +DEFINE_FIELD(DDukePlayer, aim_mode) +DEFINE_FIELD(DDukePlayer, ftt) +DEFINE_FIELD(DDukePlayer, cursector) +DEFINE_FIELD(DDukePlayer, last_extra) +DEFINE_FIELD(DDukePlayer, subweapon) +DEFINE_FIELD(DDukePlayer, ammo_amount) +DEFINE_FIELD(DDukePlayer, frag) +DEFINE_FIELD(DDukePlayer, fraggedself) +DEFINE_FIELD(DDukePlayer, curr_weapon) +DEFINE_FIELD(DDukePlayer, last_weapon) +DEFINE_FIELD(DDukePlayer, tipincs) +DEFINE_FIELD(DDukePlayer, wantweaponfire) +DEFINE_FIELD(DDukePlayer, holoduke_amount) +DEFINE_FIELD(DDukePlayer, hurt_delay) +DEFINE_FIELD(DDukePlayer, hbomb_hold_delay) +DEFINE_FIELD(DDukePlayer, jumping_counter) +DEFINE_FIELD(DDukePlayer, airleft) +DEFINE_FIELD(DDukePlayer, knee_incs) +DEFINE_FIELD(DDukePlayer, access_incs) +DEFINE_FIELD(DDukePlayer, ftq) +DEFINE_FIELD(DDukePlayer, access_wall) +DEFINE_FIELD(DDukePlayer, got_access) +DEFINE_FIELD(DDukePlayer, weapon_ang) +DEFINE_FIELD(DDukePlayer, firstaid_amount) +DEFINE_FIELD(DDukePlayer, one_parallax_sectnum) +DEFINE_FIELD(DDukePlayer, over_shoulder_on) +DEFINE_FIELD(DDukePlayer, fist_incs) +DEFINE_FIELD(DDukePlayer, cheat_phase) +DEFINE_FIELD(DDukePlayer, extra_extra8) +DEFINE_FIELD(DDukePlayer, quick_kick) +DEFINE_FIELD(DDukePlayer, last_quick_kick) +DEFINE_FIELD(DDukePlayer, heat_amount) +DEFINE_FIELD(DDukePlayer, timebeforeexit) +DEFINE_FIELD(DDukePlayer, customexitsound) +DEFINE_FIELD(DDukePlayer, interface_toggle_flag) +DEFINE_FIELD(DDukePlayer, dead_flag) +DEFINE_FIELD(DDukePlayer, show_empty_weapon) +DEFINE_FIELD(DDukePlayer, scuba_amount) +DEFINE_FIELD(DDukePlayer, jetpack_amount) +DEFINE_FIELD(DDukePlayer, steroids_amount) +DEFINE_FIELD(DDukePlayer, shield_amount) +DEFINE_FIELD(DDukePlayer, pycount) +DEFINE_FIELD(DDukePlayer, frag_ps) +DEFINE_FIELD(DDukePlayer, transporter_hold) +DEFINE_FIELD(DDukePlayer, last_full_weapon) +DEFINE_FIELD(DDukePlayer, footprintshade) +DEFINE_FIELD(DDukePlayer, boot_amount) +DEFINE_FIELD(DDukePlayer, on_warping_sector) +DEFINE_FIELD(DDukePlayer, footprintcount) +DEFINE_FIELD(DDukePlayer, hbomb_on) +DEFINE_FIELD(DDukePlayer, jumping_toggle) +DEFINE_FIELD(DDukePlayer, rapid_fire_hold) +DEFINE_FIELD(DDukePlayer, on_ground) +DEFINE_FIELD(DDukePlayer, inven_icon) +DEFINE_FIELD(DDukePlayer, buttonpalette) +DEFINE_FIELD(DDukePlayer, jetpack_on) +DEFINE_FIELD(DDukePlayer, spritebridge) +DEFINE_FIELD(DDukePlayer, lastrandomspot) +DEFINE_FIELD(DDukePlayer, scuba_on) +DEFINE_FIELD(DDukePlayer, footprintpal) +DEFINE_FIELD(DDukePlayer, heat_on) +DEFINE_FIELD(DDukePlayer, holster_weapon) +DEFINE_FIELD(DDukePlayer, falling_counter) +DEFINE_FIELD(DDukePlayer, refresh_inventory) +DEFINE_FIELD(DDukePlayer, toggle_key_flag) +DEFINE_FIELD(DDukePlayer, knuckle_incs) +DEFINE_FIELD(DDukePlayer, walking_snd_toggle) +DEFINE_FIELD(DDukePlayer, palookup) +DEFINE_FIELD(DDukePlayer, quick_kick_msg) +DEFINE_FIELD(DDukePlayer, stairs) +DEFINE_FIELD(DDukePlayer, detonate_count) +//DEFINE_FIELD(DukePlayer, noise.X) +//DEFINE_FIELD(DukePlayer, noise.Y) +DEFINE_FIELD(DDukePlayer, noise_radius) +DEFINE_FIELD(DDukePlayer, drink_timer) +DEFINE_FIELD(DDukePlayer, eat_timer) +DEFINE_FIELD(DDukePlayer, SlotWin) +DEFINE_FIELD(DDukePlayer, recoil) +DEFINE_FIELD(DDukePlayer, detonate_time) +DEFINE_FIELD(DDukePlayer, yehaa_timer) +DEFINE_FIELD(DDukePlayer, drink_amt) +DEFINE_FIELD(DDukePlayer, eat) +DEFINE_FIELD(DDukePlayer, drunkang) +DEFINE_FIELD(DDukePlayer, eatang) +DEFINE_FIELD(DDukePlayer, shotgun_state) +DEFINE_FIELD(DDukePlayer, donoise) +DEFINE_FIELD(DDukePlayer, keys) +DEFINE_FIELD(DDukePlayer, drug_aspect) +DEFINE_FIELD(DDukePlayer, drug_timer) +DEFINE_FIELD(DDukePlayer, SeaSick) +DEFINE_FIELD(DDukePlayer, MamaEnd) +DEFINE_FIELD(DDukePlayer, moto_drink) +DEFINE_FIELD(DDukePlayer, TiltStatus) +DEFINE_FIELD(DDukePlayer, oTiltStatus) +DEFINE_FIELD(DDukePlayer, VBumpNow) +DEFINE_FIELD(DDukePlayer, VBumpTarget) +DEFINE_FIELD(DDukePlayer, TurbCount) +DEFINE_FIELD(DDukePlayer, drug_stat) +DEFINE_FIELD(DDukePlayer, DrugMode) +DEFINE_FIELD(DDukePlayer, lotag800kill) +DEFINE_FIELD(DDukePlayer, sea_sick_stat) +DEFINE_FIELD(DDukePlayer, hurt_delay2) +DEFINE_FIELD(DDukePlayer, nocheat) +DEFINE_FIELD(DDukePlayer, OnMotorcycle) +DEFINE_FIELD(DDukePlayer, OnBoat) +DEFINE_FIELD(DDukePlayer, moto_underwater) +DEFINE_FIELD(DDukePlayer, NotOnWater) +DEFINE_FIELD(DDukePlayer, MotoOnGround) +DEFINE_FIELD(DDukePlayer, moto_do_bump) +DEFINE_FIELD(DDukePlayer, moto_bump_fast) +DEFINE_FIELD(DDukePlayer, moto_on_oil) +DEFINE_FIELD(DDukePlayer, moto_on_mud) +DEFINE_FIELD(DDukePlayer, MotoSpeed) +DEFINE_FIELD(DDukePlayer, holoduke_on) +DEFINE_FIELD(DDukePlayer, actorsqu) +DEFINE_FIELD(DDukePlayer, wackedbyactor) +DEFINE_FIELD(DDukePlayer, on_crane) +DEFINE_FIELD(DDukePlayer, somethingonplayer) +DEFINE_FIELD(DDukePlayer, access_spritenum) +DEFINE_FIELD(DDukePlayer, dummyplayersprite) +DEFINE_FIELD(DDukePlayer, newOwner) +DEFINE_FIELD(DDukePlayer, fric) DEFINE_ACTION_FUNCTION(_DukePlayer, IsFrozen) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); ACTION_RETURN_BOOL(self->GetActor()->spr.pal == 1 && self->last_extra < 2); } DEFINE_ACTION_FUNCTION(_DukePlayer, GetGameVar) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_STRING(name); PARAM_INT(def); ACTION_RETURN_INT(GetGameVar(name, def, self->GetActor(), self->GetPlayerNum()).safeValue()); } -void dukeplayer_backuppos(DukePlayer* self) +void dukeplayer_backuppos(DDukePlayer* self) { self->backuppos(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backuppos, dukeplayer_backuppos) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); dukeplayer_backuppos(self); return 0; } -void dukeplayer_backupxyz(DukePlayer* self) +void dukeplayer_backupxyz(DDukePlayer* self) { self->GetActor()->backuppos(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backupxyz, dukeplayer_backupxyz) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); dukeplayer_backupxyz(self); return 0; } -void dukeplayer_setpos(DukePlayer* self, double x, double y, double z) +void dukeplayer_setpos(DDukePlayer* self, double x, double y, double z) { self->GetActor()->spr.pos = { x, y, z + self->GetActor()->viewzoffset }; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setpos, dukeplayer_setpos) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_FLOAT(z); @@ -1181,14 +1181,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setpos, dukeplayer_setpos) return 0; } -void dukeplayer_addpos(DukePlayer* self, double x, double y, double z) +void dukeplayer_addpos(DDukePlayer* self, double x, double y, double z) { self->GetActor()->spr.pos += { x, y, z }; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpos, dukeplayer_addpos) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_FLOAT(z); @@ -1196,31 +1196,31 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpos, dukeplayer_addpos) return 0; } -void dukeplayer_centerview(DukePlayer* self) +void dukeplayer_centerview(DDukePlayer* self) { self->cmd.ucmd.actions |= SB_CENTERVIEW; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, centerview, dukeplayer_centerview) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); self->cmd.ucmd.actions |= SB_CENTERVIEW; return 0; } -inline int DukePlayer_PlayerInput(DukePlayer* pl, int bit) +inline int DukePlayer_PlayerInput(DDukePlayer* pl, int bit) { return (!!((pl->cmd.ucmd.actions) & ESyncBits::FromInt(bit))); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerinput, DukePlayer_PlayerInput) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(bit); ACTION_RETURN_INT(DukePlayer_PlayerInput(self, bit)); } -void dukeplayer_settargetangle(DukePlayer* self, double a, int backup) +void dukeplayer_settargetangle(DDukePlayer* self, double a, int backup) { self->GetActor()->spr.Angles.Yaw = DAngle::fromDeg(a); if (backup) self->GetActor()->PrevAngles.Yaw = self->GetActor()->spr.Angles.Yaw; @@ -1228,32 +1228,32 @@ void dukeplayer_settargetangle(DukePlayer* self, double a, int backup) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, settargetangle, dukeplayer_settargetangle) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_FLOAT(a); PARAM_BOOL(bak); dukeplayer_settargetangle(self, a, bak); return 0; } -double dukeplayer_angle(DukePlayer* self) +double dukeplayer_angle(DDukePlayer* self) { return self->GetActor()->spr.Angles.Yaw.Degrees(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, angle, dukeplayer_angle) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); ACTION_RETURN_FLOAT(dukeplayer_angle(self)); } -void dukeplayer_addpitch(DukePlayer* self, double a) +void dukeplayer_addpitch(DDukePlayer* self, double a) { self->GetActor()->spr.Angles.Pitch += DAngle::fromDeg(a); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpitch, dukeplayer_addpitch) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_FLOAT(a); dukeplayer_addpitch(self, a); return 0; @@ -1261,27 +1261,27 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpitch, dukeplayer_addpitch) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, clearcameras, clearcameras) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); clearcameras(self); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, quickkill, quickkill) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); quickkill(self); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, CheckWeapRec, CheckWeapRec) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(ac, DDukeActor); PARAM_BOOL(test); ACTION_RETURN_INT(CheckWeapRec(self, ac, test)); } -void DukePlayer_addammo(DukePlayer* p, int ammo, int amount) +void DukePlayer_addammo(DDukePlayer* p, int ammo, int amount) { if ((unsigned)ammo >= MAX_WEAPONS) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Ammo number out of range"); addammo(ammo, p, amount); @@ -1289,14 +1289,14 @@ void DukePlayer_addammo(DukePlayer* p, int ammo, int amount) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addammo, DukePlayer_addammo) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(type); PARAM_INT(amount); DukePlayer_addammo(self, type, amount); return 0; } -void DukePlayer_addweapon(DukePlayer* p, int wpn, int switchit) +void DukePlayer_addweapon(DDukePlayer* p, int wpn, int switchit) { if ((unsigned)wpn >= MAX_WEAPONS) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Weapon number out of range"); fi.addweapon(p, wpn, switchit); @@ -1304,7 +1304,7 @@ void DukePlayer_addweapon(DukePlayer* p, int wpn, int switchit) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addweapon, DukePlayer_addweapon) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(type); PARAM_INT(switchit); DukePlayer_addweapon(self, type, switchit); @@ -1314,57 +1314,57 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addweapon, DukePlayer_addweapon) DEFINE_ACTION_FUNCTION(_DukePlayer, hitablockingwall) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); walltype* pwal; hitawall(self, &pwal); ACTION_RETURN_BOOL(pwal && pwal->overtexture.isValid()); } -inline double DukePlayer_GetPitchwithView(DukePlayer* pl) +inline double DukePlayer_GetPitchwithView(DDukePlayer* pl) { return pl->Angles.getPitchWithView().Degrees(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, GetPitchwithView, DukePlayer_GetPitchwithView) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); ACTION_RETURN_FLOAT(DukePlayer_GetPitchwithView(self)); } -inline void DukePlayer_setbobpos(DukePlayer* pl) +inline void DukePlayer_setbobpos(DDukePlayer* pl) { return pl->setbobpos(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setbobpos, DukePlayer_setbobpos) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); self->setbobpos(); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, StartMotorcycle, OnMotorcycle) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); OnMotorcycle(self); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, StartBoat, OnBoat) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); OnBoat(self); return 0; } -void pl_checkhitswitch(DukePlayer* p, walltype* wal, DDukeActor* act) +void pl_checkhitswitch(DDukePlayer* p, walltype* wal, DDukeActor* act) { checkhitswitch(p->GetPlayerNum(), wal, act); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, checkhitswitch, pl_checkhitswitch) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(wal, walltype); PARAM_POINTER(act, DDukeActor); pl_checkhitswitch(self, wal, act); @@ -1373,7 +1373,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, checkhitswitch, pl_checkhitswitch) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerkick, playerkick) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(act, DDukeActor); playerkick(self, act); return 0; @@ -1381,7 +1381,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerkick, playerkick) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerstomp, playerstomp) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(act, DDukeActor); playerstomp(self, act); return 0; @@ -1389,7 +1389,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerstomp, playerstomp) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerreset, playerreset) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(act, DDukeActor); playerreset(self, act); return 0; @@ -1397,7 +1397,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerreset, playerreset) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addphealth, addphealth) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(amt); PARAM_INT(big); addphealth(self, amt, big); @@ -1406,30 +1406,30 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addphealth, addphealth) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, wackplayer, wackplayer) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); wackplayer(self); return 0; } -static void duke_checkweapons(DukePlayer* p) +static void duke_checkweapons(DDukePlayer* p) { fi.checkweapons(p); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, checkweapons, duke_checkweapons) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); duke_checkweapons(self); return 0; } -static void msg(DukePlayer* p, int num) +static void msg(DDukePlayer* p, int num) { FTA(num, p); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, FTA, msg) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(num); FTA(num, self); return 0; @@ -1437,7 +1437,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, FTA, msg) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playercheckinventory, playercheckinventory) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(act, DDukeActor); PARAM_INT(num); PARAM_INT(amt); @@ -1446,7 +1446,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playercheckinventory, playercheckinve DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddinventory, playeraddinventory) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_POINTER(act, DDukeActor); PARAM_INT(num); PARAM_INT(amt); @@ -1456,7 +1456,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddinventory, playeraddinventor DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddweapon, playeraddweapon) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(num); PARAM_INT(amt); ACTION_RETURN_BOOL(playeraddweapon(self, num, amt)); @@ -1464,7 +1464,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddweapon, playeraddweapon) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddammo, playeraddammo) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(num); PARAM_INT(amt); ACTION_RETURN_BOOL(playeraddammo(self, num, amt)); @@ -1472,14 +1472,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddammo, playeraddammo) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, forceplayerangle, forceplayerangle) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); forceplayerangle(self); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playereat, playereat) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(amt); PARAM_BOOL(big); ACTION_RETURN_BOOL(playereat(self, amt, big)); @@ -1487,7 +1487,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playereat, playereat) DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerdrink, playerdrink) { - PARAM_SELF_STRUCT_PROLOGUE(DukePlayer); + PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_INT(amt); playerdrink(self, amt); return 0; @@ -1609,7 +1609,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, operateactivators, operateactivators) { PARAM_PROLOGUE; PARAM_INT(lotag); - PARAM_POINTER(p, DukePlayer); + PARAM_POINTER(p, DDukePlayer); operateactivators(lotag, p); return 0; } diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 52b4d6e63..0716f7bd9 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -138,7 +138,7 @@ void SetNewWeaponIfBetter(int nPlayer, int nWeapon); void SelectNewWeapon(int nPlayer); void CheckClip(int nPlayer); void MoveWeapons(int nPlayer); -void DrawWeapons(ExhumedPlayer* const pPlayer, double interpfrac); +void DrawWeapons(DExhumedPlayer* const pPlayer, double interpfrac); // items diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 95d85979f..66e3c1518 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -58,6 +58,14 @@ IMPLEMENT_POINTERS_START(DExhumedActor) IMPLEMENT_POINTER(pTarget) IMPLEMENT_POINTERS_END +IMPLEMENT_CLASS(DExhumedPlayer, false, true) +IMPLEMENT_POINTERS_START(DExhumedPlayer) +IMPLEMENT_POINTER(pTarget) +IMPLEMENT_POINTER(pDoppleSprite) +IMPLEMENT_POINTER(pPlayerFloorSprite) +IMPLEMENT_POINTER(pPlayerGrenade) +IMPLEMENT_POINTERS_END + size_t MarkMove(); size_t MarkBullets(); size_t MarkItems(); @@ -419,8 +427,8 @@ void GameInterface::app_init() // Initialise player array. for (unsigned i = 0; i < MAXPLAYERS; i++) { - PlayerArray[i] = new ExhumedPlayer; - *getPlayer(i) = {}; + PlayerArray[i] = Create(i); + GC::WriteBarrier(PlayerArray[i]); } GC::AddMarkerFunc(markgcroots); diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index eeee3cc0f..3041536c1 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -902,7 +902,7 @@ loc_flag: // //--------------------------------------------------------------------------- -void DrawWeapons(ExhumedPlayer* const pPlayer, double interpfrac) +void DrawWeapons(DExhumedPlayer* const pPlayer, double interpfrac) { const auto pPlayerActor = pPlayer->GetActor(); const int nWeapon = pPlayer->nCurrentWeapon; diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 458a7d632..61b6ed61b 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -83,18 +83,6 @@ int nCurStartSprite; size_t MarkPlayers() { - for (int i = 0; i < MAXPLAYERS; i++) - { - auto plr = getPlayer(i); - if (plr) - { - GC::Mark(plr->actor); - GC::Mark(plr->pDoppleSprite); - GC::Mark(plr->pPlayerFloorSprite); - GC::Mark(plr->pPlayerGrenade); - GC::Mark(plr->pTarget); - } - } GC::MarkArray(nNetStartSprite, MAXPLAYERS); return 6 * MAXPLAYERS; } @@ -147,7 +135,7 @@ void InitPlayerKeys(int nPlayer) void InitPlayerInventory(int nPlayer) { const auto pPlayer = getPlayer(nPlayer); - memset(pPlayer, 0, sizeof(ExhumedPlayer)); + pPlayer->Clear(); ResetPlayerWeapons(nPlayer); @@ -712,7 +700,7 @@ static DExhumedActor* feebtag(const DVector3& pos, sectortype* pSector, int nMag // //--------------------------------------------------------------------------- -static void doPickupNotification(ExhumedPlayer* const pPlayer, const int nItem, const int nSound = -1, const int tintRed = 0, const int tintGreen = 16) +static void doPickupNotification(DExhumedPlayer* const pPlayer, const int nItem, const int nSound = -1, const int tintRed = 0, const int tintGreen = 16) { if (pPlayer->pnum != nLocalPlayer) return; @@ -758,7 +746,7 @@ static void doPickupDestroy(DExhumedActor* const pPickupActor, const int nItem) // //--------------------------------------------------------------------------- -static void doPickupWeapon(ExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, int nItem, int nWeapon, int nAmount, int nSound = kSound72) +static void doPickupWeapon(DExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, int nItem, int nWeapon, int nAmount, int nSound = kSound72) { const int weapFlag = 1 << nWeapon; @@ -796,7 +784,7 @@ static void doPickupWeapon(ExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, // //--------------------------------------------------------------------------- -static void doPickupHealth(ExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, int nItem, const int nAmount, int nSound) +static void doPickupHealth(DExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, int nItem, const int nAmount, int nSound) { if (!pPickupActor->spr.hitag || nAmount > 0 && pPlayer->nHealth >= 800) return; @@ -844,7 +832,7 @@ static void doPickupHealth(ExhumedPlayer* pPlayer, DExhumedActor* pPickupActor, // //--------------------------------------------------------------------------- -void doPlayerItemPickups(ExhumedPlayer* const pPlayer) +void doPlayerItemPickups(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); const auto pPlayerSect = pPlayerActor->sector(); @@ -1044,7 +1032,7 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -void updatePlayerTarget(ExhumedPlayer* const pPlayer) +void updatePlayerTarget(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); const auto pRa = &Ra[pPlayer->pnum]; @@ -1107,7 +1095,7 @@ void updatePlayerTarget(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void updatePlayerVelocity(ExhumedPlayer* const pPlayer) +static void updatePlayerVelocity(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); @@ -1139,7 +1127,7 @@ static void updatePlayerVelocity(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void updatePlayerInventory(ExhumedPlayer* const pPlayer) +static void updatePlayerInventory(DExhumedPlayer* const pPlayer) { if (const auto invDir = !!(pPlayer->cmd.ucmd.actions & SB_INVNEXT) - !!(pPlayer->cmd.ucmd.actions & SB_INVPREV)) { @@ -1181,7 +1169,7 @@ static void updatePlayerInventory(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void updatePlayerWeapon(ExhumedPlayer* const pPlayer) +static void updatePlayerWeapon(DExhumedPlayer* const pPlayer) { const bool bIsFiring = pPlayer->cmd.ucmd.actions & SB_FIRE; @@ -1237,7 +1225,7 @@ unsigned GameInterface::getCrouchState() // //--------------------------------------------------------------------------- -static void updatePlayerAction(ExhumedPlayer* const pPlayer) +static void updatePlayerAction(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); const auto pInput = &pPlayer->cmd.ucmd; @@ -1356,7 +1344,7 @@ static void updatePlayerAction(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void doPlayerCounters(ExhumedPlayer* const pPlayer) +static void doPlayerCounters(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); const bool bConsolePlayer = pPlayer->pnum == nLocalPlayer; @@ -1437,7 +1425,7 @@ static void doPlayerCounters(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void doPlayerUnderwater(ExhumedPlayer* const pPlayer, const bool oUnderwater) +static void doPlayerUnderwater(DExhumedPlayer* const pPlayer, const bool oUnderwater) { const auto pPlayerActor = pPlayer->GetActor(); const bool bUnderwater = pPlayer->pPlayerViewSect->Flag & kSectUnderwater; @@ -1527,7 +1515,7 @@ static void doPlayerUnderwater(ExhumedPlayer* const pPlayer, const bool oUnderwa // //--------------------------------------------------------------------------- -static void doPlayerRamses(ExhumedPlayer* const pPlayer) +static void doPlayerRamses(DExhumedPlayer* const pPlayer) { setForcedSyncInput(pPlayer->pnum); @@ -1571,7 +1559,7 @@ static void doPlayerGravity(DExhumedActor* const pPlayerActor) // //--------------------------------------------------------------------------- -static void doPlayerCameraEffects(ExhumedPlayer* const pPlayer, const double nDestVertPan) +static void doPlayerCameraEffects(DExhumedPlayer* const pPlayer, const double nDestVertPan) { const auto pPlayerActor = pPlayer->GetActor(); const auto nUnderwater = !!(pPlayerActor->sector()->Flag & kSectUnderwater); @@ -1613,7 +1601,7 @@ static void doPlayerCameraEffects(ExhumedPlayer* const pPlayer, const double nDe // //--------------------------------------------------------------------------- -static void updatePlayerFloorActor(ExhumedPlayer* const pPlayer) +static void updatePlayerFloorActor(DExhumedPlayer* const pPlayer) { DExhumedActor* const pFloorActor = pPlayer->pPlayerFloorSprite; @@ -1635,7 +1623,7 @@ static void updatePlayerFloorActor(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void updatePlayerDoppleActor(ExhumedPlayer* const pPlayer) +static void updatePlayerDoppleActor(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); const auto pPlayerSect = pPlayerActor->sector(); @@ -1660,7 +1648,7 @@ static void updatePlayerDoppleActor(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void updatePlayerViewSector(ExhumedPlayer* const pPlayer, const Collision& nMove, const DVector3& spr_vel) +static void updatePlayerViewSector(DExhumedPlayer* const pPlayer, const Collision& nMove, const DVector3& spr_vel) { const auto pPlayerActor = pPlayer->GetActor(); const auto pPlayerSect = pPlayerActor->sector(); @@ -1699,7 +1687,7 @@ static void updatePlayerViewSector(ExhumedPlayer* const pPlayer, const Collision // //--------------------------------------------------------------------------- -static void doPlayerFloorDamage(ExhumedPlayer* const pPlayer, const double nStartVelZ) +static void doPlayerFloorDamage(DExhumedPlayer* const pPlayer, const double nStartVelZ) { const auto pPlayerActor = pPlayer->GetActor(); pPlayer->nThrust *= 0.5; @@ -1728,7 +1716,7 @@ static void doPlayerFloorDamage(ExhumedPlayer* const pPlayer, const double nStar // //--------------------------------------------------------------------------- -static void doPlayerMovingBlocks(ExhumedPlayer* const pPlayer, const Collision& nMove, const DVector3& spr_vel, sectortype* const spr_sect) +static void doPlayerMovingBlocks(DExhumedPlayer* const pPlayer, const Collision& nMove, const DVector3& spr_vel, sectortype* const spr_sect) { const auto pPlayerActor = pPlayer->GetActor(); sectortype* sect; @@ -1786,7 +1774,7 @@ static void doPlayerMovingBlocks(ExhumedPlayer* const pPlayer, const Collision& // //--------------------------------------------------------------------------- -static bool doPlayerInput(ExhumedPlayer* const pPlayer) +static bool doPlayerInput(DExhumedPlayer* const pPlayer) { // update the player/actor's velocity before anything. updatePlayerVelocity(pPlayer); @@ -1878,7 +1866,7 @@ static bool doPlayerInput(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void doPlayerRunlistSignals(ExhumedPlayer* const pPlayer, sectortype* const pStartSect) +static void doPlayerRunlistSignals(DExhumedPlayer* const pPlayer, sectortype* const pStartSect) { const auto pPlayerActor = pPlayer->GetActor(); const auto pPlayerSect = pPlayerActor->sector(); @@ -1917,7 +1905,7 @@ static void doPlayerRunlistSignals(ExhumedPlayer* const pPlayer, sectortype* con // //--------------------------------------------------------------------------- -static bool doPlayerDeathRestart(ExhumedPlayer* const pPlayer) +static bool doPlayerDeathRestart(DExhumedPlayer* const pPlayer) { if (!(pPlayer->cmd.ucmd.actions & SB_OPEN) || pPlayer->GetActor()->nAction < 16) return true; @@ -1963,7 +1951,7 @@ static bool doPlayerDeathRestart(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void doPlayerActionSequence(ExhumedPlayer* const pPlayer) +static void doPlayerActionSequence(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); @@ -2018,7 +2006,7 @@ static void doPlayerActionSequence(ExhumedPlayer* const pPlayer) // //--------------------------------------------------------------------------- -static void doPlayerDeathPitch(ExhumedPlayer* const pPlayer) +static void doPlayerDeathPitch(DExhumedPlayer* const pPlayer) { const auto pPlayerActor = pPlayer->GetActor(); pPlayer->nThrust.Zero(); @@ -2107,7 +2095,7 @@ void AIPlayer::Tick(RunListEvent* ev) // //--------------------------------------------------------------------------- -FSerializer& Serialize(FSerializer& arc, const char* keyname, ExhumedPlayer& w, ExhumedPlayer* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, DExhumedPlayer& w, DExhumedPlayer* def) { if (arc.BeginObject(keyname)) { @@ -2199,29 +2187,29 @@ void SerializePlayer(FSerializer& arc) // //--------------------------------------------------------------------------- -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nHealth); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nLives); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nDouble); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nInvisible); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nTorch); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, actor); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, bIsMummified); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, invincibility); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nAir); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nMaskAmount); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, keys); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nMagic); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nItem); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, items); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nAmmo); // TODO - kMaxWeapons? -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nPlayerWeapons); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nCurrentWeapon); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nWeapFrame); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, bIsFiring); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nNextWeapon); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nState); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nLastWeapon); -DEFINE_FIELD_X(ExhumedPlayer, ExhumedPlayer, nRun); +DEFINE_FIELD(DExhumedPlayer, actor) +DEFINE_FIELD(DExhumedPlayer, nHealth); +DEFINE_FIELD(DExhumedPlayer, nLives); +DEFINE_FIELD(DExhumedPlayer, nDouble); +DEFINE_FIELD(DExhumedPlayer, nInvisible); +DEFINE_FIELD(DExhumedPlayer, nTorch); +DEFINE_FIELD(DExhumedPlayer, bIsMummified); +DEFINE_FIELD(DExhumedPlayer, invincibility); +DEFINE_FIELD(DExhumedPlayer, nAir); +DEFINE_FIELD(DExhumedPlayer, nMaskAmount); +DEFINE_FIELD(DExhumedPlayer, keys); +DEFINE_FIELD(DExhumedPlayer, nMagic); +DEFINE_FIELD(DExhumedPlayer, nItem); +DEFINE_FIELD(DExhumedPlayer, items); +DEFINE_FIELD(DExhumedPlayer, nAmmo); // TODO - kMaxWeapons? +DEFINE_FIELD(DExhumedPlayer, nPlayerWeapons); +DEFINE_FIELD(DExhumedPlayer, nCurrentWeapon); +DEFINE_FIELD(DExhumedPlayer, nWeapFrame); +DEFINE_FIELD(DExhumedPlayer, bIsFiring); +DEFINE_FIELD(DExhumedPlayer, nNextWeapon); +DEFINE_FIELD(DExhumedPlayer, nState); +DEFINE_FIELD(DExhumedPlayer, nLastWeapon); +DEFINE_FIELD(DExhumedPlayer, nRun); DEFINE_ACTION_FUNCTION(_Exhumed, GetViewPlayer) { @@ -2240,14 +2228,13 @@ DEFINE_ACTION_FUNCTION(_Exhumed, GetPlayerClip) DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater) { - PARAM_SELF_STRUCT_PROLOGUE(ExhumedPlayer); - auto nLocalPlayer = self - (ExhumedPlayer*)PlayerArray; - ACTION_RETURN_BOOL(getPlayer((int)nLocalPlayer)->pPlayerViewSect->Flag & kSectUnderwater); + PARAM_SELF_STRUCT_PROLOGUE(DExhumedPlayer); + ACTION_RETURN_BOOL(self->pPlayerViewSect->Flag & kSectUnderwater); } DEFINE_ACTION_FUNCTION(_ExhumedPlayer, GetAngle) { - PARAM_SELF_STRUCT_PROLOGUE(ExhumedPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DExhumedPlayer); ACTION_RETURN_INT(self->GetActor()->spr.Angles.Yaw.Buildang()); } diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index 5285da1ea..a7f2ca1c4 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -47,8 +47,20 @@ struct PlayerSave DAngle nAngle; }; -struct ExhumedPlayer final : public CorePlayer +class DExhumedPlayer final : public DCorePlayer { + DECLARE_CLASS(DExhumedPlayer, DCorePlayer) + HAS_OBJECT_POINTERS + DExhumedPlayer() = default; +public: + DExhumedPlayer(uint8_t p) : DCorePlayer(p) {} + void Clear() + { + Super::Clear(); + // Quick'n dirty clear + memset(&nHealth, 0, sizeof(DExhumedPlayer) - myoffsetof(DExhumedPlayer, nHealth)); + } + int16_t nHealth; int16_t nLives; int16_t nDouble; @@ -116,9 +128,9 @@ struct ExhumedPlayer final : public CorePlayer extern int PlayerCount; -inline ExhumedPlayer* getPlayer(int index) +inline DExhumedPlayer* getPlayer(int index) { - return static_cast(PlayerArray[index]); + return static_cast(PlayerArray[index]); } extern TObjPtr nNetStartSprite[kMaxPlayers]; @@ -129,9 +141,9 @@ int GetPlayerFromActor(DExhumedActor* actor); void SetPlayerMummified(int nPlayer, int bIsMummified); int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount); void ShootStaff(int nPlayer); -void updatePlayerTarget(ExhumedPlayer* const pPlayer); +void updatePlayerTarget(DExhumedPlayer* const pPlayer); -inline void doPlayerVertPanning(ExhumedPlayer* const pPlayer, const double nDestVertPan) +inline void doPlayerVertPanning(DExhumedPlayer* const pPlayer, const double nDestVertPan) { const auto nVertPan = (nDestVertPan - pPlayer->Angles.ViewAngles.Pitch.Tan() * 128) * 0.25; pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.); diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index eb3521608..25d6edbaf 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -238,7 +238,7 @@ int CanHitPlayer(DSWActor* actor) int DoActorPickClosePlayer(DSWActor* actor) { int pnum; - SWPlayer* pp; + DSWPlayer* pp; // if actor can still see the player bool found = false; int i; @@ -362,7 +362,7 @@ TARGETACTOR: DSWActor* GetPlayerSpriteNum(DSWActor* actor) { int pnum; - SWPlayer* pp; + DSWPlayer* pp; TRAVERSE_CONNECT(pnum) { diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index 5a0d729d6..713724747 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -993,7 +993,7 @@ int DoBunnyQuickJump(DSWActor* actor) { if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { - SWPlayer* pp = nullptr; + DSWPlayer* pp = nullptr; if (RandomRange(1000) < 995 && hitActor->user.spal != PALETTE_PLAYER0) return false; diff --git a/source/games/sw/src/cheats.cpp b/source/games/sw/src/cheats.cpp index c6324012c..88afbb121 100644 --- a/source/games/sw/src/cheats.cpp +++ b/source/games/sw/src/cheats.cpp @@ -51,7 +51,7 @@ extern bool FAF_DebugView; extern bool ToggleFlyMode; const char *CheatKeyType; -void KeysCheat(SWPlayer* pp, const char *cheat_string); +void KeysCheat(DSWPlayer* pp, const char *cheat_string); //--------------------------------------------------------------------------- // @@ -59,7 +59,7 @@ void KeysCheat(SWPlayer* pp, const char *cheat_string); // //--------------------------------------------------------------------------- -static SWPlayer* checkCheat(cheatseq_t* c) +static DSWPlayer* checkCheat(cheatseq_t* c) { if (::CheckCheatmode(true, true)) return nullptr; return getPlayer(screenpeek); @@ -142,7 +142,7 @@ bool PrevCheat(cheatseq_t* c) bool MapCheat(cheatseq_t* c) { - SWPlayer* pp; + DSWPlayer* pp; if (!(pp=checkCheat(c))) return false; gFullMap = !gFullMap; // Need to do this differently. The code here was completely broken. @@ -158,7 +158,7 @@ bool MapCheat(cheatseq_t* c) bool WarpCheat(cheatseq_t* c) { - SWPlayer* pp; + DSWPlayer* pp; if (!(pp = checkCheat(c))) return false; int level_num; diff --git a/source/games/sw/src/d_menu.cpp b/source/games/sw/src/d_menu.cpp index 4254c6900..4a41e14fc 100644 --- a/source/games/sw/src/d_menu.cpp +++ b/source/games/sw/src/d_menu.cpp @@ -97,7 +97,7 @@ bool GameInterface::CanSave() bool GameInterface::StartGame(FNewGameStartup& gs) { - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); int handle = 0; int zero = 0; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index c7c51dbf6..45aac6fea 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -608,7 +608,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub { int tSpriteNum; static int ang = 0; - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); int newshade=0; const int DART_PIC = 2526; @@ -966,7 +966,7 @@ void post_analyzesprites(tspriteArray& tsprites) // //--------------------------------------------------------------------------- -void PrintSpriteInfo(SWPlayer* pp) +void PrintSpriteInfo(DSWPlayer* pp) { const int Y_STEP = 7; @@ -1010,7 +1010,7 @@ void PrintSpriteInfo(SWPlayer* pp) // //--------------------------------------------------------------------------- -static void DrawCrosshair(SWPlayer* pp, const double interpfrac) +static void DrawCrosshair(DSWPlayer* pp, const double interpfrac) { auto offsets = pp->Angles.getCrosshairOffsets(interpfrac); ::DrawCrosshair(pp->GetActor()->user.Health, offsets.first.X, offsets.first.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, offsets.second, shadeToLight(10)); @@ -1111,7 +1111,7 @@ void PreDrawStackedWater(void) } -void DoPlayerDiveMeter(SWPlayer* pp); +void DoPlayerDiveMeter(DSWPlayer* pp); //--------------------------------------------------------------------------- // @@ -1212,10 +1212,14 @@ void RestorePortalState() // //--------------------------------------------------------------------------- -void drawscreen(SWPlayer* pp, double interpfrac, bool sceneonly) +void drawscreen(DSWPlayer* pp, double interpfrac, bool sceneonly) { +#if 0 // prediction player if prediction is on, else regular player - SWPlayer* camerapp = (PredictionOn && CommEnabled && pp == getPlayer(myconnectindex)) ? ppp : pp; + DSWPlayer* camerapp = (PredictionOn && CommEnabled && pp == getPlayer(myconnectindex)) ? ppp : pp; +#else + DSWPlayer* camerapp = pp; +#endif PreDraw(); PreUpdatePanel(interpfrac); diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 1a8fc104c..49b3ad60b 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -97,7 +97,6 @@ IMPLEMENT_CLASS(DSWActor, false, true) IMPLEMENT_POINTERS_START(DSWActor) IMPLEMENT_POINTER(ownerActor) IMPLEMENT_POINTER(user.lowActor) -IMPLEMENT_POINTER(user.lowActor) IMPLEMENT_POINTER(user.highActor) IMPLEMENT_POINTER(user.targetActor) IMPLEMENT_POINTER(user.flameActor) @@ -105,6 +104,17 @@ IMPLEMENT_POINTER(user.attachActor) IMPLEMENT_POINTER(user.WpnGoalActor) IMPLEMENT_POINTERS_END +IMPLEMENT_CLASS(DSWPlayer, false, true) +IMPLEMENT_POINTERS_START(DSWPlayer) +IMPLEMENT_POINTER(remoteActor) +IMPLEMENT_POINTER(lowActor) +IMPLEMENT_POINTER(highActor) +IMPLEMENT_POINTER(PlayerUnderActor) +IMPLEMENT_POINTER(KillerActor) +IMPLEMENT_POINTER(HitBy) +IMPLEMENT_POINTER(last_camera_act) +IMPLEMENT_POINTERS_END + void MarkSOInterp(); extern int FinishTimer; @@ -118,21 +128,6 @@ void markgcroots() GC::MarkArray(GenericQueue, MAX_GENERIC_QUEUE); GC::MarkArray(LoWangsQueue, MAX_LOWANGS_QUEUE); GC::MarkArray(BossSpriteNum, 3); - for (int i = 0; i < MAXPLAYERS; i++) - { - auto plr = getPlayer(i); - if (plr) - { - GC::Mark(plr->actor); - GC::Mark(plr->lowActor); - GC::Mark(plr->highActor); - GC::Mark(plr->remoteActor); - GC::Mark(plr->PlayerUnderActor); - GC::Mark(plr->KillerActor); - GC::Mark(plr->HitBy); - GC::Mark(plr->last_camera_act); - } - } for (auto& so : SectorObject) { GC::Mark(so.controller); @@ -152,7 +147,7 @@ void markgcroots() } -void pClearSpriteList(SWPlayer* pp); +void pClearSpriteList(DSWPlayer* pp); int GameVersion = 20; @@ -257,8 +252,8 @@ void GameInterface::app_init() // Initialise player array. for (unsigned i = 0; i < MAXPLAYERS; i++) { - PlayerArray[i] = new SWPlayer; - *getPlayer(i) = {}; + PlayerArray[i] = Create(i); + GC::WriteBarrier(PlayerArray[i]); } // these are frequently checked markers. @@ -425,7 +420,7 @@ void InitLevel(MapRecord *maprec) // don't jack with the playerreadyflag int ready_bak = getPlayer(i)->playerreadyflag; int ver_bak = getPlayer(i)->PlayerVersion; - *getPlayer(i) = {}; + getPlayer(i)->Clear(); getPlayer(i)->playerreadyflag = ready_bak; getPlayer(i)->PlayerVersion = ver_bak; INITLIST(&getPlayer(i)->PanelSpriteList); @@ -583,7 +578,7 @@ void TerminateLevel(void) TRAVERSE_CONNECT(pnum) { - SWPlayer* pp = getPlayer(pnum); + DSWPlayer* pp = getPlayer(pnum); if (pp->Flags & PF_DEAD) PlayerDeathReset(pp); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index d54e54247..217632b8b 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -327,7 +327,7 @@ enum dam // Forward declarations struct STATE; struct PANEL_STATE; -struct SWPlayer; +class DSWPlayer; struct PERSONALITY; struct ATTRIBUTE; struct SECTOR_OBJECT; @@ -427,7 +427,7 @@ enum struct DAMAGE_DATA { - void (*Init)(SWPlayer*); + void (*Init)(DSWPlayer*); int16_t damage_lo; int16_t damage_hi; unsigned int radius; @@ -444,24 +444,24 @@ extern DAMAGE_DATA DamageData[]; extern int WeaponHasNoAmmo, WeaponIsAmmo; -void InitWeaponFist(SWPlayer*); -void InitWeaponStar(SWPlayer*); -void InitWeaponShotgun(SWPlayer*); -void InitWeaponRocket(SWPlayer*); -void InitWeaponRail(SWPlayer*); -void InitWeaponMicro(SWPlayer*); -void InitWeaponUzi(SWPlayer*); -void InitWeaponSword(SWPlayer*); -void InitWeaponHothead(SWPlayer*); -void InitWeaponElectro(SWPlayer*); -void InitWeaponHeart(SWPlayer*); -void InitWeaponGrenade(SWPlayer*); -void InitWeaponMine(SWPlayer*); +void InitWeaponFist(DSWPlayer*); +void InitWeaponStar(DSWPlayer*); +void InitWeaponShotgun(DSWPlayer*); +void InitWeaponRocket(DSWPlayer*); +void InitWeaponRail(DSWPlayer*); +void InitWeaponMicro(DSWPlayer*); +void InitWeaponUzi(DSWPlayer*); +void InitWeaponSword(DSWPlayer*); +void InitWeaponHothead(DSWPlayer*); +void InitWeaponElectro(DSWPlayer*); +void InitWeaponHeart(DSWPlayer*); +void InitWeaponGrenade(DSWPlayer*); +void InitWeaponMine(DSWPlayer*); -void InitWeaponNapalm(SWPlayer*); -void InitWeaponRing(SWPlayer*); +void InitWeaponNapalm(DSWPlayer*); +void InitWeaponRing(DSWPlayer*); -extern void (*InitWeapon[MAX_WEAPONS]) (SWPlayer*); +extern void (*InitWeapon[MAX_WEAPONS]) (DSWPlayer*); /////////////////////////////////////////////////////////////////////////////////////////// // @@ -525,7 +525,7 @@ enum PlayerDeathTypes PLAYER_DEATH_FLIP, PLAYER_DEATH_CRUMBLE, PLAYER_DEATH_EXPLODE, PLAYER_DEATH_RIPPER, PLAYER_DEATH_SQUISH, PLAYER_DEATH_DROWN, MAX_PLAYER_DEATHS }; -typedef void (*PLAYER_ACTION_FUNCp)(SWPlayer*); +typedef void (*PLAYER_ACTION_FUNCp)(DSWPlayer*); #include "inv.h" @@ -755,7 +755,7 @@ struct USER // if a player's sprite points to player structure - SWPlayer* PlayerP; + DSWPlayer* PlayerP; int16_t Sibling; @@ -1413,10 +1413,10 @@ enum short SoundAngle(int x, int y); //void PlaySound(int num, short angle, short vol); -int _PlaySound(FSoundID num, DSWActor* sprite, SWPlayer* player, const DVector3 *const pos, int flags, int channel, EChanFlags sndflags); +int _PlaySound(FSoundID num, DSWActor* sprite, DSWPlayer* player, const DVector3 *const pos, int flags, int channel, EChanFlags sndflags); void InitAmbient(int num, DSWActor* actor); -inline void PlaySound(int num, SWPlayer* player, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) +inline void PlaySound(int num, DSWPlayer* player, int flags, int channel = 8, EChanFlags sndflags = CHANF_NONE) { _PlaySound(soundEngine->FindSoundByResID(num), nullptr, player, nullptr, flags | v3df_follow, channel, sndflags); } @@ -1429,20 +1429,20 @@ inline void PlaySound(int num, const DVector3 &pos, int flags, int channel = 8, _PlaySound(soundEngine->FindSoundByResID(num), nullptr, nullptr, &pos, flags, channel, sndflags); } -int _PlayerSound(int num, SWPlayer* pp); -inline int PlayerSound(int num, int flags, SWPlayer* pp) { return _PlayerSound(num, pp); } -void StopPlayerSound(SWPlayer* pp, int which = -1); +int _PlayerSound(int num, DSWPlayer* pp); +inline int PlayerSound(int num, int flags, DSWPlayer* pp) { return _PlayerSound(num, pp); } +void StopPlayerSound(DSWPlayer* pp, int which = -1); bool SoundValidAndActive(DSWActor* spr, int channel); struct BREAK_INFO; int SpawnShrap(DSWActor*, DSWActor*, int = -1, BREAK_INFO* breakinfo = nullptr); -void PlayerUpdateHealth(SWPlayer* pp, short value); -void PlayerUpdateAmmo(SWPlayer* pp, short WeaponNum, short value); -void PlayerUpdateWeapon(SWPlayer* pp, short WeaponNum); -void PlayerUpdateKills(SWPlayer* pp, short value); -void RefreshInfoLine(SWPlayer* pp); +void PlayerUpdateHealth(DSWPlayer* pp, short value); +void PlayerUpdateAmmo(DSWPlayer* pp, short WeaponNum, short value); +void PlayerUpdateWeapon(DSWPlayer* pp, short WeaponNum); +void PlayerUpdateKills(DSWPlayer* pp, short value); +void RefreshInfoLine(DSWPlayer* pp); void DoAnim(int numtics); void AnimDelete(int animtype, int animindex, DSWActor*); @@ -1571,8 +1571,8 @@ extern int16_t StatDamageList[STAT_DAMAGE_LIST_SIZE]; // /////////////////////////////////////////////////////////////// -extern void SetFadeAmt(SWPlayer* pp, short damage, uint8_t startcolor); -extern void DoPaletteFlash(SWPlayer* pp); +extern void SetFadeAmt(DSWPlayer* pp, short damage, uint8_t startcolor); +extern void DoPaletteFlash(DSWPlayer* pp); extern bool NightVision; @@ -1608,9 +1608,9 @@ void InitSetup(void); // setup.c void LoadKVXFromScript(TilesetBuildInfo& info, const char *filename); // scrip2.c void LoadCustomInfoFromScript(const char *filename); // scrip2.c -int PlayerInitChemBomb(SWPlayer* pp); // jweapon.c -int PlayerInitFlashBomb(SWPlayer* pp); // jweapon.c -int PlayerInitCaltrops(SWPlayer* pp); // jweapon.c +int PlayerInitChemBomb(DSWPlayer* pp); // jweapon.c +int PlayerInitFlashBomb(DSWPlayer* pp); // jweapon.c +int PlayerInitCaltrops(DSWPlayer* pp); // jweapon.c int InitPhosphorus(DSWActor*); // jweapon.c void SpawnFloorSplash(DSWActor*); // jweapon.c @@ -1676,9 +1676,20 @@ END_SW_NS BEGIN_SW_NS -struct SWPlayer final : public CorePlayer +class DSWPlayer final : public DCorePlayer { - DSWActor* actor; // this may not be a TObjPtr! + DECLARE_CLASS(DSWPlayer, DCorePlayer) + HAS_OBJECT_POINTERS + DSWPlayer() = default; +public: + void Clear() + { + Super::Clear(); + // Quick'n dirty clear + memset(&lowActor, 0, sizeof(DSWPlayer) - myoffsetof(DSWPlayer, lowActor)); + } + + DSWPlayer(uint8_t p) : DCorePlayer(p) {} TObjPtr lowActor, highActor; TObjPtr remoteActor; TObjPtr PlayerUnderActor; @@ -1854,9 +1865,9 @@ struct SWPlayer final : public CorePlayer } }; -inline SWPlayer* getPlayer(int index) +inline DSWPlayer* getPlayer(int index) { - return static_cast(PlayerArray[index]); + return static_cast(PlayerArray[index]); } @@ -1917,7 +1928,7 @@ inline bool SectorIsUnderwaterArea(sectortype* sect) return sect && sect->extra & (SECTFX_UNDERWATER | SECTFX_UNDERWATER2); } -inline bool PlayerFacingRange(SWPlayer* pp, DSWActor* a, DAngle range) +inline bool PlayerFacingRange(DSWPlayer* pp, DSWActor* a, DAngle range) { return absangle((a->spr.pos.XY() - pp->GetActor()->spr.pos.XY()).Angle(), pp->GetActor()->spr.Angles.Yaw) < range; } @@ -2072,7 +2083,7 @@ inline bool SpriteInUnderwaterArea(DSWActor* a) // just determine if the player is moving -inline bool PLAYER_MOVING(SWPlayer* pp) +inline bool PLAYER_MOVING(DSWPlayer* pp) { return !pp->vect.isZero(); } diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index 3341f6b58..2b6c96215 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -551,7 +551,7 @@ int DoHornetDeath(DSWActor* actor) int DoCheckSwarm(DSWActor* actor) { double dist, pdist; - SWPlayer* pp; + DSWPlayer* pp; if (!MoveSkip8) return 0; // Don't over check diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index 4b37f3143..eda6930df 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -70,7 +70,7 @@ enum // //--------------------------------------------------------------------------- -void processWeapon(SWPlayer* const pp) +void processWeapon(DSWPlayer* const pp) { DSWActor* plActor = pp->GetActor(); if (plActor == nullptr) return; diff --git a/source/games/sw/src/inv.cpp b/source/games/sw/src/inv.cpp index d377e818d..9469f3ed5 100644 --- a/source/games/sw/src/inv.cpp +++ b/source/games/sw/src/inv.cpp @@ -44,28 +44,28 @@ BEGIN_SW_NS extern short NormalVisibility; -void PlayerUpdateInventory(SWPlayer* pp, short InventoryNum); -void InventoryUse(SWPlayer* pp); -void InventoryStop(SWPlayer* pp, short InventoryNum); +void PlayerUpdateInventory(DSWPlayer* pp, short InventoryNum); +void InventoryUse(DSWPlayer* pp); +void InventoryStop(DSWPlayer* pp, short InventoryNum); -void UseInventoryRepairKit(SWPlayer* pp); -void UseInventoryMedkit(SWPlayer* pp); -void UseInventoryRepairKit(SWPlayer* pp); -void UseInventoryCloak(SWPlayer* pp); -void UseInventoryEnvironSuit(SWPlayer* pp); -void UseInventoryNightVision(SWPlayer* pp); -void UseInventoryChemBomb(SWPlayer* pp); -void UseInventoryFlashBomb(SWPlayer* pp); -void UseInventoryCaltrops(SWPlayer* pp); +void UseInventoryRepairKit(DSWPlayer* pp); +void UseInventoryMedkit(DSWPlayer* pp); +void UseInventoryRepairKit(DSWPlayer* pp); +void UseInventoryCloak(DSWPlayer* pp); +void UseInventoryEnvironSuit(DSWPlayer* pp); +void UseInventoryNightVision(DSWPlayer* pp); +void UseInventoryChemBomb(DSWPlayer* pp); +void UseInventoryFlashBomb(DSWPlayer* pp); +void UseInventoryCaltrops(DSWPlayer* pp); -void StopInventoryRepairKit(SWPlayer* pp, short); -void StopInventoryMedkit(SWPlayer* pp, short); -void StopInventoryRepairKit(SWPlayer* pp, short); -void StopInventoryCloak(SWPlayer* pp, short); -void StopInventoryEnvironSuit(SWPlayer* pp, short); -void StopInventoryNightVision(SWPlayer* pp, short); +void StopInventoryRepairKit(DSWPlayer* pp, short); +void StopInventoryMedkit(DSWPlayer* pp, short); +void StopInventoryRepairKit(DSWPlayer* pp, short); +void StopInventoryCloak(DSWPlayer* pp, short); +void StopInventoryEnvironSuit(DSWPlayer* pp, short); +void StopInventoryNightVision(DSWPlayer* pp, short); extern PANEL_STATE ps_PanelEnvironSuit[]; @@ -96,14 +96,14 @@ void PanelInvTestSuicide(PANEL_SPRITE* psp) } } -void KillPanelInv(SWPlayer* pp, short InventoryNum) +void KillPanelInv(DSWPlayer* pp, short InventoryNum) { ASSERT(InventoryNum < MAX_INVENTORY); pp->InventoryTics[InventoryNum] = 0; } -void KillAllPanelInv(SWPlayer* pp) +void KillAllPanelInv(DSWPlayer* pp) { for (int i = 0; i < MAX_INVENTORY; i++) { @@ -117,7 +117,7 @@ void KillAllPanelInv(SWPlayer* pp) // ////////////////////////////////////////////////////////////////////// -void AutoPickInventory(SWPlayer* pp) +void AutoPickInventory(DSWPlayer* pp) { int i; @@ -149,7 +149,7 @@ void AutoPickInventory(SWPlayer* pp) // //--------------------------------------------------------------------------- -void UseInventoryMedkit(SWPlayer* pp) +void UseInventoryMedkit(DSWPlayer* pp) { short diff; short inv = INVENTORY_MEDKIT; @@ -196,7 +196,7 @@ void UseInventoryMedkit(SWPlayer* pp) // CHEMICAL WARFARE CANISTERS // ////////////////////////////////////////////////////////////////////// -void UseInventoryChemBomb(SWPlayer* pp) +void UseInventoryChemBomb(DSWPlayer* pp) { short inv = INVENTORY_CHEMBOMB; @@ -219,7 +219,7 @@ void UseInventoryChemBomb(SWPlayer* pp) // FLASH BOMBS // ////////////////////////////////////////////////////////////////////// -void UseInventoryFlashBomb(SWPlayer* pp) +void UseInventoryFlashBomb(DSWPlayer* pp) { short inv = INVENTORY_FLASHBOMB; @@ -242,7 +242,7 @@ void UseInventoryFlashBomb(SWPlayer* pp) // CALTROPS // ////////////////////////////////////////////////////////////////////// -void UseInventoryCaltrops(SWPlayer* pp) +void UseInventoryCaltrops(DSWPlayer* pp) { short inv = INVENTORY_CALTROPS; @@ -266,7 +266,7 @@ void UseInventoryCaltrops(SWPlayer* pp) // ////////////////////////////////////////////////////////////////////// -void UseInventoryRepairKit(SWPlayer* pp) +void UseInventoryRepairKit(DSWPlayer* pp) { short inv = INVENTORY_REPAIR_KIT; @@ -294,7 +294,7 @@ void UseInventoryRepairKit(SWPlayer* pp) // ////////////////////////////////////////////////////////////////////// -void UseInventoryCloak(SWPlayer* pp) +void UseInventoryCloak(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -319,7 +319,7 @@ void UseInventoryCloak(SWPlayer* pp) PlayerSound(DIGI_IAMSHADOW, v3df_follow|v3df_dontpan,pp); } -void StopInventoryCloak(SWPlayer* pp, short InventoryNum) +void StopInventoryCloak(DSWPlayer* pp, short InventoryNum) { DSWActor* plActor = pp->GetActor(); @@ -347,7 +347,7 @@ void StopInventoryCloak(SWPlayer* pp, short InventoryNum) // ////////////////////////////////////////////////////////////////////// -void DoPlayerNightVisionPalette(SWPlayer* pp) +void DoPlayerNightVisionPalette(DSWPlayer* pp) { if (pp != getPlayer(screenpeek)) return; @@ -370,7 +370,7 @@ void DoPlayerNightVisionPalette(SWPlayer* pp) } } -void UseInventoryNightVision(SWPlayer* pp) +void UseInventoryNightVision(DSWPlayer* pp) { if (pp->InventoryActive[pp->InventoryNum]) { @@ -387,7 +387,7 @@ void UseInventoryNightVision(SWPlayer* pp) PlaySound(DIGI_NIGHTON, pp, v3df_dontpan|v3df_follow); } -void StopInventoryNightVision(SWPlayer* pp, short InventoryNum) +void StopInventoryNightVision(DSWPlayer* pp, short InventoryNum) { pp->InventoryActive[InventoryNum] = false; @@ -414,7 +414,7 @@ void StopInventoryNightVision(SWPlayer* pp, short InventoryNum) // ////////////////////////////////////////////////////////////////////// -void InventoryKeys(SWPlayer* pp) +void InventoryKeys(DSWPlayer* pp) { // scroll SPELLs left if (pp->cmd.ucmd.actions & SB_INVPREV) @@ -507,7 +507,7 @@ void InventoryKeys(SWPlayer* pp) // //--------------------------------------------------------------------------- -void InventoryTimer(SWPlayer* pp) +void InventoryTimer(DSWPlayer* pp) { // called every time through loop short inv = 0; @@ -591,7 +591,7 @@ void InventoryTimer(SWPlayer* pp) // //--------------------------------------------------------------------------- -void InventoryUse(SWPlayer* pp) +void InventoryUse(DSWPlayer* pp) { INVENTORY_DATA* id = &InventoryData[pp->InventoryNum]; @@ -599,7 +599,7 @@ void InventoryUse(SWPlayer* pp) (*id->Init)(pp); } -void InventoryStop(SWPlayer* pp, short InventoryNum) +void InventoryStop(DSWPlayer* pp, short InventoryNum) { INVENTORY_DATA* id = &InventoryData[InventoryNum]; @@ -613,7 +613,7 @@ void InventoryStop(SWPlayer* pp, short InventoryNum) // ///////////////////////////////////////////////////////////////// -void PlayerUpdateInventory(SWPlayer* pp, short InventoryNum) +void PlayerUpdateInventory(DSWPlayer* pp, short InventoryNum) { pp->InventoryNum = InventoryNum; diff --git a/source/games/sw/src/inv.h b/source/games/sw/src/inv.h index 1fe0e477f..3ed1d1f0f 100644 --- a/source/games/sw/src/inv.h +++ b/source/games/sw/src/inv.h @@ -39,8 +39,8 @@ enum InventoryNames struct INVENTORY_DATA { const char* Name; - void (*Init)(SWPlayer*); - void (*Stop)(SWPlayer*, short); + void (*Init)(DSWPlayer*); + void (*Stop)(DSWPlayer*, short); short DecPerSec; short MaxInv; int Scale; @@ -56,7 +56,7 @@ enum EInvFlags INVF_COUNT = 4 }; -void PlayerUpdateInventory(SWPlayer* pp, short InventoryNum); -void InventoryKeys(SWPlayer* pp); -void UseInventoryRepairKit(SWPlayer* pp); -void InventoryTimer(SWPlayer* pp); +void PlayerUpdateInventory(DSWPlayer* pp, short InventoryNum); +void InventoryKeys(DSWPlayer* pp); +void UseInventoryRepairKit(DSWPlayer* pp); +void InventoryTimer(DSWPlayer* pp); diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 345753bed..dcc69031a 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -376,7 +376,7 @@ void drawroomstotile(const DVector3& pos, DAngle ang, DAngle horiz, sectortype* void JS_ProcessEchoSpot() { - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); int16_t reverb; bool reverb_set = false; @@ -417,7 +417,7 @@ short camplayerview = 1; // Don't show yourself! // Hack job alert! // Mirrors and cameras are maintained in the same data structure, but for hardware rendering they cannot be interleaved. // So this function replicates JS_DrawMirrors to only process the camera textures but not change any global state. -void JS_DrawCameras(SWPlayer* pp, const DVector3& campos, double smoothratio) +void JS_DrawCameras(DSWPlayer* pp, const DVector3& campos, double smoothratio) { int cnt; double dist; @@ -557,7 +557,7 @@ void JS_DrawCameras(SWPlayer* pp, const DVector3& campos, double smoothratio) { if (dist < MAXCAMDIST) { - SWPlayer* cp = getPlayer(camplayerview); + DSWPlayer* cp = getPlayer(camplayerview); if (TEST_BOOL11(camactor) && numplayers > 1) { @@ -577,11 +577,11 @@ void JS_DrawCameras(SWPlayer* pp, const DVector3& campos, double smoothratio) // Workaround until the camera code can be refactored to process all camera textures that were visible last frame. // Need to stash the parameters for later use. This is only used to find the nearest camera. -static SWPlayer* cam_pp; +static DSWPlayer* cam_pp; DVector3 cam_pos; static int oldstat; -void JS_CameraParms(SWPlayer* pp, const DVector3& tpos) +void JS_CameraParms(DSWPlayer* pp, const DVector3& tpos) { cam_pp = pp; cam_pos = tpos; diff --git a/source/games/sw/src/jsector.h b/source/games/sw/src/jsector.h index 1cb529aef..61fbd6b2f 100644 --- a/source/games/sw/src/jsector.h +++ b/source/games/sw/src/jsector.h @@ -64,7 +64,7 @@ extern bool mirrorinview; extern short NormalVisibility; void JAnalyzeSprites(tspritetype* tspr); -void JS_CameraParms(SWPlayer* pp, const DVector3& tpos); +void JS_CameraParms(DSWPlayer* pp, const DVector3& tpos); void JS_InitMirrors(void); void JS_ProcessEchoSpot(void); void JS_SpriteSetup(void); diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 33c83123d..bc93bce48 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1231,7 +1231,7 @@ int DoRadiationCloud(DSWActor* actor) // Inventory Chemical Bombs // ////////////////////////////////////////////// -int PlayerInitChemBomb(SWPlayer* pp) +int PlayerInitChemBomb(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -1398,7 +1398,7 @@ int InitChemBomb(DSWActor* actor) // //--------------------------------------------------------------------------- -int PlayerInitFlashBomb(SWPlayer* pp) +int PlayerInitFlashBomb(DSWPlayer* pp) { unsigned int stat; @@ -1473,7 +1473,7 @@ int InitFlashBomb(DSWActor* actor) int i; unsigned int stat; short damage; - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); PlaySound(DIGI_GASPOP, actor, v3df_dontpan | v3df_doppler); @@ -1605,7 +1605,7 @@ void SpawnFlashBombOnActor(DSWActor* actor) // //--------------------------------------------------------------------------- -int PlayerInitCaltrops(SWPlayer* pp) +int PlayerInitCaltrops(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index 627fe4f64..baa5d1886 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -43,7 +43,7 @@ BEGIN_SW_NS // //--------------------------------------------------------------------------- -Collision MultiClipMove(SWPlayer* pp, double zz, double floordist) +Collision MultiClipMove(DSWPlayer* pp, double zz, double floordist) { int i; DVector3 opos[MAX_CLIPBOX], pos[MAX_CLIPBOX]; @@ -122,7 +122,7 @@ Collision MultiClipMove(SWPlayer* pp, double zz, double floordist) // //--------------------------------------------------------------------------- -int MultiClipTurn(SWPlayer* pp, DAngle new_ang, double zz, double floordist) +int MultiClipTurn(DSWPlayer* pp, DAngle new_ang, double zz, double floordist) { int i; SECTOR_OBJECT* sop = pp->sop; @@ -192,7 +192,7 @@ int testquadinsect(int *point_num, DVector2 const * qp, sectortype* sect) // //--------------------------------------------------------------------------- -int RectClipMove(SWPlayer* pp, DVector2* qpos) +int RectClipMove(DSWPlayer* pp, DVector2* qpos) { int i; DVector2 xy[4]; @@ -253,7 +253,7 @@ int RectClipMove(SWPlayer* pp, DVector2* qpos) // //--------------------------------------------------------------------------- -short RectClipTurn(SWPlayer* pp, DAngle new_angl, DVector2* qpos, DVector2* opos) +short RectClipTurn(DSWPlayer* pp, DAngle new_angl, DVector2* qpos, DVector2* opos) { int i; DVector2 xy[4]; diff --git a/source/games/sw/src/mclip.h b/source/games/sw/src/mclip.h index 18e895302..113211c66 100644 --- a/source/games/sw/src/mclip.h +++ b/source/games/sw/src/mclip.h @@ -27,9 +27,9 @@ BEGIN_SW_NS #define RECT_CLIP 1 -Collision MultiClipMove(SWPlayer* pp, double z, double floor_dist); -int MultiClipTurn(SWPlayer* pp, DAngle new_ang, double zz, double floordist); -int RectClipMove(SWPlayer* pp, DVector2* qpos); +Collision MultiClipMove(DSWPlayer* pp, double z, double floor_dist); +int MultiClipTurn(DSWPlayer* pp, DAngle new_ang, double zz, double floordist); +int RectClipMove(DSWPlayer* pp, DVector2* qpos); //short RectClipTurn(PLAYER* pp, short new_ang, int z, int floor_dist, int *qx, int *qy); -short RectClipTurn(SWPlayer* pp, short new_ang, int *qx, int *qy, int *ox, int *oy); +short RectClipTurn(DSWPlayer* pp, short new_ang, int *qx, int *qy, int *ox, int *oy); END_SW_NS diff --git a/source/games/sw/src/menus.cpp b/source/games/sw/src/menus.cpp index d3cc04e19..80665e236 100644 --- a/source/games/sw/src/menus.cpp +++ b/source/games/sw/src/menus.cpp @@ -80,7 +80,7 @@ static int faderamp[32] = // Set the amount of redness for damage // the player just took ////////////////////////////////////////// -void SetFadeAmt(SWPlayer* pp, short damage, uint8_t startcolor) +void SetFadeAmt(DSWPlayer* pp, short damage, uint8_t startcolor) { const int FADE_DAMAGE_FACTOR = 3; // 100 health / 32 shade cycles = 3.125 @@ -143,7 +143,7 @@ void SetFadeAmt(SWPlayer* pp, short damage, uint8_t startcolor) ////////////////////////////////////////// // Do the screen reddness based on damage ////////////////////////////////////////// -void DoPaletteFlash(SWPlayer* pp) +void DoPaletteFlash(DSWPlayer* pp) { const int MAXFADETICS = 5; diff --git a/source/games/sw/src/misc.h b/source/games/sw/src/misc.h index 01407fa43..b1f442edc 100644 --- a/source/games/sw/src/misc.h +++ b/source/games/sw/src/misc.h @@ -25,7 +25,7 @@ DSWActor* WarpPlane(DVector3& pos, sectortype** sect, double testz = DBL_MAX); void ProcessVisOn(void); -void VisViewChange(SWPlayer* pp, int* vis); +void VisViewChange(DSWPlayer* pp, int* vis); void SpawnVis(DSWActor* Parent, sectortype* sect, const DVector3& pos, int amt); enum TriggerType { TRIGGER_TYPE_REMOTE_SO }; @@ -53,10 +53,10 @@ int DoActorFall(DSWActor* actor); #define TEXT_INFO_YOFF (10) inline constexpr int TEXT_INFO_LINE(int line) { return (TEXT_INFO_Y + ((line)*TEXT_INFO_YOFF)); } -void PutStringInfo(SWPlayer* pp, const char* string); +void PutStringInfo(DSWPlayer* pp, const char* string); -void DoSlidorMatch(SWPlayer* pp, short match, bool); +void DoSlidorMatch(DSWPlayer* pp, short match, bool); bool TestSlidorMatchActive(short match); void InterpSectorSprites(sectortype* sect, bool state); @@ -75,21 +75,21 @@ int DoActorSectorDamage(DSWActor* actor); int DoScaleSprite(DSWActor* actor); int DoActorStopFall(DSWActor* actor); -void InitPlayerSprite(SWPlayer* pp, const DVector3& spawnpos, const DAngle startang); +void InitPlayerSprite(DSWPlayer* pp, const DVector3& spawnpos, const DAngle startang); void InitAllPlayerSprites(const DVector3& spawnpos, const DAngle startang); void PlayerPanelSetup(void); -void PlayerDeathReset(SWPlayer* pp); -void SpawnPlayerUnderSprite(SWPlayer* pp); +void PlayerDeathReset(DSWPlayer* pp); +void SpawnPlayerUnderSprite(DSWPlayer* pp); void DoQuakeMatch(short match); void ProcessQuakeOn(void); void ProcessQuakeSpot(void); -void QuakeViewChange(SWPlayer* pp, DVector3& tpos, DAngle& tang); -void DoQuake(SWPlayer* pp); -bool SetQuake(SWPlayer* pp, short tics, short amt); +void QuakeViewChange(DSWPlayer* pp, DVector3& tpos, DAngle& tang); +void DoQuake(DSWPlayer* pp); +bool SetQuake(DSWPlayer* pp, short tics, short amt); int SetExpQuake(DSWActor*); int SetGunQuake(DSWActor*); -int SetPlayerQuake(SWPlayer* mpp); +int SetPlayerQuake(DSWPlayer* mpp); int SetNuclearQuake(DSWActor*); int SetSumoQuake(DSWActor*); int SetSumoFartQuake(DSWActor*); diff --git a/source/games/sw/src/network.cpp b/source/games/sw/src/network.cpp index 888111987..39f73538e 100644 --- a/source/games/sw/src/network.cpp +++ b/source/games/sw/src/network.cpp @@ -60,7 +60,7 @@ uint8_t CommPlayers = 0; void InitNetPlayerOptions(void) { // short pnum; - SWPlayer* pp = getPlayer(myconnectindex); + DSWPlayer* pp = getPlayer(myconnectindex); strncpy(pp->PlayerName, playername, 31); diff --git a/source/games/sw/src/network.h b/source/games/sw/src/network.h index 751ee8a07..7683bf5d2 100644 --- a/source/games/sw/src/network.h +++ b/source/games/sw/src/network.h @@ -32,14 +32,14 @@ enum MAXSYNCBYTES = 16 }; extern bool PredictionOn; -extern SWPlayer PredictPlayer; -extern SWPlayer* ppp; +extern DSWPlayer PredictPlayer; +extern DSWPlayer* ppp; extern short predictangpos[]; extern int predictmovefifoplc; extern bool Prediction; -void InitPrediction(SWPlayer* pp); -void DoPrediction(SWPlayer* ppp); +void InitPrediction(DSWPlayer* pp); +void DoPrediction(DSWPlayer* ppp); void CorrectPrediction(int actualfifoplc); diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 76014bc00..dfe602ca0 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2120,7 +2120,7 @@ void InitAllPlayerSprites(const DVector3& spawnpos, const DAngle startang) // //--------------------------------------------------------------------------- -void PlayerLevelReset(SWPlayer* pp) +void PlayerLevelReset(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -2163,7 +2163,7 @@ void PlayerLevelReset(SWPlayer* pp) // //--------------------------------------------------------------------------- -void PlayerDeathReset(SWPlayer* pp) +void PlayerDeathReset(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -2255,7 +2255,7 @@ void PlayerPanelSetup(void) // //--------------------------------------------------------------------------- -void PlayerGameReset(SWPlayer* pp) +void PlayerGameReset(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -2319,9 +2319,9 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet; // //--------------------------------------------------------------------------- -void InitPlayerSprite(SWPlayer* pp, const DVector3& spawnpos, const DAngle startang) +void InitPlayerSprite(DSWPlayer* pp, const DVector3& spawnpos, const DAngle startang) { - int pnum = int(pp - (SWPlayer*)PlayerArray); + int pnum = int(pp->pnum); double fz,cz; extern bool NewGame; @@ -2404,11 +2404,11 @@ void InitPlayerSprite(SWPlayer* pp, const DVector3& spawnpos, const DAngle start // //--------------------------------------------------------------------------- -void SpawnPlayerUnderSprite(SWPlayer* pp) +void SpawnPlayerUnderSprite(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); - int pnum = int(pp - (SWPlayer*)PlayerArray); + int pnum = int(pp->pnum); pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, pp->GetActor()->getPosWithOffsetZ(), pp->GetActor()->spr.Angles.Yaw); diff --git a/source/games/sw/src/osdcmds.cpp b/source/games/sw/src/osdcmds.cpp index 7d9f5072d..bebdcf1b5 100644 --- a/source/games/sw/src/osdcmds.cpp +++ b/source/games/sw/src/osdcmds.cpp @@ -131,7 +131,7 @@ void GameInterface::SwitchCoopView() } else { - SWPlayer* tp = getPlayer(screenpeek); + DSWPlayer* tp = getPlayer(screenpeek); DoPlayerDivePalette(tp); DoPlayerNightVisionPalette(tp); } diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 13c8b19a8..85f71c4be 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -46,17 +46,17 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -int InitSwordAttack(SWPlayer* pp); +int InitSwordAttack(DSWPlayer* pp); PANEL_SPRITE* InitWeaponUziSecondaryReload(PANEL_SPRITE*); PANEL_SPRITE* InitWeaponUzi2(PANEL_SPRITE*); -int InitShotgun(SWPlayer* pp); -int InitRail(SWPlayer* pp); -int InitMicro(SWPlayer* pp); -int InitRocket(SWPlayer* pp); -int InitNuke(SWPlayer* pp); -int InitGrenade(SWPlayer* pp); -int InitMine(SWPlayer* pp); -int InitFistAttack(SWPlayer* pp); +int InitShotgun(DSWPlayer* pp); +int InitRail(DSWPlayer* pp); +int InitMicro(DSWPlayer* pp); +int InitRocket(DSWPlayer* pp); +int InitNuke(DSWPlayer* pp); +int InitGrenade(DSWPlayer* pp); +int InitMine(DSWPlayer* pp); +int InitFistAttack(DSWPlayer* pp); struct PANEL_SHRAP { @@ -67,7 +67,7 @@ struct PANEL_SHRAP void PanelInvTestSuicide(PANEL_SPRITE* psp); -void InsertPanelSprite(SWPlayer* pp, PANEL_SPRITE* psp); +void InsertPanelSprite(DSWPlayer* pp, PANEL_SPRITE* psp); void pKillSprite(PANEL_SPRITE* psp); void pWeaponBob(PANEL_SPRITE* psp, short condition); void pSuicide(PANEL_SPRITE* psp); @@ -92,8 +92,8 @@ uint8_t UziRecoilYadj = 0; extern short screenpeek; pANIMATOR pNullAnimator; -int InitStar(SWPlayer*); -int ChangeWeapon(SWPlayer*); +int InitStar(DSWPlayer*); +int ChangeWeapon(DSWPlayer*); int NullAnimator(DSWActor*) { @@ -117,7 +117,7 @@ inline int pspheight(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -PANEL_SPRITE* pFindMatchingSprite(SWPlayer* pp, int x, int y, short pri) +PANEL_SPRITE* pFindMatchingSprite(DSWPlayer* pp, int x, int y, short pri) { PANEL_SPRITE* next; @@ -143,7 +143,7 @@ PANEL_SPRITE* pFindMatchingSprite(SWPlayer* pp, int x, int y, short pri) // //--------------------------------------------------------------------------- -PANEL_SPRITE* pFindMatchingSpriteID(SWPlayer* pp, short id, int x, int y, short pri) +PANEL_SPRITE* pFindMatchingSpriteID(DSWPlayer* pp, short id, int x, int y, short pri) { PANEL_SPRITE* next; @@ -169,7 +169,7 @@ PANEL_SPRITE* pFindMatchingSpriteID(SWPlayer* pp, short id, int x, int y, short // //--------------------------------------------------------------------------- -bool pKillScreenSpiteIDs(SWPlayer* pp, short id) +bool pKillScreenSpiteIDs(DSWPlayer* pp, short id) { PANEL_SPRITE* next; bool found = false; @@ -213,7 +213,7 @@ void pToggleCrosshair(void) // //--------------------------------------------------------------------------- -void DoPlayerChooseYell(SWPlayer* pp) +void DoPlayerChooseYell(DSWPlayer* pp) { int choose_snd = 0; @@ -257,7 +257,7 @@ void ArmorCalc(int damage_amt, int *armor_damage, int *player_damage) // //--------------------------------------------------------------------------- -void PlayerUpdateHealth(SWPlayer* pp, short value) +void PlayerUpdateHealth(DSWPlayer* pp, short value) { DSWActor* plActor = pp->GetActor(); short x,y; @@ -367,7 +367,7 @@ void PlayerUpdateHealth(SWPlayer* pp, short value) // //--------------------------------------------------------------------------- -void PlayerUpdateAmmo(SWPlayer* pp, short UpdateWeaponNum, short value) +void PlayerUpdateAmmo(DSWPlayer* pp, short UpdateWeaponNum, short value) { short x,y; short WeaponNum; @@ -411,7 +411,7 @@ void PlayerUpdateAmmo(SWPlayer* pp, short UpdateWeaponNum, short value) // //--------------------------------------------------------------------------- -void PlayerUpdateWeapon(SWPlayer* pp, short WeaponNum) +void PlayerUpdateWeapon(DSWPlayer* pp, short WeaponNum) { DSWActor* plActor = pp->GetActor(); @@ -428,7 +428,7 @@ void PlayerUpdateWeapon(SWPlayer* pp, short WeaponNum) // //--------------------------------------------------------------------------- -void PlayerUpdateKills(SWPlayer* pp, short value) +void PlayerUpdateKills(DSWPlayer* pp, short value) { if (Prediction) return; @@ -440,7 +440,7 @@ void PlayerUpdateKills(SWPlayer* pp, short value) if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.TeamPlay) { short pnum; - SWPlayer* opp; + DSWPlayer* opp; TRAVERSE_CONNECT(pnum) { @@ -463,7 +463,7 @@ void PlayerUpdateKills(SWPlayer* pp, short value) // //--------------------------------------------------------------------------- -void PlayerUpdateArmor(SWPlayer* pp, short value) +void PlayerUpdateArmor(DSWPlayer* pp, short value) { if (Prediction) return; @@ -486,7 +486,7 @@ void PlayerUpdateArmor(SWPlayer* pp, short value) // //--------------------------------------------------------------------------- -int WeaponOperate(SWPlayer* pp) +int WeaponOperate(DSWPlayer* pp) { short weapon; DSWActor* plActor = pp->GetActor(); @@ -710,7 +710,7 @@ int WeaponOperate(SWPlayer* pp) // //--------------------------------------------------------------------------- -bool WeaponOK(SWPlayer* pp) +bool WeaponOK(DSWPlayer* pp) { short min_ammo, WeaponNum, FindWeaponNum; static const uint8_t wpn_order[] = {2,3,4,5,6,7,8,9,1,0}; @@ -990,7 +990,7 @@ void SpecialUziRetractFunc(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -void RetractCurWpn(SWPlayer* pp) +void RetractCurWpn(DSWPlayer* pp) { // Retract old weapon if (pp->CurWpn) @@ -1033,7 +1033,7 @@ void RetractCurWpn(SWPlayer* pp) // //--------------------------------------------------------------------------- -void InitWeaponSword(SWPlayer* pp) +void InitWeaponSword(DSWPlayer* pp) { PANEL_SPRITE* psp; short rnd_num; @@ -1485,7 +1485,7 @@ void pStarRestTest(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -void InitWeaponStar(SWPlayer* pp) +void InitWeaponStar(DSWPlayer* pp) { PANEL_SPRITE* psp = nullptr; @@ -2093,7 +2093,7 @@ void pUziReloadRetract(PANEL_SPRITE* nclip) void pUziDoneReload(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; if (psp->flags & (PANF_PRIMARY) && pp->WpnUziType == 3) @@ -2180,7 +2180,7 @@ void pUziClip(PANEL_SPRITE* oclip) // //--------------------------------------------------------------------------- -void InitWeaponUzi(SWPlayer* pp) +void InitWeaponUzi(DSWPlayer* pp) { PANEL_SPRITE* psp = nullptr; @@ -2269,7 +2269,7 @@ void InitWeaponUzi(SWPlayer* pp) PANEL_SPRITE* InitWeaponUzi2(PANEL_SPRITE* uzi_orig) { PANEL_SPRITE* New; - SWPlayer* pp = uzi_orig->PlayerP; + DSWPlayer* pp = uzi_orig->PlayerP; // There is already a second uzi, or it's retracting @@ -2310,7 +2310,7 @@ PANEL_SPRITE* InitWeaponUzi2(PANEL_SPRITE* uzi_orig) PANEL_SPRITE* InitWeaponUziSecondaryReload(PANEL_SPRITE* uzi_orig) { PANEL_SPRITE* New; - SWPlayer* pp = uzi_orig->PlayerP; + DSWPlayer* pp = uzi_orig->PlayerP; New = pSpawnSprite(pp, ps_PresentUzi, PRI_MID, 160 - UZI_XOFF, UZI_YOFF); New->pos.Y += pspheight(New); @@ -2567,7 +2567,7 @@ void pUziAction(PANEL_SPRITE* psp) void pUziFire(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; if (!WeaponOK(psp->PlayerP)) return; @@ -2698,7 +2698,7 @@ PANEL_STATE ps_Uzi2Shell[] = void SpawnUziShell(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; if (psp->State && (psp->State->flags & psf_Xflip)) { @@ -2773,7 +2773,7 @@ PANEL_STATE ps_ShotgunShell[] = void SpawnShotgunShell(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; SpawnShell(pp->GetActor(),-4); } @@ -2920,7 +2920,7 @@ PANEL_STATE ps_RetractShotgun[] = // //--------------------------------------------------------------------------- -void InitWeaponShotgun(SWPlayer* pp) +void InitWeaponShotgun(DSWPlayer* pp) { PANEL_SPRITE* psp = nullptr; @@ -3468,7 +3468,7 @@ PANEL_STATE ps_RetractRail[] = // //--------------------------------------------------------------------------- -void InitWeaponRail(SWPlayer* pp) +void InitWeaponRail(DSWPlayer* pp) { PANEL_SPRITE* psp = nullptr; @@ -3971,7 +3971,7 @@ void pHotHeadOverlays(PANEL_SPRITE* psp, short mode) #define HOTHEAD_XOFF (200 + HOTHEAD_BOB_X_AMT + 6) #define HOTHEAD_YOFF 200 -void InitWeaponHothead(SWPlayer* pp) +void InitWeaponHothead(DSWPlayer* pp) { PANEL_SPRITE* psp = nullptr; @@ -4272,7 +4272,7 @@ PANEL_STATE ps_OnFire[] = // //--------------------------------------------------------------------------- -void SpawnOnFire(SWPlayer* pp) +void SpawnOnFire(DSWPlayer* pp) { PANEL_SPRITE* fire; int x = 50; @@ -4451,7 +4451,7 @@ void pMicroSetRecoil(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -void InitWeaponMicro(SWPlayer* pp) +void InitWeaponMicro(DSWPlayer* pp) { PANEL_SPRITE* psp; @@ -4565,7 +4565,7 @@ void pMicroRecoilUp(PANEL_SPRITE* psp) void pMicroPresent(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; if (psp->PlayerP->Flags & (PF_WEAPON_RETRACT)) return; @@ -4743,7 +4743,7 @@ PANEL_STATE ps_MicroNukeFlash[] = void pMicroRest(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; bool force = !!(psp->flags & PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_MicroHide)) @@ -4877,7 +4877,7 @@ void pMicroRetract(PANEL_SPRITE* psp) void pNukeAction(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; #if 0 // Code commented out as it's causing interpolation issues when initialising a nuke. psp->backupy(); @@ -4904,7 +4904,7 @@ void pNukeAction(PANEL_SPRITE* psp) void pMicroStandBy(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; pMicroOverlays(psp); PlaySound(DIGI_NUKESTDBY, pp, v3df_follow|v3df_dontpan, CHAN_WEAPON); @@ -4912,14 +4912,14 @@ void pMicroStandBy(PANEL_SPRITE* psp) void pMicroCount(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; PlaySound(DIGI_NUKECDOWN, pp, v3df_follow|v3df_dontpan, CHAN_WEAPON); } void pMicroReady(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; PlaySound(DIGI_NUKEREADY, pp, v3df_follow|v3df_dontpan, CHAN_WEAPON); pp->NukeInitialized = true; @@ -4997,7 +4997,7 @@ PANEL_STATE ps_RetractHeart[] = // //--------------------------------------------------------------------------- -void InitWeaponHeart(SWPlayer* pp) +void InitWeaponHeart(DSWPlayer* pp) { PANEL_SPRITE* psp; @@ -5188,7 +5188,7 @@ void pHeartActionBlood(PANEL_SPRITE* psp) SpawnHeartBlood(psp); } -void InitHeartAttack(SWPlayer* pp); +void InitHeartAttack(DSWPlayer* pp); //--------------------------------------------------------------------------- // @@ -5198,7 +5198,7 @@ void InitHeartAttack(SWPlayer* pp); void pHeartAttack(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; // CTW MODIFICATION //int InitHeartAttack(PLAYER* pp); // CTW MODIFICATION END @@ -5270,7 +5270,7 @@ PANEL_STATE ps_HeartBloodSmall[] = void SpawnHeartBlood(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; PANEL_SPRITE* blood; PANEL_SHRAP* hsp; @@ -5315,7 +5315,7 @@ void SpawnHeartBlood(PANEL_SPRITE* psp) void SpawnSmallHeartBlood(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; PANEL_SPRITE* blood; PANEL_SHRAP* hsp; @@ -5553,7 +5553,7 @@ void pGrenadePresentSetup(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -void InitWeaponGrenade(SWPlayer* pp) +void InitWeaponGrenade(DSWPlayer* pp) { PANEL_SPRITE* psp; @@ -5857,7 +5857,7 @@ PANEL_STATE ps_RetractMine[] = //#define MINE_XOFF (160+20) #define MINE_XOFF (160+50) -void InitWeaponMine(SWPlayer* pp) +void InitWeaponMine(DSWPlayer* pp) { PANEL_SPRITE* psp; @@ -5911,7 +5911,7 @@ void InitWeaponMine(SWPlayer* pp) void pMineUpSound(PANEL_SPRITE* psp) { - SWPlayer* pp = psp->PlayerP; + DSWPlayer* pp = psp->PlayerP; PlaySound(DIGI_MINE_UP, pp, v3df_follow); } @@ -6190,7 +6190,7 @@ PANEL_STATE ps_ChopsRetract[] = // //--------------------------------------------------------------------------- -void InitChops(SWPlayer* pp) +void InitChops(DSWPlayer* pp) { PANEL_SPRITE* psp; @@ -6339,7 +6339,7 @@ void pChopsWait(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -void ChopsSetRetract(SWPlayer* pp) +void ChopsSetRetract(DSWPlayer* pp) { if (pp == nullptr || pp->Chops == nullptr) return; @@ -6615,7 +6615,7 @@ PANEL_STATE ps_RetractFist[] = // //--------------------------------------------------------------------------- -void InitWeaponFist(SWPlayer* pp) +void InitWeaponFist(DSWPlayer* pp) { PANEL_SPRITE* psp; short rnd_num; @@ -7066,7 +7066,7 @@ void pFistBlock(PANEL_SPRITE* psp) -void pWeaponForceRest(SWPlayer* pp) +void pWeaponForceRest(DSWPlayer* pp) { pSetState(pp->CurWpn, pp->CurWpn->RestState); } @@ -7171,7 +7171,7 @@ bool pWeaponHideKeys(PANEL_SPRITE* psp, PANEL_STATE* state) // //--------------------------------------------------------------------------- -void InsertPanelSprite(SWPlayer* pp, PANEL_SPRITE* psp) +void InsertPanelSprite(DSWPlayer* pp, PANEL_SPRITE* psp) { PANEL_SPRITE* cur,* nxt; @@ -7219,7 +7219,7 @@ void InsertPanelSprite(SWPlayer* pp, PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -PANEL_SPRITE* pSpawnSprite(SWPlayer* pp, PANEL_STATE* state, uint8_t priority, double x, double y) +PANEL_SPRITE* pSpawnSprite(DSWPlayer* pp, PANEL_STATE* state, uint8_t priority, double x, double y) { unsigned i; PANEL_SPRITE* psp; @@ -7287,7 +7287,7 @@ void pKillSprite(PANEL_SPRITE* psp) // //--------------------------------------------------------------------------- -void pClearSpriteList(SWPlayer* pp) +void pClearSpriteList(DSWPlayer* pp) { PANEL_SPRITE* psp = nullptr, * next_psp = nullptr; auto l = &pp->PanelSpriteList; @@ -7363,7 +7363,7 @@ void pWeaponBob(PANEL_SPRITE* psp, short condition) ////////////////////////////////////////////////////////////////////////////////////////// bool DrawBeforeView = false; -void pDisplaySprites(SWPlayer* pp, double interpfrac) +void pDisplaySprites(DSWPlayer* pp, double interpfrac) { DSWActor* plActor = pp->GetActor(); PANEL_SPRITE* next=nullptr; @@ -7656,7 +7656,7 @@ void pDisplaySprites(SWPlayer* pp, double interpfrac) // //--------------------------------------------------------------------------- -void pSpriteControl(SWPlayer* pp) +void pSpriteControl(DSWPlayer* pp) { PANEL_SPRITE* next=nullptr; diff --git a/source/games/sw/src/panel.h b/source/games/sw/src/panel.h index 086549de9..ac418d5cc 100644 --- a/source/games/sw/src/panel.h +++ b/source/games/sw/src/panel.h @@ -109,7 +109,7 @@ struct PANEL_SPRITE PANEL_SPRITE* Next, * Prev; PANEL_SPRITE* sibling; PANEL_STATE* State, *RetractState, *PresentState, *ActionState, *RestState; - SWPlayer* PlayerP; + DSWPlayer* PlayerP; DVector2 pos, opos, bobpos; PANEL_SPRITE_OVERLAY over[8]; @@ -177,16 +177,16 @@ enum }; -PANEL_SPRITE* pSpawnSprite(SWPlayer* pp, PANEL_STATE* state, uint8_t priority, double x, double y); +PANEL_SPRITE* pSpawnSprite(DSWPlayer* pp, PANEL_STATE* state, uint8_t priority, double x, double y); void pSetSuicide(PANEL_SPRITE* psp); -bool pKillScreenSpiteIDs(SWPlayer* pp, short id); +bool pKillScreenSpiteIDs(DSWPlayer* pp, short id); void PreUpdatePanel(double interpfrac); void UpdatePanel(double interpfrac); -void PlayerUpdateArmor(SWPlayer* pp,short value); +void PlayerUpdateArmor(DSWPlayer* pp,short value); void pToggleCrosshair(void); void pKillSprite(PANEL_SPRITE* psp); -void InitChops(SWPlayer* pp); -void ChopsSetRetract(SWPlayer* pp); +void InitChops(DSWPlayer* pp); +void ChopsSetRetract(DSWPlayer* pp); END_SW_NS diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 72fc1509c..2035339b4 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -58,13 +58,13 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void pSpriteControl(SWPlayer* pp); -int WeaponOperate(SWPlayer* pp); +void pSpriteControl(DSWPlayer* pp); +int WeaponOperate(DSWPlayer* pp); SECTOR_OBJECT* PlayerOnObject(sectortype* sect_match); -void PlayerRemoteReset(SWPlayer* pp, sectortype* sect); -void KillAllPanelInv(SWPlayer* pp); -void DoPlayerDeathDrown(SWPlayer* pp); -void pWeaponForceRest(SWPlayer* pp); +void PlayerRemoteReset(DSWPlayer* pp, sectortype* sect); +void KillAllPanelInv(DSWPlayer* pp); +void DoPlayerDeathDrown(DSWPlayer* pp); +void pWeaponForceRest(DSWPlayer* pp); #define SO_DRIVE_SOUND 2 #define SO_IDLE_SOUND 1 @@ -124,54 +124,54 @@ int ChopTics; short NormalVisibility; DSWActor* FindNearSprite(DSWActor*, short stat); -bool PlayerOnLadder(SWPlayer* pp); -void DoPlayerSlide(SWPlayer* pp); -void DoPlayerBeginSwim(SWPlayer* pp); -void DoPlayerSwim(SWPlayer* pp); -void DoPlayerWade(SWPlayer* pp); -void DoPlayerBeginWade(SWPlayer* pp); -void DoPlayerBeginCrawl(SWPlayer* pp); -void DoPlayerCrawl(SWPlayer* pp); -void DoPlayerRun(SWPlayer* pp); -void DoPlayerBeginRun(SWPlayer* pp); -void DoPlayerFall(SWPlayer* pp); -void DoPlayerBeginFall(SWPlayer* pp); -void DoPlayerJump(SWPlayer* pp); -void DoPlayerBeginJump(SWPlayer* pp); -void DoPlayerForceJump(SWPlayer* pp); -void DoPlayerBeginFly(SWPlayer* pp); -void DoPlayerFly(SWPlayer* pp); -void DoPlayerBeginClimb(SWPlayer* pp); -void DoPlayerClimb(SWPlayer* pp); -void DoPlayerBeginDie(SWPlayer* pp); +bool PlayerOnLadder(DSWPlayer* pp); +void DoPlayerSlide(DSWPlayer* pp); +void DoPlayerBeginSwim(DSWPlayer* pp); +void DoPlayerSwim(DSWPlayer* pp); +void DoPlayerWade(DSWPlayer* pp); +void DoPlayerBeginWade(DSWPlayer* pp); +void DoPlayerBeginCrawl(DSWPlayer* pp); +void DoPlayerCrawl(DSWPlayer* pp); +void DoPlayerRun(DSWPlayer* pp); +void DoPlayerBeginRun(DSWPlayer* pp); +void DoPlayerFall(DSWPlayer* pp); +void DoPlayerBeginFall(DSWPlayer* pp); +void DoPlayerJump(DSWPlayer* pp); +void DoPlayerBeginJump(DSWPlayer* pp); +void DoPlayerForceJump(DSWPlayer* pp); +void DoPlayerBeginFly(DSWPlayer* pp); +void DoPlayerFly(DSWPlayer* pp); +void DoPlayerBeginClimb(DSWPlayer* pp); +void DoPlayerClimb(DSWPlayer* pp); +void DoPlayerBeginDie(DSWPlayer* pp); // void DoPlayerBeginOperateBoat(PLAYER* pp); -void DoPlayerBeginOperateVehicle(SWPlayer* pp); -void DoPlayerBeginOperate(SWPlayer* pp); +void DoPlayerBeginOperateVehicle(DSWPlayer* pp); +void DoPlayerBeginOperate(DSWPlayer* pp); // void DoPlayerOperateBoat(PLAYER* pp); -void DoPlayerOperateVehicle(SWPlayer* pp); -void DoPlayerOperateTurret(SWPlayer* pp); -void DoPlayerBeginDive(SWPlayer* pp); -void DoPlayerDive(SWPlayer* pp); -void DoPlayerTeleportPause(SWPlayer* pp); +void DoPlayerOperateVehicle(DSWPlayer* pp); +void DoPlayerOperateTurret(DSWPlayer* pp); +void DoPlayerBeginDive(DSWPlayer* pp); +void DoPlayerDive(DSWPlayer* pp); +void DoPlayerTeleportPause(DSWPlayer* pp); bool PlayerFlyKey(void); void OperateSectorObject(SECTOR_OBJECT* sop, DAngle newang, const DVector2& newpos); -void CheckFootPrints(SWPlayer* pp); -bool DoPlayerTestCrawl(SWPlayer* pp); -void DoPlayerDeathFlip(SWPlayer* pp); -void DoPlayerDeathCrumble(SWPlayer* pp); -void DoPlayerDeathExplode(SWPlayer* pp); -void DoPlayerDeathFall(SWPlayer* pp); +void CheckFootPrints(DSWPlayer* pp); +bool DoPlayerTestCrawl(DSWPlayer* pp); +void DoPlayerDeathFlip(DSWPlayer* pp); +void DoPlayerDeathCrumble(DSWPlayer* pp); +void DoPlayerDeathExplode(DSWPlayer* pp); +void DoPlayerDeathFall(DSWPlayer* pp); -void PlayerCheckValidMove(SWPlayer* pp); -void PlayerWarpUpdatePos(SWPlayer* pp, const DVector3& oldpos); -void DoPlayerBeginDiveNoWarp(SWPlayer* pp); -int PlayerCanDiveNoWarp(SWPlayer* pp); -void DoPlayerCurrent(SWPlayer* pp); +void PlayerCheckValidMove(DSWPlayer* pp); +void PlayerWarpUpdatePos(DSWPlayer* pp, const DVector3& oldpos); +void DoPlayerBeginDiveNoWarp(DSWPlayer* pp); +int PlayerCanDiveNoWarp(DSWPlayer* pp); +void DoPlayerCurrent(DSWPlayer* pp); int GetOverlapSector2(const DVector2& pos, sectortype** over, sectortype** under); -void PlayerToRemote(SWPlayer* pp); -void PlayerRemoteInit(SWPlayer* pp); -void PlayerSpawnPosition(SWPlayer* pp); -void processWeapon(SWPlayer* const pp); +void PlayerToRemote(DSWPlayer* pp); +void PlayerRemoteInit(DSWPlayer* pp); +void PlayerSpawnPosition(DSWPlayer* pp); +void processWeapon(DSWPlayer* const pp); extern short target_ang; @@ -950,7 +950,7 @@ STATE* sg_PlayerNinjaFly[] = // //--------------------------------------------------------------------------- -void DoPlayerSpriteThrow(SWPlayer* pp) +void DoPlayerSpriteThrow(DSWPlayer* pp) { if (!(pp->Flags & (PF_DIVING|PF_FLYING|PF_CRAWLING))) { @@ -969,7 +969,7 @@ void DoPlayerSpriteThrow(SWPlayer* pp) int DoPlayerSpriteReset(DSWActor* actor) { - SWPlayer* pp; + DSWPlayer* pp; if (!actor->user.PlayerP) return 0; @@ -1164,7 +1164,7 @@ DSWActor* DoPickTarget(DSWActor* actor, DAngle max_delta_ang, int skip_targets) // //--------------------------------------------------------------------------- -void DoPlayerResetMovement(SWPlayer* pp) +void DoPlayerResetMovement(DSWPlayer* pp) { pp->vect.Zero(); pp->ovect.Zero(); @@ -1179,7 +1179,7 @@ void DoPlayerResetMovement(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerTeleportPause(SWPlayer* pp) +void DoPlayerTeleportPause(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -1202,7 +1202,7 @@ void DoPlayerTeleportPause(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerTeleportToSprite(SWPlayer* pp, DVector3& pos, DAngle ang) +void DoPlayerTeleportToSprite(DSWPlayer* pp, DVector3& pos, DAngle ang) { pp->GetActor()->spr.Angles.Yaw = ang; pp->GetActor()->spr.pos = pos; @@ -1218,7 +1218,7 @@ void DoPlayerTeleportToSprite(SWPlayer* pp, DVector3& pos, DAngle ang) // //--------------------------------------------------------------------------- -void DoPlayerTeleportToOffset(SWPlayer* pp) +void DoPlayerTeleportToOffset(DSWPlayer* pp) { pp->GetActor()->backupvec2(); @@ -1278,7 +1278,7 @@ void DoSpawnTeleporterEffectPlace(DSWActor* actor) // //--------------------------------------------------------------------------- -void DoPlayerWarpTeleporter(SWPlayer* pp) +void DoPlayerWarpTeleporter(DSWPlayer* pp) { auto ppActor = pp->GetActor(); short pnum; @@ -1323,9 +1323,9 @@ void DoPlayerWarpTeleporter(SWPlayer* pp) TRAVERSE_CONNECT(pnum) { - if (pnum != pp - (SWPlayer*)PlayerArray) + if (pnum != pp->pnum) { - SWPlayer* npp = getPlayer(pnum); + DSWPlayer* npp = getPlayer(pnum); // if someone already standing there if (npp->cursector == pp->cursector) @@ -1350,7 +1350,7 @@ void DoPlayerWarpTeleporter(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerSetWadeDepth(SWPlayer* pp) +void DoPlayerSetWadeDepth(DSWPlayer* pp) { sectortype* sectp; @@ -1376,18 +1376,18 @@ void DoPlayerSetWadeDepth(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerViewOffset(SWPlayer* pp) +void DoPlayerViewOffset(DSWPlayer* pp) { pp->GetActor()->viewzoffset -= (pp->GetActor()->viewzoffset + pp->height) * 0.375; } -void DoPlayerHeight(SWPlayer* pp) +void DoPlayerHeight(DSWPlayer* pp) { DoPlayerViewOffset(pp); pp->GetActor()->spr.pos.Z -= (pp->GetActor()->spr.pos.Z - pp->loz) * 0.375; } -void DoPlayerJumpHeight(SWPlayer* pp) +void DoPlayerJumpHeight(DSWPlayer* pp) { if (pp->lo_sectp && (pp->lo_sectp->extra & SECTFX_DYNAMIC_AREA)) { @@ -1405,7 +1405,7 @@ void DoPlayerJumpHeight(SWPlayer* pp) // //--------------------------------------------------------------------------- -void UpdatePlayerSpriteAngle(SWPlayer* pp) +void UpdatePlayerSpriteAngle(DSWPlayer* pp) { DSWActor* plActor = pp->PlayerUnderActor; @@ -1422,7 +1422,7 @@ void UpdatePlayerSpriteAngle(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerTurnVehicle(SWPlayer* pp, double zz, double floordist) +void DoPlayerTurnVehicle(DSWPlayer* pp, double zz, double floordist) { SECTOR_OBJECT* sop = pp->sop; @@ -1454,7 +1454,7 @@ void DoPlayerTurnVehicle(SWPlayer* pp, double zz, double floordist) // //--------------------------------------------------------------------------- -void DoPlayerTurnVehicleRect(SWPlayer* pp, DVector2* pos, DVector2* opos) +void DoPlayerTurnVehicleRect(DSWPlayer* pp, DVector2* pos, DVector2* opos) { float avel; SECTOR_OBJECT* sop = pp->sop; @@ -1487,7 +1487,7 @@ void DoPlayerTurnVehicleRect(SWPlayer* pp, DVector2* pos, DVector2* opos) // //--------------------------------------------------------------------------- -void DoPlayerTurnTurret(SWPlayer* pp) +void DoPlayerTurnTurret(DSWPlayer* pp) { DAngle new_ang, diff; SECTOR_OBJECT* sop = pp->sop; @@ -1533,7 +1533,7 @@ void DoPlayerTurnTurret(SWPlayer* pp) // //--------------------------------------------------------------------------- -void SlipSlope(SWPlayer* pp) +void SlipSlope(DSWPlayer* pp) { if (!pp->insector() || !pp->cursector->hasU()) return; @@ -1554,7 +1554,7 @@ void SlipSlope(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerSlopeTilting(SWPlayer* pp) +void DoPlayerSlopeTilting(DSWPlayer* pp) { const bool canslopetilt = (pp->cmd.ucmd.actions & SB_AIMMODE) && !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)); pp->Angles.doViewPitch(canslopetilt, pp->Flags & PF_CLIMBING); @@ -1566,7 +1566,7 @@ void DoPlayerSlopeTilting(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBob(SWPlayer* pp) +void DoPlayerBob(DSWPlayer* pp) { double amt; @@ -1603,7 +1603,7 @@ void DoPlayerBob(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginRecoil(SWPlayer* pp, double pix_amt) +void DoPlayerBeginRecoil(DSWPlayer* pp, double pix_amt) { pp->Flags |= (PF_RECOIL); @@ -1619,7 +1619,7 @@ void DoPlayerBeginRecoil(SWPlayer* pp, double pix_amt) // //--------------------------------------------------------------------------- -void DoPlayerRecoil(SWPlayer* pp) +void DoPlayerRecoil(DSWPlayer* pp) { // controls how fast you move through the sin table pp->recoil_ndx += pp->recoil_speed; @@ -1642,7 +1642,7 @@ void DoPlayerRecoil(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerSpriteBob(SWPlayer* pp, double player_height, double bobamt, short bob_speed) +void DoPlayerSpriteBob(DSWPlayer* pp, double player_height, double bobamt, short bob_speed) { pp->bob_ndx = (pp->bob_ndx + (synctics << bob_speed)) & 2047; pp->pbob_amt = bobamt * BobVal(pp->bob_ndx); @@ -1654,7 +1654,7 @@ void DoPlayerSpriteBob(SWPlayer* pp, double player_height, double bobamt, short // //--------------------------------------------------------------------------- -void UpdatePlayerUnderSprite(SWPlayer* pp) +void UpdatePlayerUnderSprite(DSWPlayer* pp) { DSWActor* act_over = pp->GetActor(); @@ -1720,7 +1720,7 @@ void UpdatePlayerUnderSprite(SWPlayer* pp) // //--------------------------------------------------------------------------- -void UpdatePlayerSprite(SWPlayer* pp) +void UpdatePlayerSprite(DSWPlayer* pp) { // Adjust player height according to the next action. if (!(pp->Flags & PF_DEAD)) @@ -1739,7 +1739,7 @@ void UpdatePlayerSprite(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerZrange(SWPlayer* pp) +void DoPlayerZrange(DSWPlayer* pp) { Collision ceilhit, florhit; @@ -1799,7 +1799,7 @@ void DoPlayerZrange(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerSlide(SWPlayer* pp) +void DoPlayerSlide(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -1854,7 +1854,7 @@ void DoPlayerSlide(SWPlayer* pp) // //--------------------------------------------------------------------------- -void PlayerCheckValidMove(SWPlayer* pp) +void PlayerCheckValidMove(DSWPlayer* pp) { if (!pp->insector()) { @@ -1869,7 +1869,7 @@ void PlayerCheckValidMove(SWPlayer* pp) // //--------------------------------------------------------------------------- -void PlayerSectorBound(SWPlayer* pp, double amt) +void PlayerSectorBound(DSWPlayer* pp, double amt) { if (!pp->insector()) return; @@ -1901,7 +1901,7 @@ void PlayerSectorBound(SWPlayer* pp, double amt) // //--------------------------------------------------------------------------- -void DoPlayerMove(SWPlayer* pp) +void DoPlayerMove(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); int friction; @@ -1913,7 +1913,7 @@ void DoPlayerMove(SWPlayer* pp) // the player gets pushed by a wall (e.g., on the boat in level 5). bool interpolate_ride = pp->sop_riding && (!cl_sointerpolation || CommEnabled); - void SlipSlope(SWPlayer* pp); + void SlipSlope(DSWPlayer* pp); SlipSlope(pp); @@ -2078,7 +2078,7 @@ void DoPlayerMove(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerSectorUpdatePreMove(SWPlayer* pp) +void DoPlayerSectorUpdatePreMove(DSWPlayer* pp) { auto sect = pp->cursector; @@ -2115,7 +2115,7 @@ void DoPlayerSectorUpdatePreMove(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerSectorUpdatePostMove(SWPlayer* pp) +void DoPlayerSectorUpdatePostMove(DSWPlayer* pp) { auto sect = pp->cursector; double fz,cz; @@ -2192,7 +2192,7 @@ void StopSOsound(sectortype* sect) // //--------------------------------------------------------------------------- -void DoTankTreads(SWPlayer* pp) +void DoTankTreads(DSWPlayer* pp) { int i; sectortype* *sectp; @@ -2291,7 +2291,7 @@ void DoTankTreads(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DriveCrush(SWPlayer* pp, DVector2* quad) +void DriveCrush(DSWPlayer* pp, DVector2* quad) { SECTOR_OBJECT* sop = pp->sop_control; short stat; @@ -2438,7 +2438,7 @@ void DriveCrush(SWPlayer* pp, DVector2* quad) // //--------------------------------------------------------------------------- -void DoPlayerMoveVehicle(SWPlayer* pp) +void DoPlayerMoveVehicle(DSWPlayer* pp) { DSWActor* actor = pp->sop->sp_child; if (!actor) return; @@ -2627,7 +2627,7 @@ void DoPlayerMoveVehicle(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerMoveTurret(SWPlayer* pp) +void DoPlayerMoveTurret(DSWPlayer* pp) { if (!Prediction) { @@ -2655,7 +2655,7 @@ void DoPlayerMoveTurret(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginJump(SWPlayer* pp) +void DoPlayerBeginJump(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -2690,7 +2690,7 @@ void DoPlayerBeginJump(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginForceJump(SWPlayer* pp) +void DoPlayerBeginForceJump(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -2717,12 +2717,12 @@ void DoPlayerBeginForceJump(SWPlayer* pp) // //--------------------------------------------------------------------------- -bool PlayerCeilingHit(SWPlayer* pp, double zlimit) +bool PlayerCeilingHit(DSWPlayer* pp, double zlimit) { return (pp->GetActor()->getOffsetZ() < zlimit); } -bool PlayerFloorHit(SWPlayer* pp, double zlimit) +bool PlayerFloorHit(DSWPlayer* pp, double zlimit) { return (pp->GetActor()->getOffsetZ() > zlimit); } @@ -2733,7 +2733,7 @@ bool PlayerFloorHit(SWPlayer* pp, double zlimit) // //--------------------------------------------------------------------------- -void DoPlayerJump(SWPlayer* pp) +void DoPlayerJump(DSWPlayer* pp) { short i; @@ -2823,7 +2823,7 @@ void DoPlayerJump(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerForceJump(SWPlayer* pp) +void DoPlayerForceJump(DSWPlayer* pp) { short i; @@ -2867,7 +2867,7 @@ void DoPlayerForceJump(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginFall(SWPlayer* pp) +void DoPlayerBeginFall(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -2892,7 +2892,7 @@ void DoPlayerBeginFall(SWPlayer* pp) // //--------------------------------------------------------------------------- -void StackedWaterSplash(SWPlayer* pp) +void StackedWaterSplash(DSWPlayer* pp) { if (FAF_ConnectArea(pp->cursector)) { @@ -2913,7 +2913,7 @@ void StackedWaterSplash(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerFall(SWPlayer* pp) +void DoPlayerFall(DSWPlayer* pp) { short i; double depth; @@ -3074,7 +3074,7 @@ void DoPlayerFall(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginClimb(SWPlayer* pp) +void DoPlayerBeginClimb(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -3095,7 +3095,7 @@ void DoPlayerBeginClimb(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerClimb(SWPlayer* pp) +void DoPlayerClimb(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); int i; @@ -3283,7 +3283,7 @@ void DoPlayerClimb(SWPlayer* pp) // //--------------------------------------------------------------------------- -int DoPlayerWadeSuperJump(SWPlayer* pp) +int DoPlayerWadeSuperJump(DSWPlayer* pp) { HitInfo hit{}; unsigned i; @@ -3337,7 +3337,7 @@ bool PlayerFlyKey(void) // //--------------------------------------------------------------------------- -void DoPlayerBeginCrawl(SWPlayer* pp) +void DoPlayerBeginCrawl(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -3360,7 +3360,7 @@ void DoPlayerBeginCrawl(SWPlayer* pp) // //--------------------------------------------------------------------------- -bool PlayerFallTest(SWPlayer* pp, double player_height) +bool PlayerFallTest(DSWPlayer* pp, double player_height) { // If the floor is far below you, fall hard instead of adjusting height if (abs(pp->GetActor()->getOffsetZ() - pp->loz) > player_height + PLAYER_FALL_HEIGHTF) @@ -3390,7 +3390,7 @@ bool PlayerFallTest(SWPlayer* pp, double player_height) const int PLAYER_STANDING_ROOM = 68; -void DoPlayerCrawl(SWPlayer* pp) +void DoPlayerCrawl(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -3461,7 +3461,7 @@ void DoPlayerCrawl(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginFly(SWPlayer* pp) +void DoPlayerBeginFly(DSWPlayer* pp) { pp->Flags &= ~(PF_FALLING | PF_JUMPING | PF_CRAWLING); pp->Flags |= (PF_FLYING); @@ -3485,7 +3485,7 @@ void DoPlayerBeginFly(SWPlayer* pp) // //--------------------------------------------------------------------------- -void PlayerWarpUpdatePos(SWPlayer* pp, const DVector3& oldpos) +void PlayerWarpUpdatePos(DSWPlayer* pp, const DVector3& oldpos) { if (Prediction) return; @@ -3501,7 +3501,7 @@ void PlayerWarpUpdatePos(SWPlayer* pp, const DVector3& oldpos) // //--------------------------------------------------------------------------- -void DoPlayerFly(SWPlayer* pp) +void DoPlayerFly(DSWPlayer* pp) { if (SectorIsUnderwaterArea(pp->cursector)) { @@ -3584,7 +3584,7 @@ DSWActor* FindNearSprite(DSWActor* actor, short stat) // //--------------------------------------------------------------------------- -bool PlayerOnLadder(SWPlayer* pp) +bool PlayerOnLadder(DSWPlayer* pp) { int nx, ny; unsigned i; @@ -3663,7 +3663,7 @@ bool PlayerOnLadder(SWPlayer* pp) // //--------------------------------------------------------------------------- -bool DoPlayerTestCrawl(SWPlayer* pp) +bool DoPlayerTestCrawl(DSWPlayer* pp) { return abs(pp->loz - pp->hiz) < PLAYER_STANDING_ROOM; } @@ -3674,7 +3674,7 @@ bool DoPlayerTestCrawl(SWPlayer* pp) // //--------------------------------------------------------------------------- -int PlayerInDiveArea(SWPlayer* pp) +int PlayerInDiveArea(DSWPlayer* pp) { sectortype* sectp; @@ -3704,7 +3704,7 @@ int PlayerInDiveArea(SWPlayer* pp) // //--------------------------------------------------------------------------- -int PlayerCanDive(SWPlayer* pp) +int PlayerCanDive(DSWPlayer* pp) { if (Prediction) return false; @@ -3738,7 +3738,7 @@ int PlayerCanDive(SWPlayer* pp) // //--------------------------------------------------------------------------- -int PlayerCanDiveNoWarp(SWPlayer* pp) +int PlayerCanDiveNoWarp(DSWPlayer* pp) { if (Prediction) return false; @@ -3948,7 +3948,7 @@ int GetOverlapSector2(const DVector2& pos, sectortype** over, sectortype** under // //--------------------------------------------------------------------------- -void DoPlayerWarpToUnderwater(SWPlayer* pp) +void DoPlayerWarpToUnderwater(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4021,7 +4021,7 @@ void DoPlayerWarpToUnderwater(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerWarpToSurface(SWPlayer* pp) +void DoPlayerWarpToSurface(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); auto sectu = pp->cursector; @@ -4097,7 +4097,7 @@ void DoPlayerWarpToSurface(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDivePalette(SWPlayer* pp) +void DoPlayerDivePalette(DSWPlayer* pp) { if (pp != getPlayer(screenpeek)) return; @@ -4123,7 +4123,7 @@ void DoPlayerDivePalette(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginDive(SWPlayer* pp) +void DoPlayerBeginDive(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4175,7 +4175,7 @@ void DoPlayerBeginDive(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginDiveNoWarp(SWPlayer* pp) +void DoPlayerBeginDiveNoWarp(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4227,7 +4227,7 @@ void DoPlayerBeginDiveNoWarp(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerStopDiveNoWarp(SWPlayer* pp) +void DoPlayerStopDiveNoWarp(DSWPlayer* pp) { if (Prediction) return; @@ -4258,7 +4258,7 @@ void DoPlayerStopDiveNoWarp(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerStopDive(SWPlayer* pp) +void DoPlayerStopDive(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -4291,7 +4291,7 @@ void DoPlayerStopDive(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDiveMeter(SWPlayer* pp) +void DoPlayerDiveMeter(DSWPlayer* pp) { short color=0,metertics,meterunit; int y; @@ -4342,7 +4342,7 @@ void DoPlayerDiveMeter(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDive(SWPlayer* pp) +void DoPlayerDive(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); auto sectu = pp->cursector; @@ -4512,7 +4512,7 @@ void DoPlayerDive(SWPlayer* pp) // //--------------------------------------------------------------------------- -int DoPlayerTestPlaxDeath(SWPlayer* pp) +int DoPlayerTestPlaxDeath(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4533,7 +4533,7 @@ int DoPlayerTestPlaxDeath(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerCurrent(SWPlayer* pp) +void DoPlayerCurrent(DSWPlayer* pp) { int xvect, yvect; auto sectu = pp->cursector; @@ -4586,7 +4586,7 @@ void DoPlayerCurrent(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerFireOutWater(SWPlayer* pp) +void DoPlayerFireOutWater(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4608,7 +4608,7 @@ void DoPlayerFireOutWater(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerFireOutDeath(SWPlayer* pp) +void DoPlayerFireOutDeath(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4628,7 +4628,7 @@ void DoPlayerFireOutDeath(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginWade(SWPlayer* pp) +void DoPlayerBeginWade(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4666,7 +4666,7 @@ void DoPlayerBeginWade(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerWade(SWPlayer* pp) +void DoPlayerWade(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4811,7 +4811,7 @@ void DoPlayerWade(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginOperateVehicle(SWPlayer* pp) +void DoPlayerBeginOperateVehicle(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4836,7 +4836,7 @@ void DoPlayerBeginOperateVehicle(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginOperateTurret(SWPlayer* pp) +void DoPlayerBeginOperateTurret(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -4885,7 +4885,7 @@ void FindMainSector(SECTOR_OBJECT* sop) // //--------------------------------------------------------------------------- -void DoPlayerOperateMatch(SWPlayer* pp, bool starting) +void DoPlayerOperateMatch(DSWPlayer* pp, bool starting) { if (!pp->sop) return; @@ -4916,7 +4916,7 @@ void DoPlayerOperateMatch(SWPlayer* pp, bool starting) // //--------------------------------------------------------------------------- -void DoPlayerBeginOperate(SWPlayer* pp) +void DoPlayerBeginOperate(DSWPlayer* pp) { SECTOR_OBJECT* sop; double cz, fz; @@ -5020,7 +5020,7 @@ void DoPlayerBeginOperate(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginRemoteOperate(SWPlayer* pp, SECTOR_OBJECT* sop) +void DoPlayerBeginRemoteOperate(DSWPlayer* pp, SECTOR_OBJECT* sop) { double cz, fz; int i; @@ -5104,7 +5104,7 @@ void DoPlayerBeginRemoteOperate(SWPlayer* pp, SECTOR_OBJECT* sop) // //--------------------------------------------------------------------------- -void PlayerToRemote(SWPlayer* pp) +void PlayerToRemote(DSWPlayer* pp) { pp->remote.cursectp = pp->cursector; pp->remote.lastcursectp = pp->lastcursector; @@ -5116,7 +5116,7 @@ void PlayerToRemote(SWPlayer* pp) pp->remote.slide_vect = pp->slide_vect; } -void RemoteToPlayer(SWPlayer* pp) +void RemoteToPlayer(DSWPlayer* pp) { pp->setcursector(pp->remote.cursectp); pp->lastcursector = pp->remote.lastcursectp; @@ -5128,7 +5128,7 @@ void RemoteToPlayer(SWPlayer* pp) pp->slide_vect = pp->remote.slide_vect; } -void PlayerRemoteReset(SWPlayer* pp, sectortype* sect) +void PlayerRemoteReset(DSWPlayer* pp, sectortype* sect) { pp->setcursector(sect); pp->lastcursector = pp->cursector; @@ -5144,7 +5144,7 @@ void PlayerRemoteReset(SWPlayer* pp, sectortype* sect) UpdatePlayerSprite(pp); } -void PlayerRemoteInit(SWPlayer* pp) +void PlayerRemoteInit(DSWPlayer* pp) { pp->remote.vect.Zero(); pp->remote.ovect.Zero(); @@ -5157,7 +5157,7 @@ void PlayerRemoteInit(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerStopOperate(SWPlayer* pp) +void DoPlayerStopOperate(DSWPlayer* pp) { pp->Flags &= ~(PF_WEAPON_DOWN); DoPlayerResetMovement(pp); @@ -5188,7 +5188,7 @@ void DoPlayerStopOperate(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerOperateTurret(SWPlayer* pp) +void DoPlayerOperateTurret(DSWPlayer* pp) { if (pp->cmd.ucmd.actions & SB_OPEN) { @@ -5232,7 +5232,7 @@ void DoPlayerOperateTurret(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerOperateVehicle(SWPlayer* pp) +void DoPlayerOperateVehicle(DSWPlayer* pp) { if (pp->cmd.ucmd.actions & SB_OPEN) { @@ -5274,7 +5274,7 @@ void DoPlayerOperateVehicle(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathJump(SWPlayer* pp) +void DoPlayerDeathJump(DSWPlayer* pp) { short i; @@ -5321,7 +5321,7 @@ void DoPlayerDeathJump(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathFall(SWPlayer* pp) +void DoPlayerDeathFall(DSWPlayer* pp) { double loz; @@ -5378,7 +5378,7 @@ const char *SuicideNote[MAX_SUICIDE] = "did everyone a favor and offed himself." }; -char *KilledPlayerMessage(SWPlayer* pp, SWPlayer* killer) +char *KilledPlayerMessage(DSWPlayer* pp, DSWPlayer* killer) { const int MAX_KILL_NOTES = 16; short rnd = StdRandomRange(MAX_KILL_NOTES); @@ -5451,12 +5451,12 @@ char *KilledPlayerMessage(SWPlayer* pp, SWPlayer* killer) // //--------------------------------------------------------------------------- -void DoPlayerDeathMessage(SWPlayer* pp, SWPlayer* killer) +void DoPlayerDeathMessage(DSWPlayer* pp, DSWPlayer* killer) { int pnum; bool SEND_OK = false; - killer->KilledPlayer[pp - (SWPlayer*)PlayerArray]++; + killer->KilledPlayer[pp->pnum]++; if (pp == killer && pp == getPlayer(myconnectindex)) { @@ -5501,7 +5501,7 @@ constexpr DAngle PLAYER_DEATH_HORIZ_UP_VALUEF = DAngle::fromDeg(-22.922); constexpr DAngle PLAYER_DEATH_HORIZ_JUMP_VALUEF = DAngle::fromDeg(-21.33686); constexpr DAngle PLAYER_DEATH_HORIZ_FALL_VALUEF = -PLAYER_DEATH_HORIZ_JUMP_VALUEF; -void DoPlayerBeginDie(SWPlayer* pp) +void DoPlayerBeginDie(DSWPlayer* pp) { extern bool ReloadPrompt; short bak; @@ -5509,7 +5509,7 @@ void DoPlayerBeginDie(SWPlayer* pp) DSWActor* plActor = pp->GetActor(); - static void (*PlayerDeathFunc[MAX_PLAYER_DEATHS]) (SWPlayer*) = + static void (*PlayerDeathFunc[MAX_PLAYER_DEATHS]) (DSWPlayer*) = { DoPlayerDeathFlip, DoPlayerDeathCrumble, @@ -5711,7 +5711,7 @@ void DoPlayerBeginDie(SWPlayer* pp) // //--------------------------------------------------------------------------- -static inline void DoPlayerDeathHoriz(SWPlayer* pp, const DAngle target, const double speed) +static inline void DoPlayerDeathHoriz(DSWPlayer* pp, const DAngle target, const double speed) { auto& pitch = pp->GetActor()->spr.Angles.Pitch; auto pspeed = DAngle::fromDeg(speed); @@ -5733,7 +5733,7 @@ static inline void DoPlayerDeathHoriz(SWPlayer* pp, const DAngle target, const d // //--------------------------------------------------------------------------- -void DoPlayerDeathZrange(SWPlayer* pp) +void DoPlayerDeathZrange(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -5752,7 +5752,7 @@ void DoPlayerDeathZrange(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathHurl(SWPlayer* pp) +void DoPlayerDeathHurl(DSWPlayer* pp) { if (numplayers > 1) { @@ -5786,7 +5786,7 @@ void DoPlayerDeathHurl(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathFollowKiller(SWPlayer* pp) +void DoPlayerDeathFollowKiller(DSWPlayer* pp) { // if it didn't make it to this angle because of a low ceiling or something // continue on to it @@ -5816,7 +5816,7 @@ void DoPlayerDeathFollowKiller(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathCheckKeys(SWPlayer* pp) +void DoPlayerDeathCheckKeys(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -5884,7 +5884,7 @@ void DoPlayerDeathCheckKeys(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerHeadDebris(SWPlayer* pp) +void DoPlayerHeadDebris(DSWPlayer* pp) { sectortype* sectp = pp->cursector; @@ -5904,7 +5904,7 @@ void DoPlayerHeadDebris(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathCheckKick(SWPlayer* pp) +void DoPlayerDeathCheckKick(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); unsigned stat; @@ -5962,7 +5962,7 @@ void DoPlayerDeathCheckKick(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathMoveHead(SWPlayer* pp) +void DoPlayerDeathMoveHead(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -6025,7 +6025,7 @@ void DoPlayerDeathMoveHead(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathFlip(SWPlayer* pp) +void DoPlayerDeathFlip(DSWPlayer* pp) { if (Prediction) return; @@ -6062,7 +6062,7 @@ void DoPlayerDeathFlip(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathDrown(SWPlayer* pp) +void DoPlayerDeathDrown(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -6103,7 +6103,7 @@ void DoPlayerDeathDrown(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathBounce(SWPlayer* pp) +void DoPlayerDeathBounce(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -6135,7 +6135,7 @@ void DoPlayerDeathBounce(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathCrumble(SWPlayer* pp) +void DoPlayerDeathCrumble(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -6192,7 +6192,7 @@ void DoPlayerDeathCrumble(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerDeathExplode(SWPlayer* pp) +void DoPlayerDeathExplode(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -6250,7 +6250,7 @@ void DoPlayerDeathExplode(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerBeginRun(SWPlayer* pp) +void DoPlayerBeginRun(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -6290,7 +6290,7 @@ void DoPlayerBeginRun(SWPlayer* pp) // //--------------------------------------------------------------------------- -void DoPlayerRun(SWPlayer* pp) +void DoPlayerRun(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -6501,7 +6501,7 @@ void MoveSkipSavePos(void) { int i; short pnum; - SWPlayer* pp; + DSWPlayer* pp; MoveSkip8 = (MoveSkip8 + 1) & 7; MoveSkip4 = (MoveSkip4 + 1) & 3; @@ -6567,12 +6567,12 @@ void MoveSkipSavePos(void) // //--------------------------------------------------------------------------- -void PlayerTimers(SWPlayer* pp) +void PlayerTimers(DSWPlayer* pp) { InventoryTimer(pp); } -void ChopsCheck(SWPlayer* pp) +void ChopsCheck(DSWPlayer* pp) { if (!M_Active() && !(pp->Flags & PF_DEAD) && !pp->sop_riding && numplayers <= 1) { @@ -6625,7 +6625,7 @@ void ChopsCheck(SWPlayer* pp) // //--------------------------------------------------------------------------- -void PlayerGlobal(SWPlayer* pp) +void PlayerGlobal(DSWPlayer* pp) { // This is the place for things that effect the player no matter what hes // doing @@ -6683,7 +6683,7 @@ void PlayerGlobal(SWPlayer* pp) void MultiPlayLimits(void) { short pnum; - SWPlayer* pp; + DSWPlayer* pp; bool Done = false; if (gNet.MultiGameType != MULTI_GAME_COMMBAT) @@ -6732,7 +6732,7 @@ void domovethings(void) { short pnum; - SWPlayer* pp; + DSWPlayer* pp; extern int FinishTimer; @@ -6771,7 +6771,7 @@ void domovethings(void) { extern short screenpeek; extern bool PlayerTrackingMode; - extern SWPlayer* GlobPlayerP; + extern DSWPlayer* GlobPlayerP; pp = getPlayer(pnum); GlobPlayerP = pp; @@ -6861,8 +6861,8 @@ void domovethings(void) void InitAllPlayers(void) { - SWPlayer* pp; - SWPlayer* pfirst = getPlayer(0); + DSWPlayer* pp; + DSWPlayer* pfirst = getPlayer(0); extern bool NewGame; //int fz,cz; @@ -6915,9 +6915,9 @@ void InitAllPlayers(void) // //--------------------------------------------------------------------------- -int SearchSpawnPosition(SWPlayer* pp) +int SearchSpawnPosition(DSWPlayer* pp) { - SWPlayer* opp; // other player + DSWPlayer* opp; // other player short pos_num; short pnum; bool blocked; @@ -6961,9 +6961,9 @@ bool SpawnPositionUsed[MAX_SW_PLAYERS_REG+1]; // //--------------------------------------------------------------------------- -void PlayerSpawnPosition(SWPlayer* pp) +void PlayerSpawnPosition(DSWPlayer* pp) { - short pnum = short(pp - (SWPlayer*)PlayerArray); + short pnum = short(pp->pnum); short pos_num = pnum; int i; DSWActor* spawn_sprite = nullptr; @@ -7042,7 +7042,7 @@ void PlayerSpawnPosition(SWPlayer* pp) void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang) { - SWPlayer* pp; + DSWPlayer* pp; short pnum; unsigned stat; int tag; @@ -7152,7 +7152,7 @@ int DoFootPrints(DSWActor* actor) return 0; } -void CheckFootPrints(SWPlayer* pp) +void CheckFootPrints(DSWPlayer* pp) { if (pp->NumFootPrints <= 0 || FootMode != WATER_FOOT) { @@ -7234,130 +7234,131 @@ saveable_module saveable_player = SIZ(saveable_player_data) }; -DEFINE_FIELD_X(SWPlayer, SWPlayer, sop_remote) -DEFINE_FIELD_X(SWPlayer, SWPlayer, jump_count) -DEFINE_FIELD_X(SWPlayer, SWPlayer, jump_speed) -DEFINE_FIELD_X(SWPlayer, SWPlayer, z_speed) -DEFINE_FIELD_X(SWPlayer, SWPlayer, climb_ndx) -DEFINE_FIELD_X(SWPlayer, SWPlayer, hiz) -DEFINE_FIELD_X(SWPlayer, SWPlayer, loz) -DEFINE_FIELD_X(SWPlayer, SWPlayer, p_ceiling_dist) -DEFINE_FIELD_X(SWPlayer, SWPlayer, p_floor_dist) -DEFINE_FIELD_X(SWPlayer, SWPlayer, circle_camera_dist) -//DEFINE_FIELD_X(SWPlayer, PLAYER, six) -//DEFINE_FIELD_X(SWPlayer, PLAYER, siy) -//DEFINE_FIELD_X(SWPlayer, PLAYER, siz) -//DEFINE_FIELD_X(SWPlayer, PLAYER, xvect) -//DEFINE_FIELD_X(SWPlayer, PLAYER, yvect) -//DEFINE_FIELD_X(SWPlayer, PLAYER, oxvect) -//DEFINE_FIELD_X(SWPlayer, PLAYER, oyvect) -DEFINE_FIELD_X(SWPlayer, SWPlayer, friction) -//DEFINE_FIELD_X(SWPlayer, PLAYER, slide_xvect) -//DEFINE_FIELD_X(SWPlayer, PLAYER, slide_yvect) -DEFINE_FIELD_X(SWPlayer, SWPlayer, slide_ang) -DEFINE_FIELD_X(SWPlayer, SWPlayer, slide_dec) -DEFINE_FIELD_X(SWPlayer, SWPlayer, drive_avel) -DEFINE_FIELD_X(SWPlayer, SWPlayer, circle_camera_ang) -DEFINE_FIELD_X(SWPlayer, SWPlayer, camera_check_time_delay) -DEFINE_FIELD_X(SWPlayer, SWPlayer, cursector) -DEFINE_FIELD_X(SWPlayer, SWPlayer, lastcursector) -DEFINE_FIELD_X(SWPlayer, SWPlayer, recoil_amt) -DEFINE_FIELD_X(SWPlayer, SWPlayer, recoil_speed) -DEFINE_FIELD_X(SWPlayer, SWPlayer, recoil_ndx) -DEFINE_FIELD_X(SWPlayer, SWPlayer, recoil_horizoff) -DEFINE_FIELD_X(SWPlayer, SWPlayer, recoil_ohorizoff) -//DEFINE_FIELD_X(SWPlayer, PLAYER, oldposx) -//DEFINE_FIELD_X(SWPlayer, PLAYER, oldposy) -//DEFINE_FIELD_X(SWPlayer, PLAYER, oldposz) -//DEFINE_FIELD_X(SWPlayer, PLAYER, Revolve) -DEFINE_FIELD_X(SWPlayer, SWPlayer, RevolveDeltaAng) -DEFINE_FIELD_X(SWPlayer, SWPlayer, pnum) -DEFINE_FIELD_X(SWPlayer, SWPlayer, LadderSector) -//DEFINE_FIELD_X(SWPlayer, PLAYER, lx) -//DEFINE_FIELD_X(SWPlayer, PLAYER, ly) -DEFINE_FIELD_X(SWPlayer, SWPlayer, JumpDuration) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WadeDepth) -DEFINE_FIELD_X(SWPlayer, SWPlayer, pbob_amt) -DEFINE_FIELD_X(SWPlayer, SWPlayer, bob_ndx) -DEFINE_FIELD_X(SWPlayer, SWPlayer, bcnt) -DEFINE_FIELD_X(SWPlayer, SWPlayer, bob_z) -DEFINE_FIELD_X(SWPlayer, SWPlayer, obob_z) -DEFINE_FIELD_X(SWPlayer, SWPlayer, playerreadyflag) -DEFINE_FIELD_X(SWPlayer, SWPlayer, Flags) -DEFINE_FIELD_X(SWPlayer, SWPlayer, Flags2) -DEFINE_FIELD_X(SWPlayer, SWPlayer, HasKey) -DEFINE_FIELD_X(SWPlayer, SWPlayer, SwordAng) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnGotOnceFlags) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnFlags) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnAmmo) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnNum) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnRocketType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnRocketHeat) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnRocketNuke) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnFlameType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnFirstType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WeaponType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, FirePause) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InventoryNum) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InventoryBarTics) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InventoryTics) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InventoryPercent) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InventoryAmount) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InventoryActive) -DEFINE_FIELD_X(SWPlayer, SWPlayer, DiveTics) -DEFINE_FIELD_X(SWPlayer, SWPlayer, DiveDamageTics) -DEFINE_FIELD_X(SWPlayer, SWPlayer, DeathType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, Armor) -DEFINE_FIELD_X(SWPlayer, SWPlayer, MaxHealth) -DEFINE_FIELD_X(SWPlayer, SWPlayer, UziShellLeftAlt) -DEFINE_FIELD_X(SWPlayer, SWPlayer, UziShellRightAlt) -DEFINE_FIELD_X(SWPlayer, SWPlayer, TeamColor) -DEFINE_FIELD_X(SWPlayer, SWPlayer, FadeTics) -DEFINE_FIELD_X(SWPlayer, SWPlayer, FadeAmt) -DEFINE_FIELD_X(SWPlayer, SWPlayer, NightVision) -DEFINE_FIELD_X(SWPlayer, SWPlayer, StartColor) -DEFINE_FIELD_X(SWPlayer, SWPlayer, IsAI) -DEFINE_FIELD_X(SWPlayer, SWPlayer, fta) -DEFINE_FIELD_X(SWPlayer, SWPlayer, ftq) -DEFINE_FIELD_X(SWPlayer, SWPlayer, NumFootPrints) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnUziType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnShotgunType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnShotgunAuto) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnShotgunLastShell) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnRailType) -DEFINE_FIELD_X(SWPlayer, SWPlayer, Bloody) -DEFINE_FIELD_X(SWPlayer, SWPlayer, InitingNuke) -DEFINE_FIELD_X(SWPlayer, SWPlayer, TestNukeInit) -DEFINE_FIELD_X(SWPlayer, SWPlayer, NukeInitialized) -DEFINE_FIELD_X(SWPlayer, SWPlayer, FistAng) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnKungFuMove) -DEFINE_FIELD_X(SWPlayer, SWPlayer, HitBy) -DEFINE_FIELD_X(SWPlayer, SWPlayer, Reverb) -DEFINE_FIELD_X(SWPlayer, SWPlayer, Heads) -DEFINE_FIELD_X(SWPlayer, SWPlayer, PlayerVersion) -DEFINE_FIELD_X(SWPlayer, SWPlayer, WpnReloadState) +DEFINE_FIELD(DSWPlayer, actor) +DEFINE_FIELD(DSWPlayer, sop_remote) +DEFINE_FIELD(DSWPlayer, jump_count) +DEFINE_FIELD(DSWPlayer, jump_speed) +DEFINE_FIELD(DSWPlayer, z_speed) +DEFINE_FIELD(DSWPlayer, climb_ndx) +DEFINE_FIELD(DSWPlayer, hiz) +DEFINE_FIELD(DSWPlayer, loz) +DEFINE_FIELD(DSWPlayer, p_ceiling_dist) +DEFINE_FIELD(DSWPlayer, p_floor_dist) +DEFINE_FIELD(DSWPlayer, circle_camera_dist) +//DEFINE_FIELD(DSWPlayer, six) +//DEFINE_FIELD(DSWPlayer, siy) +//DEFINE_FIELD(DSWPlayer, siz) +//DEFINE_FIELD(DSWPlayer, xvect) +//DEFINE_FIELD(DSWPlayer, yvect) +//DEFINE_FIELD(DSWPlayer, oxvect) +//DEFINE_FIELD(DSWPlayer, oyvect) +DEFINE_FIELD(DSWPlayer, friction) +//DEFINE_FIELD(DSWPlayer, slide_xvect) +//DEFINE_FIELD(DSWPlayer, slide_yvect) +DEFINE_FIELD(DSWPlayer, slide_ang) +DEFINE_FIELD(DSWPlayer, slide_dec) +DEFINE_FIELD(DSWPlayer, drive_avel) +DEFINE_FIELD(DSWPlayer, circle_camera_ang) +DEFINE_FIELD(DSWPlayer, camera_check_time_delay) +DEFINE_FIELD(DSWPlayer, cursector) +DEFINE_FIELD(DSWPlayer, lastcursector) +DEFINE_FIELD(DSWPlayer, recoil_amt) +DEFINE_FIELD(DSWPlayer, recoil_speed) +DEFINE_FIELD(DSWPlayer, recoil_ndx) +DEFINE_FIELD(DSWPlayer, recoil_horizoff) +DEFINE_FIELD(DSWPlayer, recoil_ohorizoff) +//DEFINE_FIELD(DSWPlayer, oldposx) +//DEFINE_FIELD(DSWPlayer, oldposy) +//DEFINE_FIELD(DSWPlayer, oldposz) +//DEFINE_FIELD(DSWPlayer, Revolve) +DEFINE_FIELD(DSWPlayer, RevolveDeltaAng) +DEFINE_FIELD(DSWPlayer, pnum) +DEFINE_FIELD(DSWPlayer, LadderSector) +//DEFINE_FIELD_X(DSWPlayer, lx) +//DEFINE_FIELD_X(DSWPlayer, ly) +DEFINE_FIELD(DSWPlayer, JumpDuration) +DEFINE_FIELD(DSWPlayer, WadeDepth) +DEFINE_FIELD(DSWPlayer, pbob_amt) +DEFINE_FIELD(DSWPlayer, bob_ndx) +DEFINE_FIELD(DSWPlayer, bcnt) +DEFINE_FIELD(DSWPlayer, bob_z) +DEFINE_FIELD(DSWPlayer, obob_z) +DEFINE_FIELD(DSWPlayer, playerreadyflag) +DEFINE_FIELD(DSWPlayer, Flags) +DEFINE_FIELD(DSWPlayer, Flags2) +DEFINE_FIELD(DSWPlayer, HasKey) +DEFINE_FIELD(DSWPlayer, SwordAng) +DEFINE_FIELD(DSWPlayer, WpnGotOnceFlags) +DEFINE_FIELD(DSWPlayer, WpnFlags) +DEFINE_FIELD(DSWPlayer, WpnAmmo) +DEFINE_FIELD(DSWPlayer, WpnNum) +DEFINE_FIELD(DSWPlayer, WpnRocketType) +DEFINE_FIELD(DSWPlayer, WpnRocketHeat) +DEFINE_FIELD(DSWPlayer, WpnRocketNuke) +DEFINE_FIELD(DSWPlayer, WpnFlameType) +DEFINE_FIELD(DSWPlayer, WpnFirstType) +DEFINE_FIELD(DSWPlayer, WeaponType) +DEFINE_FIELD(DSWPlayer, FirePause) +DEFINE_FIELD(DSWPlayer, InventoryNum) +DEFINE_FIELD(DSWPlayer, InventoryBarTics) +DEFINE_FIELD(DSWPlayer, InventoryTics) +DEFINE_FIELD(DSWPlayer, InventoryPercent) +DEFINE_FIELD(DSWPlayer, InventoryAmount) +DEFINE_FIELD(DSWPlayer, InventoryActive) +DEFINE_FIELD(DSWPlayer, DiveTics) +DEFINE_FIELD(DSWPlayer, DiveDamageTics) +DEFINE_FIELD(DSWPlayer, DeathType) +DEFINE_FIELD(DSWPlayer, Armor) +DEFINE_FIELD(DSWPlayer, MaxHealth) +DEFINE_FIELD(DSWPlayer, UziShellLeftAlt) +DEFINE_FIELD(DSWPlayer, UziShellRightAlt) +DEFINE_FIELD(DSWPlayer, TeamColor) +DEFINE_FIELD(DSWPlayer, FadeTics) +DEFINE_FIELD(DSWPlayer, FadeAmt) +DEFINE_FIELD(DSWPlayer, NightVision) +DEFINE_FIELD(DSWPlayer, StartColor) +DEFINE_FIELD(DSWPlayer, IsAI) +DEFINE_FIELD(DSWPlayer, fta) +DEFINE_FIELD(DSWPlayer, ftq) +DEFINE_FIELD(DSWPlayer, NumFootPrints) +DEFINE_FIELD(DSWPlayer, WpnUziType) +DEFINE_FIELD(DSWPlayer, WpnShotgunType) +DEFINE_FIELD(DSWPlayer, WpnShotgunAuto) +DEFINE_FIELD(DSWPlayer, WpnShotgunLastShell) +DEFINE_FIELD(DSWPlayer, WpnRailType) +DEFINE_FIELD(DSWPlayer, Bloody) +DEFINE_FIELD(DSWPlayer, InitingNuke) +DEFINE_FIELD(DSWPlayer, TestNukeInit) +DEFINE_FIELD(DSWPlayer, NukeInitialized) +DEFINE_FIELD(DSWPlayer, FistAng) +DEFINE_FIELD(DSWPlayer, WpnKungFuMove) +DEFINE_FIELD(DSWPlayer, HitBy) +DEFINE_FIELD(DSWPlayer, Reverb) +DEFINE_FIELD(DSWPlayer, Heads) +DEFINE_FIELD(DSWPlayer, PlayerVersion) +DEFINE_FIELD(DSWPlayer, WpnReloadState) DEFINE_ACTION_FUNCTION(_SWPlayer, WeaponNum) { - PARAM_SELF_STRUCT_PROLOGUE(SWPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DSWPlayer); ACTION_RETURN_INT(self->GetActor()->user.WeaponNum); } DEFINE_ACTION_FUNCTION(_SWPlayer, Health) { - PARAM_SELF_STRUCT_PROLOGUE(SWPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DSWPlayer); ACTION_RETURN_INT(self->GetActor()->user.Health); } DEFINE_ACTION_FUNCTION(_SWPlayer, MaxUserHealth) { - PARAM_SELF_STRUCT_PROLOGUE(SWPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DSWPlayer); ACTION_RETURN_INT(self->GetActor()->user.MaxHealth); } DEFINE_ACTION_FUNCTION(_SWPlayer, GetBuildAngle) { - PARAM_SELF_STRUCT_PROLOGUE(SWPlayer); + PARAM_SELF_STRUCT_PROLOGUE(DSWPlayer); ACTION_RETURN_INT(self->GetActor()->spr.Angles.Yaw.Buildang()); } diff --git a/source/games/sw/src/player.h b/source/games/sw/src/player.h index 4d59822d6..58210facb 100644 --- a/source/games/sw/src/player.h +++ b/source/games/sw/src/player.h @@ -125,15 +125,15 @@ void DoPlayer(void); void domovethings(void); void InitAllPlayers(void); void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang); -void DoPlayerDivePalette(SWPlayer* pp); -void DoPlayerNightVisionPalette(SWPlayer* pp); -void DoPlayerStopDiveNoWarp(SWPlayer* pp); -void DoPlayerResetMovement(SWPlayer* pp); -void DoPlayerZrange(SWPlayer* pp); -void DoPlayerSpriteThrow(SWPlayer* pp); -int DoPlayerWadeSuperJump(SWPlayer* pp); -void DoPlayerWarpTeleporter(SWPlayer* pp); -void UpdatePlayerSprite(SWPlayer* pp); +void DoPlayerDivePalette(DSWPlayer* pp); +void DoPlayerNightVisionPalette(DSWPlayer* pp); +void DoPlayerStopDiveNoWarp(DSWPlayer* pp); +void DoPlayerResetMovement(DSWPlayer* pp); +void DoPlayerZrange(DSWPlayer* pp); +void DoPlayerSpriteThrow(DSWPlayer* pp); +int DoPlayerWadeSuperJump(DSWPlayer* pp); +void DoPlayerWarpTeleporter(DSWPlayer* pp); +void UpdatePlayerSprite(DSWPlayer* pp); void PlaySOsound(sectortype* sect,short sound_num); void DoSpawnTeleporterEffectPlace(DSWActor* sp); void FindMainSector(SECTOR_OBJECT* sop); diff --git a/source/games/sw/src/predict.cpp b/source/games/sw/src/predict.cpp index 65fcd2610..709213e9e 100644 --- a/source/games/sw/src/predict.cpp +++ b/source/games/sw/src/predict.cpp @@ -38,9 +38,9 @@ BEGIN_SW_NS bool PredictionOn = true; bool Prediction = false; -SWPlayer PredictPlayer; +//DSWPlayer PredictPlayer; //USER PredictUser; -SWPlayer* ppp = &PredictPlayer; +//DSWPlayer* ppp = &PredictPlayer; struct PREDICT { @@ -53,11 +53,11 @@ struct PREDICT PREDICT Predict[/*MOVEFIFOSIZ*/256]; int predictmovefifoplc; -void DoPlayerSectorUpdatePreMove(SWPlayer*); -void DoPlayerSectorUpdatePostMove(SWPlayer*); +void DoPlayerSectorUpdatePreMove(DSWPlayer*); +void DoPlayerSectorUpdatePostMove(DSWPlayer*); -void InitPrediction(SWPlayer* pp) +void InitPrediction(DSWPlayer* pp) { if (!PredictionOn) return; @@ -67,7 +67,7 @@ void InitPrediction(SWPlayer* pp) //PredictUser = *pp->actor->user; } -void DoPrediction(SWPlayer* ppp) +void DoPrediction(DSWPlayer* ppp) { #if 0 spritetype spr; diff --git a/source/games/sw/src/quake.cpp b/source/games/sw/src/quake.cpp index 00fd2c631..61ddeb766 100644 --- a/source/games/sw/src/quake.cpp +++ b/source/games/sw/src/quake.cpp @@ -179,7 +179,7 @@ void ProcessQuakeSpot(void) // // //--------------------------------------------------------------------------- -void QuakeViewChange(SWPlayer* pp, DVector3& tpos, DAngle& tang) +void QuakeViewChange(DSWPlayer* pp, DVector3& tpos, DAngle& tang) { DSWActor* save_act = nullptr; double save_dist = 62500; @@ -275,7 +275,7 @@ void SpawnQuake(sectortype* sect, const DVector3& pos, int tics, int amt, int ra // //--------------------------------------------------------------------------- -bool SetQuake(SWPlayer* pp, short tics, short amt) +bool SetQuake(DSWPlayer* pp, short tics, short amt) { SpawnQuake(pp->cursector, pp->GetActor()->getPosWithOffsetZ(), tics, amt, 30000); return false; @@ -293,7 +293,7 @@ int SetGunQuake(DSWActor* actor) return 0; } -int SetPlayerQuake(SWPlayer* pp) +int SetPlayerQuake(DSWPlayer* pp) { SpawnQuake(pp->cursector, pp->GetActor()->getPosWithOffsetZ(), 40, 8, 40000); return 0; diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 9660582d8..39d5dabfb 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -38,9 +38,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void DoRotatorMatch(SWPlayer* pp, short match, bool); +void DoRotatorMatch(DSWPlayer* pp, short match, bool); bool TestRotatorMatchActive(short match); -void DoMatchEverything(SWPlayer* pp, short match, short state); +void DoMatchEverything(DSWPlayer* pp, short match, short state); void DoRotatorSetInterp(DSWActor*); void DoRotatorStopInterp(DSWActor*); @@ -149,7 +149,7 @@ void SetRotatorInactive(DSWActor* actor) // //--------------------------------------------------------------------------- -void DoRotatorOperate(SWPlayer* pp, sectortype* sect) +void DoRotatorOperate(DSWPlayer* pp, sectortype* sect) { short match = sect->hitag; @@ -167,7 +167,7 @@ void DoRotatorOperate(SWPlayer* pp, sectortype* sect) // //--------------------------------------------------------------------------- -void DoRotatorMatch(SWPlayer* pp, short match, bool manual) +void DoRotatorMatch(DSWPlayer* pp, short match, bool manual) { DSWActor* firstVator = nullptr; diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index c2aa3ae80..8c0f91ff1 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -417,9 +417,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w, // //--------------------------------------------------------------------------- -FSerializer& Serialize(FSerializer& arc, const char* keyname, SWPlayer*& w, SWPlayer** def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWPlayer*& w, DSWPlayer** def) { - int ndx = w ? int(w - (SWPlayer*)PlayerArray) : -1; + int ndx = w ? int(w->pnum) : -1; arc(keyname, ndx); w = ndx == -1 ? nullptr : getPlayer(ndx); return arc; @@ -431,7 +431,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SWPlayer*& w, SWPl // //--------------------------------------------------------------------------- -FSerializer& Serialize(FSerializer& arc, const char* keyname, SWPlayer& w, SWPlayer* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWPlayer& w, DSWPlayer* def) { if (arc.BeginObject(keyname)) { diff --git a/source/games/sw/src/sbar.cpp b/source/games/sw/src/sbar.cpp index 774105831..485877148 100644 --- a/source/games/sw/src/sbar.cpp +++ b/source/games/sw/src/sbar.cpp @@ -89,7 +89,7 @@ void UpdateStatusBar() ::UpdateStatusBar(&info); - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); if (pp->cookieTime > 0) { const int MESSAGE_LINE = 142; // Used to be 164 diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 099e8daf6..128e6860b 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -58,20 +58,20 @@ enum SINE_SLOPED = BIT(3), }; -void DoPlayerBeginForceJump(SWPlayer*); +void DoPlayerBeginForceJump(DSWPlayer*); sectortype* FindNextSectorByTag(sectortype* sect, int tag); bool TestVatorMatchActive(short match); bool TestSpikeMatchActive(short match); bool TestRotatorMatchActive(short match); bool TestSlidorMatchActive(short match); -int PlayerCheckDeath(SWPlayer*, DSWActor*); -void DoVatorOperate(SWPlayer*, sectortype*); -void DoVatorMatch(SWPlayer* pp, short match); -void DoRotatorOperate(SWPlayer*, sectortype*); -void DoRotatorMatch(SWPlayer* pp, short match, bool); -void DoSlidorOperate(SWPlayer*, sectortype*); -void DoSlidorMatch(SWPlayer* pp, short match, bool); +int PlayerCheckDeath(DSWPlayer*, DSWActor*); +void DoVatorOperate(DSWPlayer*, sectortype*); +void DoVatorMatch(DSWPlayer* pp, short match); +void DoRotatorOperate(DSWPlayer*, sectortype*); +void DoRotatorMatch(DSWPlayer* pp, short match, bool); +void DoSlidorOperate(DSWPlayer*, sectortype*); +void DoSlidorMatch(DSWPlayer* pp, short match, bool); void DoTornadoObject(SECTOR_OBJECT* sop); void DoAutoTurretObject(SECTOR_OBJECT* sop); @@ -80,7 +80,7 @@ void KillMatchingCrackSprites(short match); int DoTrapReset(short match); int DoTrapMatch(short match); -SWPlayer* GlobPlayerP; +DSWPlayer* GlobPlayerP; ANIM Anim[MAXANIM]; short AnimCnt = 0; @@ -644,7 +644,7 @@ DVector3 SectorMidPoint(sectortype* sectp) // //--------------------------------------------------------------------------- -void DoSpringBoard(SWPlayer* pp) +void DoSpringBoard(DSWPlayer* pp) { pp->jump_speed = -pp->cursector->hitag; @@ -744,7 +744,7 @@ short DoSpawnActorTrigger(short match) int OperateSector(sectortype* sect, short player_is_operating) { - SWPlayer* pp = GlobPlayerP; + DSWPlayer* pp = GlobPlayerP; // Don't let actors operate locked or secret doors if (!player_is_operating) @@ -1084,7 +1084,7 @@ void DoSoundSpotMatch(short match, short sound_num, short sound_type) if (TEST_BOOL7(actor)) { - SWPlayer* pp = GlobPlayerP; + DSWPlayer* pp = GlobPlayerP; if (pp) { @@ -1413,9 +1413,9 @@ void DoChangorMatch(short match) // //--------------------------------------------------------------------------- -void DoMatchEverything(SWPlayer* pp, short match, short state) +void DoMatchEverything(DSWPlayer* pp, short match, short state) { - SWPlayer* bak; + DSWPlayer* bak; bak = GlobPlayerP; GlobPlayerP = pp; @@ -1500,7 +1500,7 @@ bool ComboSwitchTest(short combo_type, short match) int OperateSprite(DSWActor* actor, short player_is_operating) { - SWPlayer* pp = nullptr; + DSWPlayer* pp = nullptr; short state; short key_num=0; extern STATE s_Pachinko1Operate[]; @@ -1903,7 +1903,7 @@ int DoTrapMatch(short match) // //--------------------------------------------------------------------------- -void TriggerSecret(sectortype* sectp, SWPlayer* pp) +void TriggerSecret(sectortype* sectp, DSWPlayer* pp) { if (pp == getPlayer(myconnectindex)) PlayerSound(DIGI_ANCIENTSECRET, v3df_dontpan | v3df_doppler | v3df_follow, pp); @@ -1922,7 +1922,7 @@ void TriggerSecret(sectortype* sectp, SWPlayer* pp) // //--------------------------------------------------------------------------- -void OperateTripTrigger(SWPlayer* pp) +void OperateTripTrigger(DSWPlayer* pp) { if (Prediction) return; @@ -2048,7 +2048,7 @@ void OperateTripTrigger(SWPlayer* pp) // //--------------------------------------------------------------------------- -void OperateContinuousTrigger(SWPlayer* pp) +void OperateContinuousTrigger(DSWPlayer* pp) { if (Prediction) return; @@ -2073,7 +2073,7 @@ void OperateContinuousTrigger(SWPlayer* pp) // //--------------------------------------------------------------------------- -short PlayerTakeSectorDamage(SWPlayer* pp) +short PlayerTakeSectorDamage(DSWPlayer* pp) { auto sectu = pp->cursector; DSWActor* actor = pp->GetActor(); @@ -2097,7 +2097,7 @@ short PlayerTakeSectorDamage(SWPlayer* pp) //--------------------------------------------------------------------------- enum { PLAYER_SOUNDEVENT_TAG = 900 }; -bool NearThings(SWPlayer* pp) +bool NearThings(DSWPlayer* pp) { HitInfo near; @@ -2184,7 +2184,7 @@ bool NearThings(SWPlayer* pp) static int nti_cnt; -void NearTagList(NEAR_TAG_INFO* ntip, SWPlayer* pp, double z, double dist, int type, int count) +void NearTagList(NEAR_TAG_INFO* ntip, DSWPlayer* pp, double z, double dist, int type, int count) { short save_lotag, save_hitag; HitInfo near; @@ -2292,7 +2292,7 @@ void NearTagList(NEAR_TAG_INFO* ntip, SWPlayer* pp, double z, double dist, int t // //--------------------------------------------------------------------------- -void BuildNearTagList(NEAR_TAG_INFO* ntip, int size, SWPlayer* pp, double z, double dist, int type, int count) +void BuildNearTagList(NEAR_TAG_INFO* ntip, int size, DSWPlayer* pp, double z, double dist, int type, int count) { memset(ntip, -1, size); nti_cnt = 0; @@ -2305,7 +2305,7 @@ void BuildNearTagList(NEAR_TAG_INFO* ntip, int size, SWPlayer* pp, double z, dou // //--------------------------------------------------------------------------- -int DoPlayerGrabStar(SWPlayer* pp) +int DoPlayerGrabStar(DSWPlayer* pp) { int i; @@ -2345,7 +2345,7 @@ int DoPlayerGrabStar(SWPlayer* pp) // //--------------------------------------------------------------------------- -void PlayerOperateEnv(SWPlayer* pp) +void PlayerOperateEnv(DSWPlayer* pp) { bool found; @@ -2880,7 +2880,7 @@ void DoSector(void) bool riding; int sync_flag; short pnum; - SWPlayer* pp; + DSWPlayer* pp; for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++) { diff --git a/source/games/sw/src/sector.h b/source/games/sw/src/sector.h index 851182466..81f8d81eb 100644 --- a/source/games/sw/src/sector.h +++ b/source/games/sw/src/sector.h @@ -38,11 +38,11 @@ int MoveDoorDown(short door_sector, short dir, short door_speed); int MoveDoorHoriz(short door_sector, short dir, short door_speed); void DoDoorsClose(void); short Switch(short SwitchSector); -void PlayerOperateEnv(SWPlayer* pp); -int TeleportToSector(SWPlayer* pp, int newsector); +void PlayerOperateEnv(DSWPlayer* pp); +int TeleportToSector(DSWPlayer* pp, int newsector); int OperateSector(sectortype* sect,short player_is_operating); int OperateSprite(DSWActor*, short player_is_operating); -void OperateTripTrigger(SWPlayer* pp); +void OperateTripTrigger(DSWPlayer* pp); enum SO_SCALE_TYPE { @@ -65,7 +65,7 @@ struct NEAR_TAG_INFO void DoSpawnSpotsForKill(short match); void DoSpawnSpotsForDamage(short match); -void DoMatchEverything(SWPlayer* pp, short match, short state); +void DoMatchEverything(DSWPlayer* pp, short match, short state); bool ComboSwitchTest(short combo_type,short match); void DoSoundSpotStopSound(short match); void DoSector(void); diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index c14a3980f..1c40fc985 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -144,7 +144,7 @@ void SetSlidorInactive(DSWActor* actor) // //--------------------------------------------------------------------------- -void DoSlidorOperate(SWPlayer* pp, sectortype* sect) +void DoSlidorOperate(DSWPlayer* pp, sectortype* sect) { short match; @@ -165,7 +165,7 @@ void DoSlidorOperate(SWPlayer* pp, sectortype* sect) // //--------------------------------------------------------------------------- -void DoSlidorMatch(SWPlayer* pp, short match, bool manual) +void DoSlidorMatch(DSWPlayer* pp, short match, bool manual) { SWStatIterator it(STAT_SLIDOR); while (auto actor = it.Next()) @@ -577,7 +577,7 @@ int DoSlidor(DSWActor* actor) if (!found) { short pnum; - SWPlayer* pp; + DSWPlayer* pp; // go ahead and look for players clip box bounds TRAVERSE_CONNECT(pnum) { diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 5a7dced64..08a41d8b8 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -324,7 +324,7 @@ static void UpdateAmbients() if (sdist < 255 && sfx->ResourceId == DIGI_WHIPME) { - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); if (!FAFcansee(spot->spr.pos, spot->sector(), pp->GetActor()->getPosWithOffsetZ(), pp->cursector)) { sdist = 255; @@ -379,7 +379,7 @@ public: int SoundSourceIndex(FSoundChan* chan) override { - if (chan->SourceType == SOURCE_Player) return int((SWPlayer*)(chan->Source) - (SWPlayer*)PlayerArray); + if (chan->SourceType == SOURCE_Player) return int(((DSWPlayer*)(chan->Source))->pnum); return 0; } @@ -425,7 +425,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], { if (pos != nullptr) { - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); FVector3 campos = GetSoundPos(pp->GetActor() ? pp->GetActor()->getPosWithOffsetZ() : DVector3()); DVector3 vPos = {}; bool pancheck = false; @@ -446,7 +446,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], } else { - auto act = ((SWPlayer*)source)->GetActor(); + auto act = ((DSWPlayer*)source)->GetActor(); if (act) vPos = act->getPosWithOffsetZ(); else if (pp->GetActor()) vPos = pp->GetActor()->getPosWithOffsetZ(); @@ -513,7 +513,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], void GameInterface::UpdateSounds(void) { - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); SoundListener listener; DAngle tang; @@ -549,7 +549,7 @@ void GameInterface::UpdateSounds(void) // //========================================================================== -int _PlaySound(const FSoundID sndid, DSWActor* actor, SWPlayer* pp, const DVector3* const ppos, int flags, int channel, EChanFlags cflags) +int _PlaySound(const FSoundID sndid, DSWActor* actor, DSWPlayer* pp, const DVector3* const ppos, int flags, int channel, EChanFlags cflags) { if (Prediction || !SoundEnabled() || !soundEngine->isValidSoundId(sndid)) return -1; @@ -715,18 +715,13 @@ void PlaySpriteSound(DSWActor* actor, int attrib_ndx, int flags) // //========================================================================== -int _PlayerSound(int num, SWPlayer* pp) +int _PlayerSound(int num, DSWPlayer* pp) { int handle; if (Prediction) return 0; - if (pp < *PlayerArray || pp >= getPlayer(MAX_SW_PLAYERS)) - { - return 0; - } - auto sndid = soundEngine->FindSoundByResID(num); if (!soundEngine->isValidSoundId(sndid) || !SoundEnabled()) return 0; @@ -759,7 +754,7 @@ int _PlayerSound(int num, SWPlayer* pp) return 0; } -void StopPlayerSound(SWPlayer* pp, int which) +void StopPlayerSound(DSWPlayer* pp, int which) { soundEngine->StopSound(SOURCE_Player, pp, CHAN_VOICE, soundEngine->FindSoundByResID(which)); } diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index 7d9df0a23..d4dc7d899 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -413,7 +413,7 @@ int DoSpike(DSWActor* actor) if (!found) { short pnum; - SWPlayer* pp; + DSWPlayer* pp; // go ahead and look for players clip box bounds TRAVERSE_CONNECT(pnum) { diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index c214558ba..55dd15fce 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -87,8 +87,8 @@ int SetupPachinko4(DSWActor*); int SetupGirlNinja(DSWActor*); int DoSlidorInstantClose(DSWActor*); -void InitWeaponRocket(SWPlayer*); -void InitWeaponUzi(SWPlayer*); +void InitWeaponRocket(DSWPlayer*); +void InitWeaponUzi(DSWPlayer*); int MoveSkip4, MoveSkip2, MoveSkip8; int MinEnemySkill; @@ -547,7 +547,7 @@ void KillActor(DSWActor* actor) if (actor->hasU()) { - SWPlayer* pp; + DSWPlayer* pp; int pnum; // doing a MissileSetPos - don't allow killing @@ -4887,7 +4887,7 @@ int DoSpawnItemTeleporterEffect(DSWActor* actor) // //--------------------------------------------------------------------------- -void ChoosePlayerGetSound(SWPlayer* pp) +void ChoosePlayerGetSound(DSWPlayer* pp) { int choose_snd=0; @@ -4904,7 +4904,7 @@ void ChoosePlayerGetSound(SWPlayer* pp) // //--------------------------------------------------------------------------- -bool CanGetWeapon(SWPlayer* pp, DSWActor* actor, int WPN) +bool CanGetWeapon(DSWPlayer* pp, DSWActor* actor, int WPN) { switch (gNet.MultiGameType) { @@ -4964,7 +4964,7 @@ enum }; int DoGet(DSWActor* actor) { - SWPlayer* pp; + DSWPlayer* pp; short pnum, key_num; bool can_see; @@ -5865,7 +5865,7 @@ void ProcessActiveVars(DSWActor* actor) // //--------------------------------------------------------------------------- -void AdjustActiveRange(SWPlayer* pp, DSWActor* actor, double dist) +void AdjustActiveRange(DSWPlayer* pp, DSWActor* actor, double dist) { DSWActor* plActor = pp->GetActor(); @@ -6011,7 +6011,7 @@ void SpriteControl(void) { int32_t stat; short pnum, CloseToPlayer; - SWPlayer* pp; + DSWPlayer* pp; short StateTics; SWStatIterator it(STAT_MISC); diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index d34618876..8191a02c5 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -694,7 +694,7 @@ int DoSumoDeathMelt(DSWActor* actor) void BossHealthMeter(void) { - SWPlayer* pp = getPlayer(myconnectindex); + DSWPlayer* pp = getPlayer(myconnectindex); short color=0,metertics,meterunit; int y; extern bool NoMeters; diff --git a/source/games/sw/src/text.cpp b/source/games/sw/src/text.cpp index 82b13515f..0fdcf4f92 100644 --- a/source/games/sw/src/text.cpp +++ b/source/games/sw/src/text.cpp @@ -45,9 +45,9 @@ BEGIN_SW_NS // //--------------------------------------------------------------------------- -void PutStringInfo(SWPlayer* pp, const char *string) +void PutStringInfo(DSWPlayer* pp, const char *string) { - if ((pp - (SWPlayer*)PlayerArray) == myconnectindex) + if (pp->pnum == myconnectindex) Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", string); // Put it in the console too } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 9d30cdb91..8d5960eb1 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1453,9 +1453,9 @@ void PlaceActorsOnTracks(void) } -void MovePlayer(SWPlayer* pp, SECTOR_OBJECT* sop, const DVector2& move) +void MovePlayer(DSWPlayer* pp, SECTOR_OBJECT* sop, const DVector2& move) { - void DoPlayerZrange(SWPlayer* pp); + void DoPlayerZrange(DSWPlayer* pp); // make sure your standing on the so if (pp->Flags & (PF_JUMPING | PF_FALLING | PF_FLYING)) @@ -1527,7 +1527,7 @@ void MovePoints(SECTOR_OBJECT* sop, DAngle deltaangle, const DVector2& move) { int j; int pnum; - SWPlayer* pp; + DSWPlayer* pp; sectortype** sectp; int i; DAngle rot_ang; @@ -3316,7 +3316,7 @@ present time. int ActorFollowTrack(DSWActor* actor, short locktics) { - SWPlayer* pp; + DSWPlayer* pp; TRACK_POINT* tpoint; short pnum; diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index 782c28d2f..c7a13ec46 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -40,7 +40,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void DoVatorMatch(SWPlayer* pp, short match); +void DoVatorMatch(DSWPlayer* pp, short match); bool TestVatorMatchActive(short match); void ReverseVator(DSWActor* actor) @@ -133,7 +133,7 @@ void SetVatorInactive(DSWActor* actor) } // called for operation from the space bar -void DoVatorOperate(SWPlayer* pp, sectortype* sect) +void DoVatorOperate(DSWPlayer* pp, sectortype* sect) { short match; @@ -180,7 +180,7 @@ void DoVatorOperate(SWPlayer* pp, sectortype* sect) // called from switches and triggers // returns first vator found -void DoVatorMatch(SWPlayer* pp, short match) +void DoVatorMatch(DSWPlayer* pp, short match) { SWStatIterator it(STAT_VATOR); while (auto actor = it.Next()) @@ -479,7 +479,7 @@ int DoVator(DSWActor* actor) if (!found) { short pnum; - SWPlayer* pp; + DSWPlayer* pp; // go ahead and look for players clip box bounds TRAVERSE_CONNECT(pnum) { diff --git a/source/games/sw/src/vis.cpp b/source/games/sw/src/vis.cpp index 175f00602..210c6bae1 100644 --- a/source/games/sw/src/vis.cpp +++ b/source/games/sw/src/vis.cpp @@ -80,7 +80,7 @@ void ProcessVisOn(void) } } -void VisViewChange(SWPlayer* pp, int *vis) +void VisViewChange(DSWPlayer* pp, int *vis) { short BrightestVis = NormalVisibility; DVector3 pos; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 3bce1c010..137eb8621 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -54,7 +54,7 @@ struct MISSILE_PLACEMENT void SpawnZombie2(DSWActor*); Collision move_ground_missile(DSWActor* actor, const DVector2& change, double ceildist, double flordist, uint32_t cliptype, int numtics); -void DoPlayerBeginDie(SWPlayer*); +void DoPlayerBeginDie(DSWPlayer*); void ScaleSpriteVector(DSWActor* actor, int scalex, int scaley, int scalez); void ScaleSpriteVector(DSWActor* actor, int scale); @@ -118,7 +118,7 @@ void SpawnMicroExp(DSWActor*); void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, double upper_zsize, double lower_zsize); int BulletHitSprite(DSWActor* actor, DSWActor* hitActor, const DVector3& pos, short ID); int SpawnSplashXY(const DVector3& pos, sectortype*); -DSWActor* SpawnBoatSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang); +DSWActor* SpawnBoatSparks(DSWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang); short StatDamageList[STAT_DAMAGE_LIST_SIZE] = { @@ -2540,7 +2540,7 @@ int SpawnShrapX(DSWActor* actor) int DoLavaErupt(DSWActor* actor) { short i,pnum; - SWPlayer* pp; + DSWPlayer* pp; bool found = false; if (TEST_BOOL1(actor)) @@ -3334,7 +3334,7 @@ AutoShrap: p = StdShrap; if (parentActor->user.PlayerP) { - SWPlayer* pp = parentActor->user.PlayerP; + DSWPlayer* pp = parentActor->user.PlayerP; if (pp->DeathType == PLAYER_DEATH_CRUMBLE) p = PlayerGoreFall; @@ -4628,7 +4628,7 @@ int ActorChooseDeath(DSWActor* actor, DSWActor* weapActor) actor->user.ID == CARGIRL_R0 || actor->user.ID == MECHANICGIRL_R0 || actor->user.ID == SAILORGIRL_R0 || actor->user.ID == PRUNEGIRL_R0 || actor->user.ID == WASHGIRL_R0) && weapActor->hasU() && weapActor->user.ID == NINJA_RUN_R0 && weapActor->user.PlayerP) { - SWPlayer* pp = weapActor->user.PlayerP; + DSWPlayer* pp = weapActor->user.PlayerP; if (pp && !(pp->Flags & PF_DIVING)) // JBF: added null test pp->Bloody = true; PlaySound(DIGI_TOILETGIRLSCREAM, actor, v3df_none); @@ -4653,7 +4653,7 @@ int ActorChooseDeath(DSWActor* actor, DSWActor* weapActor) case NINJA_RUN_R0: //sword if (weapActor->user.PlayerP) { - SWPlayer* pp = weapActor->user.PlayerP; + DSWPlayer* pp = weapActor->user.PlayerP; if (weapActor->user.WeaponNum == WPN_FIST && StdRandomRange(1000)>500 && pp == getPlayer(myconnectindex)) { @@ -4752,7 +4752,7 @@ int ActorChooseDeath(DSWActor* actor, DSWActor* weapActor) // Random chance of taunting the AI's here if (RandomRange(1000) > 400) { - SWPlayer* pp; + DSWPlayer* pp; auto own = GetOwner(weapActor); if (own && own->hasU()) @@ -5109,7 +5109,7 @@ int ActorDamageSlide(DSWActor* actor, int damage, DAngle angle) // //--------------------------------------------------------------------------- -int PlayerDamageSlide(SWPlayer* pp, int damage, DAngle angle) +int PlayerDamageSlide(DSWPlayer* pp, int damage, DAngle angle) { damage = abs(damage); @@ -5196,7 +5196,7 @@ int GetDamage(DSWActor* actor, DSWActor* weapActor, int DamageNdx) // //--------------------------------------------------------------------------- -int PlayerCheckDeath(SWPlayer* pp, DSWActor* weapActor) +int PlayerCheckDeath(DSWPlayer* pp, DSWActor* weapActor) { DSWActor* actor = pp->GetActor(); @@ -5263,7 +5263,7 @@ int PlayerCheckDeath(SWPlayer* pp, DSWActor* weapActor) // //--------------------------------------------------------------------------- -bool PlayerTakeDamage(SWPlayer* pp, DSWActor* weapActor) +bool PlayerTakeDamage(DSWPlayer* pp, DSWActor* weapActor) { if (weapActor == nullptr) return true; @@ -5449,7 +5449,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor) } else { - SWPlayer* pp = getPlayer(screenpeek); + DSWPlayer* pp = getPlayer(screenpeek); ActorHealth(actor, damage); if (actor->user.Health <= 0) @@ -6710,7 +6710,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor) { if (PlayerTakeDamage(actor->user.PlayerP, weapActor)) { - SWPlayer* pp = actor->user.PlayerP; + DSWPlayer* pp = actor->user.PlayerP; PlayerSound(DIGI_GASHURT, v3df_dontpan|v3df_follow|v3df_doppler,pp); PlayerUpdateHealth(actor->user.PlayerP, damage-1000); @@ -8738,7 +8738,7 @@ int DoMine(DSWActor* actor) // check to see if sprite is player or enemy if ((hitActor->spr.extra & SPRX_PLAYER_OR_ENEMY)) { - SWPlayer* pp; + DSWPlayer* pp; // attach weapon to sprite SetAttach(hitActor, actor); @@ -10069,7 +10069,7 @@ void SpawnNuclearSecondaryExp(DSWActor* actor, DAngle ang) void SpawnNuclearExp(DSWActor* actor) { DAngle ang=nullAngle; - SWPlayer* pp = nullptr; + DSWPlayer* pp = nullptr; short rnd_rng; ASSERT(actor->hasU()); @@ -11228,7 +11228,7 @@ int DoRing(DSWActor* actor) { auto own = GetOwner(actor); if (!own) return 0; // this would crash. - SWPlayer* pp = own->user.PlayerP; + DSWPlayer* pp = own->user.PlayerP; double cz,fz; if (actor->user.Flags & (SPR_UNDERWATER)) @@ -11315,7 +11315,7 @@ int DoRing(DSWActor* actor) // //--------------------------------------------------------------------------- -void InitSpellRing(SWPlayer* pp) +void InitSpellRing(DSWPlayer* pp) { short missiles; short max_missiles = 16; @@ -11690,7 +11690,7 @@ int InitSerpRing(DSWActor* actor) // //--------------------------------------------------------------------------- -void InitSpellNapalm(SWPlayer* pp) +void InitSpellNapalm(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); unsigned i; @@ -11846,7 +11846,7 @@ int InitEnemyNapalm(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitSpellMirv(SWPlayer* pp) +int InitSpellMirv(DSWPlayer* pp) { PlaySound(DIGI_MIRVFIRE, pp, v3df_none); @@ -11925,7 +11925,7 @@ int InitEnemyMirv(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitSwordAttack(SWPlayer* pp) +int InitSwordAttack(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); unsigned stat; @@ -12093,7 +12093,7 @@ int InitSwordAttack(SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitFistAttack(SWPlayer* pp) +int InitFistAttack(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); unsigned stat; @@ -12707,7 +12707,7 @@ void WeaponHitscanShootFeet(DSWActor* actor, DSWActor* hitActor, double *zvect) } } -int InitStar(SWPlayer* pp) +int InitStar(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); @@ -12811,7 +12811,7 @@ int InitStar(SWPlayer* pp) // //--------------------------------------------------------------------------- -void InitHeartAttack(SWPlayer* pp) +void InitHeartAttack(DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); short i = 0; @@ -12864,7 +12864,7 @@ void InitHeartAttack(SWPlayer* pp) // //--------------------------------------------------------------------------- -int ContinueHitscan(SWPlayer* pp, sectortype* sect, const DVector3& start, DAngle ang, const DVector3& vect) +int ContinueHitscan(DSWPlayer* pp, sectortype* sect, const DVector3& start, DAngle ang, const DVector3& vect) { HitInfo hit{}; DSWActor* actor = pp->GetActor(); @@ -12948,7 +12948,7 @@ int ContinueHitscan(SWPlayer* pp, sectortype* sect, const DVector3& start, DAngl // //--------------------------------------------------------------------------- -int InitShotgun(SWPlayer* pp) +int InitShotgun(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); HitInfo hit{}; @@ -13114,7 +13114,7 @@ int InitShotgun(SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitLaser(SWPlayer* pp) +int InitLaser(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -13204,7 +13204,7 @@ int InitLaser(SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitRail(SWPlayer* pp) +int InitRail(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); double zvel; @@ -13361,7 +13361,7 @@ int InitZillaRail(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitRocket(SWPlayer* pp) +int InitRocket(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); double zvel; @@ -13471,7 +13471,7 @@ int InitRocket(SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitBunnyRocket(SWPlayer* pp) +int InitBunnyRocket(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); double zvel; @@ -13576,7 +13576,7 @@ int InitBunnyRocket(SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitNuke(SWPlayer* pp) +int InitNuke(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); double zvel; @@ -13743,7 +13743,7 @@ int InitEnemyNuke(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitMicro(SWPlayer* pp) +int InitMicro(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); short i; @@ -14432,7 +14432,7 @@ int InitEnemyRail(DSWActor* actor) // if co-op don't hurt teammate if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE && actor->user.ID == ZOMBIE_RUN_R0) { - SWPlayer* pp; + DSWPlayer* pp; // Check all players TRAVERSE_CONNECT(pnum) @@ -14959,7 +14959,7 @@ int DoDefaultStat(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitTracerUzi(SWPlayer* pp) +int InitTracerUzi(DSWPlayer* pp) { if (!pp->insector()) return 0; @@ -15222,7 +15222,7 @@ bool HitscanSpriteAdjust(DSWActor* actor, walltype* hit_wall) // //--------------------------------------------------------------------------- -int InitUzi(SWPlayer* pp) +int InitUzi(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); HitInfo hit{}; @@ -15233,7 +15233,7 @@ int InitUzi(SWPlayer* pp) bool FireSnd = false; const int UZIFIRE_WAIT = 20; - void InitUziShell(SWPlayer*); + void InitUziShell(DSWPlayer*); PlayerUpdateAmmo(pp, actor->user.WeaponNum, -1); @@ -15423,7 +15423,7 @@ int InitUzi(SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitTankShell(DSWActor* actor, SWPlayer* pp) +int InitTankShell(DSWActor* actor, DSWPlayer* pp) { if (!SW_SHAREWARE) PlaySound(DIGI_CANNON, pp, v3df_dontpan|v3df_doppler); @@ -15466,7 +15466,7 @@ int InitTankShell(DSWActor* actor, SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitTurretMicro(DSWActor* actor, SWPlayer* pp) +int InitTurretMicro(DSWActor* actor, DSWPlayer* pp) { DSWActor* plActor = pp->GetActor(); TARGET_SORT* ts = TargetSort; @@ -15562,7 +15562,7 @@ int InitTurretMicro(DSWActor* actor, SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitTurretRocket(DSWActor* actor, SWPlayer* pp) +int InitTurretRocket(DSWActor* actor, DSWPlayer* pp) { if (SW_SHAREWARE) return false; // JBF: verify @@ -15601,7 +15601,7 @@ int InitTurretRocket(DSWActor* actor, SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitTurretFireball(DSWActor* actor, SWPlayer* pp) +int InitTurretFireball(DSWActor* actor, DSWPlayer* pp) { if (SW_SHAREWARE) return false; // JBF: verify @@ -15641,7 +15641,7 @@ int InitTurretFireball(DSWActor* actor, SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitTurretRail(DSWActor* actor, SWPlayer* pp) +int InitTurretRail(DSWActor* actor, DSWPlayer* pp) { if (SW_SHAREWARE) return false; // JBF: verify @@ -15687,7 +15687,7 @@ int InitTurretRail(DSWActor* actor, SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitTurretLaser(DSWActor* actor, SWPlayer* pp) +int InitTurretLaser(DSWActor* actor, DSWPlayer* pp) { if (SW_SHAREWARE) return false; // JBF: verify @@ -15730,7 +15730,7 @@ int InitTurretLaser(DSWActor* actor, SWPlayer* pp) // //--------------------------------------------------------------------------- -int InitSobjMachineGun(DSWActor* actor, SWPlayer* pp) +int InitSobjMachineGun(DSWActor* actor, DSWPlayer* pp) { HitInfo hit{}; short cstat = 0; @@ -15820,7 +15820,7 @@ int InitSobjMachineGun(DSWActor* actor, SWPlayer* pp) return 0; } -int InitSobjGun(SWPlayer* pp) +int InitSobjGun(DSWPlayer* pp) { short i; bool first = false; @@ -15932,7 +15932,7 @@ int InitSobjGun(SWPlayer* pp) // //--------------------------------------------------------------------------- -DSWActor* SpawnBoatSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang) +DSWActor* SpawnBoatSparks(DSWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang) { auto actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hit_sect, hitpos, hit_ang, 0); actorNew->spr.shade = -40; @@ -15972,7 +15972,7 @@ DSWActor* SpawnBoatSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall // //--------------------------------------------------------------------------- -int SpawnSwordSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang) +int SpawnSwordSparks(DSWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang) { DSWActor* actor = pp->GetActor(); @@ -16050,7 +16050,7 @@ DSWActor* SpawnTurretSparks(sectortype* hit_sect, walltype* hit_wall, const DVec // //--------------------------------------------------------------------------- -DSWActor* SpawnShotgunSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang) +DSWActor* SpawnShotgunSparks(DSWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang) { const double SHOTGUN_SMOKE_REPEAT = 0.28125; @@ -16248,7 +16248,7 @@ int InitEnemyUzi(DSWActor* actor) DAngle daang; HitInfo hit{}; double zh; - void InitUziShell(SWPlayer*); + void InitUziShell(DSWPlayer*); static short alternate; @@ -16391,7 +16391,7 @@ int InitEnemyUzi(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitGrenade(SWPlayer* pp) +int InitGrenade(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); double zvel; @@ -16536,7 +16536,7 @@ int InitSpriteGrenade(DSWActor* actor) // //--------------------------------------------------------------------------- -int InitMine(SWPlayer* pp) +int InitMine(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -16664,7 +16664,7 @@ int HelpMissileLateral(DSWActor* actor, int dist) // //--------------------------------------------------------------------------- -int InitFireball(SWPlayer* pp) +int InitFireball(DSWPlayer* pp) { DSWActor* actor = pp->GetActor(); @@ -17952,7 +17952,7 @@ int DoFloorBlood(DSWActor* actor) constexpr double FEET_IN_BLOOD_DIST = 18.75; short pnum; - SWPlayer* pp; + DSWPlayer* pp; double scale; diff --git a/source/games/sw/src/weapon.h b/source/games/sw/src/weapon.h index 91299e290..851cb8522 100644 --- a/source/games/sw/src/weapon.h +++ b/source/games/sw/src/weapon.h @@ -38,7 +38,7 @@ inline DAngle AngToSprite(DSWActor* actor, DSWActor* other) return (actor->spr.pos - other->spr.pos).Angle(); } -inline DAngle AngToPlayer(SWPlayer* player, DSWActor* other) +inline DAngle AngToPlayer(DSWPlayer* player, DSWActor* other) { return (player->GetActor()->getPosWithOffsetZ() - other->spr.pos).Angle(); } @@ -81,14 +81,14 @@ extern int LoWangsQueueHead; extern TObjPtr LoWangsQueue[MAX_LOWANGS_QUEUE]; void ChangeState(DSWActor* actor, STATE* statep); -void DoPlayerBeginRecoil(SWPlayer* pp, double pix_amt); +void DoPlayerBeginRecoil(DSWPlayer* pp, double pix_amt); SECTOR_OBJECT* DetectSectorObject(sectortype*); SECTOR_OBJECT* DetectSectorObjectByWall(walltype*); void ScaleSpriteVector(DSWActor* actor, int scale); void QueueHole(sectortype* hit_sect, walltype* hit_wall, const DVector3& pos); DSWActor* QueueWallBlood(DSWActor* hit, DAngle ang); bool SlopeBounce(DSWActor*, bool *hit_wall); -int SpawnSwordSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang); +int SpawnSwordSparks(DSWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang); DSWActor* SpawnBubble(DSWActor*); void SpawnFireballExp(DSWActor*); void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor); @@ -100,7 +100,7 @@ int ShrapKillSprite(DSWActor*); bool MissileSetPos(DSWActor*,VMFunction* DoWeapon,int dist); int ActorPain(DSWActor*); int SpawnBreakFlames(DSWActor*); -bool PlayerTakeDamage(SWPlayer* pp, DSWActor* weapActor); +bool PlayerTakeDamage(DSWPlayer* pp, DSWActor* weapActor); const char *DeathString(DSWActor*); // @@ -163,7 +163,7 @@ inline double CloseRangeDist(DSWActor* a1, DSWActor* a2, double fudge = 25) extern short target_ang; -DSWActor* SpawnShotgunSparks(SWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang); +DSWActor* SpawnShotgunSparks(DSWPlayer* pp, sectortype* hit_sect, walltype* hit_wall, const DVector3& hitpos, DAngle hit_ang); int DoActorBeginSlide(DSWActor* actor, DAngle ang, double vel); int GetOverlapSector(const DVector2& pos, sectortype** over, sectortype** under); @@ -183,12 +183,12 @@ void WallBounce(DSWActor*, DAngle ang); #define CALTROPS 2218 #define PHOSPHORUS 1397 -int PlayerInitChemBomb(SWPlayer* pp); +int PlayerInitChemBomb(DSWPlayer* pp); int InitChemBomb(DSWActor*); -int PlayerInitCaltrops(SWPlayer* pp); +int PlayerInitCaltrops(DSWPlayer* pp); int InitBloodSpray(DSWActor* actor, bool dogib, short velocity); int SpawnBunnyExp(DSWActor* actor); -int InitBunnyRocket(SWPlayer* pp); +int InitBunnyRocket(DSWPlayer* pp); int GetDamage(DSWActor*, DSWActor*, int DamageNdx); int DoFlamesDamageTest(DSWActor*); @@ -212,12 +212,12 @@ int SetSuicide(DSWActor*); void UpdateSinglePlayKills(DSWActor* actor); int InitPlasmaFountain(DSWActor* wActor, DSWActor* sActor); int InitCoolgDrip(DSWActor*); -int InitFireball(SWPlayer* pp); -void InitSpellRing(SWPlayer* pp); -void InitSpellNapalm(SWPlayer* pp); +int InitFireball(DSWPlayer* pp); +void InitSpellRing(DSWPlayer* pp); +void InitSpellNapalm(DSWPlayer* pp); int DoStaticFlamesDamage(DSWActor*); -int InitUzi(SWPlayer* pp); -int InitSobjGun(SWPlayer* pp); +int InitUzi(DSWPlayer* pp); +int InitSobjGun(DSWPlayer* pp); void InitFireballTrap(DSWActor* actor); void InitBoltTrap(DSWActor* actor); void InitSpearTrap(DSWActor*); @@ -230,9 +230,9 @@ void SpriteQueueDelete(DSWActor* actor); int HelpMissileLateral(DSWActor*, int dist); void AddSpriteToSectorObject(DSWActor*,SECTOR_OBJECT* sop); void QueueReset(void); -int PlayerCheckDeath(SWPlayer* pp,DSWActor*); +int PlayerCheckDeath(DSWPlayer* pp,DSWActor*); bool SpriteWarpToUnderwater(DSWActor* actor); -int PlayerDamageSlide(SWPlayer* pp,int damage,DAngle ang); +int PlayerDamageSlide(DSWPlayer* pp,int damage,DAngle ang); bool VehicleMoveHit(DSWActor*); int SpawnSplash(DSWActor*); void SpawnMineExp(DSWActor*); diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index c847a33f8..1269df090 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -771,7 +771,7 @@ int SetupZombie(DSWActor* actor) // //--------------------------------------------------------------------------- -void SpawnZombie(SWPlayer* pp, DSWActor* weaponActor) +void SpawnZombie(DSWPlayer* pp, DSWActor* weaponActor) { auto ownerActor = GetOwner(weaponActor); diff --git a/wadsrc/static/zscript/games/blood/bloodgame.zs b/wadsrc/static/zscript/games/blood/bloodgame.zs index 6308b1e23..c87054a24 100644 --- a/wadsrc/static/zscript/games/blood/bloodgame.zs +++ b/wadsrc/static/zscript/games/blood/bloodgame.zs @@ -69,12 +69,13 @@ struct PACKINFO // not native! int curAmount; } -struct BloodPlayer native +class BloodPlayer : CorePlayer native { - native uint8 pnum; // Connect id - native int GetHealth(); // health is stored in the XSPRITE which cannot be safely exported to scripting at the moment due to pending refactoring. native int powerupCheck(int pwup); + + native readonly BloodActor actor; + //DUDEINFO* pDudeInfo; //PlayerHorizon horizon; //PlayerAngle angle; @@ -151,4 +152,4 @@ struct BloodPlayer native native int player_par; native int nWaterPal; //POSTURE pPosture[kModeMax][kPostureMax]; -}; +} diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 26a078eda..a633974ef 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -226,8 +226,9 @@ struct Duke native } -struct DukePlayer native +class DukePlayer : CorePlayer native { + native readonly DukeActor actor; /* // player's horizon and angle structs. PlayerHorizon horizon; @@ -282,12 +283,12 @@ struct DukePlayer native native int16 cheat_phase; native int16 extra_extra8, quick_kick, last_quick_kick; native int16 heat_amount, timebeforeexit, customexitsound; - native DukeActor actor, actorsqu, wackedbyactor, on_crane, somethingonplayer, access_spritenum, dummyplayersprite, newOwner, holoduke_on; + native DukeActor actorsqu, wackedbyactor, on_crane, somethingonplayer, access_spritenum, dummyplayersprite, newOwner, holoduke_on; native sectortype cursector; native uint interface_toggle_flag; - native int16 dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang + native int16 dead_flag, show_empty_weapon; native int16 scuba_amount, jetpack_amount, steroids_amount, shield_amount; native int16 pycount, frag_ps; native int16 transporter_hold, last_full_weapon, footprintshade, boot_amount; diff --git a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs index 1903dc9cd..9d772426d 100644 --- a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs +++ b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs @@ -56,8 +56,10 @@ struct Seq native native SeqFrame getFrame(int frameId); } -struct ExhumedPlayer native +class ExhumedPlayer : CorePlayer native { + native readonly ExhumedActor actor; + native int16 nHealth; native int16 nLives; native int16 nDouble; diff --git a/wadsrc/static/zscript/games/razebase.zs b/wadsrc/static/zscript/games/razebase.zs index 5d382de46..a80eded00 100644 --- a/wadsrc/static/zscript/games/razebase.zs +++ b/wadsrc/static/zscript/games/razebase.zs @@ -248,7 +248,11 @@ struct Raze { return vel * cos(pitch), sin(pitch) * zvspeed; } - +} + +class CorePlayer native +{ + native readonly uint8 pnum; } /* @@ -266,3 +270,4 @@ class RazeMenuDelegate : MenuDelegateBase native override void MenuDismissed(); } + diff --git a/wadsrc/static/zscript/games/sw/swgame.zs b/wadsrc/static/zscript/games/sw/swgame.zs index aef9a3d37..b7ed5967d 100644 --- a/wadsrc/static/zscript/games/sw/swgame.zs +++ b/wadsrc/static/zscript/games/sw/swgame.zs @@ -145,10 +145,9 @@ struct SW native } -struct SWPlayer native +class SWPlayer : CorePlayer native { - native uint8 pnum; // carry along the player number - + native readonly SWActor actor; // variable that fit in the sprite or user structure /* union