shithub: choc

Download patch

ref: 1b7d9ea6f72b2fdaae747f0d453b8bca214fa255
parent: 08660bbbd6d78a8c9cb2323f2db890ba8aae0557
author: James Haley <haleyjd@hotmail.com>
date: Fri Feb 25 10:12:13 EST 2011

Found the last difference causing the IWAD to desync - players
experience a small amount of friction while falling (65520/65536). Also
added all cheat codes.

Subversion-branch: /branches/strife-branch
Subversion-revision: 2278

--- a/src/strife/d_englsh.h
+++ b/src/strife/d_englsh.h
@@ -242,16 +242,16 @@
 
 #define STSTR_MUS               "Music Change"
 #define STSTR_NOMUS             "IMPOSSIBLE SELECTION"
-#define STSTR_DQDON             "You're invincible!"   // [STRIFE]
+#define STSTR_DQDON             "You're Invincible!"   // [STRIFE]
 #define STSTR_DQDOFF            "You're a looney!"     // [STRIFE]
 
 #define STSTR_KFAADDED          "Very Happy Ammo Added"
-#define STSTR_FAADDED           "Ammo (no keys) Added"
+#define STSTR_FAADDED           "Ammo Added"           // [STRIFE]
 
 #define STSTR_NCON              "No Clipping Mode ON"
 #define STSTR_NCOFF             "No Clipping Mode OFF"
 
-#define STSTR_BEHOLD            "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp"
+#define STSTR_BEHOLD            "Bzrk, Inviso, Mask, Health, Pack, Stats"  // [STRIFE]
 #define STSTR_BEHOLDX           "Power-up Toggled"
 
 #define STSTR_CHOPPERS          "... doesn't suck - GM"
--- a/src/strife/deh_cheat.c
+++ b/src/strife/deh_cheat.c
@@ -43,23 +43,25 @@
 
 static deh_cheat_t allcheats[] =
 {
+    // haleyjd 20110224: filled in all cheats
     {"Change music",        &cheat_mus },
     {"Level Warp",          &cheat_clev },
-    {"Stealth Boots",       NULL }, // STRIFE-TODO
-    {"Sigil piece",         NULL }, // STRIFE-TODO
-    {"FPS",                 NULL }, // STRIFE-TODO
-    {"TeleportMapSpot",     NULL }, // STRIFE-TODO
-    {"Gold&StatTokens",     NULL }, // STRIFE-TODO
+    {"Stealth Boots",       &cheat_stealth },
+    {"Sigil piece",         &cheat_lego },
+    {"FPS",                 &cheat_mypos },
+    {"TeleportMapSpot",     &cheat_scoot },
+    {"Gold&StatTokens",     &cheat_midas },
     {"God mode",            &cheat_god },
-    {"Keys",                NULL }, // STRIFE-TODO
-    {"Weapons & Ammo",      NULL }, // STRIFE-TODO
-    {"Massacre",            NULL }, // STRIFE-TODO
+    {"Keys",                &cheat_keys },
+    {"Weapons & Ammo",      &cheat_ammo },
+    {"Massacre",            &cheat_nuke },
     {"No Clipping",         &cheat_noclip },
-    {"Berserk",             &cheat_powerup[1] },
-    {"Invisibility",        &cheat_powerup[2] },
-    {"Enviro Suit",         &cheat_powerup[3] },
-    {"Health",              NULL }, // STRIFE-TODO
-    {"Backpack",            NULL }, // STRIFE-TODO
+    {"Berserk",             &cheat_powerup[0] },
+    {"Invisibility",        &cheat_powerup[1] },
+    {"Enviro Suit",         &cheat_powerup[2] },
+    {"Health",              &cheat_powerup[3] },
+    {"Backpack",            &cheat_powerup[4] },
+    // STRIFE-FIXME/TODO: Does SeHackEd not support PUMPUP{S,T,nil}, or "DOTS" ?
 };
 
 static deh_cheat_t *FindCheatByName(char *name)
@@ -122,10 +124,10 @@
             break;
         }
 
