shithub: choc

Download patch

ref: 0e024ec2a2f064f8c76c6df71d107840198988de
parent: 924bdbaa9a8f8af8c0da5cb7a50c1ee6b20db561
author: Samuel Villareal <[email protected]>
date: Sun Sep 12 20:34:41 EDT 2010

+ stonecold/workparm variables added
+ quest enum added
+ P_damagemobj partially done
+ P_SpawnPlayer/G_PlayerReborn updated

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

--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -129,6 +129,12 @@
 
 boolean		advancedemo;
 
+// villsa [STRIFE] workparm variable (similar to devparm?)
+boolean         workparm = false;
+
+// villsa [STRIFE] stonecold cheat variable
+boolean         stonecold = false;
+
 // haleyjd 09/11/10: [STRIFE] Game type variables
 boolean         isregistered;
 boolean         isdemoversion;
--- a/src/strife/d_main.h
+++ b/src/strife/d_main.h
@@ -54,6 +54,8 @@
 
 extern  gameaction_t    gameaction;
 extern  boolean         isregistered;   // villsa [STRIFE]
+extern  boolean         stonecold;      // villsa [STRIFE]
+extern  boolean         workparm;       // villsa [STRIFE]
 
 
 #endif
--- a/src/strife/doomdef.h
+++ b/src/strife/doomdef.h
@@ -198,7 +198,45 @@
     
 } powertype_t;
 
-
+// villsa [STRIFE]
+// quest flags
+typedef enum
+{
+    tk_quest1 = 1,
+    tk_quest2,
+    tk_quest3,
+    tk_quest4,
+    tk_quest5,
+    tk_quest6,
+    tk_quest7,
+    tk_quest8,
+    tk_quest9,
+    tk_quest10,
+    tk_quest11,
+    tk_quest12,
+    tk_quest13,
+    tk_quest14,
+    tk_quest15,
+    tk_quest16,
+    tk_quest17,
+    tk_quest18,
+    tk_quest19,
+    tk_quest20,
+    tk_quest21,
+    tk_quest22,
+    tk_quest23,
+    tk_quest24,
+    tk_quest25,
+    tk_quest26,
+    tk_quest27,
+    tk_quest28,
+    tk_quest29,
+    tk_quest30,
+    tk_quest31,
+    tk_quest32,
+    NUMQUESTS,
+    tk_allquests = 0x7fffffff
+} questtype_t;
 
 //
 // Power up durations,
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -35,7 +35,6 @@
 
 #include "deh_main.h"
 #include "deh_misc.h"
-
 #include "z_zone.h"
 #include "f_finale.h"
 #include "m_argv.h"
@@ -46,13 +45,10 @@
 #include "i_system.h"
 #include "i_timer.h"
 #include "i_video.h"
-
 #include "p_setup.h"
 #include "p_saveg.h"
 #include "p_tick.h"
-
 #include "d_main.h"
-
 #include "wi_stuff.h"
 #include "hu_stuff.h"
 #include "st_stuff.h"
@@ -75,8 +71,8 @@
 #include "r_data.h"
 #include "r_sky.h"
 
+#include "p_dialog.h"   // villsa [STRIFE]
 
-
 #include "g_game.h"
 
 
