- cleaned up some dirty code.

This commit is contained in:
Christoph Oelckers 2021-08-30 08:07:40 +02:00
parent 07eda3cb4a
commit 0bd0923f44
3 changed files with 4 additions and 8 deletions

View file

@ -530,10 +530,6 @@ inline int32_t setsprite(int16_t spritenum, int x, int y, int z)
return setsprite(spritenum, &v);
}
inline void setspritepos(int spnum, int x, int y, int z)
{
sprite[spnum].pos = { x,y,z };
}
int32_t setspritez(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2)));
int32_t spriteheightofsptr(uspriteptr_t spr, int32_t *height, int32_t alsotileyofs);

View file

@ -880,7 +880,7 @@ int32_t setsprite(int16_t spritenum, const vec3_t *newpos)
{
int16_t tempsectnum = sprite[spritenum].sectnum;
if ((void const *) newpos != (void *) &sprite[spritenum])
if (newpos != &sprite[spritenum].pos)
sprite[spritenum].pos = *newpos;
updatesector(newpos->x,newpos->y,&tempsectnum);

View file

@ -173,7 +173,7 @@ void checkavailweapon(struct player_struct* player)
player->curr_weapon = weap;
if (isWW2GI())
{
SetGameVarID(g_iWeaponVarID, player->curr_weapon, player->GetActor(), snum); // snum is playerindex!
SetGameVarID(g_iWeaponVarID, player->curr_weapon, player->GetActor(), snum); // snum is player index!
if (player->curr_weapon >= 0)
{
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[player->curr_weapon][snum], player->GetActor(), snum);
@ -1010,7 +1010,7 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2)
// with no checking if it got reused in the mean time.
spri->picnum = 0; // give it a picnum without any behavior attached, just in case
spri->cstat |= CSTAT_SPRITE_INVISIBLE|CSTAT_SPRITE_NOFIND;
changespritestat(actor->GetIndex(), STAT_REMOVED);
changespritestat(actor, STAT_REMOVED);
}
}
}
@ -5316,7 +5316,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
short j = s->sectnum;
int x = s->x, y = s->y, z = s->z;
pushmove(&x, &y, &z, &j, 128, (4 << 8), (4 << 8), CLIPMASK0);
setspritepos(actor->GetIndex(), x, y, z); // wrap this for safety. The renderer may need processing of the new position.
s->x = x; s->y = y; s->z = z;
if (j != s->sectnum && j >= 0 && j < MAXSECTORS)
changespritesect(actor, j);