shithub: choc

Download patch

ref: 304a0037773d8dde95ee912b8b7e67f314a7c53e
parent: a9feab0830ecdf0b3e52e9339522918e3f12226f
author: Simon Howard <fraggle@gmail.com>
date: Sat Jun 16 12:03:10 EDT 2007

Use divides instead of bitshifts, for clarity

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 910

--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1605,7 +1605,7 @@
     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 @@
     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; 
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -220,7 +220,7 @@
     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 @@
     {
 	if (dist < 196)	
 	    return false;	// close for fist attack
-	dist >>= 1;
+	dist /= 2;
     }
 	
 
@@ -241,7 +241,7 @@
 	|| actor->type == MT_SPIDER
 	|| actor->type == MT_SKULL)
     {
-	dist >>= 1;
+	dist /= 2;
     }
     
     if (dist > 200)
@@ -1149,9 +1149,9 @@
 		
     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 @@
     
     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;
 }
 
 
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -678,7 +678,7 @@
 	target->flags &= ~MF_NOGRAVITY;
 
     target->flags |= MF_CORPSE|MF_DROPOFF;
-    target->height >>= 2;
+    target->height /= 4;
 
     if (source && source->player)
     {
@@ -797,7 +797,7 @@
 	
     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 @@
 				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
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -154,8 +154,8 @@
 	{
 	    ptryx = mo->x + xmove/2;
 	    ptryy = mo->y + ymove/2;
-	    xmove >>= 1;
-	    ymove >>= 1;
+	    xmove /= 2;
+	    ymove /= 2;
 	}
 	else
 	{
@@ -255,7 +255,7 @@
 	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 @@
 	    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 @@
 		// 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 @@
     
     // 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);
--- a/src/p_pspr.c
+++ b/src/p_pspr.c
@@ -816,7 +816,7 @@
 
 	P_SpawnMobj (linetarget->x,
 		     linetarget->y,
-		     linetarget->z + (linetarget->height>>2),
+		     linetarget->z + (linetarget->height / 4),
 		     MT_EXTRABFG);
 	
 	damage = 0;
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -90,7 +90,7 @@
 	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;
--- a/src/r_draw.c
+++ b/src/r_draw.c
@@ -777,7 +777,7 @@
     // 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<width ; i++) 
@@ -787,7 +787,7 @@
     if (width == SCREENWIDTH) 
 	viewwindowy = 0; 
     else 
-	viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) >> 1; 
+	viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) / 2;
 
     // Preclaculate all row offsets.
     for (i=0 ; i<height ; i++) 
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -364,7 +364,7 @@
 #endif 
  
     //	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 
-    desttop = destscreen + y*SCREENWIDTH/4 + (x>>2); 
+    desttop = destscreen + (y*SCREENWIDTH + x) / 4;
 	 
     w = SHORT(patch->width); 
     for ( col = 0 ; col<w ; col++)