fix hokey pokey menu

the menu eases in, the menu eases out, the menu eases in and you shake it all about
This commit is contained in:
Kistaro Windrider 2025-01-20 18:02:50 -08:00
parent 8ff0732cbc
commit 58da8e6dc3
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -185,7 +185,7 @@ function call_move(x)
end end
function updategame() function updategame()
if (primary_ship.xp >= primary_ship.xptarget) and (lframe - primary_ship.last_xp_frame > 0x0.000f) then if (primary_ship.xp >= primary_ship.xptarget) and (lframe - primary_ship.last_xp_frame > 0x0.000f) and (not primary_ship.dead) then
mode = rearm_mode.new() mode = rearm_mode.new()
return _update60() return _update60()
end end
@ -1766,6 +1766,7 @@ rearm_mode = mknew{
crt_frm = 1, crt_frm = 1,
pos=-1, pos=-1,
init=function(this) init=function(this)
poke(0x5f5c, 255) --no btnp repeat
rearm_mode.shuffle(this) rearm_mode.shuffle(this)
end, end,
} }
@ -1858,21 +1859,22 @@ function rearm_mode:update_pos()
if (not pos) return if (not pos) return
if (pos == 0) then if (pos == 0) then
if (primary_ship.xp < primary_ship.xptarget) self.pos = 1 if (primary_ship.xp < primary_ship.xptarget) self.pos = 1
xpwhoosh = nil
return return
end end
if (pos < 0) pos = min(pos + 0x0.05, 0) if (pos < 0) pos = min(pos + 0x0.05, 0)
if pos > 0 then if pos > 0 then
pos -= 0x0.1 pos -= 0x0.1
if (pos <= 0) pos = nil if (pos <= 0) pos = 999
end end
self.pos = pos self.pos = pos
end end
function rearm_mode:update() function rearm_mode:update()
self:update_pos() self:update_pos()
if not self.pos then if self.pos > 1 then
mode = game_mode mode = game_mode
return _update60() return -- do not advance frame
end end
local sel, bfm = self.sel, self.bfm local sel, bfm = self.sel, self.bfm
if (btn(3) and sel > 0 or btn(2) and sel < 0) sel=-sel if (btn(3) and sel > 0 or btn(2) and sel < 0) sel=-sel
@ -1892,7 +1894,7 @@ function rearm_mode:update()
-- todo: sound: rearm -- todo: sound: rearm
primary_ship.shield = primary_ship.maxshield primary_ship.shield = primary_ship.maxshield
-- todo: rewrite for three guns -- todo: rewrite for three guns
if (primary_ship.spec_gun) primary_ship.spec_gun.ammo = primary_ship.spec_gun.max_ammo if (primary_ship.special_gun) primary_ship.special_gun.ammo = primary_ship.special_gun.max_ammo
primary_ship.hp = min(primary_ship.maxhp, primary_ship.hp + primary_ship.maxhp/2) primary_ship.hp = min(primary_ship.maxhp, primary_ship.hp + primary_ship.maxhp/2)
primary_ship.xp -= primary_ship.xptarget / 2 primary_ship.xp -= primary_ship.xptarget / 2
else else