From 15d2ede2f6802acf6a69cee48b3e5f28b9c917fe Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 18 Feb 2024 19:46:34 -0800 Subject: [PATCH] rename update to u saves 14 chars --- vacation.p8 | 92 ++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/vacation.p8 b/vacation.p8 index 6d741f5..a87086c 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -74,10 +74,10 @@ function event_list:strip(f) end -function event_list:update() +function event_list:u() local p, n = self, self.next while n do - if n:update() then + if n:u() then p.next = n.next else p = n @@ -111,7 +111,7 @@ end function nop() end blank = {} -function blank:update() end +function blank:u() end function blank:draw() end function puke(item, indent, seen, hidekey) @@ -167,8 +167,8 @@ function view.of(subviews) return view.new{views=subviews} end -function view:update() - outer_or_each_opt(self.views, "update") +function view:u() + outer_or_each_opt(self.views, "u") end function view:draw() @@ -230,14 +230,14 @@ function _update60() awaken_now() end end - if exit_dither and exit_dither:update() then + if exit_dither and exit_dither:u() then exit_dither = nil awakener_hold_frames=0 awakener_armed=false mainview = fast_awakener() mainview:activate() end - mainview:update() + mainview:u() end function _draw() @@ -297,7 +297,7 @@ mknew(txtbox, function(self) self.c = deli(self.cols) end) -function txtbox:update() +function txtbox:u() if #self.cols > 0 then self.f += 1 if self.f >= self.interval then @@ -330,9 +330,9 @@ function easeoutovershoot(t) end -function spring:update() +function spring:u() local v = self.v - self.v:update() + self.v:u() if self.f >= self.frames then v.y=self.to return true @@ -354,9 +354,9 @@ scoot = { } mknew(scoot) -function scoot:update() +function scoot:u() local v = self.v - self.v:update() + self.v:u() if self.f >= self.frames then v.y=self.to return true @@ -388,11 +388,11 @@ mknew(scootbox, function(x) } end) -function scootbox:update() +function scootbox:u() if self.go then - self.s:update() + self.s:u() else - self.v:update() + self.v:u() 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 end) -function ditherer:update() +function ditherer:u() 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 return self.i < 0 or self.i >= #self.pattern + 1 @@ -497,7 +497,7 @@ mknew(fuzzy, function(x) end end) -function fuzzy:update() +function fuzzy:u() self.n += 1 if (self.n < self.interval) return self.n = 0 @@ -540,7 +540,7 @@ mknew(fuzzy_stripey, function(f) } end) -function fuzzy_stripey:update() +function fuzzy_stripey:u() local fz = self.fuzz fz.weight = self.weight fz.interval = self.interval @@ -548,7 +548,7 @@ function fuzzy_stripey:update() self.y += self.dy if (self.y <= -self.gap) self.y += self.gap if (self.y >= 0) self.y -= self.gap - fz:update() + fz:u() end function fuzzy_stripey:draw() @@ -594,7 +594,7 @@ breather = { } mknew(breather) -function breather:update() +function breather:u() if (self.freeze) return local f = self.f + 1 if (not self.on) f = 0 @@ -834,7 +834,7 @@ function fadetbl(col, tbl, frac) pal(col,tbl[1+(frac*#tbl)&0x7fff],1) end -function zonk_mode:update() +function zonk_mode:u() if (not self.brth:matches(self.bwt)) self.alwaysmatched=false if self.playing_text then self.twt -= 1 @@ -886,10 +886,10 @@ function zonk_mode:update() self.fpfrm=nil end end - self.stripes:update() - self.brth:update() - self.txt_frame:update() - if (self.d and self.d:update()) seq:next() + self.stripes:u() + self.brth:u() + self.txt_frame:u() + if (self.d and self.d:u()) seq:next() end function zonk_mode:draw() @@ -1030,7 +1030,7 @@ end function awakener_lock() arm_awakener() return { - update=nop, + u=nop, activate=nop, draw=function() pal() @@ -1060,9 +1060,9 @@ mknew(ao_splash, function(self) font_monogram() end) -function ao_splash:update() +function ao_splash:u() if self.c.f < self.c.speed/2.5 then - self.c:update() + self.c:u() return end self.fwait -= 1 @@ -1070,10 +1070,10 @@ function ao_splash:update() if self.fwait == 0 then self.d = ditherer.new{di=1} end - if (self.d) self.d:update() + if (self.d) self.d:u() if self.fwait <= -32 then mainview=consent_splash.new() - mainview:update() + mainview:u() end end @@ -1098,12 +1098,12 @@ mknew(consent_splash, function(self) awakener_hold_frames = 0 end) -function consent_splash:update() +function consent_splash:u() if (self.f < 0x7fff) self.f += 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:update() + mainview:u() end end @@ -1157,7 +1157,7 @@ mknew(title_screen, function(t) draw=function() t:draw_menu() end, - update=nop, + u=nop, }, phin_x = 62, } @@ -1186,13 +1186,13 @@ function title_screen:draw_menu() end end -function title_screen:update() +function title_screen:u() self.a.wordwait=999 if btnp(1) and self.a.wordremain ~= 0 then self.a.wordremain=0 create_game() end - self.a:update() + self.a:u() end -->8 -- dolphin sprite renderer @@ -1277,7 +1277,7 @@ toyphin = { } mknew(toyphin) -function toyphin:update() +function toyphin:u() local x, y, dy, splash = self.x, self.y, self.dy, self.splasher -- entry mode? if not self.entered then @@ -1410,7 +1410,7 @@ function collides(b1, b2) return not (b1[2] + b1[4] < b2[2]) end -function wordtarget:update() +function wordtarget:u() if collides({self.x, self.y, self.w, 6}, self.phin:box()) then self:on_hit() return true @@ -1479,7 +1479,7 @@ spark = { f=-1, } mknew(spark) -function spark:update() +function spark:u() self.f += 1 if (self.f >= 12) return true self.x += self.dx @@ -1539,7 +1539,7 @@ function arcade_level:activate() font_compact() end -function arcade_level:update() +function arcade_level:u() if self.phin.entered then if self.wordtimer <= 0 and self.wordremain > 0 then self:spawn_word() @@ -1552,9 +1552,9 @@ function arcade_level:update() self.phin.exiting = true end if self.phin.x > 90 then - if (self.d:update()) seq:next() + if (self.d:u()) seq:next() end - self.v:update() + self.v:u() end function arcade_level:spawn_word() @@ -1661,7 +1661,7 @@ mknew(droplet, function(d) d.c = rnd(splashcols) end) -function droplet:update() +function droplet:u() self.x += self.dx self.y += self.dy self.dy += 0.3 @@ -1723,12 +1723,12 @@ accomplishment already. will you end end -function ggwp:update() +function ggwp:u() if (hz(2) ~= self.lasthz) self.col = irnd(8)+8 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) self.frem -= 1 - if (self.d and self.d:update()) seq:next() + if (self.d and self.d:u()) seq:next() end 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() end mainview:activate() - mainview:update() + mainview:u() end function create_game()