- Converted the ScriptedMarines to DECORATE.

- Fixed: DLightTransfer and DWallLightTransfer were declared as actors.

SVN r1111 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-05 13:50:57 +00:00
parent d5cc9e01d0
commit 4a9e70f1d2
9 changed files with 449 additions and 481 deletions

View file

@ -1,3 +1,7 @@
August 5, 2008 (Changes by Graf Zahl)
- Converted the ScriptedMarines to DECORATE.
- Fixed: DLightTransfer and DWallLightTransfer were declared as actors.
August 3, 2008 (Changes by Graf Zahl)
- Converted the PhoenixRod and associated classes to DECORATE to make
the Heretic conversion complete.

View file

@ -512,14 +512,12 @@ add_executable( zdoom WIN32
g_hexen/a_blastradius.cpp
g_hexen/a_boostarmor.cpp
g_hexen/a_centaur.cpp
g_hexen/a_clericboss.cpp
g_hexen/a_clericflame.cpp
g_hexen/a_clericholy.cpp
g_hexen/a_clericmace.cpp
g_hexen/a_clericstaff.cpp
g_hexen/a_dragon.cpp
g_hexen/a_fighteraxe.cpp
g_hexen/a_fighterboss.cpp
g_hexen/a_fighterhammer.cpp
g_hexen/a_fighterplayer.cpp
g_hexen/a_fighterquietus.cpp
@ -531,7 +529,6 @@ add_executable( zdoom WIN32
g_hexen/a_hexenspecialdecs.cpp
g_hexen/a_iceguy.cpp
g_hexen/a_korax.cpp
g_hexen/a_mageboss.cpp
g_hexen/a_magecone.cpp
g_hexen/a_magelightning.cpp
g_hexen/a_magestaff.cpp

View file

@ -109,6 +109,23 @@ ACTOR(ResetReloadCounter)
ACTOR(ClearReFire)
ACTOR(SpawnSingleItem)
ACTOR(M_Refire)
ACTOR(M_CheckAttack)
ACTOR(MarineChase)
ACTOR(MarineLook)
ACTOR(MarineNoise)
ACTOR(M_Punch)
ACTOR(M_SawRefire)
ACTOR(M_FirePistol)
ACTOR(M_FireShotgun)
ACTOR(M_FireShotgun2)
ACTOR(M_FireCGun)
ACTOR(M_FireMissile)
ACTOR(M_FirePlasma)
ACTOR(M_FireRailgun)
ACTOR(M_BFGsound)
ACTOR(M_FireBFG)
// Heretic stuff
ACTOR(Feathers)
ACTOR(BeakRaise)

View file

@ -7,7 +7,7 @@
class AScriptedMarine : public AActor
{
DECLARE_ACTOR (AScriptedMarine, AActor)
DECLARE_CLASS (AScriptedMarine, AActor)
public:
enum EMarineWeapon
{
@ -33,7 +33,11 @@ public:
void SetSprite (const PClass *source);
void Serialize (FArchive &arc);
int CurrentWeapon;
protected:
bool GetWeaponStates(int weap, FState *&melee, FState *&missile);
int SpriteOverride;
};

View file

@ -7,6 +7,7 @@
#include "a_doomglobal.h"
#include "s_sound.h"
#include "r_translate.h"
#include "thingdef/thingdef.h"
#define MARINE_PAIN_CHANCE 160
@ -16,188 +17,7 @@ static FRandom pr_m_gunshot ("SMarineGunshot");
static FRandom pr_m_saw ("SMarineSaw");
static FRandom pr_m_fireshotgun2 ("SMarineFireSSG");
void A_MarineLook (AActor *);
void A_MarineNoise (AActor *);
void A_MarineChase (AActor *);
void A_M_Refire (AActor *);
void A_M_SawRefire (AActor *);
void A_M_Saw (AActor *);
void A_M_Punch (AActor *);
void A_M_BerserkPunch (AActor *);
void A_M_FirePistol (AActor *);
void A_M_FirePistolInaccurate (AActor *);
void A_M_FireShotgun (AActor *);
void A_M_CheckAttack (AActor *);
void A_M_FireShotgun2 (AActor *);
void A_M_FireCGunAccurate (AActor *);
void A_M_FireCGun (AActor *);
void A_M_FireMissile (AActor *);
void A_M_FireRailgun (AActor *);
void A_M_FirePlasma (AActor *);
void A_M_BFGsound (AActor *);
void A_M_FireBFG (AActor *);
// Scriptable marine -------------------------------------------------------
FState AScriptedMarine::States[] =
{
#define S_MPLAYSTILL 0
S_NORMAL (PLAY, 'A', 4, A_MarineLook , &States[S_MPLAYSTILL+1]),
S_NORMAL (PLAY, 'A', 4, A_MarineNoise , &States[S_MPLAYSTILL]),
#define S_MPLAY (S_MPLAYSTILL+2)
S_NORMAL (PLAY, 'A', 4, A_MarineLook , &States[S_MPLAY+1]),
S_NORMAL (PLAY, 'A', 4, A_MarineNoise , &States[S_MPLAY+2]),
S_NORMAL (PLAY, 'A', 4, A_MarineLook , &States[S_MPLAY+3]),
S_NORMAL (PLAY, 'B', 4, A_MarineNoise , &States[S_MPLAY+4]),
S_NORMAL (PLAY, 'B', 4, A_MarineLook , &States[S_MPLAY+5]),
S_NORMAL (PLAY, 'B', 4, A_MarineNoise , &States[S_MPLAY]),
#define S_MPLAY_RUN (S_MPLAY+6)
S_NORMAL (PLAY, 'A', 4, A_MarineChase , &States[S_MPLAY_RUN+1]),
S_NORMAL (PLAY, 'B', 4, A_MarineChase , &States[S_MPLAY_RUN+2]),
S_NORMAL (PLAY, 'C', 4, A_MarineChase , &States[S_MPLAY_RUN+3]),
S_NORMAL (PLAY, 'D', 4, A_MarineChase , &States[S_MPLAY_RUN+0]),
#define S_MPLAY_ATK (S_MPLAY_RUN+4)
S_NORMAL (PLAY, 'E', 12, A_FaceTarget , &States[S_MPLAY]),
S_BRIGHT (PLAY, 'F', 6, NULL , &States[S_MPLAY_ATK+0]),
#define S_MPLAY_PAIN (S_MPLAY_ATK+2)
S_NORMAL (PLAY, 'G', 4, NULL , &States[S_MPLAY_PAIN+1]),
S_NORMAL (PLAY, 'G', 4, A_Pain , &States[S_MPLAY]),
#define S_MPLAY_DIE (S_MPLAY_PAIN+2)
S_NORMAL (PLAY, 'H', 10, NULL , &States[S_MPLAY_DIE+1]),
S_NORMAL (PLAY, 'I', 10, A_Scream , &States[S_MPLAY_DIE+2]),
S_NORMAL (PLAY, 'J', 10, A_NoBlocking , &States[S_MPLAY_DIE+3]),
S_NORMAL (PLAY, 'K', 10, NULL , &States[S_MPLAY_DIE+4]),
S_NORMAL (PLAY, 'L', 10, NULL , &States[S_MPLAY_DIE+5]),
S_NORMAL (PLAY, 'M', 10, NULL , &States[S_MPLAY_DIE+6]),
S_NORMAL (PLAY, 'N', -1, NULL , NULL),
#define S_MPLAY_XDIE (S_MPLAY_DIE+7)
S_NORMAL (PLAY, 'O', 5, NULL , &States[S_MPLAY_XDIE+1]),
S_NORMAL (PLAY, 'P', 5, A_XScream , &States[S_MPLAY_XDIE+2]),
S_NORMAL (PLAY, 'Q', 5, A_NoBlocking , &States[S_MPLAY_XDIE+3]),
S_NORMAL (PLAY, 'R', 5, NULL , &States[S_MPLAY_XDIE+4]),
S_NORMAL (PLAY, 'S', 5, NULL , &States[S_MPLAY_XDIE+5]),
S_NORMAL (PLAY, 'T', 5, NULL , &States[S_MPLAY_XDIE+6]),
S_NORMAL (PLAY, 'U', 5, NULL , &States[S_MPLAY_XDIE+7]),
S_NORMAL (PLAY, 'V', 5, NULL , &States[S_MPLAY_XDIE+8]),
S_NORMAL (PLAY, 'W', -1, NULL , NULL),
#define S_MPLAY_RAISE (S_MPLAY_XDIE+9)
S_NORMAL (PLAY, 'M', 5, NULL , &States[S_MPLAY_RAISE+1]),
S_NORMAL (PLAY, 'L', 5, NULL , &States[S_MPLAY_RAISE+2]),
S_NORMAL (PLAY, 'K', 5, NULL , &States[S_MPLAY_RAISE+3]),
S_NORMAL (PLAY, 'J', 5, NULL , &States[S_MPLAY_RAISE+4]),
S_NORMAL (PLAY, 'I', 5, NULL , &States[S_MPLAY_RAISE+5]),
S_NORMAL (PLAY, 'H', 5, NULL , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_CHAINSAW (S_MPLAY_RAISE+6)
S_NORMAL (PLAY, 'E', 4, A_MarineNoise , &States[S_MPLAY_ATK_CHAINSAW+1]),
S_BRIGHT (PLAY, 'F', 4, A_M_Saw , &States[S_MPLAY_ATK_CHAINSAW+2]),
S_BRIGHT (PLAY, 'F', 0, A_M_SawRefire , &States[S_MPLAY_ATK_CHAINSAW+1]),
S_NORMAL (PLAY, 'A', 0, NULL , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_FIST (S_MPLAY_ATK_CHAINSAW+4)
S_NORMAL (PLAY, 'E', 4, A_FaceTarget , &States[S_MPLAY_ATK_FIST+1]),
S_NORMAL (PLAY, 'F', 4, A_M_Punch , &States[S_MPLAY_ATK_FIST+2]), // Purposefully not BRIGHT
S_NORMAL (PLAY, 'A', 9, NULL , &States[S_MPLAY_ATK_FIST+3]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_FIST]),
S_NORMAL (PLAY, 'A', 5, A_FaceTarget , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_BERSERK (S_MPLAY_ATK_FIST+5)
S_NORMAL (PLAY, 'E', 4, A_FaceTarget , &States[S_MPLAY_ATK_BERSERK+1]),
S_NORMAL (PLAY, 'F', 4, A_M_BerserkPunch , &States[S_MPLAY_ATK_BERSERK+2]), // Purposefully not BRIGHT
S_NORMAL (PLAY, 'A', 9, NULL , &States[S_MPLAY_ATK_BERSERK+3]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_BERSERK]),
S_NORMAL (PLAY, 'A', 5, A_FaceTarget , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_PISTOL (S_MPLAY_ATK_BERSERK+5)
S_NORMAL (PLAY, 'E', 4, A_FaceTarget , &States[S_MPLAY_ATK_PISTOL+1]),
S_BRIGHT (PLAY, 'F', 6, A_M_FirePistol , &States[S_MPLAY_ATK_PISTOL+2]),
S_NORMAL (PLAY, 'A', 4, A_FaceTarget , &States[S_MPLAY_ATK_PISTOL+3]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_PISTOL+5]),
S_NORMAL (PLAY, 'A', 5, NULL , &States[S_MPLAY_RUN]),
S_BRIGHT (PLAY, 'F', 6, A_M_FirePistolInaccurate , &States[S_MPLAY_ATK_PISTOL+6]),
S_NORMAL (PLAY, 'A', 4, A_FaceTarget , &States[S_MPLAY_ATK_PISTOL+7]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_PISTOL+5]),
S_NORMAL (PLAY, 'A', 5, A_FaceTarget , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_SHOTGUN (S_MPLAY_ATK_PISTOL+9)
S_NORMAL (PLAY, 'E', 3, A_M_CheckAttack , &States[S_MPLAY_ATK_SHOTGUN+1]),
S_BRIGHT (PLAY, 'F', 7, A_M_FireShotgun , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_DSHOTGUN (S_MPLAY_ATK_SHOTGUN+2)
S_NORMAL (PLAY, 'E', 3, A_M_CheckAttack , &States[S_MPLAY_ATK_DSHOTGUN+1]),
S_BRIGHT (PLAY, 'F', 7, A_M_FireShotgun2 , &States[S_MPLAY_RUN]),
#define S_MPLAY_SKIP_ATTACK (S_MPLAY_ATK_DSHOTGUN+2)
S_NORMAL (PLAY, 'A', 1, NULL , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_CHAINGUN (S_MPLAY_SKIP_ATTACK+1)
S_NORMAL (PLAY, 'E', 4, A_FaceTarget , &States[S_MPLAY_ATK_CHAINGUN+1]),
S_BRIGHT (PLAY, 'F', 4, A_M_FireCGunAccurate , &States[S_MPLAY_ATK_CHAINGUN+2]),
S_BRIGHT (PLAY, 'F', 4, A_M_FireCGunAccurate , &States[S_MPLAY_ATK_CHAINGUN+3]),
S_BRIGHT (PLAY, 'F', 4, A_M_FireCGun , &States[S_MPLAY_ATK_CHAINGUN+4]),
S_BRIGHT (PLAY, 'F', 4, A_M_FireCGun , &States[S_MPLAY_ATK_CHAINGUN+5]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_CHAINGUN+3]),
S_NORMAL (PLAY, 'A', 0, NULL , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_ROCKET (S_MPLAY_ATK_CHAINGUN+7)
S_NORMAL (PLAY, 'E', 8, A_FaceTarget , &States[S_MPLAY_ATK_ROCKET+1]),
S_BRIGHT (PLAY, 'F', 6, A_M_FireMissile , &States[S_MPLAY_ATK_ROCKET+2]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_ROCKET]),
S_NORMAL (PLAY, 'A', 0, NULL , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_RAILGUN (S_MPLAY_ATK_ROCKET+4)
S_NORMAL (PLAY, 'E', 4, A_M_CheckAttack , &States[S_MPLAY_ATK_RAILGUN+1]),
S_BRIGHT (PLAY, 'F', 6, A_M_FireRailgun , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_PLASMA (S_MPLAY_ATK_RAILGUN+2)
S_NORMAL (PLAY, 'E', 2, A_FaceTarget , &States[S_MPLAY_ATK_PLASMA+1]),
S_BRIGHT (PLAY, 'F', 3, A_M_FirePlasma , &States[S_MPLAY_ATK_PLASMA+2]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_PLASMA+1]),
S_NORMAL (PLAY, 'A', 0, NULL , &States[S_MPLAY_RUN]),
#define S_MPLAY_ATK_BFG (S_MPLAY_ATK_PLASMA+4)
S_NORMAL (PLAY, 'E', 5, A_M_BFGsound , &States[S_MPLAY_ATK_BFG+1]),
S_NORMAL (PLAY, 'E', 5, A_FaceTarget , &States[S_MPLAY_ATK_BFG+2]),
S_NORMAL (PLAY, 'E', 5, A_FaceTarget , &States[S_MPLAY_ATK_BFG+3]),
S_NORMAL (PLAY, 'E', 5, A_FaceTarget , &States[S_MPLAY_ATK_BFG+4]),
S_NORMAL (PLAY, 'E', 5, A_FaceTarget , &States[S_MPLAY_ATK_BFG+5]),
S_NORMAL (PLAY, 'E', 5, A_FaceTarget , &States[S_MPLAY_ATK_BFG+6]),
S_BRIGHT (PLAY, 'F', 6, A_M_FireBFG , &States[S_MPLAY_ATK_BFG+7]),
S_NORMAL (PLAY, 'A', 4, A_FaceTarget , &States[S_MPLAY_ATK_BFG+8]),
S_NORMAL (PLAY, 'A', 0, A_M_Refire , &States[S_MPLAY_ATK_BFG]),
S_NORMAL (PLAY, 'A', 0, NULL , &States[S_MPLAY_RUN]),
};
IMPLEMENT_ACTOR (AScriptedMarine, Doom, 9100, 151)
PROP_SpawnHealth (100)
PROP_RadiusFixed (16)
PROP_HeightFixed (56)
PROP_Mass (100)
PROP_SpeedFixed (8)
PROP_PainChance (MARINE_PAIN_CHANCE)
PROP_Flags (MF_SOLID|MF_SHOOTABLE)
PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP)
PROP_Flags3 (MF3_ISMONSTER)
PROP_Translation (TRANSLATION_Standard,0) // Scripted marines wear black
PROP_Damage (100)
PROP_SpawnState (S_MPLAYSTILL)
PROP_SeeState (S_MPLAY_RUN)
PROP_PainState (S_MPLAY_PAIN)
PROP_MissileState (S_MPLAY_ATK)
PROP_DeathState (S_MPLAY_DIE)
PROP_XDeathState (S_MPLAY_XDIE)
PROP_RaiseState (S_MPLAY_RAISE)
PROP_DeathSound ("*death")
PROP_PainSound ("*pain50")
END_DEFAULTS
IMPLEMENT_CLASS (AScriptedMarine)
void AScriptedMarine::Serialize (FArchive &arc)
{
@ -211,6 +31,7 @@ void AScriptedMarine::Serialize (FArchive &arc)
{
SpriteOverride = arc.ReadSprite ();
}
arc << CurrentWeapon;
}
void AScriptedMarine::Activate (AActor *activator)
@ -231,10 +52,49 @@ void AScriptedMarine::Deactivate (AActor *activator)
}
}
bool AScriptedMarine::GetWeaponStates(int weap, FState *&melee, FState *&missile)
{
static ENamedName WeaponNames[] =
{
NAME_None,
NAME_Fist,
NAME_Berserk,
NAME_Chainsaw,
NAME_Pistol,
NAME_Shotgun,
NAME_SSG,
NAME_Chaingun,
NAME_Rocket,
NAME_Plasma,
NAME_Railgun,
NAME_BFG
};
if (weap < WEAPON_Dummy || weap > WEAPON_BFG) weap = WEAPON_Dummy;
melee = FindState(NAME_Melee, WeaponNames[weap], true);
missile = FindState(NAME_Missile, WeaponNames[weap], true);
return melee != NULL || missile != NULL;
}
void AScriptedMarine::BeginPlay ()
{
Super::BeginPlay ();
// Set the current weapon
for(int i=WEAPON_Dummy; i<=WEAPON_BFG; i++)
{
FState *melee, *missile;
if (GetWeaponStates(i, melee, missile))
{
if (melee == MeleeState && missile == MissileState)
{
CurrentWeapon = i;
}
}
}
// Copy the standard player's scaling
AActor * playerdef = GetDefaultByName("DoomPlayer");
if (playerdef != NULL)
@ -256,7 +116,7 @@ void AScriptedMarine::Tick ()
if (special1 != 0)
{
if (MissileState == &States[S_MPLAY_ATK_DSHOTGUN])
if (CurrentWeapon == WEAPON_SuperShotgun)
{ // Play SSG reload sounds
int ticks = level.maptime - special1;
if (ticks < 47)
@ -340,6 +200,20 @@ void A_M_SawRefire (AActor *self)
}
}
//============================================================================
//
// A_MarineNoise
//
//============================================================================
void A_MarineNoise (AActor *self)
{
if (static_cast<AScriptedMarine *>(self)->CurrentWeapon == AScriptedMarine::WEAPON_Chainsaw)
{
S_Sound (self, CHAN_WEAPON, "weapons/sawidle", 1, ATTN_NORM);
}
}
//============================================================================
//
// A_MarineChase
@ -348,10 +222,7 @@ void A_M_SawRefire (AActor *self)
void A_MarineChase (AActor *self)
{
if (self->MeleeState == &AScriptedMarine::States[S_MPLAY_ATK_CHAINSAW])
{
S_Sound (self, CHAN_WEAPON, "weapons/sawidle", 1, ATTN_NORM);
}
A_MarineNoise (self);
A_Chase (self);
}
@ -367,20 +238,6 @@ void A_MarineLook (AActor *self)
A_Look (self);
}
//============================================================================
//
// A_MarineNoise
//
//============================================================================
void A_MarineNoise (AActor *self)
{
if (self->MeleeState == &AScriptedMarine::States[S_MPLAY_ATK_CHAINSAW])
{
S_Sound (self, CHAN_WEAPON, "weapons/sawidle", 1, ATTN_NORM);
}
}
//============================================================================
//
// A_M_Saw
@ -453,38 +310,11 @@ void A_M_Punch (AActor *self)
if (self->target == NULL)
return;
int index=CheckIndex(1);
if (index<0) return;
damage = (pr_m_punch()%10+1) << 1;
A_FaceTarget (self);
angle = self->angle + (pr_m_punch.Random2() << 18);
pitch = P_AimLineAttack (self, angle, MELEERANGE, &linetarget);
P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true);
// turn to face target
if (linetarget)
{
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = R_PointToAngle2 (self->x, self->y, linetarget->x, linetarget->y);
}
}
//============================================================================
//
// A_M_BerserkPunch
//
//============================================================================
void A_M_BerserkPunch (AActor *self)
{
angle_t angle;
int damage;
int pitch;
AActor *linetarget;
if (self->target == NULL)
return;
damage = ((pr_m_punch()%10+1) << 1) * 10;
damage *= EvalExpressionI (StateParameters[index], self);
A_FaceTarget (self);
angle = self->angle + (pr_m_punch.Random2() << 18);
@ -532,26 +362,13 @@ void A_M_FirePistol (AActor *self)
if (self->target == NULL)
return;
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, true, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
}
//============================================================================
//
// A_M_FirePistolInaccurate
//
//============================================================================
void A_M_FirePistolInaccurate (AActor *self)
{
if (self->target == NULL)
return;
int index=CheckIndex(1);
if (index<0) return;
bool accurate = !!EvalExpressionI (StateParameters[index], self);
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, false, P_AimLineAttack (self, self->angle, MISSILERANGE),
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
}
@ -588,7 +405,7 @@ void A_M_CheckAttack (AActor *self)
{
if (self->special1 != 0 || self->target == NULL)
{
self->SetState (&AScriptedMarine::States[S_MPLAY_SKIP_ATTACK]);
self->SetState (self->FindState("SkipAttack"));
}
else
{
@ -624,23 +441,6 @@ void A_M_FireShotgun2 (AActor *self)
self->special1 = level.maptime;
}
//============================================================================
//
// A_M_FireCGunAccurate
//
//============================================================================
void A_M_FireCGunAccurate (AActor *self)
{
if (self->target == NULL)
return;
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, true, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
}
//============================================================================
//
// A_M_FireCGun
@ -652,9 +452,13 @@ void A_M_FireCGun (AActor *self)
if (self->target == NULL)
return;
int index=CheckIndex(1);
if (index<0) return;
bool accurate = !!EvalExpressionI (StateParameters[index], self);
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, false, P_AimLineAttack (self, self->angle, MISSILERANGE),
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
}
@ -758,217 +562,30 @@ void A_M_FireBFG (AActor *self)
//---------------------------------------------------------------------------
class AMarineFist : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineFist, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineFist, Doom, 9101, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (S_MPLAY_ATK_FIST)
PROP_MissileState (255)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineBerserk : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineBerserk, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineBerserk, Doom, 9102, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (S_MPLAY_ATK_BERSERK)
PROP_MissileState (255)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineChainsaw : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineChainsaw, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineChainsaw, Doom, 9103, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (S_MPLAY_ATK_CHAINSAW)
PROP_MissileState (255)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarinePistol : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarinePistol, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarinePistol, Doom, 9104, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_PISTOL)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineShotgun : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineShotgun, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineShotgun, Doom, 9105, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_SHOTGUN)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineSSG : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineSSG, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineSSG, Doom, 9106, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_DSHOTGUN)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineChaingun : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineChaingun, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineChaingun, Doom, 9107, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_CHAINGUN)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineRocket : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineRocket, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineRocket, Doom, 9108, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_ROCKET)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarinePlasma : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarinePlasma, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarinePlasma, Doom, 9109, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_PLASMA)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineRailgun : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineRailgun, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineRailgun, Doom, 9110, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_RAILGUN)
END_DEFAULTS
//---------------------------------------------------------------------------
class AMarineBFG : public AScriptedMarine
{
DECLARE_STATELESS_ACTOR (AMarineBFG, AScriptedMarine)
};
IMPLEMENT_STATELESS_ACTOR (AMarineBFG, Doom, 9111, 0)
PROP_SpawnState (S_MPLAYSTILL)
PROP_MeleeState (255)
PROP_MissileState (S_MPLAY_ATK_BFG)
END_DEFAULTS
//---------------------------------------------------------------------------
void AScriptedMarine::SetWeapon (EMarineWeapon type)
{
MissileState = NULL;
MeleeState = NULL;
DecalGenerator = NULL;
switch (type)
if (GetWeaponStates(type, MeleeState, MissileState))
{
default:
case WEAPON_Dummy:
MissileState = &States[S_MPLAY_ATK];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AScriptedMarine))->DecalGenerator;
break;
static const char *classes[] = {
"ScriptedMarine",
"MarineFist",
"MarineBerserk",
"MarineChainsaw",
"MarinePistol",
"MarineShotgun",
"MarineSSG",
"MarineChaingun",
"MarineRocket",
"MarinePlasma",
"MarineRailgun",
"MarineBFG"
};
case WEAPON_Fist:
MeleeState = &States[S_MPLAY_ATK_FIST];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineFist))->DecalGenerator;
break;
case WEAPON_BerserkFist:
MeleeState = &States[S_MPLAY_ATK_BERSERK];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineBerserk))->DecalGenerator;
break;
case WEAPON_Chainsaw:
MeleeState = &States[S_MPLAY_ATK_CHAINSAW];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineChainsaw))->DecalGenerator;
break;
case WEAPON_Pistol:
MissileState = &States[S_MPLAY_ATK_PISTOL];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarinePistol))->DecalGenerator;
break;
case WEAPON_Shotgun:
MissileState = &States[S_MPLAY_ATK_SHOTGUN];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineShotgun))->DecalGenerator;
break;
case WEAPON_SuperShotgun:
MissileState = &States[S_MPLAY_ATK_DSHOTGUN];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineSSG))->DecalGenerator;
break;
case WEAPON_Chaingun:
MissileState = &States[S_MPLAY_ATK_CHAINGUN];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineChaingun))->DecalGenerator;
break;
case WEAPON_RocketLauncher:
MissileState = &States[S_MPLAY_ATK_ROCKET];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineRocket))->DecalGenerator;
break;
case WEAPON_PlasmaRifle:
MissileState = &States[S_MPLAY_ATK_PLASMA];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarinePlasma))->DecalGenerator;
break;
case WEAPON_Railgun:
MissileState = &States[S_MPLAY_ATK_RAILGUN];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineRailgun))->DecalGenerator;
break;
case WEAPON_BFG:
MissileState = &States[S_MPLAY_ATK_BFG];
DecalGenerator = GetDefaultByType (RUNTIME_CLASS(AMarineBFG))->DecalGenerator;
break;
const PClass *cls = PClass::FindClass(classes[type]);
if (cls != NULL)
DecalGenerator = GetDefaultByType(cls)->DecalGenerator;
else
DecalGenerator = NULL;
}
}

