Add initial Heretic 1.0 state dumping script.

Subversion-branch: /research
Subversion-revision: 1852
This commit is contained in:
Simon Howard 2010-02-06 22:35:06 +00:00
parent 8dfb24ef9b
commit 0e1bee7889
3 changed files with 1462 additions and 0 deletions

13
heretic1.0/README Normal file
View File

@ -0,0 +1,13 @@
This research is for the purpose of adding HHE support to Chocolate Heretic
(raven-branch). However, this is complicated by the fact that the DOS HHE
executable only worked with Heretic v1.0. Furthermore, the internal state
tables changed between Heretic v1.0 and the final v1.3. In order for loading
of HHE patches to be supported, it is therefore necessary to apply patches
against the Heretic 1.0 tables and use these instead of the normal
(v1.3) tables.
These are scripts to dump the internal tables for importing into Chocolate
Heretic.
./dump-states ~/doom/hhe/heretic/heretic.exe 8bf04

241
heretic1.0/dump-states Executable file
View File

@ -0,0 +1,241 @@
#!/usr/bin/env ruby
require "scanf"
filename = ARGV[0]
offset = ARGV[1].scanf("%x")[0]
NUM_STATES=1206
# Locations of action pointer functions for Heretic 1.0. Hand-constructed.
ACTION_POINTERS = {
78512 => "A_FreeTargMobj",
82048 => "A_RestoreSpecialThing1",
82128 => "A_RestoreSpecialThing2",
78736 => "A_HideThing",
78752 => "A_UnHideThing",
81952 => "A_RestoreArtifact",
76144 => "A_Scream",
76784 => "A_Explode",
76896 => "A_PodPain",
77056 => "A_RemovePod",
77104 => "A_MakePod",
77728 => "A_InitKeyGizmo",
77824 => "A_VolcanoSet",
77856 => "A_VolcanoBlast",
70480 => "A_BeastPuff",
78080 => "A_VolcBallImpact",
77520 => "A_SpawnTeleGlitter",
77600 => "A_SpawnTeleGlitter2",
77680 => "A_AccTeleGlitter",
117648 => "A_Light0",
111168 => "A_WeaponReady",
111760 => "A_Lower",
111920 => "A_Raise",
112640 => "A_StaffAttackPL1",
111696 => "A_ReFire",
112784 => "A_StaffAttackPL2",
111568 => "A_BeakReady",
111856 => "A_BeakRaise",
112272 => "A_BeakAttackPL1",
112448 => "A_BeakAttackPL2",
117184 => "A_GauntletAttack",
112928 => "A_FireBlasterPL1",
113072 => "A_FireBlasterPL2",
115088 => "A_SpawnRippers",
113760 => "A_FireMacePL1",
114624 => "A_FireMacePL2",
113904 => "A_MacePL1Check",
114032 => "A_MaceBallImpact",
114192 => "A_MaceBallImpact2",
114752 => "A_DeathBallImpact",
115568 => "A_FireSkullRodPL1",
115648 => "A_FireSkullRodPL2",
115776 => "A_SkullRodPL2Seek",
115808 => "A_AddPlayerRain",
116336 => "A_HideInCeiling",
115984 => "A_SkullRodStorm",
116272 => "A_RainImpact",
113152 => "A_FireGoldenWandPL1",
113296 => "A_FireGoldenWandPL2",
116368 => "A_FirePhoenixPL1",
116720 => "A_InitPhoenixPL2",
116736 => "A_FirePhoenixPL2",
117104 => "A_ShutdownPhoenixPL2",
116496 => "A_PhoenixPuff",
116480 => "???? DONT KNOW YET",
117120 => "A_FlameEnd",
117152 => "A_FloatPuff",
115232 => "A_FireCrossbowPL1",
115312 => "A_FireCrossbowPL2",
115456 => "A_BoltSpark",
69984 => "A_Pain",
76400 => "A_NoBlocking",
78608 => "A_AddPlayerCorpse",
78288 => "A_SkullPop",
78704 => "A_FlameSnd",
78448 => "A_CheckSkullFloor",
78480 => "A_CheckSkullDone",
71568 => "A_Feathers",
71456 => "A_ChicLook",
71488 => "A_ChicChase",
71520 => "A_ChicPain",
69872 => "A_FaceTarget",
71376 => "A_ChicAttack",
69200 => "A_Look",
69328 => "A_Chase",
71808 => "A_MummyAttack",
71920 => "A_MummyAttack2",
72048 => "A_MummySoul",
108432 => "A_ContMobjSound",
72016 => "A_MummyFX1Seek",
74640 => "A_BeastAttack",
75632 => "A_SnakeAttack",
75712 => "A_SnakeAttack2",
74752 => "A_HeadAttack",
77344 => "A_BossDeath",
75328 => "A_HeadIceImpact",
75488 => "A_HeadFireGrow",
75168 => "A_WhirlwindSeek",
75792 => "A_ClinkAttack",
75888 => "A_WizAtk1",
75920 => "A_WizAtk2",
75952 => "A_WizAtk3",
75872 => "A_GhostOff",
70592 => "A_ImpMeAttack",
70672 => "A_ImpMsAttack",
70880 => "A_ImpMsAttack2",
70976 => "A_ImpDeath",
71024 => "A_ImpXDeath1",
71072 => "A_ImpXDeath2",
70304 => "A_ImpExplode",
70160 => "A_KnightAttack",
70016 => "A_DripBlood",
72144 => "A_Sor1Chase",
72096 => "A_Sor1Pain",
72192 => "A_Srcr1Attack",
73456 => "A_SorZap",
72480 => "A_SorcererRise",
73488 => "A_SorRise",
73616 => "A_SorSightSnd",
72816 => "A_Srcr2Decide",
72896 => "A_Srcr2Attack",
73392 => "A_Sor2DthInit",
73520 => "A_SorDSph",
73424 => "A_Sor2DthLoop",
73552 => "A_SorDExp",
73584 => "A_SorDBon",
73120 => "A_BlueSpark",
73232 => "A_GenWizard",
73648 => "A_MinotaurAtk1",
73760 => "A_MinotaurDecide",
74112 => "A_MinotaurAtk2",
74352 => "A_MinotaurAtk3",
74032 => "A_MinotaurCharge",
74528 => "A_MntrFloorFire",
77472 => "A_ESound",
}
# Symbolic sprite names, from info.h.
SPRITE_NAMES = %w{
SPR_IMPX SPR_ACLO SPR_PTN1 SPR_SHLD SPR_SHD2 SPR_BAGH SPR_SPMP SPR_INVS
SPR_PTN2 SPR_SOAR SPR_INVU SPR_PWBK SPR_EGGC SPR_EGGM SPR_FX01 SPR_SPHL
SPR_TRCH SPR_FBMB SPR_XPL1 SPR_ATLP SPR_PPOD SPR_AMG1 SPR_SPSH SPR_LVAS
SPR_SLDG SPR_SKH1 SPR_SKH2 SPR_SKH3 SPR_SKH4 SPR_CHDL SPR_SRTC SPR_SMPL
SPR_STGS SPR_STGL SPR_STCS SPR_STCL SPR_KFR1 SPR_BARL SPR_BRPL SPR_MOS1
SPR_MOS2 SPR_WTRH SPR_HCOR SPR_KGZ1 SPR_KGZB SPR_KGZG SPR_KGZY SPR_VLCO
SPR_VFBL SPR_VTFB SPR_SFFI SPR_TGLT SPR_TELE SPR_STFF SPR_PUF3 SPR_PUF4
SPR_BEAK SPR_WGNT SPR_GAUN SPR_PUF1 SPR_WBLS SPR_BLSR SPR_FX18 SPR_FX17
SPR_WMCE SPR_MACE SPR_FX02 SPR_WSKL SPR_HROD SPR_FX00 SPR_FX20 SPR_FX21
SPR_FX22 SPR_FX23 SPR_GWND SPR_PUF2 SPR_WPHX SPR_PHNX SPR_FX04 SPR_FX08
SPR_FX09 SPR_WBOW SPR_CRBW SPR_FX03 SPR_BLOD SPR_PLAY SPR_FDTH SPR_BSKL
SPR_CHKN SPR_MUMM SPR_FX15 SPR_BEAS SPR_FRB1 SPR_SNKE SPR_SNFX SPR_HEAD
SPR_FX05 SPR_FX06 SPR_FX07 SPR_CLNK SPR_WZRD SPR_FX11 SPR_FX10 SPR_KNIG
SPR_SPAX SPR_RAXE SPR_SRCR SPR_FX14 SPR_SOR2 SPR_SDTH SPR_FX16 SPR_MNTR
SPR_FX12 SPR_FX13 SPR_AKYY SPR_BKYY SPR_CKYY SPR_AMG2 SPR_AMM1 SPR_AMM2
SPR_AMC1 SPR_AMC2 SPR_AMS1 SPR_AMS2 SPR_AMP1 SPR_AMP2 SPR_AMB1 SPR_AMB2
}
def read_int(file)
c1 = file.getc
c2 = file.getc
c3 = file.getc
c4 = file.getc
result = c1 | (c2 << 8) | (c3 << 16) | (c4 << 24)
if result > (1 << 31)
result -= (1 << 32)
end
result
end
def read_state(file)
result = {}
result[:spritenum] = read_int(file)
result[:frame] = read_int(file)
result[:tics] = read_int(file)
result[:action] = read_int(file)
result[:nextstate] = read_int(file)
result[:misc1] = read_int(file)
result[:misc2] = read_int(file)
result
end
def action_pointer_to_s(action_ptr)
# NULL pointer?
if action_ptr == 0
return "NULL"
end
if ACTION_POINTERS[action_ptr] == nil
raise "Action pointer #{action_ptr} unknown!"
end
return ACTION_POINTERS[action_ptr]
end
states = []
File.open(filename) do |file|
file.seek(offset)
NUM_STATES.times do
states.push(read_state(file))
end
end
puts "state_t states[] = {"
for state_num in 0...NUM_STATES
state = states[state_num]
record = sprintf("{%s, %i, %i, %s, %i, %i, %i },",
SPRITE_NAMES[state[:spritenum]],
state[:frame],
state[:tics],
action_pointer_to_s(state[:action]),
state[:nextstate],
state[:misc1],
state[:misc2])
printf " %s", record
padding = 55 - record.length
printf " " * padding
printf "// state #%i", state_num
printf "\n"
end
puts "};"

1208
heretic1.0/states.c Normal file

File diff suppressed because it is too large Load Diff