-	if (deh_apply_cheats)
-	{
-	    cheat->seq->sequence[i] = unsvalue[i];
-	}
+        if (deh_apply_cheats)
+        {
+            cheat->seq->sequence[i] = unsvalue[i];
+        }
         ++i;
 
         // Absolute limit - don't exceed
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -263,12 +263,12 @@
         // villsa [STRIFE] include jumpover flag
         if ( ld->flags & ML_BLOCKING &&
             (!(ld->flags & ML_JUMPOVER) || tmfloorz + (32*FRACUNIT) > tmthing->z) )
-            return false;	// explicitly blocking everything
+            return false;   // explicitly blocking everything
 
         // villsa [STRIFE] exclude floaters from blockmonster lines
         if ( !tmthing->player && (ld->flags & ML_BLOCKMONSTERS) &&
             !(tmthing->flags & MF_FLOAT))
-            return false;	// block monsters only
+            return false;   // block monsters only
 
         // villsa [STRIFE]
         if ( ld->flags & ML_BLOCKFLOATERS && tmthing->flags & MF_FLOAT )
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -115,9 +115,11 @@
 // * No SKULLFLY logic (replaced by BOUNCE flag)
 // * Missiles can activate G1/GR line types
 // * Player walking logic
+// * Air friction for players
 //
 #define STOPSPEED       0x1000
 #define FRICTION        0xe800
+#define AIRFRICTION     0xfff0  // [STRIFE]
 
 void P_XYMovement (mobj_t* mo) 
 {
@@ -202,7 +204,7 @@
                 if(blockingline && blockingline->special)
                     P_ShootSpecialLine(mo, blockingline);
                 if(numspechit)
-                    P_ShootSpecialLine(mo, spechit[numspechit]);
+                    P_ShootSpecialLine(mo, spechit[numspechit-1]);
 
                 // explode a missile
                 if (ceilingline &&
@@ -234,8 +236,18 @@
     if (mo->flags & (MF_MISSILE | MF_BOUNCE) )
         return;     // no friction for missiles ever
 
+    // haleyjd 20110224: [STRIFE] players experience friction even in the air,
+    // although less than when on the ground. With this fix, the 1.2-and-up 
+    // IWAD demo is now in sync!
     if (mo->z > mo->floorz)
+    {
+        if(player)
+        {
+            mo->momx = FixedMul (mo->momx, AIRFRICTION);
+            mo->momy = FixedMul (mo->momy, AIRFRICTION);
+        }
         return;     // no friction when airborne
+    }
 
     if (mo->flags & MF_CORPSE)
     {
@@ -260,7 +272,7 @@
                 && player->cmd.sidemove == 0 ) ) )
     {
         // if in a walking frame, stop moving
-        // villsa [STRIFE]: different player state (haleyjd - verified 02/02/11)
+        // villsa [STRIFE]: different player state (haleyjd - verified 20110202)
         if ( player&&(unsigned)((player->mo->state - states) - S_PLAY_01) < 4)
             P_SetMobjState (player->mo, S_PLAY_00);
 
@@ -305,7 +317,6 @@
             mo->ceilingz = mo->height + mo->z;
         else
             mo->floorz = mo->z;
-
     }
 
     //mo->z += mo->momz; // villsa [STRIFE] unused
@@ -327,7 +338,6 @@
             else if (delta>0 && dist < (delta*3) )
                 mo->z += FLOATSPEED;
         }
-
     }
     
     // clip movement
@@ -386,13 +396,13 @@
                 mo->player->deltaviewheight = mo->momz>>3;
 
                 // villsa [STRIFE] fall damage
+                // haleyjd 09/18/10: Repaired calculation
                 if(mo->momz < -20*FRACUNIT)
-                {
-                    // haleyjd 09/18/10: Repaired calculation
                     P_DamageMobj(mo, NULL, mo, mo->momz / -25000);
-                    mo->player->centerview = 1;
-                }
 
+                // haleyjd 20110224: *Any* fall centers your view, not just
+                // damaging falls (moved outside the above if).
+                mo->player->centerview = 1;
                 S_StartSound (mo, sfx_oof);
             }
             mo->momz = 0;
@@ -417,46 +427,45 @@
             && !(mo->flags & (MF_NOCLIP|MF_BOUNCE)) )
         {
             P_ExplodeMissile (mo);
-            return;
         }
     }
