shithub: choc

Download patch

ref: 583406a2ba2a10bfe0e654a0ede285da46c9bd88
parent: 8761422d31fdceb685b292a780727f3ad1d950db
author: Samuel Villareal <svkaiser@gmail.com>
date: Sat Sep 4 00:06:10 EDT 2010

+ Map flags for things added (MTF_*)
+ A_FireGrenade and A_MissileTick codepointers added
+ Step up height changed to 16*FRACUNIT (non-human things are excluded)
+ Fixed bug in P_MovePlayer where player cannot climb over things when
  pressing forward and jumping. Missed a line of code for this
+ P_SpawnSubMissile renamed to P_SpawnFaceMissile
+ P_SpawnMortar added
+ Ammo types added
+ Fixed some inaccuracies in P_SpawnBlood

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

--- a/src/strife/d_items.c
+++ b/src/strife/d_items.c
@@ -58,7 +58,7 @@
     },	
     {
 	// electric bow
-	am_clip,
+	am_elecbolts,
 	S_XBOW_02,
 	S_XBOW_01,
 	S_XBOW_00,
@@ -68,7 +68,7 @@
     },	
     {
 	// rifle
-	am_shell,
+	am_bullets,
 	S_RIFG_02,
 	S_RIFG_01,
 	S_RIFG_00,
@@ -78,7 +78,7 @@
     },
     {
 	// missile launcher
-	am_clip,
+	am_missiles,
 	S_MMIS_02,
 	S_MMIS_01,
 	S_MMIS_00,
@@ -88,12 +88,12 @@
     },
     {
 	// grenade launcher
-	am_misl,
+	am_hegrenades,
 	S_GREN_02,
 	S_GREN_01,
 	S_GREN_00,
 	S_GREN_03,
-	103,
+	S_GREF_00,
         0
     },
     {
@@ -128,7 +128,7 @@
     },
     {
 	// poison bow
-	am_shell,
+	am_poisonbolts,
 	S_XBOW_15,
 	S_XBOW_14,
 	S_XBOW_13,
@@ -138,7 +138,7 @@
     },
     {
 	// wp grenade launcher
-	am_shell,
+	am_wpgrenades,
 	S_GREN_10,
 	S_GREN_09,
 	S_GREN_08,
@@ -148,7 +148,7 @@
     },
     {
 	// torpedo
-	am_shell,
+	am_cell,
 	S_BLST_18,
 	S_BLST_17,
 	S_BLST_13,
--- a/src/strife/doomdef.h
+++ b/src/strife/doomdef.h
@@ -82,11 +82,25 @@
 #define	MTF_EASY		1
 #define	MTF_NORMAL		2
 #define	MTF_HARD		4
-
+// villsa [STRIFE] standing monsters
+#define MTF_STAND               8
+// villsa [STRIFE] don't spawn in single player
+#define MTF_NOTSINGLE           16
 // Deaf monsters/do not react to sound.
-#define	MTF_AMBUSH		8
+#define MTF_AMBUSH              32
+// villsa [STRIFE] friendly to players
+#define MTF_FRIEND              64
+// villsa [STRIFE] TODO - identify
+#define MTF_UNKNOWN             128
+// villsa [STRIFE] thing is translucent
+#define MTF_TRANSLUCENT         256
+// villsa [STRIFE] TODO - identify
+#define MTF_MVIS                512
+// villsa [STRIFE] TODO - identify
+#define MTF_RESERVED            1024
 
 
+
 //
 // Key cards.
 //
@@ -135,12 +149,17 @@
 // Ammunition types defined.
 typedef enum
 {
-    am_clip,	// Pistol / chaingun ammo.
-    am_shell,	// Shotgun / double barreled shotgun.
-    am_cell,	// Plasma rifle, BFG.
-    am_misl,	// Missile launcher.
+    am_bullets,
+    am_elecbolts,
+    am_poisonbolts,
+    am_cell,
+    am_missiles,
+    am_hegrenades,
+    am_wpgrenades,
+
     NUMAMMO,
-    am_noammo	// Unlimited for chainsaw / fist.	
+
+    am_noammo   // unlimited ammo
 
 } ammotype_t;
 
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -1068,8 +1068,8 @@
     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]
-    p->ammo[am_clip] = deh_initial_bullets; 
+    //p->weaponowned[wp_pistol] = true; // villsa [STRIFE] unused
+    //p->ammo[am_clip] = deh_initial_bullets;   // villsa [STRIFE] unused
 	 
     for (i=0 ; i<NUMAMMO ; i++) 
 	p->maxammo[i] = maxammo[i]; 
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -2374,9 +2374,20 @@
 
 }
 
+//
+// A_MissileTick
+// villsa [STRIFE] - new codepointer
+//
+
 void A_MissileTick(mobj_t* actor)
 {
+    int r = actor->reactiontime--;
 
+    if(r - 1 <= 0)
+    {
+        P_ExplodeMissile(actor);
+        actor->flags &= ~MF_MISSILE;
+    }
 }
 
 void A_SpawnGrenadeFire(mobj_t* actor)