@@ -1212,37 +1208,43 @@
 //
 void G_PlayerReborn (int player) 
 { 
-    player_t*	p; 
-    int		i; 
-    int		frags[MAXPLAYERS]; 
-    int		killcount;
+    player_t*   p; 
+    int         i; 
+    int         frags[MAXPLAYERS]; 
+    int         killcount;
+    int         allegiance;
 	 
-    memcpy (frags,players[player].frags,sizeof(frags)); 
-    killcount = players[player].killcount; 
+    killcount = players[player].killcount;
+    allegiance = players[player].mo->miscdata;
+
+    memcpy(frags,players[player].frags,sizeof(frags));
 	 
     p = &players[player]; 
     memset (p, 0, sizeof(*p)); 
- 
-    memcpy (players[player].frags, frags, sizeof(players[player].frags)); 
-    players[player].killcount = killcount; 
- 
-    p->usedown = p->attackdown = true;	// don't do anything immediately 
-    p->playerstate = PST_LIVE;       
-    p->health = deh_initial_health;     // Use dehacked value
-    p->readyweapon = p->pendingweapon = wp_fist; // villsa [STRIFE] default to fists
-    p->weaponowned[wp_fist] = true; 
-    //p->weaponowned[wp_pistol] = true; // villsa [STRIFE] unused
-    //p->ammo[am_clip] = deh_initial_bullets;   // villsa [STRIFE] unused
+
+    memcpy(p->frags, frags, sizeof(p->frags));
+
+    p->usedown              = true;                 // don't do anything immediately
+    p->attackdown           = true;
+    p->inventorydown        = true;                 // villsa [STRIFE]
+    p->playerstate          = PST_LIVE;       
+    p->health               = deh_initial_health;   // Use dehacked value
+    p->readyweapon          = wp_fist;              // villsa [STRIFE] default to fists
+    p->pendingweapon        = wp_fist;              // villsa [STRIFE] default to fists
+    p->weaponowned[wp_fist] = true;                 // villsa [STRIFE] default to fists
+    p->cheats               |= CF_AUTOHEALTH;       // villsa [STRIFE]
+    p->killcount            = killcount;
+    p->mo->miscdata         = allegiance;           // villsa [STRIFE]
+    p->centerview           = true;                 // villsa [STRIFE]
 	 
-    for (i=0 ; i<NUMAMMO ; i++) 
+    for(i = 0; i < NUMAMMO; i++) 
 	p->maxammo[i] = maxammo[i]; 
 
-    // villsa [STRIFE] TODO - verify
     for(i = 0; i < 32; i++)
-    {
-        p->inventory[i].sprite = -1;
         p->inventory[i].type = NUMMOBJTYPES;
-    }
+
+    // villsa [STRIFE]
+    strncpy(mission_objective, "Find help", OBJECTIVE_LEN);
 		 
 }
 
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -594,7 +594,7 @@
         // [STRIFE] TODO - verify this. Seems that questflag isn't
         // applied if the special's speed is equal to 8 or if
         // the player has recieved the SLIDESHOW token
-        if(special->info->speed != 8 || !(player->questflags & 32))
+        if(special->info->speed != 8 || !(player->questflags & tk_quest32))
             player->questflags |= 1 << (special->info->speed - 1);
     }
 
@@ -909,8 +909,6 @@
 }
 
 
-
-
 //
 // P_DamageMobj
 // Damages both enemies and players
@@ -922,147 +920,216 @@
 // Source can be NULL for slime, barrel explosions
 // and other environmental stuff.
 //
