Compare commits
4 Commits
bf9a45d87e
...
flotillas
Author | SHA1 | Date | |
---|---|---|---|
3151db5430
|
|||
2964159858
|
|||
95d4b6eb37
|
|||
96312e3adf
|
@ -191,7 +191,8 @@ end
|
|||||||
function ones(n)
|
function ones(n)
|
||||||
local ret = 0
|
local ret = 0
|
||||||
while n != 0 do
|
while n != 0 do
|
||||||
ret += 1
|
if (n&0x0.0001) ret += 1
|
||||||
|
n >>= 1
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@ -1486,24 +1487,24 @@ end
|
|||||||
-- full docs.
|
-- full docs.
|
||||||
|
|
||||||
flotilla = mknew{
|
flotilla = mknew{
|
||||||
use_var = 0x0001,
|
use_var = 0x1111,
|
||||||
opt_odds = split"0.5,0.5,0.5,0.5",
|
opt_odds = split"0.5,0.5,0.5,0.5",
|
||||||
init=function(this)
|
init=function(this)
|
||||||
this.ship_bases={
|
this.ship_bases={
|
||||||
[0]=mknew(ship_mook.new{ship_t=0}),
|
[0]=mknew(ship_mook.new{ship_t=0}),
|
||||||
[1]=mknew(ship_mook.new{ship_t=1}),
|
[1]=mknew(ship_mook.new{ship_t=1, sprite=104}),
|
||||||
[4]=mknew(ship_defender.new{ship_t=4}),
|
[4]=mknew(ship_defender.new{ship_t=4}),
|
||||||
[5]=mknew(ship_defender.new{ship_t=5}),
|
[5]=mknew(ship_defender.new{ship_t=5, sprite=10}),
|
||||||
[8]=mknew(ship_turret.new{ship_t=8}),
|
[8]=mknew(ship_turret.new{ship_t=8}),
|
||||||
[9]=mknew(ship_turret.new{ship_t=9}),
|
[9]=mknew(ship_turret.new{ship_t=9, sprite=4}),
|
||||||
[12]=mknew(ship_skirmisher.new{ship_t=12}),
|
[12]=mknew(ship_skirmisher.new{ship_t=12}),
|
||||||
[13]=mknew(ship_skirmisher.new{ship_t=13}),
|
[13]=mknew(ship_skirmisher.new{ship_t=13, sprite=26}),
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
function flotilla:load(ulc_cx, ulc_cy, lvl)
|
function flotilla:load(ulc_cx, ulc_cy, lvl)
|
||||||
local rows,cy,uv,counts={},ulc_cy,self.use_var+0xc840,{
|
local rows,cy,uv,counts={},ulc_cy,self.use_var,{
|
||||||
[0]=0,
|
[0]=0,
|
||||||
[1]=0,
|
[1]=0,
|
||||||
[4]=0,
|
[4]=0,
|
||||||
@ -1532,7 +1533,7 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
|
|||||||
-- alternate is requested
|
-- alternate is requested
|
||||||
-- and we allow alternates
|
-- and we allow alternates
|
||||||
-- for this type of ship
|
-- for this type of ship
|
||||||
ship_t+=(uv>>ship_t&0x1)&(f&0x10>>4)
|
ship_t+=(uv>>ship_t&0x1)&((f&0x10)>>4)
|
||||||
add(row, self.ship_bases[ship_t].new{col=cx-ulc_cx})
|
add(row, self.ship_bases[ship_t].new{col=cx-ulc_cx})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1591,7 +1592,7 @@ function flotilla:update()
|
|||||||
|
|
||||||
-- distribute across box:
|
-- distribute across box:
|
||||||
-- x = [4, 100)
|
-- x = [4, 100)
|
||||||
-- y = [4, 80)
|
-- y = [4, 60)
|
||||||
|
|
||||||
local x_interval,x_offset = 0,52
|
local x_interval,x_offset = 0,52
|
||||||
if min_col < max_col then
|
if min_col < max_col then
|
||||||
@ -1601,8 +1602,8 @@ function flotilla:update()
|
|||||||
|
|
||||||
local y_interval,y_offset=0,40
|
local y_interval,y_offset=0,40
|
||||||
if live_rows > 1 then
|
if live_rows > 1 then
|
||||||
y_interval=76/(live_rows-1)
|
y_interval=52/(live_rows-1)
|
||||||
x_offset=4-y_interval
|
y_offset=4-y_interval
|
||||||
end
|
end
|
||||||
|
|
||||||
-- now assign target locations
|
-- now assign target locations
|
||||||
@ -1615,8 +1616,8 @@ function flotilla:update()
|
|||||||
real_row += 1
|
real_row += 1
|
||||||
row_alive = true
|
row_alive = true
|
||||||
end
|
end
|
||||||
ship.want_x = ship.col * x_interval - x_offset
|
ship.want_x = ship.col * x_interval + x_offset
|
||||||
ship.want_y = real_row * y_interval - y_offset
|
ship.want_y = real_row * y_interval + y_offset
|
||||||
end -- ship updated
|
end -- ship updated
|
||||||
end -- row updated
|
end -- row updated
|
||||||
end -- table updated
|
end -- table updated
|
||||||
|
Reference in New Issue
Block a user