Compare commits

..

No commits in common. "e0b8386849d72ac531a2d44fb51e3d057f3db22f" and "c90b56b603d89355a0870bd37b6f68a351ee0992" have entirely different histories.

View File

@ -66,13 +66,12 @@ end
-- vore eats another linked list -- vore eats another linked list
-- by appending its contents. -- by appending its contents.
-- the ingested linked is empty. -- the ingested linked
-- list is no longer valid.
function linked_list:vore(x) function linked_list:vore(x)
if (not x.next) return if (not x.next) return
self.tail.next = x.next self.tail.next = x.next
self.tail = x.tail self.tail = x.tail
x.next = nil
x.tail = x
end end
-- strip calls f(x) for each -- strip calls f(x) for each
@ -154,7 +153,6 @@ function wipe_level()
intangibles_fg = linked_list.new() intangibles_fg = linked_list.new()
intangibles_bg = linked_list.new() intangibles_bg = linked_list.new()
events = linked_list.new() events = linked_list.new()
new_events = linked_list.new()
end end
function _update60() function _update60()
@ -171,8 +169,9 @@ end
function updategame() function updategame()
leveldone = level_frame() leveldone = level_frame()
events:vore(new_events) new_events = linked_list.new()
events:strip(call_move) events:strip(call_move)
events:vore(new_events)
for _, lst in ipairs{intangibles_bg, pships, eships, pbullets, ebullets} do for _, lst in ipairs{intangibles_bg, pships, eships, pbullets, ebullets} do
lst:strip(call_move) lst:strip(call_move)
end end
@ -1167,31 +1166,20 @@ blast = {
damage = 4, damage = 4,
dx = 0, -- px/frame dx = 0, -- px/frame
dy = 2, dy = 2,
awaitcancel = false,
-- disable damage for 2 frames -- disable damage for 2 frames
-- when hitting something -- when hitting something
hitship = function(self, _) hitship = function(self, _)
if self.damage > 0 and not self.awaitcancel then self.damage = 0
self.awaitcancel = true local wait = 2
events:push_back{move = function() events:push_back{move=function()
new_events:push_back{ wait -= 1
wait = 2, if wait <= 0 then
obj = self, self.damage = 4
saved_dmg = self.damage,
move = function(self)
self.wait -= 1
if self.wait <= 0 then
self.obj.damage = self.saved_dmg
return true
end
end,
}
self.damage = 0
self.awaitcancel = false
return true return true
end} end
end return false
end}
end end
} }
blast_t = { blast_t = {