Add another typedef in the demo game.
Chris Pressey
4 years ago
16 | 16 | // assigned to it. |
17 | 17 | // |
18 | 18 | // This type is also used as the type for the location the old interrupt vector |
19 | // is backed up to, because all the game state routines "goto" the old handler | |
19 | // is backed up to, because all the game state routines `goto` the old handler | |
20 | 20 | // and the end of their own routines, so the type needs to be compatible. |
21 | 21 | // (In a good sense, it is a continuation.) |
22 | 22 | // |
38 | 38 | screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4 |
39 | 39 | trashes a, x, y, c, z, n, v, ptr, save_x, compare_target |
40 | 40 | game_state_routine |
41 | ||
42 | // | |
43 | // Routines that are called to get the new state of each actor (player, enemy, etc.) | |
44 | // | |
45 | // Routines that conform to this type also follow this convention: | |
46 | // | |
47 | // Set carry if the player perished. Carry clear otherwise. | |
48 | // | |
49 | ||
50 | typedef routine | |
51 | inputs pos, delta, joy2, screen | |
52 | outputs pos, delta, new_pos, screen, c | |
53 | trashes a, x, y, z, n, v, ptr, compare_target | |
54 | logic_routine | |
41 | 55 | |
42 | 56 | // ---------------------------------------------------------------- |
43 | 57 | // System Locations |
250 | 264 | // Actor Logics |
251 | 265 | // ---------------------------------------------------------------- |
252 | 266 | |
253 | // | |
254 | // Sets carry if the player perished. Carry clear otherwise. | |
255 | // | |
256 | ||
257 | routine player_logic | |
258 | inputs pos, delta, joy2, screen | |
259 | outputs pos, delta, new_pos, screen, c | |
260 | trashes a, x, y, z, n, v, ptr, compare_target | |
267 | define player_logic logic_routine | |
261 | 268 | { |
262 | 269 | call read_stick |
263 | 270 | |
312 | 319 | } |
313 | 320 | } |
314 | 321 | |
315 | // | |
316 | // Sets carry if the player perished. Carry clear otherwise. | |
317 | // | |
318 | ||
319 | routine enemy_logic | |
320 | inputs pos, delta, screen | |
321 | outputs pos, delta, new_pos, screen, c | |
322 | trashes a, x, y, z, n, v, ptr, compare_target | |
322 | define enemy_logic logic_routine | |
323 | 323 | { |
324 | 324 | call calculate_new_position |
325 | 325 | call check_new_position_in_bounds |
384 | 384 | // ---------------------------------------------------------------- |
385 | 385 | // Game States |
386 | 386 | // ---------------------------------------------------------------- |
387 | ||
388 | // | |
389 | // Because these all `goto save_cinv` at the end, they must have the same signature as that routine. | |
390 | // | |
391 | 387 | |
392 | 388 | define game_state_title_screen game_state_routine |
393 | 389 | { |