groundwork for full mode switching

This commit is contained in:
Kistaro Windrider 2024-12-29 23:26:48 -08:00
parent c55ea000fd
commit 42ac2abc20
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -124,11 +124,12 @@ function linked_list:pop_front()
end end
function _init() function _init()
mode = game_mode
init_blip_pals() init_blip_pals()
wipe_level() wipe_level()
primary_ship.main_gun = zap_gun_p.new() -- redundant? primary_ship.main_gun = zap_gun_p.new() -- redundant?
load_level(example_level_csv) load_level(example_level_csv)
state = game game_state = game
pal(2,129) pal(2,129)
pal() pal()
end end
@ -172,7 +173,7 @@ function wipe_level()
end end
function _update60() function _update60()
updategame() mode:update()
end end
function call_f(x) function call_f(x)
@ -249,9 +250,9 @@ function updategame()
intangibles_fg:strip(call_move) intangibles_fg:strip(call_move)
if leveldone and not eships.next and not ebullets.next and not events.next then if leveldone and not eships.next and not ebullets.next and not events.next then
state = win game_state = win
end end
if (not pships.next) state = lose if (not pships.next) game_state = lose
if primary_ship.xp >= primary_ship.xptarget then if primary_ship.xp >= primary_ship.xptarget then
if not xpwhoosh then if not xpwhoosh then
@ -266,14 +267,23 @@ function updategame()
end end
function _draw() function _draw()
mode:draw()
end
function drawgame_top()
fillp(0) fillp(0)
drawgame() drawgame()
if (state == game) fadelvl = -45 if (game_state == game) fadelvl = -45
if (state == win) dropshadow("win",50,61,11) if (game_state == win) dropshadow("win",50,61,11)
if (state == lose) dropshadow("fail",48,61,8) if (game_state == lose) dropshadow("fail",48,61,8)
fadescreen() fadescreen()
end end
game_mode = {
update = updategame,
draw = drawgame_top,
}
fadetable = split"0,1.5,1025.5,1029.5,1285.5,1413.5,9605.5,9637.5,-23130.5,-23066.5,-18970.5,-18954.5,-2570.5,-2568.5,-520.5,-8.5,-0.5" fadetable = split"0,1.5,1025.5,1029.5,1285.5,1413.5,9605.5,9637.5,-23130.5,-23066.5,-18970.5,-18954.5,-2570.5,-2568.5,-520.5,-8.5,-0.5"
function fadescreen() function fadescreen()