View file

@ -169,6 +169,18 @@ xx(Pickup)
xx(Use)
xx(Drop)
xx(Fist)
//xx(Berserk)
xx(Chainsaw)
xx(Pistol)
xx(Shotgun)
xx(SSG)
xx(Chaingun)
xx(Rocket)
xx(Plasma)
xx(BFG)
//xx(Railgun)
// Damage types
//xx(Fire) already defined above
//xx(Ice)

View file

@ -647,7 +647,9 @@ CUSTOM_CVAR (Bool, forcewater, false, CVAR_ARCHIVE|CVAR_SERVERINFO)
class DLightTransfer : public DThinker
{
DECLARE_ACTOR (DLightTransfer, DThinker)
DECLARE_CLASS (DLightTransfer, DThinker)
DLightTransfer() {}
public:
DLightTransfer (sector_t *srcSec, int target, bool copyFloor);
void Serialize (FArchive &arc);
@ -729,7 +731,8 @@ class DWallLightTransfer : public DThinker
WLF_NOFAKECONTRAST=4
};
DECLARE_ACTOR (DWallLightTransfer, DThinker)
DECLARE_CLASS (DWallLightTransfer, DThinker)
DWallLightTransfer() {}
public:
DWallLightTransfer (sector_t *srcSec, int target, BYTE flags);
void Serialize (FArchive &arc);

