2020-11-27 02:34:05 +00:00
|
|
|
(local util (require :lib.util))
|
|
|
|
(local {: lo : hi : readjson} util)
|
2020-11-27 04:33:14 +00:00
|
|
|
(local tile (util.reload :game.tiles))
|
2021-06-22 02:40:46 +00:00
|
|
|
(local {: prg : vm : org : deflevel} (util.reload :bitsy.defs))
|
2021-04-25 03:39:50 +00:00
|
|
|
(local files (require :game.files))
|
2020-11-27 04:46:36 +00:00
|
|
|
|
2021-06-22 02:40:46 +00:00
|
|
|
(local disk (util.reload :bitsy.disk))
|
2021-01-24 15:14:32 +00:00
|
|
|
|
2021-06-22 02:40:46 +00:00
|
|
|
(util.reload :bitsy.gfx)
|
|
|
|
(util.reload :bitsy.footer)
|
|
|
|
(util.reload :bitsy.map)
|
|
|
|
(util.reload :bitsy.entity)
|
|
|
|
(util.reload :bitsy.player)
|
|
|
|
(util.reload :bitsy.boop)
|
2020-11-22 03:50:11 +00:00
|
|
|
|
2021-01-08 01:14:51 +00:00
|
|
|
(tile.appendtiles org.code)
|
|
|
|
(org.code:append [:align 0x100] :font)
|
2021-04-25 03:39:50 +00:00
|
|
|
(tile.appendgfx org.code files.game.font)
|
2021-04-18 04:09:31 +00:00
|
|
|
(tile.append-portraitwords vm)
|
2021-01-03 19:01:48 +00:00
|
|
|
|
2020-12-30 17:48:58 +00:00
|
|
|
(vm:var :tick-count)
|
2021-04-18 04:09:31 +00:00
|
|
|
(vm:word :handle-key :tick :read-key :player-key :hide-footer)
|
2021-01-24 16:32:49 +00:00
|
|
|
(vm:word :tick :map-specific-tick :tick-count :get 1 :+ :tick-count :set :player-redraw :rnd :drop)
|
2020-12-15 04:14:35 +00:00
|
|
|
|
2021-01-03 19:01:48 +00:00
|
|
|
(vm:var :next-level 0)
|
|
|
|
(vm:word :load-next-level :next-level :get :dup (vm:if [:load-level 0 :next-level :set] [:drop]))
|
|
|
|
(vm:word :load-level ; level-ptr --
|
|
|
|
:lit :map-ptr :set :reload-level)
|
|
|
|
|
|
|
|
(vm:word :reload-level
|
2021-04-18 02:50:09 +00:00
|
|
|
:map-player-yx :player-yx :set
|
2021-01-18 04:03:15 +00:00
|
|
|
:map-specific-load
|
2020-12-03 01:08:10 +00:00
|
|
|
:full-redraw)
|
2020-11-23 00:44:56 +00:00
|
|
|
|
2021-05-06 01:09:40 +00:00
|
|
|
(each [_ flag (ipairs (or files.game.flags []))]
|
|
|
|
(vm:var (.. :cond-var- flag) vm.false)
|
|
|
|
(vm:word (.. :cond- flag) (.. :cond-var- flag) :get))
|
|
|
|
|
2021-04-25 15:54:12 +00:00
|
|
|
(each [imap _ (ipairs files.game.levels)]
|
|
|
|
(deflevel imap (.. :map imap)))
|
2021-04-18 04:09:31 +00:00
|
|
|
|
2020-11-27 04:33:14 +00:00
|
|
|
(vm.code:append :main
|
2020-10-06 03:47:25 +00:00
|
|
|
[:jsr :reset]
|
|
|
|
[:jsr :interpret]
|
2020-11-15 02:55:50 +00:00
|
|
|
[:vm :hires
|
2021-04-18 02:50:09 +00:00
|
|
|
:lit :map1 :load-level
|
2020-10-15 03:40:01 +00:00
|
|
|
(vm:forever
|
2021-05-15 15:50:53 +00:00
|
|
|
(vm:hotswap-sync :full-redraw)
|
2020-11-17 20:35:41 +00:00
|
|
|
:interactive-eval-checkpoint
|
2020-11-16 16:27:34 +00:00
|
|
|
:handle-key
|
2020-10-15 03:40:01 +00:00
|
|
|
)
|
2020-10-06 03:47:25 +00:00
|
|
|
:quit])
|
|
|
|
|
2021-01-24 15:14:32 +00:00
|
|
|
(disk.append-boot-loader prg)
|
2021-04-18 02:50:09 +00:00
|
|
|
(print "assembling")
|
2020-10-06 03:47:25 +00:00
|
|
|
(prg:assemble)
|
2021-04-18 02:50:09 +00:00
|
|
|
(print "assembled")
|
2021-01-24 15:14:32 +00:00
|
|
|
(disk.write prg)
|
2020-11-02 00:39:31 +00:00
|
|
|
|
2021-01-24 15:14:32 +00:00
|
|
|
prg
|