-    else if (! (mo->flags & MF_NOGRAVITY) )
+    else // haleyjd 20110224: else here, not else if - Strife change or what?
     {
-        if (mo->momz == 0)
-            mo->momz = -GRAVITY*2;
-        else
-            mo->momz -= GRAVITY;
-    }
-
-    if (mo->z + mo->height > mo->ceilingz)
-    {
-        // villsa [STRIFE] replace skullfly flag with MF_BOUNCE
-        if (mo->flags & MF_BOUNCE)
+        if (! (mo->flags & MF_NOGRAVITY) )
         {
-            // villsa [STRIFE] affect reactiontime
-            // momz is also shifted by 1
-            mo->momz = -mo->momz >> 1;
-            mo->reactiontime >>= 1;
+            if (mo->momz == 0)
+                mo->momz = -GRAVITY*2;
+            else
+                mo->momz -= GRAVITY;
         }
 
-        // hit the ceiling
-        if (mo->momz > 0)
-            mo->momz = 0;
+        if (mo->z + mo->height > mo->ceilingz)
         {
-            mo->z = mo->ceilingz - mo->height;
-        }
+            // villsa [STRIFE] replace skullfly flag with MF_BOUNCE
+            if (mo->flags & MF_BOUNCE)
+            {
+                // villsa [STRIFE] affect reactiontime
+                // momz is also shifted by 1
+                mo->momz = -mo->momz >> 1;
+                mo->reactiontime >>= 1;
+            }
 
-        // villsa [STRIFE] also check for MF_BOUNCE
-        if ( (mo->flags & MF_MISSILE)
-            && !(mo->flags & (MF_NOCLIP|MF_BOUNCE)) )
-        {
-            // villsa [STRIFE] check against skies
-            if(mo->subsector->sector->ceilingpic == skyflatnum)
-                P_RemoveMobj(mo);
-            else
-                P_ExplodeMissile (mo);
+            // hit the ceiling
+            if (mo->momz > 0)
+                mo->momz = 0;
 
-            return;
+            mo->z = mo->ceilingz - mo->height;
+
+            // villsa [STRIFE] also check for MF_BOUNCE
+            if ( (mo->flags & MF_MISSILE)
+                && !(mo->flags & (MF_NOCLIP|MF_BOUNCE)) )
+            {
+                // villsa [STRIFE] check against skies
+                if(mo->subsector->sector->ceilingpic == skyflatnum)
+                    P_RemoveMobj(mo);
+                else
+                    P_ExplodeMissile (mo);
+            }
         }
     }
 } 
--- a/src/strife/st_stuff.c
+++ b/src/strife/st_stuff.c
@@ -248,8 +248,7 @@
 
 cheatseq_t cheat_mus        = CHEAT("spin", 2);         // [STRIFE]: idmus -> spin
 cheatseq_t cheat_god        = CHEAT("omnipotent", 0);   // [STRIFE]: iddqd -> omnipotent
-cheatseq_t cheat_ammo       = CHEAT("idkfa", 0);        // STRIFE-TODO
-cheatseq_t cheat_ammonokey  = CHEAT("idfa", 0);         // STRIFE-TODO
+cheatseq_t cheat_ammo       = CHEAT("boomstix", 0);     // [STRIFE]: idfa -> boomstix
 cheatseq_t cheat_noclip     = CHEAT("elvis", 0);        // [STRIFE]: idclip -> elvis
 cheatseq_t cheat_clev       = CHEAT("rift", 2);         // [STRIFE]: idclev -> rift
 cheatseq_t cheat_mypos      = CHEAT("gps", 0);          // [STRIFE]: idmypos -> gps
@@ -259,18 +258,34 @@
 cheatseq_t cheat_stealth    = CHEAT("gripper", 0);      // [STRIFE]: new cheat gripper
 cheatseq_t cheat_midas      = CHEAT("donnytrump", 0);   // [STRIFE]: new cheat
 cheatseq_t cheat_lego       = CHEAT("lego", 0);         // [STRIFE]: new cheat
+cheatseq_t cheat_dev        = CHEAT("dots", 0);         // [STRIFE]: new cheat
 
