From 388b3062fd7bb33419748e5d19ba1c80d91ac4b3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 25 Dec 2021 21:21:42 +0100 Subject: [PATCH] - u() in input.cpp, interpso.cpp and inv.cpp --- source/games/sw/src/input.cpp | 22 +++++++++++----------- source/games/sw/src/interpso.cpp | 15 ++++++--------- source/games/sw/src/inv.cpp | 3 +-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index a7df78b53..f98bec64f 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -78,21 +78,21 @@ enum static void processWeapon(PLAYERp const pp) { - if (pp->Actor() == nullptr) return; - USERp u = pp->Actor()->u(); + DSWActor* plActor = pp->actor; + if (plActor == nullptr) return; int i; if (loc.getNewWeapon() == WeaponSel_Next) { - int next_weapon = u->WeaponNum + 1; + int next_weapon = plActor->user.WeaponNum + 1; int start_weapon; - start_weapon = u->WeaponNum + 1; + start_weapon = plActor->user.WeaponNum + 1; - if (u->WeaponNum == WPN_SWORD) + if (plActor->user.WeaponNum == WPN_SWORD) start_weapon = WPN_STAR; - if (u->WeaponNum == WPN_FIST) + if (plActor->user.WeaponNum == WPN_FIST) { next_weapon = 14; } @@ -119,16 +119,16 @@ static void processWeapon(PLAYERp const pp) } else if (loc.getNewWeapon() == WeaponSel_Prev) { - int prev_weapon = u->WeaponNum - 1; + int prev_weapon = plActor->user.WeaponNum - 1; int start_weapon; - start_weapon = u->WeaponNum - 1; + start_weapon = plActor->user.WeaponNum - 1; - if (u->WeaponNum == WPN_SWORD) + if (plActor->user.WeaponNum == WPN_SWORD) { prev_weapon = 13; } - else if (u->WeaponNum == WPN_STAR) + else if (plActor->user.WeaponNum == WPN_STAR) { prev_weapon = 14; } @@ -151,7 +151,7 @@ static void processWeapon(PLAYERp const pp) } else if (loc.getNewWeapon() == WeaponSel_Alt) { - int which_weapon = u->WeaponNum + 1; + int which_weapon = plActor->user.WeaponNum + 1; loc.setNewWeapon(which_weapon); } } diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index e7e0670f5..9f6526a45 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -289,9 +289,8 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings auto actorofang = data->actorofang; if (actorofang) { - USERp u = actorofang->u(); - if (u) - u->oangdiff = 0; + if (actorofang->hasU()) + actorofang->user.oangdiff = 0; if (!interpolating) data->lastangdiff = 0; data->oldipos = actorofang->spr.ang; @@ -346,8 +345,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b auto actorofang = data->actorofang; if (actorofang) { - USERp u = actorofang->u(); - data->lastangdiff = u ? u->oangdiff : 0; + data->lastangdiff = actorofang->hasU() ? actorofang->user.oangdiff : 0; } } } @@ -390,10 +388,9 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b { DSWActor* actor = data->actorofang; if (!actor) continue; - USERp u = actor->u(); - if (u && (actor->spr.statnum != STAT_DEFAULT) && - ((TEST(u->Flags, SPR_SKIP4) && (actor->spr.statnum <= STAT_SKIP4_INTERP_END)) || - (TEST(u->Flags, SPR_SKIP2) && (actor->spr.statnum <= STAT_SKIP2_INTERP_END)))) + if (actor->hasU() && (actor->spr.statnum != STAT_DEFAULT) && + ((TEST(actor->user.Flags, SPR_SKIP4) && (actor->spr.statnum <= STAT_SKIP4_INTERP_END)) || + (TEST(actor->user.Flags, SPR_SKIP2) && (actor->spr.statnum <= STAT_SKIP2_INTERP_END)))) continue; } diff --git a/source/games/sw/src/inv.cpp b/source/games/sw/src/inv.cpp index 9f0fce90c..14d1fc4d1 100644 --- a/source/games/sw/src/inv.cpp +++ b/source/games/sw/src/inv.cpp @@ -139,7 +139,6 @@ void AutoPickInventory(PLAYERp pp) void UseInventoryMedkit(PLAYERp pp) { - USERp u = pp->Actor()->u(); short diff; short inv = INVENTORY_MEDKIT; short amt; @@ -148,7 +147,7 @@ void UseInventoryMedkit(PLAYERp pp) if (!pp->InventoryAmount[inv]) return; - diff = 100 - u->Health; + diff = 100 - pp->actor->user.Health; if (diff <= 0) return;