rename update to u

saves 14 chars
This commit is contained in:
Kistaro Windrider 2024-02-18 19:46:34 -08:00
parent bece54a09f
commit 15d2ede2f6
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -74,10 +74,10 @@ function event_list:strip(f)
end end
function event_list:update() function event_list:u()
local p, n = self, self.next local p, n = self, self.next
while n do while n do
if n:update() then if n:u() then
p.next = n.next p.next = n.next
else else
p = n p = n
@ -111,7 +111,7 @@ end
function nop() end function nop() end
blank = {} blank = {}
function blank:update() end function blank:u() end
function blank:draw() end function blank:draw() end
function puke(item, indent, seen, hidekey) function puke(item, indent, seen, hidekey)
@ -167,8 +167,8 @@ function view.of(subviews)
return view.new{views=subviews} return view.new{views=subviews}
end end
function view:update() function view:u()
outer_or_each_opt(self.views, "update") outer_or_each_opt(self.views, "u")
end end
function view:draw() function view:draw()
@ -230,14 +230,14 @@ function _update60()
awaken_now() awaken_now()
end end
end end
if exit_dither and exit_dither:update() then if exit_dither and exit_dither:u() then
exit_dither = nil exit_dither = nil
awakener_hold_frames=0 awakener_hold_frames=0
awakener_armed=false awakener_armed=false
mainview = fast_awakener() mainview = fast_awakener()
mainview:activate() mainview:activate()
end end
mainview:update() mainview:u()
end end
function _draw() function _draw()
@ -297,7 +297,7 @@ mknew(txtbox, function(self)
self.c = deli(self.cols) self.c = deli(self.cols)
end) end)
function txtbox:update() function txtbox:u()
if #self.cols > 0 then if #self.cols > 0 then
self.f += 1 self.f += 1
if self.f >= self.interval then if self.f >= self.interval then
@ -330,9 +330,9 @@ function easeoutovershoot(t)
end end
function spring:update() function spring:u()
local v = self.v local v = self.v
self.v:update() self.v:u()
if self.f >= self.frames then if self.f >= self.frames then
v.y=self.to v.y=self.to
return true return true
@ -354,9 +354,9 @@ scoot = {
} }
mknew(scoot) mknew(scoot)
function scoot:update() function scoot:u()
local v = self.v local v = self.v
self.v:update() self.v:u()
if self.f >= self.frames then if self.f >= self.frames then
v.y=self.to v.y=self.to
return true return true
@ -388,11 +388,11 @@ mknew(scootbox, function(x)
} }
end) end)
function scootbox:update() function scootbox:u()
if self.go then if self.go then
self.s:update() self.s:u()
else else
self.v:update() self.v:u()
end end
end end
@ -469,7 +469,7 @@ mknew(ditherer, function(x)
if (x.di and x.di < 0 and not x.i) x.i = (x.pattern and #x.pattern or #fadetable) + 0.99 if (x.di and x.di < 0 and not x.i) x.i = (x.pattern and #x.pattern or #fadetable) + 0.99
end) end)
function ditherer:update() function ditherer:u()
if (self.i > 0 and self.di < 0) self.i += self.di if (self.i > 0 and self.di < 0) self.i += self.di
if (self.i < #self.pattern + 1 and self.di > 0) self.i += self.di if (self.i < #self.pattern + 1 and self.di > 0) self.i += self.di
return self.i < 0 or self.i >= #self.pattern + 1 return self.i < 0 or self.i >= #self.pattern + 1
@ -497,7 +497,7 @@ mknew(fuzzy, function(x)
end end
end) end)
function fuzzy:update() function fuzzy:u()
self.n += 1 self.n += 1
if (self.n < self.interval) return if (self.n < self.interval) return
self.n = 0 self.n = 0
@ -540,7 +540,7 @@ mknew(fuzzy_stripey, function(f)
} }
end) end)
function fuzzy_stripey:update() function fuzzy_stripey:u()
local fz = self.fuzz local fz = self.fuzz
fz.weight = self.weight fz.weight = self.weight
fz.interval = self.interval fz.interval = self.interval
@ -548,7 +548,7 @@ function fuzzy_stripey:update()
self.y += self.dy self.y += self.dy
if (self.y <= -self.gap) self.y += self.gap if (self.y <= -self.gap) self.y += self.gap
if (self.y >= 0) self.y -= self.gap if (self.y >= 0) self.y -= self.gap
fz:update() fz:u()
end end
function fuzzy_stripey:draw() function fuzzy_stripey:draw()
@ -594,7 +594,7 @@ breather = {
} }
mknew(breather) mknew(breather)
function breather:update() function breather:u()
if (self.freeze) return if (self.freeze) return
local f = self.f + 1 local f = self.f + 1
if (not self.on) f = 0 if (not self.on) f = 0
@ -834,7 +834,7 @@ function fadetbl(col, tbl, frac)
pal(col,tbl[1+(frac*#tbl)&0x7fff],1) pal(col,tbl[1+(frac*#tbl)&0x7fff],1)
end end
function zonk_mode:update() function zonk_mode:u()
if (not self.brth:matches(self.bwt)) self.alwaysmatched=false if (not self.brth:matches(self.bwt)) self.alwaysmatched=false
if self.playing_text then if self.playing_text then
self.twt -= 1 self.twt -= 1
@ -886,10 +886,10 @@ function zonk_mode:update()
self.fpfrm=nil self.fpfrm=nil
end end
end end
self.stripes:update() self.stripes:u()
self.brth:update() self.brth:u()
self.txt_frame:update() self.txt_frame:u()
if (self.d and self.d:update()) seq:next() if (self.d and self.d:u()) seq:next()
end end
function zonk_mode:draw() function zonk_mode:draw()
@ -1030,7 +1030,7 @@ end
function awakener_lock() function awakener_lock()
arm_awakener() arm_awakener()
return { return {
update=nop, u=nop,
activate=nop, activate=nop,
draw=function() draw=function()
pal() pal()
@ -1060,9 +1060,9 @@ mknew(ao_splash, function(self)
font_monogram() font_monogram()
end) end)
function ao_splash:update() function ao_splash:u()
if self.c.f < self.c.speed/2.5 then if self.c.f < self.c.speed/2.5 then
self.c:update() self.c:u()
return return
end end
self.fwait -= 1 self.fwait -= 1
@ -1070,10 +1070,10 @@ function ao_splash:update()
if self.fwait == 0 then if self.fwait == 0 then
self.d = ditherer.new{di=1} self.d = ditherer.new{di=1}
end end
if (self.d) self.d:update() if (self.d) self.d:u()
if self.fwait <= -32 then if self.fwait <= -32 then
mainview=consent_splash.new() mainview=consent_splash.new()
mainview:update() mainview:u()
end end
end end
@ -1098,12 +1098,12 @@ mknew(consent_splash, function(self)
awakener_hold_frames = 0 awakener_hold_frames = 0
end) end)
function consent_splash:update() function consent_splash:u()
if (self.f < 0x7fff) self.f += 1 if (self.f < 0x7fff) self.f += 1
if (btnp(1) and self.f > 150) self.d.di = 1 if (btnp(1) and self.f > 150) self.d.di = 1
if self.d:update() and self.d.di > 0 then if self.d:u() and self.d.di > 0 then
mainview=newtitle() mainview=newtitle()
mainview:update() mainview:u()
end end
end end
@ -1157,7 +1157,7 @@ mknew(title_screen, function(t)
draw=function() draw=function()
t:draw_menu() t:draw_menu()
end, end,
update=nop, u=nop,
}, },
phin_x = 62, phin_x = 62,
} }
@ -1186,13 +1186,13 @@ function title_screen:draw_menu()
end end
end end
function title_screen:update() function title_screen:u()
self.a.wordwait=999 self.a.wordwait=999
if btnp(1) and self.a.wordremain ~= 0 then if btnp(1) and self.a.wordremain ~= 0 then
self.a.wordremain=0 self.a.wordremain=0
create_game() create_game()
end end
self.a:update() self.a:u()
end end
-->8 -->8
-- dolphin sprite renderer -- dolphin sprite renderer
@ -1277,7 +1277,7 @@ toyphin = {
} }
mknew(toyphin) mknew(toyphin)
function toyphin:update() function toyphin:u()
local x, y, dy, splash = self.x, self.y, self.dy, self.splasher local x, y, dy, splash = self.x, self.y, self.dy, self.splasher
-- entry mode? -- entry mode?
if not self.entered then if not self.entered then
@ -1410,7 +1410,7 @@ function collides(b1, b2)
return not (b1[2] + b1[4] < b2[2]) return not (b1[2] + b1[4] < b2[2])
end end
function wordtarget:update() function wordtarget:u()
if collides({self.x, self.y, self.w, 6}, self.phin:box()) then if collides({self.x, self.y, self.w, 6}, self.phin:box()) then
self:on_hit() self:on_hit()
return true return true
@ -1479,7 +1479,7 @@ spark = {
f=-1, f=-1,
} }
mknew(spark) mknew(spark)
function spark:update() function spark:u()
self.f += 1 self.f += 1
if (self.f >= 12) return true if (self.f >= 12) return true
self.x += self.dx self.x += self.dx
@ -1539,7 +1539,7 @@ function arcade_level:activate()
font_compact() font_compact()
end end
function arcade_level:update() function arcade_level:u()
if self.phin.entered then if self.phin.entered then
if self.wordtimer <= 0 and self.wordremain > 0 then if self.wordtimer <= 0 and self.wordremain > 0 then
self:spawn_word() self:spawn_word()
@ -1552,9 +1552,9 @@ function arcade_level:update()
self.phin.exiting = true self.phin.exiting = true
end end
if self.phin.x > 90 then if self.phin.x > 90 then
if (self.d:update()) seq:next() if (self.d:u()) seq:next()
end end
self.v:update() self.v:u()
end end
function arcade_level:spawn_word() function arcade_level:spawn_word()
@ -1661,7 +1661,7 @@ mknew(droplet, function(d)
d.c = rnd(splashcols) d.c = rnd(splashcols)
end) end)
function droplet:update() function droplet:u()
self.x += self.dx self.x += self.dx
self.y += self.dy self.y += self.dy
self.dy += 0.3 self.dy += 0.3
@ -1723,12 +1723,12 @@ accomplishment already. will you
end end
end end
function ggwp:update() function ggwp:u()
if (hz(2) ~= self.lasthz) self.col = irnd(8)+8 if (hz(2) ~= self.lasthz) self.col = irnd(8)+8
self.lasthz = hz(2) self.lasthz = hz(2)
if (self.frem <= 0 and btnp(1) and not self.d) self.d = ditherer.new{di=0.5} if (self.frem <= 0 and btnp(1) and not self.d) self.d = ditherer.new{di=0.5}
if (self.frem > 0) self.frem -= 1 if (self.frem > 0) self.frem -= 1
if (self.d and self.d:update()) seq:next() if (self.d and self.d:u()) seq:next()
end end
sunset_pal=split"12,13,14,8,137,9,10,129,1,130,2,140,5,6,7" sunset_pal=split"12,13,14,8,137,9,10,129,1,130,2,140,5,6,7"
@ -1799,7 +1799,7 @@ function sequencer:next()
mainview = rec.f() mainview = rec.f()
end end
mainview:activate() mainview:activate()
mainview:update() mainview:u()
end end
function create_game() function create_game()