- got rid of some rarely used macros.

This commit is contained in:
Christoph Oelckers 2021-11-01 15:31:42 +01:00
parent d10919704a
commit 5eca574bba
7 changed files with 10 additions and 18 deletions

View file

@ -455,8 +455,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso
u->MaxHealth = u->Health; u->MaxHealth = u->Health;
u->PainThreshold = DIV16(u->Health) - 1; u->PainThreshold = (u->Health >> 4) - 1;
//u->PainThreshold = DIV4(u->Health) - 1;
SET(sp->cstat,CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(sp->cstat,CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
SET(sp->extra,SPRX_PLAYER_OR_ENEMY); SET(sp->extra,SPRX_PLAYER_OR_ENEMY);

View file

@ -331,8 +331,7 @@ DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz,
view_dist = 0; view_dist = 0;
// make shadow smaller depending on height from ground // make shadow smaller depending on height from ground
ground_dist = labs(loz - SPRITEp_BOS(tsp)) >> 8; ground_dist = labs(loz - SPRITEp_BOS(tsp)) >> 12;
ground_dist = DIV16(ground_dist);
xrepeat = max(xrepeat - ground_dist - view_dist, 4); xrepeat = max(xrepeat - ground_dist - view_dist, 4);
yrepeat = max(yrepeat - ground_dist - view_dist, 4); yrepeat = max(yrepeat - ground_dist - view_dist, 4);

View file

@ -177,7 +177,7 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum)
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {
next_i = MOD4(i+1); next_i = (i+1) & 3;
if (!cansee(q[i].x, q[i].y,0x3fffffff, sectnum, if (!cansee(q[i].x, q[i].y,0x3fffffff, sectnum,
q[next_i].x, q[next_i].y,0x3fffffff, sectnum)) q[next_i].x, q[next_i].y,0x3fffffff, sectnum))
{ {

View file

@ -48,15 +48,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define DIV2(x) ((x) >> 1) #define DIV2(x) ((x) >> 1)
#define DIV4(x) ((x) >> 2) #define DIV4(x) ((x) >> 2)
#define DIV8(x) ((x) >> 3) #define DIV8(x) ((x) >> 3)
#define DIV16(x) ((x) >> 4)
#define DIV32(x) ((x) >> 5)
#define DIV256(x) ((x) >> 8) #define DIV256(x) ((x) >> 8)
// Fast mods of select 2 power numbers
#define MOD2(x) ((x) & 1)
#define MOD4(x) ((x) & 3)
// Fast mods of any power of 2 // Fast mods of any power of 2
#define MOD_P2(number,modby) ((number) & ((modby)-1)) #define MOD_P2(number,modby) ((number) & ((modby)-1))

View file

@ -69,10 +69,11 @@ InitNetPlayerOptions(void)
// myconnectindex palette // myconnectindex palette
pp->TeamColor = gs.NetColor; pp->TeamColor = gs.NetColor;
if (pp->SpriteP) if (pp->Actor())
{ {
pp->SpriteP->pal = PALETTE_PLAYER0 + pp->TeamColor; auto psp = &pp->Actor()->s();
User[pp->SpriteP - sprite]->spal = pp->SpriteP->pal; psp->pal = PALETTE_PLAYER0 + pp->TeamColor;
pp->Actor()->u()->spal = psp->pal;
} }
} }

View file

@ -5221,7 +5221,7 @@ DoGrating(DSWActor* actor)
// reduce to 0 to 3 value // reduce to 0 to 3 value
dir = sp->ang >> 9; dir = sp->ang >> 9;
if (MOD2(dir) == 0) if ((dir & 1) == 0)
{ {
if (dir == 0) if (dir == 0)
sp->x += 2 * GRATE_FACTOR; sp->x += 2 * GRATE_FACTOR;

View file

@ -4172,7 +4172,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
hit_ang = sp->ang; hit_ang = sp->ang;
hit_x = sp->x; hit_x = sp->x;
hit_y = sp->y; hit_y = sp->y;
hit_z = SPRITEp_TOS(wp) + DIV16(SPRITEp_SIZE_Z(wp)); hit_z = SPRITEp_TOS(wp) + (SPRITEp_SIZE_Z(wp) >> 4);
} }
else else
{ {
@ -4729,7 +4729,7 @@ DoFireballFlames(DSWActor* actor)
if (TEST(ap->extra, SPRX_BURNABLE)) if (TEST(ap->extra, SPRX_BURNABLE))
{ {
if (MOD2(u->Counter2) == 0) if ((u->Counter2 & 1) == 0)
{ {
ap->shade++; ap->shade++;
if (ap->shade > 10) if (ap->shade > 10)