shithub: choc

Download patch

ref: 5871acd3de5a88ea06d18f80a8f1dddc552e993e
parent: b6ea4375e0b5db116a1cdf27e30273d4a92b7a53
author: James Haley <haleyjd@hotmail.com>
date: Mon Aug 30 21:55:51 EDT 2010

Revamped player_t to match binary layout of structure, aside from
enum-determined arrays which will be tackled individually. Removed
player itemcount, secretcount, and didsecret fields. Changed
armorpoints, armortype, and killcount to shorts. Added all runtime
Strife sector types and changed handling of DOOM types where
appropriate. Added nukagecount handling in P_PlayerThink.

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

--- a/src/strife/d_player.h
+++ b/src/strife/d_player.h
@@ -79,10 +79,21 @@
 
 } cheat_t;
 
+// haleyjd 08/30/10: [STRIFE]
+// Player Inventory Item Structure
+typedef struct inventory_s
+{
+    int sprite; // a sprite number
+    int type;   // a thing type
+    int amount; // amount being carried
+} inventory_t;
 
 //
 // Extended player object info: player_t
 //
+// haleyjd 08/30/10: [STRIFE]
+// * Transformed to match binary structure layout.
+//
 typedef struct player_s
 {
     mobj_t*		mo;
@@ -103,14 +114,33 @@
     // This is only used between levels,
     // mo->health is used during levels.
     int			health;	
-    int			armorpoints;
+    short		armorpoints; // [STRIFE] Changed to short
     // Armor type is 0-2.
-    int			armortype;	
+    short		armortype;   // [STRIFE] Changed to short
 
     // Power ups. invinc and invis are tic counters.
     int			powers[NUMPOWERS];
+
+    // [STRIFE] Additions:
+    int			sigiltype;       // Type of Sigil carried
+    int			nukagecount;     // Nukage exposure counter
+    int			questflags;      // Quest bit flags
+    int			pitch;           // Up/down look angle
+    boolean		centerview;      // True if view should be centered
+    inventory_t		inventory[32];   // Player inventory items
+    boolean		st_update;       // If true, update status bar
+    short		numinventory;    // Num. active inventory items
+    short		inventorycursor; // Selected inventory item
+    short		accuracy;        // Accuracy stat
+    short		stamina;         // Stamina stat
+    
     boolean		cards[NUMCARDS];
     boolean		backpack;
+
+    // True if button down last tic.
+    int			attackdown;
+    int			usedown;
+    int			inventorydown;   // [STRIFE] Use inventory item
     
     // Frags, kills of other players.
     int			frags[MAXPLAYERS];
@@ -123,21 +153,17 @@
     int			ammo[NUMAMMO];
     int			maxammo[NUMAMMO];
 
-    // True if button down last tic.
-    int			attackdown;
-    int			usedown;
-
     // Bit flags, for cheats and debug.
     // See cheat_t, above.
-    int			cheats;		
+    int			cheats;
 
     // Refired shots are less accurate.
-    int			refire;		
+    int			refire;
 
      // For intermission stats.
-    int			killcount;
-    int			itemcount;
-    int			secretcount;
+    short		killcount;    // [STRIFE] Changed to short
+    //int		itemcount;    // [STRIFE] Eliminated these.
+    //int		secretcount;
 
     // Hint messages.
     char*		message;	
@@ -160,11 +186,17 @@
     //  0-3 for which color to draw player.
     int			colormap;	
 
+    // [STRIFE] For use of teleport beacons
+    short		allegiance;  
+
     // Overlay view sprites (gun, etc).
     pspdef_t		psprites[NUMPSPRITES];
 
+    // [STRIFE] Inefficient means of tracking automap state on all maps
+    boolean		mapstate[40];
+
     // True if secret level has been done.
-    boolean		didsecret;	
+    //boolean		didsecret;   [STRIFE] Removed this.
 
 } player_t;
 
--- a/src/strife/doomdef.h
+++ b/src/strife/doomdef.h
@@ -90,6 +90,7 @@
 //
 // Key cards.
 //
