All specials are now actions. Builds correct outputs, more needs deleting.
This commit is contained in:
parent
80b2b9b356
commit
5f28f95244
3 changed files with 55 additions and 48 deletions
|
@ -1313,6 +1313,14 @@ int action(struct command_t *command)
|
|||
* 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
|
||||
|
|
|
@ -3889,15 +3889,15 @@ actions: !!omap
|
|||
- ACT_UNKNOWN:
|
||||
message: *huh_man
|
||||
words: !!null
|
||||
|
||||
specials: !!omap
|
||||
- SPC_THANKYOU:
|
||||
- THANKYOU:
|
||||
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']
|
||||
- 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
|
||||
|
@ -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', '?']
|
||||
- SPC_NO:
|
||||
noaction: true
|
||||
- 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-
|
||||
|
@ -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']
|
||||
- SPC_DIG:
|
||||
noaction: true
|
||||
- DIG:
|
||||
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']
|
||||
- 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']
|
||||
- SPC_FBOMB:
|
||||
noaction: true
|
||||
- FBOMB:
|
||||
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']
|
||||
- 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
|
||||
|
@ -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']
|
||||
- SPC_SWIM:
|
||||
noaction: true
|
||||
- SWIM:
|
||||
message: *not_knowhow
|
||||
words: ['swim']
|
||||
- SPC_WIZARD:
|
||||
noaction: true
|
||||
- WIZARD:
|
||||
message: 'Wizards are not to be disturbed by such as you.'
|
||||
words: ['wizar']
|
||||
- SPC_YES:
|
||||
noaction: true
|
||||
- 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.
|
||||
|
@ -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']
|
||||
- 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']
|
||||
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
|
||||
|
|
|
@ -105,11 +105,13 @@ typedef struct {{
|
|||
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;
|
||||
const bool noaction;
|
||||
}} 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
|
||||
|
||||
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 = {},
|
||||
.noaction = {},
|
||||
}},
|
||||
"""
|
||||
spc_str = ""
|
||||
|
@ -546,7 +520,12 @@ def get_specials(specials):
|
|||
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"]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue