;;-*-Lisp-*- (in-package goal) ;; name: settings-h.gc ;; name in dgo: settings-h ;; dgos: GAME, ENGINE ;; The settings system handles settings transitions. ;; There are three copies of setting data: ;; - default ;; - target ;; - current ;; Processes may request a setting change. Once the process dies, the change will be reverted. ;; Internally, the frame's current settings are determined with this process: ;; 1). The target settings are set to default. ;; 2). Any changes to settings requested by processes are applied to target ;; NOTE: these requests are _not_ cleared on every frame. ;; 3). Target and current are compared and updated. Mostly this is just copying, but ;; some settings may also call a function when they are changed. ;; The full setting state. (deftype setting-data (structure) ((border-mode symbol :offset-assert 0) (sfx-volume float :offset-assert 4) (music-volume float :offset-assert 8) (dialog-volume float :offset-assert 12) (process-mask process-mask :offset-assert 16) (common-page int32 :offset-assert 20) (language int64 :offset-assert 24) (screenx int32 :offset-assert 32) (screeny int32 :offset-assert 36) (vibration symbol :offset-assert 40) (play-hints symbol :offset-assert 44) (movie (pointer process) :offset-assert 48) (talking (pointer process) :offset-assert 52) (spooling (pointer process) :offset-assert 56) (hint (pointer process) :offset-assert 60) (ambient (pointer process) :offset-assert 64) (video-mode symbol :offset-assert 68) (aspect-ratio symbol :offset-assert 72) (sound-flava uint8 :offset-assert 76) (auto-save symbol :offset-assert 80) (music-volume-movie float :offset-assert 84) (sfx-volume-movie float :offset-assert 88) (music symbol :offset-assert 92) (bg-r float :offset-assert 96) (bg-g float :offset-assert 100) (bg-b float :offset-assert 104) (bg-a float :offset-assert 108) (bg-a-speed float :offset-assert 112) (bg-a-force float :offset-assert 116) (allow-progress symbol :offset-assert 120) (allow-pause symbol :offset-assert 124) (sound-flava-priority float :offset-assert 128) (ocean-off symbol :offset-assert 132) (allow-look-around symbol :offset-assert 136) (ambient-volume float :offset-assert 140) (ambient-volume-movie float :offset-assert 144) (dialog-volume-hint float :offset-assert 148) (dummy uint32 11 :offset-assert 152) ) :method-count-assert 10 :size-assert #xc4 :flag-assert #xa000000c4 (:methods (handle-pending-updates (_type_ engine) setting-data 9) ) ) (defmethod inspect setting-data ((obj setting-data)) (format #t "[~8x] ~A~%" obj 'setting-data) (format #t "~Tborder-mode: ~A~%" (-> obj border-mode)) (format #t "~Tsfx-volume: ~f~%" (-> obj sfx-volume)) (format #t "~Tmusic-volume: ~f~%" (-> obj music-volume)) (format #t "~Tdialog-volume: ~f~%" (-> obj dialog-volume)) (format #t "~Tprocess-mask: ~D~%" (-> obj process-mask)) (format #t "~Tcommon-page: ~D~%" (-> obj common-page)) (format #t "~Tlanguage: ~D~%" (-> obj language)) (format #t "~Tscreenx: ~D~%" (-> obj screenx)) (format #t "~Tscreeny: ~D~%" (-> obj screeny)) (format #t "~Tvibration: ~A~%" (-> obj vibration)) (format #t "~Tplay-hints: ~A~%" (-> obj play-hints)) (format #t "~Tmovie: ~A~%" (as-process (-> obj movie))) (format #t "~Ttalking: ~A~%" (as-process (-> obj talking))) (format #t "~Tspooling: ~A~%" (as-process (-> obj spooling))) (format #t "~Thint: ~A~%" (as-process (-> obj hint))) (format #t "~Tambient: ~A~%" (as-process (-> obj ambient))) (format #t "~Tvideo-mode: ~A~%" (-> obj video-mode)) (format #t "~Taspect-ratio: ~A~%" (-> obj aspect-ratio)) (format #t "~Tsound-flava: ~D~%" (-> obj sound-flava)) (format #t "~Tauto-save: ~A~%" (-> obj auto-save)) (format #t "~Tmusic-volume-movie: ~f~%" (-> obj music-volume-movie)) (format #t "~Tsfx-volume-movie: ~f~%" (-> obj sfx-volume-movie)) (format #t "~Tmusic: ~A~%" (-> obj music)) (format #t "~Tbg-r: ~f~%" (-> obj bg-r)) (format #t "~Tbg-g: ~f~%" (-> obj bg-g)) (format #t "~Tbg-b: ~f~%" (-> obj bg-b)) (format #t "~Tbg-a: ~f~%" (-> obj bg-a)) (format #t "~Tbg-a-speed: ~f~%" (-> obj bg-a-speed)) (format #t "~Tbg-a-force: ~f~%" (-> obj bg-a-force)) (format #t "~Tallow-progress: ~A~%" (-> obj allow-progress)) (format #t "~Tallow-pause: ~A~%" (-> obj allow-pause)) (format #t "~Tsound-flava-priority: ~f~%" (-> obj sound-flava-priority)) (format #t "~Tocean-off: ~A~%" (-> obj ocean-off)) (format #t "~Tallow-look-around: ~A~%" (-> obj allow-look-around)) (format #t "~Tambient-volume: ~f~%" (-> obj ambient-volume)) (format #t "~Tambient-volume-movie: ~f~%" (-> obj ambient-volume-movie)) (format #t "~Tdialog-volume-hint: ~f~%" (-> obj dialog-volume-hint)) (format #t "~Tdummy[11] @ #x~X~%" (-> obj dummy)) obj ) ;; The setting-control manages the current/target/default system. ;; The setting requests are managed by the engine. (deftype setting-control (basic) ((current setting-data :inline :offset-assert 16) (target setting-data :inline :offset-assert 224) (default setting-data :inline :offset-assert 432) (engine engine :offset-assert 628) ) :method-count-assert 14 :size-assert #x278 :flag-assert #xe00000278 (:methods (new (symbol type int) _type_ 0) (push-setting! (_type_ process (function object object object object object) object object object) none 9) (set-setting! (_type_ process symbol symbol float int) none 10) (clear-pending-settings-from-process (_type_ process symbol) none 11) (copy-settings-from-target! (_type_) setting-data 12) (update-per-frame-settings! (_type_) setting-data 13) ) ) (defmethod new setting-control ((allocation symbol) (type-to-make type) (max-connections int)) "Allocate a new setting-control and its engine" (local-vars (s4-0 setting-control)) (set! s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) (set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control max-connections) ) s4-0 ) ;; believed unused. ;; possibly the PS2 BIOS time type. (deftype scf-time (structure) ((stat uint8 :offset-assert 0) (second uint8 :offset-assert 1) (minute uint8 :offset-assert 2) (hour uint8 :offset-assert 3) (week uint8 :offset-assert 4) (day uint8 :offset-assert 5) (month uint8 :offset-assert 6) (year uint8 :offset-assert 7) ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) (define-extern *setting-control* setting-control)