mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- Converted the DoomPlayer to DECORATE.
- Extended all A_Jump commands to take labels as parameters in addition to offsets. SVN r378 (trunk)
This commit is contained in:
parent
9c529b8aa4
commit
80950553c6
16 changed files with 301 additions and 295 deletions
|
@ -1,4 +1,7 @@
|
|||
November 5, 2006 (Changes by Graf Zahl)
|
||||
- Converted the DoomPlayer to DECORATE.
|
||||
- Extended all A_Jump commands to take labels as parameters in addition
|
||||
to offsets.
|
||||
- Removed the deprecation warnings for the state assignment commands
|
||||
in DECORATE. While it is still recommended not to use them anymore
|
||||
they will continue to work with custom state support and existing
|
||||
|
|
|
@ -1515,6 +1515,8 @@ static int PatchPointer (int ptrNum)
|
|||
state->Action = NULL;
|
||||
else
|
||||
state->Action = CodePtrs[ActionList[atoi (Line2)]];
|
||||
|
||||
state->ParameterIndex=0; // No parameters for patched code pointers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1704,8 +1706,19 @@ static int PatchMisc (int dummy)
|
|||
if (player != NULL)
|
||||
{
|
||||
player->health = deh.StartHealth;
|
||||
|
||||
FDropItem * di = GetDropItems(PClass::FindClass(NAME_DoomPlayer));
|
||||
while (di != NULL)
|
||||
{
|
||||
if (di->Name == NAME_Clip)
|
||||
{
|
||||
di->amount = deh.StartBullets;
|
||||
}
|
||||
di = di->Next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 0xDD means "enable infighting"
|
||||
if (infighting == 0xDD)
|
||||
{
|
||||
|
@ -1830,6 +1843,7 @@ static int PatchCodePtrs (int dummy)
|
|||
state->Action = CodePtrs[CodePtrNames[mid].num];
|
||||
DPrintf ("Frame %d set to %s\n", frame, GetName (CodePtrNames[mid].name));
|
||||
}
|
||||
state->ParameterIndex=0; // No parameters for patched code pointers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,11 +58,4 @@ protected:
|
|||
int SpriteOverride;
|
||||
};
|
||||
|
||||
class ADoomPlayer : public APlayerPawn
|
||||
{
|
||||
DECLARE_ACTOR (ADoomPlayer, APlayerPawn)
|
||||
public:
|
||||
void GiveDefaultInventory ();
|
||||
};
|
||||
|
||||
#endif //__A_DOOMGLOBAL_H__
|
||||
|
|
|
@ -1,220 +0,0 @@
|
|||
#include "actor.h"
|
||||
#include "gi.h"
|
||||
#include "m_random.h"
|
||||
#include "s_sound.h"
|
||||
#include "d_player.h"
|
||||
#include "a_action.h"
|
||||
#include "p_local.h"
|
||||
#include "a_doomglobal.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
void A_Pain (AActor *);
|
||||
void A_PlayerScream (AActor *);
|
||||
void A_XScream (AActor *);
|
||||
void A_DoomSkinCheck1 (AActor *);
|
||||
void A_DoomSkinCheck2 (AActor *);
|
||||
|
||||
FState ADoomPlayer::States[] =
|
||||
{
|
||||
#define S_PLAY 0
|
||||
S_NORMAL (PLAY, 'A', -1, NULL , NULL),
|
||||
|
||||
#define S_PLAY_RUN (S_PLAY+1)
|
||||
S_NORMAL (PLAY, 'A', 4, NULL , &States[S_PLAY_RUN+1]),
|
||||
S_NORMAL (PLAY, 'B', 4, NULL , &States[S_PLAY_RUN+2]),
|
||||
S_NORMAL (PLAY, 'C', 4, NULL , &States[S_PLAY_RUN+3]),
|
||||
S_NORMAL (PLAY, 'D', 4, NULL , &States[S_PLAY_RUN+0]),
|
||||
|
||||
#define S_PLAY_ATK (S_PLAY_RUN+4)
|
||||
S_NORMAL (PLAY, 'E', 12, NULL , &States[S_PLAY]),
|
||||
S_BRIGHT (PLAY, 'F', 6, NULL , &States[S_PLAY_ATK+0]),
|
||||
|
||||
#define S_PLAY_PAIN (S_PLAY_ATK+2)
|
||||
S_NORMAL (PLAY, 'G', 4, NULL , &States[S_PLAY_PAIN+1]),
|
||||
S_NORMAL (PLAY, 'G', 4, A_Pain , &States[S_PLAY]),
|
||||
|
||||
#define S_PLAY_DIE (S_PLAY_PAIN+2)
|
||||
S_NORMAL (PLAY, 'H', 10, A_DoomSkinCheck1 , &States[S_PLAY_DIE+1]),
|
||||
S_NORMAL (PLAY, 'I', 10, A_PlayerScream , &States[S_PLAY_DIE+2]),
|
||||
S_NORMAL (PLAY, 'J', 10, A_NoBlocking , &States[S_PLAY_DIE+3]),
|
||||
S_NORMAL (PLAY, 'K', 10, NULL , &States[S_PLAY_DIE+4]),
|
||||
S_NORMAL (PLAY, 'L', 10, NULL , &States[S_PLAY_DIE+5]),
|
||||
S_NORMAL (PLAY, 'M', 10, NULL , &States[S_PLAY_DIE+6]),
|
||||
S_NORMAL (PLAY, 'N', -1, NULL , NULL),
|
||||
|
||||
#define S_PLAY_XDIE (S_PLAY_DIE+7)
|
||||
S_NORMAL (PLAY, 'O', 5, A_DoomSkinCheck2 , &States[S_PLAY_XDIE+1]),
|
||||
S_NORMAL (PLAY, 'P', 5, A_XScream , &States[S_PLAY_XDIE+2]),
|
||||
S_NORMAL (PLAY, 'Q', 5, A_NoBlocking , &States[S_PLAY_XDIE+3]),
|
||||
S_NORMAL (PLAY, 'R', 5, NULL , &States[S_PLAY_XDIE+4]),
|
||||
S_NORMAL (PLAY, 'S', 5, NULL , &States[S_PLAY_XDIE+5]),
|
||||
S_NORMAL (PLAY, 'T', 5, NULL , &States[S_PLAY_XDIE+6]),
|
||||
S_NORMAL (PLAY, 'U', 5, NULL , &States[S_PLAY_XDIE+7]),
|
||||
S_NORMAL (PLAY, 'V', 5, NULL , &States[S_PLAY_XDIE+8]),
|
||||
S_NORMAL (PLAY, 'W', -1, NULL , NULL),
|
||||
|
||||
#define S_HTIC_DIE (S_PLAY_XDIE+9)
|
||||
S_NORMAL (PLAY, 'H', 6, NULL , &States[S_HTIC_DIE+1]),
|
||||
S_NORMAL (PLAY, 'I', 6, A_PlayerScream , &States[S_HTIC_DIE+2]),
|
||||
S_NORMAL (PLAY, 'J', 6, NULL , &States[S_HTIC_DIE+3]),
|
||||
S_NORMAL (PLAY, 'K', 6, NULL , &States[S_HTIC_DIE+4]),
|
||||
S_NORMAL (PLAY, 'L', 6, A_NoBlocking , &States[S_HTIC_DIE+5]),
|
||||
S_NORMAL (PLAY, 'M', 6, NULL , &States[S_HTIC_DIE+6]),
|
||||
S_NORMAL (PLAY, 'N', 6, NULL , &States[S_HTIC_DIE+7]),
|
||||
S_NORMAL (PLAY, 'O', 6, NULL , &States[S_HTIC_DIE+8]),
|
||||
S_NORMAL (PLAY, 'P', -1, NULL , NULL),
|
||||
|
||||
#define S_HTIC_XDIE (S_HTIC_DIE+9)
|
||||
S_NORMAL (PLAY, 'Q', 5, A_PlayerScream , &States[S_HTIC_XDIE+1]),
|
||||
S_NORMAL (PLAY, 'R', 0, A_NoBlocking , &States[S_HTIC_XDIE+2]),
|
||||
S_NORMAL (PLAY, 'R', 5, A_SkullPop , &States[S_HTIC_XDIE+3]),
|
||||
S_NORMAL (PLAY, 'S', 5, NULL , &States[S_HTIC_XDIE+4]),
|
||||
S_NORMAL (PLAY, 'T', 5, NULL , &States[S_HTIC_XDIE+5]),
|
||||
S_NORMAL (PLAY, 'U', 5, NULL , &States[S_HTIC_XDIE+6]),
|
||||
S_NORMAL (PLAY, 'V', 5, NULL , &States[S_HTIC_XDIE+7]),
|
||||
S_NORMAL (PLAY, 'W', 5, NULL , &States[S_HTIC_XDIE+8]),
|
||||
S_NORMAL (PLAY, 'X', 5, NULL , &States[S_HTIC_XDIE+9]),
|
||||
S_NORMAL (PLAY, 'Y', -1, NULL , NULL),
|
||||
};
|
||||
|
||||
IMPLEMENT_ACTOR (ADoomPlayer, Doom, -1, 0)
|
||||
PROP_SpawnHealth (100)
|
||||
PROP_RadiusFixed (16)
|
||||
PROP_HeightFixed (56)
|
||||
PROP_Mass (100)
|
||||
PROP_PainChance (255)
|
||||
PROP_SpeedFixed (1)
|
||||
PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|MF_PICKUP|MF_NOTDMATCH|MF_FRIENDLY)
|
||||
PROP_Flags2 (MF2_SLIDE|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP|MF2_WINDTHRUST)
|
||||
PROP_Flags3 (MF3_NOBLOCKMONST)
|
||||
|
||||
PROP_SpawnState (S_PLAY)
|
||||
PROP_SeeState (S_PLAY_RUN)
|
||||
PROP_PainState (S_PLAY_PAIN)
|
||||
PROP_MissileState (S_PLAY_ATK)
|
||||
PROP_MeleeState (S_PLAY_ATK+1)
|
||||
PROP_DeathState (S_PLAY_DIE)
|
||||
PROP_XDeathState (S_PLAY_XDIE)
|
||||
|
||||
// [GRB]
|
||||
PROP_PlayerPawn_ColorRange (112, 127)
|
||||
PROP_PlayerPawn_DisplayName ("Marine")
|
||||
PROP_PlayerPawn_CrouchSprite ("PLYC")
|
||||
END_DEFAULTS
|
||||
|
||||
void ADoomPlayer::GiveDefaultInventory ()
|
||||
{
|
||||
Super::GiveDefaultInventory ();
|
||||
|
||||
if (!Inventory)
|
||||
{
|
||||
AInventory *fist, *pistol, *bullets;
|
||||
|
||||
fist = player->mo->GiveInventoryType (PClass::FindClass ("Fist"));
|
||||
pistol = player->mo->GiveInventoryType (PClass::FindClass ("Pistol"));
|
||||
// Adding the pistol automatically adds bullets
|
||||
bullets = player->mo->FindInventory (PClass::FindClass ("Clip"));
|
||||
if (bullets != NULL)
|
||||
{
|
||||
bullets->Amount = deh.StartBullets; // [RH] Used to be 50
|
||||
}
|
||||
player->ReadyWeapon = player->PendingWeapon =
|
||||
static_cast<AWeapon *> (deh.StartBullets > 0 ? pistol : fist);
|
||||
}
|
||||
}
|
||||
|
||||
void A_FireScream (AActor *self)
|
||||
{
|
||||
S_Sound (self, CHAN_BODY, "*burndeath", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
void A_PlayerScream (AActor *self)
|
||||
{
|
||||
int sound = 0;
|
||||
int chan = CHAN_VOICE;
|
||||
|
||||
if (self->player == NULL || self->DeathSound != 0)
|
||||
{
|
||||
S_SoundID (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NORM);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the different player death screams
|
||||
if ((((level.flags >> 15) | (dmflags)) &
|
||||
(DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX)) &&
|
||||
self->momz <= -39*FRACUNIT)
|
||||
{
|
||||
sound = S_FindSkinnedSound (self, "*splat");
|
||||
chan = CHAN_BODY;
|
||||
}
|
||||
|
||||
// try to find the appropriate death sound and use suitable replacements if necessary
|
||||
if (!sound && self->special1<10)
|
||||
{ // Wimpy death sound
|
||||
sound = S_FindSkinnedSound (self, "*wimpydeath");
|
||||
}
|
||||
if (!sound && self->health <= -50)
|
||||
{
|
||||
if (self->health > -100)
|
||||
{ // Crazy death sound
|
||||
sound = S_FindSkinnedSound (self, "*crazydeath");
|
||||
}
|
||||
if (!sound)
|
||||
{ // Extreme death sound
|
||||
sound = S_FindSkinnedSound (self, "*xdeath");
|
||||
if (!sound)
|
||||
{
|
||||
sound = S_FindSkinnedSound (self, "*gibbed");
|
||||
chan = CHAN_BODY;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!sound)
|
||||
{ // Normal death sound
|
||||
sound=S_FindSkinnedSound (self, "*death");
|
||||
}
|
||||
|
||||
if (chan != CHAN_VOICE)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{ // Stop most playing sounds from this player.
|
||||
// This is mainly to stop *land from messing up *splat.
|
||||
if (i != CHAN_WEAPON && i != CHAN_VOICE)
|
||||
{
|
||||
S_StopSound (self, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
S_SoundID (self, chan, sound, 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// A_DoomSkinCheck1
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void A_DoomSkinCheck1 (AActor *actor)
|
||||
{
|
||||
if (actor->player != NULL &&
|
||||
skins[actor->player->userinfo.skin].othergame)
|
||||
{
|
||||
actor->SetState (&ADoomPlayer::States[S_HTIC_DIE]);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// A_DoomSkinCheck2
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void A_DoomSkinCheck2 (AActor *actor)
|
||||
{
|
||||
if (actor->player != NULL &&
|
||||
skins[actor->player->userinfo.skin].othergame)
|
||||
{
|
||||
actor->SetState (&ADoomPlayer::States[S_HTIC_XDIE]);
|
||||
}
|
||||
}
|
|
@ -235,8 +235,12 @@ void AScriptedMarine::BeginPlay ()
|
|||
Super::BeginPlay ();
|
||||
|
||||
// Copy the standard player's scaling
|
||||
xscale = GetDefaultByType(RUNTIME_CLASS(ADoomPlayer))->xscale;
|
||||
yscale = GetDefaultByType(RUNTIME_CLASS(ADoomPlayer))->yscale;
|
||||
AActor * playerdef = GetDefaultByName("DoomPlayer");
|
||||
if (playerdef != NULL)
|
||||
{
|
||||
xscale = playerdef->xscale;
|
||||
yscale = playerdef->yscale;
|
||||
}
|
||||
}
|
||||
|
||||
void AScriptedMarine::Tick ()
|
||||
|
@ -969,8 +973,11 @@ void AScriptedMarine::SetSprite (const PClass *source)
|
|||
if (source == NULL || source->ActorInfo == NULL)
|
||||
{ // A valid actor class wasn't passed, so use the standard sprite
|
||||
SpriteOverride = sprite = States[0].sprite.index;
|
||||
xscale = GetDefaultByType(RUNTIME_CLASS(ADoomPlayer))->xscale;
|
||||
yscale = GetDefaultByType(RUNTIME_CLASS(ADoomPlayer))->yscale;
|
||||
// Copy the standard player's scaling
|
||||
AActor * playerdef = GetDefaultByName("DoomPlayer");
|
||||
if (playerdef == NULL) playerdef = GetDefaultByType(RUNTIME_CLASS(AScriptedMarine));
|
||||
xscale = playerdef->xscale;
|
||||
yscale = playerdef->yscale;
|
||||
}
|
||||
else
|
||||
{ // Use the same sprite the passed class spawns with
|
||||
|
|
|
@ -184,6 +184,17 @@ IMPLEMENT_ACTOR (ABloodySkull, Heretic, -1, 0)
|
|||
PROP_SpawnState (0)
|
||||
END_DEFAULTS
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_FireScream
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void A_FireScream (AActor *self)
|
||||
{
|
||||
S_Sound (self, CHAN_BODY, "*burndeath", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_SkullPop
|
||||
|
|
|
@ -98,7 +98,7 @@ void A_NoBlocking (AActor *actor)
|
|||
// Otherwise, call NoBlockingSet() and let it decide what to drop.
|
||||
if (!actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB]
|
||||
{
|
||||
FDropItem *di = GetDropItems(actor);
|
||||
FDropItem *di = GetDropItems(RUNTIME_TYPE(actor));
|
||||
|
||||
if (di != NULL)
|
||||
{
|
||||
|
|
|
@ -81,10 +81,6 @@
|
|||
const BYTE SF_FULLBRIGHT = 0x40;
|
||||
const BYTE SF_BIGTIC = 0x80;
|
||||
|
||||
// All state parameters are stored in this array now.
|
||||
|
||||
extern TArray<int> StateParameters;
|
||||
|
||||
struct FState
|
||||
{
|
||||
union
|
||||
|
|
|
@ -873,7 +873,7 @@ void APlayerPawn::GiveDefaultInventory ()
|
|||
// [GRB] Give inventory specified in DECORATE
|
||||
player->health = GetDefault ()->health;
|
||||
|
||||
FDropItem *di = GetDropItems(this);
|
||||
FDropItem *di = GetDropItems(RUNTIME_TYPE(this));
|
||||
|
||||
while (di)
|
||||
{
|
||||
|
@ -904,7 +904,8 @@ void APlayerPawn::GiveDefaultInventory ()
|
|||
item = NULL;
|
||||
}
|
||||
}
|
||||
if (item != NULL && item->IsKindOf (RUNTIME_CLASS (AWeapon)))
|
||||
if (item != NULL && item->IsKindOf (RUNTIME_CLASS (AWeapon)) &&
|
||||
static_cast<AWeapon*>(item)->CheckAmmo(AWeapon::EitherFire, false))
|
||||
{
|
||||
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (item);
|
||||
}
|
||||
|
@ -1058,6 +1059,74 @@ void APlayerPawn::SpecialInvulnerabilityHandling (EInvulState setting, fixed_t *
|
|||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_PlayerScream
|
||||
//
|
||||
// try to find the appropriate death sound and use suitable
|
||||
// replacements if necessary
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void A_PlayerScream (AActor *self)
|
||||
{
|
||||
int sound = 0;
|
||||
int chan = CHAN_VOICE;
|
||||
|
||||
if (self->player == NULL || self->DeathSound != 0)
|
||||
{
|
||||
S_SoundID (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NORM);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the different player death screams
|
||||
if ((((level.flags >> 15) | (dmflags)) &
|
||||
(DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX)) &&
|
||||
self->momz <= -39*FRACUNIT)
|
||||
{
|
||||
sound = S_FindSkinnedSound (self, "*splat");
|
||||
chan = CHAN_BODY;
|
||||
}
|
||||
|
||||
if (!sound && self->special1<10)
|
||||
{ // Wimpy death sound
|
||||
sound = S_FindSkinnedSound (self, "*wimpydeath");
|
||||
}
|
||||
if (!sound && self->health <= -50)
|
||||
{
|
||||
if (self->health > -100)
|
||||
{ // Crazy death sound
|
||||
sound = S_FindSkinnedSound (self, "*crazydeath");
|
||||
}
|
||||
if (!sound)
|
||||
{ // Extreme death sound
|
||||
sound = S_FindSkinnedSound (self, "*xdeath");
|
||||
if (!sound)
|
||||
{
|
||||
sound = S_FindSkinnedSound (self, "*gibbed");
|
||||
chan = CHAN_BODY;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!sound)
|
||||
{ // Normal death sound
|
||||
sound=S_FindSkinnedSound (self, "*death");
|
||||
}
|
||||
|
||||
if (chan != CHAN_VOICE)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{ // Stop most playing sounds from this player.
|
||||
// This is mainly to stop *land from messing up *splat.
|
||||
if (i != CHAN_WEAPON && i != CHAN_VOICE)
|
||||
{
|
||||
S_StopSound (self, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
S_SoundID (self, chan, sound, 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -79,6 +79,7 @@ extern TArray<FActorInfo *> Decorations;
|
|||
TArray<char*> DecalNames;
|
||||
// all state parameters
|
||||
TArray<int> StateParameters;
|
||||
TArray<int> JumpParameters;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -1007,9 +1008,9 @@ public:
|
|||
|
||||
static FDropItemPtrArray DropItemList;
|
||||
|
||||
FDropItem *GetDropItems(AActor * actor)
|
||||
FDropItem *GetDropItems(const PClass *cls)
|
||||
{
|
||||
unsigned int index = actor->GetClass ()->Meta.GetMetaInt (ACMETA_DropItems) - 1;
|
||||
unsigned int index = cls->Meta.GetMetaInt (ACMETA_DropItems) - 1;
|
||||
|
||||
if (index >= 0 && index < DropItemList.Size())
|
||||
{
|
||||
|
@ -1962,16 +1963,78 @@ do_stop:
|
|||
SC_ScriptError("You cannot use A_Jump commands on multistate definitions\n");
|
||||
}
|
||||
|
||||
SC_MustGetNumber();
|
||||
v=sc_Number;
|
||||
if (v<1)
|
||||
if (SC_CheckNumber())
|
||||
{
|
||||
SC_ScriptError("Negative jump offsets are not allowed");
|
||||
}
|
||||
v=sc_Number;
|
||||
if (v<1)
|
||||
{
|
||||
SC_ScriptError("Negative jump offsets are not allowed");
|
||||
}
|
||||
|
||||
{
|
||||
int minreq=count+v;
|
||||
if (minreq>minrequiredstate) minrequiredstate=minreq;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int minreq=count+v;
|
||||
if (minreq>minrequiredstate) minrequiredstate=minreq;
|
||||
if (JumpParameters.Size()==0) JumpParameters.Push(0);
|
||||
|
||||
v = -(int)JumpParameters.Size();
|
||||
FString statestring = ParseStateString();
|
||||
const PClass *stype=NULL;
|
||||
int scope = statestring.IndexOf("::");
|
||||
if (scope >= 0)
|
||||
{
|
||||
FName scopename = FName(statestring, scope, false);
|
||||
if (scopename == NAME_Super)
|
||||
{
|
||||
// Super refers to the direct superclass
|
||||
scopename = actor->Class->ParentClass->TypeName;
|
||||
}
|
||||
JumpParameters.Push(scopename);
|
||||
statestring = statestring.Right(statestring.Len()-scope-2);
|
||||
|
||||
stype = PClass::FindClass (scopename);
|
||||
if (stype == NULL)
|
||||
{
|
||||
SC_ScriptError ("%s is an unknown class.", scopename);
|
||||
}
|
||||
if (!stype->IsDescendantOf (RUNTIME_CLASS(AActor)))
|
||||
{
|
||||
SC_ScriptError ("%s is not an actor class, so it has no states.", stype->TypeName.GetChars());
|
||||
}
|
||||
if (!stype->IsAncestorOf (actor->Class))
|
||||
{
|
||||
SC_ScriptError ("%s is not derived from %s so cannot access its states.",
|
||||
actor->Class->TypeName.GetChars(), stype->TypeName.GetChars());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No class name is stored. This allows 'virtual' jumps to
|
||||
// labels in subclasses.
|
||||
// It also means that the validity of the given state cannot
|
||||
// be checked here.
|
||||
JumpParameters.Push(0);
|
||||
}
|
||||
TArray<FName> names;
|
||||
MakeStateNameList(statestring, &names);
|
||||
|
||||
if (stype != NULL)
|
||||
{
|
||||
if (!stype->ActorInfo->FindState(names.Size(), (va_list)&names[0]))
|
||||
{
|
||||
SC_ScriptError("Jump to unknown state '%s' in class '%s'",
|
||||
statestring.GetChars(), stype->TypeName.GetChars());
|
||||
}
|
||||
}
|
||||
JumpParameters.Push(names.Size());
|
||||
for(unsigned i=0;i<names.Size();i++)
|
||||
{
|
||||
JumpParameters.Push(names[i]);
|
||||
}
|
||||
// No offsets here. The point of jumping to labels is to avoid such things!
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -21,6 +21,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// All state parameters are stored in this array now.
|
||||
extern TArray<int> StateParameters;
|
||||
extern TArray<int> JumpParameters;
|
||||
|
||||
|
||||
int ParseExpression (bool _not);
|
||||
|
||||
|
@ -42,7 +46,7 @@ struct FDropItem
|
|||
FDropItem * Next;
|
||||
};
|
||||
|
||||
FDropItem *GetDropItems(AActor * actor);
|
||||
FDropItem *GetDropItems(const PClass * cls);
|
||||
|
||||
|
||||
// A truly awful hack to get to the state that called an action function
|
||||
|
|
|
@ -380,21 +380,51 @@ void A_BulletAttack (AActor *self)
|
|||
//==========================================================================
|
||||
static void DoJump(AActor * self, FState * CallingState, int offset)
|
||||
{
|
||||
if (pStateCall != NULL && CallingState == pStateCall->State)
|
||||
FState *jumpto;
|
||||
|
||||
if (offset>=0)
|
||||
{
|
||||
pStateCall->State += offset;
|
||||
}
|
||||
else if (self->player != NULL && CallingState == self->player->psprites[ps_weapon].state)
|
||||
{
|
||||
P_SetPsprite(self->player, ps_weapon, CallingState + offset);
|
||||
}
|
||||
else if (self->player != NULL && CallingState == self->player->psprites[ps_flash].state)
|
||||
{
|
||||
P_SetPsprite(self->player, ps_flash, CallingState + offset);
|
||||
jumpto = CallingState + offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->SetState (CallingState + offset);
|
||||
offset = -offset;
|
||||
|
||||
int classname = JumpParameters[offset];
|
||||
const PClass *cls;
|
||||
cls = classname==NAME_None? RUNTIME_TYPE(self) : PClass::FindClass((ENamedName)classname);
|
||||
if (cls==NULL || cls->ActorInfo==NULL) return; // shouldn't happen
|
||||
|
||||
jumpto = cls->ActorInfo->FindState(JumpParameters[offset+1], (va_list)&JumpParameters[offset+2]);
|
||||
if (jumpto == NULL)
|
||||
{
|
||||
char * dot="";
|
||||
Printf("Jump target '");
|
||||
if (classname != NAME_None) Printf("%s::", ((FName)(ENamedName)classname).GetChars());
|
||||
for (int i=0;i<JumpParameters[offset+1];i++)
|
||||
{
|
||||
Printf("%s%s", dot, ((FName)(ENamedName)JumpParameters[offset+2+i]));
|
||||
}
|
||||
Printf("not found in %s\n", self->GetClass()->TypeName.GetChars());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pStateCall != NULL && CallingState == pStateCall->State)
|
||||
{
|
||||
pStateCall->State = jumpto;
|
||||
}
|
||||
else if (self->player != NULL && CallingState == self->player->psprites[ps_weapon].state)
|
||||
{
|
||||
P_SetPsprite(self->player, ps_weapon, jumpto);
|
||||
}
|
||||
else if (self->player != NULL && CallingState == self->player->psprites[ps_flash].state)
|
||||
{
|
||||
P_SetPsprite(self->player, ps_flash, jumpto);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->SetState (jumpto);
|
||||
}
|
||||
}
|
||||
//==========================================================================
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "actors/shared/splashes.txt"
|
||||
#include "actors/shared/pickups.txt"
|
||||
|
||||
#include "actors/doom/doomplayer.txt"
|
||||
#include "actors/doom/possessed.txt"
|
||||
#include "actors/doom/doomimp.txt"
|
||||
#include "actors/doom/demon.txt"
|
||||
|
|
70
wadsrc/decorate/doom/doomplayer.txt
Normal file
70
wadsrc/decorate/doom/doomplayer.txt
Normal file
|
@ -0,0 +1,70 @@
|
|||
//===========================================================================
|
||||
//
|
||||
// Player
|
||||
//
|
||||
//===========================================================================
|
||||
ACTOR DoomPlayer : PlayerPawn
|
||||
{
|
||||
Speed 1
|
||||
Health 100
|
||||
Radius 16
|
||||
Height 56
|
||||
Mass 100
|
||||
PainChance 255
|
||||
Player.ColorRange 112, 127
|
||||
Player.DisplayName "Marine"
|
||||
Player.CrouchSprite "PLYC"
|
||||
Player.StartItem "Pistol"
|
||||
Player.StartItem "Fist"
|
||||
Player.StartItem "Clip", 50
|
||||
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
PLAY A -1
|
||||
Loop
|
||||
See:
|
||||
PLAY ABCD 4
|
||||
Loop
|
||||
Missile:
|
||||
PLAY E 12
|
||||
Goto Spawn
|
||||
Melee:
|
||||
PLAY F 6
|
||||
Goto Missile
|
||||
Pain:
|
||||
PLAY G 4
|
||||
PLAY G 4 A_Pain
|
||||
Goto Spawn
|
||||
Death:
|
||||
PLAY H 10 A_PlayerSkinCheck(AltSkinDeath)
|
||||
PLAY I 10 A_PlayerScream
|
||||
PLAY J 10 A_NoBlocking
|
||||
PLAY KLM 10
|
||||
PLAY N -1
|
||||
Stop
|
||||
XDeath:
|
||||
PLAY O 5 A_PlayerSkinCheck(AltSkinXDeath)
|
||||
PLAY P 5 A_XScream
|
||||
PLAY Q 5 A_NoBlocking
|
||||
PLAY RSTUV 5
|
||||
PLAY W -1
|
||||
Stop
|
||||
AltSkinDeath:
|
||||
PLAY H 6
|
||||
PLAY I 6 A_PlayerScream
|
||||
PLAY JK 6
|
||||
PLAY L 6 A_NoBlocking
|
||||
PLAY MNO 6
|
||||
PLAY P -1
|
||||
Stop
|
||||
AltSkinXDeath:
|
||||
PLAY Q 5 A_PlayerScream
|
||||
PLAY R 0 A_NoBlocking
|
||||
PLAY R 5 A_SkullPop
|
||||
PLAY STUVWX 5
|
||||
PLAY Y -1
|
||||
Stop
|
||||
}
|
||||
}
|
||||
|
|
@ -246,6 +246,7 @@ actors/shared/debris.txt decorate/shared/debris.txt
|
|||
actors/shared/splashes.txt decorate/shared/splashes.txt
|
||||
actors/shared/pickups.txt decorate/shared/pickups.txt
|
||||
|
||||
actors/doom/doomplayer.txt decorate/doom/doomplayer.txt
|
||||
actors/doom/possessed.txt decorate/doom/possessed.txt
|
||||
actors/doom/doomimp.txt decorate/doom/doomimp.txt
|
||||
actors/doom/demon.txt decorate/doom/demon.txt
|
||||
|
|
36
zdoom.vcproj
36
zdoom.vcproj
|
@ -6558,42 +6558,6 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g_doom\a_doomplayer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="" /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" "
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="" /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" "
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="" /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" "
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="" /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" " /I /fmod/api/inc" "
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g_doom\a_doomweaps.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue