From 304a0037773d8dde95ee912b8b7e67f314a7c53e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 16 Jun 2007 16:03:10 +0000 Subject: Use divides instead of bitshifts, for clarity Subversion-branch: /trunk/chocolate-doom Subversion-revision: 910 --- src/g_game.c | 4 ++-- src/p_enemy.c | 12 ++++++------ src/p_inter.c | 6 +++--- src/p_mobj.c | 16 ++++++++-------- src/p_pspr.c | 2 +- src/p_user.c | 2 +- src/r_draw.c | 4 ++-- src/v_video.c | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/g_game.c b/src/g_game.c index 0a2d5862..8d60a5ce 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1605,7 +1605,7 @@ G_InitNew if (fastparm || (skill == sk_nightmare && gameskill != sk_nightmare) ) { for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) - states[i].tics >>= 1; + states[i].tics /= 2; mobjinfo[MT_BRUISERSHOT].speed = 20*FRACUNIT; mobjinfo[MT_HEADSHOT].speed = 20*FRACUNIT; mobjinfo[MT_TROOPSHOT].speed = 20*FRACUNIT; @@ -1613,7 +1613,7 @@ G_InitNew else if (skill != sk_nightmare && gameskill == sk_nightmare) { for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) - states[i].tics <<= 1; + states[i].tics *= 2; mobjinfo[MT_BRUISERSHOT].speed = 15*FRACUNIT; mobjinfo[MT_HEADSHOT].speed = 10*FRACUNIT; mobjinfo[MT_TROOPSHOT].speed = 10*FRACUNIT; diff --git a/src/p_enemy.c b/src/p_enemy.c index 0ed7f60f..66c446df 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -220,7 +220,7 @@ boolean P_CheckMissileRange (mobj_t* actor) if (!actor->info->meleestate) dist -= 128*FRACUNIT; // no melee attack, so fire more - dist >>= 16; + dist /= FRACUNIT; if (actor->type == MT_VILE) { @@ -233,7 +233,7 @@ boolean P_CheckMissileRange (mobj_t* actor) { if (dist < 196) return false; // close for fist attack - dist >>= 1; + dist /= 2; } @@ -241,7 +241,7 @@ boolean P_CheckMissileRange (mobj_t* actor) || actor->type == MT_SPIDER || actor->type == MT_SKULL) { - dist >>= 1; + dist /= 2; } if (dist > 200) @@ -1149,9 +1149,9 @@ boolean PIT_VileCheck (mobj_t* thing) corpsehit = thing; corpsehit->momx = corpsehit->momy = 0; - corpsehit->height <<= 2; + corpsehit->height *= 4; check = P_CheckPosition (corpsehit, corpsehit->x, corpsehit->y); - corpsehit->height >>= 2; + corpsehit->height /= 4; if (!check) return true; // doesn't fit here @@ -1439,7 +1439,7 @@ void A_SkullAttack (mobj_t* actor) if (dist < 1) dist = 1; - actor->momz = (dest->z+(dest->height>>1) - actor->z) / dist; + actor->momz = (dest->z+(dest->height / 2) - actor->z) / dist; } diff --git a/src/p_inter.c b/src/p_inter.c index 484178dd..3d494c4a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -678,7 +678,7 @@ P_KillMobj target->flags &= ~MF_NOGRAVITY; target->flags |= MF_CORPSE|MF_DROPOFF; - target->height >>= 2; + target->height /= 4; if (source && source->player) { @@ -797,7 +797,7 @@ P_DamageMobj player = target->player; if (player && gameskill == sk_baby) - damage >>= 1; // take half damage in trainer mode + damage /= 2; // take half damage in trainer mode // Some close combat weapons should not @@ -814,7 +814,7 @@ P_DamageMobj target->x, target->y); - thrust = damage*(FRACUNIT>>3)*100/target->info->mass; + thrust = damage*(FRACUNIT / 8)*100/target->info->mass; // make fall forwards sometimes if ( damage < 40 diff --git a/src/p_mobj.c b/src/p_mobj.c index 987146d7..6e639811 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -154,8 +154,8 @@ void P_XYMovement (mobj_t* mo) { ptryx = mo->x + xmove/2; ptryy = mo->y + ymove/2; - xmove >>= 1; - ymove >>= 1; + xmove /= 2; + ymove /= 2; } else { @@ -255,7 +255,7 @@ void P_ZMovement (mobj_t* mo) mo->player->viewheight -= mo->floorz-mo->z; mo->player->deltaviewheight - = (VIEWHEIGHT - mo->player->viewheight)>>3; + = (VIEWHEIGHT - mo->player->viewheight) / 8; } // adjust height @@ -271,7 +271,7 @@ void P_ZMovement (mobj_t* mo) dist = P_AproxDistance (mo->x - mo->target->x, mo->y - mo->target->y); - delta =(mo->target->z + (mo->height>>1)) - mo->z; + delta = mo->target->z + (mo->height / 2) - mo->z; if (delta<0 && dist < -(delta*3) ) mo->z -= FLOATSPEED; @@ -326,7 +326,7 @@ void P_ZMovement (mobj_t* mo) // Decrease viewheight for a moment // after hitting the ground (hard), // and utter appropriate sound. - mo->player->deltaviewheight = mo->momz>>3; + mo->player->deltaviewheight = mo->momz / 8; S_StartSound (mo, sfx_oof); } mo->momz = 0; @@ -914,9 +914,9 @@ void P_CheckMissileSpawn (mobj_t* th) // move a little forward so an angle can // be computed if it immediately explodes - th->x += (th->momx>>1); - th->y += (th->momy>>1); - th->z += (th->momz>>1); + th->x += (th->momx / 2); + th->y += (th->momy / 2); + th->z += (th->momz / 2); if (!P_TryMove (th, th->x, th->y)) P_ExplodeMissile (th); diff --git a/src/p_pspr.c b/src/p_pspr.c index fe32c53f..fde21ecf 100644 --- a/src/p_pspr.c +++ b/src/p_pspr.c @@ -816,7 +816,7 @@ void A_BFGSpray (mobj_t* mo) P_SpawnMobj (linetarget->x, linetarget->y, - linetarget->z + (linetarget->height>>2), + linetarget->z + (linetarget->height / 4), MT_EXTRABFG); damage = 0; diff --git a/src/p_user.c b/src/p_user.c index 2ff7f818..70f53031 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -90,7 +90,7 @@ void P_CalcHeight (player_t* player) FixedMul (player->mo->momx, player->mo->momx) + FixedMul (player->mo->momy,player->mo->momy); - player->bob >>= 2; + player->bob /= 4; if (player->bob>MAXBOB) player->bob = MAXBOB; diff --git a/src/r_draw.c b/src/r_draw.c index 6813ea59..30e27715 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -777,7 +777,7 @@ R_InitBuffer // Handle resize, // e.g. smaller view windows // with border and/or status bar. - viewwindowx = (SCREENWIDTH-width) >> 1; + viewwindowx = (SCREENWIDTH-width) / 2; // Column offset. For windows. for (i=0 ; i> 1; + viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) / 2; // Preclaculate all row offsets. for (i=0 ; iwidth), SHORT(patch->height)); - desttop = destscreen + y*SCREENWIDTH/4 + (x>>2); + desttop = destscreen + (y*SCREENWIDTH + x) / 4; w = SHORT(patch->width); for ( col = 0 ; col