X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=make_dungeon.py;h=f8b3147e46c4fc65ad64ad40cc3e2c620bf342cb;hp=7a16970df83ea3b369c920f880d1661172fa03ef;hb=100152c21df9a5508936e31a3971aea71a280165;hpb=7c1c169bf825de33a85624132a83724dc4ba07c6 diff --git a/make_dungeon.py b/make_dungeon.py index 7a16970..f8b3147 100755 --- a/make_dungeon.py +++ b/make_dungeon.py @@ -6,43 +6,7 @@ # # The nontrivial part of this is the compilation of the YAML for # movement rules to the travel array that's actually used by -# playermove(). This program first compiles the YAML to a form -# identical to the data in section 3 of the old adventure.text file, -# then a second stage unpacks that data into the travel array. -# -# Here are the rules of the intermediate form: -# -# Each row of data contains a location number (X), a second -# location number (Y), and a list of motion numbers (see section 4). -# each motion represents a verb which will go to Y if currently at X. -# Y, in turn, is interpreted as follows. Let M=Y/1000, N=Y mod 1000. -# If N<=300 it is the location to go to. -# If 300500 message N-500 from section 6 is printed, -# and he stays wherever he is. -# Meanwhile, M specifies the conditions on the motion. -# If M=0 it's unconditional. -# If 0500 message N-500 from section 6 is printed, + # and he stays wherever he is. + # Meanwhile, M specifies the conditions on the motion. + # If M=0 it's unconditional. + # If 0 500: + desttype = "dest_speak"; + destval = msgnames[dest - 500] + else: + desttype = "dest_special"; + destval = locnames[dest - 300] travel.append([len(tkey)-1, locnames[len(tkey)-1], rule.pop(0), - cond, - locnames[dest] if dest <= 300 else dest, - "true" if cond==100 else "false", + condtype, + condarg1, + condarg2, + desttype, + destval, + "true" if nodwarves else "false", "false"]) travel[-1][-1] = "true" return (travel, tkey) @@ -730,8 +760,11 @@ def buildtravel(locs, objs): def get_travel(travel): template = """ {{ // from {}: {} .motion = {}, - .cond = {}, - .dest = {}, + .condtype = {}, + .condarg1 = {}, + .condarg2 = {}, + .desttype = {}, + .destval = {}, .nodwarves = {}, .stop = {}, }},