diff --git a/src/actor.h b/src/actor.h index 6e8af2498..0f9a90e0e 100644 --- a/src/actor.h +++ b/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; diff --git a/src/d_main.cpp b/src/d_main.cpp index f75540983..19db0885d 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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); diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index 1344ad1c0..e020d4258 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -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) { diff --git a/src/p_map.cpp b/src/p_map.cpp index ebcb701f6..019c8087a 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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); } } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f581312f9..8fa00645f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 0c2a8c96d..f58eb6500 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/strife/macil.txt b/wadsrc/static/actors/strife/macil.txt index ea701dd9f..ba99be435 100644 --- a/wadsrc/static/actors/strife/macil.txt +++ b/wadsrc/static/actors/strife/macil.txt @@ -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" diff --git a/wadsrc/static/actors/strife/merchants.txt b/wadsrc/static/actors/strife/merchants.txt index d06ee607d..65f5ac653 100644 --- a/wadsrc/static/actors/strife/merchants.txt +++ b/wadsrc/static/actors/strife/merchants.txt @@ -7,6 +7,7 @@ ACTOR Merchant Radius 20 Height 56 Mass 5000 + CrushPainSound "misc/pcrush" +SOLID +SHOOTABLE +NOTDMATCH diff --git a/wadsrc/static/actors/strife/strifehumanoid.txt b/wadsrc/static/actors/strife/strifehumanoid.txt index c81f40f34..375f5bbcf 100644 --- a/wadsrc/static/actors/strife/strifehumanoid.txt +++ b/wadsrc/static/actors/strife/strifehumanoid.txt @@ -7,6 +7,7 @@ ACTOR StrifeHumanoid MaxStepHeight 16 MaxDropoffHeight 32 + CrushPainSound "misc/pcrush" States { Burn: diff --git a/wadsrc/static/actors/strife/strifeplayer.txt b/wadsrc/static/actors/strife/strifeplayer.txt index 1dabeff4c..5b0bdc750 100644 --- a/wadsrc/static/actors/strife/strifeplayer.txt +++ b/wadsrc/static/actors/strife/strifeplayer.txt @@ -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 diff --git a/wadsrc/static/actors/strife/templar.txt b/wadsrc/static/actors/strife/templar.txt index fd8351c89..214804b34 100644 --- a/wadsrc/static/actors/strife/templar.txt +++ b/wadsrc/static/actors/strife/templar.txt @@ -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" diff --git a/wadsrc/static/actors/strife/zombie.txt b/wadsrc/static/actors/strife/zombie.txt index e26f8b266..9788bc00f 100644 --- a/wadsrc/static/actors/strife/zombie.txt +++ b/wadsrc/static/actors/strife/zombie.txt @@ -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 } } diff --git a/wadsrc/static/sndinfo.txt b/wadsrc/static/sndinfo.txt index c534808bb..100485e28 100644 --- a/wadsrc/static/sndinfo.txt +++ b/wadsrc/static/sndinfo.txt @@ -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