forked from pyrex/chameleonic
Compare commits
5 Commits
e3dfd9e2b0
...
39efcdc1d5
Author | SHA1 | Date | |
---|---|---|---|
39efcdc1d5 | |||
24954c1145 | |||
49aa2833fd | |||
5df3f00809 | |||
c81b3a03d3 |
266
chameleonic.p8
266
chameleonic.p8
@ -8,8 +8,9 @@ real_modules={}
|
|||||||
frame=0
|
frame=0
|
||||||
function _init()
|
function _init()
|
||||||
-- printh("restarting")
|
-- printh("restarting")
|
||||||
music_on()
|
_doall("init")
|
||||||
_doall("init") end
|
end
|
||||||
|
|
||||||
function _update()
|
function _update()
|
||||||
frame+=1
|
frame+=1
|
||||||
if (frame%1==0) _doall("update") end
|
if (frame%1==0) _doall("update") end
|
||||||
@ -17,12 +18,16 @@ function _draw()
|
|||||||
_doall("draw") end
|
_doall("draw") end
|
||||||
|
|
||||||
function music_on()
|
function music_on()
|
||||||
music(0)
|
if (stat(54) ~= 0) music(0)
|
||||||
|
persist.music=true
|
||||||
|
persist:write()
|
||||||
menuitem(3, "music: on", music_off)
|
menuitem(3, "music: on", music_off)
|
||||||
end
|
end
|
||||||
|
|
||||||
function music_off()
|
function music_off()
|
||||||
music(-1)
|
music(-1)
|
||||||
|
persist.music=false
|
||||||
|
persist:write()
|
||||||
menuitem(3, "music: off", music_on)
|
menuitem(3, "music: off", music_on)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -261,7 +266,7 @@ end
|
|||||||
title={}
|
title={}
|
||||||
add(modules,title)
|
add(modules,title)
|
||||||
|
|
||||||
blinkcol=10
|
lvlshimmer = {4,9,10,10,9}
|
||||||
function title:draw()
|
function title:draw()
|
||||||
cls(0)
|
cls(0)
|
||||||
-- this is right for 72x32
|
-- this is right for 72x32
|
||||||
@ -270,22 +275,33 @@ function title:draw()
|
|||||||
print("[nyeogmi]",62,73,7)
|
print("[nyeogmi]",62,73,7)
|
||||||
print("kistaro",32,79,7)
|
print("kistaro",32,79,7)
|
||||||
local lvlstr = "⬅️ "..start_level.." ➡️"
|
local lvlstr = "⬅️ "..start_level.." ➡️"
|
||||||
print(lvlstr,50,91,1)
|
local lx, ly = 51+wrongbleep:vibrate(), 90+wrongbleep:vibrate()
|
||||||
print(lvlstr,51,90,blinkcol)
|
print(lvlstr,lx-1,ly+1,1)
|
||||||
|
print(lvlstr,lx,ly,cycle(lvlshimmer))
|
||||||
end
|
end
|
||||||
|
|
||||||
start_level=0
|
function title:init()
|
||||||
max_level=31
|
start_level=persist.recent_level
|
||||||
|
-- max_level=persist.max_level
|
||||||
|
max_level = 31 --debugging/coding
|
||||||
|
wiped = false
|
||||||
|
end
|
||||||
|
|
||||||
function title:update()
|
function title:update()
|
||||||
blinkcol=9
|
|
||||||
if (time()*4\1%2==0) blinkcol=10
|
|
||||||
|
|
||||||
if (btnp"0") start_level-=1
|
if (btnp"0") start_level-=1
|
||||||
if (btnp"1") start_level+=1
|
if (btnp"1") start_level+=1
|
||||||
start_level%=max_level
|
start_level%=(max_level+1)
|
||||||
|
if btn"3" and not wiped then
|
||||||
if (btnp"4" or btnp"5") modules=real_modules _init() music(0)
|
wrongbleep:bleep()
|
||||||
|
if (wrongbleep:adequately_warned()) then
|
||||||
|
persist:wipe()
|
||||||
|
max_level = 0
|
||||||
|
start_level = 0
|
||||||
|
wiped=true
|
||||||
|
-- todo: sfx(kaboom!)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (btnp"4" or btnp"5") modules=real_modules _init()
|
||||||
end
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
@ -308,6 +324,8 @@ function level:reinit(n)
|
|||||||
self:load_dynobjs()
|
self:load_dynobjs()
|
||||||
self:recollide_reanchor()
|
self:recollide_reanchor()
|
||||||
self:spawn_exit()
|
self:spawn_exit()
|
||||||
|
|
||||||
|
persist:lvlstart()
|
||||||
end
|
end
|
||||||
|
|
||||||
function level:restart()
|
function level:restart()
|
||||||
@ -319,7 +337,6 @@ function level:advance()
|
|||||||
end
|
end
|
||||||
|
|
||||||
normpal = {[1]=0,[8]=0,[14]=0}
|
normpal = {[1]=0,[8]=0,[14]=0}
|
||||||
pitpal = {[8]=0,[13]=3,[4]=3,[7]=3}
|
|
||||||
function level:draw()
|
function level:draw()
|
||||||
cls(5)
|
cls(5)
|
||||||
fillp()
|
fillp()
|
||||||
@ -332,15 +349,11 @@ function level:draw()
|
|||||||
|
|
||||||
for _,pit in pairs(self._pits) do
|
for _,pit in pairs(self._pits) do
|
||||||
local px,py=pit.px,pit.py
|
local px,py=pit.px,pit.py
|
||||||
local pr=self._pits[_mix(px+1,py)]
|
local pr=self._pits[_mix{px+1,py}]
|
||||||
|
|
||||||
spr(pit.s,px,py)
|
spr(pit.s,px,py)
|
||||||
if pit.full then
|
if pit.full then
|
||||||
pal(pitpal)
|
spr(15,pit.px,pit.py)
|
||||||
palt(0,false)
|
|
||||||
spr(79,pit.px,pit.py)
|
|
||||||
pal()
|
|
||||||
pal(normpal)
|
|
||||||
end
|
end
|
||||||
palt(8,true)
|
palt(8,true)
|
||||||
spr(pit.s,px,py)
|
spr(pit.s,px,py)
|
||||||
@ -367,7 +380,7 @@ function level:update()
|
|||||||
_apply(crate, crate.todo)
|
_apply(crate, crate.todo)
|
||||||
|
|
||||||
if #crate.todo==0 then
|
if #crate.todo==0 then
|
||||||
local pit=self._pits[_mix(crate.mx,crate.my)]
|
local pit=self._pits[_mix{crate.mx,crate.my}]
|
||||||
if pit and not pit.full then
|
if pit and not pit.full then
|
||||||
add(remove,cix)
|
add(remove,cix)
|
||||||
crate.dead=true
|
crate.dead=true
|
||||||
@ -393,7 +406,7 @@ function level:load_dynobjs()
|
|||||||
local crate_id=1
|
local crate_id=1
|
||||||
for mx=0,15,1 do
|
for mx=0,15,1 do
|
||||||
for my=0,15,1 do
|
for my=0,15,1 do
|
||||||
local mxy=_mix(mx,my)
|
local mxy=_mix{mx,my}
|
||||||
local px,py=mx*8,my*8
|
local px,py=mx*8,my*8
|
||||||
local s=self:_mget(mx,my)
|
local s=self:_mget(mx,my)
|
||||||
local def=self:_get_cratedef(s)
|
local def=self:_get_cratedef(s)
|
||||||
@ -418,7 +431,7 @@ function level:recollide_reanchor()
|
|||||||
self._coll={}
|
self._coll={}
|
||||||
for mx=0,15 do
|
for mx=0,15 do
|
||||||
for my=0,15 do
|
for my=0,15 do
|
||||||
local mxy=_mix(mx,my)
|
local mxy=_mix{mx,my}
|
||||||
self._coll[mxy]=
|
self._coll[mxy]=
|
||||||
fget(self:_mget(mx,my),7) or
|
fget(self:_mget(mx,my),7) or
|
||||||
self._crates[mxy]
|
self._crates[mxy]
|
||||||
@ -439,7 +452,7 @@ function level:recollide_reanchor()
|
|||||||
not self:mcoll(mx1,my0) and
|
not self:mcoll(mx1,my0) and
|
||||||
not self:mcoll(mx1,my1)
|
not self:mcoll(mx1,my1)
|
||||||
) then
|
) then
|
||||||
local key="GEOM"..mx0..","..my0..","..dx..","..dy
|
local key=_mix{"GEOM",mx0,my0,dx,dy}
|
||||||
anch_new[key]= {
|
anch_new[key]= {
|
||||||
max(mx0,mx1),max(my0,my1),adx=-dx,ady=-dy
|
max(mx0,mx1),max(my0,my1),adx=-dx,ady=-dy
|
||||||
}
|
}
|
||||||
@ -448,7 +461,7 @@ function level:recollide_reanchor()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _,cr in pairs(self._crates) do
|
for _,cr in pairs(self._crates) do
|
||||||
local key="CRATE"..cr.id..","..dx..","..dy
|
local key=_mix{"CRATE",cr.id,dx,dy}
|
||||||
local mx0,my0=cr.mx,cr.my
|
local mx0,my0=cr.mx,cr.my
|
||||||
local mx1,my1=mx0+dx,my0+dy
|
local mx1,my1=mx0+dx,my0+dy
|
||||||
anch_new[key]={
|
anch_new[key]={
|
||||||
@ -467,11 +480,13 @@ function level:recollide_reanchor()
|
|||||||
end
|
end
|
||||||
self._anch=anch_new
|
self._anch=anch_new
|
||||||
self._anch_keys={}
|
self._anch_keys={}
|
||||||
self._anch_by_position={}
|
self._anch_by={}
|
||||||
for k,v in pairs(self._anch) do
|
for k,v in pairs(self._anch) do
|
||||||
|
local ax,ay=_anch_unpack(v)
|
||||||
add(self._anch_keys,{key=k})
|
add(self._anch_keys,{key=k})
|
||||||
local pkey=_mix(_anch_unpack(v))
|
local pkey=_mix{ax,ay}
|
||||||
self._anch_by_position[pkey]=self._anch_by_position[pkey] or v
|
self._anch_by[pkey]=self._anch_by[pkey] or v
|
||||||
|
self._anch_by[_mix{ax,ay,v.adx,v.ady}]=v
|
||||||
end
|
end
|
||||||
shellsort(self._anch_keys)
|
shellsort(self._anch_keys)
|
||||||
shellsort(moves)
|
shellsort(moves)
|
||||||
@ -486,7 +501,7 @@ function level:recollide_reanchor()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function level:win_at(mx,my)
|
function level:win_at(mx,my)
|
||||||
return self._wins[_mix(mx,my)]
|
return self._wins[_mix{mx,my}]
|
||||||
end
|
end
|
||||||
|
|
||||||
function level:anchor_points()
|
function level:anchor_points()
|
||||||
@ -499,11 +514,17 @@ function level:anchor_points()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function level:anchor_at(point)
|
function level:anchor_at(point)
|
||||||
return self._anch_by_position[_mix(_anch_unpack(point))]
|
return self._anch_by[_mix{_anch_unpack(point)}]
|
||||||
|
end
|
||||||
|
|
||||||
|
function level:anchor_at_tension(point,tension)
|
||||||
|
local ax,ay=_anch_unpack(point)
|
||||||
|
local adx,ady=_anch_unpack(tension)
|
||||||
|
return self._anch_by[_mix{ax,ay,adx,ady}]
|
||||||
end
|
end
|
||||||
|
|
||||||
function level:get_open_pit(mx,my)
|
function level:get_open_pit(mx,my)
|
||||||
local pit=self._pits[_mix(mx,my)]
|
local pit=self._pits[_mix{mx,my}]
|
||||||
if (pit and not pit.full) return pit
|
if (pit and not pit.full) return pit
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -525,7 +546,7 @@ function level:spawn_exit()
|
|||||||
-- next check: is at least one of
|
-- next check: is at least one of
|
||||||
-- nx or ny out of range [0, 15]?
|
-- nx or ny out of range [0, 15]?
|
||||||
if (nx | ny) & 0xFFF0 ~= 0 then
|
if (nx | ny) & 0xFFF0 ~= 0 then
|
||||||
self._wins[_mix(nx,ny)]=true
|
self._wins[_mix{nx,ny}]=true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -539,11 +560,11 @@ end
|
|||||||
|
|
||||||
function level:mcoll(mx,my)
|
function level:mcoll(mx,my)
|
||||||
if ((mx | my) & 0xFFF0!=0) return true
|
if ((mx | my) & 0xFFF0!=0) return true
|
||||||
return self._coll[_mix(mx,my)]
|
return self._coll[_mix{mx,my}]
|
||||||
end
|
end
|
||||||
|
|
||||||
function level:get_crate(mx,my)
|
function level:get_crate(mx,my)
|
||||||
return self._crates[_mix(mx,my)]
|
return self._crates[_mix{mx,my}]
|
||||||
end
|
end
|
||||||
|
|
||||||
function level:_mget(mx,my)
|
function level:_mget(mx,my)
|
||||||
@ -553,8 +574,10 @@ function level:_mget(mx,my)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _mix(mx,my)
|
function _mix(arg)
|
||||||
return mx..","..my
|
local out=arg[1]
|
||||||
|
for i=2,#arg do out..=","..arg[i] end
|
||||||
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
-- crate spec:
|
-- crate spec:
|
||||||
@ -573,7 +596,7 @@ end
|
|||||||
|
|
||||||
function level:get_latch(dx,dy,px,py)
|
function level:get_latch(dx,dy,px,py)
|
||||||
local mx,my=px\8,py\8
|
local mx,my=px\8,py\8
|
||||||
local mxy=_mix(mx,my)
|
local mxy=_mix{mx,my}
|
||||||
|
|
||||||
local crate=self._crates[mxy]
|
local crate=self._crates[mxy]
|
||||||
local dx1,dy1=-sgn0(dx),-sgn0(dy)
|
local dx1,dy1=-sgn0(dx),-sgn0(dy)
|
||||||
@ -630,7 +653,7 @@ function level:can_move(
|
|||||||
end
|
end
|
||||||
|
|
||||||
function level:tug_crate(mx0,my0,dmx,dmy)
|
function level:tug_crate(mx0,my0,dmx,dmy)
|
||||||
local mxy0=_mix(mx0,my0)
|
local mxy0=_mix{mx0,my0}
|
||||||
local existing=self._crates[mxy0]
|
local existing=self._crates[mxy0]
|
||||||
if (not existing) return
|
if (not existing) return
|
||||||
|
|
||||||
@ -645,7 +668,7 @@ function level:tug_crate(mx0,my0,dmx,dmy)
|
|||||||
{px=px1,py=py1}
|
{px=px1,py=py1}
|
||||||
}
|
}
|
||||||
|
|
||||||
self._crates[_mix(mx1,my1)]=existing
|
self._crates[_mix{mx1,my1}]=existing
|
||||||
end
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
@ -885,6 +908,7 @@ function rope:new(
|
|||||||
id=0,
|
id=0,
|
||||||
state={name="cast",frame=0},
|
state={name="cast",frame=0},
|
||||||
latch=latch,
|
latch=latch,
|
||||||
|
flicker_t=t(),
|
||||||
}
|
}
|
||||||
r.src=src
|
r.src=src
|
||||||
r.dst=dst
|
r.dst=dst
|
||||||
@ -970,7 +994,7 @@ function rope:affected_src_xy(artificial_px,artificial_py)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function rope:draw(artificial_px,artificial_py)
|
function rope:draw(artificial_px,artificial_py)
|
||||||
local points,highlight=self:_tug(true)
|
local points,highlight,hypo_ops=self:_tug(true)
|
||||||
local n,perc_to_show,from_end = self.state.name,1.0
|
local n,perc_to_show,from_end = self.state.name,1.0
|
||||||
if (n=="done") return
|
if (n=="done") return
|
||||||
if (n=="cast") perc_to_show=self.state.frame/2
|
if (n=="cast") perc_to_show=self.state.frame/2
|
||||||
@ -1040,6 +1064,16 @@ function rope:draw(artificial_px,artificial_py)
|
|||||||
color()
|
color()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- hypothetical
|
||||||
|
local time=t()-self.flicker_t
|
||||||
|
if n=="latched" and time>0 and time%0.5>0.25 and not level:busy() then
|
||||||
|
for o in all(hypo_ops) do
|
||||||
|
local mx0,my0,dmx,dmy=unpack(o)
|
||||||
|
local px1,py1=(mx0+dmx)*8,(my0+dmy)*8
|
||||||
|
spr(14,px1,py1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- debug
|
-- debug
|
||||||
--[[
|
--[[
|
||||||
local n1=self.src
|
local n1=self.src
|
||||||
@ -1082,7 +1116,7 @@ function rope:draw(artificial_px,artificial_py)
|
|||||||
pset(x+p.adx,y,11)
|
pset(x+p.adx,y,11)
|
||||||
pset(x,y+p.ady,11)
|
pset(x,y+p.ady,11)
|
||||||
end
|
end
|
||||||
]]
|
]]--
|
||||||
end
|
end
|
||||||
|
|
||||||
function rope:drag_dst(xy)
|
function rope:drag_dst(xy)
|
||||||
@ -1116,9 +1150,9 @@ function rope:relax()
|
|||||||
local n2=n1.next
|
local n2=n1.next
|
||||||
if (not n2) return
|
if (not n2) return
|
||||||
|
|
||||||
local anch=level:anchor_at(n1)
|
local adxy,position_new=calc_tension(n0,n1,n2)
|
||||||
local wouldstick,position_new=would_stick(anch,n0,n1,n2)
|
local anch=level:anchor_at_tension(n1,adxy)
|
||||||
if not (wouldstick or _anch_eq(n1,position_new)) then
|
if not anch or _anch_eq(n1,position_new) then
|
||||||
self:_drag(n1,position_new,{_anch_unpack(n1)})
|
self:_drag(n1,position_new,{_anch_unpack(n1)})
|
||||||
_anch_del(n1)
|
_anch_del(n1)
|
||||||
else n0=n0.next end
|
else n0=n0.next end
|
||||||
@ -1194,9 +1228,9 @@ function rope:_check_pinch()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function would_stick(anchor,xy0,xy1,xy2)
|
function calc_tension(xy0,xy1,xy2)
|
||||||
local x0,y0=_anch_unpack(xy0)
|
local x0,y0=_anch_unpack(xy0)
|
||||||
local x1,y1=_anch_unpack(xy1 or anchor)
|
local x1,y1=_anch_unpack(xy1)
|
||||||
local x2,y2=_anch_unpack(xy2)
|
local x2,y2=_anch_unpack(xy2)
|
||||||
|
|
||||||
local dx,dy=x2-x0,y2-y0
|
local dx,dy=x2-x0,y2-y0
|
||||||
@ -1220,10 +1254,12 @@ function would_stick(anchor,xy0,xy1,xy2)
|
|||||||
x1_new,y1_new=x0+(y1-y0)/dy*dx,y1
|
x1_new,y1_new=x0+(y1-y0)/dy*dx,y1
|
||||||
ady,adx=signs(dx,x1_new-x1)
|
ady,adx=signs(dx,x1_new-x1)
|
||||||
end
|
end
|
||||||
|
return {adx,ady},{x1_new,y1_new}
|
||||||
|
end
|
||||||
|
|
||||||
return
|
function would_stick(anch,tens)
|
||||||
anchor and anchor.adx==adx and anchor.ady==ady,
|
adx,ady=unpack(tens)
|
||||||
{x1_new,y1_new}
|
return anch.adx==adx and anch.ady==ady
|
||||||
end
|
end
|
||||||
|
|
||||||
function rope:experience_anchor_moves(moves)
|
function rope:experience_anchor_moves(moves)
|
||||||
@ -1287,7 +1323,7 @@ function rope:_be_pushed_by1(anch_old,anch_new)
|
|||||||
|
|
||||||
(_which_side(anch_old,n0,n1)!=
|
(_which_side(anch_old,n0,n1)!=
|
||||||
_which_side(anch_new,n0,n1)
|
_which_side(anch_new,n0,n1)
|
||||||
) and would_stick(anch_new,n0,nil,n1)
|
) and would_stick(anch_new,calc_tension(n0,anch_new,n1))
|
||||||
then
|
then
|
||||||
local nx05,ny05
|
local nx05,ny05
|
||||||
if ax_new==ax_old then
|
if ax_new==ax_old then
|
||||||
@ -1325,7 +1361,7 @@ function rope:_drag(n1,new,removing)
|
|||||||
local side_orig=_which_side(anchor,pivot,point_orig)
|
local side_orig=_which_side(anchor,pivot,point_orig)
|
||||||
local side_final=_which_side(anchor,pivot,point_final)
|
local side_final=_which_side(anchor,pivot,point_final)
|
||||||
|
|
||||||
if (side_orig!=side_final and would_stick(anchor,pivot,nil,point_final)) add(eligible,{anchor,side_final})
|
if (side_orig!=side_final and would_stick(anchor,calc_tension(pivot,anchor,point_final))) add(eligible,{anchor,side_final})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1486,7 +1522,9 @@ end
|
|||||||
|
|
||||||
function rope:tug()
|
function rope:tug()
|
||||||
if (not self:latched()) return
|
if (not self:latched()) return
|
||||||
return self:_tug()
|
local success=self:_tug()
|
||||||
|
if (success) self.flicker_t=t()
|
||||||
|
return success
|
||||||
end
|
end
|
||||||
|
|
||||||
function rope:_tug(hypothetically)
|
function rope:_tug(hypothetically)
|
||||||
@ -1506,19 +1544,16 @@ function rope:_tug(hypothetically)
|
|||||||
local ops=ops_to_do
|
local ops=ops_to_do
|
||||||
|
|
||||||
if #ops>0 then
|
if #ops>0 then
|
||||||
if (hypothetically) return ancs,i-1
|
if (hypothetically) return ancs,i-1,ops
|
||||||
|
|
||||||
local dmx,dmy=ops[1].dmx,ops[1].dmy
|
for o in all(ops) do level:tug_crate(unpack(o)) end
|
||||||
for o in all(ops) do
|
|
||||||
level:tug_crate(o.mx,o.my,o.dmx,o.dmy)
|
|
||||||
end
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local latch=self.latch
|
local latch=self.latch
|
||||||
if latch and latch.el=="eyehook" then
|
if latch and latch.el=="eyehook" then
|
||||||
if (hypothetically) return ancs,0
|
if (hypothetically) return ancs,0,{}
|
||||||
player.todo={{
|
player.todo={{
|
||||||
update=function(s)
|
update=function(s)
|
||||||
if not s.rope or s.rope:done() then
|
if not s.rope or s.rope:done() then
|
||||||
@ -1562,7 +1597,7 @@ function rope:_tug(hypothetically)
|
|||||||
if not invalid_move and
|
if not invalid_move and
|
||||||
level:can_move(false,mx0,my0,dmx,dmy,1,0)
|
level:can_move(false,mx0,my0,dmx,dmy,1,0)
|
||||||
then
|
then
|
||||||
if (hypothetically) return ancs,0
|
if (hypothetically) return ancs,0,{{mx0,my0,dmx,dmy}}
|
||||||
|
|
||||||
level:tug_crate(mx0,my0,dmx,dmy)
|
level:tug_crate(mx0,my0,dmx,dmy)
|
||||||
return true
|
return true
|
||||||
@ -1608,7 +1643,7 @@ function rope:_calc_push(
|
|||||||
end
|
end
|
||||||
|
|
||||||
for my=my0,my1,smy do
|
for my=my0,my1,smy do
|
||||||
add(ops,{mx=mx,my=my,dmx=dmx,dmy=0})
|
add(ops,{mx,my,dmx,0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1635,18 +1670,19 @@ function rope:_calc_push(
|
|||||||
end
|
end
|
||||||
|
|
||||||
for mx=mx0,mx1,smx do
|
for mx=mx0,mx1,smx do
|
||||||
add(ops,{mx=mx,my=my,dmx=0,dmy=dmy})
|
add(ops,{mx,my,0,dmy})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ops2={}
|
local ops2={}
|
||||||
for o in all(ops) do
|
for o in all(ops) do
|
||||||
if not level:mcoll(o.mx,o.my) then
|
local mx,my,dmx,dmy=unpack(o)
|
||||||
|
if not level:mcoll(mx,my) then
|
||||||
-- great!
|
-- great!
|
||||||
else
|
else
|
||||||
local crate=level:get_crate(o.mx,o.my)
|
local crate=level:get_crate(mx,my)
|
||||||
if crate then
|
if crate then
|
||||||
if not level:can_move(false,o.mx,o.my,o.dmx,o.dmy,0,0) then
|
if not level:can_move(false,mx,my,dmx,dmy,0,0) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -1697,6 +1733,7 @@ end
|
|||||||
-->8
|
-->8
|
||||||
--wrongbleeps
|
--wrongbleeps
|
||||||
wrongbleep={}
|
wrongbleep={}
|
||||||
|
add(modules,wrongbleep)
|
||||||
add(real_modules,wrongbleep)
|
add(real_modules,wrongbleep)
|
||||||
function wrongbleep:init()
|
function wrongbleep:init()
|
||||||
self.duration=0
|
self.duration=0
|
||||||
@ -1704,8 +1741,12 @@ function wrongbleep:init()
|
|||||||
end
|
end
|
||||||
function wrongbleep:update()
|
function wrongbleep:update()
|
||||||
if (self.duration>5) self.duration=5
|
if (self.duration>5) self.duration=5
|
||||||
if self.duration>0 then sfx(63,3) self.continuous+=1
|
if self.duration>0 then
|
||||||
else self.continuous=0 end
|
sfx(63,3)
|
||||||
|
self.continuous+=1
|
||||||
|
else
|
||||||
|
self.continuous=0
|
||||||
|
end
|
||||||
self.duration=max(self.duration-1,-4)
|
self.duration=max(self.duration-1,-4)
|
||||||
end
|
end
|
||||||
function wrongbleep:bleep(duration)
|
function wrongbleep:bleep(duration)
|
||||||
@ -1863,15 +1904,58 @@ function debugmouse:draw3()
|
|||||||
pal()
|
pal()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-->8
|
||||||
|
-- save/load
|
||||||
|
|
||||||
|
persist={}
|
||||||
|
add(modules, persist)
|
||||||
|
add(real_modules, persist)
|
||||||
|
|
||||||
|
function persist:init0()
|
||||||
|
cartdata("ulimate_lizard_total_destruction_0_1")
|
||||||
|
self.init0 = self.read
|
||||||
|
self:read()
|
||||||
|
self.ready=true
|
||||||
|
end
|
||||||
|
|
||||||
|
function persist:read()
|
||||||
|
local m = dget(0) == 0
|
||||||
|
self.music = m
|
||||||
|
if m then music_on() else music_off() end
|
||||||
|
self.max_level = dget(1)
|
||||||
|
self.recent_level = dget(2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function persist:wipe()
|
||||||
|
self.ready=false
|
||||||
|
for i=0,64 do
|
||||||
|
dset(i,0)
|
||||||
|
end
|
||||||
|
self:read()
|
||||||
|
self.ready=true
|
||||||
|
end
|
||||||
|
|
||||||
|
function persist:lvlstart()
|
||||||
|
self.recent_level = level.ix
|
||||||
|
self.max_level = max(self.max_level, level.ix)
|
||||||
|
self:write()
|
||||||
|
end
|
||||||
|
|
||||||
|
function persist:write()
|
||||||
|
if (not self.ready) return
|
||||||
|
dset(0, self.music and 0 or -1)
|
||||||
|
dset(1, self.max_level)
|
||||||
|
dset(2, self.recent_level)
|
||||||
|
end
|
||||||
__gfx__
|
__gfx__
|
||||||
000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110005000000000000
|
000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110000000033300333
|
||||||
003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110000500000000000
|
003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110cc00cc033300333
|
||||||
099333990039932009333339effeeeeeeeeeeeeeeeeeeffee5eeeeeeeeeeee5eff1ff1ffff111111ff1111ff111111ffdddddddd111111110000000000000000
|
099333990039932009333339effeeeeeeeeeeeeeeeeeeffee5eeeeeeeeeeee5eff1ff1ffff111111ff1111ff111111ffdddddddd111111110cccccc033333333
|
||||||
09a333a9033a932009333339efee33e3333e333e3333eefee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd111111115005005000000000
|
09a333a9033a932009333339efee33e3333e333e3333eefee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd1111111100c00c0000300300
|
||||||
023333323333320000222220efe333e3333e333e33333efee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd111111110500500500000000
|
023333323333320000222220efe333e3333e333e33333efee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd1111111100c00c0000300300
|
||||||
002222200000220000222220efe33eeeeeeeeeeeeee33efeeee33eeeeee33eeeff1111ffff111111ff1ff1ff111111ffdddddddd111111110000000000000000
|
002222200000220000222220efe33eeeeeeeeeeeeee33efeeee33eeeeee33eeeff1111ffff111111ff1ff1ff111111ffdddddddd111111110cccccc033333333
|
||||||
000222c002222c0000022200efeeee555e555e55e5eeeefee5eeeeffffeeee5effffffffffffffffff1ff1ffffffffffdddddddd111111110005000000000000
|
000222c002222c0000022200efeeee555e555e55e5eeeefee5eeeeffffeeee5effffffffffffffffff1ff1ffffffffffdddddddd111111110cc00cc033300333
|
||||||
00000cc00000cc0000000cc0efe33e5eeeeeeeeee5e33efee5e33efeefe33e5e1ffffff11fffffffff1ff1fffffffff1dddddddd111111110000500000000000
|
00000cc00000cc0000000cc0efe33e5eeeeeeeeee5e33efee5e33efeefe33e5e1ffffff11fffffffff1ff1fffffffff1dddddddd111111110000000033300333
|
||||||
0000ff000000000000000000efe33e5e11111111e5e33efee5e33efeefe33e5eff1ff1ffffffffffffffffffffffffff88888888555555555555555588888888
|
0000ff000000000000000000efe33e5e11111111e5e33efee5e33efeefe33e5eff1ff1ffffffffffffffffffffffffff88888888555555555555555588888888
|
||||||
000f00f0000000000aa00aa0efe33eee11ffff11eee33efeeee33effffe33e5eff1ff1ffffffffffffffffffffffffff88888888558855885588558888888888
|
000f00f0000000000aa00aa0efe33eee11ffff11eee33efeeee33effffe33e5eff1ff1ffffffffffffffffffffffffff88888888558855885588558888888888
|
||||||
00d0000f000000000aaaaaa0efe33e5e1ff11ff1e5e33efee5e33eeeeee33eeeff1ff1fffff11111ffffffff11111fff88888888888888888888888888888888
|
00d0000f000000000aaaaaa0efe33e5e1ff11ff1e5e33efee5e33eeeeee33eeeff1ff1fffff11111ffffffff11111fff88888888888888888888888888888888
|
||||||
@ -1929,37 +2013,37 @@ eeee0000cc04405500444400efeeee5e11111111e5eeeefeeeeeeeeeeeeeeeeeffffffffffffffff
|
|||||||
00880888880880888880880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00880888880880888880880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000888888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000888888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030404040404040402140404040404050
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c000000000f300c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c00000e1e10000c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c00000000491b100c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c000040000000000c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0000000c000c0c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c000c0c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c000c0c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c000c0c0c0c0c0c0c051
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032424242424242104242424242424252
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
d0d0d0d0d0d0d0d0e3d0d0d0d0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
d0d0d0d0d0d0d0d0e3d0d0d0d0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
|
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
|
||||||
d0d0d0d0d0d04100000041d0d0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
d0d0d0d0d0d04100000041d0d0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user