-void
-P_DamageMobj
-( mobj_t*	target,
-  mobj_t*	inflictor,
-  mobj_t*	source,
-  int 		damage )
+void P_DamageMobj(mobj_t* target, mobj_t* inflictor, mobj_t* source, int damage)
 {
-    unsigned	ang;
-    int		saved;
-    player_t*	player;
-    fixed_t	thrust;
-    int		temp;
-	
-    if ( !(target->flags & MF_SHOOTABLE) )
-	return;	// shouldn't happen...
-		
-    if (target->health <= 0)
-	return;
+    angle_t     ang;
+    int         saved;
+    player_t*   player;
+    fixed_t     thrust;
+    int         temp;
 
-    // villsa [STRIFE] unused
-    /*if ( target->flags & MF_SKULLFLY )
+    if(!(target->flags & MF_SHOOTABLE) )
+        return;	// shouldn't happen...
+
+    if(target->health <= 0)
+        return;
+
+    // villsa [STRIFE] unused - skullfly check
+    // villsa [STRIFE] unused - take half damage in trainer mode
+
+    if(!inflictor
+        || !(inflictor->flags & MF_SPECTRAL)
+        || (target->type != MT_PLAYER || inflictor->health != -1)
+        && (!(target->flags & MF_SPECTRAL) || inflictor->health != -2)
+        && target->type != MT_RLEADER2 && target->type != MT_ORACLE && target->type != MT_SPECTRE_C
+        || source->player->sigiltype >= 1)
     {
-	target->momx = target->momy = target->momz = 0;
-    }*/
-	
-    player = target->player;
-    if (player && gameskill == sk_baby)
-	damage >>= 1; 	// take half damage in trainer mode
-		
+        if(inflictor)
+        {
+            if(inflictor->type != MT_SFIREBALL
+                && inflictor->type != MT_C_FLAME
+                && inflictor->type != MT_PFLAME)
+            {
+                switch(inflictor->type)
+                {
+                case MT_HOOKSHOT:
+                    ang = R_PointToAngle2(
+                        target->x,
+                        target->y,
+                        inflictor->x,
+                        inflictor->y) >> ANGLETOFINESHIFT;
 
+                    target->momx += FixedMul(finecosine[ang], (12750*FRACUNIT) / target->info->mass);
+                    target->momy += FixedMul(finesine[ang], (12750*FRACUNIT) / target->info->mass);
+                    target->reactiontime += 10;
+
+                    temp = P_AproxDistance(target->x - source->x, target->y - source->y);
+                    temp /= target->info->mass;
+
+                    if(temp < 1)
+                        temp = 1;
+
+                    target->momz = (source->z - target->z) / temp;
+                    break;
+
+                case MT_POISARROW:
+                    // don't affect robots
+                    if(target->flags & MF_NOBLOOD)
+                        return;
+
+                    // instant kill
+                    damage = target->health + 10;
+                    break;
+
+                default:
+                    if(target->flags & MF_SPECTRAL
+                        && !(inflictor->flags & MF_SPECTRAL))
+                    {
+                        P_SetMobjState(target, target->info->missilestate);
+                        return;
+                    }
+                    break;
+                }
+            }
+            else
+            {
+                temp = damage / 2;
+
+                if(P_IsMobjBoss(target->type))
+                    damage /= 2;
+                else if(inflictor->type == MT_PFLAME)
+                {
+                    damage /= 2;
+                    // robots deal very little damage
+                    if(target->flags & MF_NOBLOOD)
+                        damage = temp / 2;
+                }
+            }
+        }
+
+        if((target->type >= MT_SHOPKEEPER_W && target->type <= MT_SHOPKEEPER_M)
+            || target->type == MT_RLEADER)
+        {
+            if(source)
+                target->target = source;
+
+            P_SetMobjState(target, target->info->painstate);
+            return;
+        }
+    }
+
+
     // Some close combat weapons should not
     // inflict thrust and push the victim out of reach,
     // thus kick away unless using the chainsaw.
     if (inflictor
-	&& !(target->flags & MF_NOCLIP)
-	&& (!source
-	    || !source->player
-	    /*|| source->player->readyweapon != wp_chainsaw*/)) // villsa [STRIFE] unused
+        && !(target->flags & MF_NOCLIP)
+        && (!source
+        || !source->player
+        /*|| source->player->readyweapon != wp_chainsaw*/)) // villsa [STRIFE] unused
     {
-	ang = R_PointToAngle2 ( inflictor->x,
-				inflictor->y,
-				target->x,
-				target->y);
-		
-	thrust = damage*(FRACUNIT>>3)*100/target->info->mass;
+        ang = R_PointToAngle2 ( inflictor->x,
+            inflictor->y,
+            target->x,
+            target->y);
 
-	// make fall forwards sometimes
-	if ( damage < 40
-	     && damage > target->health
-	     && target->z - inflictor->z > 64*FRACUNIT
-	     && (P_Random ()&1) )
-	{
-	    ang += ANG180;
-	    thrust *= 4;
-	}
-		
-	ang >>= ANGLETOFINESHIFT;
-	target->momx += FixedMul (thrust, finecosine[ang]);
-	target->momy += FixedMul (thrust, finesine[ang]);
+        thrust = damage*(FRACUNIT>>3)*100/target->info->mass;
+
+        // make fall forwards sometimes
+        if ( damage < 40
+            && damage > target->health
+            && target->z - inflictor->z > 64*FRACUNIT
+            && (P_Random ()&1) )
+        {
+            ang += ANG180;
+            thrust *= 4;
+        }
+
+        ang >>= ANGLETOFINESHIFT;
+        target->momx += FixedMul (thrust, finecosine[ang]);
+        target->momy += FixedMul (thrust, finesine[ang]);
     }
