ref: ded5e702b8f28f9eb2d5322d47f0cd08e93cb74b
parent: 583406a2ba2a10bfe0e654a0ede285da46c9bd88
author: Samuel Villareal <svkaiser@gmail.com>
date: Sat Sep 4 02:34:42 EDT 2010
+ Found nearly duplicate names (MT_MINIMISSLE and MT_MINIMISLE). Corrected names + Majority of player action code pointers implemented + Removed all unused Doom player codepointers + P_SpawnPlayerMissile now returns a mobj Subversion-branch: /branches/strife-branch Subversion-revision: 2009
--- a/src/strife/info.c
+++ b/src/strife/info.c
@@ -6938,7 +6938,7 @@
"flame thrower parts", //namepointer
},
- { /*MT_MINIMISSILE*/
+ { /*MT_MISSILELAUNCHER*/
2003, //doomednum
S_MMSL_00, //spawnstate
1000, //spawnhealth
--- a/src/strife/info.h
+++ b/src/strife/info.h
@@ -2037,7 +2037,7 @@
MT_RIFLESTAND, //189
MT_FLAMETHROWER, //190
MT_TOKEN_FLAME_THROWER_PARTS, //191
- MT_MINIMISSILE, //192
+ MT_MISSILELAUNCHER, //192
MT_BLASTER, //193
MT_CROSSBOW, //194
MT_GRENADELAUNCHER, //195
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -166,9 +166,78 @@
P_RecursiveSound (emmiter->subsector->sector, 0);
}
+//
+// P_WakeUpThing
+// villsa [STRIFE] new function
+//
+static void P_WakeUpThing(mobj_t* puncher, mobj_t* rover)
+{
+ if(!(rover->flags & MF_INCOMBAT))
+ {
+ rover->target = puncher;
+ if(rover->info->seesound)
+ S_StartSound(rover, rover->info->seesound);
+ P_SetMobjState(rover, rover->info->seestate);
+ }
+}
+//
+// P_DoPunchAlert
+// villsa [STRIFE] - new function
+// Wake up buddies nearby when the player thinks he's gotten too clever
+// with the punch dagger. Walks sector links.
+//
+void P_DoPunchAlert(mobj_t *puncher, mobj_t *punchee)
+{
+ mobj_t *rover;
+
+ // don't bother with this crap if we're already on alert
+ if(punchee->subsector->sector->soundtarget)
+ return;
+
+ // gotta still be alive to call for help
+ if(punchee->health <= 0)
+ return;
+
+ // has to be something you can wake up and kill too
+ if(!(punchee->flags & MF_COUNTKILL) || punchee->flags & MF_INCOMBAT)
+ return;
+
+ // wake up punchee
+ punchee->target = puncher;
+ P_SetMobjState(punchee, punchee->info->seestate);
+
+ // wake up everybody nearby
+
+ // scan forward on sector list
+ for(rover = punchee->snext; rover; rover = rover->snext)
+ {
+ // we only wake up certain thing types (Acolytes and Templars?)
+ if(rover->health > 0 && rover->type >= MT_GUARD1 && rover->type <= MT_PGUARD &&
+ (P_CheckSight(rover, puncher) || P_CheckSight(rover, punchee)))
+ {
+ P_WakeUpThing(puncher, rover);
+ rover->flags |= MF_INCOMBAT; // huh? why?
+ }
+ }
+ // scan backward on sector list
+ for(rover = punchee->sprev; rover; rover = rover->sprev)
+ {
+ // we only wake up certain thing types (Acolytes and Templars?)
+ if(rover->health > 0 && rover->type >= MT_GUARD1 && rover->type <= MT_PGUARD &&
+ (P_CheckSight(rover, puncher) || P_CheckSight(rover, punchee)))
+ {
+ P_WakeUpThing(puncher, rover);
+ rover->flags |= MF_INCOMBAT; // huh? why?
+ }
+ }
+}
+
+
+
+
//
// P_CheckMeleeRange
//
@@ -2465,40 +2534,6 @@
}
-void A_FireFlameThrower(mobj_t* actor)
-{
-
-}
-
-void A_FireMauler2(mobj_t* actor)
-{
-
-}
-
-void A_FireElectricBolt(mobj_t* actor)
-{
-
-}
-
-void A_FirePoisonBolt(mobj_t* actor)
-{
-
-}
-
-void A_FireRifle(mobj_t* actor)
-{
-
-}
-
-void A_FireMauler1(mobj_t* actor)
-{
-
-}
-
-void A_SigilSound(mobj_t* actor)
-{
-
-}
void A_FireSigil(mobj_t* actor)
{
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -130,7 +130,7 @@
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_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]
@@ -139,6 +139,7 @@
// P_ENEMY
//
void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
+void P_DoPunchAlert(mobj_t *puncher, mobj_t *punchee); // villsa [STRIFE]
//
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -1156,11 +1156,9 @@
//
// P_SpawnPlayerMissile
// Tries to aim at a nearby monster
+// villsa [STRIFE] now returns a mobj
//
-void
-P_SpawnPlayerMissile
-( mobj_t* source,
- mobjtype_t type )
+mobj_t* P_SpawnPlayerMissile(mobj_t* source, mobjtype_t type)
{
mobj_t* th;
angle_t an;
@@ -1219,6 +1217,8 @@
th->momz = FixedMul( th->info->speed, slope);
P_CheckMissileSpawn (th);
+
+ return th;
}
//
--- a/src/strife/p_pspr.c
+++ b/src/strife/p_pspr.c
@@ -506,53 +506,6 @@
}
-//
-// A_Saw
-//
-void
-A_Saw
-( player_t* player,
- pspdef_t* psp )
-{
- angle_t angle;
- int damage;
- int slope;
-
- damage = 2*(P_Random ()%10+1);
- angle = player->mo->angle;
- angle += (P_Random()-P_Random())<<18;
-
- // use meleerange + 1 se the puff doesn't skip the flash
- slope = P_AimLineAttack (player->mo, angle, MELEERANGE+1);
- P_LineAttack (player->mo, angle, MELEERANGE+1, slope, damage);
-
- if (!linetarget)
- {
- S_StartSound (player->mo, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- return;
- }
- S_StartSound (player->mo, sfx_swish); // villsa [STRIFE] TODO - fix sounds
-
- // turn to face target
- angle = R_PointToAngle2 (player->mo->x, player->mo->y,
- linetarget->x, linetarget->y);
- if (angle - player->mo->angle > ANG180)
- {
- if ((signed int) (angle - player->mo->angle) < -ANG90/20)
- player->mo->angle = angle + ANG90/21;
- else
- player->mo->angle -= ANG90/20;
- }
- else
- {
- if (angle - player->mo->angle > ANG90/20)
- player->mo->angle = angle - ANG90/21;
- else
- player->mo->angle += ANG90/20;
- }
- player->mo->flags |= MF_JUSTATTACKED;
-}
-
// Doom does not check the bounds of the ammo array. As a result,
// it is possible to use an ammo type > 4 that overflows into the
// maxammo array and affects that instead. Through dehacked, for
@@ -573,56 +526,144 @@
//
-// A_FireMissile
+// A_FireFlameThrower
+// villsa [STRIFE] completly new compared to the original
//
-void
-A_FireMissile
-( player_t* player,
- pspdef_t* psp )
+
+void A_FireFlameThrower(player_t* player, pspdef_t* psp)
{
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1);
- // villsa [STRIFE] TODO - update
-// P_SpawnPlayerMissile (player->mo, MT_ROCKET);
-}
+ mobj_t* mo;
+ P_SetMobjState(player->mo, S_PLAY_06);
+ player->ammo[weaponinfo[player->readyweapon].ammo]--;
+ player->mo->angle += (P_Random() - P_Random()) << 18;
+ mo = P_SpawnPlayerMissile(player->mo, MT_SFIREBALL);
+ mo->momz += (5*FRACUNIT);
+}
+
//
-// A_FireBFG
+// A_FireMissile
+// villsa [STRIFE] completly new compared to the original
//
-void
-A_FireBFG
-( player_t* player,
- pspdef_t* psp )
+
+void A_FireMissile(player_t* player, pspdef_t* psp)
{
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo,
- deh_bfg_cells_per_shot);
- // villsa [STRIFE] unused
-// P_SpawnPlayerMissile (player->mo, MT_BFG);
+ angle_t an;
+ mobj_t* mo;
+
+ an = player->mo->angle;
+ player->mo->angle += (P_Random() - P_Random())<<(19 - (player->accuracy * 4 / 100));
+ P_SetMobjState(player->mo, S_PLAY_06);
+ player->ammo[weaponinfo[player->readyweapon].ammo]--;
+ P_SpawnPlayerMissile(player->mo, MT_MINIMISSLE);
+ player->mo->angle = an;
}
+//
+// A_FireMauler2
+// villsa [STRIFE] - new codepointer
+//
+void A_FireMauler2(player_t* player, pspdef_t* pspr)
+{
+ P_SetMobjState(player->mo, S_PLAY_06);
+ P_DamageMobj(player->mo, player->mo, NULL, 20);
+ player->ammo[weaponinfo[player->readyweapon].ammo] -= 30;
+ P_SpawnPlayerMissile(player->mo, MT_TORPEDO);
+ P_Thrust(player, player->mo->angle + ANG180, 512000);
+}
//
-// A_FirePlasma
+// A_FireGrenade
+// villsa [STRIFE] - new codepointer
//
-void
-A_FirePlasma
-( player_t* player,
- pspdef_t* psp )
+
+void A_FireGrenade(player_t* player, pspdef_t* pspr)
{
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1);
+ mobjtype_t type;
+ mobj_t* mo;
+ state_t* st1;
+ state_t* st2;
+ angle_t an;
+ fixed_t radius;
- P_SetPsprite (player,
- ps_flash,
- weaponinfo[player->readyweapon].flashstate+(P_Random ()&1) );
+ // 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;
+ }
- // villsa [STRIFE] TODO - update
-// P_SpawnPlayerMissile (player->mo, MT_PLASMA);
+ 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_FireElectricBolt
+// villsa [STRIFE] - new codepointer
+//
+void A_FireElectricBolt(player_t* player, pspdef_t* pspr)
+{
+ angle_t an = player->mo->angle;
+ player->mo->angle += (P_Random() - P_Random()) << (18 - (player->accuracy * 4 / 100));
+ player->ammo[weaponinfo[player->readyweapon].ammo]--;
+ P_SpawnPlayerMissile(player->mo, MT_ELECARROW);
+ player->mo->angle = an;
+ S_StartSound(player->mo, sfx_xbow);
+}
+
//
+// A_FirePoisonBolt
+// villsa [STRIFE] - new codepointer
+//
+
+void A_FirePoisonBolt(player_t* player, pspdef_t* pspr)
+{
+ angle_t an = player->mo->angle;
+
+ player->mo->angle += (P_Random() - P_Random())<<(18 - (player->accuracy * 4 / 100));
+ player->ammo[weaponinfo[player->readyweapon].ammo]--;
+ P_SpawnPlayerMissile(player->mo, MT_POISARROW);
+ player->mo->angle = an;
+ S_StartSound(player->mo, sfx_xbow);
+}
+
+//
// P_BulletSlope
// Sets a slope so a near miss is at aproximately
// the height of the intended target
@@ -662,131 +703,75 @@
angle_t angle;
int damage;
- damage = 5*(P_Random ()%3+1);
+ damage = 4*(P_Random ()%3+4); // villsa [STRIFE] different damage formula
angle = mo->angle;
+ // villsa [STRIFE] apply player accuracy
if (!accurate)
- angle += (P_Random()-P_Random())<<18;
+ angle += (P_Random()-P_Random())<<(20 - (mo->player->accuracy * 4 / 100));
P_LineAttack (mo, angle, MISSILERANGE, bulletslope, damage);
}
-
//
-// A_FirePistol
+// A_FireRifle
+// villsa [STRIFE] - new codepointer
//
-void
-A_FirePistol
-( player_t* player,
- pspdef_t* psp )
-{
- S_StartSound (player->mo, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- P_SetMobjState (player->mo, S_PLAY_06); // villsa [STRIFE] TODO - verify
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1);
-
- P_SetPsprite (player,
- ps_flash,
- weaponinfo[player->readyweapon].flashstate);
-
- P_BulletSlope (player->mo);
- P_GunShot (player->mo, !player->refire);
-}
-
-
-//
-// A_FireShotgun
-//
-void
-A_FireShotgun
-( player_t* player,
- pspdef_t* psp )
+void A_FireRifle(player_t* player, pspdef_t* pspr)
{
- int i;
-
- S_StartSound (player->mo, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- P_SetMobjState (player->mo, S_PLAY_06); // villsa [STRIFE] TODO - verify
+ S_StartSound(player->mo, sfx_rifle);
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1);
-
- P_SetPsprite (player,
- ps_flash,
- weaponinfo[player->readyweapon].flashstate);
-
- P_BulletSlope (player->mo);
-
- for (i=0 ; i<7 ; i++)
- P_GunShot (player->mo, false);
+ if(player->ammo[weaponinfo[player->readyweapon].ammo])
+ {
+ P_SetMobjState(player->mo, S_PLAY_06);
+ player->ammo[weaponinfo[player->readyweapon].ammo]--;
+ P_BulletSlope(player->mo);
+ P_GunShot(player->mo, !player->refire);
+ }
}
-
-
//
-// A_FireShotgun2
+// A_FireMauler1
+// villsa [STRIFE] - new codepointer
//
-void
-A_FireShotgun2
-( player_t* player,
- pspdef_t* psp )
+
+void A_FireMauler1(player_t* player, pspdef_t* pspr)
{
- int i;
- angle_t angle;
- int damage;
-
-
- S_StartSound (player->mo, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- P_SetMobjState (player->mo, S_PLAY_06); // villsa [STRIFE] TODO - verify
+ int i;
+ angle_t angle;
+ int damage;
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 2);
-
- P_SetPsprite (player,
- ps_flash,
- weaponinfo[player->readyweapon].flashstate);
-
- P_BulletSlope (player->mo);
-
- for (i=0 ; i<20 ; i++)
+ if(player->ammo[weaponinfo[player->readyweapon].ammo] > 20)
{
- damage = 5*(P_Random ()%3+1);
- angle = player->mo->angle;
- angle += (P_Random()-P_Random())<<19;
- P_LineAttack (player->mo,
- angle,
- MISSILERANGE,
- bulletslope + ((P_Random()-P_Random())<<5), damage);
+ player->ammo[weaponinfo[player->readyweapon].ammo] -= 20;
+ P_BulletSlope(player->mo);
+ S_StartSound(player->mo, sfx_pgrdat);
+
+ for(i = 0; i < 20; i++)
+ {
+ damage = 5*(P_Random ()%3+1);
+ angle = player->mo->angle;
+ angle += (P_Random()-P_Random())<<19;
+ P_LineAttack(player->mo, angle, MISSILERANGE,
+ bulletslope + ((P_Random()-P_Random())<<5), damage);
+ }
}
}
-
//
-// A_FireCGun
+// A_SigilSound
+// villsa [STRIFE] - new codepointer
//
-void
-A_FireCGun
-( player_t* player,
- pspdef_t* psp )
+
+void A_SigilSound(player_t* player, pspdef_t* pspr)
{
- S_StartSound (player->mo, sfx_swish); // villsa [STRIFE] TODO - fix sounds
+ S_StartSound(player->mo, sfx_siglup);
+ player->extralight = 2;
- if (!player->ammo[weaponinfo[player->readyweapon].ammo])
- return;
-
- P_SetMobjState (player->mo, S_PLAY_06); // villsa [STRIFE] TODO - verify
- DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1);
-
- /*P_SetPsprite (player,
- ps_flash,
- weaponinfo[player->readyweapon].flashstate
- + psp->state
- - &states[S_CHAIN1] );*/
-
- P_BulletSlope (player->mo);
-
- P_GunShot (player->mo, !player->refire);
}
-
//
// ?
//
@@ -804,114 +789,6 @@
{
player->extralight = 2;
}
-
-
-//
-// A_BFGSpray
-// Spawn a BFG explosion on every monster in view
-//
-void A_BFGSpray (mobj_t* mo)
-{
- // villsa [STRIFE] unused
-/* int i;
- int j;
- int damage;
- angle_t an;
-
- // offset angles from its attack angle
- for (i=0 ; i<40 ; i++)
- {
- an = mo->angle - ANG90/2 + ANG90/40*i;
-
- // mo->target is the originator (player)
- // of the missile
- P_AimLineAttack (mo->target, an, 16*64*FRACUNIT);
-
- if (!linetarget)
- continue;
-
- P_SpawnMobj (linetarget->x,
- linetarget->y,
- linetarget->z + (linetarget->height>>2),
- MT_EXTRABFG);
-
- damage = 0;
- for (j=0;j<15;j++)
- damage += (P_Random()&7) + 1;
-
- P_DamageMobj (linetarget, mo->target,mo->target, damage);
- }*/
-}
-
-
-//
-// A_BFGsound
-//
-void
-A_BFGsound
-( player_t* player,
- 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;
-}
-
//