shithub: choc

Download patch

ref: 27b9738390004186f66c2e955fe7ac8c8b296127
parent: ed6191430b27a5447ef2675f2cfe19d8f0b88333
author: Simon Howard <fraggle@gmail.com>
date: Thu Jun 21 18:00:38 EDT 2007

Revert previous change from bitshifts to divides; this causes demo
desyncs.

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

--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1638,7 +1638,7 @@
     if (fastparm || (skill == sk_nightmare && gameskill != sk_nightmare) )
     { 
 	for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) 
-	    states[i].tics /= 2;
+	    states[i].tics >>= 1; 
 	mobjinfo[MT_BRUISERSHOT].speed = 20*FRACUNIT; 
 	mobjinfo[MT_HEADSHOT].speed = 20*FRACUNIT; 
 	mobjinfo[MT_TROOPSHOT].speed = 20*FRACUNIT; 
@@ -1646,7 +1646,7 @@
     else if (skill != sk_nightmare && gameskill == sk_nightmare) 
     { 
 	for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) 
-	    states[i].tics *= 2;
+	    states[i].tics <<= 1; 
 	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 /= FRACUNIT;
+    dist >>= 16;
 
     if (actor->type == MT_VILE)
     {
@@ -233,7 +233,7 @@
     {
 	if (dist < 196)	
 	    return false;	// close for fist attack
-	dist /= 2;
+	dist >>= 1;
     }
 	
 
@@ -241,7 +241,7 @@
 	|| actor->type == MT_SPIDER
 	|| actor->type == MT_SKULL)
     {
-	dist /= 2;
+	dist >>= 1;
     }
     
     if (dist > 200)
@@ -1149,9 +1149,9 @@
 		
     corpsehit = thing;
     corpsehit->momx = corpsehit->momy = 0;
-    corpsehit->height *= 4;
+    corpsehit->height <<= 2;
     check = P_CheckPosition (corpsehit, corpsehit->x, corpsehit->y);
-    corpsehit->height /= 4;
+    corpsehit->height >>= 2;
 
     if (!check)
 	return true;		// doesn't fit here
@@ -1439,7 +1439,7 @@
     
     if (dist < 1)
 	dist = 1;
-    actor->momz = (dest->z+(dest->height / 2) - actor->z) / dist;
+    actor->momz = (dest->z+(dest->height>>1) - 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 /= 4;
+    target->height >>= 2;
 
     if (source && source->player)
     {
@@ -797,7 +797,7 @@
 	
     player = target->player;
     if (player && gameskill == sk_baby)
-	damage /= 2; 	// take half damage in trainer mode
+	damage >>= 1; 	// take half damage in trainer mode
 		
 
     // Some close combat weapons should not
@@ -814,7 +814,7 @@
 				target->x,
 				target->y);
 		
-	thrust = damage*(FRACUNIT / 8)*100/target->info->mass;
+	thrust = damage*(FRACUNIT>>3)*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 /= 2;
-	    ymove /= 2;
+	    xmove >>= 1;
+	    ymove >>= 1;
 	}
 	else
 	{
@@ -255,7 +255,7 @@
 	mo->player->viewheight -= mo->floorz-mo->z;
 
 	mo->player->deltaviewheight
-	    = (VIEWHEIGHT - mo->player->viewheight) / 8;
+	    = (VIEWHEIGHT - mo->player->viewheight)>>3;
     }
     
     // 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 / 2) - mo->z;
+	    delta =(mo->target->z + (mo->height>>1)) - 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 / 8;
+		mo->player->deltaviewheight = mo->momz>>3;
 		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 / 2);
-    th->y += (th->momy / 2);
-    th->z += (th->momz / 2);
+    th->x += (th->momx>>1);
+    th->y += (th->momy>>1);
+    th->z += (th->momz>>1);
 
     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 / 4),
+		     linetarget->z + (linetarget->height>>2),
 		     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 /= 4;
+    player->bob >>= 2;
 
     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) / 2;
+    viewwindowx = (SCREENWIDTH-width) >> 1; 
 
     // Column offset. For windows.
     for (i=0 ; i<width ; i++) 
@@ -787,7 +787,7 @@
     if (width == SCREENWIDTH) 
 	viewwindowy = 0; 
     else 
-	viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) / 2;
+	viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) >> 1; 
 
     // 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 + x) / 4;
+    desttop = destscreen + y*SCREENWIDTH/4 + (x>>2); 
 	 
     w = SHORT(patch->width); 
     for ( col = 0 ; col<w ; col++)