summaryrefslogtreecommitdiff
path: root/src/heretic/deh_frame.c
diff options
context:
space:
mode:
authorSimon Howard2010-02-08 19:18:48 +0000
committerSimon Howard2010-02-08 19:18:48 +0000
commit08e0b1471b357ae22a632d1752919d973db8983e (patch)
tree4e26c344afdbc0626e9a688882f26298a18d4470 /src/heretic/deh_frame.c
parent9769464ecf7ae3c92c628deed8164b61f567923a (diff)
downloadchocolate-doom-08e0b1471b357ae22a632d1752919d973db8983e.tar.gz
chocolate-doom-08e0b1471b357ae22a632d1752919d973db8983e.tar.bz2
chocolate-doom-08e0b1471b357ae22a632d1752919d973db8983e.zip
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
Diffstat (limited to 'src/heretic/deh_frame.c')
-rw-r--r--src/heretic/deh_frame.c181
1 files changed, 176 insertions, 5 deletions
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; i<arrlen(action_ptrs); ++i)
+ {
+ if (action_ptrs[i].offset == offset)
+ {
+ *result = action_ptrs[i].func;
+ return true;
+ }
+ }
+
+ return false;
+}
+
static void DEH_FrameParseLine(deh_context_t *context, char *line, void *tag)
{
state_t *state;
@@ -112,14 +266,31 @@ static void DEH_FrameParseLine(deh_context_t *context, char *line, void *tag)
ivalue = atoi(value);
- // "Next frame" numbers need to undergo mapping.
+ // Action pointer field is a special case:
- if (!strcasecmp(variable_name, "Next frame"))
+ if (!strcasecmp(variable_name, "Action pointer"))
{
- ivalue = DEH_MapHereticFrameNumber(ivalue);
+ void *func;
+
+ if (!GetActionPointerForOffset(ivalue, &func))
+ {
+ DEH_Warning(context, "Unknown action pointer: %i", ivalue);
+ return;
+ }
+
+ state->action = 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)