From e9d9c717bb2716894e3f6569d666224185bb16c0 Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Fri, 9 Feb 2018 16:57:49 +0000 Subject: [PATCH] More statics in demo game. --- eg/proto-game.60p | 13 ++++++------- loadngo.sh | 1 + src/sixtypical/analyzer.py | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/eg/proto-game.60p b/eg/proto-game.60p index dd9578f..abc9864 100644 --- a/eg/proto-game.60p +++ b/eg/proto-game.60p @@ -37,7 +37,7 @@ typedef routine outputs button_down, dispatch_game_state, actor_pos, actor_delta, actor_logic, screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4 - trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, compare_target, dispatch_logic + trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, dispatch_logic game_state_routine // @@ -51,7 +51,7 @@ typedef routine typedef routine inputs pos, delta, joy2, screen outputs pos, delta, new_pos, screen, c - trashes a, x, y, z, n, v, ptr, compare_target + trashes a, x, y, z, n, v, ptr logic_routine // ---------------------------------------------------------------- @@ -93,8 +93,6 @@ vector logic_routine dispatch_logic byte button_down : 0 // effectively static-local to check_button byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY" -word compare_target - // // Points to the routine that implements the current game state. // @@ -217,10 +215,11 @@ routine calculate_new_position add new_pos, delta } -routine check_new_position_in_bounds +define check_new_position_in_bounds routine inputs new_pos outputs c - trashes compare_target, a, z, n, v + trashes a, z, n, v + static word compare_target : 0 { copy 1000, compare_target st on, c @@ -321,6 +320,7 @@ define player_logic logic_routine } define enemy_logic logic_routine + static word compare_target : 0 { call calculate_new_position call check_new_position_in_bounds @@ -372,7 +372,6 @@ define enemy_logic logic_routine } else { copy $ffd8, delta } - trash compare_target } st off, c diff --git a/loadngo.sh b/loadngo.sh index 96d2b2b..0a3401e 100755 --- a/loadngo.sh +++ b/loadngo.sh @@ -10,6 +10,7 @@ if [ "X$1" = "X" ]; then fi OUT=/tmp/a-out.prg bin/sixtypical --traceback --basic-prelude $SRC > $OUT || exit 1 +ls -la $OUT if [ -e vicerc ]; then $X64 -config vicerc $OUT else diff --git a/src/sixtypical/analyzer.py b/src/sixtypical/analyzer.py index 74466f4..ecc88e4 100644 --- a/src/sixtypical/analyzer.py +++ b/src/sixtypical/analyzer.py @@ -56,7 +56,10 @@ class IncompatibleConstraintsError(ConstraintsError): def routine_has_static(routine, ref): if not hasattr(routine, 'statics'): return False - return ref in [static.location for static in routine.statics] + for static in routine.statics: + if static.location == ref: + return True + return False class Context(object):