projects
/
projects
/
chimara
/
chimara.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a766503
)
* Added some more verbs to show off the style system
author
rodin
<rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Fri, 22 May 2009 20:34:09 +0000
(20:34 +0000)
committer
rodin
<rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Fri, 22 May 2009 20:34:09 +0000
(20:34 +0000)
src/first.c
patch
|
blob
|
history
diff --git
a/src/first.c
b/src/first.c
index 3f6beccffea3bbe755d076b4407f2883820b3eee..fdb97a439e2557d60a945ccbad8eec8244ebe20d 100644
(file)
--- a/
src/first.c
+++ b/
src/first.c
@@
-61,6
+61,8
@@
static void verb_script(void);
static void verb_unscript(void);
static void verb_save(void);
static void verb_restore(void);
static void verb_unscript(void);
static void verb_save(void);
static void verb_restore(void);
+static void verb_alert(void);
+static void verb_notice(void);
/* The glk_main() function is called by the Glk system; it's the main entry
point for your program. */
/* The glk_main() function is called by the Glk system; it's the main entry
point for your program. */
@@
-213,6
+215,12
@@
void glk_main(void)
else if (str_eq(cmd, "unscript")) {
verb_unscript();
}
else if (str_eq(cmd, "unscript")) {
verb_unscript();
}
+ else if (str_eq(cmd, "alert")) {
+ verb_alert();
+ }
+ else if (str_eq(cmd, "notice")) {
+ verb_notice();
+ }
else {
glk_put_string("I don't understand the command \"");
glk_put_string(cmd);
else {
glk_put_string("I don't understand the command \"");
glk_put_string(cmd);
@@
-315,6
+323,8
@@
static void verb_help(void)
glk_put_string("UNSCRIPT: Turn off transcripting.\n");
glk_put_string("SAVE: Write fake data to a save file.\n");
glk_put_string("RESTORE: Read it back in.\n");
glk_put_string("UNSCRIPT: Turn off transcripting.\n");
glk_put_string("SAVE: Write fake data to a save file.\n");
glk_put_string("RESTORE: Read it back in.\n");
+ glk_put_string("ALERT: Print a frightful message.\n");
+ glk_put_string("NOTICE: Print an interesting message.\n");
glk_put_string("QUIT: Quit and exit.\n");
}
glk_put_string("QUIT: Quit and exit.\n");
}
@@
-399,8
+409,8
@@
static void verb_quote(void)
/* Print some quote. */
glk_set_window(quotewin);
glk_set_style(style_BlockQuote);
/* Print some quote. */
glk_set_window(quotewin);
glk_set_style(style_BlockQuote);
- glk_put_string("Tomorrow probably never rose
or set\n"
-
"
Or went out and bought cheese, or anything like that\n"
+ glk_put_string("Tomorrow probably never rose
");
+
glk_put_string("or set\n
Or went out and bought cheese, or anything like that\n"
"And anyway, what light through yonder quote box breaks\n"
"Handle to my hand?\n");
glk_put_string(" -- Fred\n");
"And anyway, what light through yonder quote box breaks\n"
"Handle to my hand?\n");
glk_put_string(" -- Fred\n");
@@
-413,7
+423,11
@@
static void verb_move(void)
current_room = (current_room+1) % 2;
need_look = TRUE;
current_room = (current_room+1) % 2;
need_look = TRUE;
- glk_put_string("You walk for a while.\n");
+ glk_put_string("You ");
+ glk_set_style(style_Emphasized);
+ glk_put_string("walk");
+ glk_set_style(style_Normal);
+ glk_put_string(" for a while.\n");
}
static void verb_quit(void)
}
static void verb_quit(void)
@@
-557,6
+571,21
@@
static void verb_restore(void)
glk_put_string("Game restored.\n");
}
glk_put_string("Game restored.\n");
}
+void verb_alert()
+{
+ glk_set_style(style_Alert);
+ glk_put_string("O noes!\n");
+ glk_set_style(style_Normal);
+}
+
+void verb_notice()
+{
+ glk_set_style(style_Note);
+ glk_put_string("The answer... is 42!\n");
+ glk_set_style(style_Normal);
+}
+
+
/* simple string length test */
static int str_len(char *s1)
{
/* simple string length test */
static int str_len(char *s1)
{