From 58b93619277375a126d6a8505023707ba3c2cc1e Mon Sep 17 00:00:00 2001 From: mcmartin Date: Wed, 6 Feb 2008 10:08:57 +0000 Subject: [PATCH] Final preparation for the replacement of integer-based resources. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2918 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/content/lastbat.ls2 | 1 + sc2/content/uqm.rmp | 5 - sc2/src/sc2code/ikey_con.h | 3 +- sc2/src/sc2code/ships/lastbat/imusicre.h | 2 +- sc2/src/sc2code/ships/lastbat/istrtab.h | 2 +- sc2/src/sc2code/ships/probe/istrtab.h | 4 - tools/resmap/resid_generated.py | 280 +++++++++++++++++++++++ 7 files changed, 284 insertions(+), 13 deletions(-) create mode 100755 tools/resmap/resid_generated.py diff --git a/sc2/content/lastbat.ls2 b/sc2/content/lastbat.ls2 index e31466f2c..125aff131 100644 --- a/sc2/content/lastbat.ls2 +++ b/sc2/content/lastbat.ls2 @@ -1,6 +1,7 @@ 1 0 8 ship.lastbat.code 2 0 2 ship.lastbat.graphics.lastbat.large 2 0 5 ship.lastbat.sounds + 2 0 6 ship.lastbat.ditty 2 1 2 ship.lastbat.graphics.lastbat.medium 2 2 2 ship.lastbat.graphics.lastbat.small 2 3 2 ship.lastbat.graphics.sen.large diff --git a/sc2/content/uqm.rmp b/sc2/content/uqm.rmp index 1c6dca7ae..c55b63f07 100644 --- a/sc2/content/uqm.rmp +++ b/sc2/content/uqm.rmp @@ -93,7 +93,6 @@ comm.spathi.graphics = GFXRES:comm/spathi/spathi.ani comm.spathi.music = MUSICRES:comm/spathi/spathi.mod comm.spathi.resources = RES_INDEX:comm/spathi.ls2 comm.starbase.dialogue = STRTAB:comm/starbas/starbas.txt -comm.starbase.music = MUSICRES:comm/starbas/starbas.ogg comm.supox.colortable = STRTAB:comm/supox/supox.ct comm.supox.dialogue = STRTAB:comm/supox/supox.txt comm.supox.font = FONTRES:comm/supox/supox.fon @@ -136,7 +135,6 @@ comm.utwig.font = FONTRES:comm/utwig/utwig.fon comm.utwig.graphics = GFXRES:comm/utwig/utwig.ani comm.utwig.music = MUSICRES:comm/utwig/utwig.mod comm.utwig.resources = RES_INDEX:comm/utwig.ls2 -comm.utwigult.music = MUSICRES:comm/utwig/utwigult.ogg comm.vux.colortable = STRTAB:comm/vux/vux.ct comm.vux.dialogue = STRTAB:comm/vux/vux.txt comm.vux.font = FONTRES:comm/vux/vux.fon @@ -149,7 +147,6 @@ comm.yehat.font = FONTRES:comm/yehat/yehat.fon comm.yehat.graphics = GFXRES:comm/yehat/yehat.ani comm.yehat.music = MUSICRES:comm/yehat/yehat.mod comm.yehat.rebel.dialogue = STRTAB:comm/rebel/rebel.txt -comm.yehat.rebel.music = MUSICRES:comm/rebel/rebel.ogg comm.yehat.resources = RES_INDEX:comm/yehat.ls2 comm.zoqfotpik.colortable = STRTAB:comm/zoqfot/zoqfot.ct comm.zoqfotpik.dialogue = STRTAB:comm/zoqfot/zoqfot.txt @@ -258,8 +255,6 @@ graphics.utwbomb = GFXRES:ipanims/utwbomb.ani music.arispace = MUSICRES:lbm/arispace.mod music.battle = MUSICRES:lbm/battle.mod music.hyper = MUSICRES:lbm/hyper.mod -music.mainmenu = MUSICRES:lbm/mainmenu.ogg -music.meleemenu = MUSICRES:melee/melemenu.ogg music.orbit1 = MUSICRES:ipanims/orbit.mod music.orbit2 = MUSICRES:ipanims/orbit.mod music.orbit3 = MUSICRES:ipanims/orbit.mod diff --git a/sc2/src/sc2code/ikey_con.h b/sc2/src/sc2code/ikey_con.h index 703d117e7..e780e2cea 100644 --- a/sc2/src/sc2code/ikey_con.h +++ b/sc2/src/sc2code/ikey_con.h @@ -1,3 +1,2 @@ -#define JOYSTICK_KEYS 0x00200001L - +// This is a dead resource file. diff --git a/sc2/src/sc2code/ships/lastbat/imusicre.h b/sc2/src/sc2code/ships/lastbat/imusicre.h index fed097185..243783c3f 100644 --- a/sc2/src/sc2code/ships/lastbat/imusicre.h +++ b/sc2/src/sc2code/ships/lastbat/imusicre.h @@ -1,3 +1,3 @@ -#define SAMATRA_VICTORY_SONG 0x00400005L +#define SAMATRA_VICTORY_SONG 0x00400006L typedef RESOURCE MUSICRES_INSTANCE; diff --git a/sc2/src/sc2code/ships/lastbat/istrtab.h b/sc2/src/sc2code/ships/lastbat/istrtab.h index 593946557..d29fbb831 100644 --- a/sc2/src/sc2code/ships/lastbat/istrtab.h +++ b/sc2/src/sc2code/ships/lastbat/istrtab.h @@ -1,3 +1,3 @@ -#define SAMATRA_SHIP_SOUNDS 0x00400004L +// Dead file diff --git a/sc2/src/sc2code/ships/probe/istrtab.h b/sc2/src/sc2code/ships/probe/istrtab.h index 2a01e92eb..19f21066d 100644 --- a/sc2/src/sc2code/ships/probe/istrtab.h +++ b/sc2/src/sc2code/ships/probe/istrtab.h @@ -1,10 +1,6 @@ #ifndef _ISTRTAB_H #define _ISTRTAB_H -#define ARILOU_RACE_STRINGS 0x00200004L -#define ARILOU_SHIP_SOUNDS 0x00400104L -#define ARILOU_VICTORY_SONG 0x00600204L - typedef RESOURCE STRTAB_INSTANCE; #endif /* _ISTRTAB_H */ diff --git a/tools/resmap/resid_generated.py b/tools/resmap/resid_generated.py new file mode 100755 index 000000000..a6ffc1d3d --- /dev/null +++ b/tools/resmap/resid_generated.py @@ -0,0 +1,280 @@ +#!/usr/bin/python + +import scan_defines as scan + +# 72-5-4 for colortable.str_cts_ -- 0x09000504L -- OOLITE_COLOR_TAB. Goes up through +# 202-87-2 for PLANET00_BIG_MASK_PMAP_ANIM. Goes up through 58. +# MAROON and CRIMSON seem swapped! + +planettypes = ['oolite', + 'yttric', + 'quasidegenerate', + 'lanthanide', + 'treasure', + 'urea', + 'metal', + 'radioactive', + 'opalescent', + 'cyanic', + 'acid', + 'alkali', + 'halide', + 'green', + 'copper', + 'carbide', + 'ultramarine', + 'noble', + 'azure', + 'chondrite', + 'purple', + 'superdense', + 'pellucid', + 'dust', + 'crimson', + 'cimmerian', + 'infrared', + 'selenic', + 'auric', + 'fluorescent', + 'ultraviolet', + 'plutonic', + 'rainbow', + 'shattered', + 'sapphire', + 'organic', + 'xenolithic', + 'redux', + 'primordial', + 'emerald', + 'chlorine', + 'magnetic', + 'water', + 'telluric', + 'hydrocarbon', + 'iodine', + 'vinylogous', + 'ruby', + 'magma', + 'maroon', + 'bluegas', # PLANET50 # (As per colorcodes) + 'cyangas', + 'greengas', + 'greygas', + 'orangegas', + 'purplegas', + 'redgas', + 'violetgas', + 'yellowgas'] + +headersymbols = {'quasidegenerate': 'quasi_degenerate', + 'superdense': 'super_dense', + 'bluegas': 'blu_gas', + 'cyangas': 'cya_gas', + 'greengas': 'grn_gas', + 'greygas': 'gry_gas', + 'orangegas': 'ora_gas', + 'purplegas': 'pur_gas', + 'redgas': 'red_gas', + 'violetgas': 'vio_gas', + 'yellowgas': 'yel_gas' } + +xlattabs = ['oolite', + 'yttric', + 'quasidegenerate', + 'yttric', + 'quasidegenerate', + 'urea', + 'metal', + 'yttric', + 'opalescent', + 'quasidegenerate', + 'yttric', + 'yttric', + 'yttric', + 'urea', + 'quasidegenerate', + 'opalescent', + 'urea', + 'yttric', + 'urea', + 'chondrite', + 'urea', + 'quasidegenerate', + 'opalescent', + 'yttric', + 'urea', + 'quasidegenerate', + 'opalescent', + 'urea', + 'quasidegenerate', + 'opalescent', + 'yttric', + 'yttric', + 'rainbow', + 'shattered', + 'sapphire', + 'quasidegenerate', + 'opalescent', + 'redux', + 'yttric', + 'sapphire', + 'chlorine', + 'opalescent', + 'chlorine', + 'yttric', + 'quasidegenerate', + 'urea', + 'opalescent', + 'sapphire', + 'quasidegenerate', + 'urea', + 'gas', + 'gas', + 'gas', + 'gas', + 'gas', + 'gas', + 'gas', + 'gas', + 'gas'] + +colorcodes = ['blu', 'cya', 'grn', 'gry', 'ora', 'pur', 'red', 'vio', 'yel'] + +# androsyn -> androsynth +# blackurq -> kohrah +# human -> earthling +# slylandr -> slylandro +# thradd -> thraddash +# zoqfot -> zoqfotpik + +shiptypes = ['arilou', + 'chmmr', + 'earthling', + 'orz', + 'pkunk', + 'shofixti', + 'spathi', + 'supox', + 'thraddash', + 'utwig', + 'vux', + 'yehat', + 'melnorme', + 'druuge', + 'ilwrath', + 'mycon', + 'slylandro', + 'umgah', + 'urquan', + 'zoqfotpik', + 'syreen', + 'kohrah', + 'androsynth', + 'chenjesu', + 'mmrnmhrm'] + +#blackur -> kohrah +#comandr -> commander +#melnorm -> melnorme +#shofixt -> shofixti +#slyland -> slylandro +#starbas -> starbase +#talkpet -> talkingpet +#thradd -> thraddash +#zoqfot -> zoqfotpik + +convtypes = ['arilou', + 'chmmr', + 'commander', + 'orz', + 'pkunk', + 'shofixti', + 'spathi', + 'supox', + 'thraddash', + 'utwig', + 'vux', + 'yehat', + 'melnorme', + 'druuge', + 'ilwrath', + 'mycon', + 'slylandro', + 'umgah', + 'urquan', + 'zoqfotpik', + 'syreen', + 'kohrah', + 'talkingpet', + 'slyhome'] + +def write_planet_gfx(): + vals = scan.collect_data() + planetanibase = vals.index([x for x in vals if x[0] == 'PLANET00_BIG_MASK_PMAP_ANIM'][0]) + (pkg, inst, typ) = scan.res_decode_str(vals[planetanibase][1]) + resmap = [] + for planettype in planettypes: + for size in ['large', 'medium', 'small']: + print "%3d %3d %3d planet.%s.%s" % (pkg, inst, typ, planettype, size) + resmap.append(("planet.%s.%s" % (planettype, size), vals[planetanibase][3])) + planetanibase += 1 + inst += 1 + pkg += 1 + print + print "---" + print + for (key, val) in resmap: + print "%s = GFXRES:%s" % (key, val) + +def write_planet_str(): + vals = scan.collect_data() + planetctbase = [x for x in vals if x[0] == 'OOLITE_COLOR_TAB'][0] + (basepkg, ctinst, typ) = scan.res_decode_str(planetctbase[1]) + xltinst = ctinst + 1 + reslist = [] + deflist = [] + rmplist = [] + pkg = basepkg + for (planettype, xltindex) in zip(planettypes, xlattabs): + ctres = "planet.%s.colortable" % planettype + xltres = "planet.%s.translatetable" % planettype + defname = planettype + if planettype in headersymbols: + defname = headersymbols[defname] + defname = defname.upper() + ctdef = "%s_COLOR_TAB" % defname + xltdef = "%s_XLAT_TAB" % defname + if xltindex in headersymbols: + oldxltdef = "%s_XLAT_TAB" % headersymbols[xltindex].upper() + else: + oldxltdef = "%s_XLAT_TAB" % xltindex.upper() + ctmatch = [x for x in vals if x[0] == ctdef] + xltmatch = [x for x in vals if x[0] == oldxltdef] + if len(ctmatch) != 1: + raise ValueError, "Couldn't find unique %s" % ctdef + if len(xltmatch) != 1: + raise ValueError, "Couldn't find unique %s" % oldxltdef + ctfile = ctmatch[0][3] + xltfile = xltmatch[0][3] + reslist.append("%3d %3d %3d %s" % (pkg, ctinst, typ, ctres)) + reslist.append("%3d %3d %3d %s" % (pkg, xltinst, typ, xltres)) + deflist.append("#define %s %s" % (ctdef, scan.res_encode_str(pkg, ctinst, typ))) + deflist.append("#define %s %s" % (xltdef, scan.res_encode_str(pkg, xltinst, typ))) + rmplist.append("%s = STRTAB:%s" % (ctres, ctfile)) + rmplist.append("%s = STRTAB:%s" % (xltres, xltfile)) + pkg += 1 + for l in reslist: + print l + print + print "---" + print + for l in deflist: + print l + print + print "---" + print + for l in rmplist: + print l + +if __name__ == '__main__': + write_planet_str()