All specials are now actions. Builds correct outputs, more needs deleting.
authorAaron Traas <aaron@traas.org>
Fri, 21 Jul 2017 20:56:43 +0000 (16:56 -0400)
committerAaron Traas <aaron@traas.org>
Fri, 21 Jul 2017 20:56:43 +0000 (16:56 -0400)
actions.c
adventure.yaml
make_dungeon.py

index 7faf3313e25fb5b5f53ad0efb849e331d12605f9..32dcd902ab4296389d3382320d6958af9fbaa479 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -1313,6 +1313,14 @@ int action(struct command_t *command)
  *  unless verb is "say", which snarfs arbitrary second word.
  */
 {
  *  unless verb is "say", which snarfs arbitrary second word.
  */
 {
+    /* Previously, actions that result in a message, but don't do anything 
+     * further were called "specials". Now they're handled here as normal 
+     * actions. If noaction is true, then we spit out the message and return */
+    if (actions[command->verb].noaction) {
+        speak(actions[command->verb].message);
+        return GO_CLEAROBJ;
+    }
+    
     if (command->part == unknown) {
         /*  Analyse an object word.  See if the thing is here, whether
          *  we've got a verb yet, and so on.  Object must be here
     if (command->part == unknown) {
         /*  Analyse an object word.  See if the thing is here, whether
          *  we've got a verb yet, and so on.  Object must be here
index 6401882f3100aea3b77eb8434180098d1113be21..75bd76cee71e4271588bed8472ff0d78c06d37e5 100644 (file)
@@ -3889,15 +3889,15 @@ actions: !!omap
 - ACT_UNKNOWN:
     message: *huh_man
     words: !!null
 - ACT_UNKNOWN:
     message: *huh_man
     words: !!null
-
-specials: !!omap
-- SPC_THANKYOU:
+- THANKYOU:
     message: 'You''re quite welcome.'
     words: ['thank']
     message: 'You''re quite welcome.'
     words: ['thank']
-- SPC_INVALIDMAGIC:
+    noaction: true
+- INVALIDMAGIC:
     message: 'Good try, but that is an old worn-out magic word.'
     words: ['sesam', 'opens', 'abra', 'abrac', 'shaza', 'hocus', 'pocus']
     message: 'Good try, but that is an old worn-out magic word.'
     words: ['sesam', 'opens', 'abra', 'abrac', 'shaza', 'hocus', 'pocus']
-- SPC_HELP:
+    noaction: true
+- HELP:
     message: |-
       I know of places, actions, and things.  Most of my vocabulary
       describes places and is used to move you there.  To move, try words
     message: |-
       I know of places, actions, and things.  Most of my vocabulary
       describes places and is used to move you there.  To move, try words
@@ -3929,10 +3929,12 @@ specials: !!omap
       though the direction that takes you back might not be the reverse of
       what got you here.  Good luck, and have fun!
     words: ['help', '?']
       though the direction that takes you back might not be the reverse of
       what got you here.  Good luck, and have fun!
     words: ['help', '?']
-- SPC_NO:
+    noaction: true
+- NO:
     message: *ok_man
     words: ['no']
     message: *ok_man
     words: ['no']
-- SPC_TREE:
+    noaction: true
+- TREE:
     message: |-
       The trees of the forest are large hardwood oak and maple, with an
       occasional grove of pine or spruce.  There is quite a bit of under-
     message: |-
       The trees of the forest are large hardwood oak and maple, with an
       occasional grove of pine or spruce.  There is quite a bit of under-
@@ -3941,27 +3943,33 @@ specials: !!omap
       all the leaves, but travel is quite easy if you detour around the
       spruce and berry bushes.
     words: ['tree', 'trees']
       all the leaves, but travel is quite easy if you detour around the
       spruce and berry bushes.
     words: ['tree', 'trees']
-- SPC_DIG:
+    noaction: true
+- DIG:
     message: |-
       Digging without a shovel is quite impractical.  Even with a shovel
       progress is unlikely.
     words: ['dig', 'excav']
     message: |-
       Digging without a shovel is quite impractical.  Even with a shovel
       progress is unlikely.
     words: ['dig', 'excav']
-- SPC_LOST:
+    noaction: true
+- LOST:
     message: 'I''m as confused as you are.'
     words: ['lost']
     message: 'I''m as confused as you are.'
     words: ['lost']
-- SPC_MIST:
+    noaction: true
+- MIST:
     message: |-
       Mist is a white vapor, usually water, seen from time to time in
       caverns.  It can be found anywhere but is frequently a sign of a deep
       pit leading down to water.'
     words: ['mist']
     message: |-
       Mist is a white vapor, usually water, seen from time to time in
       caverns.  It can be found anywhere but is frequently a sign of a deep
       pit leading down to water.'
     words: ['mist']
-- SPC_FBOMB:
+    noaction: true
+- FBOMB:
     message: 'Watch it!'
     words: ['fuck']
     message: 'Watch it!'
     words: ['fuck']
-- SPC_STOP:
+    noaction: true
+- STOP:
     message: 'I don''t know the word "stop".  Use "quit" if you want to give up.'
     words: ['stop']
     message: 'I don''t know the word "stop".  Use "quit" if you want to give up.'
     words: ['stop']
-- SPC_INFO:
+    noaction: true
+- INFO:
     message: |-
       For a summary of the most recent changes to the game, say "news".
       If you want to end your adventure early, say "quit".  To suspend your
     message: |-
       For a summary of the most recent changes to the game, say "news".
       If you want to end your adventure early, say "quit".  To suspend your
@@ -3985,16 +3993,20 @@ specials: !!omap
       save time, you may specify "brief", which tells me never to repeat the
       full description of a place unless you explicitly ask me to.
     words: ['info', 'infor']
       save time, you may specify "brief", which tells me never to repeat the
       full description of a place unless you explicitly ask me to.
     words: ['info', 'infor']
-- SPC_SWIM:
+    noaction: true
+- SWIM:
     message: *not_knowhow
     words: ['swim']
     message: *not_knowhow
     words: ['swim']
-- SPC_WIZARD:
+    noaction: true
+- WIZARD:
     message: 'Wizards are not to be disturbed by such as you.'
     words: ['wizar']
     message: 'Wizards are not to be disturbed by such as you.'
     words: ['wizar']
-- SPC_YES:
+    noaction: true
+- YES:
     message: 'Guess again.'
     words: ['yes']
     message: 'Guess again.'
     words: ['yes']
-- SPC_NEWS:
+    noaction: true
+- NEWS:
     message: |-
       Open Adventure is an author-approved open-source release of
       Version 2.5 with, as yet, no gameplay changes.
     message: |-
       Open Adventure is an author-approved open-source release of
       Version 2.5 with, as yet, no gameplay changes.
@@ -4006,11 +4018,19 @@ specials: !!omap
       while first), but it now costs you a few points each time you save the
       game.  Saved games are now stored in much smaller files than before.
     words: ['news']
       while first), but it now costs you a few points each time you save the
       game.  Saved games are now stored in much smaller files than before.
     words: ['news']
-- SPC_VERSION:
+    noaction: true
+- ACT_VERSION:
     message: |-
       There is a puff of orange smoke; within it, fiery runes spell out:
       
       \tOpen Adventure %V - http://www.catb.org/esr/open-adventure/
     words: ['versi']
     message: |-
       There is a puff of orange smoke; within it, fiery runes spell out:
       
       \tOpen Adventure %V - http://www.catb.org/esr/open-adventure/
     words: ['versi']
+    noaction: true
+
+# Specials no longer used, but this is still needed for now
+specials: !!omap
+- SPC_DELETEME:
+    message: 'Please delete this item'
+    words: ['null']
 
 # end
 
 # end
index b37856368947d219bcb5a79ef66deeaf38fdbdcf..de7251cd4bd5fbacb30458810104e9b06466bfdb 100755 (executable)
@@ -105,11 +105,13 @@ typedef struct {{
 typedef struct {{
   const string_group_t words;
   const char* message;
 typedef struct {{
   const string_group_t words;
   const char* message;
+  const bool noaction;
 }} action_t;
 
 typedef struct {{
   const string_group_t words;
   const char* message;
 }} action_t;
 
 typedef struct {{
   const string_group_t words;
   const char* message;
+  const bool noaction;
 }} special_t;
 
 enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}};
 }} special_t;
 
 enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}};
@@ -497,39 +499,11 @@ def get_motions(motions):
                     ignore += word.upper()
     return mot_str
 
                     ignore += word.upper()
     return mot_str
 
-def get_actions(actions):
-    template = """    {{
-        .words = {},
-        .message = {},
-    }},
-"""
-    act_str = ""
-    for action in actions:
-        contents = action[1]
-        
-        if contents["words"] == None:
-            words_str = get_string_group([])
-        else:
-            words_str = get_string_group(contents["words"])
-
-        if contents["message"] == None:
-            message = "NO_MESSAGE"
-        else:
-            message = contents["message"]
-            
-        act_str += template.format(words_str, message)
-        global ignore
-        if contents.get("oldstyle", True) == False:
-            for word in contents["words"]:
-                if len(word) == 1:
-                    ignore += word.upper()
-    act_str = act_str[:-1] # trim trailing newline
-    return act_str
-
 def get_specials(specials):
     template = """    {{
         .words = {},
         .message = {},
 def get_specials(specials):
     template = """    {{
         .words = {},
         .message = {},
+        .noaction = {},
     }},
 """
     spc_str = ""
     }},
 """
     spc_str = ""
@@ -546,7 +520,12 @@ def get_specials(specials):
         else:
             message = make_c_string(contents["message"])
 
         else:
             message = make_c_string(contents["message"])
 
-        spc_str += template.format(words_str, message)
+        if contents.get("noaction") == None:
+            noaction = "false"
+        else:
+            noaction = "true"
+
+        spc_str += template.format(words_str, message, noaction)
         global ignore
         if contents.get("oldstyle", True) == False:
             for word in contents["words"]:
         global ignore
         if contents.get("oldstyle", True) == False:
             for word in contents["words"]: