mirror paths for skirmishers in the right half

This commit is contained in:
2025-07-06 20:49:05 -07:00
parent 7c3fc833df
commit be321db355

View File

@ -1501,13 +1501,13 @@ ship_f = mknew(ship_m.new{
diamond_loop = segment.new{ diamond_loop = segment.new{
dests = { dests = {
destination.new{ destination.new{
x_off_frac=0.25 x_off_frac=0.125
}, destination.new{ }, destination.new{
y_off_frac=0.25 y_off_frac=0.125
}, destination.new { }, destination.new {
x_off_frac = -0.25 x_off_frac = -0.125
}, destination.new { }, destination.new {
y_off_frac = -0.25 y_off_frac = -0.125
}, },
}, },
} }
@ -1545,12 +1545,13 @@ ship_turret = mknew(ship_f.new{
ship_skirmisher = mknew(ship_f.new{ ship_skirmisher = mknew(ship_f.new{
sprite=107, sprite=107,
xp = 0x0.0004, xp = 0x0.0004,
hp = 1.5,
sparks = smokespark, sparks = smokespark,
sparkodds = 3, sparkodds = 3,
fire_off_y = 7, fire_off_y = 7,
xmin = -8, xmin = -8,
xmax = 112, xmax = 112,
path = diamond_bounce, path = diamond_loop,
}) })
function ship_skirmisher:reset_bounds() function ship_skirmisher:reset_bounds()
@ -1675,7 +1676,7 @@ flotilla = mknew{
[8]=mknew(ship_turret.new{ship_t=8}), [8]=mknew(ship_turret.new{ship_t=8}),
[9]=mknew(ship_turret.new{ship_t=9, sprite=4}), [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, sprite=26}), [13]=mknew(ship_skirmisher.new{ship_t=13, sprite=26, path=diamond_bounce}),
} }
end, end,
} }
@ -1691,8 +1692,9 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
[12]=0, [12]=0,
[13]=0, [13]=0,
} }
local maxcol = 0
repeat repeat
local row,cx,opt,f,mode= {},ulc_cx,{},0,0 local row,cx,opt,f,mode = {},ulc_cx,{},0,0
for i,v in ipairs(self.opt_odds) do for i,v in ipairs(self.opt_odds) do
opt[i*4-4]=rnd()<v opt[i*4-4]=rnd()<v
end end
@ -1702,7 +1704,7 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
mode = f&0x03 mode = f&0x03
if mode==2 then if mode==2 then
-- bits 0x0c: ship class -- bits 0x0c: ship class
local ship_t = f&0x0c local ship_t, col = f&0x0c, cx-ulc_cx
-- bit 0x20: optional? -- bit 0x20: optional?
if f&0x20 == 0 or opt[ship_t] then if f&0x20 == 0 or opt[ship_t] then
-- bit 0x10: alternate ship? -- bit 0x10: alternate ship?
@ -1711,7 +1713,8 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
-- 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=col})
if (col > maxcol) maxcol = col
end end
end end
cx += 1 cx += 1
@ -1731,6 +1734,13 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
-- control mark bit 0x04: end of flotilla -- control mark bit 0x04: end of flotilla
until f&0x04 > 0 until f&0x04 > 0
self.rows=rows self.rows=rows
-- mirror right half paths; alternate center column if odd
local rh = maxcol>>1
for r, row in ipairs(rows) do
for s in all(row) do
if ((s.path) and (s.col > rh or (s.col == rh and r & 1 == 1))) s.path = s.path.mirror.new()
end
end
self:statisfy(counts) self:statisfy(counts)
end end