diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index 2987f06f4..2a173dd34 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -455,8 +455,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso u->MaxHealth = u->Health; - u->PainThreshold = DIV16(u->Health) - 1; - //u->PainThreshold = DIV4(u->Health) - 1; + u->PainThreshold = (u->Health >> 4) - 1; SET(sp->cstat,CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(sp->extra,SPRX_PLAYER_OR_ENEMY); diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 887eea536..030061a8b 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -331,8 +331,7 @@ DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz, view_dist = 0; // make shadow smaller depending on height from ground - ground_dist = labs(loz - SPRITEp_BOS(tsp)) >> 8; - ground_dist = DIV16(ground_dist); + ground_dist = labs(loz - SPRITEp_BOS(tsp)) >> 12; xrepeat = max(xrepeat - ground_dist - view_dist, 4); yrepeat = max(yrepeat - ground_dist - view_dist, 4); diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index d3217033d..ebefb9f00 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -177,7 +177,7 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum) 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, q[next_i].x, q[next_i].y,0x3fffffff, sectnum)) { diff --git a/source/games/sw/src/mytypes.h b/source/games/sw/src/mytypes.h index 0d4a7eac1..f9b6cbb60 100644 --- a/source/games/sw/src/mytypes.h +++ b/source/games/sw/src/mytypes.h @@ -48,15 +48,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define DIV2(x) ((x) >> 1) #define DIV4(x) ((x) >> 2) #define DIV8(x) ((x) >> 3) -#define DIV16(x) ((x) >> 4) -#define DIV32(x) ((x) >> 5) #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 #define MOD_P2(number,modby) ((number) & ((modby)-1)) diff --git a/source/games/sw/src/network.cpp b/source/games/sw/src/network.cpp index ac9592e19..b48b4a328 100644 --- a/source/games/sw/src/network.cpp +++ b/source/games/sw/src/network.cpp @@ -69,10 +69,11 @@ InitNetPlayerOptions(void) // myconnectindex palette pp->TeamColor = gs.NetColor; - if (pp->SpriteP) + if (pp->Actor()) { - pp->SpriteP->pal = PALETTE_PLAYER0 + pp->TeamColor; - User[pp->SpriteP - sprite]->spal = pp->SpriteP->pal; + auto psp = &pp->Actor()->s(); + psp->pal = PALETTE_PLAYER0 + pp->TeamColor; + pp->Actor()->u()->spal = psp->pal; } } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index a5cdcd988..418fb7d73 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -5221,7 +5221,7 @@ DoGrating(DSWActor* actor) // reduce to 0 to 3 value dir = sp->ang >> 9; - if (MOD2(dir) == 0) + if ((dir & 1) == 0) { if (dir == 0) sp->x += 2 * GRATE_FACTOR; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index fc1d4bee9..11ee5befc 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -4172,7 +4172,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i hit_ang = sp->ang; hit_x = sp->x; 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 { @@ -4729,7 +4729,7 @@ DoFireballFlames(DSWActor* actor) if (TEST(ap->extra, SPRX_BURNABLE)) { - if (MOD2(u->Counter2) == 0) + if ((u->Counter2 & 1) == 0) { ap->shade++; if (ap->shade > 10)