[decomp] game-info (#779)

* support more process stuff

* more of game info

* add ref file

* progress on save
This commit is contained in:
water111
2021-08-22 20:12:47 -04:00
committed by GitHub
parent 30d1e1d6c9
commit 403bb5f4de
117 changed files with 6234 additions and 2243 deletions
+36 -83
View File
@@ -343,10 +343,7 @@
(->
(the-as
(pointer uint128)
(+
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
(the-as uint (* s5-0 32))
)
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s5-0 32))
)
)
)
@@ -366,17 +363,11 @@
(-> arg0 current-sun env-color)
(the-as
vector
(+
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
(the-as uint (* s5-0 32))
)
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s5-0 32))
)
(the-as
vector
(+
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
(the-as uint (* s4-0 32))
)
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s4-0 32))
)
f30-0
)
@@ -438,10 +429,7 @@
(->
(the-as
(pointer uint128)
(+
(the-as uint (-> arg0 mood-fog-table data 0 fog-dists))
(the-as uint (* 48 arg1))
)
(+ (the-as uint (-> arg0 mood-fog-table data 0 fog-dists)) (* 48 arg1))
)
)
)
@@ -450,10 +438,7 @@
(->
(the-as
(pointer uint128)
(+
(the-as uint (-> arg0 mood-fog-table data 0 erase-color))
(the-as uint (* 48 arg1))
)
(+ (the-as uint (-> arg0 mood-fog-table data 0 erase-color)) (* 48 arg1))
)
)
)
@@ -462,10 +447,7 @@
(->
(the-as
(pointer uint128)
(+
(the-as uint (-> arg0 mood-lights-table data 0 prt-color))
(the-as uint (* 80 arg3))
)
(+ (the-as uint (-> arg0 mood-lights-table data 0 prt-color)) (* 80 arg3))
)
)
)
@@ -478,10 +460,7 @@
(->
(the-as
(pointer uint128)
(+
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
(the-as uint (* arg2 32))
)
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* arg2 32))
)
)
)
@@ -490,10 +469,7 @@
(->
(the-as
(pointer uint128)
(+
(the-as uint (-> arg0 mood-lights-table data 0 shadow))
(the-as uint (* 80 arg3))
)
(+ (the-as uint (-> arg0 mood-lights-table data 0 shadow)) (* 80 arg3))
)
)
)
@@ -723,7 +699,7 @@
(arg6 float)
)
(let* ((s5-0 (&-> arg0 state arg3))
(s4-0 (+ (-> s5-0 0) (the-as uint arg1)))
(s4-0 (+ (-> s5-0 0) arg1))
(a0-1 (-> s5-0 1))
(v1-2 (-> s5-0 2))
(s0-0 (-> s5-0 3))
@@ -1028,6 +1004,7 @@
;; definition for function update-mood-lightning
;; ERROR: function was not converted to expressions. Cannot decompile.
(define-extern update-mood-lightning (function mood-context int int int int float symbol none))
;; definition of type light-time-state
(deftype light-time-state (structure)
@@ -1077,12 +1054,7 @@
(arg7 int)
)
(let* ((gp-0 (&-> arg0 state arg2))
(f0-1
(the
float
(* (logand (+ (-> arg0 state arg3) (the-as uint arg7)) 255) 512)
)
)
(f0-1 (the float (* (logand (+ (-> arg0 state arg3) arg7) 255) 512)))
(f0-4 (+ arg4 (* (cos f0-1) arg5)))
(f30-1 (* 0.003921569 (the float (-> gp-0 0))))
)
@@ -1153,6 +1125,7 @@
;; definition for function update-mood-lava
;; ERROR: function was not converted to expressions. Cannot decompile.
(define-extern update-mood-lava (function mood-context float int symbol none))
;; definition for function update-mood-caustics
(defun update-mood-caustics ((arg0 mood-context) (arg1 int) (arg2 int))
@@ -1161,9 +1134,9 @@
(f0-1 (* 0.125 (the float (logand a2-1 7))))
)
(let ((a2-4 (logand (+ v1-2 -1) 3)))
(set! (-> arg0 times (+ arg1 (the-as int a2-4)) w) (- 1.0 f0-1))
(set! (-> arg0 times (+ arg1 a2-4) w) (- 1.0 f0-1))
)
(set! (-> arg0 times (+ arg1 (the-as int v1-2)) w) f0-1)
(set! (-> arg0 times (+ arg1 v1-2) w) f0-1)
f0-1
)
)
@@ -1282,7 +1255,7 @@
(update-mood-palette arg0 arg1 arg2)
(when *time-of-day-effects*
(update-mood-flames arg0 4 4 0 0.333 0.001953125 1.0)
; TODO (update-mood-lightning arg0 2 2 4 2 0.5 #f)
(update-mood-lightning arg0 2 2 4 2 0.5 #f)
)
(let ((a0-7 (-> arg0 light-group 1)))
(update-light-kit a0-7 (-> arg0 light-group 0 ambi) 0.9)
@@ -1404,7 +1377,7 @@
(update-mood-palette arg0 arg1 arg2)
(when *time-of-day-effects*
(update-mood-flames arg0 4 4 0 0.333 0.001953125 1.0)
; TODO (update-mood-lightning arg0 2 2 4 2 0.5 #f)
(update-mood-lightning arg0 2 2 4 2 0.5 #f)
)
(let ((f30-0 (fmax 0.0 (-> *math-camera* camera-rot vector 1 z))))
(let ((a2-4 (new 'stack-no-clear 'vector)))
@@ -1986,10 +1959,7 @@
(*
0.0625
(cos
(the
float
(* 4000 (the-as int (-> *display* integral-frame-counter)))
)
(the float (* 4000 (-> *display* integral-frame-counter)))
)
)
)
@@ -2000,12 +1970,7 @@
)
(*
0.125
(cos
(the
float
(* 1500 (the-as int (-> *display* integral-frame-counter)))
)
)
(cos (the float (* 1500 (-> *display* integral-frame-counter))))
)
)
)
@@ -2145,7 +2110,7 @@
(if (not (paused?))
(+! (-> arg0 state 4) 1)
)
; TODO (update-mood-lightning arg0 2 2 5 2 0.5 #t)
(update-mood-lightning arg0 2 2 5 2 0.5 #t)
)
(let ((a0-10 (-> arg0 light-group 1)))
(update-light-kit a0-10 (-> arg0 light-group 0 ambi) 1.0)
@@ -2242,10 +2207,7 @@
(let
((f0-19
(vector-vector-distance
(the-as
vector
(+ (the-as uint *rolling-spheres-light2*) (the-as uint (* s4-4 16)))
)
(the-as vector (+ (the-as uint *rolling-spheres-light2*) (* s4-4 16)))
s5-3
)
)
@@ -2343,9 +2305,9 @@
(update-mood-sky-texture arg0 arg1)
(clear-mood-times arg0)
(update-mood-palette arg0 arg1 arg2)
; (if *time-of-day-effects*
; ;; TODO (update-mood-lava arg0 (the-as float 4) 0 #t)
; )
(if *time-of-day-effects*
(update-mood-lava arg0 (the-as float 4) 0 #t)
)
(update-mood-itimes arg0)
0
(none)
@@ -2948,7 +2910,7 @@
(if (not (paused?))
(+! (-> arg0 some-byte) 1)
)
;; TODO - (update-mood-lava arg0 (the-as float 4) 0 #t)
(update-mood-lava arg0 (the-as float 4) 0 #t)
)
(update-mood-quick arg0 0 0 0 arg2)
(update-mood-itimes arg0)
@@ -3005,9 +2967,9 @@
(rand-vu-float-range 64.0 2048.0)
)
)
; (if (not (movie?))
; ; TODO (update-mood-lightning arg0 2 2 18 4 0.5 #f)
; )
(if (not (movie?))
(update-mood-lightning arg0 2 2 18 4 0.5 #f)
)
(cond
((or (nonzero? *lightning-time2*) (movie?))
(if (not (paused?))
@@ -3334,11 +3296,11 @@
(when (and *target* (= (-> *target* next-state name) 'target-continue))
(set!
(-> (the-as (pointer int64) s4-0) 0)
(the-as int (+ (-> *display* base-frame-counter) -10000))
(+ (-> *display* base-frame-counter) -10000)
)
(set!
(-> (the-as (pointer int64) s4-0) 1)
(the-as int (+ (-> *display* base-frame-counter) -10000))
(+ (-> *display* base-frame-counter) -10000)
)
)
(update-mood-fog arg0 arg1)
@@ -3412,7 +3374,7 @@
float
(-
(-> *display* base-frame-counter)
(the-as uint (-> (the-as (pointer int64) s4-0) 1))
(-> (the-as (pointer int64) s4-0) 1)
)
)
)
@@ -3455,7 +3417,7 @@
(else
(set!
(-> (the-as (pointer int64) s4-0) 1)
(the-as int (-> *display* base-frame-counter))
(-> *display* base-frame-counter)
)
)
)
@@ -3467,7 +3429,7 @@
float
(-
(-> *display* base-frame-counter)
(the-as uint (-> (the-as (pointer int64) s4-0) 0))
(-> (the-as (pointer int64) s4-0) 0)
)
)
)
@@ -3501,7 +3463,7 @@
(set! (-> *time-of-day-proc* 0 frame) 0)
(set!
(-> (the-as (pointer int64) s4-0) 0)
(the-as int (-> *display* base-frame-counter))
(-> *display* base-frame-counter)
)
(dotimes (v1-72 8)
(set! (-> arg0 sky-times v1-72) 0.0)
@@ -3701,13 +3663,7 @@
(*
0.125
(cos
(the
float
(*
4000
(the-as int (-> *display* integral-frame-counter))
)
)
(the float (* 4000 (-> *display* integral-frame-counter)))
)
)
)
@@ -3721,10 +3677,7 @@
(*
0.25
(cos
(the
float
(* 1500 (the-as int (-> *display* integral-frame-counter)))
)
(the float (* 1500 (-> *display* integral-frame-counter)))
)
)
)
@@ -3812,4 +3765,4 @@
)
(update-mood-itimes arg0)
(none)
)
)
+1 -1
View File
@@ -17,7 +17,7 @@
(transv-out vector :inline :offset-assert 48)
(local-normal vector :inline :offset-assert 64)
(surface-normal vector :inline :offset-assert 80)
(time uint64 :offset-assert 96)
(time int64 :offset-assert 96)
(status uint64 :offset-assert 104)
(pat pat-surface :offset-assert 112)
(reaction-flag uint32 :offset-assert 116)
+1 -1
View File
@@ -86,7 +86,7 @@
((name basic :offset-assert 4)
(length int16 :offset-assert 8) ;; in use elts of the data array
(allocated-length int16 :offset-assert 10) ;; size of the data array
(engine-time uint64 :offset-assert 16) ;; frame that we last executed
(engine-time int64 :offset-assert 16) ;; frame that we last executed
;; terminating nodes for the next0/prev0 linked lists
(alive-list connectable :inline :offset-assert 32)
+13 -11
View File
@@ -70,7 +70,7 @@
;; amounts or timings
;; The fact-info class stores data that is common to all fact-infos.
(deftype fact-info (basic)
((process process :offset-assert 4) ;; the process that this info is for
((process process-drawable :offset-assert 4) ;; the process that this info is for
(pickup-type pickup-type :offset-assert 8)
(pickup-amount float :offset-assert 12) ;; eco increment on pickup
(pickup-spawn-amount float :offset-assert 16)
@@ -81,10 +81,10 @@
:size-assert #x28
:flag-assert #xc00000028
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(new (symbol type process-drawable pickup-type float) _type_ 0)
(TODO-RENAME-9 (_type_ symbol process-tree fact-info int) uint 9) ;; See nav-enemy::process-drawable-death-event-handler
(reset! (_type_ symbol) none 10)
(dummy-11 (_type_) float 11)
(pickup-collectable! (_type_ pickup-type float handle) float 11)
)
)
@@ -100,7 +100,7 @@
(eco-pill float :offset-assert 80)
(eco-pill-max float :offset-assert 84)
(health-pickup-time uint64 :offset-assert 88)
(eco-source uint64 :offset-assert 96)
(eco-source handle :offset-assert 96)
(eco-source-time uint64 :offset-assert 104)
(money-pickup-time uint64 :offset-assert 112)
(buzzer-pickup-time uint64 :offset-assert 120)
@@ -111,7 +111,7 @@
:size-assert #x90
:flag-assert #xc00000090
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(new (symbol type process-drawable pickup-type float) _type_ 0)
)
)
@@ -128,11 +128,13 @@
:size-assert #x44
:flag-assert #xc00000044
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(new (symbol type process-drawable pickup-type float) _type_ 0)
)
)
(defmethod new fact-info ((allocation symbol) (type-to-make type) (proc process) (pkup-type pickup-type) (pkup-amount float))
(declare-type process-drawable process)
(defmethod new fact-info ((allocation symbol) (type-to-make type) (proc process-drawable) (pkup-type pickup-type) (pkup-amount float))
"Create information about a pickup. This should be called from a process which is a pickup. This will read settings from
the entity of the process automatically. Will attempt to read pickup-type and amount from the entity, but if this
fails will use the values in the arguments"
@@ -190,11 +192,11 @@
)
)
(defmethod dummy-11 fact-info ((obj fact-info))
(defmethod pickup-collectable! fact-info ((obj fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle))
0.0
)
(defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (proc process) (kind pickup-type) (amount float))
(defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (proc process-drawable) (kind pickup-type) (amount float))
"Create information about an enemy. Possibly includes what the enemy will drop when it is killed?"
;; base class ctor
(let ((obj (the-as fact-info-enemy ((method-of-type fact-info new) allocation type-to-make proc kind amount))))
@@ -212,10 +214,10 @@
)
)
(defmethod new fact-info-target ((allocation symbol) (type-to-make type) (arg0 process) (arg1 pickup-type) (arg2 float))
(defmethod new fact-info-target ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 pickup-type) (arg2 float))
"Create information about target. Not sure why this has stuff like pickup-type."
(let ((obj (the-as fact-info-target ((method-of-type fact-info new) allocation type-to-make arg0 arg1 arg2))))
(set! (-> obj eco-source) (the-as uint #f))
(set! (-> obj eco-source) (the-as handle #f))
(reset! obj #f)
obj
)
+2 -2
View File
@@ -271,7 +271,7 @@
(death-movie-tick int32 :offset-assert 264)
(want-auto-save symbol :offset-assert 268)
(auto-save-proc handle :offset-assert 272)
(auto-save-status uint32 :offset-assert 280)
(auto-save-status mc-status-code :offset-assert 280)
(auto-save-card int32 :offset-assert 284)
(auto-save-which int32 :offset-assert 288)
(pov-camera-handle handle :offset-assert 296)
@@ -299,7 +299,7 @@
(seen-text? (_type_ game-text-id) symbol 21)
(mark-text-as-seen (_type_ game-text-id) none 22)
(got-buzzer? (_type_ game-task int) symbol 23)
(dummy-24 () none 24)
(save-game! (_type_ game-save string) none 24)
(load-game! (_type_ game-save) game-save 25)
(clear-text-seen! (_type_ game-text-id) none 26)
(get-death-count (_type_ symbol) int 27)
+387 -3
View File
@@ -5,6 +5,18 @@
;; name in dgo: game-info
;; dgos: GAME, ENGINE
;; The game-info is the logic for pickups/lives/eco/tasks/collectables/check points/saved data
;; The *game-info* object constains the "game state", like how many lives you have etc.
;; The "perm" data is saved to the memory card.
;;;;;;;;;;;;;;;;;;
;; border plane
;;;;;;;;;;;;;;;;;;
;; This border-plane seems to be unused. This is separate from load boundaries.
(defmethod debug-draw! border-plane ((obj border-plane))
"Debug draw a border plane with a vector and text."
(let* ((v1-0 (-> obj action))
@@ -35,7 +47,7 @@
(defmethod task-complete? game-info ((obj game-info) (arg0 game-task))
"Likely closed, or in the process of closing"
(nonzero? (logand (-> obj task-perm-list data arg0 status) (entity-perm-status real-complete)))
(logtest? (-> obj task-perm-list data arg0 status) (entity-perm-status real-complete))
)
;; set up a static continue point that can be used as a temporary continue point.
@@ -549,7 +561,379 @@
(none)
)
;; todo method 11
(declare-type vent process-drawable)
(define-extern touch-tracker-init function)
(defmethod pickup-collectable! fact-info-target ((obj fact-info-target) (kind pickup-type) (amount float) (source-handle handle))
"Pickup a thing!"
(with-pp
(case kind
(((pickup-type eco-green))
;; big green eco. This counts toward the health (up to 3), and if that's full, maxes out the little green ecos to 50.
(cond
((>= amount 0.0)
;; got a positive or 0 amount.
(when (< 0.0 amount)
;; when we get a different source, OR we it's been more than 0.5 seconds since we last got eco
;; from this source.
(if (or (!= (handle->process source-handle) (handle->process (-> obj eco-source)))
(>= (the-as int (- (-> *display* base-frame-counter) (-> obj eco-source-time))) 150)
)
;; play the sound!
(sound-play-by-name (static-sound-name "get-green-eco")
(new-sound-id)
1024
0
0
(the-as uint 1)
(the-as vector #t)
)
)
;; remember the source.
(when (handle->process source-handle)
(set! (-> obj eco-source) source-handle)
(set! (-> obj eco-source-time) (-> *display* base-frame-counter))
)
)
;; if we are at max health (3), and collect additional an additional big green eco,
;; then max out the little green ecos.
(if (= (-> obj health) (-> obj health-max))
(pickup-collectable!
obj
(pickup-type eco-pill)
(-> *FACT-bank* eco-pill-max-default)
(process->handle (-> obj process))
)
)
;; remember when
(set! (-> obj health-pickup-time) (-> *display* base-frame-counter))
;; increase the health!
(set! (-> obj health) (seek (-> obj health) (-> obj health-max) amount))
)
(else
;; negative health. Subtract.
(set! (-> obj health) (seek (-> obj health) 0.0 (- amount)))
;; not sure why we do this. But this will set the eco pill collection time.
(if (>= amount -10.0)
(pickup-collectable! obj (pickup-type eco-pill) 0.0 source-handle)
)
;; subtract lives.
(if (= (-> obj health) 0.0)
(adjust
(-> (the-as target (-> obj process)) game)
'life
(- (-> *GAME-bank* life-single-inc))
source-handle
)
)
)
)
;; some sort of hack for eco vents.
(b! (and (logtest? (-> (the-as collide-shape (-> obj process root)) root-prim prim-core action) 512)
(type-type? (-> (handle->process source-handle) type) vent)
)
cfg-80)
(-> obj health)
)
(((pickup-type eco-pill))
;; collect small green eco
(when (>= amount 0.0)
;; update small eco count
(set! (-> obj eco-pill-pickup-time) (-> *display* base-frame-counter))
(set! (-> obj eco-pill) (seek (-> obj eco-pill) (-> obj eco-pill-max) amount))
;; increment big health if needed
(when (and (>= (-> obj eco-pill) (-> *FACT-bank* eco-pill-max-default)) ;; have enough smalls
(< (-> obj health) (-> obj health-max)) ;; and enough room for another health
)
;; decrease eco pills
(set! (-> obj eco-pill)
(- (-> obj eco-pill) (-> *FACT-bank* eco-pill-max-default))
)
;; get a big health.
(pickup-collectable!
obj
(pickup-type eco-green)
(-> *FACT-bank* health-small-inc)
(process->handle (-> obj process))
)
)
)
(-> obj eco-pill)
)
(((pickup-type money))
;; get money.
(when (< 0.0 amount)
;; play sound.
(if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj money-pickup-time))) 15)
(sound-play-by-name (static-sound-name "money-pickup")
(new-sound-id)
1024
0
0
(the-as uint 1)
(the-as vector #t)
)
)
(set! (-> obj money-pickup-time) (-> *display* base-frame-counter))
)
(adjust (-> (the-as target (-> obj process)) game)
'money
amount
source-handle
)
)
(((pickup-type fuel-cell))
;; the amount is actually the index of the task.
(let ((s4-2 (the int amount)))
(if (not (or (task-complete? (-> (the-as target (-> obj process)) game) (the-as game-task s4-2) )
(>= (the-as uint 1) (the-as uint s4-2))
)
)
(set! (-> obj fuel-cell-pickup-time) (-> *display* base-frame-counter))
)
)
(adjust
(-> (the-as target (-> obj process)) game)
'fuel-cell
amount
source-handle
)
)
(((pickup-type buzzer))
;; scout fly.
(let ((buzz-count (adjust
(-> (the-as target (-> obj process)) game)
'buzzer
amount
source-handle
)
)
)
(if (!= buzz-count (-> obj buzzer))
(set! (-> obj buzzer-pickup-time) (-> *display* base-frame-counter))
)
(set! (-> obj buzzer) buzz-count)
)
(-> obj buzzer)
)
(((pickup-type eco-red) (pickup-type eco-blue) (pickup-type eco-yellow))
;; the green vent jumps here.
(label cfg-80)
;; if the amount is zero, we just want to know how much eco there is.
(if (= amount 0.0)
(return (if (= (-> obj eco-type) kind)
(-> obj eco-level)
0.0 ;; we don't have this kind of eco.
)
)
)
;; new type of eco. Reset and use the new type.
(when (!= (-> obj eco-type) kind)
;; as far as I can tell, the eco-level isn't really used other than just 1 or 0.
(set! (-> obj eco-level) 0.0)
(set! (-> obj eco-timeout) (the-as seconds 0))
0
)
(set! (-> obj eco-type) (the-as int kind))
(let ((eco-lev (-> obj eco-level)))
(set! (-> obj eco-level) 1.0) ;; just set to 1.
;; this check now doesn't make much sense...
(when (and (= eco-lev 0.0) (< 0.0 (-> obj eco-level)))
;; didn't have eco and now we do, remember when
(set! (-> obj eco-pickup-time) (-> *display* game-frame-counter))
;; send a reset-collide message. Not sure why we do this.
(let ((a1-24 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-24 from) pp)
(set! (-> a1-24 num-params) 0)
(set! (-> a1-24 message) 'reset-collide)
(send-event-function (-> obj process) a1-24)
)
)
;; this logic prevents eco from respawning before you are out.
;; the time until respawn is min(full_eco_time, old_time + single_timeout)
(set! (-> obj eco-timeout)
(the-as seconds
(min (the-as int (+ (-> obj eco-timeout) (* (the-as int (-> *FACT-bank* eco-single-timeout)) (the int amount))))
(the-as int (+ (-> *FACT-bank* eco-full-timeout) (- (-> *display* game-frame-counter) (-> obj eco-pickup-time))))
)
)
)
;; if you max out the eco, this should trigger
(if (>= (the-as int (- (-> obj eco-timeout) (the-as uint (- (-> *display* game-frame-counter) (-> obj eco-pickup-time)))))
(the-as int (-> *FACT-bank* eco-full-timeout))
)
(set! (-> obj eco-level) 2.0)
)
;; sound and controller vibration.
(when (not (and (= (handle->process source-handle) (handle->process (-> obj eco-source)))
(< (the-as int (- (-> *display* base-frame-counter) (-> obj eco-source-time))) 150)
)
)
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 60)
(cpad-set-buzz! (-> *cpad-list* cpads 0) 0 17 60)
(case kind
(((pickup-type eco-blue))
(sound-play-by-name (static-sound-name "get-blue-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
)
(((pickup-type eco-green))
(sound-play-by-name (static-sound-name "get-green-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
)
(((pickup-type eco-yellow))
(sound-play-by-name (static-sound-name "get-yellow-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
)
(((pickup-type eco-red))
(sound-play-by-name (static-sound-name "get-red-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
)
)
)
(set! (-> obj eco-source) source-handle)
(set! (-> obj eco-source-time) (-> *display* base-frame-counter))
;; special case for blue eco magnet effect
(when (= kind (pickup-type eco-blue))
(when (= eco-lev 0.0) ;; old level was 0, we just got our first piece of eco
(let ((s5-1 (-> obj process)))
(let* ((s3-5 (get-process *default-dead-pool* touch-tracker #x4000))
(s4-3 (when s3-5
;; interestingly, this uses the activate method of touch-tracker, not process.
(let ((t9-28 (method-of-type touch-tracker activate)))
(t9-28 (the-as touch-tracker s3-5) s5-1 'touch-tracker (the-as pointer #x70004000))
)
(run-next-time-in-process s3-5 touch-tracker-init (-> s5-1 root trans) (-> *FACT-bank* suck-bounce-dist) 300)
(-> s3-5 ppointer)
)
)
)
;; send the touch tracker the target
(let ((a1-44 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-44 from) pp)
(set! (-> a1-44 num-params) 1)
(set! (-> a1-44 message) 'target)
(set! (-> a1-44 param 0) (the-as uint s5-1))
(send-event-function (ppointer->process s4-3) a1-44)
)
;; tell it we have blue eco.
(let ((a1-45 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-45 from) pp)
(set! (-> a1-45 num-params) 1)
(set! (-> a1-45 message) 'event)
(set! (-> a1-45 param 0) (the-as uint 'eco-blue))
(send-event-function (ppointer->process s4-3) a1-45)
)
;; give it a function to call to see if it's time to exit
(let ((a1-46 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-46 from) pp)
(set! (-> a1-46 num-params) 1)
(set! (-> a1-46 message) 'exit)
(set! (-> a1-46 param 0)
(the-as uint (lambda ()
;; check to see if target has powerup 3.
(with-pp
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-0 from) pp)
(set! (-> a1-0 num-params) 2)
(set! (-> a1-0 message) 'query)
(set! (-> a1-0 param 0) (the-as uint 'powerup))
(set! (-> a1-0 param 1) (the-as uint 3))
(send-event-function *target* a1-0)
)
)
)
)
)
(send-event-function (ppointer->process s4-3) a1-46)
)
;; set up some collision thing.
(let ((a1-47 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-47 from) pp)
(set! (-> a1-47 num-params) 1)
(set! (-> a1-47 message) 'eval)
(set! (-> a1-47 param 0)
(the-as uint
(lambda :behavior process-drawable ()
(set! (-> (the-as collide-shape (-> self root)) root-prim collide-with)
(the-as uint #x800e)
)
(none)
)
)
)
(send-event-function (ppointer->process s4-3) a1-47)
)
)
;; create a process that just keeps sending 'effect 'eco-blue
(let ((s4-4 (get-process *4k-dead-pool* process #x4000)))
(when s4-4
(let ((t9-35 (method-of-type process activate)))
(t9-35 s4-4 s5-1 'process (the-as pointer #x70004000))
)
((the-as
(function cpu-thread function process-drawable none)
set-to-run
)
(-> s4-4 main-thread)
(lambda ((arg0 process-drawable))
(with-pp
(let ((start-time (-> *display* base-frame-counter)))
(until (>= (the-as int (- (-> *display* base-frame-counter) start-time)) 180)
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-0 from) pp)
(set! (-> a1-0 num-params) 1)
(set! (-> a1-0 message) 'effect)
(set! (-> a1-0 param 0) (the-as uint 'eco-blue))
(send-event-function arg0 a1-0)
)
(suspend)
)
)
(none)
)
)
s5-1
)
(-> s4-4 ppointer)
)
)
)
)
)
)
(-> obj eco-level)
)
(else
((method-of-type fact-info pickup-collectable!)
obj
kind
amount
source-handle
)
)
)
)
)
(defmethod lookup-entity-perm-by-aid game-info ((obj game-info) (aid actor-id))
(let ((v1-0 (-> obj perm-list)))
@@ -776,7 +1160,7 @@
)
(set! (-> gp-0 want-auto-save) #f)
(set! (-> gp-0 auto-save-proc) (the-as handle #f))
(set! (-> gp-0 auto-save-status) (the-as uint 1))
(set! (-> gp-0 auto-save-status) (mc-status-code ok))
(set! (-> gp-0 auto-save-card) 0)
(set! (-> gp-0 auto-save-which) -1)
(set! (-> gp-0 pov-camera-handle) (the-as handle #f))
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -9,7 +9,7 @@
;; Letterbox and blackout
;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun set-letterbox-frames ((arg0 uint))
(defun set-letterbox-frames ((arg0 int))
"Set the letterbox frame counter for arg0 frames in the future"
(let ((v0-0 (+ (-> *display* base-frame-counter) arg0)))
(set! (-> *game-info* letterbox-time) v0-0)
@@ -1275,7 +1275,7 @@
)
(set! *run* #t)
(let ((new-dproc (make-function-process *4k-dead-pool* *display-pool* process display-loop :name 'display)))
(set! *dproc* (the process (as-process new-dproc)))
(set! *dproc* (the process (ppointer->process new-dproc)))
)
(cond
((or (level-get-with-status *level* 'loaded)
+5 -5
View File
@@ -83,11 +83,11 @@
(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 "~Tmovie: ~A~%" (ppointer->process (-> obj movie)))
(format #t "~Ttalking: ~A~%" (ppointer->process (-> obj talking)))
(format #t "~Tspooling: ~A~%" (ppointer->process (-> obj spooling)))
(format #t "~Thint: ~A~%" (ppointer->process (-> obj hint)))
(format #t "~Tambient: ~A~%" (ppointer->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))
+1 -8
View File
@@ -41,14 +41,7 @@
)
(('sfx-volume)
(when (or (zero? (logand (-> *kernel-context* prevent-from-run) (process-mask progress)))
(let ((v1-18 (get-process conn))
(a0-22 *progress-process*)
)
(= v1-18 (if a0-22
(-> a0-22 0 self)
)
)
)
(= (get-process conn) (ppointer->process *progress-process*))
)
(let ((v1-20 (the-as symbol (-> conn param1))))
(if (= v1-20 'rel)
+2 -2
View File
@@ -12,8 +12,8 @@
(num-success-before-killing int8 :offset-assert 13)
(num-attempts int8 :offset-assert 14)
(num-success int8 :offset-assert 15)
(start-time uint64 :offset-assert 16)
(last-time-called uint64 :offset-assert 24)
(start-time int64 :offset-assert 16)
(last-time-called int64 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x20
+2 -2
View File
@@ -476,8 +476,8 @@
(let ((v1-2 (length (-> *game-info* hint-control))))
(dotimes (a0-1 v1-2)
(let ((a1-2 (-> *game-info* hint-control a0-1)))
(set! (-> a1-2 start-time) (the-as uint 0))
(set! (-> a1-2 last-time-called) (the-as uint 0))
(set! (-> a1-2 start-time) 0)
(set! (-> a1-2 last-time-called) 0)
(set! (-> a1-2 num-attempts) 0)
(set! (-> a1-2 num-success) 0)
)
+19 -16
View File
@@ -141,25 +141,25 @@
(frames virtual-frame 6 :inline :offset-assert 568)
(bg-clear-color rgba 4 :offset-assert 760)
;; counters (why are there so many???)
(real-frame-counter uint64 :offset-assert 776)
(base-frame-counter uint64 :offset-assert 784)
(game-frame-counter uint64 :offset-assert 792)
(integral-frame-counter uint64 :offset-assert 800)
(real-integral-frame-counter uint64 :offset-assert 808)
(actual-frame-counter uint64 :offset-assert 816)
(real-actual-frame-counter uint64 :offset-assert 824)
(part-frame-counter uint64 :offset-assert 832)
(real-frame-counter int64 :offset-assert 776)
(base-frame-counter int64 :offset-assert 784)
(game-frame-counter int64 :offset-assert 792)
(integral-frame-counter int64 :offset-assert 800)
(real-integral-frame-counter int64 :offset-assert 808)
(actual-frame-counter int64 :offset-assert 816)
(real-actual-frame-counter int64 :offset-assert 824)
(part-frame-counter int64 :offset-assert 832)
;; the "old" counters are the values from the previous tick.
;; the counters above may jump during a load.
(old-real-frame-counter uint64 :offset-assert 840)
(old-base-frame-counter uint64 :offset-assert 848)
(old-game-frame-counter uint64 :offset-assert 856)
(old-integral-frame-counter uint64 :offset-assert 864)
(old-real-integral-frame-counter uint64 :offset-assert 872)
(old-actual-frame-counter uint64 :offset-assert 880)
(old-real-actual-frame-counter uint64 :offset-assert 888)
(old-part-frame-counter uint64 :offset-assert 896)
(old-real-frame-counter int64 :offset-assert 840)
(old-base-frame-counter int64 :offset-assert 848)
(old-game-frame-counter int64 :offset-assert 856)
(old-integral-frame-counter int64 :offset-assert 864)
(old-real-integral-frame-counter int64 :offset-assert 872)
(old-actual-frame-counter int64 :offset-assert 880)
(old-real-actual-frame-counter int64 :offset-assert 888)
(old-part-frame-counter int64 :offset-assert 896)
;; timing stats for how fast the engine is currently running.
(time-ratio float :offset-assert 904) ;; engine speed, 1.0 = full speed
@@ -242,3 +242,6 @@
(defmacro integral-current-time ()
`(-> *display* integral-frame-counter)
)
(define-extern get-current-time (function int))
(define-extern get-integral-current-time (function int))
+7 -7
View File
@@ -230,12 +230,12 @@
(set-draw-env (-> disp draw1) psm w h ztest zpsm 320)
;; initialize a bunch of counters
(set! (-> disp base-frame-counter) (the-as uint #x493e0))
(set! (-> disp game-frame-counter) (the-as uint #x493e0))
(set! (-> disp real-frame-counter) (the-as uint #x493e0))
(set! (-> disp part-frame-counter) (the-as uint #x493e0))
(set! (-> disp integral-frame-counter) (the-as uint #x493e0))
(set! (-> disp real-integral-frame-counter) (the-as uint #x493e0))
(set! (-> disp base-frame-counter) #x493e0)
(set! (-> disp game-frame-counter) #x493e0)
(set! (-> disp real-frame-counter) #x493e0)
(set! (-> disp part-frame-counter) #x493e0)
(set! (-> disp integral-frame-counter) #x493e0)
(set! (-> disp real-integral-frame-counter) #x493e0)
;; and the "old" version, which I think was their value on the last... frame?
(set! (-> disp old-base-frame-counter) (+ (-> disp base-frame-counter) -1))
@@ -403,7 +403,7 @@
(>= end-time (the-as int (-> worst-time-cache (/ bar-pos 10))))
)
(set! (-> worst-time-cache (/ bar-pos 10)) (the-as uint end-time))
(set! (-> obj cache-time) (-> *display* real-frame-counter))
(set! (-> obj cache-time) (the uint (-> *display* real-frame-counter)))
)
;; draw the time, either in ticks or percent.
+2 -2
View File
@@ -52,7 +52,7 @@
)
(defun ripple-update-waveform-offs ((arg0 ripple-wave-set))
(let ((f0-1 (the float (- (-> *display* integral-frame-counter) (-> arg0 frame-save)))))
(let ((f0-1 (the float (- (-> *display* integral-frame-counter) (the int (-> arg0 frame-save))))))
(when (!= f0-1 0.0)
(dotimes (v1-4 (-> arg0 count))
(let ((a1-4 (-> arg0 wave v1-4)))
@@ -60,7 +60,7 @@
(set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff)))
)
)
(set! (-> arg0 frame-save) (-> *display* integral-frame-counter))
(set! (-> arg0 frame-save) (the uint (-> *display* integral-frame-counter)))
)
)
(none)
+1
View File
@@ -405,3 +405,4 @@
)
(define-extern *level-load-list* pair)
(define-extern lookup-level-info (function symbol level-load-info))
+1 -1
View File
@@ -265,7 +265,7 @@ struct DgoHeader {
;; DGO LOAD and LINK
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define *dgo-time* (the-as uint 0))
(define *dgo-time* 0)
(defun dgo-load-begin ((name string) (buffer1 pointer) (buffer2 pointer) (buffer-top pointer))
"Send a DGO load RPC!"
+1 -1
View File
@@ -33,7 +33,7 @@
(rotv vector :inline :offset-assert 80)
(scalev vector :inline :offset-assert 96)
(dir-targ quaternion :inline :offset-assert 112)
(angle-change-time uint64 :offset-assert 128)
(angle-change-time int64 :offset-assert 128)
(old-y-angle-diff float :offset-assert 136)
)
:method-count-assert 28
+10 -11
View File
@@ -51,15 +51,15 @@
(defmethod seek-toward-heading-vec! trsqv ((obj trsqv) (dir vector) (vel float) (frame-count int))
"Adjust the orientation to point along dir, only changing our yaw.
The vel is a maximum velocity limit.
The frame count is the time constant (first order).
There's some logic to avoid rapidly changing directions"
The vel is a maximum velocity limit.
The frame count is the time constant (first order).
There's some logic to avoid rapidly changing directions"
(let* ((yaw-error (deg-diff (quaternion-y-angle (-> obj quat)) (vector-y-angle dir)))
;; limit both on a max velocity, and a proportional to error term.
(yaw-limit (fmin (* vel (-> *display* seconds-per-frame))
(/ (* 5.0 (fabs yaw-error)) (the float frame-count))
)
)
)
;; saturate the yaw error
(saturated-yaw (fmax (fmin yaw-error yaw-limit) (- yaw-limit)))
)
@@ -71,10 +71,9 @@
((or (= old-diff 0.0)
(and (< 0.0 saturated-yaw) (< 0.0 old-diff))
(or (and (< saturated-yaw 0.0) (< old-diff 0.0))
(>= (the-as int (- (-> *display* base-frame-counter)
(-> obj angle-change-time)
)
)
(>= (- (-> *display* base-frame-counter)
(-> obj angle-change-time)
)
60
)
)
@@ -83,9 +82,9 @@
saturated-yaw
)
(else
;; not sure why this isn't 0.
(* 0.000000001 saturated-yaw)
)
;; not sure why this isn't 0.
(* 0.000000001 saturated-yaw)
)
)
)
)
+1 -1
View File
@@ -67,7 +67,7 @@
"Print mc info to the screen."
(let ((info (new 'stack-no-clear 'mc-slot-info)))
(dotimes (slot-idx 2)
(mc-get-slot-info slot-idx)
(mc-get-slot-info slot-idx info)
(cond
((zero? (-> info known))
(format (clear *temp-string*) "SLOT ~D: EXAMINING SLOT~%" slot-idx)
+11 -15
View File
@@ -10,6 +10,10 @@
;; Use the service-cpads functions once per frame to update the data and vibration control
;; The cpad-set-buzz! function can be used for vibration.
;; in display, but we haven't gotten to display-h.gc yet.
(define-extern get-current-time (function int))
(define-extern get-integral-current-time (function int))
(defenum pad-buttons
:bitfield #t
:type uint32
@@ -39,10 +43,6 @@
(namco-gun 6)
)
;; these forward declarations should probably go somewhere else...
(define-extern get-current-time (function uint))
(define-extern get-integral-current-time (function uint))
;; this gets set to #f later on.
(define *cheat-mode* #t)
@@ -86,10 +86,10 @@
(align uint8 6 :offset-assert 88) ;; hardware control of buzzing.
(direct uint8 6 :offset-assert 94) ;; hardware control of buzzing.
(buzz-val uint8 2 :offset-assert 100) ;; intensity for buzzing
(buzz-time uint64 2 :offset-assert 104) ;; when to stop buzzing
(buzz-time int64 2 :offset-assert 104) ;; when to stop buzzing
(buzz basic :offset-assert 120) ;; is vibration enabled?
(buzz-act int32 :offset-assert 124)
(change-time uint64 :offset-assert 128)
(change-time int64 :offset-assert 128)
)
(:methods
(new (symbol type int) _type_ 0)
@@ -132,7 +132,7 @@
;; probably a bug here, this should use v1-17 as the index.
(dotimes (v1-17 2)
(set! (-> pad buzz-val 0) (the-as uint 0))
(set! (-> pad buzz-time 0) (the-as uint 0))
(set! (-> pad buzz-time 0) 0)
)
pad
)
@@ -211,16 +211,14 @@
;; we are already buzzing at this intensity.
;; buzz for max (old_buzz, new_buzz) duration
(set! (-> pad buzz-time buzz-idx)
(max (the-as int (-> pad buzz-time buzz-idx))
(the-as int (+ (get-current-time) (the-as uint duration)))
)
(max (-> pad buzz-time buzz-idx) (+ (get-current-time) duration))
)
)
((< (-> pad buzz-val buzz-idx) (the-as uint buzz-amount))
;; buzz harder than the older value, overwrite the old buzz.
(set! (-> pad buzz-val buzz-idx) buzz-amount)
(set! (-> pad buzz-time buzz-idx)
(+ (get-current-time) (the-as uint duration))
(+ (get-current-time) duration)
)
)
)
@@ -247,9 +245,7 @@
(cond
;; check if okay to buzz:
((and (-> pad buzz)
(< (the-as int (get-current-time))
(the-as int (-> pad buzz-time buzz-idx))
)
(< (get-current-time) (-> pad buzz-time buzz-idx))
(= *master-mode* 'game)
)
(let ((v1-10 buzz-idx))
@@ -259,7 +255,7 @@
;; an analog control
(set! (-> pad direct buzz-idx)
(logand (ash (-> pad buzz-val buzz-idx)
(- (the-as int (logand (get-integral-current-time) 7)))
(- (logand (get-integral-current-time) 7))
)
1
)
+3 -3
View File
@@ -381,9 +381,9 @@
(playing-id sound-id :offset-assert 8)
(trans vector :inline :offset-assert 16)
(name sound-name :offset-assert 32)
(play-time uint64 :offset-assert 48)
(time-base uint64 :offset-assert 56)
(time-random uint64 :offset-assert 64)
(play-time int64 :offset-assert 48)
(time-base int64 :offset-assert 56)
(time-random int64 :offset-assert 64)
(volume int32 :offset-assert 72)
(pitch int32 :offset-assert 76)
(falloff-near int32 :offset-assert 80)
+11 -13
View File
@@ -563,11 +563,11 @@
)
(cond
(sound-times
(set! (-> obj time-base) (the-as uint (the int (* 300.0 (-> sound-times 0)))))
(set! (-> obj time-random) (the-as uint (the int (* 300.0 (-> sound-times 1)))))
(set! (-> obj time-base) (the int (* 300.0 (-> sound-times 0))))
(set! (-> obj time-random) (the int (* 300.0 (-> sound-times 1))))
)
(else
(set! (-> obj time-base) (the-as uint -1))
(set! (-> obj time-base) -1)
)
)
(set! (-> obj trans quad) (-> sound-trans quad))
@@ -592,14 +592,13 @@
)
(cond
((-> obj spec)
(when (or (< (the-as int (-> obj time-base)) 0)
(>= (the-as int (-> *display* base-frame-counter))
(the-as int (-> obj play-time)))
(when (or (< (-> obj time-base) 0)
(>= (-> *display* base-frame-counter) (-> obj play-time))
)
(when (>= (the-as int (-> obj time-base)) 0)
(when (>= (-> obj time-base) 0)
(set! (-> obj play-time) (+ (-> *display* base-frame-counter)
(-> obj time-base)
(the-as uint (rand-vu-int-count (the-as int (-> obj time-random))))
(rand-vu-int-count (-> obj time-random))
))
(set! (-> obj playing-id) (new-sound-id))
)
@@ -620,7 +619,7 @@
(vector-vector-distance (ear-trans) (-> obj trans))))
(return 0)
)
(when (and *debug-effect-control* (>= (the-as int (-> obj time-base)) 0))
(when (and *debug-effect-control* (>= (-> obj time-base) 0))
(with-pp
(format #t "(~5D) effect sound ~A ~G "
(-> *display* base-frame-counter)
@@ -641,7 +640,7 @@
)
(else
(cond
((< (the-as int (-> obj time-base)) 0)
((< (-> obj time-base) 0)
(set! (-> obj playing-id) (sound-play-by-name
(-> obj name)
(-> obj playing-id)
@@ -652,8 +651,7 @@
(-> obj trans)))
)
(else
(when (>= (the-as int (-> *display* base-frame-counter))
(the-as int (-> obj play-time)))
(when (>= (-> *display* base-frame-counter) (-> obj play-time))
(set! (-> obj playing-id) (sound-play-by-name
(-> obj name)
(new-sound-id)
@@ -664,7 +662,7 @@
(-> obj trans)))
(set! (-> obj play-time) (+ (-> *display* base-frame-counter)
(-> obj time-base)
(the-as uint (rand-vu-int-count (the-as int (-> obj time-random))))
(rand-vu-int-count (-> obj time-random))
))
)
)
@@ -78,14 +78,14 @@
(linger-duration uint16 :offset-assert 8)
(flags uint16 :offset-assert 10)
(name basic :offset-assert 12)
(launcher uint32 :offset-assert 16)
(launcher sparticle-group-item :offset-assert 16)
(bounds sphere :inline :offset-assert 32)
)
:method-count-assert 10
:size-assert #x30
:flag-assert #xa00000030
(:methods
(dummy-9 (_type_ process) _type_ 9)
(create-launch-control (_type_ process) sparticle-launch-control 9)
)
)
@@ -106,8 +106,8 @@
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-11 (_type_ vector) none 11)
(deactivate (_type_) none 12)
(dummy-13 () none 13)
)
)
+20 -29
View File
@@ -41,7 +41,7 @@
(trans vector :inline :offset-assert 64)
(quat quaternion :inline :offset-assert 80)
(scale vector :inline :offset-assert 96)
(notice-time uint64 :offset-assert 112)
(notice-time int64 :offset-assert 112)
(flex-blend float :offset-assert 120)
(blend float :offset-assert 124)
(max-dist meters :offset-assert 128)
@@ -225,15 +225,15 @@
(defmethod look-at-enemy! joint-mod ((obj joint-mod) (target-trans vector) (option symbol) (proc process))
"Set up animation for Jak looking at an enemy. If option is 'attacking, remember when this happened.
Will only override an existing look-at if this one is closer, or option is 'force.
"
Will only override an existing look-at if this one is closer, or option is 'force.
"
(when (= option 'attacking)
;; make sure we got a process-drawable
(let* ((s3-0 proc)
(proc-drawable
(if (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable))
(the-as process-drawable s3-0)
)
(if (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable))
(the-as process-drawable s3-0)
)
)
)
(when proc-drawable
@@ -243,7 +243,7 @@
(the-as fact-info-enemy s0-0)
)
)
)
)
)
;; check that we have enemy facts, and that we are within the notice distance
(when (and enemy-facts (< (vector-vector-distance (-> obj process root trans) (-> proc-drawable root trans))
@@ -253,16 +253,7 @@
;; success! we consider this a noticed and remember when
(set! (-> obj notice-time) (-> *display* base-frame-counter))
;; and update the look at data
(let ((v1-12 (if proc
(-> proc ppointer)
)
)
)
(set!
(-> last-try-to-look-at-data who)
(new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid))
)
)
(set! (-> last-try-to-look-at-data who) (process->handle proc))
;; not sure what these are yet.
(if (< (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))
(set! (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))
@@ -275,21 +266,21 @@
)
)
)
;; in all cases,
(let ((dist (vector-vector-distance (-> obj process root trans) target-trans)))
(when (and
;; done with previous
(or (= (-> obj blend) 0.0)
;; closer than previous.
(or (< dist (vector-vector-distance (-> obj process root trans) (-> obj target)))
;; force
(= option 'force)
)
)
;; and in range
(< dist (-> obj max-dist))
)
;; done with previous
(or (= (-> obj blend) 0.0)
;; closer than previous.
(or (< dist (vector-vector-distance (-> obj process root trans) (-> obj target)))
;; force
(= option 'force)
)
)
;; and in range
(< dist (-> obj max-dist))
)
;; set mode, if we aren't in one
(if (= (-> obj mode) (joint-mod-handler-mode reset))
(set-mode! obj (joint-mod-handler-mode look-at))
+2 -1
View File
@@ -183,4 +183,5 @@
(define-extern activate-orb-all (function int int)) ;; maybe in hud?
(define-extern progress-allowed? (function symbol))
(define-extern pause-allowed? (function symbol))
(define-extern deactivate-progress (function none))
(define-extern deactivate-progress (function none))
(define-extern calculate-completion (function symbol float))
+4 -1
View File
@@ -35,6 +35,9 @@
(hidden-power-cell #x12f) ;; why is this here??
(saving-data #x136)
(do-not-remove-mem-card #x138)
(continue-without-saving #x13f)
(back #x13e)
(load-game #x14b)
@@ -45,7 +48,7 @@
(exit-demo #x15f)
(press-start #x16e)
(quit-game #x16f)
(village1-mayor-money #x200)
(vollage1-uncle-money #x201)
(village1-yakow-herd #x202)
+7 -7
View File
@@ -11,13 +11,13 @@
;; - the amplitude is additionally linearly scaled to go to zero over the duration.
(deftype smush-control (structure)
((start-time uint64 :offset-assert 0)
(period float :offset-assert 8)
(duration float :offset-assert 12)
(amp float :offset-assert 16)
(damp-amp float :offset-assert 20)
(damp-period float :offset-assert 24) ;; set a negative value here to flag as die on next update
(ticks float :offset-assert 28)
((start-time int64 :offset-assert 0)
(period float :offset-assert 8)
(duration float :offset-assert 12)
(amp float :offset-assert 16)
(damp-amp float :offset-assert 20)
(damp-period float :offset-assert 24) ;; set a negative value here to flag as die on next update
(ticks float :offset-assert 28)
)
:method-count-assert 15
:size-assert #x20
+2 -2
View File
@@ -64,7 +64,7 @@
(max-time int32 :offset-assert 4)
(max-val float :offset-assert 8)
(timer int32 :offset-assert 12)
(start-time uint64 :offset-assert 16)
(start-time int64 :offset-assert 16)
(value float :offset-assert 24)
)
:method-count-assert 11
@@ -117,7 +117,7 @@
(xz-max float :offset-assert 8)
(y-max float :offset-assert 12)
(timer int32 :offset-assert 16)
(start-time uint64 :offset-assert 24)
(start-time int64 :offset-assert 24)
(value vector :inline :offset-assert 32)
)
:method-count-assert 13
+14 -14
View File
@@ -233,7 +233,7 @@
(period-float (the float period))
;; now + offset
(current-time
(+ (the float (mod (-> *display* base-frame-counter) period))
(+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period))
(-> obj offset)
)
)
@@ -265,7 +265,7 @@
)
;; with the current offset, what is the time (0, period)?
(current-time
(+ (the float (mod (-> *display* base-frame-counter) period))
(+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period))
(-> obj offset)
)
)
@@ -299,7 +299,7 @@
"Get the current phase."
(let* ((period (-> obj period))
(period-float (the float period))
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
)
;; don't need to wrap this again.
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
@@ -314,7 +314,7 @@
(let* ((period (-> obj period))
(period-float (the float period))
(max-phase 1.0)
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
)
(fmin max-phase
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
@@ -328,7 +328,7 @@
"This is just get-current-phase multiplied by max-val"
(let* ((period (-> obj period))
(period-float (the float period))
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
)
(* (/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
period-float
@@ -348,7 +348,7 @@
(let* ((period (-> obj period))
(period-float (the float period))
(max-val 2.0)
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
(phase-out-of-2
(* max-val
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
@@ -371,7 +371,7 @@
(let* ((period (-> obj period))
(period-float (the float period))
(max-val 2.0)
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
(current-val
(* max-val
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
@@ -424,7 +424,7 @@
;; max val
(f0-1 2.0)
;; current-time
(f2-2 (+ (the float (mod (-> *display* base-frame-counter) v1-0)) (-> obj offset)))
(f2-2 (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) v1-0)) (-> obj offset)))
;; phase
(f0-2 (* f0-1 (/ (- f2-2 (* (the float (the int (/ f2-2 f1-0))) f1-0)) f1-0)))
;; offset for pause
@@ -456,7 +456,7 @@
(let* ((period (-> obj period))
(period-float (the float period))
(max-val 2.0)
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
(current-val
(* max-val
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
@@ -490,7 +490,7 @@
(set! (-> obj min-time) min-tim)
(set! (-> obj max-time) max-time)
(set! (-> obj max-val) (* 0.5 max-times-two))
(set! (-> obj start-time) (the-as uint 0))
(set! (-> obj start-time) 0)
(set! (-> obj timer) 0)
(set! (-> obj value) 0.0)
(-> obj value)
@@ -498,7 +498,7 @@
(defmethod update! delayed-rand-float ((obj delayed-rand-float))
"Get the value."
(when (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (-> obj timer))
(when (>= (- (-> *display* base-frame-counter) (-> obj start-time)) (-> obj timer))
;; only update if enough time has passed.
(set! (-> obj start-time) (-> *display* base-frame-counter))
;; come up with a random end time.
@@ -609,7 +609,7 @@
(set! (-> obj max-time) max-time)
(set! (-> obj xz-max) (* 0.5 xz-range))
(set! (-> obj y-max) (* 0.5 y-range))
(set! (-> obj start-time) (the-as uint 0))
(set! (-> obj start-time) 0)
(set! (-> obj timer) 0)
(vector-reset! (-> obj value))
(-> obj value)
@@ -627,7 +627,7 @@
(defmethod update-with-delay! delayed-rand-vector ((obj delayed-rand-vector))
"Update, if enough time has passed"
(if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (-> obj timer))
(if (>= (- (-> *display* base-frame-counter) (-> obj start-time)) (-> obj timer))
(update-now! obj)
)
(-> obj value)
@@ -635,7 +635,7 @@
(defmethod update-with-delay-or-reset! delayed-rand-vector ((obj delayed-rand-vector))
"Update, if enough time has passed. Otherwise reset to zero."
(if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (-> obj timer))
(if (>= (- (-> *display* base-frame-counter) (-> obj start-time)) (-> obj timer))
(update-now! obj)
(vector-reset! (-> obj value))
)