foxygit / doom Log in
commit 27b9738390004186f66c2e955fe7ac8c8b296127
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Jun 21 22:00:38 2007 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu Jun 21 22:00:38 2007 +0000

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

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 923
---
 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(-)

diff --git a/src/g_game.c b/src/g_game.c
index 46337443..9ef99408 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1638,7 +1638,7 @@ G_InitNew
     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 @@ G_InitNew
     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;
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 66c446df..0ed7f60f 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 /= FRACUNIT;
+    dist >>= 16;

     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 /= 2;
+	dist >>= 1;
     }


@@ -241,7 +241,7 @@ boolean P_CheckMissileRange (mobj_t* actor)
 	|| actor->type == MT_SPIDER
 	|| actor->type == MT_SKULL)
     {
-	dist /= 2;
+	dist >>= 1;
     }

     if (dist > 200)
@@ -1149,9 +1149,9 @@ boolean PIT_VileCheck (mobj_t*	thing)

     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 @@ void A_SkullAttack (mobj_t* actor)

     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;
 }


diff --git a/src/p_inter.c b/src/p_inter.c
index 3d494c4a..484178dd 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 /= 4;
+    target->height >>= 2;

     if (source && source->player)
     {
@@ -797,7 +797,7 @@ P_DamageMobj

     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 @@ P_DamageMobj
 				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
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 6e639811..987146d7 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 /= 2;
-	    ymove /= 2;
+	    xmove >>= 1;
+	    ymove >>= 1;
 	}
 	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) / 8;
+	    = (VIEWHEIGHT - mo->player->viewheight)>>3;
     }

     // 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 / 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 @@ 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 / 8;
+		mo->player->deltaviewheight = mo->momz>>3;
 		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 / 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);
diff --git a/src/p_pspr.c b/src/p_pspr.c
index fde21ecf..fe32c53f 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 / 4),
+		     linetarget->z + (linetarget->height>>2),
 		     MT_EXTRABFG);

 	damage = 0;
diff --git a/src/p_user.c b/src/p_user.c
index 70f53031..2ff7f818 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 /= 4;
+    player->bob >>= 2;

     if (player->bob>MAXBOB)
 	player->bob = MAXBOB;
diff --git a/src/r_draw.c b/src/r_draw.c
index 30e27715..6813ea59 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) / 2;
+    viewwindowx = (SCREENWIDTH-width) >> 1;

     // Column offset. For windows.
     for (i=0 ; i<width ; i++)
@@ -787,7 +787,7 @@ R_InitBuffer
     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++)
diff --git a/src/v_video.c b/src/v_video.c
index 63155862..84882186 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -364,7 +364,7 @@ V_DrawPatchDirect
 #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++)