mirror of
https://github.com/chocolate-doom/research.git
synced 2024-11-28 15:02:44 +00:00
Add script to dump mobjinfo table.
Subversion-branch: /research Subversion-revision: 1853
This commit is contained in:
parent
0e1bee7889
commit
6aa2b4370a
6 changed files with 4534 additions and 22 deletions
|
@ -9,5 +9,6 @@ against the Heretic 1.0 tables and use these instead of the normal
|
|||
These are scripts to dump the internal tables for importing into Chocolate
|
||||
Heretic.
|
||||
|
||||
./dump-states ~/doom/hhe/heretic/heretic.exe 8bf04
|
||||
./dump-states heretic.exe 8bf04 > states.c
|
||||
./dump-mobjinfo heretic.exe 942ec > mobjinfo.c
|
||||
|
||||
|
|
75
heretic1.0/common.rb
Normal file
75
heretic1.0/common.rb
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
# 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
|
||||
}
|
||||
|
||||
SOUND_EFFECTS = %w{
|
||||
sfx_None sfx_gldhit sfx_gntful sfx_gnthit sfx_gntpow sfx_gntact
|
||||
sfx_gntuse sfx_phosht sfx_phohit sfx_phopow sfx_lobsht sfx_lobhit
|
||||
sfx_lobpow sfx_hrnsht sfx_hrnhit sfx_hrnpow sfx_ramphit sfx_ramrain
|
||||
sfx_bowsht sfx_stfhit sfx_stfpow sfx_stfcrk sfx_impsit sfx_impat1
|
||||
sfx_impat2 sfx_impdth sfx_impact sfx_imppai sfx_mumsit sfx_mumat1
|
||||
sfx_mumat2 sfx_mumdth sfx_mumact sfx_mumpai sfx_mumhed sfx_bstsit
|
||||
sfx_bstatk sfx_bstdth sfx_bstact sfx_bstpai sfx_clksit sfx_clkatk
|
||||
sfx_clkdth sfx_clkact sfx_clkpai sfx_snksit sfx_snkatk sfx_snkdth
|
||||
sfx_snkact sfx_snkpai sfx_kgtsit sfx_kgtatk sfx_kgtat2 sfx_kgtdth
|
||||
sfx_kgtact sfx_kgtpai sfx_wizsit sfx_wizatk sfx_wizdth sfx_wizact
|
||||
sfx_wizpai sfx_minsit sfx_minat1 sfx_minat2 sfx_minat3 sfx_mindth
|
||||
sfx_minact sfx_minpai sfx_hedsit sfx_hedat1 sfx_hedat2 sfx_hedat3
|
||||
sfx_heddth sfx_hedact sfx_hedpai sfx_sorzap sfx_sorrise sfx_sorsit
|
||||
sfx_soratk sfx_soract sfx_sorpai sfx_sordsph sfx_sordexp sfx_sordbon
|
||||
sfx_sbtsit sfx_sbtatk sfx_sbtdth sfx_sbtact sfx_sbtpai sfx_plroof
|
||||
sfx_plrpai sfx_plrdth sfx_gibdth sfx_plrwdth sfx_plrcdth sfx_itemup
|
||||
sfx_wpnup sfx_telept sfx_doropn sfx_dorcls sfx_dormov sfx_artiup
|
||||
sfx_switch sfx_pstart sfx_pstop sfx_stnmov sfx_chicpai sfx_chicatk
|
||||
sfx_chicdth sfx_chicact sfx_chicpk1 sfx_chicpk2 sfx_chicpk3 sfx_keyup
|
||||
sfx_ripslop sfx_newpod sfx_podexp sfx_bounce sfx_volsht sfx_volhit
|
||||
sfx_burn sfx_splash sfx_gloop sfx_respawn sfx_blssht sfx_blshit
|
||||
sfx_chat sfx_artiuse sfx_gfrag sfx_waterfl sfx_wind sfx_amb1 sfx_amb2
|
||||
sfx_amb3 sfx_amb4 sfx_amb5 sfx_amb6 sfx_amb7 sfx_amb8 sfx_amb9
|
||||
sfx_amb10 sfx_amb11
|
||||
}
|
||||
|
||||
MOBJINFO_FIELDS = %w{
|
||||
doomednum spawnstate spawnhealth seestate seesound reactiontime
|
||||
attacksound painstate painchance painsound meleestate missilestate
|
||||
crashstate deathstate xdeathstate deathsound speed radius height
|
||||
mass damage activesound flags flags2
|
||||
}
|
||||
|
||||
THING_FLAGS1 = %w{
|
||||
MF_SPECIAL MF_SOLID MF_SHOOTABLE MF_NOSECTOR
|
||||
MF_NOBLOCKMAP MF_AMBUSH MF_JUSTHIT MF_JUSTATTACKED
|
||||
MF_SPAWNCEILING MF_NOGRAVITY MF_DROPOFF MF_PICKUP
|
||||
MF_NOCLIP MF_SLIDE MF_FLOAT MF_TELEPORT
|
||||
MF_MISSILE MF_DROPPED MF_SHADOW MF_NOBLOOD
|
||||
MF_CORPSE MF_INFLOAT MF_COUNTKILL MF_COUNTITEM
|
||||
MF_SKULLFLY MF_NOTDMATCH MF_TRANS1 MF_TRANS2
|
||||
}
|
||||
|
||||
THING_FLAGS2 = %w{
|
||||
MF2_LOGRAV MF2_WINDTHRUST MF2_FLOORBOUNCE MF2_THRUGHOST
|
||||
MF2_FLY MF2_FOOTCLIP MF2_SPAWNFLOAT MF2_NOTELEPORT
|
||||
MF2_RIP MF2_PUSHABLE MF2_SLIDE MF2_ONMOBJ
|
||||
MF2_PASSMOBJ MF2_CANNOTPUSH MF2_FEETARECLIPPED MF2_BOSS
|
||||
MF2_FIREDAMAGE MF2_NODMGTHRUST MF2_TELESTOMP MF2_FLOATBOB
|
||||
MF2_DONTDRAW
|
||||
}
|
||||
|
103
heretic1.0/dump-mobjinfo
Executable file
103
heretic1.0/dump-mobjinfo
Executable file
|
@ -0,0 +1,103 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require "scanf"
|
||||
require "common.rb"
|
||||
|
||||
filename = ARGV[0]
|
||||
offset = ARGV[1].scanf("%x")[0]
|
||||
|
||||
NUM_MOBJS=161
|
||||
|
||||
def read_int(file)
|
||||
c1 = file.getc
|
||||
c2 = file.getc
|
||||
c3 = file.getc
|
||||
c4 = file.getc
|
||||
|
||||
c1 | (c2 << 8) | (c3 << 16) | (c4 << 24)
|
||||
end
|
||||
|
||||
def read_mobj(file)
|
||||
result = []
|
||||
|
||||
24.times do
|
||||
i = read_int(file)
|
||||
result.push(i)
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def parse_flags(value, flagnames)
|
||||
flags = []
|
||||
|
||||
for i in 0...32
|
||||
if (value & (1 << i)) != 0
|
||||
flags.push(flagnames[i])
|
||||
end
|
||||
end
|
||||
|
||||
if flags.length == 0
|
||||
return "0"
|
||||
else
|
||||
return flags.join(" | ")
|
||||
end
|
||||
end
|
||||
|
||||
def print_field(state, index)
|
||||
field_name = MOBJINFO_FIELDS[index]
|
||||
value = state[index]
|
||||
|
||||
if field_name =~ /sound$/
|
||||
value = SOUND_EFFECTS[value]
|
||||
elsif field_name == "doomednum"
|
||||
if value > (1 << 31)
|
||||
value -= (1 << 32)
|
||||
end
|
||||
elsif field_name =~ /speed|radius|height/ # fixed_t
|
||||
if value != 0 and ((value % 65536) == 0)
|
||||
value /= 65536
|
||||
|
||||
value = sprintf("%i * FRACUNIT", value)
|
||||
end
|
||||
elsif field_name == "flags"
|
||||
value = parse_flags(value, THING_FLAGS1)
|
||||
elsif field_name == "flags2"
|
||||
value = parse_flags(value, THING_FLAGS2)
|
||||
end
|
||||
|
||||
s = sprintf(" %s,", value)
|
||||
|
||||
printf "%s", s
|
||||
|
||||
if s.length < 32
|
||||
printf " " * (32 - s.length)
|
||||
else
|
||||
printf " "
|
||||
end
|
||||
|
||||
printf "// %s\n", field_name
|
||||
end
|
||||
|
||||
states = []
|
||||
|
||||
File.open(filename) do |file|
|
||||
file.seek(offset)
|
||||
|
||||
NUM_MOBJS.times do
|
||||
states.push(read_mobj(file))
|
||||
end
|
||||
end
|
||||
|
||||
puts "mobjinfo_t mobjinfo[] = {"
|
||||
puts
|
||||
|
||||
for state in states
|
||||
printf " {\n"
|
||||
for i in 0...24
|
||||
print_field(state, i)
|
||||
end
|
||||
printf " },\n"
|
||||
puts
|
||||
end
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require "scanf"
|
||||
require "common.rb"
|
||||
|
||||
filename = ARGV[0]
|
||||
offset = ARGV[1].scanf("%x")[0]
|
||||
|
@ -137,27 +138,6 @@ ACTION_POINTERS = {
|
|||
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
|
||||
|
|
4349
heretic1.0/mobjinfo.c
Normal file
4349
heretic1.0/mobjinfo.c
Normal file
File diff suppressed because it is too large
Load diff
4
heretic1.0/notes.txt
Normal file
4
heretic1.0/notes.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
mobjinfo differences in Heretic 1.0:
|
||||
|
||||
* extra object after MT_PHOENIXFX1 (MT_PHOENIXFX1.5?)
|
||||
|
Loading…
Reference in a new issue