diff --git a/updatedshmup.p8 b/updatedshmup.p8 index 9a6c07f..2f7d2e6 100644 --- a/updatedshmup.p8 +++ b/updatedshmup.p8 @@ -857,18 +857,21 @@ function load_level(levelfile) distance = 0 lframe = 0 freeze = 0 + leveldone = false current_level = {} + local found_eol = false for row in all(csv(levelfile)) do local x = current_level[row[1]] if row[2] == "eol" then + found_eol = true assert(x==nil, "events on eol frame") - row[1] = eol + current_level[row[1]] = eol else - add(x, row) + row.next = x + currentlevel[row[1]]=row end - row[1]=x end - leveldone = false + assert found_eol end function level_frame() @@ -882,9 +885,10 @@ function level_frame() current_level = nil return true else - for c in all(cbs) do - assert(c[1] == distance) - level_events[c[2]](unpack(c.params, 3)) + while cbs do + assert(cbs[1] == distance) + level_events[cbs[2]](unpack(cbs, 3)) + cbs=cbs.next end end end