##// END OF EJS Templates
Null indexes
Null indexes

File last commit:

r32:f0801da6 default
r38:de154bb9 default
Show More
main.ps
51 lines | 1.3 KiB | application/postscript | PostScriptLexer
(in-package sugar-qsp.main)
(setf (root)
(create
;;; Game session state (saved in savegames)
;; Variables
vars (create)
;; Inventory (objects)
objs (create)
current-location nil
;; Game time
started-at (chain *date (now))
;; Timers
timer-interval 500
timer-obj nil
;; Games
loaded-games (list)
;;; Transient state
;; ACTions
acts (create)
;; Savegame data
state-stash (create)
;; List of audio files being played
playing (create)
;; Local variables stack (starts with an empty frame)
locals (list)
;;; Game data
;; Games (filename -> [locations])
games (list)
;; The main (non library) game. Updated by openqst
main-game nil
;; Active locations
locs (create)))
;; Launch the game from the first location
(setf (@ window onload)
(lambda ()
(#.(intern "INIT-DOM" "SUGAR-QSP.API"))
;; For MSECCOUNT
(setf (root started-at) (chain *date (now)))
;; For $COUNTER and SETTIMER
(#.(intern "SET-TIMER" "SUGAR-QSP.API")
(root timer-interval))
;; Start the first game
(#.(intern "RUN-GAME" "SUGAR-QSP.API")
(chain *object (keys (root games)) 0))
(values)))