2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_strifeglobal.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "templates.h"
|
2008-08-08 10:24:08 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Note: Strife missiles do 1-4 times their damage amount.
|
|
|
|
// Doom missiles do 1-8 times their damage amount, so to
|
|
|
|
// make the strife missiles do proper damage without
|
|
|
|
// hacking more stuff in the executable, be sure to give
|
|
|
|
// all Strife missiles the MF4_STRIFEDAMAGE flag.
|
|
|
|
|
|
|
|
static FRandom pr_jabdagger ("JabDagger");
|
|
|
|
static FRandom pr_electric ("FireElectric");
|
|
|
|
static FRandom pr_sgunshot ("StrifeGunShot");
|
|
|
|
static FRandom pr_minimissile ("MiniMissile");
|
|
|
|
static FRandom pr_flamethrower ("FlameThrower");
|
|
|
|
static FRandom pr_flamedie ("FlameDie");
|
|
|
|
static FRandom pr_mauler1 ("Mauler1");
|
|
|
|
static FRandom pr_mauler2 ("Mauler2");
|
|
|
|
static FRandom pr_phburn ("PhBurn");
|
|
|
|
|
|
|
|
void A_LoopActiveSound (AActor *);
|
|
|
|
void A_Countdown (AActor *);
|
|
|
|
|
|
|
|
// Punch Dagger -------------------------------------------------------------
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// P_DaggerAlert
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void P_DaggerAlert (AActor *target, AActor *emitter)
|
|
|
|
{
|
|
|
|
AActor *looker;
|
|
|
|
sector_t *sec = emitter->Sector;
|
|
|
|
|
|
|
|
if (emitter->LastHeard != NULL)
|
|
|
|
return;
|
|
|
|
if (emitter->health <= 0)
|
|
|
|
return;
|
|
|
|
if (!(emitter->flags3 & MF3_ISMONSTER))
|
|
|
|
return;
|
|
|
|
if (emitter->flags4 & MF4_INCOMBAT)
|
|
|
|
return;
|
|
|
|
emitter->flags4 |= MF4_INCOMBAT;
|
|
|
|
|
|
|
|
emitter->target = target;
|
2006-10-31 14:53:21 +00:00
|
|
|
FState * painstate = emitter->FindState(NAME_Pain);
|
|
|
|
if (painstate != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-10-31 14:53:21 +00:00
|
|
|
emitter->SetState (painstate);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (looker = sec->thinglist; looker != NULL; looker = looker->snext)
|
|
|
|
{
|
|
|
|
if (looker == emitter || looker == target)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (looker->health <= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!(looker->flags4 & MF4_SEESDAGGERS))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!(looker->flags4 & MF4_INCOMBAT))
|
|
|
|
{
|
|
|
|
if (!P_CheckSight (looker, target) && !P_CheckSight (looker, emitter))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
looker->target = target;
|
|
|
|
if (looker->SeeSound)
|
|
|
|
{
|
2008-06-15 02:25:09 +00:00
|
|
|
S_Sound (looker, CHAN_VOICE, looker->SeeSound, 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
looker->SetState (looker->SeeState);
|
|
|
|
looker->flags4 |= MF4_INCOMBAT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_JabDagger
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_JabDagger)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
|
|
|
int pitch;
|
|
|
|
int power;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-03-11 09:08:35 +00:00
|
|
|
power = MIN(10, self->player->mo->stamina / 10);
|
2006-04-10 21:54:50 +00:00
|
|
|
damage = (pr_jabdagger() % (power + 8)) * (power + 2);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->FindInventory<APowerStrength>())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
damage *= 10;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
angle = self->angle + (pr_jabdagger.Random2() << 18);
|
|
|
|
pitch = P_AimLineAttack (self, angle, 80*FRACUNIT, &linetarget);
|
2010-06-13 11:14:01 +00:00
|
|
|
P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// turn to face target
|
|
|
|
if (linetarget)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON,
|
2006-02-24 04:48:15 +00:00
|
|
|
linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit",
|
|
|
|
1, ATTN_NORM);
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle = R_PointToAngle2 (self->x,
|
|
|
|
self->y,
|
2006-02-24 04:48:15 +00:00
|
|
|
linetarget->x,
|
|
|
|
linetarget->y);
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_JUSTATTACKED;
|
|
|
|
P_DaggerAlert (self, linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, "misc/swish", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_AlertMonsters
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2011-06-13 10:30:30 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-06-13 10:30:30 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_FIXED(maxdist, 0);
|
|
|
|
|
2006-07-30 08:31:26 +00:00
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
2011-06-13 10:30:30 +00:00
|
|
|
P_NoiseAlert(self, self, false, maxdist);
|
2006-07-30 08:31:26 +00:00
|
|
|
}
|
|
|
|
else if (self->target != NULL && self->target->player != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2011-06-13 10:30:30 +00:00
|
|
|
P_NoiseAlert (self->target, self, false, maxdist);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Poison Bolt --------------------------------------------------------------
|
|
|
|
|
|
|
|
class APoisonBolt : public AActor
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
DECLARE_CLASS (APoisonBolt, AActor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
int DoSpecialDamage (AActor *target, int damage);
|
|
|
|
};
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
IMPLEMENT_CLASS (APoisonBolt)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
int APoisonBolt::DoSpecialDamage (AActor *target, int damage)
|
|
|
|
{
|
|
|
|
if (target->flags & MF_NOBLOOD)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (target->health < 1000000)
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
if (!(target->flags2 & MF2_BOSS))
|
|
|
|
return target->health + 10;
|
|
|
|
else
|
|
|
|
return 50;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Strife's Crossbow --------------------------------------------------------
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_ClearFlash
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player = self->player;
|
|
|
|
|
|
|
|
if (player == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
P_SetPsprite (player, ps_flash, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_ShowElectricFlash
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
P_SetPsprite (self->player, ps_flash, self->player->ReadyWeapon->FindState(NAME_Flash));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireElectric
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t savedangle;
|
|
|
|
|
2008-08-13 22:54:24 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_CLASS(ti, 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (self->player == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-08 07:40:41 +00:00
|
|
|
if (ti)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
savedangle = self->angle;
|
2012-03-11 09:08:35 +00:00
|
|
|
self->angle += pr_electric.Random2 () << (18 - self->player->mo->accuracy * 5 / 100);
|
2008-08-08 07:40:41 +00:00
|
|
|
self->player->mo->PlayAttacking2 ();
|
|
|
|
P_SpawnPlayerMissile (self, ti);
|
|
|
|
self->angle = savedangle;
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/xbowshoot", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assault Gun --------------------------------------------------------------
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// P_StrifeGunShot
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-04-10 14:38:43 +00:00
|
|
|
void P_StrifeGunShot (AActor *mo, bool accurate, angle_t pitch)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
|
|
|
|
|
|
|
damage = 4*(pr_sgunshot()%3+1);
|
|
|
|
angle = mo->angle;
|
|
|
|
|
|
|
|
if (mo->player != NULL && !accurate)
|
|
|
|
{
|
2012-03-11 09:08:35 +00:00
|
|
|
angle += pr_sgunshot.Random2() << (20 - mo->player->mo->accuracy * 5 / 100);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-08 10:24:08 +00:00
|
|
|
P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, NAME_StrifePuff);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireAssaultGun
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireAssaultGun)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
bool accurate;
|
|
|
|
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/assaultgun", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self->player->mo->PlayAttacking2 ();
|
|
|
|
accurate = !self->player->refire;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
accurate = true;
|
|
|
|
}
|
|
|
|
|
2008-04-10 14:38:43 +00:00
|
|
|
P_StrifeGunShot (self, accurate, P_BulletSlope (self));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Mini-Missile Launcher ----------------------------------------------------
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireMiniMissile
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player = self->player;
|
|
|
|
angle_t savedangle;
|
|
|
|
|
|
|
|
if (self->player == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
savedangle = self->angle;
|
2012-03-11 09:08:35 +00:00
|
|
|
self->angle += pr_minimissile.Random2() << (19 - player->mo->accuracy * 5 / 100);
|
2006-02-24 04:48:15 +00:00
|
|
|
player->mo->PlayAttacking2 ();
|
2008-08-08 10:24:08 +00:00
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("MiniMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
self->angle = savedangle;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_RocketInFlight
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *trail;
|
|
|
|
|
|
|
|
S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM);
|
2008-08-08 10:24:08 +00:00
|
|
|
P_SpawnPuff (self, PClass::FindClass("MiniMissilePuff"), self->x, self->y, self->z, self->angle - ANGLE_180, 2, PF_HITTHING);
|
2009-06-30 20:57:51 +00:00
|
|
|
trail = Spawn("RocketTrail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (trail != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
trail->velz = FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Flame Thrower ------------------------------------------------------------
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FlameDie
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FlameDie)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
self->flags |= MF_NOGRAVITY;
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz = (pr_flamedie() & 3) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireFlamer
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireFlamer)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player = self->player;
|
|
|
|
|
|
|
|
if (player != NULL)
|
|
|
|
{
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
player->mo->PlayAttacking2 ();
|
|
|
|
}
|
|
|
|
|
|
|
|
self->angle += pr_flamethrower.Random2() << 18;
|
2008-08-08 10:24:08 +00:00
|
|
|
self = P_SpawnPlayerMissile (self, PClass::FindClass("FlameMissile"));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (self != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz += 5*FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mauler -------------------------------------------------------------------
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireMauler1
|
|
|
|
//
|
|
|
|
// Hey! This is exactly the same as a super shotgun except for the sound
|
|
|
|
// and the bullet puffs and the disintegration death.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Strife apparently didn't show the player shooting. Let's fix that.
|
|
|
|
self->player->mo->PlayAttacking2 ();
|
|
|
|
}
|
|
|
|
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/mauler1", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
|
2008-04-10 14:38:43 +00:00
|
|
|
int bpitch = P_BulletSlope (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 20; ++i)
|
|
|
|
{
|
|
|
|
int damage = 5 * (pr_mauler1() % 3 + 1);
|
|
|
|
angle_t angle = self->angle + (pr_mauler1.Random2() << 19);
|
2008-04-10 14:38:43 +00:00
|
|
|
int pitch = bpitch + (pr_mauler1.Random2() * 332063);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Strife used a range of 2112 units for the mauler to signal that
|
|
|
|
// it should use a different puff. ZDoom's default range is longer
|
|
|
|
// than this, so let's not handicap it by being too faithful to the
|
|
|
|
// original.
|
2009-12-16 16:09:48 +00:00
|
|
|
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, NAME_MaulerPuff);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireMauler2Pre
|
|
|
|
//
|
|
|
|
// Makes some noise and moves the psprite.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2Pre)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/mauler2charge", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
|
|
|
self->player->psprites[ps_weapon].sx += pr_mauler2.Random2() << 10;
|
|
|
|
self->player->psprites[ps_weapon].sy += pr_mauler2.Random2() << 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireMauler2Pre
|
|
|
|
//
|
|
|
|
// Fires the torpedo.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
if (weapon != NULL)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self->player->mo->PlayAttacking2 ();
|
|
|
|
}
|
2008-08-08 10:24:08 +00:00
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("MaulerTorpedo"));
|
2006-02-24 04:48:15 +00:00
|
|
|
P_DamageMobj (self, self, NULL, 20, self->DamageType);
|
|
|
|
P_ThrustMobj (self, self->angle + ANGLE_180, 0x7D000);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_MaulerTorpedoWave
|
|
|
|
//
|
|
|
|
// Launches lots of balls when the torpedo hits something.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-05 22:51:51 +00:00
|
|
|
AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-08 10:24:08 +00:00
|
|
|
AActor *wavedef = GetDefaultByName("MaulerTorpedoWave");
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t savedz;
|
|
|
|
self->angle += ANGLE_180;
|
|
|
|
|
|
|
|
// If the torpedo hit the ceiling, it should still spawn the wave
|
|
|
|
savedz = self->z;
|
2008-08-08 10:24:08 +00:00
|
|
|
if (wavedef && self->ceilingz - self->z < wavedef->height)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-08 10:24:08 +00:00
|
|
|
self->z = self->ceilingz - wavedef->height;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 80; ++i)
|
|
|
|
{
|
|
|
|
self->angle += ANGLE_45/10;
|
2008-08-08 10:24:08 +00:00
|
|
|
P_SpawnSubMissile (self, PClass::FindClass("MaulerTorpedoWave"), self->target);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
self->z = savedz;
|
|
|
|
}
|
|
|
|
|
2008-08-05 22:51:51 +00:00
|
|
|
AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-07-16 09:10:45 +00:00
|
|
|
AActor *other = Spawn (type, source->x, source->y, source->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (other == NULL)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
other->target = target;
|
|
|
|
other->angle = source->angle;
|
|
|
|
|
2009-06-30 20:57:51 +00:00
|
|
|
other->velx = FixedMul (other->Speed, finecosine[source->angle >> ANGLETOFINESHIFT]);
|
|
|
|
other->vely = FixedMul (other->Speed, finesine[source->angle >> ANGLETOFINESHIFT]);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-12 10:59:36 +00:00
|
|
|
if (other->flags4 & MF4_SPECTRAL)
|
|
|
|
{
|
|
|
|
if (source->flags & MF_MISSILE && source->flags4 & MF4_SPECTRAL)
|
|
|
|
{
|
2012-05-13 11:17:27 +00:00
|
|
|
other->FriendPlayer = source->FriendPlayer;
|
2008-07-12 10:59:36 +00:00
|
|
|
}
|
|
|
|
else if (target->player != NULL)
|
|
|
|
{
|
2012-05-13 11:17:27 +00:00
|
|
|
other->FriendPlayer = int(target->player - players) + 1;
|
2008-07-12 10:59:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-13 11:17:27 +00:00
|
|
|
other->FriendPlayer = 0;
|
2008-07-12 10:59:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (P_CheckMissileSpawn (other))
|
|
|
|
{
|
|
|
|
angle_t pitch = P_AimLineAttack (source, source->angle, 1024*FRACUNIT);
|
2009-06-30 20:57:51 +00:00
|
|
|
other->velz = FixedMul (-finesine[pitch>>ANGLETOFINESHIFT], other->Speed);
|
2006-02-24 04:48:15 +00:00
|
|
|
return other;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-08-08 10:24:08 +00:00
|
|
|
class APhosphorousFire : public AActor
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (APhosphorousFire, AActor)
|
|
|
|
public:
|
|
|
|
int DoSpecialDamage (AActor *target, int damage);
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_CLASS (APhosphorousFire)
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
int APhosphorousFire::DoSpecialDamage (AActor *target, int damage)
|
|
|
|
{
|
|
|
|
if (target->flags & MF_NOBLOOD)
|
|
|
|
{
|
|
|
|
return damage / 2;
|
|
|
|
}
|
|
|
|
return Super::DoSpecialDamage (target, damage);
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BurnArea)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-08-10 21:03:17 +00:00
|
|
|
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
self->velz -= 8*FRACUNIT;
|
|
|
|
self->velx += (pr_phburn.Random2 (3)) << FRACBITS;
|
|
|
|
self->vely += (pr_phburn.Random2 (3)) << FRACBITS;
|
2006-02-24 04:48:15 +00:00
|
|
|
S_Sound (self, CHAN_VOICE, "world/largefire", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
// Only the main fire spawns more.
|
|
|
|
if (!(self->flags & MF_DROPPED))
|
|
|
|
{
|
|
|
|
// Original x and y offsets seemed to be like this:
|
|
|
|
// x + (((pr_phburn() + 12) & 31) << FRACBITS);
|
|
|
|
//
|
|
|
|
// But that creates a lop-sided burn because it won't use negative offsets.
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
int xofs, xrand = pr_phburn();
|
|
|
|
int yofs, yrand = pr_phburn();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
// Adding 12 is pointless if you're going to mask it afterward.
|
|
|
|
xofs = xrand & 31;
|
|
|
|
if (xrand & 128)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
xofs = -xofs;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
yofs = yrand & 31;
|
|
|
|
if (yrand & 128)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
yofs = -yofs;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2006-04-11 16:27:41 +00:00
|
|
|
fixed_t x = self->x + (xofs << FRACBITS);
|
|
|
|
fixed_t y = self->y + (yofs << FRACBITS);
|
2007-12-25 10:25:43 +00:00
|
|
|
sector_t * sector = P_PointInSector(x, y);
|
2006-04-11 16:27:41 +00:00
|
|
|
|
|
|
|
// The sector's floor is too high so spawn the flame elsewhere.
|
|
|
|
if (sector->floorplane.ZatPoint(x, y) > self->z + self->MaxStepHeight)
|
|
|
|
{
|
|
|
|
x = self->x;
|
|
|
|
y = self->y;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
AActor *drop = Spawn<APhosphorousFire> (
|
2006-04-11 16:27:41 +00:00
|
|
|
x, y,
|
2006-07-16 09:10:45 +00:00
|
|
|
self->z + 4*FRACUNIT, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (drop != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
drop->velx = self->velx + ((pr_phburn.Random2 (7)) << FRACBITS);
|
|
|
|
drop->vely = self->vely + ((pr_phburn.Random2 (7)) << FRACBITS);
|
|
|
|
drop->velz = self->velz - FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
drop->reactiontime = (pr_phburn() & 3) + 2;
|
|
|
|
drop->flags |= MF_DROPPED;
|
|
|
|
}
|
|
|
|
}
|
2011-06-13 10:30:30 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireGrenade
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player = self->player;
|
|
|
|
AActor *grenade;
|
|
|
|
angle_t an;
|
|
|
|
fixed_t tworadii;
|
|
|
|
AWeapon *weapon;
|
|
|
|
|
2008-08-13 22:54:24 +00:00
|
|
|
ACTION_PARAM_START(3);
|
|
|
|
ACTION_PARAM_CLASS(grenadetype, 0);
|
|
|
|
ACTION_PARAM_ANGLE(Angle, 1);
|
|
|
|
ACTION_PARAM_STATE(flash, 2);
|
2008-08-08 07:40:41 +00:00
|
|
|
|
2008-08-13 22:54:24 +00:00
|
|
|
if (player == NULL || grenadetype == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if ((weapon = player->ReadyWeapon) == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
|
|
|
return;
|
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
P_SetPsprite (player, ps_flash, flash);
|
2008-08-08 07:40:41 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
if (grenadetype != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-10-25 17:38:00 +00:00
|
|
|
self->z += 32*FRACUNIT;
|
|
|
|
grenade = P_SpawnSubMissile (self, grenadetype, self);
|
|
|
|
self->z -= 32*FRACUNIT;
|
|
|
|
if (grenade == NULL)
|
|
|
|
return;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
if (grenade->SeeSound != 0)
|
|
|
|
{
|
|
|
|
S_Sound (grenade, CHAN_VOICE, grenade->SeeSound, 1, ATTN_NORM);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-06-30 20:57:51 +00:00
|
|
|
grenade->velz = FixedMul (finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], grenade->Speed) + 8*FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
an = self->angle >> ANGLETOFINESHIFT;
|
|
|
|
tworadii = self->radius + grenade->radius;
|
|
|
|
grenade->x += FixedMul (finecosine[an], tworadii);
|
|
|
|
grenade->y += FixedMul (finesine[an], tworadii);
|
|
|
|
|
|
|
|
an = self->angle + Angle;
|
|
|
|
an >>= ANGLETOFINESHIFT;
|
|
|
|
grenade->x += FixedMul (finecosine[an], 15*FRACUNIT);
|
|
|
|
grenade->y += FixedMul (finesine[an], 15*FRACUNIT);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The Almighty Sigil! ------------------------------------------------------
|
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
IMPLEMENT_CLASS(ASigil)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// ASigil :: Serialize
|
|
|
|
//
|
|
|
|
//============================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-08 19:47:18 +00:00
|
|
|
void ASigil::BeginPlay()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
NumPieces = health;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// ASigil :: Serialize
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void ASigil::Serialize (FArchive &arc)
|
|
|
|
{
|
|
|
|
Super::Serialize (arc);
|
|
|
|
arc << NumPieces << DownPieces;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// ASigil :: HandlePickup
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
bool ASigil::HandlePickup (AInventory *item)
|
|
|
|
{
|
|
|
|
if (item->IsKindOf (RUNTIME_CLASS(ASigil)))
|
|
|
|
{
|
|
|
|
int otherPieces = static_cast<ASigil*>(item)->NumPieces;
|
|
|
|
if (otherPieces > NumPieces)
|
|
|
|
{
|
|
|
|
item->ItemFlags |= IF_PICKUPGOOD;
|
|
|
|
Icon = item->Icon;
|
|
|
|
// If the player is holding the Sigil right now, drop it and bring
|
|
|
|
// it back with the new piece(s) in view.
|
|
|
|
if (Owner->player != NULL && Owner->player->ReadyWeapon == this)
|
|
|
|
{
|
|
|
|
DownPieces = NumPieces;
|
|
|
|
Owner->player->PendingWeapon = this;
|
|
|
|
}
|
|
|
|
NumPieces = otherPieces;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (Inventory != NULL)
|
|
|
|
{
|
|
|
|
return Inventory->HandlePickup (item);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// ASigil :: CreateCopy
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
AInventory *ASigil::CreateCopy (AActor *other)
|
|
|
|
{
|
2006-07-16 09:10:45 +00:00
|
|
|
ASigil *copy = Spawn<ASigil> (0,0,0, NO_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
copy->Amount = Amount;
|
|
|
|
copy->MaxAmount = MaxAmount;
|
|
|
|
copy->NumPieces = NumPieces;
|
|
|
|
copy->Icon = Icon;
|
|
|
|
GoAwayAndDie ();
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SelectPiece
|
|
|
|
//
|
|
|
|
// Decide which sprite frame this Sigil should use as an item, based on how
|
|
|
|
// many pieces it represents.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SelectPiece)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int pieces = MIN (static_cast<ASigil*>(self)->NumPieces, 5);
|
|
|
|
|
|
|
|
if (pieces > 1)
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
self->SetState (self->FindState("Spawn")+pieces);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SelectSigilView
|
|
|
|
//
|
|
|
|
// Decide which first-person frame this Sigil should show, based on how many
|
|
|
|
// pieces it represents. Strife did this by selecting a flash that looked like
|
|
|
|
// the Sigil whenever you switched to it and at the end of an attack. I have
|
|
|
|
// chosen to make the weapon sprite choose the correct frame and let the flash
|
|
|
|
// be a regular flash. It means I need to use more states, but I think it's
|
|
|
|
// worth it.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilView)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int pieces;
|
|
|
|
|
|
|
|
if (self->player == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pieces = static_cast<ASigil*>(self->player->ReadyWeapon)->NumPieces;
|
|
|
|
P_SetPsprite (self->player, ps_weapon,
|
|
|
|
self->player->psprites[ps_weapon].state + pieces);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SelectSigilDown
|
|
|
|
//
|
|
|
|
// Same as A_SelectSigilView, except it uses DownPieces. This is so that when
|
|
|
|
// you pick up a Sigil, the old one will drop and *then* change to the new
|
|
|
|
// one.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilDown)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int pieces;
|
|
|
|
|
|
|
|
if (self->player == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pieces = static_cast<ASigil*>(self->player->ReadyWeapon)->DownPieces;
|
|
|
|
static_cast<ASigil*>(self->player->ReadyWeapon)->DownPieces = 0;
|
|
|
|
if (pieces == 0)
|
|
|
|
{
|
|
|
|
pieces = static_cast<ASigil*>(self->player->ReadyWeapon)->NumPieces;
|
|
|
|
}
|
|
|
|
P_SetPsprite (self->player, ps_weapon,
|
|
|
|
self->player->psprites[ps_weapon].state + pieces);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SelectSigilAttack
|
|
|
|
//
|
|
|
|
// Same as A_SelectSigilView, but used just before attacking.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int pieces;
|
|
|
|
|
|
|
|
if (self->player == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pieces = static_cast<ASigil*>(self->player->ReadyWeapon)->NumPieces;
|
|
|
|
P_SetPsprite (self->player, ps_weapon,
|
|
|
|
self->player->psprites[ps_weapon].state + 4*pieces - 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SigilCharge
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SigilCharge)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
|
|
|
|
if (self->player != NULL)
|
|
|
|
{
|
|
|
|
self->player->extralight = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_LightInverse
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_LightInverse)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->player != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->player->extralight = INT_MIN;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireSigil1
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *spot;
|
2008-08-10 20:48:55 +00:00
|
|
|
player_t *player = self->player;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (player == NULL || player->ReadyWeapon == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DamageMobj (self, self, NULL, 1*4, 0, DMG_NO_ARMOR);
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_BulletSlope (self, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (linetarget != NULL)
|
|
|
|
{
|
2009-01-03 18:09:33 +00:00
|
|
|
spot = Spawn("SpectralLightningSpot", linetarget->x, linetarget->y, linetarget->floorz, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spot != NULL)
|
|
|
|
{
|
|
|
|
spot->tracer = linetarget;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
spot = Spawn("SpectralLightningSpot", self->x, self->y, self->z, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spot != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
spot->velx += 28 * finecosine[self->angle >> ANGLETOFINESHIFT];
|
|
|
|
spot->vely += 28 * finesine[self->angle >> ANGLETOFINESHIFT];
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (spot != NULL)
|
|
|
|
{
|
2012-05-13 11:17:27 +00:00
|
|
|
spot->FriendPlayer = int(player-players)+1;
|
2008-08-10 20:48:55 +00:00
|
|
|
spot->target = self;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireSigil2
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
player_t *player = self->player;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (player == NULL || player->ReadyWeapon == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DamageMobj (self, self, NULL, 2*4, 0, DMG_NO_ARMOR);
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("SpectralLightningH1"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireSigil3
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *spot;
|
2008-08-10 20:48:55 +00:00
|
|
|
player_t *player = self->player;
|
2006-02-24 04:48:15 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (player == NULL || player->ReadyWeapon == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DamageMobj (self, self, NULL, 3*4, 0, DMG_NO_ARMOR);
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle -= ANGLE_90;
|
2006-02-24 04:48:15 +00:00
|
|
|
for (i = 0; i < 20; ++i)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle += ANGLE_180/20;
|
|
|
|
spot = P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall1"), self);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spot != NULL)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
spot->z = self->z + 32*FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
self->angle -= (ANGLE_180/20)*10;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireSigil4
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AActor *spot;
|
2008-08-10 20:48:55 +00:00
|
|
|
player_t *player = self->player;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (player == NULL || player->ReadyWeapon == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DamageMobj (self, self, NULL, 4*4, 0, DMG_NO_ARMOR);
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_BulletSlope (self, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (linetarget != NULL)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
spot = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindClass("SpectralLightningBigV1"), self->angle, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spot != NULL)
|
|
|
|
{
|
|
|
|
spot->tracer = linetarget;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
spot = P_SpawnPlayerMissile (self, PClass::FindClass("SpectralLightningBigV1"));
|
2006-02-24 04:48:15 +00:00
|
|
|
if (spot != NULL)
|
|
|
|
{
|
2009-06-30 20:57:51 +00:00
|
|
|
spot->velx += FixedMul (spot->Speed, finecosine[self->angle >> ANGLETOFINESHIFT]);
|
|
|
|
spot->vely += FixedMul (spot->Speed, finesine[self->angle >> ANGLETOFINESHIFT]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FireSigil5
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil5)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
player_t *player = self->player;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (player == NULL || player->ReadyWeapon == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DamageMobj (self, self, NULL, 5*4, 0, DMG_NO_ARMOR);
|
|
|
|
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
P_SpawnPlayerMissile (self, PClass::FindClass("SpectralLightningBigBall1"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// ASigil :: SpecialDropAction
|
|
|
|
//
|
|
|
|
// Monsters don't drop Sigil pieces. The Sigil pieces grab hold of the person
|
|
|
|
// who killed the dropper and automatically enter their inventory. That's the
|
|
|
|
// way it works if you believe Macil, anyway...
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
bool ASigil::SpecialDropAction (AActor *dropper)
|
|
|
|
{
|
|
|
|
// Give a Sigil piece to every player in the game
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].mo != NULL)
|
|
|
|
{
|
|
|
|
GiveSigilPiece (players[i].mo);
|
|
|
|
Destroy ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// ASigil :: GiveSigilPiece
|
|
|
|
//
|
|
|
|
// Gives the actor another Sigil piece, up to 5. Returns the number of Sigil
|
|
|
|
// pieces the actor previously held.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
int ASigil::GiveSigilPiece (AActor *receiver)
|
|
|
|
{
|
|
|
|
ASigil *sigil;
|
|
|
|
|
|
|
|
sigil = receiver->FindInventory<ASigil> ();
|
|
|
|
if (sigil == NULL)
|
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
sigil = static_cast<ASigil*>(Spawn("Sigil1", 0,0,0, NO_REPLACE));
|
2008-09-13 22:08:41 +00:00
|
|
|
if (!sigil->CallTryPickup (receiver))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
sigil->Destroy ();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (sigil->NumPieces < 5)
|
|
|
|
{
|
|
|
|
++sigil->NumPieces;
|
2008-08-08 19:47:18 +00:00
|
|
|
static const char* sigils[5] =
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-08 19:47:18 +00:00
|
|
|
"Sigil1", "Sigil2", "Sigil3", "Sigil4", "Sigil5"
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
2008-08-08 19:47:18 +00:00
|
|
|
sigil->Icon = ((AInventory*)GetDefaultByName (sigils[MAX(0,sigil->NumPieces-1)]))->Icon;
|
2006-02-24 04:48:15 +00:00
|
|
|
// If the player has the Sigil out, drop it and bring it back up.
|
|
|
|
if (sigil->Owner->player != NULL && sigil->Owner->player->ReadyWeapon == sigil)
|
|
|
|
{
|
|
|
|
sigil->Owner->player->PendingWeapon = sigil;
|
|
|
|
sigil->DownPieces = sigil->NumPieces - 1;
|
|
|
|
}
|
|
|
|
return sigil->NumPieces - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
}
|