From 25314c9979b17efbeb18f88cae70dd65d884a6d6 Mon Sep 17 00:00:00 2001 From: James Haley Date: Mon, 6 Sep 2010 21:50:32 +0000 Subject: Minor reformatting, added some comments, and fixed P_SpawnFacingMissile to return th. Subversion-branch: /branches/strife-branch Subversion-revision: 2022 --- src/strife/p_mobj.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'src/strife/p_mobj.c') diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c index d2c2e5de..a40e2e63 100644 --- a/src/strife/p_mobj.c +++ b/src/strife/p_mobj.c @@ -1118,10 +1118,10 @@ P_SpawnMissile // // P_SpawnFacingMissile +// // villsa [STRIFE] new function // Spawn a missile based on source's angle // - mobj_t* P_SpawnFacingMissile(mobj_t* source, mobj_t* target, mobjtype_t type) { mobj_t* th; @@ -1156,11 +1156,13 @@ mobj_t* P_SpawnFacingMissile(mobj_t* source, mobj_t* target, mobjtype_t type) th->momz = (target->z - source->z) / dist; P_CheckMissileSpawn (th); -} + return th; +} // // P_SpawnPlayerMissile +// // Tries to aim at a nearby monster // villsa [STRIFE] now returns a mobj // @@ -1180,26 +1182,26 @@ mobj_t* P_SpawnPlayerMissile(mobj_t* source, mobjtype_t type) if (!linetarget) { - an += 1<<26; - slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); + an += 1<<26; + slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); - if (!linetarget) - { - an -= 2<<26; - slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); - } + if (!linetarget) + { + an -= 2<<26; + slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); + } - if (!linetarget) - { - an = source->angle; - slope = 0; - } + if (!linetarget) + { + an = source->angle; + slope = 0; + } } // villsa [STRIFE] if(linetarget) source->target = linetarget; - + x = source->x; y = source->y; @@ -1208,18 +1210,18 @@ mobj_t* P_SpawnPlayerMissile(mobj_t* source, mobjtype_t type) z = source->z + 32*FRACUNIT; else z = source->z + 22*FRACUNIT; - + th = P_SpawnMobj (x,y,z, type); if (th->info->seesound) - S_StartSound (th, th->info->seesound); + S_StartSound (th, th->info->seesound); th->target = source; th->angle = an; th->momx = FixedMul( th->info->speed, - finecosine[an>>ANGLETOFINESHIFT]); + finecosine[an>>ANGLETOFINESHIFT]); th->momy = FixedMul( th->info->speed, - finesine[an>>ANGLETOFINESHIFT]); + finesine[an>>ANGLETOFINESHIFT]); th->momz = FixedMul( th->info->speed, slope); P_CheckMissileSpawn (th); -- cgit v1.2.3