git @ Cat's Eye Technologies SixtyPical / 0438725
Add another typedef in the demo game. Chris Pressey 4 years ago
1 changed file(s) with 17 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
1616 // assigned to it.
1717 //
1818 // 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
2020 // and the end of their own routines, so the type needs to be compatible.
2121 // (In a good sense, it is a continuation.)
2222 //
3838 screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
3939 trashes a, x, y, c, z, n, v, ptr, save_x, compare_target
4040 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
4155
4256 // ----------------------------------------------------------------
4357 // System Locations
250264 // Actor Logics
251265 // ----------------------------------------------------------------
252266
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
261268 {
262269 call read_stick
263270
312319 }
313320 }
314321
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
323323 {
324324 call calculate_new_position
325325 call check_new_position_in_bounds
384384 // ----------------------------------------------------------------
385385 // Game States
386386 // ----------------------------------------------------------------
387
388 //
389 // Because these all `goto save_cinv` at the end, they must have the same signature as that routine.
390 //
391387
392388 define game_state_title_screen game_state_routine
393389 {