-cheatseq_t cheat_powerup[7] = // STRIFE-TODO
+// haleyjd 20110224: enumeration for access to powerup cheats
+enum
 {
-    CHEAT("idbeholdv", 0),
-    CHEAT("idbeholds", 0),
-    CHEAT("idbeholdi", 0),
-    CHEAT("idbeholdr", 0),
-    CHEAT("idbeholda", 0),
-    CHEAT("idbeholdl", 0),
-    CHEAT("idbehold", 0),
+    ST_PUMPUP_B,
+    ST_PUMPUP_I,
+    ST_PUMPUP_M,
+    ST_PUMPUP_H,
+    ST_PUMPUP_P,
+    ST_PUMPUP_S,
+    ST_PUMPUP_T,
+    ST_PUMPUP,
+    NUM_ST_PUMPUP
 };
 
+cheatseq_t cheat_powerup[NUM_ST_PUMPUP] = // [STRIFE]
+{
+    CHEAT("pumpupb", 0),
+    CHEAT("pumpupi", 0),
+    CHEAT("pumpupm", 0),
+    CHEAT("pumpuph", 0),
+    CHEAT("pumpupp", 0),
+    CHEAT("pumpups", 0),
+    CHEAT("pumpupt", 0),
+    CHEAT("pumpup", 0),
+};
+
 //cheatseq_t cheat_choppers = CHEAT("idchoppers", 0); [STRIFE] no such thing
 
 void M_SizeDisplay(int choice); // villsa [STRIFE]
@@ -481,8 +496,7 @@
         else
             S_ChangeMusic(musnum, 1);
     }
-    /*
-    // STRIFE-TODO: "dev" cheat - is this the "DOTS" cheat?
+    // [STRIFE]: "dev" cheat - "DOTS"
     else if (cht_CheckCheat(&cheat_dev, ev->data2))
     {
         devparm = !devparm;
@@ -491,7 +505,6 @@
         else
             plyr->message = DEH_String("devparm OFF");
     }
-    */
 
     // [STRIFE] Cheats below are not allowed in netgames or demos
     if(netgame || !usergame)
@@ -511,46 +524,32 @@
             plyr->message = DEH_String(STSTR_DQDON);
         }
         else 
+        {
+            plyr->st_update = true;
             plyr->message = DEH_String(STSTR_DQDOFF);
+        }
     }
-    //
-    // STRIFE-TODO: IDFA, IDKFA equivs are unfinished
-    //
-    else if (cht_CheckCheat(&cheat_ammonokey, ev->data2))
-    {
-        // 'fa' cheat for killer fucking arsenal
-        plyr->armorpoints = deh_idfa_armor;
-        plyr->armortype = deh_idfa_armor_class;
-
-        for (i=0;i<NUMWEAPONS;i++)
-            plyr->weaponowned[i] = true;
-
-        for (i=0;i<NUMAMMO;i++)
-            plyr->ammo[i] = plyr->maxammo[i];
-
-        plyr->message = DEH_String(STSTR_FAADDED);
-    }
     else if (cht_CheckCheat(&cheat_ammo, ev->data2))
     {
-        // 'kfa' cheat for key full ammo
+        // [STRIFE]: "BOOMSTIX" cheat for all normal weapons
         plyr->armorpoints = deh_idkfa_armor;
         plyr->armortype = deh_idkfa_armor_class;
 
-        for (i=0;i<NUMWEAPONS;i++)
-            plyr->weaponowned[i] = true;
+        for (i = 0; i < NUMWEAPONS; i++)
+            if(!isdemoversion || weaponinfo[i].availabledemo)
+                plyr->weaponowned[i] = true;
+        
+        // Takes away the Sigil, even if you already had it...
+        plyr->weaponowned[wp_sigil] = false;
 
         for (i=0;i<NUMAMMO;i++)
             plyr->ammo[i] = plyr->maxammo[i];
 
-        for (i=0;i<NUMCARDS;i++)
-            plyr->cards[i] = true;
-
-        plyr->message = DEH_String(STSTR_KFAADDED);
+        plyr->message = DEH_String(STSTR_FAADDED);
     }
