data.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /* $Id$
  2. * MegaZeux
  3. *
  4. * Copyright (C) 1996 Greg Janson
  5. * Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net
  6. * Copyright (C) 2004 B.D.A - Gilead Kutnick
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. // Translation of data.asm to C
  23. #include "data.h"
  24. #include "const.inc"
  25. char board_where[NUM_BOARDS]; // Array of where boards are
  26. char curr_board = 0; // Current board
  27. // Current MZX file
  28. char curr_file[FILENAME_SIZE] = "CAVERNS.MZX";
  29. // Current SAVE file
  30. char curr_sav[FILENAME_SIZE] ="SAVED.SAV";
  31. char help_file[PATHNAME_SIZE + 1] // Drive + Path + Filename
  32. char config_file[PATHNAME_SIZE + 1] // Drive + Path + Filename
  33. char MSE_file[PATHNAME_SIZE + 1] // Drive + Path + Filename
  34. // Drive + Path + Filename
  35. char mzx_blank_mod_file[PATHNAME_SIZE + 1];
  36. // Drive + Path + Filename
  37. char mzx_convert_mod_file[PATHNAME_SIZE + 1];
  38. char megazeux_dir[PATHNAME_SIZE + 1]; // Directory started in
  39. char current_dir[PATHNAME_SIZE + 1]; // Current directory
  40. char megazeux_drive = 2; // Startup drive (0=A...)
  41. char current_drive = 2; // Current drive (0=A...)
  42. // Current quicksave filename
  43. char quicksave_file[FILENAME_SIZE + 1];
  44. short board_xsiz = 80; // Size of board in memory
  45. short board_ysiz = 25;
  46. char overlay_mode = OVERLAY_OFF; // Mode for overlay
  47. char max_bsiz_mode = 2;
  48. short max_bxsiz = 100;
  49. short max_bysiz = 100;
  50. // Mouse state stuff
  51. short saved_mouse_x = 0;
  52. short saved_mouse_y = 0;
  53. short saved_mouse_buttons = 0;
  54. // Board "save chunk"
  55. char mod_playing[FILENAME_SIZE]; // Mod currently playing
  56. char real_mod_playing[FILENAME_SIZE] // Real mod currently playing
  57. char refresh_mod_playing = 1; // Load mod no matter what
  58. char viewport_x = 3; // X pos of UL corner of view
  59. char viewport_y = 2;
  60. char viewport_xsiz = 74; // Size of view
  61. char viewport_ysiz = 21;
  62. char can_shoot = 1; // Allowed to shoot on board
  63. char can_bomb = 1; // Allowed to bomb on board
  64. char fire_burn_brown = 0;
  65. char fire_burn_space = 1;
  66. char fire_burn_fakes = 1;
  67. char fire_burn_trees = 1;
  68. char explosions_leave = EXPL_LEAVE_ASH;
  69. char save_mode = CAN_SAVE;
  70. char forest_becomes = FOREST_TO_EMPTY;
  71. char collect_bombs = 1; // If zero, bombs auto set
  72. char fire_burns = FIRE_BURNS_FOREVER;
  73. char board_dir[4]; // Boards to dirs
  74. char restart_if_zapped = 0;
  75. // Stays the same, for resetting time when it runs out
  76. short time_limit = 0;
  77. char last_key = '?'; // Last key pressed
  78. short num_input = 0; // Numeric form of input
  79. char input_size = 0; // Size of input
  80. char input_string[81]; // Last inputted string
  81. char player_last_dir[16]; // Last direction of player
  82. char bottom_mesg[81]; // Message at bottom of screen
  83. char b_mesg_timer = 0; // Timer for bottom message
  84. char lazwall_start = 7; // Current LazWalls to fire
  85. char b_mesg_row = 24; // Row to display message on
  86. char b_mesg_col = 255; // Column (255=centered)
  87. short scroll_x = 0; // +/- to x from scrollview
  88. short scroll_y = 0; // +/- to y
  89. // Position in array of ul corner of viewport when scroll locked (-1 = none)
  90. short locked_x = -1;
  91. short locked_y = -1;
  92. char player_ns_locked = 0;
  93. char player_ew_locked = 0;
  94. char player_attack_locked = 0;
  95. char volume = 127;
  96. char volume_inc = 0; // For fading (negative okay)
  97. char volume_target = 127; // Target volume for fading
  98. // World "save chunk"
  99. char edge_color = 8; // Color OUTSIDE viewport
  100. char first_board = 0; // First board to play
  101. //No board=Game Over
  102. char endgame_board = NO_ENDGAME_BOARD;
  103. char death_board = NO_DEATH_BOARD; // No board=Restart same
  104. short endgame_x = 0;
  105. short endgame_y = 0;
  106. char game_over_sfx = 1;
  107. short death_x = 0;
  108. short death_y = 0;
  109. short starting_lives = 5;
  110. short lives_limit = 99; // Limit's Limit- 65535
  111. short starting_health = 100;
  112. short health_limit = 200; // Limit's Limit- 65535
  113. char enemy_hurt_enemy = 0;
  114. char clear_on_exit = 0; // 1=Clear message/projeciles between screens
  115. // Set if only playable from a SWAP robot command
  116. char only_from_swap = 0;
  117. // Save game "save chunk"
  118. char keys[NUM_KEYS]; // Array of keys
  119. int score = 0;
  120. char blind_dur = 0; // Cycles left
  121. char firewalker_dur = 0;
  122. char freeze_time_dur = 0;
  123. char slow_time_dur = 0;
  124. char wind_dur = 0;
  125. short pl_saved_x[8]; // Array of 8
  126. short pl_saved_y[8]; // Array of 8
  127. char pl_saved_board[8]; // Array of 8
  128. char saved_pl_color = 27; // Saves color for energizer
  129. char under_player_id = 0;
  130. char under_player_color = 7;
  131. char under_player_param = 0;
  132. char mesg_edges = 1;
  133. char current_page = 0; // 0 or 1
  134. short current_pg_seg = VIDEO_SEG; // Segment of 0 or 1
  135. // Counters shown on status screen
  136. char status_shown_counters[COUNTER_NAME_SIZE + 1] = { NUM_STATUS_CNTRS };
  137. char music_on = 1; // If music is on
  138. char sfx_on = 1; // If pc sfx is on
  139. char music_device = 0; // Music device
  140. short mixing_rate = 30; // Mixing rate
  141. char sfx_channels = 2; // # of sfx channels
  142. char music_gvol = 8; // Global Music volume (x/8)
  143. char sound_gvol = 8; // Global Sound volume (x/8)
  144. char overall_speed = 4; // 1 through 7
  145. short player_x = 0; // Not updated during "update"
  146. short player_y = 0; // " " " "
  147. char scroll_color = 15; // Current scroll color
  148. char protection_method = NO_PROTECTION;
  149. char password[16];
  150. char cheats_active = 0; // (additive flag)
  151. char current_help_sec = 0; // Use for context-sens.help
  152. // Array of flags for things
  153. short flags[] =
  154. {
  155. A_UNDER, // Space
  156. 0, // Normal
  157. 0, // Solid
  158. 0, // Tree
  159. 0, // Line
  160. 0, // Customblock
  161. A_SHOOTABLE | A_BLOW_UP, // Breakaway
  162. A_SHOOTABLE | A_BLOW_UP, // Customblock
  163. A_PUSHABLE | A_BLOW_UP, // Boulder
  164. A_PUSHABLE | A_BLOW_UP, // Crate
  165. A_PUSHABLE | A_BLOW_UP, // Custompush
  166. A_PUSHABLE, // Box
  167. A_PUSHABLE, // Customsolidpush
  168. A_UNDER, // Fake
  169. A_UNDER, // Carpet
  170. A_UNDER, // Floor
  171. A_UNDER, // Tiles
  172. A_UNDER, // Customfloor
  173. A_UNDER | A_BLOW_UP, // Web
  174. A_UNDER | A_BLOW_UP, // Thickweb
  175. A_UNDER, // Stillwater
  176. A_UNDER | A_AFFECT_IF_STOOD, // NWater
  177. A_UNDER | A_AFFECT_IF_STOOD, // SWater
  178. A_UNDER | A_AFFECT_IF_STOOD, // EWater
  179. A_UNDER | A_AFFECT_IF_STOOD, // WWater
  180. A_UNDER | A_AFFECT_IF_STOOD | A_UPDATE, // Ice
  181. A_UNDER | A_AFFECT_IF_STOOD | A_UPDATE, // Lava
  182. A_ITEM | A_BLOW_UP, // Chest
  183. A_ITEM | A_PUSHABLE | A_BLOW_UP | A_SHOOTABLE, // Gem
  184. A_ITEM | A_PUSHABLE | A_BLOW_UP | A_SHOOTABLE, // Magicgem
  185. A_ITEM | A_PUSHABLE, // Health
  186. A_ITEM | A_PUSHABLE, // Ring
  187. A_ITEM | A_PUSHABLE, // Potion
  188. A_ITEM | A_PUSHABLE, // Health
  189. A_ITEM | A_PUSHABLE, // Ring
  190. A_ITEM | A_PUSHABLE, // Potion
  191. A_ITEM | A_PUSHABLE | A_UPDATE, // Energizer
  192. A_UNDER | A_ITEM, // Goop
  193. A_ITEM | A_PUSHABLE, // Ammo
  194. A_ITEM | A_PUSHABLE | A_EXPLODE, // Bomb
  195. A_PUSHABLE | A_EXPLODE | A_UPDATE, // LitBomb
  196. A_HURTS | A_UPDATE, // Explosion
  197. A_ITEM | A_PUSHABLE, // Key
  198. A_ITEM, // Lock
  199. A_ITEM, // Door
  200. A_UPDATE, // Opening/closing door
  201. A_ENTRANCE | A_UNDER, // Stairs
  202. A_ENTRANCE | A_UNDER, // Cave
  203. A_UPDATE, // CW
  204. A_UPDATE, // CCW
  205. A_ITEM, // Gate
  206. A_UPDATE | A_UNDER, // OpenGate
  207. A_SPEC_PUSH | A_ITEM | A_UPDATE, // Transport
  208. A_ITEM | A_PUSHABLE, // Coin
  209. A_UPDATE, // MovingWall N
  210. A_UPDATE, // MovingWall S
  211. A_UPDATE, // MovingWall E
  212. A_UPDATE, // MovingWall W
  213. A_ITEM | A_PUSHABLE | A_BLOW_UP, // Pouch
  214. A_UPDATE, // Pusher
  215. A_PUSHNS, // SliderNS
  216. A_PUSHEW, // SliderEW
  217. A_UPDATE | A_HURTS, // Lazer
  218. A_UPDATE, // LazerWallShooter
  219. A_UPDATE | A_BLOW_UP | A_SHOOTABLE | A_ITEM | A_ENEMY, // Bullet
  220. A_UPDATE | A_HURTS | A_EXPLODE, // Missile
  221. A_UPDATE | A_UNDER | A_AFFECT_IF_STOOD // Fire
  222. 0, // '?'
  223. A_ITEM, // Forest
  224. A_PUSHABLE | A_ITEM | A_UPDATE, // Life
  225. A_UPDATE | A_UNDER | A_ENTRANCE, // Whirlpool 1
  226. A_UPDATE | A_UNDER | A_ENTRANCE, // Whirlpool 2
  227. A_UPDATE | A_UNDER | A_ENTRANCE, // Whirlpool 3
  228. A_UPDATE | A_UNDER | A_ENTRANCE, // Whirlpool 4
  229. A_ITEM, // Invisible
  230. A_SPEC_SHOT, // RicochetPanel
  231. A_SPEC_SHOT, // Ricochet
  232. A_ITEM | A_SPEC_SHOT | A_SPEC_BOMB | A_UPDATE // Mine
  233. A_HURTS, // Spike
  234. A_HURTS, // Customhurt
  235. 0, // Text
  236. A_UPDATE | A_ENEMY | A_BLOW_UP, // ShootingFire
  237. A_UPDATE | A_ENEMY | A_BLOW_UP | A_PUSHABLE, // Seeker
  238. A_UPDATE | A_PUSHABLE | A_ENEMY | A_SHOOTABLE | A_BLOW_UP, // Snake
  239. A_UPDATE | A_EXPLODE | A_ITEM | A_SPEC_SHOT | A_PUSHABLE, // Eye
  240. A_UPDATE | A_BLOW_UP | A_PUSHABLE | A_ITEM | A_SHOOTABLE, // Thief
  241. A_UPDATE | A_ITEM | A_SPEC_BOMB | A_SPEC_SHOT, // SlimeBlob
  242. A_UPDATE | A_ENEMY | A_BLOW_UP | A_PUSHABLE | A_SPEC_SHOT, // Runner
  243. A_UPDATE | A_ITEM | A_PUSHABLE | A_SPEC_BOMB | A_SPEC_SHOT, // Ghost
  244. A_UPDATE | A_SPEC_SHOT | A_SPEC_BOMB | A_ITEM, // Dragon
  245. A_UPDATE | A_ITEM | A_BLOW_UP | A_SPEC_SHOT | A_PUSHABLE, // Fish
  246. A_UPDATE | A_BLOW_UP | A_SHOOTABLE | A_ENEMY, // Shark
  247. A_UPDATE | A_ENEMY | A_BLOW_UP | A_SPEC_SHOT | A_PUSHABLE, // Spider
  248. A_UPDATE | A_ENEMY | A_SHOOTABLE | A_PUSHABLE | A_BLOW_UP, // Goblin (90)
  249. A_UPDATE | A_PUSHABLE | A_SHOOTABLE | A_ENEMY | A_BLOW_UP, // Tiger
  250. A_UPDATE, // BulletGun
  251. A_UPDATE, // SpinningGun
  252. A_UPDATE | A_ENEMY | A_SPEC_SHOT | A_PUSHABLE | A_BLOW_UP, // Bear
  253. A_UPDATE | A_BLOW_UP | A_ENEMY | A_SHOOTABLE | A_PUSHABLE, // BearCub
  254. 0, // '?'
  255. A_UPDATE, // MissileGun
  256. 0, // 98
  257. 0, // 99
  258. 0, // 100
  259. 0, // 101
  260. 0, // 102
  261. 0, // 103
  262. 0, // 104
  263. 0, // 105
  264. 0, // 106
  265. 0, // 107
  266. 0, // 108
  267. 0, // 109
  268. 0, // 110
  269. 0, // 111
  270. 0, // 112
  271. 0, // 113
  272. 0, // 114
  273. 0, // 115
  274. 0, // 116
  275. 0, // 117
  276. 0, // 118
  277. 0, // 119
  278. 0, // 120
  279. 0, // 121
  280. A_SPEC_STOOD | A_SPEC_PUSH, // Sensor
  281. A_ITEM | A_UPDATE | A_SPEC_SHOT | A_SPEC_BOMB | A_SPEC_PUSH,// Robot (pushable)
  282. A_ITEM | A_UPDATE | A_SPEC_SHOT | A_SPEC_BOMB // Robot
  283. A_ITEM, // Sign
  284. A_ITEM | A_PUSHABLE, // Scroll
  285. A_SPEC_SHOT | A_SPEC_PUSH | A_SPEC_BOMB, // Player
  286. };
  287. char *board_list = NULL; // Far pointer to array of board names
  288. bOffset *board_offsets = NULL; // Far pointer to array of mem/file offsets
  289. unsigned long *board_sizes = NULL; // Far pointer to array of sizes
  290. char *board_filenames = NULL; // Far pointer to array of filenames
  291. unsigned char *level_id = NULL; // Far pointer to array of 100x100
  292. unsigned char *level_color = NULL;
  293. unsigned char *level_param;
  294. unsigned char *level_under_id;
  295. unsigned char *level_under_color;
  296. unsigned char *level_under_param;
  297. unsigned char *overlay;
  298. unsigned char *overlay_color;
  299. unsigned char *update_done;