diff options
author | Torne Wuff <torne@wolfpuppy.org.uk> | 2010-01-17 22:15:13 +0000 |
---|---|---|
committer | Torne Wuff <torne@wolfpuppy.org.uk> | 2010-01-17 22:15:13 +0000 |
commit | 7f28c94eda576e3f972fc05468188986f2e45885 (patch) | |
tree | e03b94613028d16855a5d3df0f4853e077931214 /apps/plugins/frotz/dumb_init.c | |
parent | 563f2602f471208cb8544a36539a79dcceaad643 (diff) | |
download | rockbox-7f28c94eda576e3f972fc05468188986f2e45885.tar.gz rockbox-7f28c94eda576e3f972fc05468188986f2e45885.zip |
New plugin: frotz, a Z-machine interpreter, for playing interactive fiction.
The interpreter more or less passes all the tests in the z-machine test suite.
It should build for every target except Archos (for which it is disabled).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24267 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/frotz/dumb_init.c')
-rw-r--r-- | apps/plugins/frotz/dumb_init.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/apps/plugins/frotz/dumb_init.c b/apps/plugins/frotz/dumb_init.c new file mode 100644 index 0000000000..ea08447c0c --- /dev/null +++ b/apps/plugins/frotz/dumb_init.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* dumb-init.c | ||
2 | * $Id: dumb-init.c,v 1.1.1.1 2002/03/26 22:38:34 feedle Exp $ | ||
3 | * | ||
4 | * Copyright 1997,1998 Alva Petrofsky <alva@petrofsky.berkeley.ca.us>. | ||
5 | * Any use permitted provided this notice stays intact. | ||
6 | * | ||
7 | * Changes for Rockbox copyright 2009 Torne Wuff | ||
8 | */ | ||
9 | |||
10 | #include "dumb_frotz.h" | ||
11 | #include "lib/pluginlib_exit.h" | ||
12 | |||
13 | static int user_screen_width = LCD_WIDTH / SYSFONT_WIDTH; | ||
14 | static int user_screen_height = LCD_HEIGHT / SYSFONT_HEIGHT; | ||
15 | static int user_interpreter_number = -1; | ||
16 | static int user_random_seed = -1; | ||
17 | static int user_tandy_bit = 0; | ||
18 | |||
19 | |||
20 | void os_init_screen(void) | ||
21 | { | ||
22 | if (h_version == V3 && user_tandy_bit) | ||
23 | h_config |= CONFIG_TANDY; | ||
24 | |||
25 | if (h_version >= V5 && f_setup.undo_slots == 0) | ||
26 | h_flags &= ~UNDO_FLAG; | ||
27 | |||
28 | h_screen_rows = user_screen_height; | ||
29 | h_screen_cols = user_screen_width; | ||
30 | |||
31 | if (user_interpreter_number > 0) | ||
32 | h_interpreter_number = user_interpreter_number; | ||
33 | else { | ||
34 | /* Use ms-dos for v6 (because that's what most people have the | ||
35 | * graphics files for), but don't use it for v5 (or Beyond Zork | ||
36 | * will try to use funky characters). */ | ||
37 | h_interpreter_number = h_version == 6 ? INTERP_MSDOS : INTERP_DEC_20; | ||
38 | } | ||
39 | h_interpreter_version = 'F'; | ||
40 | |||
41 | if (h_version >= V4) | ||
42 | h_config |= CONFIG_TIMEDINPUT; | ||
43 | |||
44 | if (h_version >= V5) | ||
45 | h_flags &= ~(MOUSE_FLAG | MENU_FLAG); | ||
46 | |||
47 | dumb_init_output(); | ||
48 | |||
49 | h_flags &= ~GRAPHICS_FLAG; | ||
50 | } | ||
51 | |||
52 | int os_random_seed (void) | ||
53 | { | ||
54 | if (user_random_seed == -1) | ||
55 | /* Use the rockbox tick as seed value */ | ||
56 | return ((int)rb->current_tick) & 0x7fff; | ||
57 | else return user_random_seed; | ||
58 | } | ||
59 | |||
60 | void os_restart_game (int stage) { (void)stage; } | ||
61 | |||
62 | void os_fatal (const char *s) | ||
63 | { | ||
64 | rb->splash(HZ*10, s); | ||
65 | exit(1); | ||
66 | } | ||
67 | |||
68 | void os_init_setup(void) | ||
69 | { | ||
70 | f_setup.attribute_assignment = 0; | ||
71 | f_setup.attribute_testing = 0; | ||
72 | f_setup.context_lines = 0; | ||
73 | f_setup.object_locating = 0; | ||
74 | f_setup.object_movement = 0; | ||
75 | f_setup.left_margin = 0; | ||
76 | f_setup.right_margin = 0; | ||
77 | f_setup.ignore_errors = 0; | ||
78 | f_setup.piracy = 0; | ||
79 | f_setup.undo_slots = MAX_UNDO_SLOTS; | ||
80 | f_setup.expand_abbreviations = 0; | ||
81 | f_setup.script_cols = 80; | ||
82 | f_setup.save_quetzal = 1; | ||
83 | f_setup.sound = 1; | ||
84 | f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE; | ||
85 | |||
86 | } | ||