mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- added a CrushPainSound actor property for Strife.
- fixed memory leaks in SBARINFO and WAD loading code. - added GetBloodColor and GetBloodType inline functions to AActor to wrap the GetMeta calls used for this. SVN r2234 (trunk)
This commit is contained in:
parent
1eed01244c
commit
a2cfbec3cf
13 changed files with 94 additions and 36 deletions
23
src/actor.h
23
src/actor.h
|
@ -716,6 +716,28 @@ public:
|
|||
return ( abs(x - other->x) < blockdist && abs(y - other->y) < blockdist);
|
||||
}
|
||||
|
||||
PalEntry GetBloodColor() const
|
||||
{
|
||||
return (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
}
|
||||
|
||||
const PClass *GetBloodType(int type = 0) const
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
return PClass::FindClass((ENamedName)GetClass()->Meta.GetMetaInt(AMETA_BloodType, NAME_Blood));
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
return PClass::FindClass((ENamedName)GetClass()->Meta.GetMetaInt(AMETA_BloodType2, NAME_BloodSplatter));
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
return PClass::FindClass((ENamedName)GetClass()->Meta.GetMetaInt(AMETA_BloodType3, NAME_AxeBlood));
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
// Calculate amount of missile damage
|
||||
virtual int GetMissileDamage(int mask, int add);
|
||||
|
||||
|
@ -846,6 +868,7 @@ public:
|
|||
FSoundIDNoInit UseSound; // [RH] Sound to play when an actor is used.
|
||||
FSoundIDNoInit BounceSound;
|
||||
FSoundIDNoInit WallBounceSound;
|
||||
FSoundIDNoInit CrushPainSound;
|
||||
|
||||
fixed_t Speed;
|
||||
fixed_t FloatSpeed;
|
||||
|
|
|
@ -1850,9 +1850,14 @@ void D_DoomMain (void)
|
|||
|
||||
CopyFiles(allwads, pwads);
|
||||
|
||||
// Since this function will never leave we must delete this array here manually.
|
||||
pwads.Clear();
|
||||
pwads.ShrinkToFit();
|
||||
|
||||
Printf ("W_Init: Init WADfiles.\n");
|
||||
Wads.InitMultipleFiles (allwads);
|
||||
allwads.Clear();
|
||||
allwads.ShrinkToFit();
|
||||
|
||||
// [RH] Initialize localizable strings.
|
||||
GStrings.LoadStrings (false);
|
||||
|
|
|
@ -542,6 +542,10 @@ void SBarInfo::ParseSBarInfo(int lump)
|
|||
sc.MustGetToken(TK_Identifier);
|
||||
barNum = sc.MustMatchString(StatusBars);
|
||||
}
|
||||
if (this->huds[barNum] != NULL)
|
||||
{
|
||||
delete this->huds[barNum];
|
||||
}
|
||||
this->huds[barNum] = new SBarInfoMainBlock(this);
|
||||
if(barNum == STBAR_AUTOMAP)
|
||||
{
|
||||
|
|
|
@ -3588,7 +3588,7 @@ void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, a
|
|||
{
|
||||
if (bleedtrace.HitType == TRACE_HitWall)
|
||||
{
|
||||
PalEntry bloodcolor = (PalEntry)actor->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
PalEntry bloodcolor = actor->GetBloodColor();
|
||||
if (bloodcolor != 0)
|
||||
{
|
||||
bloodcolor.r>>=1; // the full color is too bright for blood decals
|
||||
|
@ -4592,34 +4592,40 @@ void P_DoCrunch (AActor *thing, FChangePosition *cpos)
|
|||
P_DamageMobj (thing, NULL, NULL, cpos->crushchange, NAME_Crush);
|
||||
|
||||
// spray blood in a random direction
|
||||
if ((!(thing->flags&MF_NOBLOOD)) &&
|
||||
(!(thing->flags2&(MF2_INVULNERABLE|MF2_DORMANT))))
|
||||
if (!(thing->flags2&(MF2_INVULNERABLE|MF2_DORMANT)))
|
||||
{
|
||||
PalEntry bloodcolor = (PalEntry)thing->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
const PClass *bloodcls = PClass::FindClass((ENamedName)thing->GetClass()->Meta.GetMetaInt(AMETA_BloodType, NAME_Blood));
|
||||
|
||||
P_TraceBleed (cpos->crushchange, thing);
|
||||
if (cl_bloodtype <= 1 && bloodcls != NULL)
|
||||
if (!(thing->flags&MF_NOBLOOD))
|
||||
{
|
||||
AActor *mo;
|
||||
|
||||
mo = Spawn (bloodcls, thing->x, thing->y,
|
||||
thing->z + thing->height/2, ALLOW_REPLACE);
|
||||
|
||||
mo->velx = pr_crunch.Random2 () << 12;
|
||||
mo->vely = pr_crunch.Random2 () << 12;
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
PalEntry bloodcolor = thing->GetBloodColor();
|
||||
const PClass *bloodcls = thing->GetBloodType();
|
||||
|
||||
P_TraceBleed (cpos->crushchange, thing);
|
||||
if (cl_bloodtype <= 1 && bloodcls != NULL)
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
AActor *mo;
|
||||
|
||||
mo = Spawn (bloodcls, thing->x, thing->y,
|
||||
thing->z + thing->height/2, ALLOW_REPLACE);
|
||||
|
||||
mo->velx = pr_crunch.Random2 () << 12;
|
||||
mo->vely = pr_crunch.Random2 () << 12;
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
}
|
||||
}
|
||||
if (cl_bloodtype >= 1)
|
||||
{
|
||||
angle_t an;
|
||||
|
||||
an = (M_Random () - 128) << 24;
|
||||
P_DrawSplash2 (32, thing->x, thing->y,
|
||||
thing->z + thing->height/2, an, 2, bloodcolor);
|
||||
}
|
||||
}
|
||||
if (cl_bloodtype >= 1)
|
||||
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))
|
||||
{
|
||||
angle_t an;
|
||||
|
||||
an = (M_Random () - 128) << 24;
|
||||
P_DrawSplash2 (32, thing->x, thing->y,
|
||||
thing->z + thing->height/2, an, 2, bloodcolor);
|
||||
S_Sound(thing, CHAN_VOICE, thing->CrushPainSound, 1.f, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,8 +270,12 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< ActiveSound
|
||||
<< UseSound
|
||||
<< BounceSound
|
||||
<< WallBounceSound
|
||||
<< Speed
|
||||
<< WallBounceSound;
|
||||
if (SaveVersion >= 2234)
|
||||
{
|
||||
arc << CrushPainSound;
|
||||
}
|
||||
arc << Speed
|
||||
<< FloatSpeed
|
||||
<< Mass
|
||||
<< PainChance
|
||||
|
@ -1068,7 +1072,7 @@ bool AActor::Grind(bool items)
|
|||
if (isgeneric) // Not a custom crush state, so colorize it appropriately.
|
||||
{
|
||||
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
||||
PalEntry bloodcolor = PalEntry(GetClass()->Meta.GetMetaInt(AMETA_BloodColor));
|
||||
PalEntry bloodcolor = GetBloodColor();
|
||||
if (bloodcolor!=0) Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
}
|
||||
return false;
|
||||
|
@ -1112,7 +1116,7 @@ bool AActor::Grind(bool items)
|
|||
}
|
||||
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
||||
|
||||
PalEntry bloodcolor = (PalEntry)this->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
PalEntry bloodcolor = GetBloodColor();
|
||||
if (bloodcolor!=0) gib->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
}
|
||||
if (flags & MF_ICECORPSE)
|
||||
|
@ -4502,8 +4506,8 @@ AActor *P_SpawnPuff (AActor *source, const PClass *pufftype, fixed_t x, fixed_t
|
|||
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator)
|
||||
{
|
||||
AActor *th;
|
||||
PalEntry bloodcolor = (PalEntry)originator->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
const PClass *bloodcls = PClass::FindClass((ENamedName)originator->GetClass()->Meta.GetMetaInt(AMETA_BloodType, NAME_Blood));
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
const PClass *bloodcls = originator->GetBloodType();
|
||||
|
||||
int bloodtype = cl_bloodtype;
|
||||
|
||||
|
@ -4564,8 +4568,8 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
|
|||
|
||||
void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator)
|
||||
{
|
||||
PalEntry bloodcolor = (PalEntry)originator->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
const PClass *bloodcls = PClass::FindClass((ENamedName)originator->GetClass()->Meta.GetMetaInt(AMETA_BloodType2, NAME_BloodSplatter));
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
const PClass *bloodcls = originator->GetBloodType(1);
|
||||
|
||||
int bloodtype = cl_bloodtype;
|
||||
|
||||
|
@ -4602,8 +4606,8 @@ void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator)
|
|||
|
||||
void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator)
|
||||
{
|
||||
PalEntry bloodcolor = (PalEntry)originator->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
const PClass *bloodcls = PClass::FindClass((ENamedName)originator->GetClass()->Meta.GetMetaInt(AMETA_BloodType3, NAME_AxeBlood));
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
const PClass *bloodcls = originator->GetBloodType(2);
|
||||
|
||||
int bloodtype = cl_bloodtype;
|
||||
|
||||
|
@ -4641,8 +4645,8 @@ void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator)
|
|||
void P_RipperBlood (AActor *mo, AActor *bleeder)
|
||||
{
|
||||
fixed_t x, y, z;
|
||||
PalEntry bloodcolor = (PalEntry)bleeder->GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||
const PClass *bloodcls = PClass::FindClass((ENamedName)bleeder->GetClass()->Meta.GetMetaInt(AMETA_BloodType, NAME_Blood));
|
||||
PalEntry bloodcolor = bleeder->GetBloodColor();
|
||||
const PClass *bloodcls = bleeder->GetBloodType();
|
||||
|
||||
x = mo->x + (pr_ripperblood.Random2 () << 12);
|
||||
y = mo->y + (pr_ripperblood.Random2 () << 12);
|
||||
|
|
|
@ -554,6 +554,15 @@ DEFINE_PROPERTY(howlsound, S, Actor)
|
|||
info->Class->Meta.SetMetaInt (AMETA_HowlSound, S_FindSound(str));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_PROPERTY(crushpainsound, S, Actor)
|
||||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
defaults->CrushPainSound = str;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -21,6 +21,7 @@ ACTOR Macil1 64
|
|||
SeeSound "macil/sight"
|
||||
PainSound "macil/pain"
|
||||
ActiveSound "macil/active"
|
||||
CrushPainSound "misc/pcrush"
|
||||
Tag "MACIL"
|
||||
Obituary "$OB_MACIL"
|
||||
DropItem "BoxOfBullets"
|
||||
|
|
|
@ -7,6 +7,7 @@ ACTOR Merchant
|
|||
Radius 20
|
||||
Height 56
|
||||
Mass 5000
|
||||
CrushPainSound "misc/pcrush"
|
||||
+SOLID
|
||||
+SHOOTABLE
|
||||
+NOTDMATCH
|
||||
|
|
|
@ -7,6 +7,7 @@ ACTOR StrifeHumanoid
|
|||
MaxStepHeight 16
|
||||
MaxDropoffHeight 32
|
||||
|
||||
CrushPainSound "misc/pcrush"
|
||||
States
|
||||
{
|
||||
Burn:
|
||||
|
|
|
@ -9,6 +9,7 @@ ACTOR StrifePlayer : PlayerPawn
|
|||
PainChance 255
|
||||
Speed 1
|
||||
MaxStepHeight 16
|
||||
CrushPainSound "misc/pcrush"
|
||||
Player.DisplayName "Rebel"
|
||||
Player.StartItem "PunchDagger"
|
||||
Player.RunHealth 15
|
||||
|
|
|
@ -19,6 +19,7 @@ ACTOR Templar 3003
|
|||
PainSound "templar/pain"
|
||||
DeathSound "templar/death"
|
||||
ActiveSound "templar/active"
|
||||
CrushPainSound "misc/pcrush"
|
||||
Tag "TEMPLAR"
|
||||
HitObituary "$OB_TEMPLARHIT"
|
||||
Obituary "$OB_TEMPLAR"
|
||||
|
|
|
@ -20,6 +20,7 @@ ACTOR Zombie : StrifeHumanoid 169
|
|||
Translation 0
|
||||
ConversationID 28, -1, -1
|
||||
DeathSound "zombie/death"
|
||||
CrushPainSound "misc/pcrush"
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -34,7 +35,7 @@ ACTOR Zombie : StrifeHumanoid 169
|
|||
GIBS O 5 A_NoBlocking
|
||||
GIBS PQRST 4 A_TossGib
|
||||
GIBS U 5
|
||||
GIBS V 1400
|
||||
GIBS V -1
|
||||
Stop
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1124,6 +1124,7 @@ misc/teleport dstelept
|
|||
misc/swish dsswish
|
||||
misc/meathit dsmeatht
|
||||
misc/metalhit dsmtalht
|
||||
misc/pcrush dspcrush
|
||||
misc/gibbed dsslop
|
||||
misc/explosion dsexplod
|
||||
misc/reactor dsreactr
|
||||
|
|
Loading…
Reference in a new issue