-
-    // villsa [STRIFE]
     else if(cht_CheckCheat(&cheat_keys, ev->data2))
     {
+        // villsa [STRIFE]: "JIMMY" cheat for all keys
         #define FIRSTKEYSETAMOUNT   16
 
         if(plyr->cards[FIRSTKEYSETAMOUNT - 1])
@@ -596,10 +595,9 @@
             plyr->mo->flags &= ~MF_NOCLIP;
         }
     }
-    
-    // villsa [STRIFE]
     else if(cht_CheckCheat(&cheat_stealth, ev->data2))
     {
+        // villsa [STRIFE]: "GRIPPER" cheat; nothing to do with stealth...
         plyr->cheats ^= CF_NOMOMENTUM;
         if(plyr->cheats & CF_NOMOMENTUM)
             plyr->message = DEH_String("STEALTH BOOTS ON");
@@ -607,75 +605,65 @@
             plyr->message = DEH_String("STEALTH BOOTS OFF");
     }
     
-
-    //
-    // STRIFE-TODO: Fix idbehold equivalent
-    //
-    for (i=0;i<6;i++)
+    for(i = 0; i < ST_PUMPUP_B + 3; ++i)
     {
-        // 'behold?' power-up cheats
-        if (cht_CheckCheat(&cheat_powerup[i], ev->data2))
+        // [STRIFE]: Handle berserk, invisibility, and envirosuit
+        if(cht_CheckCheat(&cheat_powerup[i], ev->data2))
         {
-            if (!plyr->powers[i])
-                P_GivePower( plyr, i);
-            else if (i!=pw_strength)
-                plyr->powers[i] = 1;
+            if(plyr->powers[i])
+                plyr->powers[i] = (i != 1);
             else
-                plyr->powers[i] = 0;
-
+                P_GivePower(plyr, i);
             plyr->message = DEH_String(STSTR_BEHOLDX);
         }
     }
-    // STRIFE-TODO:
-    if (cht_CheckCheat(&cheat_powerup[6], ev->data2))
+    if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_H], ev->data2))
     {
-        // 'behold' power-up menu
-        plyr->message = DEH_String(STSTR_BEHOLD);
-    }
-    
-    //
-    // STRIFE-TODO: 
-    // * Give medical items cheat (what code???)
-    // * Ammo cheat
-    // * Stats cheat
-    // * Unknown power-giving cheat
-    /*
-    if(cht_CheckCheat(&cheat_meditems, ev->data2))
-    {
+        // [STRIFE]: PUMPUPH gives medical inventory items
         P_GiveItemToPlayer(plyr, SPR_STMP, MT_INV_MED1);
         P_GiveItemToPlayer(plyr, SPR_MDKT, MT_INV_MED2);
         P_GiveItemToPlayer(plyr, SPR_FULL, MT_INV_MED3);
         plyr->message = DEH_String("you got the stuff!");
     }
-    if (cht_CheckCheat(&off_885E4, ev->data2))
+    if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_P], ev->data2))
     {
+        // [STRIFE]: PUMPUPP gives backpack
         if(!plyr->backpack)
         {
-            for(i = 0; i < NUMAMMO; i++)
+            for(i = 0; i < NUMAMMO; ++i)
                 plyr->maxammo[i] = 2 * plyr->maxammo[i];
-            plyr->backpack = true;
         }
-        for(i = 0; i < NUMAMMO; i++)
+        plyr->backpack = true;
+
+        for(i = 0; i < NUMAMMO; ++i)
             P_GiveAmmo(plyr, i, 1);
         plyr->message = DEH_String("you got the stuff!");
     }
-    if(cht_CheckCheat(&cheat_stats, ev->data2))
+    if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_S], ev->data2))
     {
+        // [STRIFE]: PUMPUPS gives stamina and accuracy upgrades
         P_GiveItemToPlayer(plyr, SPR_TOKN, MT_TOKEN_STAMINA);
         P_GiveItemToPlayer(plyr, SPR_TOKN, MT_TOKEN_NEW_ACCURACY);
         plyr->message = DEH_String("you got the stuff!");
     }
-    //
-    // UNKNOWN POWER GIVING CHEAT HERE...
-    //
-    */
-   
-    // STRIFE-TODO: weird isdemoversion check
+    if(cht_CheckCheat(&cheat_powerup[ST_PUMPUP_T], ev->data2))
+    {
+        // [STRIFE] PUMPUPT gives targeter
+        P_GivePower(plyr, pw_targeter);
+        plyr->message = DEH_String("you got the stuff!");
+    }
+    // [STRIFE]: PUMPUP
+    if (cht_CheckCheat(&cheat_powerup[ST_PUMPUP], ev->data2))
+    {
+        // 'behold' power-up menu
+        plyr->message = DEH_String(STSTR_BEHOLD);
+        return false;
+    }
 
     if (cht_CheckCheat(&cheat_mypos, ev->data2))
     {
         // [STRIFE] 'GPS' for player position
-        static char	buf[ST_MSGWIDTH];
+        static char buf[ST_MSGWIDTH];
         sprintf(buf, "ang=0x%x;x,y=(0x%x,0x%x)",
                 players[consoleplayer].mo->angle,
                 players[consoleplayer].mo->x,
@@ -682,7 +670,6 @@
                 players[consoleplayer].mo->y);
         plyr->message = buf;
     }
