- u() in input.cpp, interpso.cpp and inv.cpp

This commit is contained in:
Christoph Oelckers 2021-12-25 21:21:42 +01:00
parent 41753240dd
commit 388b3062fd
3 changed files with 18 additions and 22 deletions

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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;