(in-package sugar-qsp.main) (setf (root) (create ;;; Game session state ;; Variables vars (create) ;; Inventory (objects) objs (list) current-location nil ;; Game time started-at (chain *date (now)) ;; Timers timer-interval 500 timer-obj nil ;;; Transient state ;; 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 ;; ACTions acts (create) ;; 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 location (funcall (getprop (root locs) (chain *object (keys (root locs)) 0)) (list)) (values)))