-    
+
     // player specific
     if (player)
     {
-	// end of game hell hack
-	if (target->subsector->sector->special == 11
-	    && damage >= target->health)
-	{
-	    damage = target->health - 1;
-	}
-	
+        // end of game hell hack
+        if (target->subsector->sector->special == 11
+            && damage >= target->health)
+        {
+            damage = target->health - 1;
+        }
 
-	// Below certain threshold,
-	// ignore damage in GOD mode.
+
+        // Below certain threshold,
+        // ignore damage in GOD mode.
         // villsa [STRIFE] removed pw_invulnerability check
-	if(damage < 1000 && (player->cheats & CF_GODMODE))
+        if(damage < 1000 && (player->cheats & CF_GODMODE))
             return;
-	
-	if (player->armortype)
-	{
-	    if (player->armortype == 1)
-		saved = damage/3;
-	    else
-		saved = damage/2;
-	    
-	    if (player->armorpoints <= saved)
-	    {
-		// armor is used up
-		saved = player->armorpoints;
-		player->armortype = 0;
-	    }
-	    player->armorpoints -= saved;
-	    damage -= saved;
-	}
-	player->health -= damage; 	// mirror mobj health here for Dave
-	if (player->health < 0)
-	    player->health = 0;
-	
-	player->attacker = source;
-	player->damagecount += damage;	// add damage after armor / invuln
 
-	if (player->damagecount > 100)
-	    player->damagecount = 100;	// teleport stomp does 10k points...
-	
-	temp = damage < 100 ? damage : 100;
+        if (player->armortype)
+        {
+            if (player->armortype == 1)
+                saved = damage/3;
+            else
+                saved = damage/2;
 
-	if (player == &players[consoleplayer])
-	    I_Tactile (40,10,40+temp*2);
+            if (player->armorpoints <= saved)
+            {
+                // armor is used up
+                saved = player->armorpoints;
+                player->armortype = 0;
+            }
+            player->armorpoints -= saved;
+            damage -= saved;
+        }
+        player->health -= damage; 	// mirror mobj health here for Dave
+        if (player->health < 0)
+            player->health = 0;
+
+        player->attacker = source;
+        player->damagecount += damage;	// add damage after armor / invuln
+
+        if (player->damagecount > 100)
+            player->damagecount = 100;	// teleport stomp does 10k points...
+
+        temp = damage < 100 ? damage : 100;
+
+        if (player == &players[consoleplayer])
+            I_Tactile (40,10,40+temp*2);
     }
-    
+
     // do the damage	
     target->health -= damage;	
     if (target->health <= 0)
     {
-	P_KillMobj (source, target);
-	return;
+        P_KillMobj (source, target);
+        return;
     }
 
     if ( (P_Random () < target->info->painchance)
-	 /*&& !(target->flags&MF_SKULLFLY)*/ )  // villsa [STRIFE] unused flag
+        /*&& !(target->flags&MF_SKULLFLY)*/ )  // villsa [STRIFE] unused flag
     {
-	target->flags |= MF_JUSTHIT;	// fight back!
-	
-	P_SetMobjState (target, target->info->painstate);
+        target->flags |= MF_JUSTHIT;	// fight back!
+
+        P_SetMobjState (target, target->info->painstate);
     }
-			
+
     target->reactiontime = 0;		// we're awake now...	
 
     // villsa [STRIFE] TODO - update to strife version
     if ( (!target->threshold /*|| target->type == MT_VILE*/)
-	 && source && source != target
-	 /*&& source->type != MT_VILE*/)
+        && source && source != target
+        /*&& source->type != MT_VILE*/)
     {
-	// if not intent on another player,
-	// chase after this one
-	target->target = source;
-	target->threshold = BASETHRESHOLD;
-	if (target->state == &states[target->info->spawnstate]
-	    && target->info->seestate != S_NULL)
-	    P_SetMobjState (target, target->info->seestate);
+        // if not intent on another player,
+        // chase after this one
+        target->target = source;
+        target->threshold = BASETHRESHOLD;
+        if (target->state == &states[target->info->spawnstate]
+        && target->info->seestate != S_NULL)
+            P_SetMobjState (target, target->info->seestate);
     }
-			
+
 }
 
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -29,17 +29,14 @@
 #include "i_system.h"
 #include "z_zone.h"
 #include "m_random.h"
-
 #include "doomdef.h"
 #include "p_local.h"
 #include "sounds.h"
-
 #include "st_stuff.h"
 #include "hu_stuff.h"
-
 #include "s_sound.h"
-
 #include "doomstat.h"
+#include "d_main.h"     // villsa [STRIFE]
 
 
 void G_PlayerReborn (int player);
