[decomp] minor type cleanup (#874)

* clean up some types

* clean up settings
This commit is contained in:
water111 2021-10-02 11:50:12 -04:00 committed by GitHub
parent cdd7e5bdee
commit 911a8e32a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 3203 additions and 1309 deletions

View File

@ -5540,7 +5540,7 @@
(declare-type engine basic)
(deftype connection (connectable)
((param0 (function object object object object object) :offset-assert 16)
((param0 basic :offset-assert 16) ;; often (function object object object object object), but can be other things.
(param1 basic :offset-assert 20)
(param2 basic :offset-assert 24)
(param3 basic :offset-assert 28)
@ -5584,7 +5584,7 @@
(execute-connections (engine object) int 12)
(execute-connections-and-move-to-dead (engine object) int 13)
(execute-connections-if-needed (engine object) int 14)
(add-connection (engine process (function object object object object object) object object object) connection 15)
(add-connection (engine process object object object object) connection 15)
(remove-from-process (engine process) int 16)
(remove-matching (engine (function connection engine symbol)) int 17)
(remove-all (engine) int 18)
@ -5704,7 +5704,7 @@
:size-assert #xc4
:flag-assert #xa000000c4
(:methods
(handle-pending-updates (_type_ engine) setting-data 9)
(update-from-engine (_type_ engine) setting-data 9)
)
)
@ -5719,7 +5719,7 @@
: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)
(push-setting! (_type_ process symbol 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)

View File

@ -340,9 +340,15 @@
"(method 0 engine)": [[39, "v0", "pointer"]],
"(method 12 engine)": [[[5, 16], "s4", "connection"]],
"(method 12 engine)": [
[[5, 16], "s4", "connection"],
[12, "t9", "(function basic basic basic object object)"]
],
"(method 13 engine)": [[[5, 24], "s4", "connection"]],
"(method 13 engine)": [
[[5, 24], "s4", "connection"],
[12, "t9", "(function basic basic basic object object)"]
],
"(method 15 engine)": [[[0, 36], "v1", "connection"]],

View File

@ -205,4 +205,5 @@
- It is now possible to call a method on a forward declared type. The forward declared type must be a basic.
- Using `->` on a plain `pointer` or `inline-array` now generates an error instead of crashing the compiler
- It is now possible to use a macro to provide a static inline array element definition
- It is now possible to have symbol names that have a `#` in the middle of them
- It is now possible to have symbol names that have a `#` in the middle of them
- `go-hook` now returns the return value of the `enter-state` function it calls

View File

@ -426,14 +426,7 @@
(set! (-> self total-off-time) 0)
(set! (-> self last-time) (-> *display* base-frame-counter))
(set! *hint-semaphore* (the-as (pointer level-hint) (process->ppointer self)))
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'hint)
(process->ppointer self)
0.0
0
)
(push-setting! *setting-control* self 'hint (process->ppointer self) 0.0 0)
(set! (-> self voicebox) (the-as handle #f))
(let ((s5-1 (res-lump-struct arg2 'play-mode structure))
(a0-6
@ -486,24 +479,10 @@
(set! (-> self last-time) (-> *display* base-frame-counter))
(set! (-> self trans) arg1)
(set! *hint-semaphore* (the-as (pointer level-hint) (process->ppointer self)))
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'hint)
(process->ppointer self)
0.0
0
)
(push-setting! *setting-control* self 'hint (process->ppointer self) 0.0 0)
(set! (-> self mode) arg2)
(if (or (= arg2 'camera) (= arg2 'ambient) (= arg2 'stinger))
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'ambient)
(process->ppointer self)
0.0
0
)
(push-setting! *setting-control* self 'ambient (process->ppointer self) 0.0 0)
)
(copy-settings-from-target! *setting-control*)
(set!
@ -736,30 +715,9 @@
)
(cond
((= (current-str-id) s5-2)
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'music-volume)
'rel
(-> *setting-control* current music-volume-movie)
0
)
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'sfx-volume)
'rel
(-> *setting-control* current sfx-volume-movie)
0
)
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'dialog-volume)
'rel
(-> *setting-control* current dialog-volume-hint)
0
)
(push-setting! *setting-control* self 'music-volume 'rel (-> *setting-control* current music-volume-movie) 0)
(push-setting! *setting-control* self 'sfx-volume 'rel (-> *setting-control* current sfx-volume-movie) 0)
(push-setting! *setting-control* self 'dialog-volume 'rel (-> *setting-control* current dialog-volume-hint) 0)
(while (= (current-str-id) s5-2)
(suspend)
)
@ -849,22 +807,8 @@
(cond
((= (current-str-id) (-> self sound-id))
(when (or (= (-> self mode) 'stinger) (= (-> self mode) 'camera))
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'music-volume)
'rel
(-> *setting-control* current music-volume-movie)
0
)
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'sfx-volume)
'rel
(-> *setting-control* current sfx-volume-movie)
0
)
(push-setting! *setting-control* self 'music-volume 'rel (-> *setting-control* current music-volume-movie) 0)
(push-setting! *setting-control* self 'sfx-volume 'rel (-> *setting-control* current sfx-volume-movie) 0)
)
(while (= (current-str-id) (-> self sound-id))
(suspend)

View File

@ -430,16 +430,16 @@
;; add us to right list.
(case collide-list-kind
(((collide-list-enum hit-by-player))
(add-connection *collide-hit-by-player-list* proc (the (function object object object object object) #f) obj #f #f))
(add-connection *collide-hit-by-player-list* proc #f obj #f #f))
(((collide-list-enum usually-hit-by-player))
(add-connection *collide-usually-hit-by-player-list* proc (the (function object object object object object) #f) obj #f #f))
(add-connection *collide-usually-hit-by-player-list* proc #f obj #f #f))
(((collide-list-enum hit-by-others))
(add-connection *collide-hit-by-others-list* proc (the (function object object object object object) #f) obj #f #f))
(add-connection *collide-hit-by-others-list* proc #f obj #f #f))
(((collide-list-enum player))
(add-connection *collide-player-list* proc (the (function object object object object object) #f) obj #f #f))
(add-connection *collide-player-list* proc #f obj #f #f))
(else
(format 0 "Unsupported collide-list-enum in collide-shape constructor!~%"))

View File

@ -7,6 +7,9 @@
(declare-type entity-ambient basic)
(define-extern vector-for-ambient (function process-drawable vector vector))
(deftype drawable-ambient (drawable)
((ambient entity-ambient :offset 8)
)

View File

@ -53,11 +53,11 @@
(declare-type engine basic)
(deftype connection (connectable)
((param0 (function object object object object object) :offset-assert 16)
(param1 basic :offset-assert 20)
(param2 basic :offset-assert 24)
(param3 basic :offset-assert 28)
(quad uint128 2 :offset 0)
((param0 basic :offset-assert 16) ;; often (function object object object object object)
(param1 basic :offset-assert 20)
(param2 basic :offset-assert 24)
(param3 basic :offset-assert 28)
(quad uint128 2 :offset 0)
)
:method-count-assert 14
:size-assert #x20
@ -108,7 +108,7 @@
(execute-connections (engine object) int 12)
(execute-connections-and-move-to-dead (engine object) int 13)
(execute-connections-if-needed (engine object) int 14)
(add-connection (engine process (function object object object object object) object object object) connection 15)
(add-connection (engine process object object object object) connection 15)
(remove-from-process (engine process) int 16)
(remove-matching (engine (function connection engine symbol)) int 17)
(remove-all (engine) int 18)
@ -336,7 +336,7 @@
(let ((ct (the-as connection (-> obj alive-list-end prev0))))
(while (!= ct (-> obj alive-list))
;; execute!
((-> ct param0) (-> ct param1) (-> ct param2) (-> ct param3) arg0)
((the-as (function basic basic basic object object) (-> ct param0)) (-> ct param1) (-> ct param2) (-> ct param3) arg0)
;; advance to previous.
(set! ct (the-as connection (-> ct prev0)))
)
@ -350,7 +350,7 @@
(let ((ct (the-as connection (-> obj alive-list-end prev0))))
(while (!= ct (-> obj alive-list))
;; execute function
(let ((result ((-> ct param0) (-> ct param1) (-> ct param2) (-> ct param3) arg0)))
(let ((result ((the-as (function basic basic basic object object) (-> ct param0)) (-> ct param1) (-> ct param2) (-> ct param3) arg0)))
;; set the next one, _before_ removing
(set! ct (the-as connection (-> ct prev0)))
;; remove if desired.
@ -397,7 +397,7 @@
(defmethod add-connection engine
((obj engine)
(proc process)
(func (function object object object object object))
(func object) ;; not always a function, you can technically put whatever
(p1 object)
(p2 object)
(p3 object)
@ -412,7 +412,7 @@
(= con (-> obj dead-list-end))))
(let ((con (the connection con)))
;; set the params of the connection
(set! (-> con param0) func)
(set! (-> con param0) (the basic func))
(set! (-> con param1) (the basic p1))
(set! (-> con param2) (the basic p2))
(set! (-> con param3) (the basic p3))

View File

@ -77,3 +77,4 @@
:flag-assert #x1f0130019c
)
(define-extern fuel-cell-init-as-clone (function handle object none))
(define-extern fuel-cell-pick-anim (function process-taskable none))

View File

@ -2212,14 +2212,7 @@
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (-> self save) (the-as string #f))
(set-master-mode 'game)
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'process-mask)
'set
0.0
16
)
(push-setting! *setting-control* self 'process-mask 'set 0.0 16)
(copy-settings-from-target! *setting-control*)
(dotimes (gp-1 15)
(suspend)

View File

@ -10,6 +10,8 @@
;; TODO - for babak-with-cannon
(define-extern beachcam-spawn (function none))
(define-extern ja-anim-done? (function symbol))
;; decomp begins
(deftype manipy (process-drawable)

View File

@ -5,21 +5,11 @@
;; 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 settings system manages the state of settings like volume, language, and some other game state.
;; There are two special features of settings:
;; - To avoid changing a setting and forgetting to restore it, all changes must have an associated process. When that process dies, the settings is reverted.
;; - If there are no processes trying to set a setting, it will go to a "default" setting.
;; - We must catch the actual changing of settings once per frame, and possibly call functions for certains settings.
;; The full setting state.
(deftype setting-data (structure)
@ -66,7 +56,7 @@
:size-assert #xc4
:flag-assert #xa000000c4
(:methods
(handle-pending-updates (_type_ engine) setting-data 9)
(update-from-engine (_type_ engine) setting-data 9)
)
)
@ -113,6 +103,10 @@
obj
)
;; There are three copies of setting data:
;; - default - if nothing is requesting a setting to be set, you end up with this value.
;; - target - the default settings, plus the changes from all processes
;; - current - the actual settings. gets set to target on each frame.
;; The setting-control manages the current/target/default system.
;; The setting requests are managed by the engine.
@ -127,7 +121,7 @@
: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)
(push-setting! (_type_ process symbol 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)
@ -145,8 +139,7 @@
s4-0
)
;; believed unused.
;; possibly the PS2 BIOS time type.
;; used for memory card time information
(deftype scf-time (structure)
((stat uint8 :offset-assert 0)
(second uint8 :offset-assert 1)

View File

@ -6,8 +6,8 @@
;; dgos: GAME, ENGINE
(defmethod handle-pending-updates setting-data ((obj setting-data) (arg0 engine))
"this goes through the list of pending setting changes in
(defmethod update-from-engine setting-data ((obj setting-data) (arg0 engine))
"this goes through the list of desired setting changes in
the engine/connection list and updates the setting-data"
(let ((conn (the-as connection (-> arg0 alive-list-end)))
(s4-0 (-> arg0 alive-list-end prev0))
@ -204,27 +204,23 @@
obj
)
(defmethod push-setting! setting-control ((obj setting-control) (arg0 process) (arg1 (function object object object object object)) (arg2 object) (arg3 object) (arg4 object))
(defmethod push-setting! setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object) (arg4 object))
"Set the setting. The set is linked to this process and will be reverted if the process dies"
(add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4)
0
(none)
)
(defmethod set-setting! setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 symbol) (arg3 float) (arg4 int))
"Replace all settings from this process with this one."
(clear-pending-settings-from-process obj arg0 arg1)
(add-connection
(-> obj engine)
arg0
(the-as (function object object object object object) arg1)
arg2
arg3
arg4
)
(add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4)
0
(none)
)
(defmethod clear-pending-settings-from-process setting-control ((obj setting-control) (arg0 process) (arg1 symbol))
"Remove requests to change settings from the given process."
(when arg0
(let ((s5-0 (-> obj engine))
(s4-0 (-> arg0 connection-list next1))
@ -250,143 +246,164 @@
(defmethod copy-settings-from-target! setting-control ((obj setting-control))
"Update the current settings. This only updates settings that are 'safe' to do multiple times per frame."
(let ((gp-0 (-> obj current)))
(let ((s5-0 (-> obj target)))
(mem-copy! (the-as pointer s5-0) (the-as pointer (-> obj default)) 196)
(set!
(-> s5-0 ambient-volume)
(* (* 0.01 (-> obj default ambient-volume)) (-> obj default sfx-volume))
)
(handle-pending-updates s5-0 (-> obj engine))
(set! (-> gp-0 border-mode) (-> s5-0 border-mode))
(set! (-> gp-0 common-page) (-> s5-0 common-page))
(set! (-> gp-0 vibration) (-> s5-0 vibration))
(set! (-> gp-0 auto-save) (-> s5-0 auto-save))
(set! (-> gp-0 play-hints) (-> s5-0 play-hints))
(set! (-> gp-0 movie) (-> s5-0 movie))
(set! (-> gp-0 talking) (-> s5-0 talking))
(set! (-> gp-0 spooling) (-> s5-0 spooling))
(set! (-> gp-0 hint) (-> s5-0 hint))
(set! (-> gp-0 ambient) (-> s5-0 ambient))
(set! (-> gp-0 allow-pause) (-> s5-0 allow-pause))
(set! (-> gp-0 allow-progress) (-> s5-0 allow-progress))
(set! (-> gp-0 allow-look-around) (-> s5-0 allow-look-around))
(set! (-> gp-0 ocean-off) (-> s5-0 ocean-off))
(set! (-> gp-0 ambient-volume-movie) (-> s5-0 ambient-volume-movie))
(set! (-> gp-0 music-volume-movie) (-> s5-0 music-volume-movie))
(set! (-> gp-0 sfx-volume-movie) (-> s5-0 sfx-volume-movie))
(set! (-> gp-0 dialog-volume-hint) (-> s5-0 dialog-volume-hint))
(set! (-> gp-0 process-mask) (-> s5-0 process-mask))
(let ((s5-0 (-> obj target)))
;; set the settings to default
(mem-copy! (the-as pointer s5-0) (the-as pointer (-> obj default)) 196)
;; hack
(set! (-> s5-0 ambient-volume)
(* (* 0.01 (-> obj default ambient-volume)) (-> obj default sfx-volume))
)
;; apply requesting changes
(update-from-engine s5-0 (-> obj engine))
;; copy those settings to current.
(set! (-> gp-0 border-mode) (-> s5-0 border-mode))
(set! (-> gp-0 common-page) (-> s5-0 common-page))
(set! (-> gp-0 vibration) (-> s5-0 vibration))
(set! (-> gp-0 auto-save) (-> s5-0 auto-save))
(set! (-> gp-0 play-hints) (-> s5-0 play-hints))
(set! (-> gp-0 movie) (-> s5-0 movie))
(set! (-> gp-0 talking) (-> s5-0 talking))
(set! (-> gp-0 spooling) (-> s5-0 spooling))
(set! (-> gp-0 hint) (-> s5-0 hint))
(set! (-> gp-0 ambient) (-> s5-0 ambient))
(set! (-> gp-0 allow-pause) (-> s5-0 allow-pause))
(set! (-> gp-0 allow-progress) (-> s5-0 allow-progress))
(set! (-> gp-0 allow-look-around) (-> s5-0 allow-look-around))
(set! (-> gp-0 ocean-off) (-> s5-0 ocean-off))
(set! (-> gp-0 ambient-volume-movie) (-> s5-0 ambient-volume-movie))
(set! (-> gp-0 music-volume-movie) (-> s5-0 music-volume-movie))
(set! (-> gp-0 sfx-volume-movie) (-> s5-0 sfx-volume-movie))
(set! (-> gp-0 dialog-volume-hint) (-> s5-0 dialog-volume-hint))
(set! (-> gp-0 process-mask) (-> s5-0 process-mask))
)
(set! (-> *kernel-context* prevent-from-run) (-> gp-0 process-mask))
gp-0
)
(set! (-> *kernel-context* prevent-from-run) (-> gp-0 process-mask))
gp-0
)
)
(defmethod update-per-frame-settings! setting-control ((obj setting-control))
"Do a per-frame update of all settings"
;; compute all settings
(copy-settings-from-target! obj)
;; now handle the special ones.
(let ((gp-0 (-> obj current)))
(let ((s5-1 (-> obj target)))
(when *sound-player-enable*
(when (!= (-> gp-0 sfx-volume) (-> s5-1 sfx-volume))
(seek! (-> gp-0 sfx-volume) (-> s5-1 sfx-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 1) (-> gp-0 sfx-volume))
(let ((s5-1 (-> obj target)))
;; the volume change is done slowly
(when *sound-player-enable*
(when (!= (-> gp-0 sfx-volume) (-> s5-1 sfx-volume))
(seek! (-> gp-0 sfx-volume) (-> s5-1 sfx-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 1) (-> gp-0 sfx-volume))
)
(when (!= (-> gp-0 music-volume) (-> s5-1 music-volume))
(seek! (-> gp-0 music-volume) (-> s5-1 music-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 2) (-> gp-0 music-volume))
)
(when (!= (-> gp-0 dialog-volume) (-> s5-1 dialog-volume))
(seek! (-> gp-0 dialog-volume) (-> s5-1 dialog-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 4) (-> gp-0 dialog-volume))
)
(when (!= (-> gp-0 ambient-volume) (-> s5-1 ambient-volume))
(seek! (-> gp-0 ambient-volume) (-> s5-1 ambient-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 16) (-> gp-0 ambient-volume))
)
)
;; send language change to the IOP.
(when (!= (-> gp-0 language) (-> s5-1 language))
(set! (-> gp-0 language) (-> s5-1 language))
(set-language (-> gp-0 language))
)
;; try to load music
(when (and (!= (-> s5-1 music) (-> gp-0 music))
(and (< 0.0 (-> *setting-control* current music-volume))
(zero? (rpc-busy? 1))
*sound-bank-1*
*sound-bank-2*
)
)
(cond
((-> s5-1 music)
(format 0 "Load music ~A~%" (-> s5-1 music))
(sound-music-load (string->sound-name (symbol->string (-> s5-1 music))))
)
(else
(format 0 "Unload music~%")
(sound-music-unload)
)
)
(set! (-> gp-0 music) (-> s5-1 music))
)
;; set sound flava
(set! (-> s5-1 sound-flava) (the-as uint (flava-lookup (-> gp-0 music) (the-as int (-> s5-1 sound-flava)))))
(set! (-> gp-0 sound-flava) (-> s5-1 sound-flava))
(if *sound-player-enable*
(sound-set-flava (-> gp-0 sound-flava))
)
;; update display settings
(when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))
(set! (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))
(set-aspect-ratio (-> gp-0 aspect-ratio))
)
(when (!= (-> gp-0 video-mode) (-> s5-1 video-mode))
(set! (-> gp-0 video-mode) (-> s5-1 video-mode))
(set-video-mode (-> gp-0 video-mode))
)
(when (!= (-> gp-0 screenx) (-> s5-1 screenx))
(set! (-> gp-0 screenx) (-> s5-1 screenx))
(set! (-> *video-parms* display-dx) (/ (-> s5-1 screenx) 2))
(set! (-> *video-parms* set-video-mode) #t)
)
(when (!= (-> gp-0 screeny) (-> s5-1 screeny))
(set! (-> gp-0 screeny) (-> s5-1 screeny))
(set! (-> *video-parms* display-dy) (* (/ (-> s5-1 screeny) 2) 2))
(set! (-> *video-parms* set-video-mode) #t)
)
;; update display bg color
(set! (-> gp-0 bg-a-speed) (-> s5-1 bg-a-speed))
(set! (-> gp-0 bg-a-force) (-> s5-1 bg-a-force))
(set! (-> gp-0 bg-r) (-> s5-1 bg-r))
(set! (-> gp-0 bg-g) (-> s5-1 bg-g))
(set! (-> gp-0 bg-b) (-> s5-1 bg-b))
(seek! (-> gp-0 bg-a) (-> s5-1 bg-a) (* (-> s5-1 bg-a-speed) (-> *display* seconds-per-frame)))
)
(when (!= (-> gp-0 music-volume) (-> s5-1 music-volume))
(seek! (-> gp-0 music-volume) (-> s5-1 music-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 2) (-> gp-0 music-volume))
(let ((v1-60 (-> *display* frames (-> *display* on-screen) display))
(f0-39 (-> gp-0 bg-a))
)
(if (!= (-> gp-0 bg-a-force) 0.0)
(set! f0-39 (-> gp-0 bg-a-force))
)
(set! (-> v1-60 bgcolor r) (the int (* 255.0 (-> gp-0 bg-r))))
(set! (-> v1-60 bgcolor g) (the int (* 255.0 (-> gp-0 bg-g))))
(set! (-> v1-60 bgcolor b) (the int (* 255.0 (-> gp-0 bg-b))))
(set! (-> v1-60 pmode alp) (the int (* 255.0 (- 1.0 f0-39))))
)
(when (!= (-> gp-0 dialog-volume) (-> s5-1 dialog-volume))
(seek! (-> gp-0 dialog-volume) (-> s5-1 dialog-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 4) (-> gp-0 dialog-volume))
)
(when (!= (-> gp-0 ambient-volume) (-> s5-1 ambient-volume))
(seek! (-> gp-0 ambient-volume) (-> s5-1 ambient-volume) (* 100.0 (-> *display* seconds-per-frame)))
(sound-set-volume (the-as uint 16) (-> gp-0 ambient-volume))
)
)
(when (!= (-> gp-0 language) (-> s5-1 language))
(set! (-> gp-0 language) (-> s5-1 language))
(set-language (-> gp-0 language))
)
(when (and (!= (-> s5-1 music) (-> gp-0 music))
(and (< 0.0 (-> *setting-control* current music-volume))
(zero? (rpc-busy? 1))
*sound-bank-1*
*sound-bank-2*
)
)
(cond
((-> s5-1 music)
(format 0 "Load music ~A~%" (-> s5-1 music))
(sound-music-load (string->sound-name (symbol->string (-> s5-1 music))))
)
(else
(format 0 "Unload music~%")
(sound-music-unload)
)
)
(set! (-> gp-0 music) (-> s5-1 music))
)
(set! (-> s5-1 sound-flava) (the-as uint (flava-lookup (-> gp-0 music) (the-as int (-> s5-1 sound-flava)))))
(set! (-> gp-0 sound-flava) (-> s5-1 sound-flava))
(if *sound-player-enable*
(sound-set-flava (-> gp-0 sound-flava))
)
(when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))
(set! (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))
(set-aspect-ratio (-> gp-0 aspect-ratio))
)
(when (!= (-> gp-0 video-mode) (-> s5-1 video-mode))
(set! (-> gp-0 video-mode) (-> s5-1 video-mode))
(set-video-mode (-> gp-0 video-mode))
)
(when (!= (-> gp-0 screenx) (-> s5-1 screenx))
(set! (-> gp-0 screenx) (-> s5-1 screenx))
(set! (-> *video-parms* display-dx) (/ (-> s5-1 screenx) 2))
(set! (-> *video-parms* set-video-mode) #t)
)
(when (!= (-> gp-0 screeny) (-> s5-1 screeny))
(set! (-> gp-0 screeny) (-> s5-1 screeny))
(set! (-> *video-parms* display-dy) (* (/ (-> s5-1 screeny) 2) 2))
(set! (-> *video-parms* set-video-mode) #t)
)
(set! (-> gp-0 bg-a-speed) (-> s5-1 bg-a-speed))
(set! (-> gp-0 bg-a-force) (-> s5-1 bg-a-force))
(set! (-> gp-0 bg-r) (-> s5-1 bg-r))
(set! (-> gp-0 bg-g) (-> s5-1 bg-g))
(set! (-> gp-0 bg-b) (-> s5-1 bg-b))
(seek! (-> gp-0 bg-a) (-> s5-1 bg-a) (* (-> s5-1 bg-a-speed) (-> *display* seconds-per-frame)))
;; ??
(set! (-> *level* border?) (-> gp-0 border-mode))
;; common pool texture page mask
(set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page))
(set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration))
(case (-> gp-0 ocean-off)
((#t)
(set! *ocean-off* #t)
)
(('mid)
(set! *ocean-mid-off* #t)
)
(('near)
(set! *ocean-near-off* #t)
)
)
gp-0
)
(let ((v1-60 (-> *display* frames (-> *display* on-screen) display))
(f0-39 (-> gp-0 bg-a))
)
(if (!= (-> gp-0 bg-a-force) 0.0)
(set! f0-39 (-> gp-0 bg-a-force))
)
(set! (-> v1-60 bgcolor r) (the int (* 255.0 (-> gp-0 bg-r))))
(set! (-> v1-60 bgcolor g) (the int (* 255.0 (-> gp-0 bg-g))))
(set! (-> v1-60 bgcolor b) (the int (* 255.0 (-> gp-0 bg-b))))
(set! (-> v1-60 pmode alp) (the int (* 255.0 (- 1.0 f0-39))))
)
(set! (-> *level* border?) (-> gp-0 border-mode))
(set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page))
(set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration))
(case (-> gp-0 ocean-off)
((#t)
(set! *ocean-off* #t)
)
(('mid)
(set! *ocean-mid-off* #t)
)
(('near)
(set! *ocean-near-off* #t)
)
)
gp-0
)
)

File diff suppressed because it is too large Load Diff

View File

@ -312,7 +312,7 @@
;; connect the nav-mesh engine:
(add-connection (-> entity-nav-mesh user-list)
proc ;; to the given process
(the-as (function object object object object object) nothing) ;; no function
nothing ;; no function
;; and some weird parameters.
proc
nav-cont

View File

@ -2826,14 +2826,7 @@
)
(set! (-> self control pad 5) (the-as uint (new-sound-id)))
(if *debug-segment*
(add-connection
*debug-engine*
self
(the-as (function object object object object object) target-print-stats)
self
*stdcon0*
#f
)
(add-connection *debug-engine* self target-print-stats self *stdcon0* #f)
)
(activate-hud self)
(set! (-> self fp-hud) (the-as uint #f))

View File

@ -3269,14 +3269,7 @@
(behavior ()
(sound-group-pause (the-as uint 255))
(logclear! (-> *setting-control* default process-mask) (process-mask pause menu))
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'process-mask)
'set
0.0
16
)
(push-setting! *setting-control* self 'process-mask 'set 0.0 16)
(copy-settings-from-target! *setting-control*)
(sound-play-by-name
(static-sound-name "select-menu")

View File

@ -146,14 +146,7 @@
(behavior ((arg0 int) (arg1 int) (arg2 symbol))
(set! (-> *setting-control* current bg-a) 1.0)
(set! (-> *setting-control* default bg-a) 0.0)
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'common-page)
'set
0.0
(ash 1 (+ arg0 1))
)
(push-setting! *setting-control* self 'common-page 'set 0.0 (ash 1 (+ arg0 1)))
(none)
)
:trans

File diff suppressed because it is too large Load Diff

View File

@ -499,14 +499,7 @@
(defmethod init-particles! hud-bike-heat ((obj hud-bike-heat) (arg0 int))
(with-pp
(push-setting!
*setting-control*
pp
(the-as (function object object object object object) 'common-page)
'set
0.0
2
)
(push-setting! *setting-control* pp 'common-page 'set 0.0 2)
(when (< (-> obj nb-of-particles) (-> obj max-nb-of-particles))
(let ((s5-0 (-> obj nb-of-particles)))
(set! (-> obj particles s5-0) (new 'static 'hud-particle))
@ -595,14 +588,7 @@
(defmethod init-particles! hud-bike-speed ((obj hud-bike-speed) (arg0 int))
(with-pp
(push-setting!
*setting-control*
pp
(the-as (function object object object object object) 'common-page)
'set
0.0
2
)
(push-setting! *setting-control* pp 'common-page 'set 0.0 2)
(when (< (-> obj nb-of-particles) (-> obj max-nb-of-particles))
(let ((s5-0 (-> obj nb-of-particles)))
(set! (-> obj particles s5-0) (new 'static 'hud-particle))

View File

@ -240,7 +240,6 @@ Val* Compiler::compile_go_hook(const goos::Object& form, const goos::Object& res
}
// typechecking here will make sure the go is possible.
compile_real_function_call(form, enter_state_func->to_gpr(form, env), function_arguments, env);
return get_none();
return compile_real_function_call(form, enter_state_func->to_gpr(form, env), function_arguments,
env);
}

View File

@ -264,10 +264,10 @@
(set! (-> vec w) ,wv)))
)
;; cause the current process to change state
(defmacro go (next-state &rest args)
`(with-pp
(set! (-> pp next-state) ,next-state)
((the (function _varargs_ object) enter-state) ,@args)
(go-hook pp ,next-state ,@args)
)
)

View File

@ -742,44 +742,16 @@
(vector-identity! (-> obj scale))
(cond
((= collide-list-kind (collide-list-enum hit-by-player))
(add-connection
*collide-hit-by-player-list*
proc
(the-as (function object object object object object) #f)
obj
#f
#f
)
(add-connection *collide-hit-by-player-list* proc #f obj #f #f)
)
((= collide-list-kind (collide-list-enum usually-hit-by-player))
(add-connection
*collide-usually-hit-by-player-list*
proc
(the-as (function object object object object object) #f)
obj
#f
#f
)
(add-connection *collide-usually-hit-by-player-list* proc #f obj #f #f)
)
((= collide-list-kind (collide-list-enum hit-by-others))
(add-connection
*collide-hit-by-others-list*
proc
(the-as (function object object object object object) #f)
obj
#f
#f
)
(add-connection *collide-hit-by-others-list* proc #f obj #f #f)
)
((= collide-list-kind (collide-list-enum player))
(add-connection
*collide-player-list*
proc
(the-as (function object object object object object) #f)
obj
#f
#f
)
(add-connection *collide-player-list* proc #f obj #f #f)
)
(else
(format 0 "Unsupported collide-list-enum in collide-shape constructor!~%")

View File

@ -25,11 +25,11 @@
;; definition of type connection
(deftype connection (connectable)
((param0 (function object object object object object) :offset-assert 16)
(param1 basic :offset-assert 20)
(param2 basic :offset-assert 24)
(param3 basic :offset-assert 28)
(quad uint128 2 :offset 0)
((param0 basic :offset-assert 16)
(param1 basic :offset-assert 20)
(param2 basic :offset-assert 24)
(param3 basic :offset-assert 28)
(quad uint128 2 :offset 0)
)
:method-count-assert 14
:size-assert #x20
@ -81,7 +81,7 @@
(execute-connections (engine object) int 12)
(execute-connections-and-move-to-dead (engine object) int 13)
(execute-connections-if-needed (engine object) int 14)
(add-connection (engine process (function object object object object object) object object object) connection 15)
(add-connection (engine process object object object object) connection 15)
(remove-from-process (engine process) int 16)
(remove-matching (engine (function connection engine symbol)) int 17)
(remove-all (engine) int 18)
@ -328,7 +328,12 @@
(set! (-> obj engine-time) (-> *display* real-frame-counter))
(let ((ct (the-as connection (-> obj alive-list-end prev0))))
(while (!= ct (-> obj alive-list))
((-> ct param0) (-> ct param1) (-> ct param2) (-> ct param3) arg0)
((the-as (function basic basic basic object object) (-> ct param0))
(-> ct param1)
(-> ct param2)
(-> ct param3)
arg0
)
(set! ct (the-as connection (-> ct prev0)))
)
)
@ -345,7 +350,12 @@
(while (!= ct (-> obj alive-list))
(let
((result
((-> ct param0) (-> ct param1) (-> ct param2) (-> ct param3) arg0)
((the-as (function basic basic basic object object) (-> ct param0))
(-> ct param1)
(-> ct param2)
(-> ct param3)
arg0
)
)
)
(set! ct (the-as connection (-> ct prev0)))
@ -396,14 +406,14 @@
engine
((obj engine)
(proc process)
(func (function object object object object object))
(func object)
(p1 object)
(p2 object)
(p3 object)
)
(let ((con (the-as connection (-> obj dead-list next0))))
(when (not (or (not proc) (= con (-> obj dead-list-end))))
(set! (-> con param0) func)
(set! (-> con param0) (the-as basic func))
(set! (-> con param1) (the-as basic p1))
(set! (-> con param2) (the-as basic p2))
(set! (-> con param3) (the-as basic p3))

View File

@ -46,7 +46,7 @@
:size-assert #xc4
:flag-assert #xa000000c4
(:methods
(handle-pending-updates (_type_ engine) setting-data 9)
(update-from-engine (_type_ engine) setting-data 9)
)
)
@ -106,7 +106,7 @@
: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)
(push-setting! (_type_ process symbol 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)

View File

@ -2,7 +2,7 @@
(in-package goal)
;; definition for method 9 of type setting-data
(defmethod handle-pending-updates setting-data ((obj setting-data) (arg0 engine))
(defmethod update-from-engine setting-data ((obj setting-data) (arg0 engine))
(let ((conn (the-as connection (-> arg0 alive-list-end)))
(s4-0 (-> arg0 alive-list-end prev0))
)
@ -233,7 +233,7 @@
setting-control
((obj setting-control)
(arg0 process)
(arg1 (function object object object object object))
(arg1 symbol)
(arg2 object)
(arg3 object)
(arg4 object)
@ -256,14 +256,7 @@
(arg4 int)
)
(clear-pending-settings-from-process obj arg0 arg1)
(add-connection
(-> obj engine)
arg0
(the-as (function object object object object object) arg1)
arg2
arg3
arg4
)
(add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4)
0
(none)
)
@ -303,7 +296,7 @@
(-> s5-0 ambient-volume)
(* 0.01 (-> obj default ambient-volume) (-> obj default sfx-volume))
)
(handle-pending-updates s5-0 (-> obj engine))
(update-from-engine s5-0 (-> obj engine))
(set! (-> gp-0 border-mode) (-> s5-0 border-mode))
(set! (-> gp-0 common-page) (-> s5-0 common-page))
(set! (-> gp-0 vibration) (-> s5-0 vibration))

View File

@ -643,7 +643,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'music-volume)
'music-volume
'rel
(-> *setting-control* current music-volume-movie)
0
@ -651,7 +651,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'sfx-volume)
'sfx-volume
'rel
(-> *setting-control* current sfx-volume-movie)
0
@ -659,7 +659,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'ambient-volume)
'ambient-volume
'rel
(-> *setting-control* current ambient-volume-movie)
0
@ -1796,7 +1796,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'process-mask)
'process-mask
'set
0.0
(-> self mask-to-clear)
@ -1804,7 +1804,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'movie)
'movie
(process->ppointer self)
0.0
0
@ -1813,7 +1813,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'border-mode)
'border-mode
(-> self border-value)
0.0
0

View File

@ -502,7 +502,7 @@
(add-connection
(-> entity-nav-mesh user-list)
proc
(the-as (function object object object object object) nothing)
nothing
proc
nav-cont
trans

View File

@ -2889,14 +2889,7 @@
)
(set! (-> self control pad 5) (the-as uint (new-sound-id)))
(if *debug-segment*
(add-connection
*debug-engine*
self
(the-as (function object object object object object) target-print-stats)
self
*stdcon0*
#f
)
(add-connection *debug-engine* self target-print-stats self *stdcon0* #f)
)
(activate-hud self)
(set! (-> self fp-hud) (the-as uint #f))

View File

@ -154,7 +154,7 @@
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'common-page)
'common-page
'set
0.0
(ash 1 (+ arg0 1))
@ -281,7 +281,3 @@
(-> sv-16 ppointer)
)
)

View File

@ -772,7 +772,7 @@ nav-enemy-default-event-handler
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'music-volume)
'music-volume
'rel
(-> *setting-control* current music-volume-movie)
0
@ -780,7 +780,7 @@ nav-enemy-default-event-handler
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'sfx-volume)
'sfx-volume
'rel
(-> *setting-control* current sfx-volume-movie)
0
@ -788,7 +788,7 @@ nav-enemy-default-event-handler
(push-setting!
*setting-control*
self
(the-as (function object object object object object) 'ambient-volume)
'ambient-volume
'rel
(-> *setting-control* current ambient-volume-movie)
0

View File

@ -527,14 +527,7 @@
;; INFO: Return type mismatch int vs none.
(defmethod init-particles! hud-bike-heat ((obj hud-bike-heat) (arg0 int))
(with-pp
(push-setting!
*setting-control*
pp
(the-as (function object object object object object) 'common-page)
'set
0.0
2
)
(push-setting! *setting-control* pp 'common-page 'set 0.0 2)
(when (< (-> obj nb-of-particles) (-> obj max-nb-of-particles))
(let ((s5-0 (-> obj nb-of-particles)))
(set! (-> obj particles s5-0) (new 'static 'hud-particle))
@ -635,14 +628,7 @@
;; INFO: Return type mismatch int vs none.
(defmethod init-particles! hud-bike-speed ((obj hud-bike-speed) (arg0 int))
(with-pp
(push-setting!
*setting-control*
pp
(the-as (function object object object object object) 'common-page)
'set
0.0
2
)
(push-setting! *setting-control* pp 'common-page 'set 0.0 2)
(when (< (-> obj nb-of-particles) (-> obj max-nb-of-particles))
(let ((s5-0 (-> obj nb-of-particles)))
(set! (-> obj particles s5-0) (new 'static 'hud-particle))