From 063c85b1572bb916ff9265708d3f5b9fdba2e1de Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Oct 2006 14:53:21 +0000 Subject: [PATCH] - Fixed: The global WeaponSection string was never freed. It has been replaced with an FString now. - Fixed: The music strings in the default level info were never freed and caused memory leaks when used repeatedly. - Fixed: The intermusic string in the level info was never freed. - Fixed: The default fire obituary should only be printed if the damage came from the environment. If it comes from a monster the monster specific obituary should be used instead. - Added custom damage types from the floating point test release. - Changed Pain Elemental's massacre check. Now A_PainDie checks for the damage type and doesn't spawn anything if it is NAME_Massacre. A_PainDie can also be used by other actors so a more generalized approach is needed than hard coding it into the Pain Elemental. - Converted a few of Doom's monsters to DECORATE because I couldn't test the first version of the custom state code with the corpses inheriting from them. - Added custom states from last year's floating point test release and fixed some bugs I found in that code. Unfortunately it wasn't all salvageable and it was easier to recreate some parts from scratch. SVN r368 (trunk) --- docs/rh-log.txt | 20 + src/actor.h | 23 +- src/d_dehacked.cpp | 66 +++- src/decorations.cpp | 18 +- src/dobjtype.cpp | 14 + src/dobjtype.h | 1 + src/doomdef.h | 23 -- src/f_finale.cpp | 2 +- src/g_doom/a_archvile.cpp | 15 +- src/g_doom/a_bruiser.cpp | 197 +--------- src/g_doom/a_cacodemon.cpp | 111 +----- src/g_doom/a_demon.cpp | 95 +---- src/g_doom/a_doomimp.cpp | 125 +------ src/g_doom/a_doomweaps.cpp | 38 +- src/g_doom/a_lostsoul.cpp | 57 --- src/g_doom/a_painelemental.cpp | 28 +- src/g_doom/a_possessed.cpp | 380 +------------------ src/g_doom/a_revenant.cpp | 2 +- src/g_doom/a_scriptedmarine.cpp | 10 +- src/g_heretic/a_beast.cpp | 2 +- src/g_heretic/a_chicken.cpp | 13 +- src/g_heretic/a_clink.cpp | 2 +- src/g_heretic/a_dsparil.cpp | 8 +- src/g_heretic/a_hereticartifacts.cpp | 2 +- src/g_heretic/a_hereticimp.cpp | 4 +- src/g_heretic/a_hereticmisc.cpp | 6 +- src/g_heretic/a_hereticweaps.cpp | 16 +- src/g_heretic/a_ironlich.cpp | 6 +- src/g_heretic/a_knight.cpp | 2 +- src/g_heretic/a_mummy.cpp | 4 +- src/g_heretic/a_wizard.cpp | 2 +- src/g_hexen/a_bats.cpp | 2 +- src/g_hexen/a_bishop.cpp | 2 +- src/g_hexen/a_centaur.cpp | 2 +- src/g_hexen/a_clericflame.cpp | 4 +- src/g_hexen/a_clericholy.cpp | 6 +- src/g_hexen/a_clericmace.cpp | 6 +- src/g_hexen/a_clericstaff.cpp | 4 +- src/g_hexen/a_demons.cpp | 6 +- src/g_hexen/a_dragon.cpp | 8 +- src/g_hexen/a_ettin.cpp | 2 +- src/g_hexen/a_fighteraxe.cpp | 24 +- src/g_hexen/a_fighterhammer.cpp | 8 +- src/g_hexen/a_fighterplayer.cpp | 6 +- src/g_hexen/a_firedemon.cpp | 2 +- src/g_hexen/a_flechette.cpp | 6 +- src/g_hexen/a_fog.cpp | 2 +- src/g_hexen/a_heresiarch.cpp | 12 +- src/g_hexen/a_hexenspecialdecs.cpp | 10 +- src/g_hexen/a_iceguy.cpp | 6 +- src/g_hexen/a_magecone.cpp | 6 +- src/g_hexen/a_magelightning.cpp | 8 +- src/g_hexen/a_magestaff.cpp | 4 +- src/g_hexen/a_pig.cpp | 11 +- src/g_hexen/a_serpent.cpp | 4 +- src/g_hexen/a_spike.cpp | 2 +- src/g_hexen/a_teleportother.cpp | 2 +- src/g_hexen/a_wraith.cpp | 4 +- src/g_level.cpp | 19 + src/g_raven/a_minotaur.cpp | 16 +- src/g_shared/a_action.cpp | 6 +- src/g_shared/a_artifacts.cpp | 8 +- src/g_shared/a_artifacts.h | 4 +- src/g_shared/a_hatetarget.cpp | 4 +- src/g_shared/a_pickups.cpp | 31 +- src/g_shared/a_pickups.h | 19 +- src/g_shared/a_quake.cpp | 2 +- src/g_shared/a_weapons.cpp | 43 ++- src/g_shared/shared_sbar.cpp | 2 +- src/g_strife/a_alienspectres.cpp | 2 +- src/g_strife/a_entityboss.cpp | 4 +- src/g_strife/a_loremaster.cpp | 2 +- src/g_strife/a_macil.cpp | 4 +- src/g_strife/a_oracle.cpp | 2 +- src/g_strife/a_programmer.cpp | 2 +- src/g_strife/a_reaver.cpp | 4 +- src/g_strife/a_rebels.cpp | 2 +- src/g_strife/a_sentinel.cpp | 2 +- src/g_strife/a_stalker.cpp | 2 +- src/g_strife/a_strifeglobal.h | 2 +- src/g_strife/a_strifestuff.cpp | 8 +- src/g_strife/a_strifeweapons.cpp | 27 +- src/g_strife/a_templar.cpp | 2 +- src/g_strife/a_thingstoblowup.cpp | 2 +- src/gameconfigfile.cpp | 6 +- src/gameconfigfile.h | 2 +- src/info.cpp | 322 ++++++++++++++++ src/info.h | 36 +- src/infodefaults.cpp | 49 ++- src/infomacros.h | 7 +- src/m_cheat.cpp | 8 +- src/namedef.h | 83 +++-- src/p_acs.cpp | 13 +- src/p_enemy.cpp | 2 +- src/p_interaction.cpp | 186 +++++----- src/p_lnspec.cpp | 47 ++- src/p_lnspec.h | 2 + src/p_local.h | 8 +- src/p_map.cpp | 25 +- src/p_mobj.cpp | 117 +++--- src/p_pspr.cpp | 27 +- src/p_spec.cpp | 30 +- src/p_terrain.cpp | 32 +- src/p_terrain.h | 2 +- src/p_user.cpp | 10 +- src/po_man.cpp | 2 +- src/thingdef.cpp | 526 ++++++++++++++++++--------- src/thingdef.h | 5 + src/thingdef_codeptr.cpp | 22 +- src/version.h | 10 +- wadsrc/decorate/decorate.txt | 7 + wadsrc/decorate/doom/bruiser.txt | 135 +++++++ wadsrc/decorate/doom/cacodemon.txt | 88 +++++ wadsrc/decorate/doom/demon.txt | 74 ++++ wadsrc/decorate/doom/doomimp.txt | 90 +++++ wadsrc/decorate/doom/lostsoul.txt | 51 +++ wadsrc/decorate/doom/possessed.txt | 248 +++++++++++++ wadsrc/zdoom.lst | 7 + 118 files changed, 2118 insertions(+), 1833 deletions(-) create mode 100644 wadsrc/decorate/doom/bruiser.txt create mode 100644 wadsrc/decorate/doom/cacodemon.txt create mode 100644 wadsrc/decorate/doom/demon.txt create mode 100644 wadsrc/decorate/doom/doomimp.txt create mode 100644 wadsrc/decorate/doom/lostsoul.txt create mode 100644 wadsrc/decorate/doom/possessed.txt diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 52c7fad68..f57cf50bc 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,23 @@ +October 31, 2006 (Changes by Graf Zahl) +- Fixed: The global WeaponSection string was never freed. It has been replaced + with an FString now. +- Fixed: The music strings in the default level info were never freed and + caused memory leaks when used repeatedly. +- Fixed: The intermusic string in the level info was never freed. +- Fixed: The default fire obituary should only be printed if the damage + came from the environment. If it comes from a monster the monster specific + obituary should be used instead. +- Added custom damage types from the floating point test release. +- Changed Pain Elemental's massacre check. Now A_PainDie checks for the damage + type and doesn't spawn anything if it is NAME_Massacre. A_PainDie can also + be used by other actors so a more generalized approach is needed than hard + coding it into the Pain Elemental. +- Converted a few of Doom's monsters to DECORATE because I couldn't test the + first version of the custom state code with the corpses inheriting from them. +- Added custom states from last year's floating point test release and fixed + some bugs I found in that code. Unfortunately it wasn't all salvageable + and it was easier to recreate some parts from scratch. + October 30, 2006 - Version bump to 2.1.7. - Fixed: Placing a /* */ comment at the very end of a file without a diff --git a/src/actor.h b/src/actor.h index 5daa657e9..5ca2a1e12 100644 --- a/src/actor.h +++ b/src/actor.h @@ -472,7 +472,7 @@ public: virtual int DoSpecialDamage (AActor *target, int damage); // Like DoSpecialDamage, but called on the actor receiving the damage. - virtual int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype); + virtual int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); // Centaurs and ettins squeal when electrocuted, poisoned, or "holy"-ed virtual void Howl (); @@ -699,26 +699,12 @@ public: fixed_t MaxDropOffHeight, MaxStepHeight; SDWORD Mass; SWORD PainChance; - BYTE DamageType; + FNameNoInit DamageType; FState *SpawnState; FState *SeeState; - FState *PainState; FState *MeleeState; FState *MissileState; - FState *CrashState; - FState *DeathState; - FState *XDeathState; - FState *BDeathState; - FState *IDeathState; - FState *EDeathState; - FState *RaiseState; - FState *WoundState; - FState *HealState; - FState *CrushState; - FState *YesState; - FState *NoState; - FState *GreetingsState; // [RH] The dialogue to show when this actor is "used." FStrifeDialogueNode *Conversation; @@ -754,6 +740,11 @@ public: bool SetStateNF (FState *newstate); bool UpdateWaterLevel (fixed_t oldz); + FState *FindState (FName label) const; + FState *FindState (int numnames, int first, ...) const; + FState *FindState (int numnames, va_list arglist) const; + bool HasStates (FName label) const; + static FState States[]; enum { S_NULL = 2, S_GENERICFREEZEDEATH = 3 }; diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index d4493b410..34b1c73b0 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -63,6 +63,7 @@ #include "r_draw.h" #include "v_palette.h" #include "a_sharedglobal.h" +#include "thingdef.h" // [SO] Just the way Randy said to do it :) // [RH] Made this CVAR_SERVERINFO @@ -712,6 +713,7 @@ static int PatchThing (int thingy) bool hadHeight = false; bool hadTranslucency = false; bool hadStyle = false; + bool patchedStates = false; int oldflags; const PClass *type; SWORD *ednum, dummyed; @@ -841,27 +843,38 @@ static int PatchThing (int thingy) { FState *state = FindState (val); + if (type != NULL && !patchedStates) + { + MakeStateDefines(type->ActorInfo->StateList); + patchedStates = true; + } + if (!strnicmp (Line1, "Initial", 7)) - info->SpawnState = state ? state : GetDefault()->SpawnState; + AddState("Spawn", state ? state : GetDefault()->SpawnState); else if (!strnicmp (Line1, "First moving", 12)) - info->SeeState = state; + AddState("See", state); else if (!strnicmp (Line1, "Injury", 6)) - info->PainState = state; + AddState("Pain", state); else if (!strnicmp (Line1, "Close attack", 12)) - info->MeleeState = state; + { + if (thingy != 1) // Not for players! + { + AddState("Melee", state); + } + } else if (!strnicmp (Line1, "Far attack", 10)) { if (thingy != 1) // Not for players! { - info->MissileState = state; + AddState("Missile", state); } } else if (!strnicmp (Line1, "Death", 5)) - info->DeathState = state; + AddState("Death", state); else if (!strnicmp (Line1, "Exploding", 9)) - info->XDeathState = state; + AddState("XDeath", state); else if (!strnicmp (Line1, "Respawn", 7)) - info->RaiseState = state; + AddState("Raise", state); } else if (stricmp (Line1 + linelen - 6, " sound") == 0) { @@ -979,12 +992,12 @@ static int PatchThing (int thingy) // Damage types that once were flags but now are not if (info->flags2 & 0x20000000) { - info->DamageType = MOD_ICE; + info->DamageType = NAME_Ice; info->flags2 &= ~0x20000000; } if (info->flags2 & 0x10000) { - info->DamageType = MOD_FIRE; + info->DamageType = NAME_Fire; info->flags2 &= ~0x10000; } } @@ -1064,6 +1077,10 @@ static int PatchThing (int thingy) { info->flags3 &= ~MF3_ISMONSTER; } + if (patchedStates) + { + InstallStates(type->ActorInfo, info); + } } return result; @@ -1370,17 +1387,21 @@ static int PatchAmmo (int ammoNum) static int PatchWeapon (int weapNum) { int result; + const PClass *type; AWeapon *info; BYTE dummy[sizeof(AWeapon)]; + bool patchedStates = false; if (weapNum >= 0 && weapNum < 9) { - info = (AWeapon *)GetDefaultByName (WeaponNames[weapNum]); + type = PClass::FindClass(WeaponNames[weapNum]); + info = (AWeapon *)GetDefaultByType (type); DPrintf ("Weapon %d\n", weapNum); } else { info = (AWeapon *)&dummy; + type = NULL; Printf ("Weapon %d out of range.\n", weapNum); } @@ -1394,16 +1415,22 @@ static int PatchWeapon (int weapNum) { FState *state = FindState (val); + if (type != NULL && !patchedStates) + { + MakeStateDefines(type->ActorInfo->StateList); + patchedStates = true; + } + if (strnicmp (Line1, "Deselect", 8) == 0) - info->UpState = state; + AddState("Select", state); else if (strnicmp (Line1, "Select", 6) == 0) - info->DownState = state; + AddState("Deselect", state); else if (strnicmp (Line1, "Bobbing", 7) == 0) - info->ReadyState = state; + AddState("Ready", state); else if (strnicmp (Line1, "Shooting", 8) == 0) - info->AtkState = info->HoldAtkState = state; + AddState("Fire", state); else if (strnicmp (Line1, "Firing", 6) == 0) - info->FlashState = state; + AddState("Flash", state); } else if (stricmp (Line1, "Ammo type") == 0) { @@ -1458,6 +1485,11 @@ static int PatchWeapon (int weapNum) info->AmmoUse1 = 0; } + if (patchedStates) + { + InstallStates(type->ActorInfo, info); + } + return result; } @@ -2446,7 +2478,7 @@ static bool LoadDehSupp () StateMap[i].State = def->SpawnState; break; case DeathState: - StateMap[i].State = def->DeathState; + StateMap[i].State = type->ActorInfo->FindStateExact(1, NAME_Death); break; } StateMap[i].StateSpan = supp[6+i*4+3]; diff --git a/src/decorations.cpp b/src/decorations.cpp index 86ea4fcb1..02b66e237 100644 --- a/src/decorations.cpp +++ b/src/decorations.cpp @@ -345,6 +345,7 @@ static void ParseDecorate (void (*process)(FState *, int)) info = type->ActorInfo; info->GameFilter = 0x80; Decorations.Push (info); + ClearStateLabels(); SC_MustGetString (); while (!SC_Compare ("{")) @@ -482,7 +483,7 @@ static void ParseDecorate (void (*process)(FState *, int)) if (extra.DeathHeight == 0) extra.DeathHeight = ((AActor*)(type->Defaults))->height; info->Class->Meta.SetMetaFixed (AMETA_DeathHeight, extra.DeathHeight); } - ((AActor *)(type->Defaults))->DeathState = &info->OwnedStates[extra.DeathStart]; + AddState("Death", &info->OwnedStates[extra.DeathStart]); } // Burn states are the same as death states, except they can optionally terminate @@ -521,7 +522,7 @@ static void ParseDecorate (void (*process)(FState *, int)) if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(type->Defaults))->height; type->Meta.SetMetaFixed (AMETA_BurnHeight, extra.BurnHeight); - ((AActor *)(type->Defaults))->BDeathState = &info->OwnedStates[extra.FireDeathStart]; + AddState("Burn", &info->OwnedStates[extra.FireDeathStart]); } // Ice states are similar to burn and death, except their final frame enters @@ -542,11 +543,11 @@ static void ParseDecorate (void (*process)(FState *, int)) info->OwnedStates[i].Tics = 2; info->OwnedStates[i].Misc1 = 0; info->OwnedStates[i].Action = A_FreezeDeathChunks; - ((AActor *)(type->Defaults))->IDeathState = &info->OwnedStates[extra.IceDeathStart]; + AddState("Ice", &info->OwnedStates[extra.IceDeathStart]); } else if (extra.bGenericIceDeath) { - ((AActor *)(type->Defaults))->IDeathState = &AActor::States[AActor::S_GENERICFREEZEDEATH]; + AddState("Ice", &AActor::States[AActor::S_GENERICFREEZEDEATH]); } } if (def == DEF_BreakableDecoration) @@ -557,7 +558,8 @@ static void ParseDecorate (void (*process)(FState *, int)) { ((AActor *)(type->Defaults))->flags |= MF_DROPOFF|MF_MISSILE; } - ((AActor *)(type->Defaults))->SpawnState = &info->OwnedStates[extra.SpawnStart]; + AddState("Spawn", &info->OwnedStates[extra.SpawnStart]); + InstallStates(info, ((AActor *)(type->Defaults))); process (info->OwnedStates, info->NumOwnedStates); } } @@ -728,15 +730,15 @@ static void ParseInsideDecoration (FActorInfo *info, AActor *defaults, SC_MustGetString (); if (SC_Compare ("Normal")) { - defaults->DamageType = 0; + defaults->DamageType = NAME_None; } else if (SC_Compare ("Ice")) { - defaults->DamageType = MOD_ICE; + defaults->DamageType = NAME_Ice; } else if (SC_Compare ("Fire")) { - defaults->DamageType = MOD_FIRE; + defaults->DamageType = NAME_Fire; } else { diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 0f5542671..f3c38fcff 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -85,6 +85,8 @@ void PClass::StaticFreeData (PClass *type) delete[] type->Defaults; type->Defaults = NULL; } + type->FreeStateList (); + if (type->bRuntimeClass) { if (type->ActorInfo != NULL) @@ -99,6 +101,7 @@ void PClass::StaticFreeData (PClass *type) } delete type; } + } void ClassReg::RegisterClass () @@ -288,3 +291,14 @@ void PClass::BuildFlatPointers () } } } + +void PClass::FreeStateList () +{ + if (ActorInfo != NULL && ActorInfo->StateList != NULL) + { + ActorInfo->StateList->Destroy(); + free (ActorInfo->StateList); + ActorInfo->StateList = NULL; + } +} + diff --git a/src/dobjtype.h b/src/dobjtype.h index 725b842f3..53b5dff73 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -31,6 +31,7 @@ struct PClass DObject *CreateNew () const; PClass *CreateDerivedClass (FName name, unsigned int size); void BuildFlatPointers (); + void FreeStateList(); // Returns true if this type is an ancestor of (or same as) the passed type. bool IsAncestorOf (const PClass *ti) const diff --git a/src/doomdef.h b/src/doomdef.h index fdb174ed0..125c27d02 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -289,29 +289,6 @@ enum #define FRICTION_LOW 0xf900 #define FRICTION_FLY 0xeb00 -// [RH] Means of death flags (based on Quake2's) -#define MOD_UNKNOWN 0 -#define MOD_ROCKET 5 -#define MOD_R_SPLASH 6 -#define MOD_BFG_SPLASH 9 -#define MOD_WATER 12 -#define MOD_SLIME 13 -#define MOD_FIRE 14 -#define MOD_CRUSH 15 -#define MOD_TELEFRAG 16 -#define MOD_FALLING 17 -#define MOD_SUICIDE 18 -#define MOD_BARREL 19 -#define MOD_EXIT 20 -#define MOD_SPLASH 21 -#define MOD_HIT 22 -#define MOD_RAILGUN 23 -#define MOD_ICE 24 -#define MOD_DISINTEGRATE 25 -#define MOD_POISON 26 -#define MOD_ELECTRIC 27 -#define MOD_MASSACRE 1000 // Damaged by the massacre cheat -#define MOD_FRIENDLY_FIRE 0x80000000 #define BLINKTHRESHOLD (4*32) diff --git a/src/f_finale.cpp b/src/f_finale.cpp index 3cb96a8b9..68c0a26db 100644 --- a/src/f_finale.cpp +++ b/src/f_finale.cpp @@ -708,7 +708,7 @@ bool F_CastResponder (event_t* ev) // go into death frame castdeath = true; - caststate = castorder[castnum].info->DeathState; + caststate = castorder[castnum].info->FindState(NAME_Death); if (caststate != NULL) { casttics = caststate->GetTics(); diff --git a/src/g_doom/a_archvile.cpp b/src/g_doom/a_archvile.cpp index b60718291..5f08a550f 100644 --- a/src/g_doom/a_archvile.cpp +++ b/src/g_doom/a_archvile.cpp @@ -152,6 +152,7 @@ static AActor *corpsehit; static AActor *vileobj; static fixed_t viletryx; static fixed_t viletryy; +static FState *raisestate; bool PIT_VileCheck (AActor *thing) { @@ -164,7 +165,8 @@ bool PIT_VileCheck (AActor *thing) if (thing->tics != -1) return true; // not lying still yet - if (thing->RaiseState == NULL) + raisestate = thing->FindState(NAME_Raise); + if (raisestate == NULL) return true; // monster doesn't have a raise state // This may be a potential problem if this is used by something other @@ -253,9 +255,10 @@ void A_VileChase (AActor *self) // Make the state the monster enters customizable - but leave the // default for Dehacked compatibility! - if (self->HealState != NULL) + FState * state = self->FindState(NAME_Heal); + if (state != NULL) { - self->SetState (self->HealState); + self->SetState (state); } else { @@ -264,7 +267,7 @@ void A_VileChase (AActor *self) S_Sound (corpsehit, CHAN_BODY, "vile/raise", 1, ATTN_IDLE); info = corpsehit->GetDefault (); - corpsehit->SetState (info->RaiseState); + corpsehit->SetState (raisestate); corpsehit->height = info->height; // [RH] Use real mobj height corpsehit->radius = info->radius; // [RH] Use real radius /* @@ -390,7 +393,7 @@ void A_VileAttack (AActor *actor) return; S_Sound (actor, CHAN_WEAPON, "vile/stop", 1, ATTN_NORM); - P_DamageMobj (actor->target, actor, actor, 20, MOD_UNKNOWN); + P_DamageMobj (actor->target, actor, actor, 20, NAME_None); P_TraceBleed (20, actor->target); actor->target->momz = 1000 * FRACUNIT / actor->target->Mass; @@ -404,5 +407,5 @@ void A_VileAttack (AActor *actor) // move the fire between the vile and the player fire->x = actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]); fire->y = actor->target->y - FixedMul (24*FRACUNIT, finesine[an]); - P_RadiusAttack (fire, actor, 70, 70, MOD_FIRE, false); + P_RadiusAttack (fire, actor, 70, 70, NAME_Fire, false); } diff --git a/src/g_doom/a_bruiser.cpp b/src/g_doom/a_bruiser.cpp index c22edbb1f..af2cb5768 100644 --- a/src/g_doom/a_bruiser.cpp +++ b/src/g_doom/a_bruiser.cpp @@ -10,199 +10,6 @@ static FRandom pr_bruisattack ("BruisAttack"); -void A_BruisAttack (AActor *); - -class ABaronOfHell : public AActor -{ - DECLARE_ACTOR (ABaronOfHell, AActor) -}; - -FState ABaronOfHell::States[] = -{ -#define S_BOSS_STND 0 - S_NORMAL (BOSS, 'A', 10, A_Look , &States[S_BOSS_STND+1]), - S_NORMAL (BOSS, 'B', 10, A_Look , &States[S_BOSS_STND]), - -#define S_BOSS_RUN (S_BOSS_STND+2) - S_NORMAL (BOSS, 'A', 3, A_Chase , &States[S_BOSS_RUN+1]), - S_NORMAL (BOSS, 'A', 3, A_Chase , &States[S_BOSS_RUN+2]), - S_NORMAL (BOSS, 'B', 3, A_Chase , &States[S_BOSS_RUN+3]), - S_NORMAL (BOSS, 'B', 3, A_Chase , &States[S_BOSS_RUN+4]), - S_NORMAL (BOSS, 'C', 3, A_Chase , &States[S_BOSS_RUN+5]), - S_NORMAL (BOSS, 'C', 3, A_Chase , &States[S_BOSS_RUN+6]), - S_NORMAL (BOSS, 'D', 3, A_Chase , &States[S_BOSS_RUN+7]), - S_NORMAL (BOSS, 'D', 3, A_Chase , &States[S_BOSS_RUN+0]), - -#define S_BOSS_ATK (S_BOSS_RUN+8) - S_NORMAL (BOSS, 'E', 8, A_FaceTarget , &States[S_BOSS_ATK+1]), - S_NORMAL (BOSS, 'F', 8, A_FaceTarget , &States[S_BOSS_ATK+2]), - S_NORMAL (BOSS, 'G', 8, A_BruisAttack , &States[S_BOSS_RUN+0]), - -#define S_BOSS_PAIN (S_BOSS_ATK+3) - S_NORMAL (BOSS, 'H', 2, NULL , &States[S_BOSS_PAIN+1]), - S_NORMAL (BOSS, 'H', 2, A_Pain , &States[S_BOSS_RUN+0]), - -#define S_BOSS_DIE (S_BOSS_PAIN+2) - S_NORMAL (BOSS, 'I', 8, NULL , &States[S_BOSS_DIE+1]), - S_NORMAL (BOSS, 'J', 8, A_Scream , &States[S_BOSS_DIE+2]), - S_NORMAL (BOSS, 'K', 8, NULL , &States[S_BOSS_DIE+3]), - S_NORMAL (BOSS, 'L', 8, A_NoBlocking , &States[S_BOSS_DIE+4]), - S_NORMAL (BOSS, 'M', 8, NULL , &States[S_BOSS_DIE+5]), - S_NORMAL (BOSS, 'N', 8, NULL , &States[S_BOSS_DIE+6]), - S_NORMAL (BOSS, 'O', -1, A_BossDeath , NULL), - -#define S_BOSS_RAISE (S_BOSS_DIE+7) - S_NORMAL (BOSS, 'O', 8, NULL , &States[S_BOSS_RAISE+1]), - S_NORMAL (BOSS, 'N', 8, NULL , &States[S_BOSS_RAISE+2]), - S_NORMAL (BOSS, 'M', 8, NULL , &States[S_BOSS_RAISE+3]), - S_NORMAL (BOSS, 'L', 8, NULL , &States[S_BOSS_RAISE+4]), - S_NORMAL (BOSS, 'K', 8, NULL , &States[S_BOSS_RAISE+5]), - S_NORMAL (BOSS, 'J', 8, NULL , &States[S_BOSS_RAISE+6]), - S_NORMAL (BOSS, 'I', 8, NULL , &States[S_BOSS_RUN+0]) -}; - -IMPLEMENT_ACTOR (ABaronOfHell, Doom, 3003, 3) - PROP_SpawnHealth (1000) - PROP_RadiusFixed (24) - PROP_HeightFixed (64) - PROP_Mass (1000) - PROP_SpeedFixed (8) - PROP_PainChance (50) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - PROP_Flags4 (MF4_BOSSDEATH) - - PROP_SpawnState (S_BOSS_STND) - PROP_SeeState (S_BOSS_RUN) - PROP_PainState (S_BOSS_PAIN) - PROP_MeleeState (S_BOSS_ATK) - PROP_MissileState (S_BOSS_ATK) - PROP_DeathState (S_BOSS_DIE) - PROP_RaiseState (S_BOSS_RAISE) - - PROP_SeeSound ("baron/sight") - PROP_PainSound ("baron/pain") - PROP_DeathSound ("baron/death") - PROP_ActiveSound ("baron/active") - PROP_Obituary("$OB_BARON") - PROP_HitObituary("$OB_BARONHIT") - -END_DEFAULTS - -class ABaronBall : public AActor -{ - DECLARE_ACTOR (ABaronBall, AActor) -}; - -FState ABaronBall::States[] = -{ -#define S_BRBALL 0 - S_BRIGHT (BAL7, 'A', 4, NULL , &States[S_BRBALL+1]), - S_BRIGHT (BAL7, 'B', 4, NULL , &States[S_BRBALL+0]), - -#define S_BRBALLX (S_BRBALL+2) - S_BRIGHT (BAL7, 'C', 6, NULL , &States[S_BRBALLX+1]), - S_BRIGHT (BAL7, 'D', 6, NULL , &States[S_BRBALLX+2]), - S_BRIGHT (BAL7, 'E', 6, NULL , NULL) -}; - -IMPLEMENT_ACTOR (ABaronBall, Doom, -1, 154) - PROP_RadiusFixed (6) - PROP_HeightFixed (16) - PROP_SpeedFixed (15) - PROP_Damage (8) - PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) - PROP_Flags2 (MF2_PCROSS|MF2_IMPACT|MF2_NOTELEPORT) - PROP_Flags4 (MF4_RANDOMIZE) - PROP_RenderStyle (STYLE_Add) - - PROP_SpawnState (S_BRBALL) - PROP_DeathState (S_BRBALLX) - - PROP_SeeSound ("baron/attack") - PROP_DeathSound ("baron/shotx") -END_DEFAULTS - -AT_SPEED_SET (BaronBall, speed) -{ - SimpleSpeedSetter (ABaronBall, 15*FRACUNIT, 20*FRACUNIT, speed); -} - -class AHellKnight : public ABaronOfHell -{ - DECLARE_ACTOR (AHellKnight, ABaronOfHell) -}; - -FState AHellKnight::States[] = -{ -#define S_BOS2_STND 0 - S_NORMAL (BOS2, 'A', 10, A_Look , &States[S_BOS2_STND+1]), - S_NORMAL (BOS2, 'B', 10, A_Look , &States[S_BOS2_STND]), - -#define S_BOS2_RUN (S_BOS2_STND+2) - S_NORMAL (BOS2, 'A', 3, A_Chase , &States[S_BOS2_RUN+1]), - S_NORMAL (BOS2, 'A', 3, A_Chase , &States[S_BOS2_RUN+2]), - S_NORMAL (BOS2, 'B', 3, A_Chase , &States[S_BOS2_RUN+3]), - S_NORMAL (BOS2, 'B', 3, A_Chase , &States[S_BOS2_RUN+4]), - S_NORMAL (BOS2, 'C', 3, A_Chase , &States[S_BOS2_RUN+5]), - S_NORMAL (BOS2, 'C', 3, A_Chase , &States[S_BOS2_RUN+6]), - S_NORMAL (BOS2, 'D', 3, A_Chase , &States[S_BOS2_RUN+7]), - S_NORMAL (BOS2, 'D', 3, A_Chase , &States[S_BOS2_RUN+0]), - -#define S_BOS2_ATK (S_BOS2_RUN+8) - S_NORMAL (BOS2, 'E', 8, A_FaceTarget , &States[S_BOS2_ATK+1]), - S_NORMAL (BOS2, 'F', 8, A_FaceTarget , &States[S_BOS2_ATK+2]), - S_NORMAL (BOS2, 'G', 8, A_BruisAttack , &States[S_BOS2_RUN+0]), - -#define S_BOS2_PAIN (S_BOS2_ATK+3) - S_NORMAL (BOS2, 'H', 2, NULL , &States[S_BOS2_PAIN+1]), - S_NORMAL (BOS2, 'H', 2, A_Pain , &States[S_BOS2_RUN+0]), - -#define S_BOS2_DIE (S_BOS2_PAIN+2) - S_NORMAL (BOS2, 'I', 8, NULL , &States[S_BOS2_DIE+1]), - S_NORMAL (BOS2, 'J', 8, A_Scream , &States[S_BOS2_DIE+2]), - S_NORMAL (BOS2, 'K', 8, NULL , &States[S_BOS2_DIE+3]), - S_NORMAL (BOS2, 'L', 8, A_NoBlocking , &States[S_BOS2_DIE+4]), - S_NORMAL (BOS2, 'M', 8, NULL , &States[S_BOS2_DIE+5]), - S_NORMAL (BOS2, 'N', 8, NULL , &States[S_BOS2_DIE+6]), - S_NORMAL (BOS2, 'O', -1, NULL , NULL), - -#define S_BOS2_RAISE (S_BOS2_DIE+7) - S_NORMAL (BOS2, 'O', 8, NULL , &States[S_BOS2_RAISE+1]), - S_NORMAL (BOS2, 'N', 8, NULL , &States[S_BOS2_RAISE+2]), - S_NORMAL (BOS2, 'M', 8, NULL , &States[S_BOS2_RAISE+3]), - S_NORMAL (BOS2, 'L', 8, NULL , &States[S_BOS2_RAISE+4]), - S_NORMAL (BOS2, 'K', 8, NULL , &States[S_BOS2_RAISE+5]), - S_NORMAL (BOS2, 'J', 8, NULL , &States[S_BOS2_RAISE+6]), - S_NORMAL (BOS2, 'I', 8, NULL , &States[S_BOS2_RUN+0]) -}; - -IMPLEMENT_ACTOR (AHellKnight, Doom, 69, 113) - PROP_SpawnHealth (500) - PROP_RadiusFixed (24) - PROP_HeightFixed (64) - PROP_Mass (1000) - PROP_SpeedFixed (8) - PROP_PainChance (50) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - PROP_Flags4Clear (MF4_BOSSDEATH) - - PROP_SpawnState (S_BOS2_STND) - PROP_SeeState (S_BOS2_RUN) - PROP_PainState (S_BOS2_PAIN) - PROP_MeleeState (S_BOS2_ATK) - PROP_MissileState (S_BOS2_ATK) - PROP_DeathState (S_BOS2_DIE) - PROP_RaiseState (S_BOS2_RAISE) - - PROP_SeeSound ("knight/sight") - PROP_PainSound ("knight/pain") - PROP_DeathSound ("knight/death") - PROP_ActiveSound ("knight/active") - PROP_Obituary("$OB_KNIGHT") - PROP_HitObituary("$OB_KNIGHTHIT") -END_DEFAULTS void A_BruisAttack (AActor *self) { @@ -213,11 +20,11 @@ void A_BruisAttack (AActor *self) { int damage = (pr_bruisattack()%8+1)*10; S_Sound (self, CHAN_WEAPON, "baron/melee", 1, ATTN_NORM); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); return; } // launch a missile - P_SpawnMissile (self, self->target, RUNTIME_CLASS(ABaronBall)); + P_SpawnMissile (self, self->target, PClass::FindClass("BaronBall")); } diff --git a/src/g_doom/a_cacodemon.cpp b/src/g_doom/a_cacodemon.cpp index 2a0d00970..d5ac50ee4 100644 --- a/src/g_doom/a_cacodemon.cpp +++ b/src/g_doom/a_cacodemon.cpp @@ -9,113 +9,6 @@ static FRandom pr_headattack ("HeadAttack"); -void A_HeadAttack (AActor *); - -class ACacodemon : public AActor -{ - DECLARE_ACTOR (ACacodemon, AActor) -}; - -FState ACacodemon::States[] = -{ -#define S_HEAD_STND 0 - S_NORMAL (HEAD, 'A', 10, A_Look , &States[S_HEAD_STND]), - -#define S_HEAD_RUN (S_HEAD_STND+1) - S_NORMAL (HEAD, 'A', 3, A_Chase , &States[S_HEAD_RUN+0]), - -#define S_HEAD_ATK (S_HEAD_RUN+1) - S_NORMAL (HEAD, 'B', 5, A_FaceTarget , &States[S_HEAD_ATK+1]), - S_NORMAL (HEAD, 'C', 5, A_FaceTarget , &States[S_HEAD_ATK+2]), - S_BRIGHT (HEAD, 'D', 5, A_HeadAttack , &States[S_HEAD_RUN+0]), - -#define S_HEAD_PAIN (S_HEAD_ATK+3) - S_NORMAL (HEAD, 'E', 3, NULL , &States[S_HEAD_PAIN+1]), - S_NORMAL (HEAD, 'E', 3, A_Pain , &States[S_HEAD_PAIN+2]), - S_NORMAL (HEAD, 'F', 6, NULL , &States[S_HEAD_RUN+0]), - -#define S_HEAD_DIE (S_HEAD_PAIN+3) - S_NORMAL (HEAD, 'G', 8, NULL , &States[S_HEAD_DIE+1]), - S_NORMAL (HEAD, 'H', 8, A_Scream , &States[S_HEAD_DIE+2]), - S_NORMAL (HEAD, 'I', 8, NULL , &States[S_HEAD_DIE+3]), - S_NORMAL (HEAD, 'J', 8, NULL , &States[S_HEAD_DIE+4]), - S_NORMAL (HEAD, 'K', 8, A_NoBlocking , &States[S_HEAD_DIE+5]), - S_NORMAL (HEAD, 'L', -1, A_SetFloorClip , NULL), - -#define S_HEAD_RAISE (S_HEAD_DIE+6) - S_NORMAL (HEAD, 'L', 8, A_UnSetFloorClip , &States[S_HEAD_RAISE+1]), - S_NORMAL (HEAD, 'K', 8, NULL , &States[S_HEAD_RAISE+2]), - S_NORMAL (HEAD, 'J', 8, NULL , &States[S_HEAD_RAISE+3]), - S_NORMAL (HEAD, 'I', 8, NULL , &States[S_HEAD_RAISE+4]), - S_NORMAL (HEAD, 'H', 8, NULL , &States[S_HEAD_RAISE+5]), - S_NORMAL (HEAD, 'G', 8, NULL , &States[S_HEAD_RUN+0]) -}; - -IMPLEMENT_ACTOR (ACacodemon, Doom, 3005, 19) - PROP_SpawnHealth (400) - PROP_RadiusFixed (31) - PROP_HeightFixed (56) - PROP_Mass (400) - PROP_SpeedFixed (8) - PROP_PainChance (128) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_FLOAT|MF_NOGRAVITY|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL) - - PROP_SpawnState (S_HEAD_STND) - PROP_SeeState (S_HEAD_RUN) - PROP_PainState (S_HEAD_PAIN) - PROP_MissileState (S_HEAD_ATK) - PROP_DeathState (S_HEAD_DIE) - PROP_RaiseState (S_HEAD_RAISE) - - PROP_SeeSound ("caco/sight") - PROP_PainSound ("caco/pain") - PROP_DeathSound ("caco/death") - PROP_ActiveSound ("caco/active") - PROP_AttackSound ("caco/melee") - PROP_Obituary("$OB_CACO") - PROP_HitObituary("$OB_CACOHIT") -END_DEFAULTS - -class ACacodemonBall : public AActor -{ - DECLARE_ACTOR (ACacodemonBall, AActor) -}; - -FState ACacodemonBall::States[] = -{ -#define S_RBALL 0 - S_BRIGHT (BAL2, 'A', 4, NULL , &States[S_RBALL+1]), - S_BRIGHT (BAL2, 'B', 4, NULL , &States[S_RBALL+0]), - -#define S_RBALLX (S_RBALL+2) - S_BRIGHT (BAL2, 'C', 6, NULL , &States[S_RBALLX+1]), - S_BRIGHT (BAL2, 'D', 6, NULL , &States[S_RBALLX+2]), - S_BRIGHT (BAL2, 'E', 6, NULL , NULL) -}; - -IMPLEMENT_ACTOR (ACacodemonBall, Doom, -1, 126) - PROP_RadiusFixed (6) - PROP_HeightFixed (8) - PROP_SpeedFixed (10) - PROP_Damage (5) - PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) - PROP_Flags2 (MF2_PCROSS|MF2_IMPACT|MF2_NOTELEPORT) - PROP_Flags4 (MF4_RANDOMIZE) - PROP_RenderStyle (STYLE_Add) - - PROP_SpawnState (S_RBALL) - PROP_DeathState (S_RBALLX) - - PROP_SeeSound ("caco/attack") - PROP_DeathSound ("caco/shotx") -END_DEFAULTS - -AT_SPEED_SET (CacodemonBall, speed) -{ - SimpleSpeedSetter (ACacodemonBall, 10*FRACUNIT, 20*FRACUNIT, speed); -} - void A_HeadAttack (AActor *self) { if (!self->target) @@ -126,11 +19,11 @@ void A_HeadAttack (AActor *self) { int damage = (pr_headattack()%6+1)*10; S_SoundID (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); return; } // launch a missile - P_SpawnMissile (self, self->target, RUNTIME_CLASS(ACacodemonBall)); + P_SpawnMissile (self, self->target, PClass::FindClass("CacodemonBall")); } diff --git a/src/g_doom/a_demon.cpp b/src/g_doom/a_demon.cpp index 6da6cdcb5..0db9c88ec 100644 --- a/src/g_doom/a_demon.cpp +++ b/src/g_doom/a_demon.cpp @@ -8,99 +8,6 @@ static FRandom pr_sargattack ("SargAttack"); -void A_SargAttack (AActor *); - -class ADemon : public AActor -{ - DECLARE_ACTOR (ADemon, AActor) -}; - -FState ADemon::States[] = -{ -#define S_SARG_STND 0 - S_NORMAL (SARG, 'A', 10, A_Look , &States[S_SARG_STND+1]), - S_NORMAL (SARG, 'B', 10, A_Look , &States[S_SARG_STND]), - -#define S_SARG_RUN (S_SARG_STND+2) - S_NORMAL (SARG, 'A', 2, A_Chase , &States[S_SARG_RUN+1]), - S_NORMAL (SARG, 'A', 2, A_Chase , &States[S_SARG_RUN+2]), - S_NORMAL (SARG, 'B', 2, A_Chase , &States[S_SARG_RUN+3]), - S_NORMAL (SARG, 'B', 2, A_Chase , &States[S_SARG_RUN+4]), - S_NORMAL (SARG, 'C', 2, A_Chase , &States[S_SARG_RUN+5]), - S_NORMAL (SARG, 'C', 2, A_Chase , &States[S_SARG_RUN+6]), - S_NORMAL (SARG, 'D', 2, A_Chase , &States[S_SARG_RUN+7]), - S_NORMAL (SARG, 'D', 2, A_Chase , &States[S_SARG_RUN+0]), - -#define S_SARG_ATK (S_SARG_RUN+8) - S_NORMAL (SARG, 'E', 8, A_FaceTarget , &States[S_SARG_ATK+1]), - S_NORMAL (SARG, 'F', 8, A_FaceTarget , &States[S_SARG_ATK+2]), - S_NORMAL (SARG, 'G', 8, A_SargAttack , &States[S_SARG_RUN+0]), - -#define S_SARG_PAIN (S_SARG_ATK+3) - S_NORMAL (SARG, 'H', 2, NULL , &States[S_SARG_PAIN+1]), - S_NORMAL (SARG, 'H', 2, A_Pain , &States[S_SARG_RUN+0]), - -#define S_SARG_DIE (S_SARG_PAIN+2) - S_NORMAL (SARG, 'I', 8, NULL , &States[S_SARG_DIE+1]), - S_NORMAL (SARG, 'J', 8, A_Scream , &States[S_SARG_DIE+2]), - S_NORMAL (SARG, 'K', 4, NULL , &States[S_SARG_DIE+3]), - S_NORMAL (SARG, 'L', 4, A_NoBlocking , &States[S_SARG_DIE+4]), - S_NORMAL (SARG, 'M', 4, NULL , &States[S_SARG_DIE+5]), - S_NORMAL (SARG, 'N', -1, NULL , NULL), - -#define S_SARG_RAISE (S_SARG_DIE+6) - S_NORMAL (SARG, 'N', 5, NULL , &States[S_SARG_RAISE+1]), - S_NORMAL (SARG, 'M', 5, NULL , &States[S_SARG_RAISE+2]), - S_NORMAL (SARG, 'L', 5, NULL , &States[S_SARG_RAISE+3]), - S_NORMAL (SARG, 'K', 5, NULL , &States[S_SARG_RAISE+4]), - S_NORMAL (SARG, 'J', 5, NULL , &States[S_SARG_RAISE+5]), - S_NORMAL (SARG, 'I', 5, NULL , &States[S_SARG_RUN+0]) -}; - -IMPLEMENT_ACTOR (ADemon, Doom, 3002, 8) - PROP_SpawnHealth (150) - PROP_PainChance (180) - PROP_SpeedFixed (10) - PROP_RadiusFixed (30) - PROP_HeightFixed (56) - PROP_Mass (400) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - PROP_Flags5 (MF5_FASTER|MF5_FASTMELEE) - - PROP_SpawnState (S_SARG_STND) - PROP_SeeState (S_SARG_RUN) - PROP_PainState (S_SARG_PAIN) - PROP_MeleeState (S_SARG_ATK) - PROP_DeathState (S_SARG_DIE) - PROP_RaiseState (S_SARG_RAISE) - - PROP_SeeSound ("demon/sight") - PROP_AttackSound ("demon/melee") - PROP_PainSound ("demon/pain") - PROP_DeathSound ("demon/death") - PROP_ActiveSound ("demon/active") - PROP_HitObituary("$OB_DEMONHIT") -END_DEFAULTS - -class ASpectre : public ADemon -{ - DECLARE_STATELESS_ACTOR (ASpectre, ADemon) -}; - -IMPLEMENT_STATELESS_ACTOR (ASpectre, Doom, 58, 9) - PROP_FlagsSet (MF_SHADOW) - PROP_RenderStyle (STYLE_OptFuzzy) - PROP_Alpha (FRACUNIT/5) - - PROP_SeeSound ("spectre/sight") - PROP_AttackSound ("spectre/melee") - PROP_PainSound ("spectre/pain") - PROP_DeathSound ("spectre/death") - PROP_ActiveSound ("spectre/active") - PROP_HitObituary("$OB_SPECTREHIT") -END_DEFAULTS - void A_SargAttack (AActor *self) { if (!self->target) @@ -110,7 +17,7 @@ void A_SargAttack (AActor *self) if (self->CheckMeleeRange ()) { int damage = ((pr_sargattack()%10)+1)*4; - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } } diff --git a/src/g_doom/a_doomimp.cpp b/src/g_doom/a_doomimp.cpp index ba9aba7c2..351b31c5a 100644 --- a/src/g_doom/a_doomimp.cpp +++ b/src/g_doom/a_doomimp.cpp @@ -11,127 +11,6 @@ static FRandom pr_troopattack ("TroopAttack"); void A_TroopAttack (AActor *); -class ADoomImp : public AActor -{ - DECLARE_ACTOR (ADoomImp, AActor) -}; - -FState ADoomImp::States[] = -{ -#define S_TROO_STND 0 - S_NORMAL (TROO, 'A', 10, A_Look , &States[S_TROO_STND+1]), - S_NORMAL (TROO, 'B', 10, A_Look , &States[S_TROO_STND]), - -#define S_TROO_RUN (S_TROO_STND+2) - S_NORMAL (TROO, 'A', 3, A_Chase , &States[S_TROO_RUN+1]), - S_NORMAL (TROO, 'A', 3, A_Chase , &States[S_TROO_RUN+2]), - S_NORMAL (TROO, 'B', 3, A_Chase , &States[S_TROO_RUN+3]), - S_NORMAL (TROO, 'B', 3, A_Chase , &States[S_TROO_RUN+4]), - S_NORMAL (TROO, 'C', 3, A_Chase , &States[S_TROO_RUN+5]), - S_NORMAL (TROO, 'C', 3, A_Chase , &States[S_TROO_RUN+6]), - S_NORMAL (TROO, 'D', 3, A_Chase , &States[S_TROO_RUN+7]), - S_NORMAL (TROO, 'D', 3, A_Chase , &States[S_TROO_RUN+0]), - -#define S_TROO_ATK (S_TROO_RUN+8) - S_NORMAL (TROO, 'E', 8, A_FaceTarget , &States[S_TROO_ATK+1]), - S_NORMAL (TROO, 'F', 8, A_FaceTarget , &States[S_TROO_ATK+2]), - S_NORMAL (TROO, 'G', 6, A_TroopAttack , &States[S_TROO_RUN+0]), - -#define S_TROO_PAIN (S_TROO_ATK+3) - S_NORMAL (TROO, 'H', 2, NULL , &States[S_TROO_PAIN+1]), - S_NORMAL (TROO, 'H', 2, A_Pain , &States[S_TROO_RUN+0]), - -#define S_TROO_DIE (S_TROO_PAIN+2) - S_NORMAL (TROO, 'I', 8, NULL , &States[S_TROO_DIE+1]), - S_NORMAL (TROO, 'J', 8, A_Scream , &States[S_TROO_DIE+2]), - S_NORMAL (TROO, 'K', 6, NULL , &States[S_TROO_DIE+3]), - S_NORMAL (TROO, 'L', 6, A_NoBlocking , &States[S_TROO_DIE+4]), - S_NORMAL (TROO, 'M', -1, NULL , NULL), - -#define S_TROO_XDIE (S_TROO_DIE+5) - S_NORMAL (TROO, 'N', 5, NULL , &States[S_TROO_XDIE+1]), - S_NORMAL (TROO, 'O', 5, A_XScream , &States[S_TROO_XDIE+2]), - S_NORMAL (TROO, 'P', 5, NULL , &States[S_TROO_XDIE+3]), - S_NORMAL (TROO, 'Q', 5, A_NoBlocking , &States[S_TROO_XDIE+4]), - S_NORMAL (TROO, 'R', 5, NULL , &States[S_TROO_XDIE+5]), - S_NORMAL (TROO, 'S', 5, NULL , &States[S_TROO_XDIE+6]), - S_NORMAL (TROO, 'T', 5, NULL , &States[S_TROO_XDIE+7]), - S_NORMAL (TROO, 'U', -1, NULL , NULL), - -#define S_TROO_RAISE (S_TROO_XDIE+8) - S_NORMAL (TROO, 'M', 8, NULL , &States[S_TROO_RAISE+1]), - S_NORMAL (TROO, 'L', 8, NULL , &States[S_TROO_RAISE+2]), - S_NORMAL (TROO, 'K', 6, NULL , &States[S_TROO_RAISE+3]), - S_NORMAL (TROO, 'J', 6, NULL , &States[S_TROO_RAISE+4]), - S_NORMAL (TROO, 'I', 6, NULL , &States[S_TROO_RUN+0]) -}; - -IMPLEMENT_ACTOR (ADoomImp, Doom, 3001, 5) - PROP_SpawnHealth (60) - PROP_RadiusFixed (20) - PROP_HeightFixed (56) - PROP_Mass (100) - PROP_SpeedFixed (8) - PROP_PainChance (200) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - - PROP_SpawnState (S_TROO_STND) - PROP_SeeState (S_TROO_RUN) - PROP_PainState (S_TROO_PAIN) - PROP_MeleeState (S_TROO_ATK) - PROP_MissileState (S_TROO_ATK) - PROP_DeathState (S_TROO_DIE) - PROP_XDeathState (S_TROO_XDIE) - PROP_RaiseState (S_TROO_RAISE) - - PROP_SeeSound ("imp/sight") - PROP_PainSound ("imp/pain") - PROP_DeathSound ("imp/death") - PROP_ActiveSound ("imp/active") - PROP_Obituary("$OB_IMP") - PROP_HitObituary("$OB_IMPHIT") -END_DEFAULTS - -class ADoomImpBall : public AActor -{ - DECLARE_ACTOR (ADoomImpBall, AActor) -}; - -FState ADoomImpBall::States[] = -{ -#define S_TBALL 0 - S_BRIGHT (BAL1, 'A', 4, NULL , &States[S_TBALL+1]), - S_BRIGHT (BAL1, 'B', 4, NULL , &States[S_TBALL+0]), - -#define S_TBALLX (S_TBALL+2) - S_BRIGHT (BAL1, 'C', 6, NULL , &States[S_TBALLX+1]), - S_BRIGHT (BAL1, 'D', 6, NULL , &States[S_TBALLX+2]), - S_BRIGHT (BAL1, 'E', 6, NULL , NULL) -}; - -IMPLEMENT_ACTOR (ADoomImpBall, Doom, -1, 10) - PROP_RadiusFixed (6) - PROP_HeightFixed (8) - PROP_SpeedFixed (10) - PROP_Damage (3) - PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) - PROP_Flags2 (MF2_PCROSS|MF2_IMPACT|MF2_NOTELEPORT) - PROP_Flags4 (MF4_RANDOMIZE) - PROP_RenderStyle (STYLE_Add) - - PROP_SpawnState (S_TBALL) - PROP_DeathState (S_TBALLX) - - PROP_SeeSound ("imp/attack") - PROP_DeathSound ("imp/shotx") -END_DEFAULTS - -AT_SPEED_SET (ADoomImpBall, speed) -{ - SimpleSpeedSetter (ADoomImpBall, 10*FRACUNIT, 20*FRACUNIT, speed); -} - // // A_TroopAttack // @@ -145,11 +24,11 @@ void A_TroopAttack (AActor *self) { int damage = (pr_troopattack()%8+1)*3; S_Sound (self, CHAN_WEAPON, "imp/melee", 1, ATTN_NORM); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); return; } // launch a missile - P_SpawnMissile (self, self->target, RUNTIME_CLASS(ADoomImpBall)); + P_SpawnMissile (self, self->target, PClass::FindClass("DoomImpBall")); } diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index faa7a380e..80e127e5b 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -89,7 +89,7 @@ void A_Punch (AActor *actor) angle += pr_punch.Random2() << 18; pitch = P_AimLineAttack (actor, angle, MELEERANGE); - P_LineAttack (actor, angle, MELEERANGE, pitch, damage, MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); + P_LineAttack (actor, angle, MELEERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(ABulletPuff)); // turn to face target if (linetarget) @@ -169,7 +169,7 @@ void A_FirePistol (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; - P_SetPsprite (actor->player, ps_flash, weapon->FlashState); + P_SetPsprite (actor->player, ps_flash, weapon->FindState(NAME_Flash)); } actor->player->mo->PlayAttacking2 (); @@ -283,7 +283,7 @@ void A_Saw (AActor *actor) // use meleerange + 1 so the puff doesn't skip the flash (i.e. plays all states) P_LineAttack (actor, angle, MELEERANGE+1, P_AimLineAttack (actor, angle, MELEERANGE+1), damage, - MOD_UNKNOWN, pufftype); + NAME_None, pufftype); if (!linetarget) { @@ -392,7 +392,7 @@ void A_FireShotgun (AActor *actor) { if (!weapon->DepleteAmmo (weapon->bAltFire)) return; - P_SetPsprite (player, ps_flash, weapon->FlashState); + P_SetPsprite (player, ps_flash, weapon->FindState(NAME_Flash)); } player->mo->PlayAttacking2 (); @@ -492,7 +492,7 @@ void A_FireShotgun2 (AActor *actor) { if (!weapon->DepleteAmmo (weapon->bAltFire)) return; - P_SetPsprite (player, ps_flash, weapon->FlashState); + P_SetPsprite (player, ps_flash, weapon->FindState(NAME_Flash)); } player->mo->PlayAttacking2 (); @@ -515,7 +515,7 @@ void A_FireShotgun2 (AActor *actor) angle, PLAYERMISSILERANGE, bulletpitch + (pr_fireshotgun2.Random2() * 332063), damage, - MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); + NAME_None, RUNTIME_CLASS(ABulletPuff)); } } @@ -608,17 +608,21 @@ void A_FireCGun (AActor *actor) { if (!weapon->DepleteAmmo (weapon->bAltFire)) return; - if (weapon->FlashState != NULL) + + FState *flash = weapon->FindState(NAME_Flash); + if (flash != NULL) { // [RH] Fix for Sparky's messed-up Dehacked patch! Blargh! - int theflash = clamp (int(players->psprites[ps_weapon].state - weapon->AtkState), 0, 1); + FState * atk = weapon->FindState(NAME_Fire); - if (weapon->FlashState[theflash].sprite.index != weapon->FlashState->sprite.index) + int theflash = clamp (int(players->psprites[ps_weapon].state - atk), 0, 1); + + if (flash[theflash].sprite.index != flash->sprite.index) { theflash = 0; } - P_SetPsprite (player, ps_flash, weapon->FlashState + theflash); + P_SetPsprite (player, ps_flash, flash + theflash); } } @@ -841,9 +845,11 @@ void A_FirePlasma (AActor *actor) { if (!weapon->DepleteAmmo (weapon->bAltFire)) return; - if (weapon->FlashState != NULL) + + FState *flash = weapon->FindState(NAME_Flash); + if (flash != NULL) { - P_SetPsprite (player, ps_flash, weapon->FlashState + (pr_fireplasma()&1)); + P_SetPsprite (player, ps_flash, flash + (pr_fireplasma()&1)); } } @@ -870,9 +876,11 @@ void A_FireRailgun (AActor *actor) { if (!weapon->DepleteAmmo (weapon->bAltFire)) return; - if (weapon->FlashState != NULL) + + FState *flash = weapon->FindState(NAME_Flash); + if (flash != NULL) { - P_SetPsprite (player, ps_flash, weapon->FlashState + (pr_firerail()&1)); + P_SetPsprite (player, ps_flash, flash + (pr_firerail()&1)); } } @@ -1099,7 +1107,7 @@ void A_BFGSpray (AActor *mo) damage += (pr_bfgspray() & 7) + 1; thingToHit = linetarget; - P_DamageMobj (thingToHit, mo->target, mo->target, damage, MOD_BFG_SPLASH); + P_DamageMobj (thingToHit, mo->target, mo->target, damage, NAME_BFGSplash); P_TraceBleed (damage, thingToHit, mo->target); } } diff --git a/src/g_doom/a_lostsoul.cpp b/src/g_doom/a_lostsoul.cpp index d91d545e7..9729cadb6 100644 --- a/src/g_doom/a_lostsoul.cpp +++ b/src/g_doom/a_lostsoul.cpp @@ -12,63 +12,6 @@ FRandom pr_lost ("LostMissileRange"); -void A_SkullAttack (AActor *); - -FState ALostSoul::States[] = -{ -#define S_SKULL_STND 0 - S_BRIGHT (SKUL, 'A', 10, A_Look , &States[S_SKULL_STND+1]), - S_BRIGHT (SKUL, 'B', 10, A_Look , &States[S_SKULL_STND]), - -#define S_SKULL_RUN (S_SKULL_STND+2) - S_BRIGHT (SKUL, 'A', 6, A_Chase , &States[S_SKULL_RUN+1]), - S_BRIGHT (SKUL, 'B', 6, A_Chase , &States[S_SKULL_RUN+0]), - -#define S_SKULL_ATK (S_SKULL_RUN+2) - S_BRIGHT (SKUL, 'C', 10, A_FaceTarget , &States[S_SKULL_ATK+1]), - S_BRIGHT (SKUL, 'D', 4, A_SkullAttack , &States[S_SKULL_ATK+2]), - S_BRIGHT (SKUL, 'C', 4, NULL , &States[S_SKULL_ATK+3]), - S_BRIGHT (SKUL, 'D', 4, NULL , &States[S_SKULL_ATK+2]), - -#define S_SKULL_PAIN (S_SKULL_ATK+4) - S_BRIGHT (SKUL, 'E', 3, NULL , &States[S_SKULL_PAIN+1]), - S_BRIGHT (SKUL, 'E', 3, A_Pain , &States[S_SKULL_RUN+0]), - -#define S_SKULL_DIE (S_SKULL_PAIN+2) - S_BRIGHT (SKUL, 'F', 6, NULL , &States[S_SKULL_DIE+1]), - S_BRIGHT (SKUL, 'G', 6, A_Scream , &States[S_SKULL_DIE+2]), - S_BRIGHT (SKUL, 'H', 6, NULL , &States[S_SKULL_DIE+3]), - S_BRIGHT (SKUL, 'I', 6, A_NoBlocking , &States[S_SKULL_DIE+4]), - S_NORMAL (SKUL, 'J', 6, NULL , &States[S_SKULL_DIE+5]), - S_NORMAL (SKUL, 'K', 6, NULL , NULL) -}; - -IMPLEMENT_ACTOR (ALostSoul, Doom, 3006, 110) - PROP_SpawnHealth (100) - PROP_RadiusFixed (16) - PROP_HeightFixed (56) - PROP_Mass (50) - PROP_SpeedFixed (8) - PROP_Damage (3) - PROP_MaxPainChance - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_FLOAT|MF_NOGRAVITY|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PUSHWALL|MF2_PASSMOBJ) - PROP_Flags4 (MF4_NOICEDEATH|MF4_MISSILEMORE|MF4_DONTFALL) - PROP_RenderStyle (STYLE_SoulTrans) - - PROP_SpawnState (S_SKULL_STND) - PROP_SeeState (S_SKULL_RUN) - PROP_PainState (S_SKULL_PAIN) - PROP_MissileState (S_SKULL_ATK) - PROP_DeathState (S_SKULL_DIE) - - PROP_AttackSound ("skull/melee") - PROP_PainSound ("skull/pain") - PROP_DeathSound ("skull/death") - PROP_ActiveSound ("skull/active") - PROP_Obituary("$OB_SKULL") -END_DEFAULTS - // // SkullAttack // Fly at the player like a missile. diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index 46548071e..705431d72 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -14,8 +14,6 @@ void A_SkullAttack (AActor *self); class APainElemental : public AActor { DECLARE_ACTOR (APainElemental, AActor) -public: - bool Massacre (); }; FState APainElemental::States[] = @@ -81,24 +79,6 @@ IMPLEMENT_ACTOR (APainElemental, Doom, 71, 115) PROP_ActiveSound ("pain/active") END_DEFAULTS -bool APainElemental::Massacre () -{ - if (Super::Massacre ()) - { - FState *deadstate; - A_NoBlocking (this); // [RH] Use this instead of A_PainDie - deadstate = DeathState; - if (deadstate != NULL) - { - while (deadstate->GetNextState() != NULL) - deadstate = deadstate->GetNextState(); - SetState (deadstate); - } - return true; - } - return false; -} - // // A_PainShootSkull // Spawn a lost soul and launch it at the target @@ -113,12 +93,14 @@ void A_PainShootSkull (AActor *self, angle_t angle) const PClass *spawntype = NULL; + if (self->DamageType==NAME_Massacre) return; + int index=CheckIndex(1, NULL); if (index>=0) { spawntype = PClass::FindClass((ENamedName)StateParameters[index]); } - if (spawntype == NULL) spawntype = RUNTIME_CLASS(ALostSoul); + if (spawntype == NULL) spawntype = PClass::FindClass("LostSoul"); // [RH] check to make sure it's not too close to the ceiling if (self->z + self->height + 8*FRACUNIT > self->ceilingz) @@ -178,7 +160,7 @@ void A_PainShootSkull (AActor *self, angle_t angle) (other->z < other->Sector->floorplane.ZatPoint (other->x, other->y))) { // kill it immediately - P_DamageMobj (other, self, self, 1000000, MOD_UNKNOWN); // ^ + P_DamageMobj (other, self, self, 1000000, NAME_None); // ^ return; // | } // phares @@ -187,7 +169,7 @@ void A_PainShootSkull (AActor *self, angle_t angle) if (!P_CheckPosition (other, other->x, other->y)) { // kill it immediately - P_DamageMobj (other, self, self, 1000000, MOD_UNKNOWN); + P_DamageMobj (other, self, self, 1000000, NAME_None); return; } diff --git a/src/g_doom/a_possessed.cpp b/src/g_doom/a_possessed.cpp index 7827b1602..499210583 100644 --- a/src/g_doom/a_possessed.cpp +++ b/src/g_doom/a_possessed.cpp @@ -13,101 +13,6 @@ static FRandom pr_sposattack ("SPosAttack"); static FRandom pr_cposattack ("CPosAttack"); static FRandom pr_cposrefire ("CPosRefire"); -void A_PosAttack (AActor *); -void A_SPosAttackUseAtkSound (AActor *); -void A_CPosAttack (AActor *); -void A_CPosRefire (AActor *); - -// Zombie man -------------------------------------------------------------- - -class AZombieMan : public AActor -{ - DECLARE_ACTOR (AZombieMan, AActor) -public: - void NoBlockingSet (); -}; - -FState AZombieMan::States[] = -{ -#define S_POSS_STND 0 - S_NORMAL (POSS, 'A', 10, A_Look , &States[S_POSS_STND+1]), - S_NORMAL (POSS, 'B', 10, A_Look , &States[S_POSS_STND]), - -#define S_POSS_RUN (S_POSS_STND+2) - S_NORMAL (POSS, 'A', 4, A_Chase , &States[S_POSS_RUN+1]), - S_NORMAL (POSS, 'A', 4, A_Chase , &States[S_POSS_RUN+2]), - S_NORMAL (POSS, 'B', 4, A_Chase , &States[S_POSS_RUN+3]), - S_NORMAL (POSS, 'B', 4, A_Chase , &States[S_POSS_RUN+4]), - S_NORMAL (POSS, 'C', 4, A_Chase , &States[S_POSS_RUN+5]), - S_NORMAL (POSS, 'C', 4, A_Chase , &States[S_POSS_RUN+6]), - S_NORMAL (POSS, 'D', 4, A_Chase , &States[S_POSS_RUN+7]), - S_NORMAL (POSS, 'D', 4, A_Chase , &States[S_POSS_RUN+0]), - -#define S_POSS_ATK (S_POSS_RUN+8) - S_NORMAL (POSS, 'E', 10, A_FaceTarget , &States[S_POSS_ATK+1]), - S_NORMAL (POSS, 'F', 8, A_PosAttack , &States[S_POSS_ATK+2]), - S_NORMAL (POSS, 'E', 8, NULL , &States[S_POSS_RUN+0]), - -#define S_POSS_PAIN (S_POSS_ATK+3) - S_NORMAL (POSS, 'G', 3, NULL , &States[S_POSS_PAIN+1]), - S_NORMAL (POSS, 'G', 3, A_Pain , &States[S_POSS_RUN+0]), - -#define S_POSS_DIE (S_POSS_PAIN+2) - S_NORMAL (POSS, 'H', 5, NULL , &States[S_POSS_DIE+1]), - S_NORMAL (POSS, 'I', 5, A_Scream , &States[S_POSS_DIE+2]), - S_NORMAL (POSS, 'J', 5, A_NoBlocking , &States[S_POSS_DIE+3]), - S_NORMAL (POSS, 'K', 5, NULL , &States[S_POSS_DIE+4]), - S_NORMAL (POSS, 'L', -1, NULL , NULL), - -#define S_POSS_XDIE (S_POSS_DIE+5) - S_NORMAL (POSS, 'M', 5, NULL , &States[S_POSS_XDIE+1]), - S_NORMAL (POSS, 'N', 5, A_XScream , &States[S_POSS_XDIE+2]), - S_NORMAL (POSS, 'O', 5, A_NoBlocking , &States[S_POSS_XDIE+3]), - S_NORMAL (POSS, 'P', 5, NULL , &States[S_POSS_XDIE+4]), - S_NORMAL (POSS, 'Q', 5, NULL , &States[S_POSS_XDIE+5]), - S_NORMAL (POSS, 'R', 5, NULL , &States[S_POSS_XDIE+6]), - S_NORMAL (POSS, 'S', 5, NULL , &States[S_POSS_XDIE+7]), - S_NORMAL (POSS, 'T', 5, NULL , &States[S_POSS_XDIE+8]), - S_NORMAL (POSS, 'U', -1, NULL , NULL), - -#define S_POSS_RAISE (S_POSS_XDIE+9) - S_NORMAL (POSS, 'K', 5, NULL , &States[S_POSS_RAISE+1]), - S_NORMAL (POSS, 'J', 5, NULL , &States[S_POSS_RAISE+2]), - S_NORMAL (POSS, 'I', 5, NULL , &States[S_POSS_RAISE+3]), - S_NORMAL (POSS, 'H', 5, NULL , &States[S_POSS_RUN+0]) -}; - -IMPLEMENT_ACTOR (AZombieMan, Doom, 3004, 4) - PROP_SpawnHealth (20) - PROP_RadiusFixed (20) - PROP_HeightFixed (56) - PROP_Mass (100) - PROP_SpeedFixed (8) - PROP_PainChance (200) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - - PROP_SpawnState (S_POSS_STND) - PROP_SeeState (S_POSS_RUN) - PROP_PainState (S_POSS_PAIN) - PROP_MissileState (S_POSS_ATK) - PROP_DeathState (S_POSS_DIE) - PROP_XDeathState (S_POSS_XDIE) - PROP_RaiseState (S_POSS_RAISE) - - PROP_SeeSound ("grunt/sight") - PROP_AttackSound ("grunt/attack") - PROP_PainSound ("grunt/pain") - PROP_DeathSound ("grunt/death") - PROP_ActiveSound ("grunt/active") - PROP_Obituary("$OB_ZOMBIE") -END_DEFAULTS - -void AZombieMan::NoBlockingSet () -{ - P_DropItem (this, "Clip", -1, 256); -} - // // A_PosAttack // @@ -127,99 +32,7 @@ void A_PosAttack (AActor *self) S_Sound (self, CHAN_WEAPON, "grunt/attack", 1, ATTN_NORM); angle += pr_posattack.Random2() << 20; damage = ((pr_posattack()%5)+1)*3; - P_LineAttack (self, angle, MISSILERANGE, slope, damage, MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); -} - -// Shotgun guy ------------------------------------------------------------- - -class AShotgunGuy : public AActor -{ - DECLARE_ACTOR (AShotgunGuy, AActor) -public: - void NoBlockingSet (); -}; - -FState AShotgunGuy::States[] = -{ - -#define S_SPOS_STND 0 - S_NORMAL (SPOS, 'A', 10, A_Look , &States[S_SPOS_STND+1]), - S_NORMAL (SPOS, 'B', 10, A_Look , &States[S_SPOS_STND]), - -#define S_SPOS_RUN (S_SPOS_STND+2) - S_NORMAL (SPOS, 'A', 3, A_Chase , &States[S_SPOS_RUN+1]), - S_NORMAL (SPOS, 'A', 3, A_Chase , &States[S_SPOS_RUN+2]), - S_NORMAL (SPOS, 'B', 3, A_Chase , &States[S_SPOS_RUN+3]), - S_NORMAL (SPOS, 'B', 3, A_Chase , &States[S_SPOS_RUN+4]), - S_NORMAL (SPOS, 'C', 3, A_Chase , &States[S_SPOS_RUN+5]), - S_NORMAL (SPOS, 'C', 3, A_Chase , &States[S_SPOS_RUN+6]), - S_NORMAL (SPOS, 'D', 3, A_Chase , &States[S_SPOS_RUN+7]), - S_NORMAL (SPOS, 'D', 3, A_Chase , &States[S_SPOS_RUN+0]), - -#define S_SPOS_ATK (S_SPOS_RUN+8) - S_NORMAL (SPOS, 'E', 10, A_FaceTarget , &States[S_SPOS_ATK+1]), - S_BRIGHT (SPOS, 'F', 10, A_SPosAttackUseAtkSound , &States[S_SPOS_ATK+2]), - S_NORMAL (SPOS, 'E', 10, NULL , &States[S_SPOS_RUN+0]), - -#define S_SPOS_PAIN (S_SPOS_ATK+3) - S_NORMAL (SPOS, 'G', 3, NULL , &States[S_SPOS_PAIN+1]), - S_NORMAL (SPOS, 'G', 3, A_Pain , &States[S_SPOS_RUN+0]), - -#define S_SPOS_DIE (S_SPOS_PAIN+2) - S_NORMAL (SPOS, 'H', 5, NULL , &States[S_SPOS_DIE+1]), - S_NORMAL (SPOS, 'I', 5, A_Scream , &States[S_SPOS_DIE+2]), - S_NORMAL (SPOS, 'J', 5, A_NoBlocking , &States[S_SPOS_DIE+3]), - S_NORMAL (SPOS, 'K', 5, NULL , &States[S_SPOS_DIE+4]), - S_NORMAL (SPOS, 'L', -1, NULL , NULL), - -#define S_SPOS_XDIE (S_SPOS_DIE+5) - S_NORMAL (SPOS, 'M', 5, NULL , &States[S_SPOS_XDIE+1]), - S_NORMAL (SPOS, 'N', 5, A_XScream , &States[S_SPOS_XDIE+2]), - S_NORMAL (SPOS, 'O', 5, A_NoBlocking , &States[S_SPOS_XDIE+3]), - S_NORMAL (SPOS, 'P', 5, NULL , &States[S_SPOS_XDIE+4]), - S_NORMAL (SPOS, 'Q', 5, NULL , &States[S_SPOS_XDIE+5]), - S_NORMAL (SPOS, 'R', 5, NULL , &States[S_SPOS_XDIE+6]), - S_NORMAL (SPOS, 'S', 5, NULL , &States[S_SPOS_XDIE+7]), - S_NORMAL (SPOS, 'T', 5, NULL , &States[S_SPOS_XDIE+8]), - S_NORMAL (SPOS, 'U', -1, NULL , NULL), - -#define S_SPOS_RAISE (S_SPOS_XDIE+9) - S_NORMAL (SPOS, 'L', 5, NULL , &States[S_SPOS_RAISE+1]), - S_NORMAL (SPOS, 'K', 5, NULL , &States[S_SPOS_RAISE+2]), - S_NORMAL (SPOS, 'J', 5, NULL , &States[S_SPOS_RAISE+3]), - S_NORMAL (SPOS, 'I', 5, NULL , &States[S_SPOS_RAISE+4]), - S_NORMAL (SPOS, 'H', 5, NULL , &States[S_SPOS_RUN+0]) -}; - -IMPLEMENT_ACTOR (AShotgunGuy, Doom, 9, 1) - PROP_SpawnHealth (30) - PROP_RadiusFixed (20) - PROP_HeightFixed (56) - PROP_Mass (100) - PROP_SpeedFixed (8) - PROP_PainChance (170) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - - PROP_SpawnState (S_SPOS_STND) - PROP_SeeState (S_SPOS_RUN) - PROP_PainState (S_SPOS_PAIN) - PROP_MissileState (S_SPOS_ATK) - PROP_DeathState (S_SPOS_DIE) - PROP_XDeathState (S_SPOS_XDIE) - PROP_RaiseState (S_SPOS_RAISE) - - PROP_SeeSound ("shotguy/sight") - PROP_AttackSound ("shotguy/attack") - PROP_PainSound ("shotguy/pain") - PROP_DeathSound ("shotguy/death") - PROP_ActiveSound ("shotguy/active") - PROP_Obituary("$OB_SHOTGUY") -END_DEFAULTS - -void AShotgunGuy::NoBlockingSet () -{ - P_DropItem (this, "Shotgun", -1, 256); + P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_None, RUNTIME_CLASS(ABulletPuff)); } static void A_SPosAttack2 (AActor *self) @@ -236,7 +49,7 @@ static void A_SPosAttack2 (AActor *self) { int angle = bangle + (pr_sposattack.Random2() << 20); int damage = ((pr_sposattack()%5)+1)*3; - P_LineAttack(self, angle, MISSILERANGE, slope, damage, MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); + P_LineAttack(self, angle, MISSILERANGE, slope, damage, NAME_None, RUNTIME_CLASS(ABulletPuff)); } } @@ -260,193 +73,6 @@ void A_SPosAttack (AActor *self) A_SPosAttack2 (self); } -// Chaingun guy ------------------------------------------------------------ - -class AChaingunGuy : public AActor -{ - DECLARE_ACTOR (AChaingunGuy, AActor) -public: - void NoBlockingSet (); -}; - -FState AChaingunGuy::States[] = -{ -#define S_CPOS_STND 0 - S_NORMAL (CPOS, 'A', 10, A_Look , &States[S_CPOS_STND+1]), - S_NORMAL (CPOS, 'B', 10, A_Look , &States[S_CPOS_STND]), - -#define S_CPOS_RUN (S_CPOS_STND+2) - S_NORMAL (CPOS, 'A', 3, A_Chase , &States[S_CPOS_RUN+1]), - S_NORMAL (CPOS, 'A', 3, A_Chase , &States[S_CPOS_RUN+2]), - S_NORMAL (CPOS, 'B', 3, A_Chase , &States[S_CPOS_RUN+3]), - S_NORMAL (CPOS, 'B', 3, A_Chase , &States[S_CPOS_RUN+4]), - S_NORMAL (CPOS, 'C', 3, A_Chase , &States[S_CPOS_RUN+5]), - S_NORMAL (CPOS, 'C', 3, A_Chase , &States[S_CPOS_RUN+6]), - S_NORMAL (CPOS, 'D', 3, A_Chase , &States[S_CPOS_RUN+7]), - S_NORMAL (CPOS, 'D', 3, A_Chase , &States[S_CPOS_RUN+0]), - -#define S_CPOS_ATK (S_CPOS_RUN+8) - S_NORMAL (CPOS, 'E', 10, A_FaceTarget , &States[S_CPOS_ATK+1]), - S_BRIGHT (CPOS, 'F', 4, A_CPosAttack , &States[S_CPOS_ATK+2]), - S_BRIGHT (CPOS, 'E', 4, A_CPosAttack , &States[S_CPOS_ATK+3]), - S_NORMAL (CPOS, 'F', 1, A_CPosRefire , &States[S_CPOS_ATK+1]), - -#define S_CPOS_PAIN (S_CPOS_ATK+4) - S_NORMAL (CPOS, 'G', 3, NULL , &States[S_CPOS_PAIN+1]), - S_NORMAL (CPOS, 'G', 3, A_Pain , &States[S_CPOS_RUN+0]), - -#define S_CPOS_DIE (S_CPOS_PAIN+2) - S_NORMAL (CPOS, 'H', 5, NULL , &States[S_CPOS_DIE+1]), - S_NORMAL (CPOS, 'I', 5, A_Scream , &States[S_CPOS_DIE+2]), - S_NORMAL (CPOS, 'J', 5, A_NoBlocking , &States[S_CPOS_DIE+3]), - S_NORMAL (CPOS, 'K', 5, NULL , &States[S_CPOS_DIE+4]), - S_NORMAL (CPOS, 'L', 5, NULL , &States[S_CPOS_DIE+5]), - S_NORMAL (CPOS, 'M', 5, NULL , &States[S_CPOS_DIE+6]), - S_NORMAL (CPOS, 'N', -1, NULL , NULL), - -#define S_CPOS_XDIE (S_CPOS_DIE+7) - S_NORMAL (CPOS, 'O', 5, NULL , &States[S_CPOS_XDIE+1]), - S_NORMAL (CPOS, 'P', 5, A_XScream , &States[S_CPOS_XDIE+2]), - S_NORMAL (CPOS, 'Q', 5, A_NoBlocking , &States[S_CPOS_XDIE+3]), - S_NORMAL (CPOS, 'R', 5, NULL , &States[S_CPOS_XDIE+4]), - S_NORMAL (CPOS, 'S', 5, NULL , &States[S_CPOS_XDIE+5]), - S_NORMAL (CPOS, 'T', -1, NULL , NULL), - -#define S_CPOS_RAISE (S_CPOS_XDIE+6) - S_NORMAL (CPOS, 'N', 5, NULL , &States[S_CPOS_RAISE+1]), - S_NORMAL (CPOS, 'M', 5, NULL , &States[S_CPOS_RAISE+2]), - S_NORMAL (CPOS, 'L', 5, NULL , &States[S_CPOS_RAISE+3]), - S_NORMAL (CPOS, 'K', 5, NULL , &States[S_CPOS_RAISE+4]), - S_NORMAL (CPOS, 'J', 5, NULL , &States[S_CPOS_RAISE+5]), - S_NORMAL (CPOS, 'I', 5, NULL , &States[S_CPOS_RAISE+6]), - S_NORMAL (CPOS, 'H', 5, NULL , &States[S_CPOS_RUN+0]) -}; - -IMPLEMENT_ACTOR (AChaingunGuy, Doom, 65, 2) - PROP_SpawnHealth (70) - PROP_RadiusFixed (20) - PROP_HeightFixed (56) - PROP_Mass (100) - PROP_SpeedFixed (8) - PROP_PainChance (170) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - - PROP_SpawnState (S_CPOS_STND) - PROP_SeeState (S_CPOS_RUN) - PROP_PainState (S_CPOS_PAIN) - PROP_MissileState (S_CPOS_ATK) - PROP_DeathState (S_CPOS_DIE) - PROP_XDeathState (S_CPOS_XDIE) - PROP_RaiseState (S_CPOS_RAISE) - - PROP_SeeSound ("chainguy/sight") - PROP_PainSound ("chainguy/pain") - PROP_DeathSound ("chainguy/death") - PROP_ActiveSound ("chainguy/active") - PROP_AttackSound ("chainguy/attack") - PROP_Obituary("$OB_CHAINGUY") -END_DEFAULTS - -void AChaingunGuy::NoBlockingSet () -{ - P_DropItem (this, "Chaingun", -1, 256); -} - -// Wolfenstein SS ---------------------------------------------------------- - -class AWolfensteinSS : public AActor -{ - DECLARE_ACTOR (AWolfensteinSS, AActor) -public: - void NoBlockingSet (); -}; - -FState AWolfensteinSS::States[] = -{ -#define S_SSWV_STND 0 - S_NORMAL (SSWV, 'A', 10, A_Look , &States[S_SSWV_STND+1]), - S_NORMAL (SSWV, 'B', 10, A_Look , &States[S_SSWV_STND]), - -#define S_SSWV_RUN (S_SSWV_STND+2) - S_NORMAL (SSWV, 'A', 3, A_Chase , &States[S_SSWV_RUN+1]), - S_NORMAL (SSWV, 'A', 3, A_Chase , &States[S_SSWV_RUN+2]), - S_NORMAL (SSWV, 'B', 3, A_Chase , &States[S_SSWV_RUN+3]), - S_NORMAL (SSWV, 'B', 3, A_Chase , &States[S_SSWV_RUN+4]), - S_NORMAL (SSWV, 'C', 3, A_Chase , &States[S_SSWV_RUN+5]), - S_NORMAL (SSWV, 'C', 3, A_Chase , &States[S_SSWV_RUN+6]), - S_NORMAL (SSWV, 'D', 3, A_Chase , &States[S_SSWV_RUN+7]), - S_NORMAL (SSWV, 'D', 3, A_Chase , &States[S_SSWV_RUN+0]), - -#define S_SSWV_ATK (S_SSWV_RUN+8) - S_NORMAL (SSWV, 'E', 10, A_FaceTarget , &States[S_SSWV_ATK+1]), - S_NORMAL (SSWV, 'F', 10, A_FaceTarget , &States[S_SSWV_ATK+2]), - S_BRIGHT (SSWV, 'G', 4, A_CPosAttack , &States[S_SSWV_ATK+3]), - S_NORMAL (SSWV, 'F', 6, A_FaceTarget , &States[S_SSWV_ATK+4]), - S_BRIGHT (SSWV, 'G', 4, A_CPosAttack , &States[S_SSWV_ATK+5]), - S_NORMAL (SSWV, 'F', 1, A_CPosRefire , &States[S_SSWV_ATK+1]), - -#define S_SSWV_PAIN (S_SSWV_ATK+6) - S_NORMAL (SSWV, 'H', 3, NULL , &States[S_SSWV_PAIN+1]), - S_NORMAL (SSWV, 'H', 3, A_Pain , &States[S_SSWV_RUN+0]), - -#define S_SSWV_DIE (S_SSWV_PAIN+2) - S_NORMAL (SSWV, 'I', 5, NULL , &States[S_SSWV_DIE+1]), - S_NORMAL (SSWV, 'J', 5, A_Scream , &States[S_SSWV_DIE+2]), - S_NORMAL (SSWV, 'K', 5, A_NoBlocking , &States[S_SSWV_DIE+3]), - S_NORMAL (SSWV, 'L', 5, NULL , &States[S_SSWV_DIE+4]), - S_NORMAL (SSWV, 'M', -1, NULL , NULL), - -#define S_SSWV_XDIE (S_SSWV_DIE+5) - S_NORMAL (SSWV, 'N', 5, NULL , &States[S_SSWV_XDIE+1]), - S_NORMAL (SSWV, 'O', 5, A_XScream , &States[S_SSWV_XDIE+2]), - S_NORMAL (SSWV, 'P', 5, A_NoBlocking , &States[S_SSWV_XDIE+3]), - S_NORMAL (SSWV, 'Q', 5, NULL , &States[S_SSWV_XDIE+4]), - S_NORMAL (SSWV, 'R', 5, NULL , &States[S_SSWV_XDIE+5]), - S_NORMAL (SSWV, 'S', 5, NULL , &States[S_SSWV_XDIE+6]), - S_NORMAL (SSWV, 'T', 5, NULL , &States[S_SSWV_XDIE+7]), - S_NORMAL (SSWV, 'U', 5, NULL , &States[S_SSWV_XDIE+8]), - S_NORMAL (SSWV, 'V', -1, NULL , NULL), - -#define S_SSWV_RAISE (S_SSWV_XDIE+9) - S_NORMAL (SSWV, 'M', 5, NULL , &States[S_SSWV_RAISE+1]), - S_NORMAL (SSWV, 'L', 5, NULL , &States[S_SSWV_RAISE+2]), - S_NORMAL (SSWV, 'K', 5, NULL , &States[S_SSWV_RAISE+3]), - S_NORMAL (SSWV, 'J', 5, NULL , &States[S_SSWV_RAISE+4]), - S_NORMAL (SSWV, 'I', 5, NULL , &States[S_SSWV_RUN+0]) -}; - -IMPLEMENT_ACTOR (AWolfensteinSS, Doom, 84, 116) - PROP_SpawnHealth (50) - PROP_RadiusFixed (20) - PROP_HeightFixed (56) - PROP_Mass (100) - PROP_SpeedFixed (8) - PROP_PainChance (170) - PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL) - PROP_Flags2 (MF2_MCROSS|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_FLOORCLIP) - - PROP_SpawnState (S_SSWV_STND) - PROP_SeeState (S_SSWV_RUN) - PROP_PainState (S_SSWV_PAIN) - PROP_MissileState (S_SSWV_ATK) - PROP_DeathState (S_SSWV_DIE) - PROP_XDeathState (S_SSWV_XDIE) - PROP_RaiseState (S_SSWV_RAISE) - - PROP_SeeSound ("wolfss/sight") - PROP_PainSound ("wolfss/pain") - PROP_DeathSound ("wolfss/death") - PROP_ActiveSound ("wolfss/active") - PROP_AttackSound ("wolfss/attack") - PROP_Obituary("$OB_WOLFSS") -END_DEFAULTS - -void AWolfensteinSS::NoBlockingSet () -{ - P_DropItem (this, "Clip", -1, 256); -} - void A_CPosAttack (AActor *self) { int angle; @@ -470,7 +96,7 @@ void A_CPosAttack (AActor *self) angle = bangle + (pr_cposattack.Random2() << 20); damage = ((pr_cposattack()%5)+1)*3; - P_LineAttack (self, angle, MISSILERANGE, slope, damage, MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); + P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_None, RUNTIME_CLASS(ABulletPuff)); } void A_CPosRefire (AActor *self) diff --git a/src/g_doom/a_revenant.cpp b/src/g_doom/a_revenant.cpp index 8bcef275e..b3da21d48 100644 --- a/src/g_doom/a_revenant.cpp +++ b/src/g_doom/a_revenant.cpp @@ -279,7 +279,7 @@ void A_SkelFist (AActor *self) { int damage = ((pr_skelfist()%10)+1)*6; S_Sound (self, CHAN_WEAPON, "skeleton/melee", 1, ATTN_NORM); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } } diff --git a/src/g_doom/a_scriptedmarine.cpp b/src/g_doom/a_scriptedmarine.cpp index 4be5554f8..16223a690 100644 --- a/src/g_doom/a_scriptedmarine.cpp +++ b/src/g_doom/a_scriptedmarine.cpp @@ -398,7 +398,7 @@ void A_M_Saw (AActor *self) P_LineAttack (self, angle, MELEERANGE+1, P_AimLineAttack (self, angle, MELEERANGE+1), damage, - MOD_HIT, RUNTIME_CLASS(ABulletPuff)); + NAME_Melee, RUNTIME_CLASS(ABulletPuff)); if (!linetarget) { @@ -451,7 +451,7 @@ void A_M_Punch (AActor *self) A_FaceTarget (self); angle = self->angle + (pr_m_punch.Random2() << 18); pitch = P_AimLineAttack (self, angle, MELEERANGE); - P_LineAttack (self, angle, MELEERANGE, pitch, damage, MOD_HIT, RUNTIME_CLASS(ABulletPuff)); + P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, RUNTIME_CLASS(ABulletPuff)); // turn to face target if (linetarget) @@ -481,7 +481,7 @@ void A_M_BerserkPunch (AActor *self) A_FaceTarget (self); angle = self->angle + (pr_m_punch.Random2() << 18); pitch = P_AimLineAttack (self, angle, MELEERANGE); - P_LineAttack (self, angle, MELEERANGE, pitch, damage, MOD_HIT, RUNTIME_CLASS(ABulletPuff)); + P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, RUNTIME_CLASS(ABulletPuff)); // turn to face target if (linetarget) @@ -510,7 +510,7 @@ void P_GunShot2 (AActor *mo, bool accurate, int pitch, const PClass *pufftype) angle += pr_m_gunshot.Random2 () << 18; } - P_LineAttack (mo, angle, MISSILERANGE, pitch, damage, MOD_UNKNOWN, pufftype); + P_LineAttack (mo, angle, MISSILERANGE, pitch, damage, NAME_None, pufftype); } //============================================================================ @@ -611,7 +611,7 @@ void A_M_FireShotgun2 (AActor *self) P_LineAttack (self, angle, MISSILERANGE, pitch + (pr_m_fireshotgun2.Random2() * 332063), damage, - MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); + NAME_None, RUNTIME_CLASS(ABulletPuff)); } self->special1 = level.maptime; } diff --git a/src/g_heretic/a_beast.cpp b/src/g_heretic/a_beast.cpp index b93dcef9e..9b2c76b94 100644 --- a/src/g_heretic/a_beast.cpp +++ b/src/g_heretic/a_beast.cpp @@ -189,7 +189,7 @@ void A_BeastAttack (AActor *actor) if (actor->CheckMeleeRange()) { int damage = pr_beastatk.HitDice (3); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } diff --git a/src/g_heretic/a_chicken.cpp b/src/g_heretic/a_chicken.cpp index 417953122..a854f6a4a 100644 --- a/src/g_heretic/a_chicken.cpp +++ b/src/g_heretic/a_chicken.cpp @@ -184,10 +184,9 @@ void AChickenPlayer::MorphPlayerThink () if ((z <= floorz) && (pr_chickenplayerthink() < 32)) { // Jump and noise momz += JumpZ; - if (PainState != NULL) - { - SetState (PainState); - } + + FState * painstate = FindState(NAME_Pain); + if (painstate != NULL) SetState (painstate); } if (pr_chickenplayerthink () < 48) { // Just noise @@ -305,7 +304,7 @@ void A_ChicAttack (AActor *actor) if (actor->CheckMeleeRange()) { int damage = 1 + (pr_chicattack() & 1); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); } } @@ -406,7 +405,7 @@ void A_BeakAttackPL1 (AActor *actor) damage = 1 + (pr_beakatkpl1()&3); angle = player->mo->angle; slope = P_AimLineAttack (player->mo, angle, MELEERANGE); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(ABeakPuff)); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(ABeakPuff)); if (linetarget) { player->mo->angle = R_PointToAngle2 (player->mo->x, @@ -438,7 +437,7 @@ void A_BeakAttackPL2 (AActor *actor) damage = pr_beakatkpl2.HitDice (4); angle = player->mo->angle; slope = P_AimLineAttack (player->mo, angle, MELEERANGE); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(ABeakPuff)); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(ABeakPuff)); if (linetarget) { player->mo->angle = R_PointToAngle2 (player->mo->x, diff --git a/src/g_heretic/a_clink.cpp b/src/g_heretic/a_clink.cpp index 5e1bd9271..ac68944dd 100644 --- a/src/g_heretic/a_clink.cpp +++ b/src/g_heretic/a_clink.cpp @@ -98,7 +98,7 @@ void A_ClinkAttack (AActor *actor) if (actor->CheckMeleeRange ()) { damage = ((pr_clinkattack()%7)+3); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); } } diff --git a/src/g_heretic/a_dsparil.cpp b/src/g_heretic/a_dsparil.cpp index 1bbc2d5ce..20bc6545d 100644 --- a/src/g_heretic/a_dsparil.cpp +++ b/src/g_heretic/a_dsparil.cpp @@ -165,7 +165,7 @@ IMPLEMENT_ACTOR (ASorcererFX1, Heretic, -1, 144) PROP_HeightFixed (10) PROP_SpeedFixed (20) PROP_Damage (10) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) PROP_Flags2 (MF2_NOTELEPORT) PROP_RenderStyle (STYLE_Add) @@ -467,7 +467,7 @@ void A_Srcr1Attack (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_scrc1atk.HitDice (8); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } @@ -617,7 +617,7 @@ void A_Srcr2Attack (AActor *actor) if (actor->CheckMeleeRange()) { int damage = pr_s2a.HitDice (20); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } @@ -678,7 +678,7 @@ void A_GenWizard (AActor *actor) mo->CopyFriendliness (actor->target, true); actor->momx = actor->momy = actor->momz = 0; - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); actor->flags &= ~MF_MISSILE; mo->master = actor->target; // Heretic did not offset it by TELEFOGHEIGHT, so I won't either. diff --git a/src/g_heretic/a_hereticartifacts.cpp b/src/g_heretic/a_hereticartifacts.cpp index 186a06714..2f51d0f17 100644 --- a/src/g_heretic/a_hereticartifacts.cpp +++ b/src/g_heretic/a_hereticartifacts.cpp @@ -36,7 +36,7 @@ bool AArtiTomeOfPower::Use (bool pickup) { // Attempt to undo chicken if (P_UndoPlayerMorph (Owner->player) == false) { // Failed - P_DamageMobj (Owner, NULL, NULL, 1000000, MOD_TELEFRAG); + P_DamageMobj (Owner, NULL, NULL, 1000000, NAME_Telefrag); } else { // Succeeded diff --git a/src/g_heretic/a_hereticimp.cpp b/src/g_heretic/a_hereticimp.cpp index 6474e2370..67fc7f095 100644 --- a/src/g_heretic/a_hereticimp.cpp +++ b/src/g_heretic/a_hereticimp.cpp @@ -264,7 +264,7 @@ void A_ImpMeAttack (AActor *self) if (self->CheckMeleeRange ()) { int damage = 5+(pr_impmeatk()&7); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } } @@ -320,7 +320,7 @@ void A_ImpMsAttack2 (AActor *self) if (self->CheckMeleeRange ()) { int damage = 5+(pr_impmsatk2()&7); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); return; } diff --git a/src/g_heretic/a_hereticmisc.cpp b/src/g_heretic/a_hereticmisc.cpp index 4a79f693d..2f0d2ba23 100644 --- a/src/g_heretic/a_hereticmisc.cpp +++ b/src/g_heretic/a_hereticmisc.cpp @@ -419,7 +419,7 @@ IMPLEMENT_ACTOR (AVolcanoBlast, Heretic, -1, 123) PROP_HeightFixed (8) PROP_SpeedFixed (2) PROP_Damage (2) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) @@ -457,7 +457,7 @@ IMPLEMENT_ACTOR (AVolcanoTBlast, Heretic, -1, 124) PROP_HeightFixed (6) PROP_SpeedFixed (2) PROP_Damage (1) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF) PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) @@ -525,7 +525,7 @@ void A_VolcBallImpact (AActor *ball) ball->z += 28*FRACUNIT; //ball->momz = 3*FRACUNIT; } - P_RadiusAttack (ball, ball->target, 25, 25, MOD_FIRE, true); + P_RadiusAttack (ball, ball->target, 25, 25, NAME_Fire, true); for (i = 0; i < 4; i++) { tiny = Spawn (ball->x, ball->y, ball->z, ALLOW_REPLACE); diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index d96ab60ad..6addbb794 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -218,7 +218,7 @@ void A_StaffAttackPL1 (AActor *actor) angle = player->mo->angle; angle += pr_sap.Random2() << 18; slope = P_AimLineAttack (player->mo, angle, MELEERANGE); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AStaffPuff)); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff)); if (linetarget) { //S_StartSound(player->mo, sfx_stfhit); @@ -257,7 +257,7 @@ void A_StaffAttackPL2 (AActor *actor) angle = player->mo->angle; angle += pr_sap2.Random2() << 18; slope = P_AimLineAttack (player->mo, angle, MELEERANGE); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AStaffPuff2)); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff2)); if (linetarget) { //S_StartSound(player->mo, sfx_stfpow); @@ -457,7 +457,7 @@ void A_FireGoldWandPL1 (AActor *actor) { angle += pr_fgw.Random2() << 18; } - P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, MOD_UNKNOWN, RUNTIME_CLASS(AGoldWandPuff1)); + P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff1)); S_Sound (player->mo, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); } @@ -497,7 +497,7 @@ void A_FireGoldWandPL2 (AActor *actor) for(i = 0; i < 5; i++) { damage = 1+(pr_fgw2()&7); - P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, MOD_UNKNOWN, RUNTIME_CLASS(AGoldWandPuff2)); + P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff2)); angle += ((ANG45/8)*2)/4; } S_Sound (player->mo, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); @@ -1651,7 +1651,7 @@ void A_GauntletAttack (AActor *actor) pufftype = RUNTIME_CLASS(AGauntletPuff1); } slope = P_AimLineAttack (player->mo, angle, dist); - P_LineAttack (player->mo, angle, dist, slope, damage, MOD_HIT, pufftype); + P_LineAttack (player->mo, angle, dist, slope, damage, NAME_Melee, pufftype); if (!linetarget) { if (pr_gatk() > 64) @@ -1976,7 +1976,7 @@ void A_FireBlasterPL1 (AActor *actor) { angle += pr_fb1.Random2() << 18; } - P_LineAttack (actor, angle, PLAYERMISSILERANGE, bulletpitch, damage, MOD_UNKNOWN, RUNTIME_CLASS(ABlasterPuff)); + P_LineAttack (actor, angle, PLAYERMISSILERANGE, bulletpitch, damage, NAME_None, RUNTIME_CLASS(ABlasterPuff)); S_Sound (actor, CHAN_WEAPON, "weapons/blastershoot", 1, ATTN_NORM); } @@ -2692,7 +2692,7 @@ IMPLEMENT_ACTOR (APhoenixFX1, Heretic, -1, 163) PROP_HeightFixed (8) PROP_SpeedFixed (20) PROP_Damage (20) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) PROP_Flags2 (MF2_THRUGHOST|MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) PROP_RenderStyle (STYLE_Add) @@ -2770,7 +2770,7 @@ IMPLEMENT_ACTOR (APhoenixFX2, Heretic, -1, 0) PROP_HeightFixed (8) PROP_SpeedFixed (10) PROP_Damage (2) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) PROP_Flags2 (MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) PROP_RenderStyle (STYLE_Add) diff --git a/src/g_heretic/a_ironlich.cpp b/src/g_heretic/a_ironlich.cpp index 55d6dc608..db2c6f43d 100644 --- a/src/g_heretic/a_ironlich.cpp +++ b/src/g_heretic/a_ironlich.cpp @@ -263,7 +263,7 @@ int AWhirlwind::DoSpecialDamage (AActor *target, int damage) } if (!(level.time & 7)) { - P_DamageMobj (target, NULL, this->target, 3, MOD_HIT); + P_DamageMobj (target, NULL, this->target, 3, NAME_Melee); } return -1; } @@ -300,7 +300,7 @@ void A_LichAttack (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_atk.HitDice (6); - P_DamageMobj (target, actor, actor, damage, MOD_HIT); + P_DamageMobj (target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, target, actor); return; } @@ -364,7 +364,7 @@ void A_WhirlwindSeek (AActor *actor) if (actor->health < 0) { actor->momx = actor->momy = actor->momz = 0; - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); actor->flags &= ~MF_MISSILE; return; } diff --git a/src/g_heretic/a_knight.cpp b/src/g_heretic/a_knight.cpp index 221c854f6..691bb02f5 100644 --- a/src/g_heretic/a_knight.cpp +++ b/src/g_heretic/a_knight.cpp @@ -209,7 +209,7 @@ void A_KnightAttack (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_knightatk.HitDice (3); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); S_Sound (actor, CHAN_BODY, "hknight/melee", 1, ATTN_NORM); return; diff --git a/src/g_heretic/a_mummy.cpp b/src/g_heretic/a_mummy.cpp index 0418252f7..67c06ca3f 100644 --- a/src/g_heretic/a_mummy.cpp +++ b/src/g_heretic/a_mummy.cpp @@ -221,7 +221,7 @@ void A_MummyAttack (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_atk.HitDice (2); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); S_Sound (actor, CHAN_WEAPON, "mummy/attack2", 1, ATTN_NORM); return; @@ -249,7 +249,7 @@ void A_MummyAttack2 (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_ma2.HitDice (2); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } diff --git a/src/g_heretic/a_wizard.cpp b/src/g_heretic/a_wizard.cpp index 19894a4cd..e3cb3ff6c 100644 --- a/src/g_heretic/a_wizard.cpp +++ b/src/g_heretic/a_wizard.cpp @@ -187,7 +187,7 @@ void A_WizAtk3 (AActor *actor) if (actor->CheckMeleeRange()) { int damage = pr_wizatk3.HitDice (4); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } diff --git a/src/g_hexen/a_bats.cpp b/src/g_hexen/a_bats.cpp index 33d3ec24a..fcceb8884 100644 --- a/src/g_hexen/a_bats.cpp +++ b/src/g_hexen/a_bats.cpp @@ -128,7 +128,7 @@ void A_BatMove (AActor *actor) if (actor->special2 < 0) { - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); } actor->special2 -= 2; // Called every 2 tics diff --git a/src/g_hexen/a_bishop.cpp b/src/g_hexen/a_bishop.cpp index 20095a069..c52be6f64 100644 --- a/src/g_hexen/a_bishop.cpp +++ b/src/g_hexen/a_bishop.cpp @@ -239,7 +239,7 @@ void A_BishopAttack (AActor *actor) if (actor->CheckMeleeRange()) { int damage = pr_atk.HitDice (4); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } diff --git a/src/g_hexen/a_centaur.cpp b/src/g_hexen/a_centaur.cpp index 5ae4d3026..8d1d79d38 100644 --- a/src/g_hexen/a_centaur.cpp +++ b/src/g_hexen/a_centaur.cpp @@ -266,7 +266,7 @@ void A_CentaurAttack (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_centaurattack()%7+3; - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); } } diff --git a/src/g_hexen/a_clericflame.cpp b/src/g_hexen/a_clericflame.cpp index 73a7f8725..61c8901b7 100644 --- a/src/g_hexen/a_clericflame.cpp +++ b/src/g_hexen/a_clericflame.cpp @@ -236,7 +236,7 @@ FState ACircleFlame::States[] = IMPLEMENT_ACTOR (ACircleFlame, Hexen, -1, 0) PROP_RadiusFixed (6) PROP_Damage (2) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT) PROP_RenderStyle (STYLE_Add) @@ -278,7 +278,7 @@ IMPLEMENT_ACTOR (ACFlameMissile, Hexen, -1, 0) PROP_RadiusFixed (14) PROP_HeightFixed (8) PROP_Damage (8) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) PROP_RenderFlags (RF_INVISIBLE) diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 9f531fc6b..4f885e7a6 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -360,7 +360,7 @@ bool AHolySpirit::Slam (AActor *thing) // ghost burns out faster when attacking players/bosses health -= 6; } - P_DamageMobj (thing, this, target, dam, MOD_HIT); + P_DamageMobj (thing, this, target, dam, NAME_Melee); if (pr_spiritslam() < 128) { Spawn (x, y, z, ALLOW_REPLACE); @@ -666,7 +666,7 @@ void A_CHolyTail (AActor *actor) parent = actor->target; - if (parent == NULL || parent->state >= parent->DeathState) + if (parent == NULL || parent->health <= 0) // better check for health than current state - it's safer! { // Ghost removed, so remove all tail parts CHolyTailRemove (actor); return; @@ -825,7 +825,7 @@ void A_CHolySeek (AActor *actor) actor->momx >>= 2; actor->momy >>= 2; actor->momz = 0; - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); actor->tics -= pr_holyseek()&3; return; } diff --git a/src/g_hexen/a_clericmace.cpp b/src/g_hexen/a_clericmace.cpp index 145abcd91..b4162a234 100644 --- a/src/g_hexen/a_clericmace.cpp +++ b/src/g_hexen/a_clericmace.cpp @@ -95,7 +95,7 @@ void A_CMaceAttack (AActor *actor) slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE); if (linetarget) { - P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AHammerPuff)); + P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AHammerPuff)); AdjustPlayerAngle (player->mo); // player->mo->angle = R_PointToAngle2(player->mo->x, // player->mo->y, linetarget->x, linetarget->y); @@ -105,7 +105,7 @@ void A_CMaceAttack (AActor *actor) slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE); if (linetarget) { - P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AHammerPuff)); + P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AHammerPuff)); AdjustPlayerAngle (player->mo); // player->mo->angle = R_PointToAngle2(player->mo->x, // player->mo->y, linetarget->x, linetarget->y); @@ -117,7 +117,7 @@ void A_CMaceAttack (AActor *actor) angle = player->mo->angle; slope = P_AimLineAttack (player->mo, angle, MELEERANGE); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AHammerPuff)); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AHammerPuff)); macedone: return; } diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 2a191e43e..aa14356c5 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -204,7 +204,7 @@ void A_CStaffCheck (AActor *actor) slope = P_AimLineAttack (pmo, angle, fixed_t(1.5*MELEERANGE)); if (linetarget) { - P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, MOD_HIT, RUNTIME_CLASS(ACStaffPuff)); + P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, RUNTIME_CLASS(ACStaffPuff)); pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y); if ((linetarget->player || linetarget->flags3&MF3_ISMONSTER) @@ -228,7 +228,7 @@ void A_CStaffCheck (AActor *actor) slope = P_AimLineAttack (player->mo, angle, fixed_t(1.5*MELEERANGE)); if (linetarget) { - P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, MOD_HIT, RUNTIME_CLASS(ACStaffPuff)); + P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, RUNTIME_CLASS(ACStaffPuff)); pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y); if (linetarget->player || linetarget->flags3&MF3_ISMONSTER) diff --git a/src/g_hexen/a_demons.cpp b/src/g_hexen/a_demons.cpp index c5bbb081a..a68ef39d0 100644 --- a/src/g_hexen/a_demons.cpp +++ b/src/g_hexen/a_demons.cpp @@ -283,7 +283,7 @@ IMPLEMENT_ACTOR (ADemon1FX1, Hexen, -1, 0) PROP_RadiusFixed (10) PROP_HeightFixed (6) PROP_Damage (5) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) PROP_RenderStyle (STYLE_Add) @@ -529,7 +529,7 @@ IMPLEMENT_ACTOR (ADemon2FX1, Hexen, -1, 0) PROP_RadiusFixed (10) PROP_HeightFixed (6) PROP_Damage (5) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) PROP_RenderStyle (STYLE_Add) @@ -551,7 +551,7 @@ void A_DemonAttack1 (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_atk.HitDice (2); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); } } diff --git a/src/g_hexen/a_dragon.cpp b/src/g_hexen/a_dragon.cpp index 2d54c2143..81b6b6883 100644 --- a/src/g_hexen/a_dragon.cpp +++ b/src/g_hexen/a_dragon.cpp @@ -124,7 +124,7 @@ IMPLEMENT_ACTOR (ADragonFireball, Hexen, -1, 0) PROP_RadiusFixed (12) PROP_HeightFixed (10) PROP_Damage (6) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT) PROP_RenderStyle (STYLE_Add) @@ -163,7 +163,7 @@ FState ADragonExplosion::States[] = IMPLEMENT_ACTOR (ADragonExplosion, Hexen, -1, 0) PROP_RadiusFixed (8) PROP_HeightFixed (8) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP) PROP_Flags2 (MF2_NOTELEPORT) PROP_RenderFlags (RF_INVISIBLE) @@ -251,7 +251,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax) if (actor->CheckMeleeRange ()) { int damage = pr_dragonseek.HitDice (10); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); S_SoundID (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM); } @@ -365,7 +365,7 @@ void A_DragonFlight (AActor *actor) if (abs(actor->angle-angle) < ANGLE_45/2 && actor->CheckMeleeRange()) { int damage = pr_dragonflight.HitDice (8); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); S_SoundID (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM); } diff --git a/src/g_hexen/a_ettin.cpp b/src/g_hexen/a_ettin.cpp index e9f987945..6dac9f7a5 100644 --- a/src/g_hexen/a_ettin.cpp +++ b/src/g_hexen/a_ettin.cpp @@ -162,7 +162,7 @@ void A_EttinAttack (AActor *actor) if (actor->CheckMeleeRange()) { int damage = pr_ettinatk.HitDice (2); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); } } diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index e81c04ec5..397b1524a 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -37,8 +37,7 @@ public: FState *GetUpState (); FState *GetDownState (); FState *GetReadyState (); - FState *GetAtkState (); - FState *GetHoldAtkState (); + FState *GetAtkState (bool hold); }; FState AFWeapAxe::States[] = @@ -121,27 +120,22 @@ END_DEFAULTS FState *AFWeapAxe::GetUpState () { - return Ammo1->Amount ? &States[S_FAXEUP_G] : UpState; + return Ammo1->Amount ? &States[S_FAXEUP_G] : Super::GetUpState(); } FState *AFWeapAxe::GetDownState () { - return Ammo1->Amount ? &States[S_FAXEDOWN_G] : DownState; + return Ammo1->Amount ? &States[S_FAXEDOWN_G] : Super::GetDownState(); } FState *AFWeapAxe::GetReadyState () { - return Ammo1->Amount ? &States[S_FAXEREADY_G] : ReadyState; + return Ammo1->Amount ? &States[S_FAXEREADY_G] : Super::GetReadyState(); } -FState *AFWeapAxe::GetAtkState () +FState *AFWeapAxe::GetAtkState (bool hold) { - return Ammo1->Amount ? &States[S_FAXEATK_G] : AtkState; -} - -FState *AFWeapAxe::GetHoldAtkState () -{ - return Ammo1->Amount ? &States[S_FAXEATK_G] : HoldAtkState; + return Ammo1->Amount ? &States[S_FAXEATK_G] : Super::GetAtkState(hold); } // Axe Puff ----------------------------------------------------------------- @@ -388,7 +382,7 @@ void A_FAxeAttack (AActor *actor) slope = P_AimLineAttack (pmo, angle, AXERANGE); if (linetarget) { - P_LineAttack (pmo, angle, AXERANGE, slope, damage, MOD_HIT, pufftype); + P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) { P_ThrustMobj (linetarget, angle, power); @@ -401,7 +395,7 @@ void A_FAxeAttack (AActor *actor) slope = P_AimLineAttack (pmo, angle, AXERANGE); if (linetarget) { - P_LineAttack (pmo, angle, AXERANGE, slope, damage, MOD_HIT, pufftype); + P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype); if (linetarget->flags3&MF3_ISMONSTER) { P_ThrustMobj (linetarget, angle, power); @@ -416,7 +410,7 @@ void A_FAxeAttack (AActor *actor) angle = pmo->angle; slope = P_AimLineAttack (pmo, angle, MELEERANGE); - P_LineAttack (pmo, angle, MELEERANGE, slope, damage, MOD_HIT, pufftype); + P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype); axedone: if (useMana == 2) diff --git a/src/g_hexen/a_fighterhammer.cpp b/src/g_hexen/a_fighterhammer.cpp index 7060f6aba..22c6bf658 100644 --- a/src/g_hexen/a_fighterhammer.cpp +++ b/src/g_hexen/a_fighterhammer.cpp @@ -119,7 +119,7 @@ IMPLEMENT_ACTOR (AHammerMissile, Hexen, -1, 0) PROP_RadiusFixed (14) PROP_HeightFixed (20) PROP_Damage (10) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) @@ -194,7 +194,7 @@ void A_FHammerAttack (AActor *actor) slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE); if (linetarget) { - P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AHammerPuff)); + P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AHammerPuff)); AdjustPlayerAngle(pmo); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) { @@ -207,7 +207,7 @@ void A_FHammerAttack (AActor *actor) slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE); if(linetarget) { - P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AHammerPuff)); + P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AHammerPuff)); AdjustPlayerAngle(pmo); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) { @@ -221,7 +221,7 @@ void A_FHammerAttack (AActor *actor) PuffSpawned = NULL; angle = pmo->angle; slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE); - P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(AHammerPuff)); + P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AHammerPuff)); if (PuffSpawned) { pmo->special1 = false; diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index d10e0d33f..9adddb4e3 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -300,7 +300,7 @@ void A_FPunchAttack (AActor *actor) power = 6*FRACUNIT; pufftype = RUNTIME_CLASS(AHammerPuff); } - P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, MOD_HIT, pufftype); + P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) { P_ThrustMobj (linetarget, angle, power); @@ -319,7 +319,7 @@ void A_FPunchAttack (AActor *actor) power = 6*FRACUNIT; pufftype = RUNTIME_CLASS(AHammerPuff); } - P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, MOD_HIT, pufftype); + P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) { P_ThrustMobj (linetarget, angle, power); @@ -333,7 +333,7 @@ void A_FPunchAttack (AActor *actor) angle = pmo->angle; slope = P_AimLineAttack (pmo, angle, MELEERANGE); - P_LineAttack (pmo, angle, MELEERANGE, slope, damage, MOD_HIT, pufftype); + P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype); punchdone: if (pmo->special1 == 3) diff --git a/src/g_hexen/a_firedemon.cpp b/src/g_hexen/a_firedemon.cpp index dfd17d380..1dccfbd7f 100644 --- a/src/g_hexen/a_firedemon.cpp +++ b/src/g_hexen/a_firedemon.cpp @@ -312,7 +312,7 @@ IMPLEMENT_ACTOR (AFireDemonMissile, Hexen, -1, 0) PROP_HeightFixed (6) PROP_Mass (15) PROP_Damage (1) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS|MF2_FLOORCLIP) PROP_RenderStyle (STYLE_Add) diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 3b1f27e76..e71d65949 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -75,7 +75,7 @@ FState AFireBomb::States[] = }; IMPLEMENT_ACTOR (AFireBomb, Hexen, -1, 0) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOGRAVITY) PROP_Flags3 (MF3_FOILINVUL) PROP_RenderStyle (STYLE_Translucent) @@ -127,7 +127,7 @@ IMPLEMENT_ACTOR (AThrowingBomb, Hexen, -1, 0) PROP_SpeedFixed (12) PROP_RadiusFixed (8) PROP_HeightFixed (10) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_HEXENBOUNCE) @@ -527,7 +527,7 @@ void A_CheckThrowBomb (AActor *actor) { if (--actor->health <= 0) { - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); } } diff --git a/src/g_hexen/a_fog.cpp b/src/g_hexen/a_fog.cpp index 811121150..1567f2025 100644 --- a/src/g_hexen/a_fog.cpp +++ b/src/g_hexen/a_fog.cpp @@ -197,7 +197,7 @@ void A_FogMove (AActor *actor) if (actor->args[3]-- <= 0) { - actor->SetStateNF (actor->DeathState); + actor->SetStateNF (actor->FindState(NAME_Death)); return; } diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index 772464c3c..1a1cbf2d5 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -696,7 +696,7 @@ void A_SorcBallOrbit(AActor *ball) // [RH] If no parent, then die instead of crashing if (ball->target == NULL) { - ball->SetState (ball->PainState); + ball->SetState (ball->FindState(NAME_Pain)); return; } @@ -715,7 +715,7 @@ void A_SorcBallOrbit(AActor *ball) actor = static_cast (ball); if (actor->target->health <= 0) - actor->SetState (actor->PainState); + actor->SetState (actor->FindState(NAME_Pain)); baseangle = (angle_t)parent->special1; angle = baseangle + actor->AngleOffset; @@ -1226,7 +1226,7 @@ void A_SorcFX2Orbit (AActor *actor) if ((parent->health <= 0) || // Sorcerer is dead (!parent->args[0])) // Time expired { - actor->SetStateNF (actor->DeathState); + actor->SetStateNF (actor->FindState(NAME_Death)); parent->args[0] = 0; parent->flags2 &= ~MF2_REFLECTIVE; parent->flags2 &= ~MF2_INVULNERABLE; @@ -1234,7 +1234,7 @@ void A_SorcFX2Orbit (AActor *actor) if (actor->args[0] && (parent->args[0]-- <= 0)) // Time expired { - actor->SetStateNF (actor->DeathState); + actor->SetStateNF (actor->FindState(NAME_Death)); parent->args[0] = 0; parent->flags2 &= ~MF2_REFLECTIVE; } @@ -1320,7 +1320,7 @@ void A_SorcFX4Check(AActor *actor) { if (actor->special2-- <= 0) { - actor->SetStateNF (actor->DeathState); + actor->SetStateNF (actor->FindState(NAME_Death)); } } @@ -1357,7 +1357,7 @@ void A_DoBounceCheck (AActor *actor, const char *sound) { if (actor->args[3]-- <= 0) { - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); S_Sound (actor, CHAN_BODY, sound, 1, ATTN_NONE); } else diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index e5f183f93..001246be3 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -28,12 +28,12 @@ IMPLEMENT_ABSTRACT_ACTOR (ASwitchableDecoration) void ASwitchableDecoration::Activate (AActor *activator) { - SetState (SeeState); + SetState (FindState(NAME_Active)); } void ASwitchableDecoration::Deactivate (AActor *activator) { - SetState (MeleeState); + SetState (FindState(NAME_Inactive)); } // SwitchingDecoration: Only Activate changes state ------------------------- @@ -86,7 +86,7 @@ END_DEFAULTS void APottery1::HitFloor () { Super::HitFloor (); - P_DamageMobj (this, NULL, NULL, 25, MOD_UNKNOWN); + P_DamageMobj (this, NULL, NULL, 25, NAME_None); } // Pottery2 ----------------------------------------------------------------- @@ -216,7 +216,7 @@ void A_PotteryExplode (AActor *actor) void A_PotteryChooseBit (AActor *actor) { - actor->SetState (actor->DeathState+1 + 2*(pr_bit()%5)); + actor->SetState (actor->FindState(NAME_Death) + 1 + 2*(pr_bit()%5)); actor->tics = 256+(pr_bit()<<1); } @@ -827,7 +827,7 @@ void AZBell::Activate (AActor *activator) { if (health > 0) { - P_DamageMobj (this, activator, activator, 10, MOD_HIT); // 'ring' the bell + P_DamageMobj (this, activator, activator, 10, NAME_Melee); // 'ring' the bell } } diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp index 07c00e820..34827917f 100644 --- a/src/g_hexen/a_iceguy.cpp +++ b/src/g_hexen/a_iceguy.cpp @@ -61,7 +61,7 @@ IMPLEMENT_ACTOR (AIceGuy, Hexen, 8020, 20) PROP_RadiusFixed (22) PROP_HeightFixed (75) PROP_Mass (150) - PROP_DamageType (MOD_ICE) + PROP_DamageType (NAME_Ice) PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_NOBLOOD|MF_COUNTKILL) PROP_Flags2 (MF2_PASSMOBJ|MF2_TELESTOMP|MF2_PUSHWALL|MF2_MCROSS) PROP_Flags4 (MF4_NOICEDEATH) @@ -110,7 +110,7 @@ IMPLEMENT_ACTOR (AIceGuyFX, Hexen, -1, 0) PROP_RadiusFixed (8) PROP_HeightFixed (10) PROP_Damage (1) - PROP_DamageType (MOD_ICE) + PROP_DamageType (NAME_Ice) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT) @@ -168,7 +168,7 @@ IMPLEMENT_ACTOR (AIceGuyFX2, Hexen, -1, 0) PROP_RadiusFixed (4) PROP_HeightFixed (4) PROP_Damage (1) - PROP_DamageType (MOD_ICE) + PROP_DamageType (NAME_Ice) PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_LOGRAV|MF2_NOTELEPORT) diff --git a/src/g_hexen/a_magecone.cpp b/src/g_hexen/a_magecone.cpp index e7e66b480..847edfd4c 100644 --- a/src/g_hexen/a_magecone.cpp +++ b/src/g_hexen/a_magecone.cpp @@ -105,7 +105,7 @@ IMPLEMENT_ACTOR (AFrostMissile, Hexen, -1, 0) PROP_RadiusFixed (13) PROP_HeightFixed (8) PROP_Damage (1) - PROP_DamageType (MOD_ICE) + PROP_DamageType (NAME_Ice) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) @@ -139,7 +139,7 @@ FState AIceShard::States[] = }; IMPLEMENT_ACTOR (AIceShard, Hexen, -1, 65) - PROP_DamageType (MOD_ICE) + PROP_DamageType (NAME_Ice) PROP_Flags2 (MF2_NOTELEPORT) PROP_SpawnState (0) END_DEFAULTS @@ -180,7 +180,7 @@ void A_FireConePL1 (AActor *actor) slope = P_AimLineAttack (actor, angle, MELEERANGE); if (linetarget) { - P_DamageMobj (linetarget, actor, actor, damage, MOD_ICE); + P_DamageMobj (linetarget, actor, actor, damage, NAME_Ice); conedone = true; break; } diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 9e6132894..e6ca1e355 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -132,11 +132,11 @@ int ALightning::SpecialMissileHit (AActor *thing) { if (thing->IsKindOf(RUNTIME_CLASS(ACentaur))) { // Lightning does more damage to centaurs - P_DamageMobj(thing, this, target, 9, MOD_ELECTRIC); + P_DamageMobj(thing, this, target, 9, NAME_Electric); } else { - P_DamageMobj(thing, this, target, 3, MOD_ELECTRIC); + P_DamageMobj(thing, this, target, 3, NAME_Electric); } if (!(S_IsActorPlayingSomething (this, CHAN_WEAPON, -1))) { @@ -438,7 +438,7 @@ void A_LightningZap (AActor *actor) actor->health -= 8; if (actor->health <= 0) { - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); return; } if (actor->flags3 & MF3_FLOORHUGGER) @@ -532,7 +532,7 @@ void A_ZapMimic (AActor *actor) mo = actor->lastenemy; if (mo) { - if (mo->state >= mo->DeathState) + if (mo->state >= mo->FindState(NAME_Death)) { P_ExplodeMissile (actor, NULL, NULL); } diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index b93eb7b28..9a37b27e0 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -272,7 +272,7 @@ IMPLEMENT_ACTOR (AMageStaffFX2, Hexen, -1, 0) PROP_SpeedFixed (17) PROP_HeightFixed (8) PROP_Damage (4) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS|MF2_SEEKERMISSILE) @@ -295,7 +295,7 @@ int AMageStaffFX2::SpecialMissileHit (AActor *victim) !victim->player && !(victim->flags2 & MF2_BOSS)) { - P_DamageMobj (victim, this, target, 10, MOD_FIRE); + P_DamageMobj (victim, this, target, 10, NAME_Fire); return 1; // Keep going } return -1; diff --git a/src/g_hexen/a_pig.cpp b/src/g_hexen/a_pig.cpp index d8d74cbb3..43b6e004c 100644 --- a/src/g_hexen/a_pig.cpp +++ b/src/g_hexen/a_pig.cpp @@ -76,7 +76,7 @@ IMPLEMENT_ACTOR (ASnout, Hexen, -1, 0) PROP_Weapon_DownState (S_SNOUTDOWN) PROP_Weapon_ReadyState (S_SNOUTREADY) PROP_Weapon_AtkState (S_SNOUTATK) - PROP_Weapon_HoldAtkState (S_SNOUTATK) + PROP_Weapon_FlashState (S_SNOUTATK+1) // Not really - but it will do until this gets exported from the EXE PROP_Weapon_Kickback (150) PROP_Weapon_YAdjust (10) END_DEFAULTS @@ -164,7 +164,10 @@ void APigPlayer::MorphPlayerThink () } if(!(momx | momy) && pr_pigplayerthink() < 64) { // Snout sniff - P_SetPspriteNF (player, ps_weapon, ((ASnout*)GetDefaultByType(RUNTIME_CLASS(ASnout)))->AtkState + 1); + if (player->ReadyWeapon != NULL) + { + P_SetPspriteNF(player, ps_weapon, player->ReadyWeapon->FindState(NAME_Flash)); + } S_Sound (this, CHAN_VOICE, "PigActive1", 1, ATTN_NORM); // snort return; } @@ -261,7 +264,7 @@ void A_SnoutAttack (AActor *actor) angle = player->mo->angle; slope = P_AimLineAttack(player->mo, angle, MELEERANGE); PuffSpawned = NULL; - P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(ASnoutPuff)); + P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(ASnoutPuff)); S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM); if(linetarget) { @@ -287,7 +290,7 @@ void A_PigAttack (AActor *actor) } if (actor->CheckMeleeRange ()) { - P_DamageMobj(actor->target, actor, actor, 2+(pr_pigattack()&1), MOD_HIT); + P_DamageMobj(actor->target, actor, actor, 2+(pr_pigattack()&1), NAME_Melee); S_Sound(actor, CHAN_WEAPON, "PigAttack", 1, ATTN_NORM); } } diff --git a/src/g_hexen/a_serpent.cpp b/src/g_hexen/a_serpent.cpp index 3b87067ab..2cc06c731 100644 --- a/src/g_hexen/a_serpent.cpp +++ b/src/g_hexen/a_serpent.cpp @@ -572,7 +572,7 @@ void A_SerpentMeleeAttack (AActor *actor) if (actor->CheckMeleeRange ()) { int damage = pr_serpentmeattack.HitDice (5); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); S_Sound (actor, CHAN_BODY, "SerpentMeleeHit", 1, ATTN_NORM); } @@ -691,7 +691,7 @@ void A_SerpentHeadCheck (AActor *actor) } else { - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); } } } diff --git a/src/g_hexen/a_spike.cpp b/src/g_hexen/a_spike.cpp index e412991a4..775e0af73 100644 --- a/src/g_hexen/a_spike.cpp +++ b/src/g_hexen/a_spike.cpp @@ -53,7 +53,7 @@ bool PIT_ThrustStompThing (AActor *thing) if (thing == tsthing) return true; // don't clip against self - P_DamageMobj (thing, tsthing, tsthing, 10001, MOD_CRUSH); + P_DamageMobj (thing, tsthing, tsthing, 10001, NAME_Crush); P_TraceBleed (10001, thing); tsthing->args[1] = 1; // Mark thrust thing as bloody diff --git a/src/g_hexen/a_teleportother.cpp b/src/g_hexen/a_teleportother.cpp index 0814a7a44..fba93917c 100644 --- a/src/g_hexen/a_teleportother.cpp +++ b/src/g_hexen/a_teleportother.cpp @@ -200,7 +200,7 @@ void A_CheckTeleRing (AActor *actor) { if (actor->special1-- <= 0) { - actor->SetState (actor->DeathState); + actor->SetState (actor->FindState(NAME_Death)); } } diff --git a/src/g_hexen/a_wraith.cpp b/src/g_hexen/a_wraith.cpp index 90801ea54..50f708a98 100644 --- a/src/g_hexen/a_wraith.cpp +++ b/src/g_hexen/a_wraith.cpp @@ -173,7 +173,7 @@ IMPLEMENT_ACTOR (AWraithFX1, Hexen, -1, 0) PROP_HeightFixed (6) PROP_Mass (5) PROP_Damage (5) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_FLOORCLIP|MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) @@ -383,7 +383,7 @@ void A_WraithMelee (AActor *actor) if (actor->CheckMeleeRange() && (pr_stealhealth()<220)) { amount = pr_stealhealth.HitDice (2); - P_DamageMobj (actor->target, actor, actor, amount, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, amount, NAME_Melee); actor->health += amount; } } diff --git a/src/g_level.cpp b/src/g_level.cpp index 71681459e..b4c3b6f3f 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -548,6 +548,8 @@ static void G_DoParseMapInfo (int lump) switch (SC_MustMatchString (MapInfoTopLevel)) { case MITL_DEFAULTMAP: + if (defaultinfo.music != NULL) delete [] defaultinfo.music; + if (defaultinfo.intermusic != NULL) delete [] defaultinfo.intermusic; SetLevelDefaults (&defaultinfo); ParseMapInfoLower (MapHandlers, MapInfoMapLevel, &defaultinfo, NULL, defaultinfo.flags); break; @@ -583,6 +585,10 @@ static void G_DoParseMapInfo (int lump) { levelinfo->music = copystring (levelinfo->music); } + if (levelinfo->intermusic != NULL) + { + levelinfo->intermusic = copystring (levelinfo->intermusic); + } if (HexenHack) { levelinfo->WallHorizLight = levelinfo->WallVertLight = 0; @@ -676,6 +682,14 @@ static void G_DoParseMapInfo (int lump) } } SC_Close (); + if (defaultinfo.music != NULL) + { + delete [] defaultinfo.music; + } + if (defaultinfo.intermusic != NULL) + { + delete [] defaultinfo.intermusic; + } } static void ClearLevelInfoStrings(level_info_t *linfo) @@ -685,6 +699,11 @@ static void ClearLevelInfoStrings(level_info_t *linfo) delete[] linfo->music; linfo->music = NULL; } + if (linfo->intermusic != NULL) + { + delete[] linfo->intermusic; + linfo->intermusic = NULL; + } if (linfo->level_name != NULL) { delete[] linfo->level_name; diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 17ed6f10f..2dcb88595 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -220,7 +220,7 @@ AT_GAME_SET (Minotaur) AMinotaur::States[S_MNTR_ATK3+3].SetFrame ('I'); AMinotaur::States[S_MNTR_ATK4+0].SetFrame ('F'); - GetDefault()->DeathState = &AMinotaur::States[S_MNTR_FADEOUT]; + RUNTIME_CLASS(AMinotaur)->ActorInfo->ChangeState(NAME_Death, &AMinotaur::States[S_MNTR_FADEOUT]); } } @@ -349,7 +349,7 @@ IMPLEMENT_ACTOR (AMinotaurFX1, Raven, -1, 0) PROP_HeightFixed (6) PROP_SpeedFixed (20) PROP_Damage (3) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY) PROP_Flags2 (MF2_NOTELEPORT) PROP_RenderStyle (STYLE_Add) @@ -503,7 +503,7 @@ void A_MinotaurAtk1 (AActor *actor) if (actor->CheckMeleeRange()) { int damage = pr_minotauratk1.HitDice (4); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); if ((player = actor->target->player) != NULL && player->mo == actor->target) @@ -635,7 +635,7 @@ void A_MinotaurAtk2 (AActor *actor) { int damage; damage = pr_atk.HitDice (friendly ? 3 : 5); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); return; } @@ -677,7 +677,7 @@ void A_MinotaurAtk3 (AActor *actor) int damage; damage = pr_minotauratk3.HitDice (friendly ? 3 : 5); - P_DamageMobj (actor->target, actor, actor, damage, MOD_HIT); + P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee); P_TraceBleed (damage, actor->target, actor); if ((player = actor->target->player) != NULL && player->mo == actor->target) @@ -738,7 +738,7 @@ void P_MinotaurSlam (AActor *source, AActor *target) target->momx += FixedMul (thrust, finecosine[angle]); target->momy += FixedMul (thrust, finesine[angle]); damage = pr_minotaurslam.HitDice (static_cast(source) ? 4 : 6); - P_DamageMobj (target, NULL, NULL, damage, MOD_HIT); + P_DamageMobj (target, NULL, NULL, damage, NAME_Melee); P_TraceBleed (damage, target, angle, 0); if (target->player) { @@ -790,7 +790,7 @@ void A_MinotaurRoam (AActor *actor) if (self->StartTime >= 0 && (level.maptime - self->StartTime) >= MAULATORTICS) { - P_DamageMobj (actor, NULL, NULL, 1000000, MOD_UNKNOWN); + P_DamageMobj (actor, NULL, NULL, 1000000, NAME_None); return; } @@ -909,7 +909,7 @@ void A_MinotaurChase (AActor *actor) if (self->StartTime >= 0 && (level.maptime - self->StartTime) >= MAULATORTICS) { - P_DamageMobj (actor, NULL, NULL, 1000000, MOD_UNKNOWN); + P_DamageMobj (actor, NULL, NULL, 1000000, NAME_None); return; } diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index da2cd2fd8..a4cd54edc 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -60,7 +60,7 @@ IMPLEMENT_ACTOR (AIceChunkHead, Any, -1, 0) PROP_RadiusFixed (3) PROP_HeightFixed (4) PROP_Mass(5) - PROP_DamageType (MOD_ICE) + PROP_DamageType (NAME_Ice) PROP_Flags (MF_DROPOFF) PROP_Flags2 (MF2_LOGRAV|MF2_CANNOTPUSH) @@ -214,11 +214,11 @@ void A_IceSetTics (AActor *actor) actor->tics = 70+(pr_icesettics()&63); floor = P_GetThingFloorType (actor); - if (Terrains[floor].DamageMOD == MOD_FIRE) + if (Terrains[floor].DamageMOD == NAME_Fire) { actor->tics >>= 2; } - else if (Terrains[floor].DamageMOD == MOD_ICE) + else if (Terrains[floor].DamageMOD == NAME_Ice) { actor->tics <<= 1; } diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 1f84c63af..6851a1e03 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -551,9 +551,9 @@ END_DEFAULTS // //=========================================================================== -void APowerIronFeet::AbsorbDamage (int damage, int damageType, int &newdamage) +void APowerIronFeet::AbsorbDamage (int damage, FName damageType, int &newdamage) { - if (damageType == MOD_WATER) + if (damageType == NAME_Water) { newdamage = 0; if (Owner->player != NULL) @@ -582,9 +582,9 @@ END_DEFAULTS // //=========================================================================== -void APowerMask::AbsorbDamage (int damage, int damageType, int &newdamage) +void APowerMask::AbsorbDamage (int damage, FName damageType, int &newdamage) { - if (damageType == MOD_FIRE) + if (damageType == NAME_Fire) { newdamage = 0; } diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 617489afe..9847d2dea 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -104,14 +104,14 @@ class APowerIronFeet : public APowerup { DECLARE_STATELESS_ACTOR (APowerIronFeet, APowerup) public: - void AbsorbDamage (int damage, int damageType, int &newdamage); + void AbsorbDamage (int damage, FName damageType, int &newdamage); }; class APowerMask : public APowerIronFeet { DECLARE_STATELESS_ACTOR (APowerMask, APowerIronFeet) public: - void AbsorbDamage (int damage, int damageType, int &newdamage); + void AbsorbDamage (int damage, FName damageType, int &newdamage); void DoEffect (); }; diff --git a/src/g_shared/a_hatetarget.cpp b/src/g_shared/a_hatetarget.cpp index b4eac96d4..52625002e 100644 --- a/src/g_shared/a_hatetarget.cpp +++ b/src/g_shared/a_hatetarget.cpp @@ -43,7 +43,7 @@ class AHateTarget : public AActor public: void BeginPlay (); angle_t AngleIncrements (void); - int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype); + int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); }; FState AHateTarget::States[] = @@ -76,7 +76,7 @@ void AHateTarget::BeginPlay () } } -int AHateTarget::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype) +int AHateTarget::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { if (special2 != 0) { diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 55cfa4da7..1763a376c 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -764,7 +764,7 @@ void AInventory::BecomePickup () // //=========================================================================== -void AInventory::AbsorbDamage (int damage, int damageType, int &newdamage) +void AInventory::AbsorbDamage (int damage, FName damageType, int &newdamage) { if (Inventory != NULL) { @@ -1250,18 +1250,6 @@ void AInventory::DetachFromOwner () IMPLEMENT_STATELESS_ACTOR (ACustomInventory, Any, -1, 0) END_DEFAULTS -//=========================================================================== -// -// ACustomInventory :: Serialize -// -//=========================================================================== - -void ACustomInventory::Serialize (FArchive &arc) -{ - Super::Serialize (arc); - arc << UseState << PickupState << DropState; -} - //=========================================================================== // // ACustomInventory :: SpecialDropAction @@ -1270,7 +1258,7 @@ void ACustomInventory::Serialize (FArchive &arc) bool ACustomInventory::SpecialDropAction (AActor *dropper) { - return CallStateChain (dropper, DropState); + return CallStateChain (dropper, FindState(NAME_Drop)); } //=========================================================================== @@ -1281,7 +1269,7 @@ bool ACustomInventory::SpecialDropAction (AActor *dropper) bool ACustomInventory::Use (bool pickup) { - return CallStateChain (Owner, UseState); + return CallStateChain (Owner, FindState(NAME_Use)); } //=========================================================================== @@ -1292,8 +1280,9 @@ bool ACustomInventory::Use (bool pickup) bool ACustomInventory::TryPickup (AActor *toucher) { - bool useok = CallStateChain (toucher, PickupState); - if ((useok || PickupState == NULL) && UseState != NULL) + FState *pickupstate = FindState(NAME_Pickup); + bool useok = CallStateChain (toucher, pickupstate); + if ((useok || pickupstate == NULL) && FindState(NAME_Use) != NULL) { useok = Super::TryPickup (toucher); } @@ -1561,9 +1550,9 @@ bool ABasicArmor::HandlePickup (AInventory *item) // //=========================================================================== -void ABasicArmor::AbsorbDamage (int damage, int damageType, int &newdamage) +void ABasicArmor::AbsorbDamage (int damage, FName damageType, int &newdamage) { - if (damageType != MOD_WATER) + if (damageType != NAME_Water) { int saved = FixedMul (damage, SavePercent); if (Amount < saved) @@ -1725,9 +1714,9 @@ bool AHexenArmor::AddArmorToSlot (AActor *actor, int slot, int amount) // //=========================================================================== -void AHexenArmor::AbsorbDamage (int damage, int damageType, int &newdamage) +void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage) { - if (damageType != MOD_WATER) + if (damageType != NAME_Water) { fixed_t savedPercent = Slots[0] + Slots[1] + Slots[2] + Slots[3] + Slots[4]; APlayerPawn *ppawn = Owner->player != NULL ? Owner->player->mo : NULL; diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index b4fcf2104..e9e695baa 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -149,7 +149,7 @@ public: virtual void Travelled (); virtual void OwnerDied (); - virtual void AbsorbDamage (int damage, int damageType, int &newdamage); + virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); virtual void AlterWeaponSprite (vissprite_t *vis); virtual PalEntry GetBlend (); @@ -167,12 +167,10 @@ class ACustomInventory : public AInventory { DECLARE_STATELESS_ACTOR (ACustomInventory, AInventory) public: - FState *UseState, *PickupState, *DropState; // This is used when an inventory item's use state sequence is executed. static bool CallStateChain (AActor *actor, FState *state); - void Serialize (FArchive &arc); bool TryPickup (AActor *toucher); bool Use (bool pickup); bool SpecialDropAction (AActor *dropper); @@ -211,13 +209,6 @@ public: int SelectionOrder; // Lower-numbered weapons get picked first fixed_t MoveCombatDist; // Used by bots, but do they *really* need it? - FState *UpState; - FState *DownState; - FState *ReadyState; - FState *AtkState, *HoldAtkState; - FState *AltAtkState, *AltHoldAtkState; - FState *FlashState, *AltFlashState; - // In-inventory instance variables AAmmo *Ammo1, *Ammo2; AWeapon *SisterWeapon; @@ -237,8 +228,8 @@ public: virtual FState *GetUpState (); virtual FState *GetDownState (); virtual FState *GetReadyState (); - virtual FState *GetAtkState (); - virtual FState *GetHoldAtkState (); + virtual FState *GetAtkState (bool hold); + virtual FState *GetAltAtkState (bool hold); virtual void PostMorphWeapon (); virtual void EndPowerup (); @@ -326,7 +317,7 @@ public: virtual void Tick (); virtual AInventory *CreateCopy (AActor *other); virtual bool HandlePickup (AInventory *item); - virtual void AbsorbDamage (int damage, int damageType, int &newdamage); + virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); fixed_t SavePercent; }; @@ -368,7 +359,7 @@ public: virtual AInventory *CreateCopy (AActor *other); virtual AInventory *CreateTossable (); virtual bool HandlePickup (AInventory *item); - virtual void AbsorbDamage (int damage, int damageType, int &newdamage); + virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); fixed_t Slots[5]; fixed_t SlotsIncrement[4]; diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index f62f4ef59..621f73fa8 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -96,7 +96,7 @@ void DEarthquake::Tick () { if (pr_quake() < 50) { - P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), MOD_UNKNOWN); + P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None); } // Thrust player around angle_t an = victim->angle + ANGLE_1*pr_quake(); diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index c1ef7544f..c8bc56bb3 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -52,10 +52,6 @@ void AWeapon::Serialize (FArchive &arc) << ProjectileType << AltProjectileType << SelectionOrder << MoveCombatDist - << UpState << DownState << ReadyState - << AtkState << HoldAtkState - << AltAtkState << AltHoldAtkState - << FlashState << AltFlashState << Ammo1 << Ammo2 << SisterWeapon << bAltFire; } @@ -70,6 +66,7 @@ void AWeapon::Serialize (FArchive &arc) bool AWeapon::TryPickup (AActor *toucher) { + FState * ReadyState = FindState(NAME_Ready); if (ReadyState != NULL && ReadyState->GetFrame() < sprites[ReadyState->sprite.index].numframes) { @@ -394,7 +391,7 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo) { enoughmask = 1 << altFire; } - if (altFire && AltAtkState == NULL) + if (altFire && FindState(NAME_AltFire) == NULL) { // If this weapon has no alternate fire, then there is never enough ammo for it enough &= 1; } @@ -472,7 +469,7 @@ void AWeapon::PostMorphWeapon () Owner->player->PendingWeapon = WP_NOCHANGE; Owner->player->ReadyWeapon = this; Owner->player->psprites[ps_weapon].sy = WEAPONBOTTOM; - P_SetPsprite (Owner->player, ps_weapon, UpState); + P_SetPsprite (Owner->player, ps_weapon, GetUpState()); } //=========================================================================== @@ -487,7 +484,7 @@ void AWeapon::EndPowerup () { if (SisterWeapon != NULL && WeaponFlags&WIF_POWERED_UP) { - if (ReadyState != SisterWeapon->ReadyState) + if (GetReadyState() != SisterWeapon->GetReadyState()) { Owner->player->PendingWeapon = SisterWeapon; } @@ -506,7 +503,7 @@ void AWeapon::EndPowerup () FState *AWeapon::GetUpState () { - return UpState; + return FindState(NAME_Select); } //=========================================================================== @@ -517,7 +514,7 @@ FState *AWeapon::GetUpState () FState *AWeapon::GetDownState () { - return DownState; + return FindState(NAME_Deselect); } //=========================================================================== @@ -528,7 +525,7 @@ FState *AWeapon::GetDownState () FState *AWeapon::GetReadyState () { - return ReadyState; + return FindState(NAME_Ready); } //=========================================================================== @@ -537,20 +534,28 @@ FState *AWeapon::GetReadyState () // //=========================================================================== -FState *AWeapon::GetAtkState () +FState *AWeapon::GetAtkState (bool hold) { - return AtkState; + FState * state=NULL; + + if (hold) state = FindState(NAME_Hold); + if (state == NULL) state = FindState(NAME_Fire); + return state; } //=========================================================================== // -// AWeapon :: GetHoldAtkState +// AWeapon :: GetAtkState // //=========================================================================== -FState *AWeapon::GetHoldAtkState () +FState *AWeapon::GetAltAtkState (bool hold) { - return HoldAtkState; + FState * state=NULL; + + if (hold) state = FindState(NAME_AltHold); + if (state == NULL) state = FindState(NAME_AltFire); + return state; } /* Weapon slots ***********************************************************/ @@ -792,7 +797,7 @@ CCMD (setslot) { int slot, i; - if (ParsingKeyConf && !WeaponSection) + if (ParsingKeyConf && WeaponSection.IsEmpty()) { Printf ("You need to use weaponsection before using setslot\n"); return; @@ -861,7 +866,7 @@ CCMD (weaponsection) { argv[1][32] = 0; } - ReplaceString (&WeaponSection, argv[1]); + WeaponSection = argv[1]; // If the ini already has definitions for this section, load them char fullSection[32*3]; @@ -888,7 +893,7 @@ CCMD (weaponsection) tackOn = fullSection + 4; } - sprintf (tackOn, ".%s.WeaponSlots", WeaponSection); + sprintf (tackOn, ".%s.WeaponSlots", WeaponSection.GetChars()); if (GameConfig->SetSection (fullSection)) { LocalWeapons.RestoreSlots (*GameConfig); @@ -907,7 +912,7 @@ CCMD (addslotdefault) return; } - if (ParsingKeyConf && !WeaponSection) + if (ParsingKeyConf && WeaponSection.IsEmpty()) { Printf ("You need to use weaponsection before using addslotdefault\n"); return; diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 2cbc77d5f..3893cbca9 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1366,7 +1366,7 @@ void FBaseStatusBar::BlendView (float blend[4]) { AddBlend (0.f, 1.f, 0.f, 0.125f, blend); } - if (CPlayer->mo->DamageType == MOD_ICE) + if (CPlayer->mo->DamageType == NAME_Ice) { AddBlend (0.25f, 0.25f, 0.853f, 0.4f, blend); } diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 5d03112cf..dc6fe30e9 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -130,7 +130,7 @@ END_DEFAULTS void AAlienSpectre1::Touch (AActor *toucher) { - P_DamageMobj (toucher, this, this, 5, MOD_HIT); + P_DamageMobj (toucher, this, this, 5, NAME_Melee); } // Alien Spectre 2 ----------------------------------------------------------- diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index bb0457535..125f44538 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -182,7 +182,7 @@ void AEntityBoss::BeginPlay () void AEntityBoss::Touch (AActor *toucher) { - P_DamageMobj (toucher, this, this, 5, MOD_HIT); + P_DamageMobj (toucher, this, this, 5, NAME_Melee); } // Second Entity Boss ------------------------------------------------------- @@ -273,7 +273,7 @@ END_DEFAULTS void AEntitySecond::Touch (AActor *toucher) { - P_DamageMobj (toucher, this, this, 5, MOD_HIT); + P_DamageMobj (toucher, this, this, 5, NAME_Melee); } void A_SubEntityDeath (AActor *self) diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index 28de62a6e..ba43fdbe0 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -190,7 +190,7 @@ void A_20538 (AActor *self) damage = (pr_atk1() & 9) * 5; - P_DamageMobj (self->target, self, self, damage, MOD_UNKNOWN); + P_DamageMobj (self->target, self, self, damage, NAME_None); P_TraceBleed (damage, self->target, self); } diff --git a/src/g_strife/a_macil.cpp b/src/g_strife/a_macil.cpp index 89430c726..3482b5a7a 100644 --- a/src/g_strife/a_macil.cpp +++ b/src/g_strife/a_macil.cpp @@ -119,7 +119,7 @@ class AMacil2 : public AMacil1 DECLARE_STATELESS_ACTOR (AMacil2, AMacil1) public: void NoBlockingSet (); - int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype); + int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); }; IMPLEMENT_STATELESS_ACTOR (AMacil2, Strife, 200, 0) @@ -161,7 +161,7 @@ void AMacil2::NoBlockingSet () // //============================================================================ -int AMacil2::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype) +int AMacil2::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { if (inflictor != NULL && inflictor->IsKindOf (RUNTIME_CLASS(ASpectralLightningV1))) return -1; diff --git a/src/g_strife/a_oracle.cpp b/src/g_strife/a_oracle.cpp index 8025ad0db..bca209bbc 100644 --- a/src/g_strife/a_oracle.cpp +++ b/src/g_strife/a_oracle.cpp @@ -79,7 +79,7 @@ void A_WakeOracleSpectre (AActor *self) // //============================================================================ -int AOracle::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype) +int AOracle::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { if (inflictor != NULL && inflictor->IsKindOf (RUNTIME_CLASS(ASpectralLightningV1))) return -1; diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index 9a4a2f1cf..12b59dc1a 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -230,7 +230,7 @@ void A_ProgrammerMelee (AActor *self) S_Sound (self, CHAN_WEAPON, "programmer/clank", 1, ATTN_NORM); damage = ((pr_prog() % 10) + 1) * 6; - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } diff --git a/src/g_strife/a_reaver.cpp b/src/g_strife/a_reaver.cpp index 0ffb6b519..d0cd1fdfb 100644 --- a/src/g_strife/a_reaver.cpp +++ b/src/g_strife/a_reaver.cpp @@ -118,7 +118,7 @@ void A_ReaverMelee (AActor *self) S_Sound (self, CHAN_WEAPON, "reaver/blade", 1, ATTN_NORM); damage = ((pr_reaverattack() & 7) + 1) * 3; - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } } @@ -140,7 +140,7 @@ void A_ReaverRanged (AActor *self) { angle_t angle = bangle + (pr_reaverattack.Random2() << 20); int damage = ((pr_reaverattack() & 7) + 1) * 3; - P_LineAttack (self, angle, MISSILERANGE, pitch, damage, MOD_UNKNOWN, RUNTIME_CLASS(AStrifePuff)); + P_LineAttack (self, angle, MISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AStrifePuff)); } } } diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index 52ecfa239..3b785693d 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -122,7 +122,7 @@ void A_ShootGun (AActor *self) pitch = P_AimLineAttack (self, self->angle, MISSILERANGE); P_LineAttack (self, self->angle + (pr_shootgun.Random2() << 19), MISSILERANGE, pitch, - 3*(pr_shootgun() % 5 + 1), MOD_UNKNOWN, RUNTIME_CLASS(AStrifePuff)); + 3*(pr_shootgun() % 5 + 1), NAME_None, RUNTIME_CLASS(AStrifePuff)); } // Rebel 1 ------------------------------------------------------------------ diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index e43c16218..a33c29e63 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -100,7 +100,7 @@ IMPLEMENT_ACTOR (ASentinelFX1, Strife, -1, 0) PROP_RadiusFixed (10) PROP_HeightFixed (8) PROP_Damage (0) - PROP_DamageType (MOD_DISINTEGRATE) + PROP_DamageType (NAME_Disintegrate) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_IMPACT|MF2_PCROSS) PROP_Flags4 (MF4_STRIFEDAMAGE) diff --git a/src/g_strife/a_stalker.cpp b/src/g_strife/a_stalker.cpp index bc158f856..e9a7d1a44 100644 --- a/src/g_strife/a_stalker.cpp +++ b/src/g_strife/a_stalker.cpp @@ -153,7 +153,7 @@ void A_StalkerAttack (AActor *self) { int damage = (pr_stalker() & 7) * 2 + 2; - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } } diff --git a/src/g_strife/a_strifeglobal.h b/src/g_strife/a_strifeglobal.h index e0e3e5cb8..3474bcd5a 100644 --- a/src/g_strife/a_strifeglobal.h +++ b/src/g_strife/a_strifeglobal.h @@ -59,7 +59,7 @@ class AOracle : public AActor DECLARE_ACTOR (AOracle, AActor) public: void NoBlockingSet (); - int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype); + int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); }; class ADummyStrifeItem : public AInventory diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 316c0a0ea..309013f64 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -391,7 +391,7 @@ class AForceFieldGuard : public AActor { DECLARE_ACTOR (AForceFieldGuard, AActor) public: - int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype); + int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); }; FState AForceFieldGuard::States[] = @@ -412,7 +412,7 @@ IMPLEMENT_ACTOR (AForceFieldGuard, Strife, 25, 0) PROP_Flags4 (MF4_INCOMBAT) END_DEFAULTS -int AForceFieldGuard::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype) +int AForceFieldGuard::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { if (inflictor == NULL || !inflictor->IsKindOf (RUNTIME_CLASS(ADegninOre))) { @@ -820,7 +820,7 @@ void A_CheckTerrain (AActor *self) { if ((sec->special & 0xFF) == Damage_InstantDeath) { - P_DamageMobj (self, NULL, NULL, 999, MOD_UNKNOWN); + P_DamageMobj (self, NULL, NULL, 999, NAME_None); } else if ((sec->special & 0xFF) == Scroll_StrifeCurrent) { @@ -967,7 +967,7 @@ void A_DropFire (AActor *self) { AActor *drop = Spawn (self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE); drop->momz = -FRACUNIT; - P_RadiusAttack (self, self, 64, 64, MOD_FIRE, false); + P_RadiusAttack (self, self, 64, 64, NAME_Fire, false); } void A_CrispyPlayer (AActor *self) diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index c59f16e5b..dd83073d1 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -153,9 +153,10 @@ void P_DaggerAlert (AActor *target, AActor *emitter) emitter->flags4 |= MF4_INCOMBAT; emitter->target = target; - if (emitter->PainState != NULL) + FState * painstate = emitter->FindState(NAME_Pain); + if (painstate != NULL) { - emitter->SetState (emitter->PainState); + emitter->SetState (painstate); } for (looker = sec->thinglist; looker != NULL; looker = looker->snext) @@ -208,7 +209,7 @@ void A_JabDagger (AActor *actor) angle = actor->angle + (pr_jabdagger.Random2() << 18); pitch = P_AimLineAttack (actor, angle, 80*FRACUNIT); - P_LineAttack (actor, angle, 80*FRACUNIT, pitch, damage, MOD_HIT, RUNTIME_CLASS(AStrifeSpark)); + P_LineAttack (actor, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, RUNTIME_CLASS(AStrifeSpark)); // turn to face target if (linetarget) @@ -689,7 +690,7 @@ void P_StrifeGunShot (AActor *mo, bool accurate) angle += pr_sgunshot.Random2() << (20 - mo->player->accuracy * 5 / 100); } - P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, MOD_UNKNOWN, RUNTIME_CLASS(AStrifePuff)); + P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, NAME_None, RUNTIME_CLASS(AStrifePuff)); } //============================================================================ @@ -1025,7 +1026,7 @@ IMPLEMENT_ACTOR (AFlameMissile, Strife, -1, 0) PROP_HeightFixed (11) PROP_Mass (10) PROP_Damage (4) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_ReactionTime (8) PROP_Flags (MF_NOBLOCKMAP|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) @@ -1209,7 +1210,7 @@ FState AMaulerPuff::States[] = IMPLEMENT_ACTOR (AMaulerPuff, Strife, -1, 0) PROP_SpawnState (0) - PROP_DamageType (MOD_DISINTEGRATE) + PROP_DamageType (NAME_Disintegrate) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY) PROP_Flags3 (MF3_PUFFONACTORS) PROP_RenderStyle (STYLE_Add) @@ -1243,7 +1244,7 @@ IMPLEMENT_ACTOR (AMaulerTorpedo, Strife, -1, 0) PROP_RadiusFixed (13) PROP_HeightFixed (8) PROP_Damage (1) - PROP_DamageType (MOD_DISINTEGRATE) + PROP_DamageType (NAME_Disintegrate) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) PROP_Flags4 (MF4_STRIFEDAMAGE) @@ -1274,7 +1275,7 @@ IMPLEMENT_ACTOR (AMaulerTorpedoWave, Strife, -1, 0) PROP_RadiusFixed (13) PROP_HeightFixed (13) PROP_Damage (10) - PROP_DamageType (MOD_DISINTEGRATE) + PROP_DamageType (NAME_Disintegrate) PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DROPOFF|MF_MISSILE) PROP_Flags2 (MF2_NOTELEPORT|MF2_PCROSS|MF2_IMPACT) PROP_Flags4 (MF4_STRIFEDAMAGE) @@ -1320,7 +1321,7 @@ void A_FireMauler1 (AActor *self) // 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. - P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, MOD_DISINTEGRATE, RUNTIME_CLASS(AMaulerPuff)); + P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Disintegrate, RUNTIME_CLASS(AMaulerPuff)); } } @@ -1563,7 +1564,7 @@ IMPLEMENT_ACTOR (APhosphorousFire, Strife, -1, 0) PROP_SpawnState (S_BURNINATION) PROP_DeathState (S_BURNDWINDLE) PROP_ReactionTime (120) - PROP_DamageType (MOD_FIRE) + PROP_DamageType (NAME_Fire) PROP_Flags (MF_NOBLOCKMAP) PROP_Flags2 (MF2_FLOORCLIP|MF2_NOTELEPORT|MF2_NODMGTHRUST) PROP_RenderStyle (STYLE_Add) @@ -1783,8 +1784,8 @@ void A_FireGrenade (AActor *self) return; // Make it flash - P_SetPsprite (player, ps_flash, weapon->FlashState + - (player->psprites[ps_weapon].state - weapon->GetAtkState())); + P_SetPsprite (player, ps_flash, weapon->FindState(NAME_Flash) + + (player->psprites[ps_weapon].state - weapon->GetAtkState(false))); self->z += 32*FRACUNIT; grenade = P_SpawnSubMissile (self, grenadetype, self); @@ -1804,7 +1805,7 @@ void A_FireGrenade (AActor *self) grenade->x += FixedMul (finecosine[an], tworadii); grenade->y += FixedMul (finesine[an], tworadii); - if (weapon->GetAtkState() == player->psprites[ps_weapon].state) + if (weapon->GetAtkState(false) == player->psprites[ps_weapon].state) { an = self->angle - ANGLE_90; } diff --git a/src/g_strife/a_templar.cpp b/src/g_strife/a_templar.cpp index 0f46f1586..98fb92119 100644 --- a/src/g_strife/a_templar.cpp +++ b/src/g_strife/a_templar.cpp @@ -137,6 +137,6 @@ void A_1fce8 (AActor *self) damage = (pr_templar() & 4) * 2; angle = self->angle + (pr_templar.Random2() << 19); pitchdiff = pr_templar.Random2() * 332063; - P_LineAttack (self, angle, MISSILERANGE+64*FRACUNIT, pitch+pitchdiff, damage, MOD_DISINTEGRATE, RUNTIME_CLASS(AMaulerPuff)); + P_LineAttack (self, angle, MISSILERANGE+64*FRACUNIT, pitch+pitchdiff, damage, NAME_Disintegrate, RUNTIME_CLASS(AMaulerPuff)); } } diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index ee53d16da..588b99c1b 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -244,7 +244,7 @@ void A_ExtraLightOff (AActor *self) void A_Explode512 (AActor *self) { - P_RadiusAttack (self, self->target, 512, 512, MOD_UNKNOWN, true); + P_RadiusAttack (self, self->target, 512, 512, NAME_None, true); if (self->target != NULL && self->target->player != NULL) { self->target->player->extralight = 5; diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 17d82f17a..2f4f469dc 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -71,7 +71,7 @@ EXTERN_CVAR (Color, am_wallcolor) EXTERN_CVAR (Color, am_fdwallcolor) EXTERN_CVAR (Color, am_cdwallcolor) -char *WeaponSection; +FString WeaponSection; FGameConfigFile::FGameConfigFile () { @@ -477,13 +477,13 @@ void FGameConfigFile::ArchiveGameData (const char *gamename) ClearCurrentSection (); C_ArchiveBindings (this, true); - if (WeaponSection == NULL) + if (WeaponSection.IsEmpty()) { strcpy (subsection, "WeaponSlots"); } else { - sprintf (subsection, "%s.WeaponSlots", WeaponSection); + sprintf (subsection, "%s.WeaponSlots", WeaponSection.GetChars()); } SetSection (section, true); ClearCurrentSection (); diff --git a/src/gameconfigfile.h b/src/gameconfigfile.h index 3492bf6cd..2173e009e 100644 --- a/src/gameconfigfile.h +++ b/src/gameconfigfile.h @@ -69,6 +69,6 @@ private: char *subsection; }; -extern char *WeaponSection; +extern FString WeaponSection; #endif //__GAMECONFIGFILE_H__ diff --git a/src/info.cpp b/src/info.cpp index 493d2befe..53d29a9d5 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -49,6 +49,7 @@ #include "r_state.h" #include "i_system.h" #include "p_local.h" +#include "templates.h" extern void LoadDecorations (void (*process)(FState *, int)); @@ -64,6 +65,11 @@ extern void LoadDecorations (void (*process)(FState *, int)); #define NULL_STATE_INDEX 127 +//========================================================================== +// +// +//========================================================================== + FArchive &operator<< (FArchive &arc, FState *&state) { const PClass *info; @@ -119,7 +125,12 @@ FArchive &operator<< (FArchive &arc, FState *&state) return arc; } +//========================================================================== +// // Find the actor that a state belongs to. +// +//========================================================================== + const PClass *FState::StaticFindStateOwner (const FState *state) { const FActorInfo *info = RUNTIME_CLASS(AActor)->ActorInfo; @@ -153,8 +164,13 @@ const PClass *FState::StaticFindStateOwner (const FState *state) return NULL; } +//========================================================================== +// // Find the actor that a state belongs to, but restrict the search to // the specified type and its ancestors. +// +//========================================================================== + const PClass *FState::StaticFindStateOwner (const FState *state, const FActorInfo *info) { while (info != NULL) @@ -169,6 +185,11 @@ const PClass *FState::StaticFindStateOwner (const FState *state, const FActorInf return NULL; } +//========================================================================== +// +// +//========================================================================== + int GetSpriteIndex(const char * spritename) { for (unsigned i = 0; i < sprites.Size (); ++i) @@ -187,7 +208,12 @@ int GetSpriteIndex(const char * spritename) } +//========================================================================== +// // Change sprite names to indices +// +//========================================================================== + static void ProcessStates (FState *states, int numstates) { int sprite = -1; @@ -205,6 +231,12 @@ static void ProcessStates (FState *states, int numstates) } } + +//========================================================================== +// +// +//========================================================================== + void FActorInfo::StaticInit () { TAutoSegIterator reg; @@ -247,7 +279,12 @@ void FActorInfo::StaticInit () LoadDecorations (ProcessStates); } +//========================================================================== +// // Called after the IWAD has been identified +// +//========================================================================== + void FActorInfo::StaticGameSet () { // Run every AT_GAME_SET function @@ -258,7 +295,12 @@ void FActorInfo::StaticGameSet () } } +//========================================================================== +// // Called after Dehacked patches are applied +// +//========================================================================== + void FActorInfo::StaticSetActorNums () { memset (SpawnableThings, 0, sizeof(SpawnableThings)); @@ -278,6 +320,11 @@ void FActorInfo::StaticSetActorNums () } } +//========================================================================== +// +// +//========================================================================== + void FActorInfo::RegisterIDs () { if (GameFilter == GAME_Any || (GameFilter & gameinfo.gametype)) @@ -293,8 +340,12 @@ void FActorInfo::RegisterIDs () } } +//========================================================================== +// // Called when a new game is started, but only if the game // speed has changed. +// +//========================================================================== void FActorInfo::StaticSpeedSet () { @@ -305,6 +356,11 @@ void FActorInfo::StaticSpeedSet () } } +//========================================================================== +// +// +//========================================================================== + FActorInfo *FActorInfo::GetReplacement () { if (Replacement == NULL) @@ -320,6 +376,11 @@ FActorInfo *FActorInfo::GetReplacement () return rep; } +//========================================================================== +// +// +//========================================================================== + FActorInfo *FActorInfo::GetReplacee () { if (Replacee == NULL) @@ -335,6 +396,267 @@ FActorInfo *FActorInfo::GetReplacee () return rep; } + +//========================================================================== +// +// +//========================================================================== + +FStateLabel *FStateLabels::FindLabel (FName label) +{ + return const_cast(BinarySearch (Labels, NumLabels, &FStateLabel::Label, label)); +} + +void FStateLabels::Destroy () +{ + for(int i=0; iDestroy(); + free (Labels[i].Children); // These are malloc'd, not new'd! + Labels[i].Children=NULL; + } + } +} + + +//=========================================================================== +// +// FindState (one name version) +// +// Finds a state with the exact specified name. +// +//=========================================================================== + +FState *AActor::FindState (FName label) const +{ + const FActorInfo *info = GetClass()->ActorInfo; + FStateLabel *slabel; + + while (info != NULL) + { + if (info->StateList != NULL) + { + slabel = info->StateList->FindLabel (label); + if (slabel != NULL && slabel->valid) + { + return slabel->State; + } + } + info = info->Class->ParentClass->ActorInfo; + } + return NULL; +} + +//=========================================================================== +// +// HasStates +// +// Checks whether the actor has substates for the given name. +// +//=========================================================================== + +bool AActor::HasStates (FName label) const +{ + const FActorInfo *info = GetClass()->ActorInfo; + FStateLabel *slabel; + + while (info != NULL) + { + if (info->StateList != NULL) + { + slabel = info->StateList->FindLabel (label); + if (slabel != NULL) + { + return true; + } + } + info = info->Class->ParentClass->ActorInfo; + } + return false; +} + +//=========================================================================== +// +// FindState (multiple names version) +// +// Finds a state that matches as many of the supplied names as possible. +// A state with more names than those provided does not match. +// A state with fewer names can match if there are no states with the exact +// same number of names. +// +// The search proceeds like this. For the current class, keeping matching +// names until there are no more. If both the argument list and the state +// are out of names, it's an exact match, so return it. If the state still +// has names, ignore it. If the argument list still has names, remember it. +// Repeat with each successive ancestor class. The state with the longest +// match not exceeding the supplied number of names is returned. +// +//=========================================================================== + +FState *AActor::FindState (int numnames, int first, ...) const // The 'first' parameter is only here to + // disambiguate from the single parameter version +{ + va_list arglist; + va_start (arglist, numnames); + return FindState (numnames, arglist); +} + +FState *FActorInfo::FindState (int numnames, ...) const +{ + va_list arglist; + va_start (arglist, numnames); + return FindState (numnames, arglist); +} + +FState *AActor::FindState (int numnames, va_list arglist) const +{ + return GetClass()->ActorInfo->FindState (numnames, arglist); +} + +FState *FActorInfo::FindState (int numnames, va_list arglist) const +{ + const FActorInfo *info = this; + FState *best = NULL; + int bestcount = 0; + + // Search this actor's class, plus all its ancestors for a match. + while (info != NULL && bestcount < numnames) + { + FStateLabels *labels = info->StateList; + + if (labels != NULL) + { + va_list names = arglist; + int count = 0; + FStateLabel *slabel = NULL; + FName label; + + // Find the best-matching label for this class. + while (labels != NULL && count < numnames) + { + label = ENamedName(va_arg (names, int)); + slabel = labels->FindLabel (label); + + if (slabel != NULL) + { + count++; + labels = slabel->Children; + + // Labels that are more specific than what we want do not match. + // Less specific labels do match. + if (slabel->valid && count > bestcount) + { + if (count == numnames) + { + return slabel->State; + } + bestcount = count; + best = slabel->State; + } + } + else + { + break; + } + } + } + // Walk up the class hierarchy and repeat. + info = info->Class->ParentClass->ActorInfo; + } + return best; +} + +//=========================================================================== +// +// FindStateExact +// +// This is like FindState, except it will only return states whose labels +// match the requested one exactly. +// +//=========================================================================== + +FState *FActorInfo::FindStateExact (int numnames, ...) const +{ + va_list arglist; + va_start (arglist, numnames); + return FindStateExact (numnames, arglist); +} + +FState *FActorInfo::FindStateExact (int numnames, va_list arglist) const +{ + const FActorInfo *info = this; + + // Search this actor's class, plus all its ancestors for a match. + while (info != NULL) + { + FStateLabels *labels = info->StateList; + + if (labels != NULL) + { + va_list names = arglist; + int count = 0; + FStateLabel *slabel = NULL; + FName label; + + // Look for a matching label for this class. + while (labels != NULL && count < numnames) + { + label = ENamedName(va_arg (names, int)); + slabel = labels->FindLabel (label); + + if (slabel != NULL) + { + count++; + labels = slabel->Children; + } + else + { + break; + } + } + // Only exact matches count. + if (slabel != NULL && slabel->valid && count == numnames) + { + return slabel->State; + } + } + // Walk up the class hierarchy and repeat. + info = info->Class->ParentClass->ActorInfo; + } + return NULL; +} + +//=========================================================================== +// +// Changes a single state +// +// If the given state does not exist it won't be changed +// +//=========================================================================== + +void FActorInfo::ChangeState (FName label, FState * newstate) const +{ + FStateLabel *slabel; + + if (StateList != NULL) + { + slabel = StateList->FindLabel (label); + if (slabel != NULL) + { + slabel->State = newstate; + } + } +} + + + +//========================================================================== +// +// +//========================================================================== + FDoomEdMap DoomEdMap; FDoomEdMap::FDoomEdEntry *FDoomEdMap::DoomEdHash[DOOMED_HASHSIZE]; diff --git a/src/info.h b/src/info.h index 4a5b2b0eb..bc2373ce6 100644 --- a/src/info.h +++ b/src/info.h @@ -82,8 +82,6 @@ const BYTE SF_FULLBRIGHT = 0x40; const BYTE SF_BIGTIC = 0x80; // All state parameters are stored in this array now. -// The first 2 parameters for each function call represent -// the old misc1/misc2 values, even for non-weapons extern TArray StateParameters; @@ -155,6 +153,26 @@ struct FState static const PClass *StaticFindStateOwner (const FState *state, const FActorInfo *info); }; +struct FStateLabels; +struct FStateLabel +{ + FName Label; + bool valid; // needed to recognize genuine NULL states + FState *State; + FStateLabels *Children; +}; + +struct FStateLabels +{ + int NumLabels; + FStateLabel Labels[1]; + + FStateLabel *FindLabel (FName label); + + void Destroy(); // intentionally not a destructor! +}; + + FArchive &operator<< (FArchive &arc, FState *&state); @@ -291,9 +309,6 @@ enum ADEF_EDeathState, ADEF_RaiseState, ADEF_WoundState, - ADEF_YesState, - ADEF_NoState, - ADEF_GreetingsState, ADEF_StrifeType, // Not really a property. Used to init StrifeTypes[] in p_conversation.h. ADEF_StrifeTeaserType, @@ -338,8 +353,6 @@ enum ADEF_Weapon_ReadyState, ADEF_Weapon_AtkState, ADEF_Weapon_HoldAtkState, - ADEF_Weapon_AltAtkState, - ADEF_Weapon_AltHoldAtkState, ADEF_Weapon_FlashState, ADEF_Sigil_NumPieces, @@ -375,6 +388,14 @@ struct FActorInfo void BuildDefaults (); void ApplyDefaults (BYTE *defaults); void RegisterIDs (); + + FState *FindState (int numnames, ...) const; + FState *FindState (int numnames, va_list arglist) const; + void ChangeState (FName label, FState * newstate) const; + + FState *FindStateExact (int numnames, ...) const; + FState *FindStateExact (int numnames, va_list arglist) const; + FActorInfo *GetReplacement (); FActorInfo *GetReplacee (); @@ -386,6 +407,7 @@ struct FActorInfo BYTE GameFilter; BYTE SpawnID; SWORD DoomEdNum; + FStateLabels * StateList; #if _MSC_VER // A 0-terminated list of default properties diff --git a/src/infodefaults.cpp b/src/infodefaults.cpp index 77d0e3671..c70116f87 100644 --- a/src/infodefaults.cpp +++ b/src/infodefaults.cpp @@ -98,6 +98,7 @@ static FState *DefaultStates (PClass *type) static PClass *sgClass; static BYTE *sgDefaults; + static void ApplyActorDefault (int defnum, const char *datastr, int dataint) { int datasound = 0; @@ -203,7 +204,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint) case ADEF_Height: actor->height = dataint; break; case ADEF_Mass: actor->Mass = dataint; break; case ADEF_Damage: actor->Damage = dataint; break; - case ADEF_DamageType: actor->DamageType = dataint; break; + case ADEF_DamageType: actor->DamageType = (ENamedName)dataint; break; case ADEF_Flags: actor->flags = dataint; break; case ADEF_Flags2: actor->flags2 = dataint; break; case ADEF_Flags3: actor->flags3 = dataint; break; @@ -232,22 +233,19 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint) case ADEF_RDFactor: sgClass->Meta.SetMetaFixed (AMETA_RDFactor, dataint); break; case ADEF_FXFlags: actor->effects = dataint; break; - case ADEF_SpawnState: actor->SpawnState = datastate; break; - case ADEF_SeeState: actor->SeeState = datastate; break; - case ADEF_PainState: actor->PainState = datastate; break; - case ADEF_MeleeState: actor->MeleeState = datastate; break; - case ADEF_MissileState: actor->MissileState = datastate; break; - case ADEF_CrashState: actor->CrashState = datastate; break; - case ADEF_DeathState: actor->DeathState = datastate; break; - case ADEF_XDeathState: actor->XDeathState = datastate; break; - case ADEF_BDeathState: actor->BDeathState = datastate; break; - case ADEF_IDeathState: actor->IDeathState = datastate; break; - case ADEF_EDeathState: actor->EDeathState = datastate; break; - case ADEF_RaiseState: actor->RaiseState = datastate; break; - case ADEF_WoundState: actor->WoundState = datastate; break; - case ADEF_YesState: actor->YesState = datastate; break; - case ADEF_NoState: actor->NoState = datastate; break; - case ADEF_GreetingsState: actor->GreetingsState = datastate; break; + case ADEF_SpawnState: AddState("Spawn", datastate); break; + case ADEF_SeeState: AddState("See", datastate); break; + case ADEF_PainState: AddState("Pain", datastate); break; + case ADEF_MeleeState: AddState("Melee", datastate); break; + case ADEF_MissileState: AddState("Missile", datastate); break; + case ADEF_CrashState: AddState("Crash", datastate); break; + case ADEF_DeathState: AddState("Death", datastate); break; + case ADEF_XDeathState: AddState("XDeath", datastate); break; + case ADEF_BDeathState: AddState("Burn", datastate); break; + case ADEF_IDeathState: AddState("Ice", datastate); break; + case ADEF_EDeathState: AddState("Disintegrate", datastate);break; + case ADEF_RaiseState: AddState("Raise", datastate); break; + case ADEF_WoundState: AddState("Wound", datastate); break; case ADEF_StrifeType: if (!(gameinfo.flags & GI_SHAREWARE)) StrifeTypes[dataint] = sgClass; break; case ADEF_StrifeTeaserType: @@ -306,14 +304,13 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint) case ADEF_Weapon_YAdjust: weapon->YAdjust = (dataint<<8)>>8; break; case ADEF_Weapon_SelectionOrder:weapon->SelectionOrder = dataint; break; case ADEF_Weapon_MoveCombatDist:weapon->MoveCombatDist = dataint; break; - case ADEF_Weapon_UpState: weapon->UpState = datastate; break; - case ADEF_Weapon_DownState: weapon->DownState = datastate; break; - case ADEF_Weapon_ReadyState: weapon->ReadyState = datastate; break; - case ADEF_Weapon_AtkState: weapon->AtkState = datastate; break; - case ADEF_Weapon_HoldAtkState: weapon->HoldAtkState = datastate; break; - case ADEF_Weapon_AltAtkState: weapon->AltAtkState = datastate; break; - case ADEF_Weapon_AltHoldAtkState:weapon->AltHoldAtkState = datastate; break; - case ADEF_Weapon_FlashState: weapon->FlashState = datastate; break; + + case ADEF_Weapon_UpState: AddState("Select", datastate); break; + case ADEF_Weapon_DownState: AddState("Deselect", datastate); break; + case ADEF_Weapon_ReadyState: AddState("Ready", datastate); break; + case ADEF_Weapon_AtkState: AddState("Fire", datastate); break; + case ADEF_Weapon_HoldAtkState: AddState("Hold", datastate); break; + case ADEF_Weapon_FlashState: AddState("Flash", datastate); break; case ADEF_Sigil_NumPieces: sigil->NumPieces = dataint; break; // [GRB] Player class properties @@ -360,6 +357,7 @@ void FActorInfo::ApplyDefaults (BYTE *defaults) sgClass = Class; sgDefaults = defaults; + ClearStateLabels(); #if _MSC_VER const BYTE *parser = DefaultList; @@ -410,6 +408,7 @@ void FActorInfo::ApplyDefaults (BYTE *defaults) #else DefaultsConstructor (); #endif + InstallStates(this, ((AActor *)defaults)); // Anything that is CountKill is also a monster, even if it doesn't specify it. if (((AActor *)defaults)->flags & MF_COUNTKILL) { diff --git a/src/infomacros.h b/src/infomacros.h index 9c40e5f2a..29a52af7b 100644 --- a/src/infomacros.h +++ b/src/infomacros.h @@ -78,7 +78,7 @@ typedef void (*voidfunc_)(); FActorInfo actor##ActorInfo = { #define BEGIN_DEFAULTS_POST(actor,game,ednum,id) \ - GAME_##game, id, ednum, + GAME_##game, id, ednum, NULL, #ifdef WORDS_BIGENDIAN #define END_DEFAULTS "\xED\x5E" }; @@ -280,9 +280,6 @@ public: #define PROP_EDeathState(x) ADD_BYTE_PROP(ADEF_EDeathState,x) #define PROP_RaiseState(x) ADD_BYTE_PROP(ADEF_RaiseState,x) #define PROP_WoundState(x) ADD_BYTE_PROP(ADEF_WoundState,x) -#define PROP_YesState(x) ADD_BYTE_PROP(ADEF_YesState,x) -#define PROP_NoState(x) ADD_BYTE_PROP(ADEF_NoState,x) -#define PROP_GreetingsState(x) ADD_BYTE_PROP(ADEF_GreetingsState,x) #define PROP_StrifeType(x) ADD_WORD_PROP(ADEF_StrifeType,x) #define PROP_StrifeTeaserType(x) ADD_WORD_PROP(ADEF_StrifeTeaserType,x) @@ -329,8 +326,6 @@ public: #define PROP_Weapon_ReadyState(x) ADD_BYTE_PROP(ADEF_Weapon_ReadyState,x) #define PROP_Weapon_AtkState(x) ADD_BYTE_PROP(ADEF_Weapon_AtkState,x) #define PROP_Weapon_HoldAtkState(x) ADD_BYTE_PROP(ADEF_Weapon_HoldAtkState,x) -#define PROP_Weapon_AltAtkState(x) ADD_BYTE_PROP(ADEF_Weapon_AltAtkState,x) -#define PROP_Weapon_AltHoldAtkState(x) ADD_BYTE_PROP(ADEF_Weapon_AltHoldAtkState,x) #define PROP_Weapon_FlashState(x) ADD_BYTE_PROP(ADEF_Weapon_FlashState,x) #define PROP_Sigil_NumPieces(x) ADD_BYTE_PROP(ADEF_Sigil_NumPieces,x) diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index f5ffc2aba..db93ed56e 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -274,11 +274,11 @@ void cht_DoCheat (player_t *player, int cheat) player->mo->height = player->mo->GetDefault()->height; player->mo->SetState (player->mo->SpawnState); player->mo->Translation = TRANSLATION(TRANSLATION_Players, BYTE(player-players)); - player->mo->DamageType = MOD_UNKNOWN; + player->mo->DamageType = NAME_None; // player->mo->GiveDefaultInventory(); if (player->ReadyWeapon != NULL) { - P_SetPsprite(player, ps_weapon, player->ReadyWeapon->UpState); + P_SetPsprite(player, ps_weapon, player->ReadyWeapon->GetUpState()); } if (player->morphTics > 0) @@ -342,7 +342,7 @@ void cht_DoCheat (player_t *player, int cheat) // a very very cheap kill. P_LineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE, P_AimLineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE), 1000000, - MOD_UNKNOWN, RUNTIME_CLASS(ABulletPuff)); + NAME_None, RUNTIME_CLASS(ABulletPuff)); } break; @@ -701,7 +701,7 @@ void cht_Suicide (player_t *plyr) { plyr->mo->flags |= MF_SHOOTABLE; plyr->mo->flags2 &= ~MF2_INVULNERABLE; - P_DamageMobj (plyr->mo, plyr->mo, plyr->mo, 1000000, MOD_SUICIDE); + P_DamageMobj (plyr->mo, plyr->mo, plyr->mo, 1000000, NAME_Suicide); plyr->mo->flags &= ~MF_SHOOTABLE; } } diff --git a/src/namedef.h b/src/namedef.h index cfde2d6e7..4b300c6a3 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -103,15 +103,55 @@ xx(Mauler) xx(Chicken) xx(Pig) +// Standard animator names. +xx(Spawn) +xx(See) +xx(Pain) +xx(Melee) +xx(Missile) +xx(Crash) +xx(Death) +xx(Raise) +xx(Wound) +xx(Heal) +xx(Crush) +xx(Yes) +xx(No) +xx(Greetings) + +// Compatible death names for the decorate parser. +xx(XDeath) +xx(Burn) +//xx(Ice) // already defined above +xx(Disintegrate) + +// Weapon animator names. +xx(Select) +xx(Deselect) +xx(Ready) +xx(Fire) +xx(Hold) +xx(AltFire) +xx(AltHold) +xx(Flash) +xx(AltFlash) + +// State names used by ASwitchableDecoration +xx(Active) +xx(Inactive) + +// State names used by ACustomInventory +xx(Pickup) +xx(Use) +xx(Drop) // Damage types -xx(Fire) -//xx(Ice) already defined above -xx(Disintegrate) -#if 0 -xx(Water) +//xx(Fire) already defined above +//xx(Ice) +//xx(Disintegrate) +//xx(Water) xx(Slime) -xx(Crush) +//xx(Crush) xx(Telefrag) xx(Falling) xx(Suicide) @@ -124,39 +164,8 @@ xx(DrainLife) // A weapon like the Sigil that drains your life away. xx(Massacre) // For death by a cheater! //(Melee) already defined above, so don't define it again - -// Standard animator names. -xx(Spawn) -xx(See) -xx(Pain) -xx(Melee) -xx(Missile) -xx(Crash) -xx(Death) -xx(Raise) -xx(Wound) - -// Weapon animator names. -xx(Up) -xx(Down) -xx(Ready) -xx(Flash) -xx(Attack) -xx(HoldAttack) -xx(AltAttack) -xx(AltHoldAttack) - // Special death name for getting killed excessively. Could be used as // a damage type if you wanted to force an extreme death. xx(Extreme) -// Compatible death names for the decorate parser. -xx(XDeath) -xx(BDeath) -xx(IDeath) -xx(EDeath) -// State names used by ASwitchableDecoration -xx(Active) -xx(Inactive) -#endif diff --git a/src/p_acs.cpp b/src/p_acs.cpp index c4ecf98af..12d1c6e0b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4995,17 +4995,6 @@ int DLevelScript::RunScript () int flags = STACK(1); sp -= 5; - // Oh, give me custom damage types! :-) - int modtype; - - switch (type) - { - case NAME_Fire: modtype = MOD_FIRE; break; - case NAME_Ice: modtype = MOD_ICE; break; - case NAME_Disintegrate: modtype = MOD_DISINTEGRATE; break; - default: modtype = MOD_UNKNOWN; break; - } - int secnum = -1; while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0) @@ -5050,7 +5039,7 @@ int DLevelScript::RunScript () } } - P_DamageMobj (actor, NULL, NULL, amount, modtype); + P_DamageMobj (actor, NULL, NULL, amount, type); } } } diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 26da19e81..c4133202c 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2317,7 +2317,7 @@ void A_Pain (AActor *actor) // killough 11/98: kill an object void A_Die (AActor *actor) { - P_DamageMobj (actor, NULL, NULL, actor->health, MOD_UNKNOWN); + P_DamageMobj (actor, NULL, NULL, actor->health, NAME_None); } // diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 25093f109..00c151448 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -69,6 +69,10 @@ CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE) CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE) EXTERN_CVAR (Bool, show_obituaries) + +FName MeansOfDeath; +bool FriendlyFire; + // // GET STUFF // @@ -172,11 +176,11 @@ void SexMessage (const char *from, char *to, int gender, const char *victim, con // void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) { - int mod; + FName mod; const char *message; const char *messagename; char gendermessage[1024]; - INTBOOL friendly; + bool friendly; int gender; // No obituaries for non-players, voodoo dolls or when not wanted @@ -187,19 +191,19 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) // Treat voodoo dolls as unknown deaths if (inflictor && inflictor->player == self->player) - MeansOfDeath = MOD_UNKNOWN; + MeansOfDeath = NAME_None; if (multiplayer && !deathmatch) - MeansOfDeath |= MOD_FRIENDLY_FIRE; + FriendlyFire = true; - friendly = MeansOfDeath & MOD_FRIENDLY_FIRE; - mod = MeansOfDeath & ~MOD_FRIENDLY_FIRE; + friendly = FriendlyFire; + mod = MeansOfDeath; message = NULL; messagename = NULL; if (attacker == NULL || attacker->player != NULL) { - if (mod == MOD_TELEFRAG) + if (mod == NAME_Telefrag) { if (AnnounceTelefrag (attacker, self)) return; @@ -213,15 +217,13 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) switch (mod) { - case MOD_SUICIDE: messagename = "OB_SUICIDE"; break; - case MOD_FALLING: messagename = "OB_FALLING"; break; - case MOD_CRUSH: messagename = "OB_CRUSH"; break; - case MOD_EXIT: messagename = "OB_EXIT"; break; - case MOD_WATER: messagename = "OB_WATER"; break; - case MOD_SLIME: messagename = "OB_SLIME"; break; - case MOD_FIRE: messagename = "OB_LAVA"; break; - case MOD_BARREL: messagename = "OB_BARREL"; break; - case MOD_SPLASH: messagename = "OB_SPLASH"; break; + case NAME_Suicide: messagename = "OB_SUICIDE"; break; + case NAME_Falling: messagename = "OB_FALLING"; break; + case NAME_Crush: messagename = "OB_CRUSH"; break; + case NAME_Exit: messagename = "OB_EXIT"; break; + case NAME_Water: messagename = "OB_WATER"; break; + case NAME_Slime: messagename = "OB_SLIME"; break; + case NAME_Fire: if (attacker == NULL) messagename = "OB_LAVA"; break; } if (messagename != NULL) @@ -231,21 +233,15 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) { if (attacker == self) { - switch (mod) - { - case MOD_R_SPLASH: messagename = "OB_R_SPLASH"; break; - case MOD_ROCKET: messagename = "OB_ROCKET"; break; - default: messagename = "OB_KILLEDSELF"; break; - } - message = GStrings(messagename); + message = GStrings("OB_KILLEDSELF"); } else if (attacker->player == NULL) { - if (mod == MOD_TELEFRAG) + if (mod == NAME_Telefrag) { message = GStrings("OB_MONTELEFRAG"); } - else if (mod == MOD_HIT) + else if (mod == NAME_Melee) { message = attacker->GetClass()->Meta.GetMetaString (AMETA_HitObituary); if (message == NULL) @@ -273,7 +269,7 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) } else { - if (mod == MOD_TELEFRAG) message = GStrings("OB_MPTELEFRAG"); + if (mod == NAME_Telefrag) message = GStrings("OB_MPTELEFRAG"); if (message == NULL) { if (inflictor != NULL) @@ -288,9 +284,8 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) { switch (mod) { - case MOD_R_SPLASH: messagename = "OB_MPR_SPLASH"; break; - case MOD_BFG_SPLASH: messagename = "OB_MPBFG_SPLASH"; break; - case MOD_RAILGUN: messagename = "OB_RAILGUN"; break; + case NAME_BFGSplash: messagename = "OB_MPBFG_SPLASH"; break; + case NAME_Railgun: messagename = "OB_RAILGUN"; break; } if (messagename != NULL) message = GStrings(messagename); @@ -360,7 +355,7 @@ void AActor::Die (AActor *source, AActor *inflictor) flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); if (!(flags4 & MF4_DONTFALL)) flags&=~MF_NOGRAVITY; flags |= MF_DROPOFF; - if ((flags3 & MF3_ISMONSTER) || RaiseState != NULL) + if ((flags3 & MF3_ISMONSTER) || FindState(NAME_Raise) != NULL) { // [RH] Only monsters get to be corpses. // Objects with a raise state should get the flag as well so they can // be revived by an Arch-Vile. Batman Doom needs this. @@ -368,7 +363,7 @@ void AActor::Die (AActor *source, AActor *inflictor) } // [RH] Allow the death height to be overridden using metadata. fixed_t metaheight = 0; - if (DamageType == MOD_FIRE) + if (DamageType == NAME_Fire) { metaheight = GetClass()->Meta.GetMetaFixed (AMETA_BurnHeight); } @@ -612,29 +607,26 @@ void AActor::Die (AActor *source, AActor *inflictor) return; } - if (DamageType == MOD_DISINTEGRATE && EDeathState) - { // Electrocution death - SetState (EDeathState); - } - else if (DamageType == MOD_FIRE && BDeathState) - { // Burn death - SetState (BDeathState); - } - else if (DamageType == MOD_ICE && - (IDeathState || ( - (!deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH)) && - (player || (flags3 & MF3_ISMONSTER))))) - { // Ice death - if (IDeathState) + + + FState *diestate=NULL; + + if (DamageType != NAME_None) + { + diestate = GetClass()->ActorInfo->FindStateExact (2, NAME_Death, int(DamageType)); + if (diestate == NULL) { - SetState (IDeathState); - } - else - { - SetState (&AActor::States[S_GENERICFREEZEDEATH]); + if (DamageType == NAME_Ice) + { // If an actor doesn't have an ice death, we can still give them a generic one. + + if (!deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH) && (player || (flags3 & MF3_ISMONSTER))) + { + diestate = &AActor::States[S_GENERICFREEZEDEATH]; + } + } } } - else + if (diestate == NULL) { int flags4 = !inflictor ? 0 : inflictor->player && inflictor->player->ReadyWeapon ? inflictor->player->ReadyWeapon->flags4 : inflictor->flags4; @@ -642,40 +634,30 @@ void AActor::Die (AActor *source, AActor *inflictor) int gibhealth = -abs(GetClass()->Meta.GetMetaInt (AMETA_GibHealth, gameinfo.gametype == GAME_Doom ? -GetDefault()->health : -GetDefault()->health/2)); - DamageType = MOD_UNKNOWN; // [RH] "Frozen" barrels shouldn't do freezing damage - if (XDeathState && (healthhealth <= 0) { - if (inflictor && mod == MOD_ICE) + if (inflictor && mod == NAME_Ice) { return; } @@ -858,6 +839,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage } MeansOfDeath = mod; + FriendlyFire = false; // [RH] Andy Baker's Stealth monsters if (target->flags & MF_STEALTH) { @@ -898,7 +880,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage return; } } - if (mod == MOD_FIRE && target->flags4 & MF4_FIRERESIST) + if (mod == NAME_Fire && target->flags4 & MF4_FIRERESIST) { damage /= 2; } @@ -1000,7 +982,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage // [RH] Avoid friendly fire if enabled if (source != NULL && player != source->player && target->IsTeammate (source)) { - MeansOfDeath |= MOD_FRIENDLY_FIRE; + FriendlyFire = true; if (damage < 1000000) { // Still allow telefragging :-( damage = (int)((float)damage * teamdamage); @@ -1066,7 +1048,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage target->target = source; } // check for special fire damage or ice damage deaths - if (mod == MOD_FIRE) + if (mod == NAME_Fire) { if (player && !player->morphTics) { // Check for flame death @@ -1074,12 +1056,12 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage ((target->health > -50) && (damage > 25)) || !inflictor->IsKindOf (RUNTIME_CLASS(APhoenixFX1))) { - target->DamageType = MOD_FIRE; + target->DamageType = NAME_Fire; } } else { - target->DamageType = MOD_FIRE; + target->DamageType = NAME_Fire; } } else @@ -1103,28 +1085,27 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage target->Die (source, inflictor); return; } - if (target->WoundState != NULL) + + FState * woundstate = target->FindState(2,NAME_Wound, (int)mod); + if (woundstate != NULL) { int woundhealth = RUNTIME_TYPE(target)->Meta.GetMetaInt (AMETA_WoundHealth, 6); if (target->health <= woundhealth) { - target->SetState (target->WoundState); + target->SetState (woundstate); return; } } - if ((pr_damagemobj() < target->PainChance) && target->PainState != NULL - && !(target->flags & MF_SKULLFLY)) + if ((pr_damagemobj() < target->PainChance) && !(target->flags & MF_SKULLFLY)) { if (inflictor && inflictor->IsKindOf (RUNTIME_CLASS(ALightning))) { if (pr_lightning() < 96) { target->flags |= MF_JUSTHIT; // fight back! - if (target->PainState != NULL) - { - target->SetState (target->PainState); - } + FState * painstate = target->FindState(2,NAME_Pain, (int)mod); + if (painstate != NULL) target->SetState (painstate); } else { // "electrocute" the target @@ -1138,7 +1119,8 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage else { target->flags |= MF_JUSTHIT; // fight back! - target->SetState (target->PainState); + FState * painstate = target->FindState(2,NAME_Pain, (int)mod); + if (painstate != NULL) target->SetState (painstate); if (inflictor && inflictor->IsKindOf (RUNTIME_CLASS(APoisonCloud))) { if ((target->flags3 & MF3_ISMONSTER) && pr_poison() < 128) @@ -1317,22 +1299,20 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, target->special1 = damage; if (player && inflictor && !player->morphTics) { // Check for flame death - if ((inflictor->DamageType == MOD_FIRE) + if ((inflictor->DamageType == NAME_Fire) && (target->health > -50) && (damage > 25)) { - target->DamageType = MOD_FIRE; - } - if (inflictor->DamageType == MOD_ICE) - { - target->DamageType = MOD_ICE; + target->DamageType = NAME_Fire; } + else target->DamageType = inflictor->DamageType; } target->Die (source, source); return; } - if (!(level.time&63) && playPainSound && target->PainState != NULL) + if (!(level.time&63) && playPainSound) { - target->SetState (target->PainState); + FState * painstate = target->FindState(2,NAME_Pain, (int)target->DamageType); + if (painstate != NULL) target->SetState (painstate); } /* if((P_Random() < target->info->painchance) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 886285a73..15e69cb6f 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -63,6 +63,29 @@ static FRandom pr_glass ("GlassBreak"); +FName MODtoDamageType (int mod) +{ + switch (mod) + { + default: return NAME_None; break; + case 9: return NAME_BFGSplash; break; + case 12: return NAME_Water; break; + case 13: return NAME_Slime; break; + case 14: return NAME_Fire; break; + case 15: return NAME_Crush; break; + case 16: return NAME_Telefrag; break; + case 17: return NAME_Falling; break; + case 18: return NAME_Suicide; break; + case 20: return NAME_Exit; break; + case 22: return NAME_Melee; break; + case 23: return NAME_Railgun; break; + case 24: return NAME_Ice; break; + case 25: return NAME_Disintegrate; break; + case 26: return NAME_Poison; break; + case 27: return NAME_Electric; break; + case 1000: return NAME_Massacre; break; + } +} FUNC(LS_NOP) { @@ -734,7 +757,7 @@ FUNC(LS_Teleport_NewMap) FUNC(LS_Teleport) // Teleport (tid, sectortag, bNoSourceFog) -{ + { return EV_Teleport (arg0, arg1, ln, backSide, it, true, !arg2, false); } @@ -751,7 +774,7 @@ FUNC(LS_Teleport_ZombieChanger) if (it != NULL) { EV_Teleport (arg0, arg1, ln, backSide, it, false, false, false); - it->SetState (it->PainState); + it->SetState (it->FindState(NAME_Pain)); return true; } return false; @@ -935,11 +958,11 @@ FUNC(LS_DamageThing) } else if (arg0 > 0) { - P_DamageMobj (it, NULL, NULL, arg0, arg1); + P_DamageMobj (it, NULL, NULL, arg0, MODtoDamageType (arg1)); } else { // If zero damage, guarantee a kill - P_DamageMobj (it, NULL, NULL, 1000000, arg1); + P_DamageMobj (it, NULL, NULL, 1000000, MODtoDamageType (arg1)); } } @@ -1094,7 +1117,7 @@ FUNC(LS_Thing_Destroy) { AActor *temp = iterator.Next (); if (actor->flags & MF_SHOOTABLE) - P_DamageMobj (actor, NULL, it, arg1 ? 1000000 : actor->health, MOD_UNKNOWN); + P_DamageMobj (actor, NULL, it, arg1 ? 1000000 : actor->health, NAME_None); actor = temp; } } @@ -1115,7 +1138,7 @@ FUNC(LS_Thing_Damage) { if (arg1 > 0) { - P_DamageMobj (actor, NULL, it, arg1, arg2); + P_DamageMobj (actor, NULL, it, arg1, MODtoDamageType (arg2)); } else if (actor->health < actor->GetDefault()->health) { @@ -1354,7 +1377,8 @@ static bool DoThingRaise(AActor *thing) if (thing->tics != -1) return true; // not lying still yet - if (thing->RaiseState == NULL) + FState * RaiseState = thing->FindState(NAME_Raise); + if (RaiseState == NULL) return true; // monster doesn't have a raise state AActor *info = thing->GetDefault (); @@ -1379,7 +1403,7 @@ static bool DoThingRaise(AActor *thing) S_Sound (thing, CHAN_BODY, "vile/raise", 1, ATTN_IDLE); - thing->SetState (info->RaiseState); + thing->SetState (RaiseState); thing->flags = info->flags; thing->flags2 = info->flags2; thing->flags3 = info->flags3; @@ -1974,6 +1998,11 @@ FUNC(LS_PointPush_SetForce) FUNC(LS_Sector_SetDamage) // Sector_SetDamage (tag, amount, mod) { + // The sector still stores the mod in its old format because + // adding an FName to the sector_t structure might cause + // problems by adding an unwanted constructor. + // Since it doesn't really matter whether the type is translated + // here or in P_PlayerInSpecialSector I think it's the best solution. int secnum = -1; while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) { sectors[secnum].damage = arg1; @@ -2561,7 +2590,7 @@ FUNC(LS_ForceField) { if (it != NULL) { - P_DamageMobj (it, NULL, NULL, 16, MOD_UNKNOWN); + P_DamageMobj (it, NULL, NULL, 16, NAME_None); P_ThrustMobj (it, it->angle + ANGLE_180, 0x7D000); } return true; diff --git a/src/p_lnspec.h b/src/p_lnspec.h index 82f0bc652..4d48f25d7 100644 --- a/src/p_lnspec.h +++ b/src/p_lnspec.h @@ -427,6 +427,8 @@ typedef enum { struct line_s; class AActor; +FName MODtoDamageType (int mod); + typedef int (*lnSpecFunc)(struct line_s *line, class AActor *activator, bool backSide, diff --git a/src/p_local.h b/src/p_local.h index 13fb681dc..ec0363526 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -299,7 +299,7 @@ extern AActor* linetarget; // who got hit (or NULL) extern AActor *PuffSpawned; // points to last puff spawned fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, fixed_t vrange=0); -void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, int damageType, const PClass *pufftype); +void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype); void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version @@ -315,7 +315,7 @@ extern fixed_t CameraX, CameraY, CameraZ; extern sector_t *CameraSector; // [RH] Means of death -void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, int damageType, bool hurtSelf, bool dodamage=true); +void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, FName damageType, bool hurtSelf, bool dodamage=true); void P_DelSector_List(); void P_DelSeclist(msecnode_t *); // phares 3/16/98 @@ -346,7 +346,7 @@ extern FBlockNode** blocklinks; // for thing chains // void P_TouchSpecialThing (AActor *special, AActor *toucher); -void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int mod, int flags=0); +void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags=0); bool P_GiveBody (AActor *actor, int num); bool P_MorphPlayer (player_t *player, const PClass *morphClass); @@ -355,8 +355,6 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, bool playPain #define DMG_NO_ARMOR 1 -extern int MeansOfDeath; - // ===== PO_MAN ===== diff --git a/src/p_map.cpp b/src/p_map.cpp index 45d3091c2..6b6b13a15 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -295,7 +295,7 @@ bool PIT_StompThing (AActor *thing) // [RH] Some Heretic/Hexen monsters can telestomp if (StompAlwaysFrags || (tmthing->flags2 & MF2_TELESTOMP)) { - P_DamageMobj (thing, tmthing, tmthing, 1000000, MOD_TELEFRAG); + P_DamageMobj (thing, tmthing, tmthing, 1000000, NAME_Telefrag); return true; } return false; @@ -453,7 +453,7 @@ bool PIT_StompThing2 (AActor *thing) if (tmthing->z + tmthing->height < thing->z) return true; // underneath - P_DamageMobj (thing, tmthing, tmthing, 1000000, MOD_TELEFRAG); + P_DamageMobj (thing, tmthing, tmthing, 1000000, NAME_Telefrag); return true; } @@ -662,7 +662,7 @@ bool PIT_CheckLine (line_t *ld) { // One sided line if (tmthing->flags2 & MF2_BLASTED) { - P_DamageMobj (tmthing, NULL, NULL, tmthing->Mass >> 5, MOD_HIT); + P_DamageMobj (tmthing, NULL, NULL, tmthing->Mass >> 5, NAME_Melee); } BlockingLine = ld; CheckForPushSpecial (ld, 0, tmthing); @@ -681,7 +681,7 @@ bool PIT_CheckLine (line_t *ld) { if (tmthing->flags2 & MF2_BLASTED) { - P_DamageMobj (tmthing, NULL, NULL, tmthing->Mass >> 5, MOD_HIT); + P_DamageMobj (tmthing, NULL, NULL, tmthing->Mass >> 5, NAME_Melee); } BlockingLine = ld; CheckForPushSpecial (ld, 0, tmthing); @@ -1867,7 +1867,7 @@ pushline: if (tmthing->flags2 & MF2_BLASTED) { - P_DamageMobj (tmthing, NULL, NULL, tmthing->Mass >> 5, MOD_HIT); + P_DamageMobj (tmthing, NULL, NULL, tmthing->Mass >> 5, NAME_Melee); } numSpecHitTemp = (int)spechit.Size (); while (numSpecHitTemp > 0) @@ -2683,7 +2683,7 @@ static bool CheckForSpectral (FTraceResults &res) } void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, - int pitch, int damage, int damageType, const PClass *pufftype) + int pitch, int damage, FName damageType, const PClass *pufftype) { fixed_t vx, vy, vz, shootz; FTraceResults trace; @@ -3089,7 +3089,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color { P_SpawnBlood (x, y, z, source->angle - ANG180, damage, RailHits[i].HitActor); } - P_DamageMobj (RailHits[i].HitActor, source, source, damage, MOD_RAILGUN); + P_DamageMobj (RailHits[i].HitActor, source, source, damage, NAME_Railgun); P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, angle, pitch); } @@ -3421,7 +3421,7 @@ float bombdamagefloat; int bombdistance; float bombdistancefloat; bool DamageSource; -int bombmod; +FName bombmod; vec3_t bombvec; bool bombdodamage; @@ -3598,7 +3598,7 @@ bool PIT_RadiusAttack (AActor *thing) // P_RadiusAttack // Source is the creature that caused the explosion at spot. // -void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, int damageType, +void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, FName damageType, bool hurtSource, bool dodamage) { static TArray radbt; @@ -3853,12 +3853,13 @@ void P_DoCrunch (AActor *thing) !(thing->flags3 & MF3_DONTGIB) && (thing->health <= 0)) { - if (thing->CrushState && !(thing->flags & MF_ICECORPSE)) + FState * state = thing->FindState(NAME_Crush); + if (state != NULL && !(thing->flags & MF_ICECORPSE)) { // Clear MF_CORPSE so that this isn't done more than once thing->flags &= ~(MF_CORPSE|MF_SOLID); thing->height = thing->radius = 0; - thing->SetState (thing->CrushState); + thing->SetState (state); return; } if (!(thing->flags & MF_NOBLOOD)) @@ -3912,7 +3913,7 @@ void P_DoCrunch (AActor *thing) if ((crushchange > 0) && !(level.maptime & 3)) { - P_DamageMobj (thing, NULL, NULL, crushchange, MOD_CRUSH); + P_DamageMobj (thing, NULL, NULL, crushchange, NAME_Crush); // spray blood in a random direction if ((!(thing->flags&MF_NOBLOOD)) && diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index aaeefccdd..36e51108b 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -303,22 +303,8 @@ void AActor::Serialize (FArchive &arc) << PainChance << SpawnState << SeeState - << PainState << MeleeState << MissileState - << CrashState - << DeathState - << XDeathState - << BDeathState - << IDeathState - << EDeathState - << RaiseState - << WoundState - << HealState - << YesState - << NoState - << GreetingsState - << CrushState << MaxDropOffHeight << MaxStepHeight << bouncefactor @@ -947,18 +933,20 @@ bool AActor::CheckLocalView (int playernum) const void AActor::ConversationAnimation (int animnum) { + FState * state = NULL; switch (animnum) { case 0: - if (GreetingsState != NULL) SetState (GreetingsState); + state = FindState(NAME_Greetings); break; case 1: - if (YesState != NULL) SetState (YesState); + state = FindState(NAME_Yes); break; case 2: - if (NoState != NULL) SetState (NoState); + state = FindState(NAME_No); break; } + if (state != NULL) SetState(state); } //============================================================================ @@ -993,7 +981,7 @@ bool AActor::Massacre () do { prevhealth = health; - P_DamageMobj (this, NULL, NULL, 1000000, MOD_MASSACRE); + P_DamageMobj (this, NULL, NULL, 1000000, NAME_Massacre); } while (health != prevhealth && health > 0); //abort if the actor wasn't hurt. return true; @@ -1021,12 +1009,12 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) FState *nextstate=NULL; - if (target != NULL && target->flags & MF_SHOOTABLE) + if (target != NULL && target->flags & (MF_SHOOTABLE|MF_CORPSE)) { - if (target->flags & MF_NOBLOOD) nextstate = mo->CrashState; - if (nextstate == NULL) nextstate = mo->XDeathState; + if (target->flags & MF_NOBLOOD) nextstate = mo->FindState(NAME_Crash); + if (nextstate == NULL) nextstate = mo->FindState(2, NAME_Death, NAME_Extreme); } - if (nextstate == NULL) nextstate = mo->DeathState; + if (nextstate == NULL) nextstate = mo->FindState(NAME_Death); mo->SetState (nextstate); if (mo->ObjectFlags & OF_MassDestruction) @@ -1085,7 +1073,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) } } - if (mo->DeathState != NULL) + if (nextstate != NULL) { // [RH] Change render style of exploding rockets if (mo->flags5 & MF5_DEHEXPLOSION) @@ -1167,7 +1155,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane) momz -= MulScale15 (plane.c, dot); angle = R_PointToAngle2 (0, 0, momx, momy); flags |= MF_INBOUNCE; - SetState (DeathState); + SetState (FindState(NAME_Death)); flags &= ~MF_INBOUNCE; return false; } @@ -1813,7 +1801,7 @@ void P_MonsterFallingDamage (AActor *mo) damage = ((mom - (23*FRACUNIT))*6)>>FRACBITS; } damage = 1000000; // always kill 'em - P_DamageMobj (mo, NULL, NULL, damage, MOD_FALLING); + P_DamageMobj (mo, NULL, NULL, damage, NAME_Falling); } // @@ -1957,7 +1945,7 @@ void P_ZMovement (AActor *mo) // Spawn splashes, etc. P_HitFloor (mo); - if (mo->DamageType == MOD_ICE && mom < minmom) + if (mo->DamageType == NAME_Ice && mom < minmom) { mo->tics = 1; mo->momx = 0; @@ -1984,13 +1972,13 @@ void P_ZMovement (AActor *mo) { // The skull slammed into something mo->momz = -mo->momz; } - if (mo->CrashState && - (mo->flags & MF_CORPSE) && + if ((mo->flags & MF_CORPSE) && !(mo->flags3 & MF3_CRASHED) && - mo->DamageType != MOD_ICE) + mo->DamageType != NAME_Ice) { + FState * crashstate = mo->FindState(NAME_Crash); + if (crashstate != NULL) mo->SetState(crashstate); mo->flags3 |= MF3_CRASHED; - mo->SetState (mo->CrashState); } } } @@ -2353,7 +2341,7 @@ void AActor::HitFloor () bool AActor::Slam (AActor *thing) { int dam = GetMissileDamage (7, 1); - P_DamageMobj (thing, this, this, dam, MOD_HIT); + P_DamageMobj (thing, this, this, dam, NAME_Melee); P_TraceBleed (dam, thing, this); flags &= ~MF_SKULLFLY; momx = momy = momz = 0; @@ -2864,13 +2852,13 @@ void AActor::Tick () } flags2 |= MF2_ONMOBJ; momz = 0; - if (CrashState && - (flags & MF_CORPSE) && + if ((flags & MF_CORPSE) && !(flags3 & MF3_CRASHED) && - DamageType != MOD_ICE) + DamageType != NAME_Ice) { + FState * crashstate = FindState(NAME_Crash); + if (crashstate != NULL) SetState(crashstate); flags3 |= MF3_CRASHED; - SetState (CrashState); } } } @@ -2884,13 +2872,13 @@ void AActor::Tick () } else if (z <= floorz) { - if (CrashState && - (flags & MF_CORPSE) && + if ((flags & MF_CORPSE) && !(flags3 & MF3_CRASHED) && - DamageType != MOD_ICE) + DamageType != NAME_Ice) { + FState * crashstate = FindState(NAME_Crash); + if (crashstate != NULL) SetState(crashstate); flags3 |= MF3_CRASHED; - SetState (CrashState); } } @@ -3918,9 +3906,10 @@ AActor *P_SpawnPuff (const PClass *pufftype, fixed_t x, fixed_t y, fixed_t z, an // If a puff has a crash state and an actor was not hit, // it will enter the crash state. This is used by the StrifeSpark // and BlasterPuff. - if (hitthing == false && puff->CrashState != NULL) + FState *crashstate; + if (hitthing == false && (crashstate = puff->FindState(NAME_Crash)) != NULL) { - puff->SetState (puff->CrashState); + puff->SetState (crashstate); } else if (attackrange == MELEERANGE && puff->MeleeState != NULL) { @@ -4625,7 +4614,7 @@ int AActor::DoSpecialDamage (AActor *target, int damage) } } -int AActor::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype) +int AActor::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { // If the actor does not have a corresponding death state, then it does not take damage. // Note that DeathState matches every kind of damagetype, so if an actor has that, it can @@ -4636,48 +4625,36 @@ int AActor::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, in if (flags5 & MF5_NODAMAGE) { target = source; - if (PainState != NULL && pr_takedamage() < PainChance) + if (pr_takedamage() < PainChance) { - SetState (PainState); + FState * painstate = FindState(2,NAME_Pain, (int)damagetype); + if (painstate != NULL) SetState (painstate); } return -1; } - if (DeathState != NULL) + // If the actor does not have a corresponding death state, then it does not take damage. + // Note that DeathState matches every kind of damagetype, so an actor has that, it can + // be hurt with any type of damage. Exception: Massacre damage always succeeds, because + // it needs to work. + + // Always kill if there is a regular death state or no death states at all. + if (FindState (NAME_Death) != NULL || !HasStates(NAME_Death)) { return damage; } - if (EDeathState==NULL && BDeathState==NULL && IDeathState==NULL) + if (damagetype == NAME_Ice) { - // If there is no death state at all, kill it always. - return damage; - } - - switch (damagetype) - { - case MOD_MASSACRE: - return damage; - - case MOD_DISINTEGRATE: - death = EDeathState; - break; - - case MOD_FIRE: - death = BDeathState; - break; - - case MOD_ICE: - death = IDeathState; + death = GetClass()->ActorInfo->FindStateExact (2, NAME_Death, NAME_Ice); if (death == NULL && !deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH) && (player || (flags3 & MF3_ISMONSTER))) { death = &AActor::States[S_GENERICFREEZEDEATH]; } - break; - - default: - death = NULL; - break; + } + else + { + death = FindState (2, NAME_Death, int(damagetype)); } return (death == NULL) ? -1 : damage; } diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index b976be436..7b88b50e7 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -235,8 +235,7 @@ void P_FireWeapon (player_t *player) player->mo->PlayAttacking (); weapon->bAltFire = false; - P_SetPsprite (player, ps_weapon, - player->refire ? weapon->GetHoldAtkState() : weapon->GetAtkState()); + P_SetPsprite (player, ps_weapon, weapon->GetAtkState(!!player->refire)); if (!(weapon->WeaponFlags & WIF_NOALERT)) { P_NoiseAlert (player->mo, player->mo, false); @@ -261,15 +260,16 @@ void P_FireWeaponAlt (player_t *player) } weapon = player->ReadyWeapon; - if (weapon == NULL || weapon->AltAtkState == NULL || !weapon->CheckAmmo (AWeapon::AltFire, true)) + if (weapon == NULL || weapon->FindState(NAME_AltFire) == NULL || !weapon->CheckAmmo (AWeapon::AltFire, true)) { return; } player->mo->PlayAttacking (); weapon->bAltFire = true; - P_SetPsprite (player, ps_weapon, - player->refire ? weapon->AltHoldAtkState : weapon->AltAtkState); + + + P_SetPsprite (player, ps_weapon, weapon->GetAltAtkState(!!player->refire)); if (!(weapon->WeaponFlags & WIF_NOALERT)) { P_NoiseAlert (player->mo, player->mo, false); @@ -382,14 +382,14 @@ void A_WeaponReady(AActor *actor) } // Change player from attack state - if (actor->state >= actor->MissileState && - actor->state < actor->PainState) + if (actor->InStateSequence(actor->state, actor->MissileState) || + actor->InStateSequence(actor->state, actor->MeleeState)) { static_cast(actor)->PlayIdle (); } // Play ready sound, if any. - if (weapon->ReadySound && player->psprites[ps_weapon].state == weapon->ReadyState) + if (weapon->ReadySound && player->psprites[ps_weapon].state == weapon->FindState(NAME_Ready)) { if (!(weapon->WeaponFlags & WIF_READYSNDHALF) || pr_wpnreadysnd() < 128) { @@ -613,8 +613,11 @@ void A_GunFlash (AActor *actor) return; } player->mo->PlayAttacking2 (); - P_SetPsprite (player, ps_flash, (player->ReadyWeapon->bAltFire && player->ReadyWeapon->AltFlashState != NULL) ? - player->ReadyWeapon->AltFlashState : player->ReadyWeapon->FlashState); + + FState * flash=NULL; + if (player->ReadyWeapon->bAltFire) flash = player->ReadyWeapon->FindState(NAME_AltFlash); + if (flash == NULL) flash = player->ReadyWeapon->FindState(NAME_Flash); + P_SetPsprite (player, ps_flash, flash); } @@ -668,7 +671,7 @@ void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype) angle += pr_gunshot.Random2 () << 18; } - P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, MOD_UNKNOWN, pufftype); + P_LineAttack (mo, angle, PLAYERMISSILERANGE, bulletpitch, damage, NAME_None, pufftype); } void A_Light0 (AActor *actor) @@ -742,7 +745,7 @@ void P_MovePsprites (player_t *player) FState *state; // [RH] If you don't have a weapon, then the psprites should be NULL. - if (player->ReadyWeapon == NULL && (player->health > 0 || player->mo->DamageType != MOD_FIRE)) + if (player->ReadyWeapon == NULL && (player->health > 0 || player->mo->DamageType != NAME_Fire)) { P_SetPsprite (player, ps_weapon, NULL); P_SetPsprite (player, ps_flash, NULL); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index f99cabb5e..e02ef0d2b 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -127,7 +127,7 @@ bool CheckIfExitIsGood (AActor *self) if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT)) { - P_DamageMobj (self, self, self, 1000000, MOD_EXIT); + P_DamageMobj (self, self, self, 1000000, NAME_Exit); return false; } if (deathmatch) @@ -399,20 +399,20 @@ void P_PlayerInSpecialSector (player_t *player) case Damage_InstantDeath: // Strife's instant death sector - P_DamageMobj (player->mo, NULL, NULL, 999, MOD_UNKNOWN); + P_DamageMobj (player->mo, NULL, NULL, 999, NAME_None); break; case dDamage_Hellslime: // HELLSLIME DAMAGE if (ironfeet == NULL && !(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 10, MOD_SLIME); + P_DamageMobj (player->mo, NULL, NULL, 10, NAME_Slime); break; case dDamage_Nukage: // NUKAGE DAMAGE case sLight_Strobe_Hurt: if (ironfeet == NULL && !(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 5, MOD_SLIME); + P_DamageMobj (player->mo, NULL, NULL, 5, NAME_Slime); break; case dDamage_SuperHellslime: @@ -422,7 +422,7 @@ void P_PlayerInSpecialSector (player_t *player) if (ironfeet == NULL || pr_playerinspecialsector() < 5) { if (!(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 20, MOD_SLIME); + P_DamageMobj (player->mo, NULL, NULL, 20, NAME_Slime); } break; @@ -441,7 +441,7 @@ void P_PlayerInSpecialSector (player_t *player) player->cheats &= ~CF_GODMODE; if (!(level.time & 0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 20, MOD_UNKNOWN); + P_DamageMobj (player->mo, NULL, NULL, 20, NAME_None); if (player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) G_ExitLevel(0, false); @@ -451,7 +451,7 @@ void P_PlayerInSpecialSector (player_t *player) case dScroll_EastLavaDamage: if (!(level.time & 15)) { - P_DamageMobj(player->mo, NULL, NULL, 5, MOD_FIRE); + P_DamageMobj(player->mo, NULL, NULL, 5, NAME_Fire); P_HitFloor(player->mo); } break; @@ -459,7 +459,7 @@ void P_PlayerInSpecialSector (player_t *player) case dDamage_LavaHefty: if(!(level.time & 15)) { - P_DamageMobj(player->mo, NULL, NULL, 8, MOD_FIRE); + P_DamageMobj(player->mo, NULL, NULL, 8, NAME_Fire); P_HitFloor(player->mo); } break; @@ -478,18 +478,18 @@ void P_PlayerInSpecialSector (player_t *player) break; case 0x100: // 2/5 damage per 31 ticks if (ironfeet == NULL && !(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 5, MOD_FIRE); + P_DamageMobj (player->mo, NULL, NULL, 5, NAME_Fire); break; case 0x200: // 5/10 damage per 31 ticks if (ironfeet == NULL && !(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 10, MOD_SLIME); + P_DamageMobj (player->mo, NULL, NULL, 10, NAME_Slime); break; case 0x300: // 10/20 damage per 31 ticks if (ironfeet == NULL || pr_playerinspecialsector() < 5) // take damage even with suit { if (!(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, 20, MOD_SLIME); + P_DamageMobj (player->mo, NULL, NULL, 20, NAME_Slime); } break; } @@ -501,19 +501,19 @@ void P_PlayerInSpecialSector (player_t *player) if (sector->damage < 20) { if (ironfeet == NULL && !(level.time&0x1f)) - P_DamageMobj (player->mo, NULL, NULL, sector->damage, sector->mod); + P_DamageMobj (player->mo, NULL, NULL, sector->damage, MODtoDamageType (sector->mod)); } else if (sector->damage < 50) { if ((ironfeet == NULL || (pr_playerinspecialsector()<5)) && !(level.time&0x1f)) { - P_DamageMobj (player->mo, NULL, NULL, sector->damage, sector->mod); + P_DamageMobj (player->mo, NULL, NULL, sector->damage, MODtoDamageType (sector->mod)); } } else { - P_DamageMobj (player->mo, NULL, NULL, sector->damage, sector->mod); + P_DamageMobj (player->mo, NULL, NULL, sector->damage, MODtoDamageType (sector->mod)); } } @@ -1001,7 +1001,7 @@ void P_SpawnSpecials (void) for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0],s)) >= 0;) { sectors[s].damage = damage; - sectors[s].mod = MOD_UNKNOWN; + sectors[s].mod = 0;//MOD_UNKNOWN; } } break; diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index 9508de8ee..f23c1757d 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -83,13 +83,6 @@ enum ETerrainKeywords TR_FRICTION }; -enum EDamageKeywords -{ - DAM_Lava, - DAM_Ice, - DAM_Slime -}; - enum EGenericType { GEN_End, @@ -190,14 +183,6 @@ static const char *TerrainKeywords[] = NULL }; -static const char *DamageKeywords[] = -{ - "lava", - "ice", - "slime", - NULL -}; - // Alternate offsetof macro to shut GCC up #define theoffsetof(type,field) ((size_t)&((type*)1)->field - 1) @@ -501,20 +486,9 @@ static void ParseDamage (int keyword, void *fields) FTerrainDef *def = (FTerrainDef *)fields; SC_MustGetString (); - switch (SC_MustMatchString (DamageKeywords)) - { - case DAM_Lava: - def->DamageMOD = MOD_FIRE; - break; - - case DAM_Ice: - def->DamageMOD = MOD_ICE; - break; - - case DAM_Slime: - def->DamageMOD = MOD_SLIME; - break; - } + // Lava is synonymous with Fire here! + if (SC_Compare("Lava")) def->DamageMOD=NAME_Fire; + else def->DamageMOD=sc_String; } //========================================================================== diff --git a/src/p_terrain.h b/src/p_terrain.h index 98095e802..44ab4e6db 100644 --- a/src/p_terrain.h +++ b/src/p_terrain.h @@ -65,7 +65,7 @@ struct FTerrainDef FName Name; int Splash; int DamageAmount; - int DamageMOD; + FName DamageMOD; int DamageTimeMask; fixed_t FootClip; float StepVolume; diff --git a/src/p_user.cpp b/src/p_user.cpp index 7f8bb8be6..0b010f131 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -651,7 +651,7 @@ AWeapon *APlayerPawn::PickNewWeapon (const PClass *ammotype) player->PendingWeapon = best; if (player->ReadyWeapon != NULL) { - P_SetPsprite (player, ps_weapon, player->ReadyWeapon->DownState); + P_SetPsprite (player, ps_weapon, player->ReadyWeapon->GetDownState()); } else if (player->PendingWeapon != WP_NOCHANGE) { @@ -1506,7 +1506,7 @@ void P_FallingDamage (AActor *actor) damage = 999; } } - P_DamageMobj (actor, NULL, NULL, damage, MOD_FALLING); + P_DamageMobj (actor, NULL, NULL, damage, NAME_Falling); } //========================================================================== @@ -1537,7 +1537,7 @@ void P_DeathThink (player_t *player) } } } - else if (player->mo->DamageType != MOD_ICE) + else if (!(player->mo->flags & MF_ICECORPSE)) { // Fall to ground (if not frozen) player->deltaviewheight = 0; if (player->viewheight > 6*FRACUNIT) @@ -1961,7 +1961,7 @@ void P_PlayerThink (player_t *player) { player->hazardcount--; if (!(level.time & 31) && player->hazardcount > 16*TICRATE) - P_DamageMobj (player->mo, NULL, NULL, 5, MOD_SLIME); + P_DamageMobj (player->mo, NULL, NULL, 5, NAME_Slime); } if (player->poisoncount && !(level.time & 15)) @@ -1985,7 +1985,7 @@ void P_PlayerThink (player_t *player) } else if (player->air_finished <= level.time && !(level.time & 31)) { - P_DamageMobj (player->mo, NULL, NULL, 2 + 2*((level.time-player->air_finished)/TICRATE), MOD_WATER); + P_DamageMobj (player->mo, NULL, NULL, 2 + 2*((level.time-player->air_finished)/TICRATE), NAME_Water); } } } diff --git a/src/po_man.cpp b/src/po_man.cpp index c43460b78..2b0d14e4f 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -695,7 +695,7 @@ void ThrustMobj (AActor *actor, seg_t *seg, polyobj_t *po) { if (po->bHurtOnTouch || !P_CheckPosition (actor, actor->x + thrustX, actor->y + thrustY)) { - P_DamageMobj (actor, NULL, NULL, po->crush, MOD_CRUSH); + P_DamageMobj (actor, NULL, NULL, po->crush, NAME_Crush); P_TraceBleed (po->crush, actor); } } diff --git a/src/thingdef.cpp b/src/thingdef.cpp index a7fb51876..7484df2c7 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -510,6 +510,7 @@ ACTOR(CheckFloor) ACTOR(CheckSkullDone) ACTOR(RadiusThrust) ACTOR(Stop) +ACTOR(SPosAttackUseAtkSound) #include "d_dehackedactions.h" @@ -547,6 +548,7 @@ AFuncDesc AFTable[]= FUNC(A_PosAttack, NULL) FUNC(A_Scream, NULL) FUNC(A_SPosAttack, NULL) + FUNC(A_SPosAttackUseAtkSound, NULL) FUNC(A_VileChase, NULL) FUNC(A_VileStart, NULL) FUNC(A_VileTarget, NULL) @@ -1087,51 +1089,280 @@ inline bool TestCom() // //========================================================================== -// These strings must be in the same order as the respective variables in the actor struct! -static const char * actor_statenames[]={"SPAWN","SEE","PAIN","MELEE","MISSILE","CRASH", "DEATH", - "XDEATH", "BURN","ICE","DISINTEGRATE","RAISE","WOUND","HEAL", - "CRUSH", "YES", "NO", "GREETINGS", NULL}; - -static const char * weapon_statenames[]={"SELECT", "DESELECT", "READY", "FIRE", "HOLD", - "ALTFIRE", "ALTHOLD", "FLASH", "ALTFLASH", NULL }; - -static const char * inventory_statenames[]={"USE", "PICKUP", "DROP", NULL }; - - -FState ** FindState(AActor * actor, const PClass * type, const char * name) +struct FStateDefine { - int i; + FName Label; + bool valid; + TArray Children; + FState *State; +}; - for(i=0;actor_statenames[i];i++) - { - if (!stricmp(actor_statenames[i],name)) - return (&actor->SpawnState)+i; - } - if (type->IsDescendantOf (RUNTIME_CLASS(AWeapon))) - { - for(i=0;weapon_statenames[i];i++) - { - if (!stricmp(weapon_statenames[i],name)) - return (&static_cast(actor)->UpState)+i; - } - } - else if (type->IsDescendantOf (RUNTIME_CLASS(ACustomInventory))) - { - for(i=0;inventory_statenames[i];i++) - { - if (!stricmp(inventory_statenames[i],name)) - return (&static_cast(actor)->UseState)+i; - } - } - else if (type->IsDescendantOf (RUNTIME_CLASS(ASwitchableDecoration))) - { - // These are the names that the code will use when custom labels are working. - if (!stricmp(name, "ACTIVE")) return &actor->SeeState; - if (!stricmp(name, "INACTIVE")) return &actor->MeleeState; - } - return NULL; +static TArray StateLabels; + +void ClearStateLabels() +{ + StateLabels.Clear(); } +//========================================================================== +// +// Search one list of state definitions for the given name +// +//========================================================================== + +static FStateDefine * FindStateLabelInList(TArray & list, FName name, bool create) +{ + for(unsigned i = 0; i * out) +{ + FName firstpart, secondpart; + char * c; + + // Handle the old names for the existing death states + char * name = copystring(fname); + firstpart = strtok(name, "."); + switch (firstpart) + { + case NAME_Burn: + firstpart = NAME_Death; + secondpart = NAME_Fire; + break; + case NAME_Ice: + firstpart = NAME_Death; + secondpart = NAME_Ice; + break; + case NAME_Disintegrate: + firstpart = NAME_Death; + secondpart = NAME_Disintegrate; + break; + case NAME_XDeath: + firstpart = NAME_Death; + secondpart = NAME_Extreme; + break; + } + + out->Clear(); + out->Push(firstpart); + if (secondpart!=NAME_None) out->Push(secondpart); + + while ((c = strtok(NULL, "."))!=NULL) + { + FName cc = c; + out->Push(cc); + } + delete [] name; +} + +//========================================================================== +// +// Finds the address of a state given by name. +// Adds the state if it doesn't exist +// +//========================================================================== + +static FStateDefine * FindStateAddress(const char * name) +{ + static TArray namelist(3); + FStateDefine * statedef=NULL; + + MakeStateNameList(name, &namelist); + + TArray * statelist = &StateLabels; + for(unsigned i=0;iChildren; + } + return statedef; +} + +void AddState (const char * statename, FState * state) +{ + FStateDefine * std = FindStateAddress(statename); + std->State = state; + std->valid = true; +} + +//========================================================================== +// +// Finds the state associated with the given name +// +//========================================================================== + +FState * FindState(AActor * actor, const PClass * type, const char * name) +{ + static TArray namelist(3); + FStateDefine * statedef=NULL; + + MakeStateNameList(name, &namelist); + + TArray * statelist = &StateLabels; + for(unsigned i=0;iParentClass->ActorInfo; + if (parentinfo) return parentinfo->FindStateExact(namelist.Size(), (va_list)&namelist[0]); + else return NULL; + } + statelist = &statedef->Children; + } + return statedef? statedef->State : NULL; +} + +//========================================================================== +// +// Finds the state associated with the given name +// +//========================================================================== + +FState * FindStateInClass(AActor * actor, const PClass * type, const char * name) +{ + static TArray namelist(3); + + MakeStateNameList(name, &namelist); + FActorInfo * info = type->ActorInfo; + if (info) return info->FindStateExact(namelist.Size(), (va_list)&namelist[0]); + return NULL; +} + +//========================================================================== +// +// Checks if a state list is empty +// A list is empty if it doesn't contain any states and no children +// that contain any states +// +//========================================================================== + +static bool IsStateListEmpty(TArray & statelist) +{ + for(unsigned i=0;iLabel - (int)B->Label); +} + +static FStateLabels * CreateStateLabelList(TArray & statelist) +{ + int count=statelist.Size(); + + if (count == 0) return NULL; + + FStateLabels * list = (FStateLabels*)M_Malloc(sizeof(FStateLabels)+(count-1)*sizeof(FStateLabel)); + list->NumLabels = count; + + int j=0; + for (unsigned i=0;iLabels[j].Label = statelist[i].Label; + list->Labels[j].State = statelist[i].State; + list->Labels[j].valid = statelist[i].valid; + list->Labels[j].Children = CreateStateLabelList(statelist[i].Children); + j++; + } + } + qsort(list->Labels, count, sizeof(FStateLabel), labelcmp); + return list; +} + +//=========================================================================== +// +// InstallStates +// +// Creates the actor's state list from the current definition +// +//=========================================================================== + +void InstallStates(FActorInfo *info, AActor *defaults) +{ + FState * state = FindState(defaults, info->Class, "Spawn"); + // If the actor doesn't provide a valid spawn state we have to substutute it + // with the default. + if (state == &AActor::States[2] || state == NULL) + { + AddState("Spawn", &AActor::States[0]); + } + + info->StateList = CreateStateLabelList(StateLabels); + + // Cache these states as member veriables. + defaults->SpawnState = info->FindStateExact(1,NAME_Spawn); + defaults->SeeState = info->FindStateExact(1,NAME_See); + // Melee and Missile states are manipulated by the scripted marines so they + // have to be stored locally + defaults->MeleeState = info->FindStateExact(1,NAME_Melee); + defaults->MissileState = info->FindStateExact(1,NAME_Missile); +} + + +//=========================================================================== +// +// MakeStateDefines +// +// Creates a list of state definitions from an existing actor +// Used by Dehacked to modify an actor's state list +// +//=========================================================================== + +static void MakeStateList(const FStateLabels *list, TArray &dest) +{ + dest.Clear(); + for(int i=0;iNumLabels;i++) + { + FStateDefine def; + + def.Label = list->Labels[i].Label; + def.State = list->Labels[i].State; + def.valid = list->Labels[i].valid; + dest.Push(def); + if (list->Labels[i].Children != NULL) + { + MakeStateList(list->Labels[i].Children, dest[dest.Size()-1].Children); + } + } +} + +void MakeStateDefines(const FStateLabels *list) +{ + MakeStateList(list, StateLabels); +} //========================================================================== // @@ -1237,9 +1468,11 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag) FActorInfo * info = ti->ActorInfo; Decorations.Push (info); + ClearStateLabels(); info->NumOwnedStates = 0; info->OwnedStates = NULL; info->SpawnID = 0; + info->StateList = NULL; ResetBaggage (bag); bag->Info = info; @@ -1415,30 +1648,24 @@ bool DoSpecialFunctions(FState & state, bool multistate, int * statecount, Bagga // //========================================================================== -static void RetargetStatePointers (intptr_t count, const char *target, FState **start, FState **stop) +static void RetargetStatePointers (intptr_t count, const char *target, TArray & statelist) { - for (FState **probe = start; probe <= stop; ++probe) + for(unsigned i = 0;i 0) + { + RetargetStatePointers(count, target, statelist[i].Children); } } } -static void RetargetStates (intptr_t count, const char *target, const PClass *cls, AActor *defaults) +static void RetargetStates (intptr_t count, const char *target) { - RetargetStatePointers (count, target, &defaults->SpawnState, &defaults->GreetingsState); - if (cls->IsDescendantOf (RUNTIME_CLASS(AWeapon))) - { - AWeapon *weapon = (AWeapon *)defaults; - RetargetStatePointers (count, target, &weapon->UpState, &weapon->AltFlashState); - } - if (cls->IsDescendantOf (RUNTIME_CLASS(ACustomInventory))) - { - ACustomInventory *item = (ACustomInventory *)defaults; - RetargetStatePointers (count, target, &item->UseState, &item->DropState); - } + RetargetStatePointers(count, target, StateLabels); } //========================================================================== @@ -1472,7 +1699,7 @@ static int ProcessStates(FActorInfo * actor, AActor * defaults, Baggage &bag) FState state; FState * laststate = NULL; intptr_t lastlabel = -1; - FState ** stp; + FStateDefine * stp; int minrequiredstate = -1; statestring[255] = 0; @@ -1500,7 +1727,7 @@ do_goto: } else if (lastlabel >= 0) { // Following a label: Retarget it. - RetargetStates (count+1, statestring, actor->Class, defaults); + RetargetStates (count+1, statestring); } else { @@ -1516,7 +1743,7 @@ do_stop: } else if (lastlabel >=0) { - RetargetStates (count+1, NULL, actor->Class, defaults); + RetargetStates (count+1, NULL); } else { @@ -1553,11 +1780,7 @@ do_stop: do { lastlabel = count; - stp = FindState(defaults, bag.Info->Class, statestring); - if (stp) *stp=(FState *) (count+1); - else - SC_ScriptError("Unknown state label %s", statestring); - + AddState(statestring, (FState *) (count+1)); ParseStateString(statestring); if (!stricmp(statestring, "GOTO")) { @@ -1845,9 +2068,10 @@ endofstate: // //========================================================================== -static FState *ResolveGotoLabel (AActor *actor, const PClass *type, char *name) +static FState *ResolveGotoLabel (AActor *actor, const PClass *mytype, char *name) { - FState **stp, *state; + const PClass *type=mytype; + FState *state; char *namestart = name; char *label, *offset, *pt; int v; @@ -1866,8 +2090,9 @@ static FState *ResolveGotoLabel (AActor *actor, const PClass *type, char *name) type = type->ParentClass; actor = GetDefaultByType (type); } - else + else if (!FindState(actor, type, classname)) { + // first check whether a state of the desired name exists const PClass *stype = PClass::FindClass (classname); if (stype == NULL) { @@ -1888,6 +2113,12 @@ static FState *ResolveGotoLabel (AActor *actor, const PClass *type, char *name) actor = GetDefaultByType (type); } } + else + { + // Restore the period in the name + *pt='.'; + name = (char*)classname; + } } label = name; // Check for offset @@ -1899,23 +2130,17 @@ static FState *ResolveGotoLabel (AActor *actor, const PClass *type, char *name) } v = offset ? strtol (offset, NULL, 0) : 0; - // Calculate the state's address. - stp = FindState (actor, type, label); - state = NULL; - if (stp != NULL) + // Get the state's address. + if (type==mytype) state = FindState (actor, type, label); + else state = FindStateInClass (actor, type, label); + + if (state != NULL) { - if (*stp != NULL) - { - state = *stp + v; - } - else if (v != 0) - { - SC_ScriptError ("Attempt to get invalid state from actor %s.", type->TypeName.GetChars()); - } + state += v; } - else + else if (v != 0) { - SC_ScriptError("Unknown state label %s", label); + SC_ScriptError ("Attempt to get invalid state %s from actor %s.", label, type->TypeName.GetChars()); } delete[] namestart; // free the allocated string buffer return state; @@ -1929,18 +2154,16 @@ static FState *ResolveGotoLabel (AActor *actor, const PClass *type, char *name) // //========================================================================== -static void FixStatePointers (FActorInfo *actor, FState **start, FState **stop) +static void FixStatePointers (FActorInfo *actor, TArray & list) { - FState **stp; - size_t v; - - for (stp = start; stp <= stop; ++stp) + for(unsigned i=0;i= 1 && v < 0x10000) { - *stp = actor->OwnedStates + v - 1; + list[i].State = actor->OwnedStates + v - 1; } + if (list[i].Children.Size() > 0) FixStatePointers(actor, list[i].Children); } } @@ -1952,27 +2175,29 @@ static void FixStatePointers (FActorInfo *actor, FState **start, FState **stop) // //========================================================================== -static void FixStatePointersAgain (FActorInfo *actor, AActor *defaults, FState **start, FState **stop) +static void FixStatePointersAgain (FActorInfo *actor, AActor *defaults, TArray & list) { - FState **stp; - - for (stp = start; stp <= stop; ++stp) + for(unsigned i=0;iClass, (char *)*stp); + list[i].State = ResolveGotoLabel (defaults, actor->Class, (char *)list[i].State); } + if (list[i].Children.Size() > 0) FixStatePointersAgain(actor, defaults, list[i].Children); } } + //========================================================================== // // FinishStates // copies a state block and fixes all state links // //========================================================================== + static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag) { + static int c=0; int count = StateArray.Size(); if (count > 0) @@ -1987,19 +2212,7 @@ static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag) // adjust the state pointers // In the case new states are added these must be adjusted, too! - FixStatePointers (actor, &defaults->SpawnState, &defaults->GreetingsState); - if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(AWeapon))) - { - AWeapon *weapon = (AWeapon*)defaults; - - FixStatePointers (actor, &weapon->UpState, &weapon->AltFlashState); - } - if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(ACustomInventory))) - { - ACustomInventory *item = (ACustomInventory*)defaults; - - FixStatePointers (actor, &item->UseState, &item->DropState); - } + FixStatePointers (actor, StateLabels); for(i = currange = 0; i < count; i++) { @@ -2033,19 +2246,7 @@ static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag) StateArray.Clear (); // Fix state pointers that are gotos - FixStatePointersAgain (actor, defaults, &defaults->SpawnState, &defaults->GreetingsState); - if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(AWeapon))) - { - AWeapon *weapon = (AWeapon*)defaults; - - FixStatePointersAgain (actor, defaults, &weapon->UpState, &weapon->AltFlashState); - } - if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(ACustomInventory))) - { - ACustomInventory *item = (ACustomInventory*)defaults; - - FixStatePointersAgain (actor, defaults, &item->UseState, &item->DropState); - } + FixStatePointersAgain (actor, defaults, StateLabels); return count; } @@ -2053,26 +2254,27 @@ static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag) //========================================================================== // // For getting a state address from the parent +// No attempts have been made to add new functionality here +// This is strictly for keeping compatibility with old WADs! // //========================================================================== -static FState *CheckState(int statenum, PClass *type) +static FState *CheckState(PClass *type) { + int v=0; + if (SC_GetString() && !sc_Crossed) { if (SC_Compare("0")) return NULL; else if (SC_Compare("PARENT")) { + FState * state = NULL; SC_MustGetString(); - FState * basestate; - FState ** stp=FindState((AActor*)type->ParentClass->Defaults, type, sc_String); - int v = 0; + FActorInfo * info = type->ParentClass->ActorInfo; - if (stp) basestate =*stp; - else + if (info != NULL) { - SC_ScriptError("Unknown state label %s",(const char **)&sc_String); - return NULL; + state = info->FindStateExact(1, (int)FName(sc_String)); } if (SC_GetString ()) @@ -2088,15 +2290,15 @@ static FState *CheckState(int statenum, PClass *type) } } - if (!basestate && !v) return NULL; - basestate+=v; + if (state == NULL && v==0) return NULL; - if (v && !basestate) + if (v!=0 && state==NULL) { SC_ScriptError("Attempt to get invalid state from actor %s\n", type->ParentClass->TypeName.GetChars()); return NULL; } - return basestate; + state+=v; + return state; } else SC_ScriptError("Invalid state assignment"); } @@ -2220,6 +2422,7 @@ void ProcessActor(void (*process)(FState *, int)) ParseActorProperties (bag); FinishStates (info, defaults, bag); + InstallStates(info, defaults); process(info->OwnedStates, info->NumOwnedStates); if (bag.DropItemSet) { @@ -2609,7 +2812,7 @@ static void ActorDropItem (AActor *defaults, Baggage &bag) static void ActorSpawnState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Spawn"); - defaults->SpawnState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Spawn", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2618,7 +2821,7 @@ static void ActorSpawnState (AActor *defaults, Baggage &bag) static void ActorSeeState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "See"); - defaults->SeeState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("See", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2627,7 +2830,7 @@ static void ActorSeeState (AActor *defaults, Baggage &bag) static void ActorMeleeState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Melee"); - defaults->MeleeState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Melee", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2636,7 +2839,7 @@ static void ActorMeleeState (AActor *defaults, Baggage &bag) static void ActorMissileState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Missile"); - defaults->MissileState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Missile", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2645,7 +2848,7 @@ static void ActorMissileState (AActor *defaults, Baggage &bag) static void ActorPainState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Pain"); - defaults->PainState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Pain", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2654,7 +2857,7 @@ static void ActorPainState (AActor *defaults, Baggage &bag) static void ActorDeathState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Death"); - defaults->DeathState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Death", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2663,7 +2866,7 @@ static void ActorDeathState (AActor *defaults, Baggage &bag) static void ActorXDeathState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "XDeath"); - defaults->XDeathState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("XDeath", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2672,7 +2875,7 @@ static void ActorXDeathState (AActor *defaults, Baggage &bag) static void ActorBurnState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Burn"); - defaults->BDeathState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Burn", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2681,7 +2884,7 @@ static void ActorBurnState (AActor *defaults, Baggage &bag) static void ActorIceState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Ice"); - defaults->IDeathState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Ice", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2690,7 +2893,7 @@ static void ActorIceState (AActor *defaults, Baggage &bag) static void ActorRaiseState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Raise"); - defaults->RaiseState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Raise", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2699,7 +2902,7 @@ static void ActorRaiseState (AActor *defaults, Baggage &bag) static void ActorCrashState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Crash"); - defaults->CrashState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Crash", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2708,7 +2911,7 @@ static void ActorCrashState (AActor *defaults, Baggage &bag) static void ActorCrushState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Crush"); - defaults->CrushState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Crush", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2717,7 +2920,7 @@ static void ActorCrushState (AActor *defaults, Baggage &bag) static void ActorWoundState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Wound"); - defaults->WoundState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Wound", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2726,7 +2929,7 @@ static void ActorWoundState (AActor *defaults, Baggage &bag) static void ActorDisintegrateState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Disintegrate"); - defaults->EDeathState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Disintegrate", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2735,7 +2938,7 @@ static void ActorDisintegrateState (AActor *defaults, Baggage &bag) static void ActorHealState (AActor *defaults, Baggage &bag) { StatePropertyIsDeprecated (bag.Info->Class->TypeName.GetChars(), "Heal"); - defaults->HealState=CheckState (bag.CurrentState, bag.Info->Class); + AddState("Heal", CheckState ( bag.Info->Class)); } //========================================================================== @@ -2985,11 +3188,8 @@ static void ActorMinMissileChance (AActor *defaults, Baggage &bag) static void ActorDamageType (AActor *defaults, Baggage &bag) { SC_MustGetString (); - if (SC_Compare("Normal")) defaults->DamageType=MOD_UNKNOWN; - else if (SC_Compare("Fire")) defaults->DamageType=MOD_FIRE; - else if (SC_Compare("Ice")) defaults->DamageType=MOD_ICE; - else if (SC_Compare("Disintegrate")) defaults->DamageType=MOD_DISINTEGRATE; - else SC_ScriptError("Unknown damage type '%s'\n", sc_String); + if (SC_Compare("Normal")) defaults->DamageType = NAME_None; + else defaults->DamageType=sc_String; } //========================================================================== @@ -3098,13 +3298,13 @@ static void ActorFlagSetOrReset (AActor *defaults, Baggage &bag) // Fire and ice damage were once flags but now are not. if (SC_Compare ("FIREDAMAGE")) { - if (mod == '+') defaults->DamageType = MOD_FIRE; - else defaults->DamageType = MOD_UNKNOWN; + if (mod == '+') defaults->DamageType = NAME_Fire; + else defaults->DamageType = NAME_None; } else if (SC_Compare ("ICEDAMAGE")) { - if (mod == '+') defaults->DamageType = MOD_ICE; - else defaults->DamageType = MOD_UNKNOWN; + if (mod == '+') defaults->DamageType = NAME_Ice; + else defaults->DamageType = NAME_None; } else { @@ -4029,14 +4229,10 @@ void FinishThingdef() if (isRuntimeActor) { // Do some consistency checks. If these states are undefined the weapon cannot work! - if (!defaults->ReadyState) I_Error("Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars()); - if (!defaults->UpState) I_Error("Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars()); - if (!defaults->DownState) I_Error("Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars()); - if (!defaults->AtkState) I_Error("Weapon %s doesn't define an attack state.\n", ti->TypeName.GetChars()); - - // If the weapon doesn't define a hold state use the attack state instead. - if (!defaults->HoldAtkState) defaults->HoldAtkState=defaults->AtkState; - if (!defaults->AltHoldAtkState) defaults->AltHoldAtkState=defaults->AltAtkState; + if (!ti->ActorInfo->FindState(1, NAME_Ready)) I_Error("Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars()); + if (!ti->ActorInfo->FindState(1, NAME_Select)) I_Error("Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars()); + if (!ti->ActorInfo->FindState(1, NAME_Deselect)) I_Error("Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars()); + if (!ti->ActorInfo->FindState(1, NAME_Fire)) I_Error("Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars()); } } diff --git a/src/thingdef.h b/src/thingdef.h index 7eb191da7..e59de42ec 100644 --- a/src/thingdef.h +++ b/src/thingdef.h @@ -28,6 +28,11 @@ int EvalExpressionI (int id, AActor *self); float EvalExpressionF (int id, AActor *self); bool EvalExpressionN (int id, AActor *self); +void ClearStateLabels(); +void AddState (const char * statename, FState * state); +FState * FindState(AActor * actor, const PClass * type, const char * name); +void InstallStates(FActorInfo *info, AActor *defaults); +void MakeStateDefines(const FStateLabels *list); struct FDropItem { diff --git a/src/thingdef_codeptr.cpp b/src/thingdef_codeptr.cpp index 2be39b187..c66fe3247 100644 --- a/src/thingdef_codeptr.cpp +++ b/src/thingdef_codeptr.cpp @@ -213,7 +213,7 @@ static void DoAttack (AActor *self, bool domelee, bool domissile) { int damage = pr_camelee.HitDice(MeleeDamage); if (MeleeSound) S_SoundID (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, NAME_Melee); P_TraceBleed (damage, self->target, self); } else if (domissile && MissileName != NAME_None) @@ -781,13 +781,8 @@ void A_CustomMeleeAttack (AActor *self) int MeleeSound=StateParameters[index+1]; ENamedName DamageType = (ENamedName)StateParameters[index+2]; bool bleed = EvalExpressionN (StateParameters[index+3], self); - int mod; - // This needs to be redesigned once the customizable damage type system is working - if (DamageType==NAME_Fire) mod=MOD_FIRE; - else if (DamageType==NAME_Ice) mod=MOD_ICE; - else if (DamageType==NAME_Disintegrate) mod=MOD_DISINTEGRATE; - else mod=MOD_HIT; + if (DamageType==NAME_None) DamageType = NAME_Melee; // Melee is the default type if (!self->target) return; @@ -796,7 +791,7 @@ void A_CustomMeleeAttack (AActor *self) if (self->CheckMeleeRange ()) { if (MeleeSound) S_SoundID (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM); - P_DamageMobj (self->target, self, self, damage, MOD_HIT); + P_DamageMobj (self->target, self, self, damage, DamageType); if (bleed) P_TraceBleed (damage, self->target, self); } } @@ -1210,6 +1205,9 @@ void A_SpawnItem(AActor * self) return; } + // Don't spawn monsters if this actor has been massacred + if (self->DamageType == NAME_Massacre && GetDefaultByType(missile)->flags3&MF3_ISMONSTER) return; + if (distance==0) { // use the minimum distance that does not result in an overlap @@ -1650,7 +1648,7 @@ void A_KillMaster(AActor * self) { if (self->master != NULL) { - P_DamageMobj(self->master, self, self, self->master->health, MOD_UNKNOWN, DMG_NO_ARMOR); + P_DamageMobj(self->master, self, self, self->master->health, NAME_None, DMG_NO_ARMOR); } } @@ -1668,7 +1666,7 @@ void A_KillChildren(AActor * self) { if (mo->master == self) { - P_DamageMobj(mo, self, self, mo->health, MOD_UNKNOWN, DMG_NO_ARMOR); + P_DamageMobj(mo, self, self, mo->health, NAME_None, DMG_NO_ARMOR); } } } @@ -1693,11 +1691,11 @@ void A_CountdownArg(AActor * self) } else if (self->flags&MF_SHOOTABLE) { - P_DamageMobj (self, NULL, NULL, self->health, MOD_UNKNOWN); + P_DamageMobj (self, NULL, NULL, self->health, NAME_None); } else { - self->SetState(self->DeathState); + self->SetState(self->FindState(NAME_Death)); } } diff --git a/src/version.h b/src/version.h index dda594111..e3126a999 100644 --- a/src/version.h +++ b/src/version.h @@ -54,7 +54,7 @@ // Version identifier for network games. // Bump it every time you do a release unless you're certain you // didn't change anything that will affect sync. -#define NETGAMEVERSION 210 +#define NETGAMEVERSION 211 // Version stored in the ini's [LastRun] section. // Bump it if you made some configuration change that you want to @@ -64,17 +64,17 @@ // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. // Otherwise, it should be safe to leave it alone. -#define DEMOGAMEVERSION 0x206 +#define DEMOGAMEVERSION 0x207 // Minimum demo version we can play. // Bump it whenever you change or remove existing DEM_ commands. -#define MINDEMOVERSION 0x205 +#define MINDEMOVERSION 0x207 // SAVEVER is the version of the information stored in level snapshots. // Note that SAVEVER is not directly comparable to VERSION. // SAVESIG should match SAVEVER. -#define SAVEVER 235 -#define SAVESIG "ZDOOMSAVE235" +#define SAVEVER 236 +#define SAVESIG "ZDOOMSAVE236" // This is so that derivates can use the same savegame versions without worrying about engine compatibility #define GAMESIG "ZDOOM" diff --git a/wadsrc/decorate/decorate.txt b/wadsrc/decorate/decorate.txt index d70c2b73f..0d55c3115 100644 --- a/wadsrc/decorate/decorate.txt +++ b/wadsrc/decorate/decorate.txt @@ -2,6 +2,13 @@ #include "actors/shared/debris.txt" #include "actors/shared/splashes.txt" +#include "actors/doom/possessed.txt" +#include "actors/doom/doomimp.txt" +#include "actors/doom/demon.txt" +#include "actors/doom/lostsoul.txt" +#include "actors/doom/cacodemon.txt" +#include "actors/doom/bruiser.txt" + #include "actors/doom/deadthings.txt" #include "actors/doom/doomammo.txt" #include "actors/doom/doomarmor.txt" diff --git a/wadsrc/decorate/doom/bruiser.txt b/wadsrc/decorate/doom/bruiser.txt new file mode 100644 index 000000000..b7fc48497 --- /dev/null +++ b/wadsrc/decorate/doom/bruiser.txt @@ -0,0 +1,135 @@ +//=========================================================================== +// +// Baron of Hell +// +//=========================================================================== +ACTOR BaronOfHell 3003 +{ + Game Doom + SpawnID 3 + Health 1000 + Radius 24 + Height 64 + Mass 1000 + Speed 8 + PainChance 50 + Monster + +FLOORCLIP + SeeSound "baron/sight" + PainSound "baron/pain" + DeathSound "baron/death" + ActiveSound "baron/active" + Obituary "$OB_BARON" + HitObituary "$OB_BARONHIT" + States + { + Spawn: + BOSS AB 10 A_Look + Loop + See: + BOSS AABBCCDD 3 A_Chase + Loop + Melee: + Missile: + BOSS EF 8 A_FaceTarget + BOSS G 8 A_BruisAttack + Goto See + Pain: + BOSS H 2 + BOSS H 2 A_Pain + Goto See + Death: + BOSS I 8 + BOSS J 8 A_Scream + BOSS K 8 + BOSS L 8 A_Fall + BOSS MN 8 + BOSS O -1 A_BossDeath + Stop + Raise: + BOSS O 8 + BOSS NMLKJI 8 + Goto See + } +} + +//=========================================================================== +// +// Hell Knight +// +//=========================================================================== +ACTOR HellKnight : BaronOfHell 69 +{ + Game Doom + SpawnID 113 + Health 500 + SeeSound "knight/sight" + ActiveSound "knight/active" + PainSound "knight/pain" + DeathSound "knight/death" + HitObituary "$OB_KNIGHTHIT" + Obituary "$OB_KNIGHT" + States + { + Spawn: + BOS2 AB 10 A_Look + Loop + See: + BOS2 AABBCCDD 3 A_Chase + Loop + Melee: + Missile: + BOS2 EF 8 A_FaceTarget + BOS2 G 8 A_BruisAttack + Goto See + Pain: + BOS2 H 2 + BOS2 H 2 A_Pain + Goto See + Death: + BOS2 I 8 + BOS2 J 8 A_Scream + BOS2 K 8 + BOS2 L 8 A_Fall + BOS2 MN 8 + BOS2 O -1 + Stop + Raise: + BOS2 O 8 + BOS2 NMLKJI 8 + Goto See + } +} + +//=========================================================================== +// +// Baron slime ball +// +//=========================================================================== +ACTOR BaronBall +{ + Game Doom + SpawnID 154 + Radius 6 + Height 16 + Speed 15 + FastSpeed 20 + Damage 8 + Projectile + +RANDOMIZE + RenderStyle Add + Alpha 1 + SeeSound "baron/attack" + DeathSound "baron/shotx" + Decal "BaronScorch" + States + { + Spawn: + BAL7 AB 4 BRIGHT + Loop + Death: + BAL7 CDE 6 BRIGHT + Stop + } +} + diff --git a/wadsrc/decorate/doom/cacodemon.txt b/wadsrc/decorate/doom/cacodemon.txt new file mode 100644 index 000000000..5c665edf4 --- /dev/null +++ b/wadsrc/decorate/doom/cacodemon.txt @@ -0,0 +1,88 @@ +//=========================================================================== +// +// Cacodemon +// +//=========================================================================== +ACTOR Cacodemon 3005 +{ + Game Doom + SpawnID 19 + Health 400 + Radius 31 + Height 56 + Mass 400 + Speed 8 + FastSpeed 20 + PainChance 128 + Monster + +FLOAT +NOGRAVITY + SeeSound "caco/sight" + PainSound "caco/pain" + DeathSound "caco/death" + ActiveSound "caco/active" + Obituary "$OB_CACO" + HitObituary "$OB_CACOHIT" + States + { + Spawn: + HEAD A 10 A_Look + Loop + See: + HEAD A 3 A_Chase + Loop + Melee: + Missile: + HEAD B 5 A_FaceTarget + HEAD C 5 A_FaceTarget + HEAD D 5 A_HeadAttack + Goto See + Pain: + HEAD E 3 + HEAD E 3 A_Pain + HEAD F 6 + Goto See + Death: + HEAD G 8 + HEAD H 8 A_Scream + HEAD I 8 + HEAD J 8 + HEAD K 8 A_Fall + HEAD L -1 A_SetFloorClip + Stop + Raise: + HEAD L 8 A_UnSetFloorClip + HEAD KJIHG 8 + Goto See + } +} + +//=========================================================================== +// +// Cacodemon plasma ball +// +//=========================================================================== +ACTOR CacodemonBall +{ + Game Doom + SpawnID 126 + Radius 6 + Height 8 + Speed 10 + FastSpeed 20 + Damage 5 + Projectile + +RANDOMIZE + RenderStyle Add + Alpha 1 + SeeSound "caco/attack" + DeathSound "caco/shotx" + States + { + Spawn: + BAL2 AB 4 BRIGHT + Loop + Death: + BAL2 CDE 6 BRIGHT + Stop + } +} diff --git a/wadsrc/decorate/doom/demon.txt b/wadsrc/decorate/doom/demon.txt new file mode 100644 index 000000000..b752bca8c --- /dev/null +++ b/wadsrc/decorate/doom/demon.txt @@ -0,0 +1,74 @@ +//=========================================================================== +// +// Pink Demon +// +//=========================================================================== +ACTOR Demon 3002 +{ + Game Doom + SpawnID 8 + Health 150 + PainChance 180 + Speed 10 + Radius 30 + Height 56 + Mass 400 + Monster + +FLOORCLIP +FASTER +FASTMELEE + SeeSound "demon/sight" + AttackSound "demon/melee" + PainSound "demon/pain" + DeathSound "demon/death" + ActiveSound "demon/active" + Obituary "$OB_DEMONHIT" + States + { + Spawn: + SARG AB 10 A_Look + Loop + See: + SARG AABBCCDD 2 A_Chase + Loop + Melee: + SARG EF 8 A_FaceTarget + SARG G 8 A_SargAttack + Goto See + Pain: + SARG H 2 + SARG H 2 A_Pain + Goto See + Death: + SARG I 8 + SARG J 8 A_Scream + SARG K 4 + SARG L 4 A_Fall + SARG M 4 + SARG N -1 + Stop + Raise: + SARG N 5 + SARG MLKJI 5 + Goto See + } +} + +//=========================================================================== +// +// Spectre +// +//=========================================================================== +ACTOR Spectre : Demon 58 +{ + SpawnID 9 + +SHADOW + RenderStyle OptFuzzy + Alpha 0.5 + SeeSound "spectre/sight" + AttackSound "spectre/melee" + PainSound "spectre/pain" + DeathSound "spectre/death" + ActiveSound "spectre/active" + HitObituary "$OB_SPECTREHIT" +} + + diff --git a/wadsrc/decorate/doom/doomimp.txt b/wadsrc/decorate/doom/doomimp.txt new file mode 100644 index 000000000..8628729b0 --- /dev/null +++ b/wadsrc/decorate/doom/doomimp.txt @@ -0,0 +1,90 @@ +//=========================================================================== +// +// Imp +// +//=========================================================================== +ACTOR DoomImp 3001 +{ + Game Doom + SpawnID 5 + Health 60 + Radius 20 + Height 56 + Mass 100 + Speed 8 + PainChance 200 + Monster + +FLOORCLIP + SeeSound "imp/sight" + PainSound "imp/pain" + DeathSound "imp/death" + ActiveSound "imp/active" + HitObituary "$OB_IMPHIT" + Obituary "$OB_IMP" + States + { + Spawn: + TROO AB 10 A_Look + Loop + See: + TROO AABBCCDD 3 A_Chase + Loop + Melee: + Missile: + TROO EF 8 A_FaceTarget + TROO G 6 A_TroopAttack + Goto See + Pain: + TROO H 2 + TROO H 2 A_Pain + Goto See + Death: + TROO I 8 + TROO J 8 A_Scream + TROO K 6 + TROO L 6 A_Fall + TROO M -1 + Stop + XDeath: + TROO N 5 + TROO O 5 A_XScream + TROO P 5 + TROO Q 5 A_Fall + TROO RST 5 + TROO U -1 + Stop + Raise: + TROO M 8 + TROO KLJI 8 + Goto See + } +} + +//=========================================================================== +// +// Imp fireball +// +//=========================================================================== +ACTOR DoomImpBall +{ + Radius 6 + Height 8 + Speed 10 + FastSpeed 20 + Damage 3 + Projectile + +RANDOMIZE + RenderStyle Add + Alpha 1 + SeeSound "imp/attack" + DeathSound "imp/shotx" + States + { + Spawn: + BAL1 AB 4 BRIGHT + Loop + Death: + BAL1 CDE 6 BRIGHT + Stop + } +} diff --git a/wadsrc/decorate/doom/lostsoul.txt b/wadsrc/decorate/doom/lostsoul.txt new file mode 100644 index 000000000..d0e913919 --- /dev/null +++ b/wadsrc/decorate/doom/lostsoul.txt @@ -0,0 +1,51 @@ +//=========================================================================== +// +// Lost Soul +// +//=========================================================================== +ACTOR LostSoul 3006 +{ + Game Doom + SpawnID 110 + Health 100 + Radius 16 + Height 56 + Mass 50 + Speed 8 + Damage 3 + PainChance 256 + Monster + +FLOAT +NOGRAVITY +MISSILEMORE +DONTFALL +NOICEDEATH + AttackSound "skull/melee" + PainSound "skull/pain" + DeathSound "skull/death" + ActiveSound "skull/active" + RenderStyle SoulTrans + Obituary "$OB_SKULL" + States + { + Spawn: + SKUL AB 10 BRIGHT A_Look + Loop + See: + SKUL AB 6 BRIGHT A_Chase + Loop + Missile: + SKUL C 10 BRIGHT A_FaceTarget + SKUL D 4 BRIGHT A_SkullAttack + SKUL CD 4 BRIGHT + Goto Missile+2 + Pain: + SKUL E 3 BRIGHT + SKUL E 3 BRIGHT A_Pain + Goto See + Death: + SKUL F 6 BRIGHT + SKUL G 6 BRIGHT A_Scream + SKUL H 6 BRIGHT + SKUL I 6 BRIGHT A_Fall + SKUL J 6 + SKUL K 6 + Stop + } +} diff --git a/wadsrc/decorate/doom/possessed.txt b/wadsrc/decorate/doom/possessed.txt new file mode 100644 index 000000000..26447b0f8 --- /dev/null +++ b/wadsrc/decorate/doom/possessed.txt @@ -0,0 +1,248 @@ + +//=========================================================================== +// +// Zombie man +// +//=========================================================================== +ACTOR ZombieMan 3004 +{ + Game Doom + SpawnID 4 + Health 20 + Radius 20 + Height 56 + Speed 8 + PainChance 200 + Monster + +FLOORCLIP + SeeSound "grunt/sight" + AttackSound "grunt/attack" + PainSound "grunt/pain" + DeathSound "grunt/death" + ActiveSound "grunt/active" + Obituary "$OB_ZOMBIE" + DropItem "Clip" + States + { + Spawn: + POSS AB 10 A_Look + Loop + See: + POSS AABBCCDD 4 A_Chase + Loop + Missile: + POSS E 10 A_FaceTarget + POSS F 8 A_PosAttack + POSS E 8 + Goto See + Pain: + POSS G 3 + POSS G 3 A_Pain + Goto See + Death: + POSS H 5 + POSS I 5 A_Scream + POSS J 5 A_Fall + POSS K 5 + POSS L -1 + Stop + XDeath: + POSS M 5 + POSS N 5 A_XScream + POSS O 5 A_Fall + POSS PQRST 5 + POSS U -1 + Stop + Raise: + POSS K 5 + POSS JIH 5 + Goto See + } +} + +//=========================================================================== +// +// Sergeant / Shotgun guy +// +//=========================================================================== +ACTOR ShotgunGuy 9 +{ + Game Doom + SpawnID 1 + Health 30 + Radius 20 + Height 56 + Mass 100 + Speed 8 + PainChance 170 + Monster + +FLOORCLIP + SeeSound "shotguy/sight" + AttackSound "shotguy/attack" + PainSound "shotguy/pain" + DeathSound "shotguy/death" + ActiveSound "shotguy/active" + Obituary "$OB_SHOTGUY" + DropItem "Shotgun" + States + { + Spawn: + SPOS AB 10 A_Look + Loop + See: + SPOS AABBCCDD 3 A_Chase + Loop + Missile: + SPOS E 10 A_FaceTarget + SPOS F 10 A_SposAttackUseAtkSound + SPOS E 10 + Goto See + Pain: + SPOS G 3 + SPOS G 3 A_Pain + Goto See + Death: + SPOS H 5 + SPOS I 5 A_Scream + SPOS J 5 A_Fall + SPOS K 5 + SPOS L -1 + Stop + XDeath: + SPOS M 5 + SPOS N 5 A_XScream + SPOS O 5 A_Fall + SPOS PQRST 5 + SPOS U -1 + Stop + Raise: + SPOS L 5 + SPOS KJIH 5 + Goto See + } +} + +//=========================================================================== +// +// Chaingunner +// +//=========================================================================== +ACTOR ChaingunGuy 65 +{ + Game Doom + SpawnID 2 + Health 70 + Radius 20 + Height 56 + Mass 100 + Speed 8 + PainChance 170 + Monster + +FLOORCLIP + SeeSound "chainguy/sight" + PainSound "chainguy/pain" + DeathSound "chainguy/death" + ActiveSound "chainguy/active" + AttackSound "chainguy/attack" + Obituary "$OB_CHAINGUY" + Dropitem "Chaingun" + States + { + Spawn: + CPOS AB 10 A_Look + Loop + See: + CPOS AABBCCDD 3 A_Chase + Loop + Missile: + CPOS E 10 A_FaceTarget + CPOS FE 4 A_CPosAttack + CPOS F 1 A_CPosRefire + Goto Missile+1 + Pain: + CPOS G 3 + CPOS G 3 A_Pain + Goto See + Death: + CPOS H 5 + CPOS I 5 A_Scream + CPOS J 5 A_Fall + CPOS KLM 5 + CPOS N -1 + Stop + XDeath: + CPOS O 5 + CPOS P 5 A_XScream + CPOS Q 5 A_Fall + CPOS RS 5 + CPOS T -1 + Stop + Raise: + CPOS N 5 + CPOS MLKJIH 5 + Goto See + } +} + +//=========================================================================== +// +// SS Nazi +// +//=========================================================================== +ACTOR WolfensteinSS 84 +{ + Game Doom + SpawnID 116 + Health 50 + Radius 20 + Height 56 + Speed 8 + PainChance 170 + Monster + +FLOORCLIP + SeeSound "wolfss/sight" + PainSound "wolfss/pain" + DeathSound "wolfss/death" + ActiveSound "wolfss/active" + AttackSound "wolfss/attack" + Dropitem "Clip" + States + { + Spawn: + SSWV AB 10 A_Look + Loop + See: + SSWV AABBCCDD 3 A_Chase + Loop + Missile: + SSWV E 10 A_FaceTarget + SSWV F 10 A_FaceTarget + SSWV G 4 A_CPosAttack + SSWV F 6 A_FaceTarget + SSWV G 4 A_CPosAttack + SSWV F 1 A_CPosRefire + Goto Missile+1 + Pain: + SSWV H 3 + SSWV H 3 A_Pain + Goto See + Death: + SSWV I 5 + SSWV J 5 A_Scream + SSWV K 5 A_Fall + SSWV L 5 + SSWV M -1 + Stop + XDeath: + SSWV N 5 + SSWV O 5 A_XScream + SSWV P 5 A_Fall + SSWV QRSTU 5 + SSWV V -1 + Stop + Raise: + SSWV M 5 + SSWV LKJI 5 + Goto See + } +} diff --git a/wadsrc/zdoom.lst b/wadsrc/zdoom.lst index 92b2ad2ba..f1b864c28 100644 --- a/wadsrc/zdoom.lst +++ b/wadsrc/zdoom.lst @@ -245,6 +245,13 @@ actors/shared/blood.txt decorate/shared/blood.txt actors/shared/debris.txt decorate/shared/debris.txt actors/shared/splashes.txt decorate/shared/splashes.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 +actors/doom/lostsoul.txt decorate/doom/lostsoul.txt +actors/doom/cacodemon.txt decorate/doom/cacodemon.txt +actors/doom/bruiser.txt decorate/doom/bruiser.txt + actors/doom/deadthings.txt decorate/doom/deadthings.txt actors/doom/doomammo.txt decorate/doom/doomammo.txt actors/doom/doomarmor.txt decorate/doom/doomarmor.txt