@@ -2460,11 +2471,6 @@
 }
 
 void A_FireMauler2(mobj_t* actor)
-{
-
-}
-
-void A_FireGrenade(mobj_t* actor)
 {
 
 }
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -129,7 +129,10 @@
 mobj_t* P_SpawnSparkPuff(fixed_t x, fixed_t y, fixed_t z);  // villsa [STRIFE]
 void 	P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
 mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
+mobj_t* P_SpawnFacingMissile(mobj_t* source, mobj_t* target, mobjtype_t type);  // villsa [STRIFE]
 void	P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
+mobj_t* P_SpawnMortar(mobj_t *source, mobjtype_t type); // villsa [STRIFE]
+void    P_ExplodeMissile (mobj_t* mo); // villsa [STRIFE]
 
 
 //
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -530,10 +530,15 @@
 	     &&*/tmceilingz - thing->z < thing->height)
 	    return false;	// mobj must lower itself to fit
 
-	if ( /*!(thing->flags&MF_TELEPORT) // villsa [STRIFE] unused
-	     &&*/ tmfloorz - thing->z > 24*FRACUNIT )
-	    return false;	// too big a step up
+        // villsa [STRIFE] non-robots are limited to 16 unit step height
+        if(!(thing->flags & MF_NOBLOOD) && tmfloorz - thing->z > (16*FRACUNIT) ||
+            tmfloorz - thing->z > 24*FRACUNIT)
+            return false;       // too big a step up
 
+        // villsa [STRIFE] special case for missiles
+        if(thing->flags & MF_MISSILE && tmfloorz - thing->z > (4*FRACUNIT))
+            return false;
+
 	if ( !(thing->flags&(MF_DROPOFF|MF_FLOAT))
 	     && tmfloorz - tmdropoffz > 24*FRACUNIT )
 	    return false;	// don't stand over a dropoff
@@ -792,7 +797,8 @@
     if (opentop - slidemo->z < slidemo->height)
 	goto isblocking;		// mobj is too high
 
-    if (openbottom - slidemo->z > 24*FRACUNIT )
+    // villsa [STRIFE] change from 24 to 16
+    if (openbottom - slidemo->z > 16*FRACUNIT )
 	goto isblocking;		// too big a step up
 
     // this line doesn't block movement
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -174,6 +174,21 @@
 	    {	// try to slide along it
 		P_SlideMove (mo);
 	    }
