cloud prototype in-game
This commit is contained in:
parent
dd34ad0a37
commit
b421df9174
@ -9,11 +9,16 @@ Arcade Mode palette notes:
|
||||
-- 4 (underwater) is a deeper blue shade part of sea
|
||||
-- 6: dolphin specular highlights
|
||||
-- 7: dolphin white paint
|
||||
-- 8, 9: unassigned, layer specific
|
||||
-- 8, 9: layer specific
|
||||
-- sky:
|
||||
-- 8: bright cloud shadows (15)
|
||||
-- 9: light gray for clouds (6? 13? 134?)
|
||||
-- 10: word primary (yellow 10?)
|
||||
-- 11: word shadow (wood 132?)
|
||||
-- 12: dolphin eye
|
||||
-- 13: common sky color
|
||||
-- 13: common sky color
|
||||
-- this is a reassignment candidate but means I will never do
|
||||
-- the "sunset palette cycle" thing
|
||||
-- 14: dolphin primary color
|
||||
-- 15: highlight white (all layers)
|
||||
--
|
||||
|
95
vacation.p8
95
vacation.p8
@ -1396,6 +1396,97 @@ function toyphin:draw()
|
||||
spr(st.s[1+(((t()<<1)&0x0.ffff*#st.s)&0x7fff)], self.x + st.xo, y + st.yo, self.state.ws, self.state.hs)
|
||||
end
|
||||
|
||||
-->8
|
||||
|
||||
-- pyrex's cloud renderer
|
||||
|
||||
cld_bpl={241,242,244,248}
|
||||
cmgr={
|
||||
f=0,
|
||||
df=1,
|
||||
bpi=1, -- TODO: bitplane index -- different algorithm
|
||||
sprs=10,
|
||||
step=3,
|
||||
y=12,
|
||||
h=9,
|
||||
oval_h=4,
|
||||
c0 = 8, -- shadow
|
||||
c1 = 7, -- primary
|
||||
}
|
||||
mknew(cmgr, function(self)
|
||||
self.clouds = {}
|
||||
--todo: nonempty spawn
|
||||
end)
|
||||
|
||||
function cmgr:u()
|
||||
self.f+=self.df
|
||||
if self.f%(self.step*self.sprs) == 0 then
|
||||
self.f=0
|
||||
local bp=cld_bpl[self.bpi]
|
||||
self.bpi += 1
|
||||
if (self.bpi > #cld_bpl) self.bpi = 1
|
||||
add(self.clouds,{x=127,y=rnd()*self.h,w=flr(rnd()*16)+16,plane=bp})
|
||||
end
|
||||
|
||||
if self.f%self.step==0 then
|
||||
local clouds2={}
|
||||
for c in all(self.clouds) do
|
||||
c.x-=1
|
||||
if (c.x+c.w>-6) add(clouds2,c)
|
||||
end
|
||||
self.clouds=clouds2
|
||||
end
|
||||
end
|
||||
|
||||
function cmgr:draw()
|
||||
--back up pal01
|
||||
memcpy(0x8010,0x5f00,32)
|
||||
--back up pal2
|
||||
memcpy(0x8000,0x5f60,16)
|
||||
fillp(0)
|
||||
local h=self.h+self.oval_h+1
|
||||
assert(h<=16)
|
||||
|
||||
-- render to spritesheet
|
||||
poke(0x5f55,0x00)
|
||||
rectfill(0,96,127,96+h,0)
|
||||
|
||||
-- use bitplanes
|
||||
for c in all(self.clouds) do
|
||||
poke(0x5f5e,c.plane)
|
||||
ovalfill(c.x,96+c.y,c.x+c.w,96+c.y+self.oval_h,15)
|
||||
end
|
||||
poke(0x5f5e,255)
|
||||
|
||||
-- render from high memory
|
||||
-- to higher memory
|
||||
rectfill(0,112,127,112+h,0)
|
||||
|
||||
palt(0b1110100010000000)
|
||||
for i=0,15 do
|
||||
pal(i,7)
|
||||
end
|
||||
|
||||
poke(0x5f5e,0xf1)
|
||||
sspr(0,96,128,h,0,112)
|
||||
poke(0x5f5e,0xf2)
|
||||
sspr(0,96,128,h,1,112+1)
|
||||
sspr(0,96,128,h,5,112+1)
|
||||
poke(0x5f5e,255)
|
||||
|
||||
-- render to screen
|
||||
poke(0x5f55,0x60)
|
||||
pal()
|
||||
pal(1,self.c1)
|
||||
pal(2,self.c0)
|
||||
pal(3,self.c1)
|
||||
sspr(0,112,128,h,0,self.y)
|
||||
|
||||
-- restore former palettes
|
||||
memcpy(0x5f00,0x8010,32)
|
||||
memcpy(0x5f60,0x8000,16)
|
||||
end
|
||||
|
||||
-->8
|
||||
-- arcade mode
|
||||
|
||||
@ -1441,7 +1532,7 @@ function setup_arcade_pal()
|
||||
pal()
|
||||
--game_nrm_pal
|
||||
pal({
|
||||
[0] = 1, 0, 2, 140, 4, 5, 7, 7, 8, 9, 10, 132, 12, 12, 14, 7
|
||||
[0] = 1, 0, 2, 140, 4, 5, 7, 7, 15, 6, 10, 132, 12, 12, 14, 7
|
||||
}, 1)
|
||||
--game_uw_pal
|
||||
pal({
|
||||
@ -1565,6 +1656,7 @@ mknew(arcade_level, function(x)
|
||||
}
|
||||
x.sky = bg.new{c=13}
|
||||
x.sea = sea.new()
|
||||
x.cld1 = cmgr.new{}
|
||||
x.bg = event_list.new()
|
||||
x.fg = event_list.new()
|
||||
x.words = event_list.new()
|
||||
@ -1574,6 +1666,7 @@ mknew(arcade_level, function(x)
|
||||
|
||||
x.v = view.of{
|
||||
x.sky,
|
||||
x.cld1,
|
||||
x.sea,
|
||||
x.waves,
|
||||
x.noscore and blank or {
|
||||
|
Loading…
Reference in New Issue
Block a user