View file

@ -0,0 +1,313 @@
// Scriptable marine -------------------------------------------------------
ACTOR ScriptedMarine 9100 native
{
Game Doom
SpawnID 151
Health 100
Radius 16
Height 56
Mass 100
Speed 8
Painchance 160
MONSTER
-COUNTKILL
Translation 0
Damage 100
DeathSound "*death"
PainSound "*pain50"
action native A_M_Refire ();
action native A_M_CheckAttack ();
action native A_MarineChase ();
action native A_MarineLook ();
action native A_MarineNoise ();
action native A_M_Punch (int force);
action native A_M_SawRefire ();
action native A_M_FirePistol (bool accurate);
action native A_M_FireShotgun ();
action native A_M_FireShotgun2 ();
action native A_M_FireCGun(bool accurate);
action native A_M_FireMissile ();
action native A_M_FirePlasma ();
action native A_M_FireRailgun ();
action native A_M_BFGsound ();
action native A_M_FireBFG ();
States
{
Spawn:
PLAY A 4 A_MarineLook
PLAY A 4 A_MarineNoise
Idle:
PLAY A 4 A_MarineLook
PLAY A 4 A_MarineNoise
PLAY A 4 A_MarineLook
PLAY B 4 A_MarineNoise
PLAY B 4 A_MarineLook
PLAY B 4 A_MarineNoise
Loop
See:
PLAY ABCD 4 A_MarineChase
Loop
Melee.Fist:
PLAY E 4 A_FaceTarget
PLAY F 4 A_M_Punch(1)
PLAY A 9
PLAY A 0 A_M_Refire
Loop
PLAY A 5 A_FaceTarget
Goto See
Melee.Berserk:
PLAY E 4 A_FaceTarget
PLAY F 4 A_M_Punch(10)
PLAY A 9
PLAY A 0 A_M_Refire
Loop
PLAY A 5 A_FaceTarget
Goto See
Melee.Chainsaw:
PLAY E 4 A_MarineNoise
PLAY F 4 BRIGHT A_M_Saw
PLAY F 0 A_M_SawRefire
goto Melee.Chainsaw+1
PLAY A 0
Goto See
Missile:
Missile.None:
PLAY E 12 A_FaceTarget
Goto Idle
PLAY F 6 BRIGHT
Loop
Missile.Pistol:
PLAY E 4 A_FaceTarget
PLAY F 6 BRIGHT A_M_FirePistol(1)
PLAY A 4 A_FaceTarget
PLAY A 0 A_M_Refire
PLAY A 5
Goto See
Fireloop.Pistol:
PLAY F 6 BRIGHT A_M_FirePistol(0)
PLAY A 4 A_FaceTarget
PLAY A 0 A_M_Refire
Goto Fireloop.Pistol
PLAY A 5
Goto See
Missile.Shotgun:
PLAY E 3 A_M_CheckAttack
PLAY F 7 BRIGHT A_M_FireShotgun
Goto See
Missile.SSG:
PLAY E 3 A_M_CheckAttack
PLAY F 7 BRIGHT A_M_FireShotgun2
Goto See
Missile.Chaingun:
PLAY E 4 A_FaceTarget
PLAY FF 4 BRIGHT A_M_FireCGun(1)
PLAY FF 4 BRIGHT A_M_FireCGun(0)
PLAY A 0 A_M_Refire
Goto Missile.Chaingun+3
PLAY A 0
Goto See
Missile.Rocket:
PLAY E 8
PLAY F 6 BRIGHT A_M_FireMissile
PLAY A 0 A_M_Refire
Loop
PLAY A 0
Goto See
Missile.Plasma:
PLAY E 2 A_FaceTarget
PLAY F 3 BRIGHT A_M_FirePlasma
PLAY A 0 A_M_Refire
Loop
PLAY A 0
Goto See
Missile.Railgun:
PLAY E 4 A_M_CheckAttack
PLAY F 6 A_M_FireRailgun
Goto See
Missile.BFG:
PLAY E 5 A_M_BFGSound
PLAY EEEEE 5 A_FaceTarget
PLAY F 6 A_M_FireBFG
PLAY A 4 A_FaceTarget
PLAY A 0 A_M_Refire
Loop
PLAY A 0
Goto See
SkipAttack:
PLAY A 1
Goto See
Pain:
PLAY G 4
PLAY G 4 A_Pain
Goto Idle
Death:
PLAY H 10
PLAY I 10 A_Scream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
Stop
XDeath:
PLAY O 5
PLAY P 5 A_XScream
PLAY Q 5 A_NoBlocking
PLAY RSTUV 5
PLAY W -1
Stop
}
}
//---------------------------------------------------------------------------
ACTOR MarineFist : ScriptedMarine 9101
{
Game Doom
States
{
Melee:
Goto Super::Melee.Fist
Missile:
Stop
}
}
//---------------------------------------------------------------------------
ACTOR MarineBerserk : MarineFist 9102
{
Game Doom
States
{
Melee:
Goto Super::Melee.Berserk
Missile:
Stop
}
}
//---------------------------------------------------------------------------
ACTOR MarineChainsaw : ScriptedMarine 9103
{
Game Doom
States
{
Melee:
Goto Super::Melee.Chainsaw
Missile:
Stop
}
}
//---------------------------------------------------------------------------
ACTOR MarinePistol : ScriptedMarine 9104
{
Game Doom
States
{
Missile:
Goto Super::Missile.Pistol
}
}
//---------------------------------------------------------------------------
ACTOR MarineShotgun : ScriptedMarine 9105
{
Game Doom
States
{
Missile:
Goto Super::Missile.Shotgun
}
}
//---------------------------------------------------------------------------
ACTOR MarineSSG : ScriptedMarine 9106
{
Game Doom
States
{
Missile:
Goto Super::Missile.SSG
}
}
//---------------------------------------------------------------------------
ACTOR MarineChaingun : ScriptedMarine 9107
{
Game Doom
States
{
Missile:
Goto Super::Missile.Chaingun
}
}
//---------------------------------------------------------------------------
ACTOR MarineRocket : MarineFist 9108
{
Game Doom
States
{
Missile:
Goto Super::Missile.Rocket
}
}
//---------------------------------------------------------------------------
ACTOR MarinePlasma : ScriptedMarine 9109
{
Game Doom
States
{
Missile:
Goto Super::Missile.Plasma
}
}
//---------------------------------------------------------------------------
ACTOR MarineRailgun : ScriptedMarine 9110
{
Game Doom
States
{
Missile:
Goto Super::Missile.Railgun
}
}
//---------------------------------------------------------------------------
ACTOR MarineBFG : ScriptedMarine 9111
{
Game Doom
States
{
Missile:
Goto Super::Missile.BFG
}
}

View file

@ -39,6 +39,7 @@
#include "actors/doom/doomdecorations.txt"
#include "actors/doom/doomweapons.txt"
#include "actors/doom/stealthmonsters.txt"
#include "actors/doom/scriptedmarine.txt"
#include "actors/raven/artiegg.txt"
#include "actors/raven/ravenartifacts.txt"