@@ -752,68 +749,82 @@
 // Most of the player structure stays unchanged
 //  between levels.
 //
-void P_SpawnPlayer (mapthing_t* mthing)
+void P_SpawnPlayer(mapthing_t* mthing)
 {
-    player_t*		p;
-    fixed_t		x;
-    fixed_t		y;
-    fixed_t		z;
+    player_t*   p;
+    fixed_t     x;
+    fixed_t     y;
+    fixed_t     z;
+    mobj_t*     mobj;
+    int         i;
 
-    mobj_t*		mobj;
-
-    int			i;
-
-    if (mthing->type == 0)
-    {
+    if(mthing->type == 0)
         return;
-    }
 
     // not playing?
-    if (!playeringame[mthing->type-1])
-	return;					
-		
+    if(!playeringame[mthing->type-1])
+        return;					
+
     p = &players[mthing->type-1];
 
     if (p->playerstate == PST_REBORN)
-	G_PlayerReborn (mthing->type-1);
+        G_PlayerReborn (mthing->type-1);
 
-    x 		= mthing->x << FRACBITS;
-    y 		= mthing->y << FRACBITS;
-    z		= ONFLOORZ;
-    mobj	= P_SpawnMobj (x,y,z, MT_PLAYER);
+    x       = mthing->x << FRACBITS;
+    y       = mthing->y << FRACBITS;
+    z       = ONFLOORZ;
+    mobj    = P_SpawnMobj (x,y,z, MT_PLAYER);
 
     // set color translations for player sprites
-    if (mthing->type > 1)		
-	mobj->flags |= (mthing->type-1)<<MF_TRANSSHIFT;
-		
+    if(mthing->type > 1)		
+        mobj->flags |= (mthing->type-1)<<MF_TRANSSHIFT;
+
     mobj->angle	= ANG45 * (mthing->angle/45);
     mobj->player = p;
     mobj->health = p->health;
 
-    p->mo = mobj;
-    p->playerstate = PST_LIVE;	
-    p->refire = 0;
-    p->message = NULL;
-    p->damagecount = 0;
-    p->bonuscount = 0;
-    p->extralight = 0;
-    p->fixedcolormap = 0;
-    p->viewheight = VIEWHEIGHT;
+    p->mo               = mobj;
+    p->playerstate      = PST_LIVE;	
+    p->refire           = 0;
+    p->message          = NULL;
+    p->damagecount      = 0;
+    p->bonuscount       = 0;
+    p->extralight       = 0;
+    p->fixedcolormap    = 0;
+    p->viewheight       = VIEWHEIGHT;
 
     // setup gun psprite
-    P_SetupPsprites (p);
-    
-    // give all cards in death match mode
-    if (deathmatch)
-	for (i=0 ; i<NUMCARDS ; i++)
-	    p->cards[i] = true;
-			
-    if (mthing->type-1 == consoleplayer)
+    P_SetupPsprites(p);
+
+    // villsa [STRIFE]
+    stonecold = false;
+
+    // villsa [STRIFE] what a nasty hack...
+    if(gamemap == 10)
+      p->weaponowned[wp_sigil] = true;
+
+
+    // villsa [STRIFE] instead of giving cards in deathmatch mode, set
+    // accuracy to 50 and give all quest flags
+    if(deathmatch)
     {
-	// wake up the status bar
-	ST_Start ();
-	// wake up the heads up text
-	HU_Start ();		
+        p->accuracy = 50;
+        p->questflags = tk_allquests;
+
+        /*for(i = 0; i < NUMCARDS; i++)
+            p->cards[i] = true;*/
+    }
+
+    // villsa [STRIFE] set godmode?
+    if(workparm)
+        p->cheats |= CF_GODMODE;
+
+    if(mthing->type - 1 == consoleplayer)
+    {
+        // wake up the status bar
+        ST_Start ();
+        // wake up the heads up text
+        HU_Start ();		
     }
 }
 
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -325,7 +325,7 @@
                     breakglass = true;
 
                     // give quest token #28 to player
-                    players[0].questflags |= (1 << ((MT_TOKEN_QUEST28 - MT_TOKEN_QUEST1) + 1));
+                    players[0].questflags |= (1 << tk_quest28);
 
                     // give stamina/accuracy items
                     if(!netgame)