From 08e0b1471b357ae22a632d1752919d973db8983e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 8 Feb 2010 19:18:48 +0000 Subject: Move action function prototypes in info.c into separate p_action.h header. Add table of action functions along with their location in the Heretic 1.0 executable, so that the "Action pointer" frame property can be set. Subversion-branch: /branches/raven-branch Subversion-revision: 1865 --- src/heretic/Makefile.am | 1 + src/heretic/deh_frame.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++-- src/heretic/info.c | 129 +--------------------------------- src/heretic/p_action.h | 160 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 338 insertions(+), 133 deletions(-) create mode 100644 src/heretic/p_action.h diff --git a/src/heretic/Makefile.am b/src/heretic/Makefile.am index 3fdd3ff7..081ca989 100644 --- a/src/heretic/Makefile.am +++ b/src/heretic/Makefile.am @@ -20,6 +20,7 @@ info.c info.h \ in_lude.c \ m_random.c m_random.h \ mn_menu.c \ + p_action.h \ p_ceilng.c \ p_doors.c \ p_enemy.c \ diff --git a/src/heretic/deh_frame.c b/src/heretic/deh_frame.c index 7dfb5aab..6ec62ae7 100644 --- a/src/heretic/deh_frame.c +++ b/src/heretic/deh_frame.c @@ -36,6 +36,145 @@ #include "deh_mapping.h" #include "deh_htic.h" +#include "p_action.h" + +// Offsets of action pointers within the Heretic 1.0 executable. +// (Seriously Greg, was this really necessary? What was wrong with the +// "copying action pointer from another frame" technique used in dehacked?) + +static const struct +{ + int offset; + void (*func)(); +} action_ptrs[] = { + { 0, NULL }, + { 69200, A_Look }, + { 69328, A_Chase }, + { 69872, A_FaceTarget }, + { 69984, A_Pain }, + { 70016, A_DripBlood }, + { 70160, A_KnightAttack }, + { 70304, A_ImpExplode }, + { 70480, A_BeastPuff }, + { 70592, A_ImpMeAttack }, + { 70672, A_ImpMsAttack }, + { 70880, A_ImpMsAttack2 }, + { 70976, A_ImpDeath }, + { 71024, A_ImpXDeath1 }, + { 71072, A_ImpXDeath2 }, + { 71376, A_ChicAttack }, + { 71456, A_ChicLook }, + { 71488, A_ChicChase }, + { 71520, A_ChicPain }, + { 71568, A_Feathers }, + { 71808, A_MummyAttack }, + { 71920, A_MummyAttack2 }, + { 72016, A_MummyFX1Seek }, + { 72048, A_MummySoul }, + { 72096, A_Sor1Pain }, + { 72144, A_Sor1Chase }, + { 72192, A_Srcr1Attack }, + { 72480, A_SorcererRise }, + { 72816, A_Srcr2Decide }, + { 72896, A_Srcr2Attack }, + { 73120, A_BlueSpark }, + { 73232, A_GenWizard }, + { 73392, A_Sor2DthInit }, + { 73424, A_Sor2DthLoop }, + { 73456, A_SorZap }, + { 73488, A_SorRise }, + { 73520, A_SorDSph }, + { 73552, A_SorDExp }, + { 73584, A_SorDBon }, + { 73616, A_SorSightSnd }, + { 73648, A_MinotaurAtk1 }, + { 73760, A_MinotaurDecide }, + { 74032, A_MinotaurCharge }, + { 74112, A_MinotaurAtk2 }, + { 74352, A_MinotaurAtk3 }, + { 74528, A_MntrFloorFire }, + { 74640, A_BeastAttack }, + { 74752, A_HeadAttack }, + { 75168, A_WhirlwindSeek }, + { 75328, A_HeadIceImpact }, + { 75488, A_HeadFireGrow }, + { 75632, A_SnakeAttack }, + { 75712, A_SnakeAttack2 }, + { 75792, A_ClinkAttack }, + { 75872, A_GhostOff }, + { 75888, A_WizAtk1 }, + { 75920, A_WizAtk2 }, + { 75952, A_WizAtk3 }, + { 76144, A_Scream }, + { 76400, A_NoBlocking }, + { 76784, A_Explode }, + { 76896, A_PodPain }, + { 77056, A_RemovePod }, + { 77104, A_MakePod }, + { 77344, A_BossDeath }, + { 77472, A_ESound }, + { 77520, A_SpawnTeleGlitter }, + { 77600, A_SpawnTeleGlitter2 }, + { 77680, A_AccTeleGlitter }, + { 77728, A_InitKeyGizmo }, + { 77824, A_VolcanoSet }, + { 77856, A_VolcanoBlast }, + { 78080, A_VolcBallImpact }, + { 78288, A_SkullPop }, + { 78448, A_CheckSkullFloor }, + { 78480, A_CheckSkullDone }, + { 78512, A_FreeTargMobj }, + { 78608, A_AddPlayerCorpse }, + { 78704, A_FlameSnd }, + { 78736, A_HideThing }, + { 78752, A_UnHideThing }, + { 81952, A_RestoreArtifact }, + { 82048, A_RestoreSpecialThing1 }, + { 82128, A_RestoreSpecialThing2 }, + { 108432, A_ContMobjSound }, + { 111168, A_WeaponReady }, + { 111568, A_BeakReady }, + { 111696, A_ReFire }, + { 111760, A_Lower }, + { 111856, A_BeakRaise }, + { 111920, A_Raise }, + { 112272, A_BeakAttackPL1 }, + { 112448, A_BeakAttackPL2 }, + { 112640, A_StaffAttackPL1 }, + { 112784, A_StaffAttackPL2 }, + { 112928, A_FireBlasterPL1 }, + { 113072, A_FireBlasterPL2 }, + { 113152, A_FireGoldWandPL1 }, + { 113296, A_FireGoldWandPL2 }, + { 113760, A_FireMacePL1 }, + { 113904, A_MacePL1Check }, + { 114032, A_MaceBallImpact }, + { 114192, A_MaceBallImpact2 }, + { 114624, A_FireMacePL2 }, + { 114752, A_DeathBallImpact }, + { 115088, A_SpawnRippers }, + { 115232, A_FireCrossbowPL1 }, + { 115312, A_FireCrossbowPL2 }, + { 115456, A_BoltSpark }, + { 115568, A_FireSkullRodPL1 }, + { 115648, A_FireSkullRodPL2 }, + { 115776, A_SkullRodPL2Seek }, + { 115808, A_AddPlayerRain }, + { 115984, A_SkullRodStorm }, + { 116272, A_RainImpact }, + { 116336, A_HideInCeiling }, + { 116368, A_FirePhoenixPL1 }, + { 116480, A_RemovedPhoenixFunc }, + { 116496, A_PhoenixPuff }, + { 116720, A_InitPhoenixPL2 }, + { 116736, A_FirePhoenixPL2 }, + { 117104, A_ShutdownPhoenixPL2 }, + { 117120, A_FlameEnd }, + { 117152, A_FloatPuff }, + { 117184, A_GauntletAttack }, + { 117648, A_Light0 } +}; + DEH_BEGIN_MAPPING(state_mapping, state_t) DEH_MAPPING("Sprite number", sprite) DEH_MAPPING("Sprite subnumber", frame) @@ -43,7 +182,6 @@ DEH_BEGIN_MAPPING(state_mapping, state_t) DEH_MAPPING("Next frame", nextstate) DEH_MAPPING("Unknown 1", misc1) DEH_MAPPING("Unknown 2", misc2) - DEH_UNSUPPORTED_MAPPING("Action pointer") DEH_END_MAPPING // When a HHE patch is first loaded, we must apply a small change @@ -87,6 +225,22 @@ static void *DEH_FrameStart(deh_context_t *context, char *line) return state; } +static boolean GetActionPointerForOffset(int offset, void **result) +{ + int i; + + for (i=0; iaction = func; } + else + { + // "Next frame" numbers need to undergo mapping. - DEH_SetMapping(context, &state_mapping, state, variable_name, ivalue); + if (!strcasecmp(variable_name, "Next frame")) + { + ivalue = DEH_MapHereticFrameNumber(ivalue); + } + + DEH_SetMapping(context, &state_mapping, state, variable_name, ivalue); + } } static void DEH_FrameMD5Sum(md5_context_t *context) diff --git a/src/heretic/info.c b/src/heretic/info.c index 7149220e..b6dd921f 100644 --- a/src/heretic/info.c +++ b/src/heretic/info.c @@ -22,7 +22,7 @@ // //----------------------------------------------------------------------------- #include "doomdef.h" -// generated by multigen +#include "p_action.h" char *sprnames[] = { "IMPX","ACLO","PTN1","SHLD","SHD2","BAGH","SPMP","INVS","PTN2","SOAR", @@ -41,133 +41,6 @@ char *sprnames[] = { NULL }; -void A_FreeTargMobj(); -void A_RestoreSpecialThing1(); -void A_RestoreSpecialThing2(); -void A_HideThing(); -void A_UnHideThing(); -void A_RestoreArtifact(); -void A_Scream(); -void A_Explode(); -void A_PodPain(); -void A_RemovePod(); -void A_MakePod(); -void A_InitKeyGizmo(); -void A_VolcanoSet(); -void A_VolcanoBlast(); -void A_BeastPuff(); -void A_VolcBallImpact(); -void A_SpawnTeleGlitter(); -void A_SpawnTeleGlitter2(); -void A_AccTeleGlitter(); -void A_Light0(); -void A_WeaponReady(); -void A_Lower(); -void A_Raise(); -void A_StaffAttackPL1(); -void A_ReFire(); -void A_StaffAttackPL2(); -void A_BeakReady(); -void A_BeakRaise(); -void A_BeakAttackPL1(); -void A_BeakAttackPL2(); -void A_GauntletAttack(); -void A_FireBlasterPL1(); -void A_FireBlasterPL2(); -void A_SpawnRippers(); -void A_FireMacePL1(); -void A_FireMacePL2(); -void A_MacePL1Check(); -void A_MaceBallImpact(); -void A_MaceBallImpact2(); -void A_DeathBallImpact(); -void A_FireSkullRodPL1(); -void A_FireSkullRodPL2(); -void A_SkullRodPL2Seek(); -void A_AddPlayerRain(); -void A_HideInCeiling(); -void A_SkullRodStorm(); -void A_RainImpact(); -void A_FireGoldWandPL1(); -void A_FireGoldWandPL2(); -void A_FirePhoenixPL1(); -void A_InitPhoenixPL2(); -void A_FirePhoenixPL2(); -void A_ShutdownPhoenixPL2(); -void A_PhoenixPuff(); -void A_RemovedPhoenixFunc(); -void A_FlameEnd(); -void A_FloatPuff(); -void A_FireCrossbowPL1(); -void A_FireCrossbowPL2(); -void A_BoltSpark(); -void A_Pain(); -void A_NoBlocking(); -void A_AddPlayerCorpse(); -void A_SkullPop(); -void A_FlameSnd(); -void A_CheckBurnGone(); -void A_CheckSkullFloor(); -void A_CheckSkullDone(); -void A_Feathers(); -void A_ChicLook(); -void A_ChicChase(); -void A_ChicPain(); -void A_FaceTarget(); -void A_ChicAttack(); -void A_Look(); -void A_Chase(); -void A_MummyAttack(); -void A_MummyAttack2(); -void A_MummySoul(); -void A_ContMobjSound(); -void A_MummyFX1Seek(); -void A_BeastAttack(); -void A_SnakeAttack(); -void A_SnakeAttack2(); -void A_HeadAttack(); -void A_BossDeath(); -void A_HeadIceImpact(); -void A_HeadFireGrow(); -void A_WhirlwindSeek(); -void A_ClinkAttack(); -void A_WizAtk1(); -void A_WizAtk2(); -void A_WizAtk3(); -void A_GhostOff(); -void A_ImpMeAttack(); -void A_ImpMsAttack(); -void A_ImpMsAttack2(); -void A_ImpDeath(); -void A_ImpXDeath1(); -void A_ImpXDeath2(); -void A_ImpExplode(); -void A_KnightAttack(); -void A_DripBlood(); -void A_Sor1Chase(); -void A_Sor1Pain(); -void A_Srcr1Attack(); -void A_SorZap(); -void A_SorcererRise(); -void A_SorRise(); -void A_SorSightSnd(); -void A_Srcr2Decide(); -void A_Srcr2Attack(); -void A_Sor2DthInit(); -void A_SorDSph(); -void A_Sor2DthLoop(); -void A_SorDExp(); -void A_SorDBon(); -void A_BlueSpark(); -void A_GenWizard(); -void A_MinotaurAtk1(); -void A_MinotaurDecide(); -void A_MinotaurAtk2(); -void A_MinotaurAtk3(); -void A_MinotaurCharge(); -void A_MntrFloorFire(); -void A_ESound(); - state_t states[NUMSTATES] = { {SPR_IMPX, 0, -1, NULL, S_NULL, 0, 0}, // S_NULL {SPR_ACLO, 4, 1050, A_FreeTargMobj, S_NULL, 0, 0}, // S_FREETARGMOBJ diff --git a/src/heretic/p_action.h b/src/heretic/p_action.h new file mode 100644 index 00000000..8d8e383c --- /dev/null +++ b/src/heretic/p_action.h @@ -0,0 +1,160 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 1993-2008 Raven Software +// Copyright(C) 2008 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- +// +// External definitions for action pointer functions. +// +//----------------------------------------------------------------------------- + +#ifndef HERETIC_P_ACTION_H +#define HERETIC_P_ACTION_H + +void A_FreeTargMobj(); +void A_RestoreSpecialThing1(); +void A_RestoreSpecialThing2(); +void A_HideThing(); +void A_UnHideThing(); +void A_RestoreArtifact(); +void A_Scream(); +void A_Explode(); +void A_PodPain(); +void A_RemovePod(); +void A_MakePod(); +void A_InitKeyGizmo(); +void A_VolcanoSet(); +void A_VolcanoBlast(); +void A_BeastPuff(); +void A_VolcBallImpact(); +void A_SpawnTeleGlitter(); +void A_SpawnTeleGlitter2(); +void A_AccTeleGlitter(); +void A_Light0(); +void A_WeaponReady(); +void A_Lower(); +void A_Raise(); +void A_StaffAttackPL1(); +void A_ReFire(); +void A_StaffAttackPL2(); +void A_BeakReady(); +void A_BeakRaise(); +void A_BeakAttackPL1(); +void A_BeakAttackPL2(); +void A_GauntletAttack(); +void A_FireBlasterPL1(); +void A_FireBlasterPL2(); +void A_SpawnRippers(); +void A_FireMacePL1(); +void A_FireMacePL2(); +void A_MacePL1Check(); +void A_MaceBallImpact(); +void A_MaceBallImpact2(); +void A_DeathBallImpact(); +void A_FireSkullRodPL1(); +void A_FireSkullRodPL2(); +void A_SkullRodPL2Seek(); +void A_AddPlayerRain(); +void A_HideInCeiling(); +void A_SkullRodStorm(); +void A_RainImpact(); +void A_FireGoldWandPL1(); +void A_FireGoldWandPL2(); +void A_FirePhoenixPL1(); +void A_InitPhoenixPL2(); +void A_FirePhoenixPL2(); +void A_ShutdownPhoenixPL2(); +void A_PhoenixPuff(); +void A_RemovedPhoenixFunc(); +void A_FlameEnd(); +void A_FloatPuff(); +void A_FireCrossbowPL1(); +void A_FireCrossbowPL2(); +void A_BoltSpark(); +void A_Pain(); +void A_NoBlocking(); +void A_AddPlayerCorpse(); +void A_SkullPop(); +void A_FlameSnd(); +void A_CheckBurnGone(); +void A_CheckSkullFloor(); +void A_CheckSkullDone(); +void A_Feathers(); +void A_ChicLook(); +void A_ChicChase(); +void A_ChicPain(); +void A_FaceTarget(); +void A_ChicAttack(); +void A_Look(); +void A_Chase(); +void A_MummyAttack(); +void A_MummyAttack2(); +void A_MummySoul(); +void A_ContMobjSound(); +void A_MummyFX1Seek(); +void A_BeastAttack(); +void A_SnakeAttack(); +void A_SnakeAttack2(); +void A_HeadAttack(); +void A_BossDeath(); +void A_HeadIceImpact(); +void A_HeadFireGrow(); +void A_WhirlwindSeek(); +void A_ClinkAttack(); +void A_WizAtk1(); +void A_WizAtk2(); +void A_WizAtk3(); +void A_GhostOff(); +void A_ImpMeAttack(); +void A_ImpMsAttack(); +void A_ImpMsAttack2(); +void A_ImpDeath(); +void A_ImpXDeath1(); +void A_ImpXDeath2(); +void A_ImpExplode(); +void A_KnightAttack(); +void A_DripBlood(); +void A_Sor1Chase(); +void A_Sor1Pain(); +void A_Srcr1Attack(); +void A_SorZap(); +void A_SorcererRise(); +void A_SorRise(); +void A_SorSightSnd(); +void A_Srcr2Decide(); +void A_Srcr2Attack(); +void A_Sor2DthInit(); +void A_SorDSph(); +void A_Sor2DthLoop(); +void A_SorDExp(); +void A_SorDBon(); +void A_BlueSpark(); +void A_GenWizard(); +void A_MinotaurAtk1(); +void A_MinotaurDecide(); +void A_MinotaurAtk2(); +void A_MinotaurAtk3(); +void A_MinotaurCharge(); +void A_MntrFloorFire(); +void A_ESound(); + +#endif /* #ifndef HERETIC_P_ACTION_H */ + -- cgit v1.2.3