+// STRIFE-TODO: A hell of a bunch of keys.
 typedef enum
 {
     it_bluecard,
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -1018,13 +1018,9 @@
     int		i; 
     int		frags[MAXPLAYERS]; 
     int		killcount;
-    int		itemcount;
-    int		secretcount; 
 	 
     memcpy (frags,players[player].frags,sizeof(frags)); 
     killcount = players[player].killcount; 
-    itemcount = players[player].itemcount; 
-    secretcount = players[player].secretcount; 
 	 
     p = &players[player]; 
     memset (p, 0, sizeof(*p)); 
@@ -1031,8 +1027,6 @@
  
     memcpy (players[player].frags, frags, sizeof(players[player].frags)); 
     players[player].killcount = killcount; 
-    players[player].itemcount = itemcount; 
-    players[player].secretcount = secretcount; 
  
     p->usedown = p->attackdown = true;	// don't do anything immediately 
     p->playerstate = PST_LIVE;       
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -655,9 +655,10 @@
       default:
 	I_Error ("P_SpecialThing: Unknown gettable thing");
     }
-	
-    if (special->flags & MF_COUNTITEM)
-	player->itemcount++;
+
+    // haleyjd 08/30/10: [STRIFE] No itemcount
+    //if (special->flags & MF_COUNTITEM)
+    //    player->itemcount++;
     P_RemoveMobj (special);
     player->bonuscount += BONUSADD;
     if (player == &players[consoleplayer])
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -91,7 +91,9 @@
 //
 // P_USER
 //
-void	P_PlayerThink (player_t* player);
+void    P_PlayerThink (player_t* player);
+// haleyjd 08/30/10: [STRIFE] Needed externally
+void    P_Thrust (player_t* player, angle_t angle, fixed_t move);
 
 
 //
--- a/src/strife/p_saveg.c
+++ b/src/strife/p_saveg.c
@@ -721,11 +721,13 @@
     // int killcount;
     str->killcount = saveg_read32();
 
+    // haleyjd 08/30/10 [STRIFE] No itemcount.
     // int itemcount;
-    str->itemcount = saveg_read32();
+    //str->itemcount = saveg_read32();
 
+    // haleyjd 08/30/10 [STRIFE] No secretcount.
     // int secretcount;
-    str->secretcount = saveg_read32();
+    //str->secretcount = saveg_read32();
 
     // char* message;
     str->message = saveg_readp();
@@ -754,8 +756,9 @@
         saveg_read_pspdef_t(&str->psprites[i]);
     }
 
+    // haleyjd 08/30/10: [STRIFE] No intermission, no didsecret.
     // boolean didsecret;
-    str->didsecret = saveg_read32();
+    //str->didsecret = saveg_read32();
 }
 
 static void saveg_write_player_t(player_t *str)
@@ -852,11 +855,13 @@
     // int killcount;
     saveg_write32(str->killcount);
 
+    // haleyjd 08/30/10 [STRIFE] No itemcount
     // int itemcount;
-    saveg_write32(str->itemcount);
+    //saveg_write32(str->itemcount);
 
+    // haleyjd 08/30/10 [STRIFE] No secretcount
     // int secretcount;
-    saveg_write32(str->secretcount);
+    //saveg_write32(str->secretcount);
 
     // char* message;
     saveg_writep(str->message);
@@ -885,8 +890,9 @@
         saveg_write_pspdef_t(&str->psprites[i]);
     }
 
+    // haleyjd 08/30/10: [STRIFE] No intermission, no secret.
     // boolean didsecret;
-    saveg_write32(str->didsecret);
+    //saveg_write32(str->didsecret);
 }
 
 