-    
 
     // 'rift' change-level cheat
     if (cht_CheckCheat(&cheat_clev, ev->data2))
@@ -697,6 +684,7 @@
         // haleyjd 09/01/10: Removed Chex Quest stuff.
         // haleyjd 09/15/10: Removed retail/registered/shareware stuff
 
+        // STRIFE-TODO: different bounds in v1.31
         // Ohmygod - this is not going to work.
         if (map <= 0 || map > 40)
             return false;
@@ -719,6 +707,7 @@
         {
             plyr->message = DEH_String("Spawning to spot");
             G_RiftCheat(spot);
+            return false;
         }
     }
 
@@ -727,6 +716,7 @@
     {
         stonecold ^= 1;
         plyr->message = DEH_String("Kill 'em.  Kill 'em All");
+        return false;
     }
 
     // villsa [STRIFE]
@@ -737,7 +727,8 @@
     }
 
     // villsa [STRIFE] 
-    if(cht_CheckCheat(&cheat_lego, ev->data2))
+    // haleyjd 20110224: No sigil in demo version
+    if(!isdemoversion && cht_CheckCheat(&cheat_lego, ev->data2))
     {
         plyr->st_update = true;
         if(plyr->weaponowned[wp_sigil])
--- a/src/strife/st_stuff.h
+++ b/src/strife/st_stuff.h
@@ -88,16 +88,22 @@
 boolean ST_Responder(event_t* ev);
 
 extern byte *st_backing_screen;
-extern cheatseq_t cheat_mus;
-extern cheatseq_t cheat_god;
-extern cheatseq_t cheat_ammo;
-extern cheatseq_t cheat_ammonokey;
-extern cheatseq_t cheat_noclip;
-extern cheatseq_t cheat_commercial_noclip;
-extern cheatseq_t cheat_powerup[7];
-extern cheatseq_t cheat_choppers;
-extern cheatseq_t cheat_clev;
-extern cheatseq_t cheat_mypos;
+
+extern cheatseq_t cheat_mus;     // [STRIFE]: idmus -> spin
+extern cheatseq_t cheat_god;     // [STRIFE]: iddqd -> omnipotent
+extern cheatseq_t cheat_ammo;    // [STRIFE]: idfa -> boomstix
+extern cheatseq_t cheat_noclip;  // [STRIFE]: idclip -> elvis
+extern cheatseq_t cheat_clev;    // [STRIFE]: idclev -> rift
+extern cheatseq_t cheat_mypos;   // [STRIFE]: idmypos -> gps
+extern cheatseq_t cheat_scoot;   // [STRIFE]: new cheat scoot
+extern cheatseq_t cheat_nuke;    // [STRIFE]: new cheat stonecold
+extern cheatseq_t cheat_keys;    // [STRIFE]: new cheat jimmy (all keys)
+extern cheatseq_t cheat_stealth; // [STRIFE]: new cheat gripper
+extern cheatseq_t cheat_midas;   // [STRIFE]: new cheat
+extern cheatseq_t cheat_lego;    // [STRIFE]: new cheat
+extern cheatseq_t cheat_dev;     // [STRIFE]: new cheat
+
+extern cheatseq_t cheat_powerup[];
 
 
 #endif