mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-08-16 00:27:39 +00:00
Use word tables, in game, to store the actors' positions and deltas.
This commit is contained in:
@@ -27,12 +27,18 @@ byte joy2 @ $dc00
|
|||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
pointer ptr @ 254
|
pointer ptr @ 254
|
||||||
|
|
||||||
|
word table actor_pos
|
||||||
word pos
|
word pos
|
||||||
|
|
||||||
|
word table actor_delta
|
||||||
word delta
|
word delta
|
||||||
|
|
||||||
byte button_down : 0 // effectively static-local to check_button
|
byte button_down : 0 // effectively static-local to check_button
|
||||||
byte table press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
byte table press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
||||||
|
|
||||||
|
byte save_x
|
||||||
|
|
||||||
//
|
//
|
||||||
// Points to the routine that implements the current game state.
|
// Points to the routine that implements the current game state.
|
||||||
//
|
//
|
||||||
@@ -44,9 +50,11 @@ byte table press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
|||||||
//
|
//
|
||||||
|
|
||||||
vector dispatch_game_state
|
vector dispatch_game_state
|
||||||
inputs joy2, pos, button_down, press_fire_msg, dispatch_game_state,
|
inputs joy2, button_down, press_fire_msg, dispatch_game_state, save_x,
|
||||||
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
actor_pos, pos, actor_delta, delta,
|
||||||
outputs delta, pos, button_down, dispatch_game_state,
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
outputs button_down, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
trashes a, x, y, c, z, n, v, ptr
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
|
|
||||||
@@ -63,17 +71,21 @@ vector dispatch_game_state
|
|||||||
//
|
//
|
||||||
|
|
||||||
vector cinv
|
vector cinv
|
||||||
inputs joy2, pos, button_down, press_fire_msg, dispatch_game_state,
|
inputs joy2, button_down, press_fire_msg, dispatch_game_state, save_x,
|
||||||
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
actor_pos, pos, actor_delta, delta,
|
||||||
outputs delta, pos, button_down, dispatch_game_state,
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
outputs button_down, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
trashes a, x, y, c, z, n, v, ptr
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
@ 788
|
@ 788
|
||||||
|
|
||||||
vector save_cinv
|
vector save_cinv
|
||||||
inputs joy2, pos, button_down, press_fire_msg, dispatch_game_state,
|
inputs joy2, button_down, press_fire_msg, dispatch_game_state, save_x,
|
||||||
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
actor_pos, pos, actor_delta, delta,
|
||||||
outputs delta, pos, button_down, dispatch_game_state,
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
outputs button_down, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
trashes a, x, y, c, z, n, v, ptr
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
|
|
||||||
@@ -169,18 +181,12 @@ routine clear_screen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// Game States
|
// Actor Logics
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
//
|
routine player_logic
|
||||||
// Because these all `goto save_cinv` at the end, they must have the same signature as that routine.
|
inputs pos, delta, joy2, screen
|
||||||
//
|
outputs pos, delta, screen
|
||||||
|
|
||||||
routine game_state_play
|
|
||||||
inputs joy2, pos, button_down, press_fire_msg, dispatch_game_state,
|
|
||||||
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
|
||||||
outputs delta, pos, button_down, dispatch_game_state,
|
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
|
||||||
trashes a, x, y, c, z, n, v, ptr
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
{
|
{
|
||||||
call read_stick
|
call read_stick
|
||||||
@@ -194,14 +200,68 @@ routine game_state_play
|
|||||||
|
|
||||||
ld y, 0
|
ld y, 0
|
||||||
copy 81, [ptr] + y
|
copy 81, [ptr] + y
|
||||||
|
}
|
||||||
|
|
||||||
|
routine enemy_logic
|
||||||
|
inputs pos, delta, joy2, screen
|
||||||
|
outputs pos, delta, screen
|
||||||
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
// Game States
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
//
|
||||||
|
// Because these all `goto save_cinv` at the end, they must have the same signature as that routine.
|
||||||
|
//
|
||||||
|
|
||||||
|
routine game_state_play
|
||||||
|
inputs joy2, button_down, press_fire_msg, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
outputs button_down, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
|
{
|
||||||
|
ld x, 0
|
||||||
|
repeat {
|
||||||
|
copy actor_pos + x, pos
|
||||||
|
copy actor_delta + x, delta
|
||||||
|
|
||||||
|
st x, save_x
|
||||||
|
|
||||||
|
////// FIXME need VECTOR TABLEs to make this happen:
|
||||||
|
////// copy actor_logic, x dispatch_logic
|
||||||
|
////// call indirect_jsr_logic
|
||||||
|
|
||||||
|
cmp x, 0
|
||||||
|
if z {
|
||||||
|
call player_logic
|
||||||
|
} else {
|
||||||
|
call enemy_logic
|
||||||
|
}
|
||||||
|
|
||||||
|
ld x, save_x
|
||||||
|
|
||||||
|
copy pos, actor_pos + x
|
||||||
|
copy delta, actor_delta + x
|
||||||
|
|
||||||
|
inc x
|
||||||
|
cmp x, 16
|
||||||
|
} until z
|
||||||
|
|
||||||
goto save_cinv
|
goto save_cinv
|
||||||
}
|
}
|
||||||
|
|
||||||
routine game_state_title_screen
|
routine game_state_title_screen
|
||||||
inputs joy2, pos, button_down, press_fire_msg, dispatch_game_state,
|
inputs joy2, button_down, press_fire_msg, dispatch_game_state, save_x,
|
||||||
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
actor_pos, pos, actor_delta, delta,
|
||||||
outputs delta, pos, button_down, dispatch_game_state,
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
outputs button_down, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
trashes a, x, y, c, z, n, v, ptr
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
{
|
{
|
||||||
@@ -239,9 +299,11 @@ routine game_state_title_screen
|
|||||||
// *************************
|
// *************************
|
||||||
|
|
||||||
routine our_cinv
|
routine our_cinv
|
||||||
inputs joy2, pos, button_down, press_fire_msg, dispatch_game_state,
|
inputs joy2, button_down, press_fire_msg, dispatch_game_state, save_x,
|
||||||
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
actor_pos, pos, actor_delta, delta,
|
||||||
outputs delta, pos, button_down, dispatch_game_state,
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
|
outputs button_down, dispatch_game_state, save_x,
|
||||||
|
actor_pos, pos, actor_delta, delta,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
trashes a, x, y, c, z, n, v, ptr
|
trashes a, x, y, c, z, n, v, ptr
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user