+            // villsa [STRIFE] check for bouncy missiles
+            else if(mo->flags & MF_BOUNCE)
+            {
+                mo->momx >>= 3;
+                mo->momy >>= 3;
+
+                if (P_TryMove(mo, mo->x - xmove, ymove + mo->y))
+                    mo->momy = -mo->momy;
+                else
+                    mo->momx = -mo->momx;
+
+
+                xmove = 0;
+                ymove = 0;
+            }
 	    else if (mo->flags & MF_MISSILE)
 	    {
 		// explode a missile
@@ -986,7 +1001,7 @@
     z += ((P_Random()-P_Random())<<10);
     th = P_SpawnMobj (x,y,z, MT_BLOOD_DEATH);
     th->momz = FRACUNIT*2;
-    th->tics -= P_Random()&3;
+    //th->tics -= P_Random()&3; // villsa [STRIFE] unused
 
     // villsa [STRIFE] unused
     /*if (th->tics < 1)
@@ -995,6 +1010,8 @@
     // villsa [STRIFE] different checks for damage range
     if (damage >= 10 && damage <= 13)
 	P_SetMobjState (th,S_BLOD_00);
+    else if (damage < 10 && damage >= 7)
+        P_SetMobjState (th,S_BLOD_01);
     else if (damage < 7)
 	P_SetMobjState (th,S_BLOD_02);
 }
@@ -1094,11 +1111,12 @@
 }
 
 //
-// P_SpawnSubMissile
-// villsa [STRIFE] new function (TODO - add description)
+// P_SpawnFacingMissile
+// villsa [STRIFE] new function
+// Spawn a missile based on source's angle
 //
 
-mobj_t* P_SpawnSubMissile(mobj_t* source, mobj_t* target, mobjtype_t type, fixed_t radius)
+mobj_t* P_SpawnFacingMissile(mobj_t* source, mobj_t* target, mobjtype_t type)
 {
     mobj_t* th;
     angle_t an;
@@ -1173,10 +1191,19 @@
 	    slope = 0;
 	}
     }
+
+    // villsa [STRIFE]
+    if(linetarget)
+        source->target = linetarget;
 		
     x = source->x;
     y = source->y;
-    z = source->z + 4*8*FRACUNIT;
+    
+    // villsa [STRIFE]
+    if(!(source->flags & MF_FEETCLIPPED))
+        z = source->z + 32*FRACUNIT;
+    else
+        z = source->z + 22*FRACUNIT;
 	
     th = P_SpawnMobj (x,y,z, type);
 
@@ -1194,3 +1221,32 @@
     P_CheckMissileSpawn (th);
 }
 
+//
+// P_SpawnMortar
+// villsa [STRIFE] new function
+// Spawn a high-arcing ballistic projectile
+//
+
+mobj_t* P_SpawnMortar(mobj_t *source, mobjtype_t type)
+{
+    mobj_t* th;
+    angle_t an;
+    fixed_t slope;
+
+    an = source->angle;
+
+    th = P_SpawnMobj(source->x, source->y, source->z, type);
+    th->target = source;
+    th->angle = an;
+    an >>= ANGLETOFINESHIFT;
+
+    slope = P_AimLineAttack(source, source->angle, 1024*FRACUNIT);
+
+    th->momx = FixedMul (th->info->speed, finecosine[an]);
+    th->momy = FixedMul (th->info->speed, finesine[an]);
+    th->momz = FixedMul(th->info->speed, slope);
+
+    P_CheckMissileSpawn(th);
+
+    return th;
+}
--- a/src/strife/p_pspr.c
+++ b/src/strife/p_pspr.c
@@ -164,6 +164,9 @@
     ammotype_t		ammo;
     int			count;
 
+    // villsa [STRIFE] TODO - temp until this function is cleaned up
+    return true;
+
     ammo = weaponinfo[player->readyweapon].ammo;
 
     // Minimal amount for one shot varies.
@@ -850,6 +853,63 @@
   pspdef_t*	psp )
 {
     S_StartSound (player->mo, sfx_swish);   // villsa [STRIFE] TODO - fix sounds
+}
+
+//
+// A_FireGrenade
+// villsa [STRIFE] - new codepointer
+//
+
+void A_FireGrenade(player_t* player, pspdef_t* pspr)
+{
+    mobjtype_t type;
+    mobj_t* mo;
+    state_t* st1;
+    state_t* st2;
+    angle_t an;
+    fixed_t radius;
+
+    // decide on what type of grenade to spawn
+    if(player->readyweapon == wp_hegrenade)
+        type = MT_HEGRENADE;
+    else
+    {
+        if(player->readyweapon == wp_wpgrenade)
+            type = MT_PGRENADE;
+    }
+
+    player->ammo[weaponinfo[player->readyweapon].ammo]--;
+
+    // set flash frame
+    st1 = &states[(pspr->state - states) + weaponinfo[player->readyweapon].flashstate];
+    st2 = &states[weaponinfo[player->readyweapon].atkstate];
+    P_SetPsprite(player, ps_flash, st1 - st2);
+
+    player->mo->z += (32*FRACUNIT); // ugh
+    mo = P_SpawnMortar(player->mo, type);
+    player->mo->z -= (32*FRACUNIT); // ugh
+
+    // change momz based on player's pitch
+    mo->momz = FixedMul((player->pitch<<FRACBITS) / 160, mo->info->speed) + (8*FRACUNIT);
+    S_StartSound(mo, mo->info->seesound);
+
+    radius = mobjinfo[type].radius + player->mo->info->radius;
+    an = (player->mo->angle >> ANGLETOFINESHIFT);
+
+    mo->x += FixedMul(finecosine[an], radius + (4*FRACUNIT));
+    mo->y += FixedMul(finesine[an], radius + (4*FRACUNIT));
+
+    // shoot grenade from left or right side?
+    if(&states[weaponinfo[player->readyweapon].atkstate] == pspr->state)
+        an = (player->mo->angle - ANG90) >> ANGLETOFINESHIFT;
+    else
+        an = (player->mo->angle + ANG90) >> ANGLETOFINESHIFT;
+
+    mo->x += FixedMul((15*FRACUNIT), finecosine[an]);
+    mo->y += FixedMul((15*FRACUNIT), finesine[an]);
+
+    // set bounce flag
+    mo->flags |= MF_BOUNCE;
 }
 
 
--- a/src/strife/p_user.c
+++ b/src/strife/p_user.c
@@ -166,18 +166,27 @@
     //  if not onground.
     onground = (player->mo->z <= player->mo->floorz);
 
-    // villsa [STRIFE] jump button
-    if (onground && cmd->buttons2 & BT2_JUMP)
+    // villsa [STRIFE] allows player to climb over things by jumping
+    if(!onground)
     {
-        if(!player->deltaviewheight)
-            player->mo->momz += (8*FRACUNIT);
+        if(cmd->forwardmove)
+            P_Thrust (player, player->mo->angle, cmd->forwardmove);
     }
+    else
+    {
+        // villsa [STRIFE] jump button
+        if (cmd->buttons2 & BT2_JUMP)
+        {
+            if(!player->deltaviewheight)
+                player->mo->momz += (8*FRACUNIT);
+        }
 	
-    if (cmd->forwardmove && onground)
-	P_Thrust (player, player->mo->angle, cmd->forwardmove*2048);
+        if (cmd->forwardmove && onground)
+	    P_Thrust (player, player->mo->angle, cmd->forwardmove*2048);
     
-    if (cmd->sidemove && onground)
-	P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048);
+        if (cmd->sidemove && onground)
+	    P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048);
+    }
 
     // villsa [STRIFE] TODO - verify
     if ( (cmd->forwardmove || cmd->sidemove)