--- a/src/strife/p_setup.c
+++ b/src/strife/p_setup.c
@@ -680,8 +680,8 @@
     wminfo.partime = 180;
     for (i=0 ; i<MAXPLAYERS ; i++)
     {
-	players[i].killcount = players[i].secretcount 
-	    = players[i].itemcount = 0;
+        // haleyjd 08/30/10: [STRIFE] Removed secretcount, itemcount
+	players[i].killcount = 0;
     }
 
     // Initial height of PointOfView
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -1035,64 +1035,86 @@
 void P_PlayerInSpecialSector (player_t* player)
 {
     sector_t*	sector;
-	
+
     sector = player->mo->subsector->sector;
 
     // Falling, not all the way down yet?
     if (player->mo->z != sector->floorheight)
-	return;	
+        return;	
 
     // Has hitten ground.
     switch (sector->special)
     {
-      case 5:
-	// HELLSLIME DAMAGE
-	if (!player->powers[pw_ironfeet])
-	    if (!(leveltime&0x1f))
-		P_DamageMobj (player->mo, NULL, NULL, 10);
-	break;
-	
-      case 7:
-	// NUKAGE DAMAGE
-	if (!player->powers[pw_ironfeet])
-	    if (!(leveltime&0x1f))
-		P_DamageMobj (player->mo, NULL, NULL, 5);
-	break;
-	
-      case 16:
-	// SUPER HELLSLIME DAMAGE
-      case 4:
-	// STROBE HURT
-	if (!player->powers[pw_ironfeet]
-	    || (P_Random()<5) )
-	{
-	    if (!(leveltime&0x1f))
-		P_DamageMobj (player->mo, NULL, NULL, 20);
-	}
-	break;
-			
-      case 9:
-	// SECRET SECTOR
-	player->secretcount++;
-	sector->special = 0;
-	break;
-			
-      case 11:
-	// EXIT SUPER DAMAGE! (for E1M8 finale)
-	player->cheats &= ~CF_GODMODE;
+    case 5:
+        // HELLSLIME DAMAGE
+        // [STRIFE] +2 to nukagecount
+        if(!player->powers[pw_ironfeet])
+            player->nukagecount += 2;
+        break;
+    
+    case 16:
+        // [STRIFE] +4 to nukagecount
+        if(!player->powers[pw_ironfeet])
+            player->nukagecount += 4;
+        break;
 
-	if (!(leveltime&0x1f))
-	    P_DamageMobj (player->mo, NULL, NULL, 20);
+    case 4:
+    case 7:
+        // [STRIFE] Immediate 5 damage every 31 tics
+        if(!player->powers[pw_ironfeet])
+            if(!(leveltime & 0x1f))
+                P_DamageMobj(player->mo, NULL, NULL, 5);
+        break;
 
-	if (player->health <= 10)
-	    G_ExitLevel(0);
-	break;
-			
-      default:
-	I_Error ("P_PlayerInSpecialSector: "
-		 "unknown special %i",
-		 sector->special);
-	break;
+    case 9:
+        // SECRET SECTOR
+        //player->secretcount++; [STRIFE] Don't have a secret count.
+        sector->special = 0;
+        // STRIFE-TODO: sfx_yeah when secret is found
+        //if(player - players == consoleplayer)
+        //    S_StartSound(NULL, sfx_yeah);
+        break;
+
+    case 11:
+        // EXIT SUPER DAMAGE! (for E1M8 finale)
+        player->cheats &= ~CF_GODMODE;
+
+        if (!(leveltime&0x1f))
+            P_DamageMobj (player->mo, NULL, NULL, 20);
+
+        if (player->health <= 10)
+            G_ExitLevel(0);
+        break;
+
+    case 15:
+        // haleyjd 08/30/10: [STRIFE] "Instant" Death sector
+        P_DamageMobj(player->mo, NULL, NULL, 999);
+        break;
+
+
+    case 18:
+        // haleyjd 08/30/10: [STRIFE] Water current
+        // STRIFE-TODO: Verify this works as the ASM is shifty
+        {
+            int tagval = sector->tag - 100;
+            fixed_t force;
+            angle_t angle;
+
+            if(player->cheats & CF_NOCLIP)
+                return;
+
+            force = (tagval % 10) << 12;
+            angle = (tagval / 10) << 29;
+
+            P_Thrust(player, angle, force);
+        }
+        break;
+
+    default:
+        I_Error ("P_PlayerInSpecialSector: "
+                 "unknown special %i",
+                 sector->special);
+        break;
     };
 }
 
--- a/src/strife/p_user.c
+++ b/src/strife/p_user.c
@@ -336,6 +336,18 @@
     
     // Counters, time dependend power ups.
 
+    // haleyjd 08/30/10: [STRIFE]
+    // Nukage count keeps track of exposure to hazardous conditions over time.
+    // After accumulating 16 total seconds or more of exposure, you will take
+    // 5 damage roughly once per second until the count drops back under 560
+    // tics.
+    if (player->nukagecount)
+    {
+        player->nukagecount--;
+        if (!(leveltime & 0x1f) && player->nukagecount > 16*TICRATE)
+            P_DamageMobj(player->mo, NULL, NULL, 5);
+    }
+
     // Strength counts up to diminish fade.
     if (player->powers[pw_strength])
 	player->powers[pw_strength]++;