Jak 2 controller LED implementation (#3035)

Adds controller LED features to Jak 2:
- progressive flickering denoting health
- copies tomb simon says puzzle colors
- unique colors for each gun
- orange color for being indax
- yellow color for being in mech
- purple color for being darkjak
- blue color for being in board
- red flash when wanted.

May add more features later?

Also did some minor clean-up on some types.
This commit is contained in:
ManDude 2023-09-28 02:47:09 +01:00 committed by GitHub
parent 170cbd7e6c
commit 1f4044b9ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 656 additions and 385 deletions

View file

@ -483,6 +483,10 @@ FormElement* rewrite_as_send_event(LetElement* in,
{"'color-effect", {1}},
{"'set-alert-duration", {0}},
};
// enum to cast to.
EnumType* enum_ts = nullptr;
auto float_arg_settings = jak2_float_args.find(msg_str);
auto time_frame_arg_settings = jak2_time_frame_args.find(msg_str);
if ((float_arg_settings != jak2_float_args.end() &&
@ -499,39 +503,34 @@ FormElement* rewrite_as_send_event(LetElement* in,
pool.form<ConstantTokenElement>(seconds_to_string(val)));
}
} else if (param_idx == 0 && (msg_str == "'get-pickup" || msg_str == "'test-pickup")) {
auto enum_ts = env.dts->ts.try_enum_lookup("pickup-type");
if (enum_ts) {
param_val = cast_to_int_enum(enum_ts, pool, env, val);
}
enum_ts = env.dts->ts.try_enum_lookup("pickup-type");
} else if (param_idx == 1 &&
(param_values.at(0)->to_string(env) == "'error" ||
param_values.at(0)->to_string(env) == "'done") &&
msg_str == "'notify") {
auto enum_ts = env.dts->ts.try_enum_lookup("mc-status-code");
if (enum_ts) {
param_val = cast_to_int_enum(enum_ts, pool, env, val);
}
enum_ts = env.dts->ts.try_enum_lookup("mc-status-code");
} else if (param_idx == 0 &&
(msg_str == "'deactivate-by-type" || msg_str == "'set-object-reserve-count" ||
msg_str == "'set-object-target-count" ||
msg_str == "'set-object-auto-activate" || msg_str == "'end-pursuit-by-type" ||
msg_str == "'get-object-remaining-count")) {
auto enum_ts = env.dts->ts.try_enum_lookup("traffic-type");
if (enum_ts) {
param_val = cast_to_int_enum(enum_ts, pool, env, val);
}
enum_ts = env.dts->ts.try_enum_lookup("traffic-type");
} else if (param_idx == 0 &&
(msg_str == "'clear-slave-option" || msg_str == "'set-slave-option" ||
msg_str == "'toggle-slave-option")) {
auto enum_ts = env.dts->ts.try_enum_lookup("cam-slave-options");
if (enum_ts) {
param_val = cast_to_bitfield_enum(enum_ts, pool, env, val);
}
enum_ts = env.dts->ts.try_enum_lookup("cam-slave-options");
} else if (param_idx == 2 && param_values.at(0)->to_string(env) == "'darkjak" &&
msg_str == "'change-mode") {
auto enum_ts = env.dts->ts.try_enum_lookup("darkjak-stage");
enum_ts = env.dts->ts.try_enum_lookup("darkjak-stage");
} else if (param_idx == 2 && param_values.at(0)->to_string(env) == "'gun" &&
msg_str == "'change-mode") {
enum_ts = env.dts->ts.try_enum_lookup("pickup-type");
}
if (enum_ts) {
if (enum_ts->is_bitfield()) {
param_val = cast_to_bitfield_enum(enum_ts, pool, env, val);
} else {
param_val = cast_to_int_enum(enum_ts, pool, env, val);
}
}
}

View file

@ -1968,7 +1968,7 @@
(define-extern *listener-function* (function object))
(define-extern reset-and-call (function thread function object))
(define-extern execute-process-tree (function process-tree (function object object) kernel-context object))
(define-extern search-process-tree (function process-tree (function process-tree object) process-tree))
(define-extern search-process-tree (function process-tree (function process-tree object) process))
(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object))
(define-extern process-not-name (function object process-tree process))
(define-extern process-by-name (function object process-tree process))

View file

@ -657,7 +657,7 @@
(define-extern kill-not-type (function type process-tree symbol))
(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object))
(define-extern execute-process-tree (function process-tree (function object object) kernel-context object))
(define-extern search-process-tree (function process-tree (function process-tree object) process-tree))
(define-extern search-process-tree (function process-tree (function process-tree object) process))
(define-extern kernel-dispatcher (function object))
(define-extern sync-dispatcher (function object))
(define-extern inspect-process-tree (function process-tree int int symbol process-tree))
@ -7371,7 +7371,7 @@
(progress-controller-options-analog-deadzone #x1295)
(progress-controller-options-ignore-if-unfocused #x1296)
(progress-controller-options-led-hp #x1297)
(progress-controller-options-led-darkjak #x1298)
(progress-controller-options-led-state #x1298)
(progress-input-options-enable-keyboard #x1299)
(progress-input-options-enable-mouse #x129a)
(progress-menu-mouse-options #x129b)
@ -7388,6 +7388,9 @@
(progress-keybinds-waiting-for-bind #x1306)
(progress-keybinds-unset #x1307)
(progress-unknown-option #x1308)
(progress-hires-sky #x1309)
(progress-fast-airlock #x130a)
(progress-fast-elevator #x130b)
)
;; ---text-id-h:text-id
@ -13154,6 +13157,45 @@
;; game-info-h ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defenum pickup-type
:bitfield #f
:type int32
(none 0)
(eco-yellow 1)
(eco-red 2)
(eco-blue 3)
(eco-dark 4)
(eco-green 5)
(eco-pill-green 6)
(eco-pill-dark 7)
(eco-pill-random 8)
(money 9)
(fuel-cell 10)
(buzzer 11)
(darkjak 12)
(ammo-yellow 13)
(ammo-red 14)
(ammo-blue 15)
(ammo-dark 16)
(shield 17)
(health 18)
(trick-point 19)
(trick-judge 20)
(gem 21)
(skill 22)
(karma 23)
(gun-red 24)
(gun-yellow 25)
(gun-blue 26)
(gun-dark 27)
(board 28)
(pass-red 29)
(pass-green 30)
(pass-yellow 31)
(pass-blue 32)
(ammo-random 33)
)
(deftype game-bank (basic)
((life-max-default float :offset-assert 4)
(life-start-default float :offset-assert 8)
@ -13366,7 +13408,7 @@
(unknown-pad1 uint32)
(purchase-secrets game-secrets :offset-assert 152)
(unknown-pad2 uint32 :offset-assert 156)
(gun-type int32 :offset-assert 160)
(gun-type pickup-type :offset-assert 160)
(gun-ammo float 4 :offset-assert 164)
(shield float :offset-assert 180)
(score float :offset-assert 184)
@ -15026,45 +15068,6 @@
;; fact-h ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defenum pickup-type
:bitfield #f
:type int32
(none 0)
(eco-yellow 1)
(eco-red 2)
(eco-blue 3)
(eco-dark 4)
(eco-green 5)
(eco-pill-green 6)
(eco-pill-dark 7)
(eco-pill-random 8)
(money 9)
(fuel-cell 10)
(buzzer 11)
(darkjak 12)
(ammo-yellow 13)
(ammo-red 14)
(ammo-blue 15)
(ammo-dark 16)
(shield 17)
(health 18)
(trick-point 19)
(trick-judge 20)
(gem 21)
(skill 22)
(karma 23)
(gun-red 24)
(gun-yellow 25)
(gun-blue 26)
(gun-dark 27)
(board 28)
(pass-red 29)
(pass-green 30)
(pass-yellow 31)
(pass-blue 32)
(ammo-random 33)
)
(deftype fact-bank (basic)
((eco-level-max float :offset-assert 4)
(eco-single-inc float :offset-assert 8)
@ -29728,12 +29731,12 @@
(define-extern *gun-walk-mods* surface)
(define-extern target-gun-event-handler (function process int symbol event-message-block object :behavior target))
(define-extern target-gun-setup (function symbol none :behavior target))
(define-extern target-gun-init (function int none :behavior target))
(define-extern target-gun-init (function pickup-type none :behavior target))
(define-extern target-gun-exit (function symbol))
(define-extern target-gun-end-mode (function symbol symbol :behavior target))
(define-extern quat<-gun! (function quaternion quaternion quaternion))
(define-extern target-gun-ammo-out-pick (function int :behavior target))
(define-extern target-gun-type-set! (function int none :behavior target))
(define-extern target-gun-type-set! (function pickup-type none :behavior target))
(define-extern target-gun-marking-menu (function target none))
(define-extern target-gun-build-track-list (function none :behavior target))
(define-extern target-gun-find-track (function none :behavior target))
@ -46529,27 +46532,17 @@
(defenum simon-block-flags
:type uint16
:bitfield #t
(sbf0)
(sbf1)
(sbf2)
(blink)
(blink-on)
(ridden)
(sbf3)
(sbf4)
(sbf5)
(sbf6)
(sbf7)
(sbf8)
(sbf9)
(sbf10)
(sbf11)
(sbf12)
(sbf13)
(sbf14)
(sbf15)
(dangerous)
(up-sound-played)
)
;; ---tomb-water:simon-block-flags
(deftype tomb-simon-block (base-plat)
((sound-show uint128 :offset-assert 272)
((sound-show sound-name :offset-assert 272)
(color vector :inline :offset-assert 288)
(my-idx int32 :offset-assert 304)
(next-idx int32 :offset-assert 308)

View file

@ -129,9 +129,9 @@
"1293": "Controller Options",
"1294": "Select Controller",
"1295": "Analog Deadzone",
"1296": "Ignore If Window Unfocused",
"1297": "Controller Led For HP",
"1298": "Controller Led For Dark Jak",
"1296": "Ignore When Window is Unfocused",
"1297": "Use LED for Health",
"1298": "Use LED for Other States",
"1299": "Enable Keyboard",
"129a": "Enable Mouse",
"129b": "Mouse Options",
@ -147,5 +147,8 @@
"1305": "No Options",
"1306": "Waiting",
"1307": "Unset",
"1308": "Unknown"
"1308": "Unknown",
"1309": "High-Resolution Sky",
"130a": "Fast Airlocks and Doors",
"130b": "Fast Elevators"
}

View file

@ -519,6 +519,15 @@
)
)
(defmacro eq-any? (val &rest pred)
"is val equal to any of the values in pred? evaluated using or, so it short circuits."
(with-gensyms (val-var)
`(let ((,val-var ,val))
(or ,@(apply (lambda (x) `(= ,val-var ,x)) pred)))
)
)
;;;;;;;;;;;;;;;;;;;
;; Math Macros

View file

@ -402,6 +402,10 @@
:flag-assert #x900000010
)
(defmacro static-vector (x y z w)
"creates a static vector."
`(new 'static 'vector :x ,x :y ,y :z ,z :w ,w)
)
(defmacro static-vectorm (x y z)
"creates a static vector using meters. w is set to 1.0"
`(new 'static 'vector :x (meters ,x) :y (meters ,y) :z (meters ,z) :w 1.0)
@ -535,6 +539,17 @@
))
)
(defmacro set-vector-xyz! (v xv yv zv)
"Set xyz fields in a vector"
(with-gensyms (vec)
`(let ((,vec ,v))
(set! (-> ,vec x) ,xv)
(set! (-> ,vec y) ,yv)
(set! (-> ,vec z) ,zv)
,vec
))
)
(defun vector-dot ((a vector) (b vector))
"Take the dot product of two vectors.
Only does the x, y, z compoments.

View file

@ -1473,22 +1473,20 @@
(define *global-search-name* (the basic #f))
(define *global-search-count* 0)
(define-extern search-process-tree (function process-tree (function process-tree object) process-tree))
(define-extern search-process-tree (function process-tree (function process-tree object) process))
(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object))
(define-extern execute-process-tree (function process-tree (function object object) kernel-context object))
(defun process-by-name (name (pool process-tree))
"Look up a process in the given pool by name"
(set! *global-search-name* (the basic name))
(the process (search-process-tree pool (lambda ((var process))
(name= (-> var name) *global-search-name*))))
(search-process-tree pool (lambda ((var process)) (name= (-> var name) *global-search-name*)))
)
(defun process-not-name (name (pool process-tree))
"Look up a process with not the given name."
(set! *global-search-name* (the basic name))
(the process (search-process-tree pool (lambda ((var process))
(not (name= (-> var name) *global-search-name*)))))
(search-process-tree pool (lambda ((var process)) (not (name= (-> var name) *global-search-name*))))
)
(defun process-count ((this process-tree))
@ -1513,7 +1511,7 @@
(defun kill-by-type (type (pool process-tree))
"Call deactivate on all processes with the given type"
(set! *global-search-name* (the basic type))
(let ((proc (the process-tree #f)))
(let ((proc (the process #f)))
(while (set! proc (search-process-tree pool (lambda ((var process))
(= (the type *global-search-name*)
(-> var type)))))
@ -1615,7 +1613,7 @@
(unless (process-mask? (-> this mask) process-tree)
;; is this a match?
(when (func this)
(return-from #f this)
(return (the process this))
)
)
@ -1625,14 +1623,14 @@
(let ((temp (-> (-> brother) brother)))
(let ((ret (search-process-tree (-> brother) func)))
(when ret
(return-from #f ret)
(return ret)
)
)
(set! brother temp)
)
)
)
(the process-tree #f)
(the process #f)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -820,9 +820,9 @@
(flag "x16" 16 dm-msaa-pick-func)
)
(menu "LED"
(flag "hp" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-hp-led?)))
(flag "eco" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-eco-led?)))
(flag "heat" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-heat-led?)))
(flag "hp" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-led-hp?)))
(flag "eco" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-led-eco?)))
(flag "heat" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-led-heat?)))
)
(menu "Territory"
(flag "GAME_TERRITORY_SCEA" (the binteger GAME_TERRITORY_SCEA) dm-territory-pick-func)

View file

@ -235,10 +235,12 @@
;; now multiply by the brightness setting
(vector-float*! (-> obj controller-led-color) (-> obj controller-led-color) (-> obj controller-led-brightness))
;; now use it as the controller led color
(pc-set-controller-led! 0
(the int (lerp-scale 0.0 255.0 (-> obj controller-led-color r) 0.0 1.0))
(the int (lerp-scale 0.0 255.0 (-> obj controller-led-color g) 0.0 1.0))
(the int (lerp-scale 0.0 255.0 (-> obj controller-led-color b) 0.0 1.0)))
(let ((led-rgba (new 'static 'rgba :r (the int (lerp-scale 0.0 255.0 (-> obj controller-led-color r) 0.0 1.0))
:g (the int (lerp-scale 0.0 255.0 (-> obj controller-led-color g) 0.0 1.0))
:b (the int (lerp-scale 0.0 255.0 (-> obj controller-led-color b) 0.0 1.0))
:a #x80)))
(set! *display-led-rgba* led-rgba)
(pc-set-controller-led! 0 (the-as int (-> led-rgba r)) (the-as int (-> led-rgba g)) (the-as int (-> led-rgba b))))
)
(none))
@ -656,9 +658,9 @@
(("subtitle-speaker") (set! (-> obj subtitle-speaker?) (file-stream-read-symbol file)))
(("ignore-controller-win-unfocused?") (set-ignore-controller-in-bg! obj (file-stream-read-symbol file)))
(("controller-hp-led?") (set! (-> obj controller-hp-led?) (file-stream-read-symbol file)))
(("controller-eco-led?") (set! (-> obj controller-eco-led?) (file-stream-read-symbol file)))
(("controller-heat-led?") (set! (-> obj controller-heat-led?) (file-stream-read-symbol file)))
(("controller-hp-led?") (set! (-> obj controller-led-hp?) (file-stream-read-symbol file)))
(("controller-eco-led?") (set! (-> obj controller-led-eco?) (file-stream-read-symbol file)))
(("controller-heat-led?") (set! (-> obj controller-led-heat?) (file-stream-read-symbol file)))
(("stick-deadzone") (set! (-> obj stick-deadzone) (file-stream-read-float file)))
(("keyboard-enabled?") (set-enable-keyboard! obj (file-stream-read-symbol file)))
(("mouse-enabled?") (set! (-> obj mouse-enabled?) (file-stream-read-symbol file)))
@ -733,9 +735,9 @@
(format file " (lod-force-actor ~D)~%" (-> obj lod-force-actor))
(format file " (ignore-controller-win-unfocused? ~A)~%" (-> obj ignore-controller-win-unfocused?))
(format file " (controller-hp-led? ~A)~%" (-> obj controller-hp-led?))
(format file " (controller-eco-led? ~A)~%" (-> obj controller-eco-led?))
(format file " (controller-heat-led? ~A)~%" (-> obj controller-heat-led?))
(format file " (controller-hp-led? ~A)~%" (-> obj controller-led-hp?))
(format file " (controller-eco-led? ~A)~%" (-> obj controller-led-eco?))
(format file " (controller-heat-led? ~A)~%" (-> obj controller-led-heat?))
(format file " (controller-led-brightness ~f)~%" (-> obj controller-led-brightness))
(format file " (controller-led-min-brightness ~f)~%" (-> obj controller-led-min-brightness))
(format file " (controller-led-max-brightness ~f)~%" (-> obj controller-led-max-brightness))

View file

@ -142,9 +142,9 @@
;; device settings
(ignore-controller-win-unfocused? symbol)
(controller-hp-led? symbol)
(controller-eco-led? symbol)
(controller-heat-led? symbol)
(controller-led-hp? symbol)
(controller-led-eco? symbol)
(controller-led-heat? symbol)
(controller-led-brightness float)
(controller-led-min-brightness float)
(controller-led-max-brightness float)
@ -272,6 +272,8 @@
(define *display-actor-bank* #f)
(define *display-pad-debug* #f)
(define *display-led* #f)
(define *display-led-rgba* (new 'static 'rgba))
(define *display-heap-status* #f)
(define *display-actor-counts* #f)
(define *display-text-box* #f)
@ -359,9 +361,9 @@
(when (or (= device 'all) (= device 'controller))
(set! (-> obj ignore-controller-win-unfocused?) #f)
(set! (-> obj controller-hp-led?) #t)
(set! (-> obj controller-eco-led?) #t)
(set! (-> obj controller-heat-led?) #t)
(set! (-> obj controller-led-hp?) #t)
(set! (-> obj controller-led-eco?) #t)
(set! (-> obj controller-led-heat?) #t)
(set! (-> obj stick-deadzone) 0.3)
(set! (-> obj controller-led-brightness) 1.0)
(set! (-> obj controller-led-min-brightness) 0.25)

View file

@ -323,9 +323,9 @@
(defmethod led-enabled? pc-settings-jak1 ((obj pc-settings-jak1))
"should the controller led be set?"
(or (-> obj controller-hp-led?)
(-> obj controller-eco-led?)
(-> obj controller-heat-led?)))
(or (-> obj controller-led-hp?)
(-> obj controller-led-eco?)
(-> obj controller-led-heat?)))
(defmethod update-led pc-settings-jak1 ((obj pc-settings-jak1))
"set the controller led color by modifying the controller-led-color vector"
@ -337,7 +337,7 @@
(when *target*
(let ((set-no-eco-color? #t))
(when (-> obj controller-hp-led?)
(when (-> obj controller-led-hp?)
;; flicker led according to hp. lower hp = faster and more intense flicker
(cond
((= (-> *target* fact-info-target health) 0.0)
@ -358,7 +358,7 @@
)
)
(when (and (-> obj controller-heat-led?)
(when (and (-> obj controller-led-heat?)
(nonzero? (-> *target* racer))
(logtest? (-> *target* control root-prim prim-core action) (collide-action racer))
(or (= (-> *target* current-level name) 'lavatube)
@ -378,7 +378,7 @@
)
)
(when (-> obj controller-eco-led?)
(when (-> obj controller-led-eco?)
;; get remaining eco as a number from 0.0 to 1.0
(let ((eco-remain-fac (/ (the float (- (-> *target* fact-info-target eco-timeout) (- (-> *display* game-frame-counter) (-> *target* fact-info-target eco-pickup-time))))
(the float (-> *FACT-bank* eco-full-timeout)))))

View file

@ -993,9 +993,9 @@
(set! (-> *controller-options* 1 value-to-modify) (&-> *setting-control* default vibration))
(set! (-> *controller-options* 2 value-to-modify) (&-> *pc-settings* stick-deadzone))
(set! (-> *controller-options* 3 value-to-modify) (&-> *pc-settings* ignore-controller-win-unfocused?))
(set! (-> *controller-options* 4 value-to-modify) (&-> *pc-settings* controller-hp-led?))
(set! (-> *controller-options* 5 value-to-modify) (&-> *pc-settings* controller-eco-led?))
(set! (-> *controller-options* 6 value-to-modify) (&-> *pc-settings* controller-heat-led?))
(set! (-> *controller-options* 4 value-to-modify) (&-> *pc-settings* controller-led-hp?))
(set! (-> *controller-options* 5 value-to-modify) (&-> *pc-settings* controller-led-eco?))
(set! (-> *controller-options* 6 value-to-modify) (&-> *pc-settings* controller-led-heat?))
(set! (-> *mouse-options* 0 value-to-modify) (&-> *pc-settings* mouse-camera?))
(set! (-> *mouse-options* 1 value-to-modify) (&-> *pc-settings* mouse-xsens))

View file

@ -3896,7 +3896,7 @@
)
(logior! (-> *game-info* features) (game-feature gun))
(logior! (-> *game-info* debug-features) (game-feature gun))
(send-event *target* 'change-mode 'gun #f 0)
(send-event *target* 'change-mode 'gun #f (pickup-type none))
)
)
(function "darkjak" #f ,(lambda ()
@ -6011,7 +6011,7 @@
)
(logior! (-> *game-info* features) (game-feature gun))
(logior! (-> *game-info* debug-features) (game-feature gun))
(send-event *target* 'change-mode 'gun #f 0)
(send-event *target* 'change-mode 'gun #f (pickup-type none))
)
)
(function "darkjak" #f ,(lambda ()

View file

@ -1541,8 +1541,9 @@
(s1-3 (-> s4-8 bsp region-trees s2-4))
)
(while (< s2-4 s3-5)
;; og:preserve-this pc port note: added this name check
;; og:preserve-this pc port note: added this name and water check
(let ((tree-name (-> s1-3 name)))
(when (or (!= tree-name 'water) (not *debug-region-hide-water*))
(set! *debug-region-color-alt* (= tree-name 'camera))
(let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length)))
@ -1557,7 +1558,7 @@
)
)
)
)
))
(+! s2-4 1)
(set! s1-3 (-> s4-8 bsp region-trees s2-4))
)

View file

@ -5,45 +5,6 @@
;; name in dgo: fact-h
;; dgos: ENGINE, GAME
(defenum pickup-type
:bitfield #f
:type int32
(none 0)
(eco-yellow 1)
(eco-red 2)
(eco-blue 3)
(eco-dark 4)
(eco-green 5)
(eco-pill-green 6)
(eco-pill-dark 7)
(eco-pill-random 8)
(money 9)
(fuel-cell 10)
(buzzer 11)
(darkjak 12)
(ammo-yellow 13)
(ammo-red 14)
(ammo-blue 15)
(ammo-dark 16)
(shield 17)
(health 18)
(trick-point 19)
(trick-judge 20)
(gem 21)
(skill 22)
(karma 23)
(gun-red 24)
(gun-yellow 25)
(gun-blue 26)
(gun-dark 27)
(board 28)
(pass-red 29)
(pass-green 30)
(pass-yellow 31)
(pass-blue 32)
(ammo-random 33)
)
(defenum actor-option
:bitfield #t
:type uint64

View file

@ -9,6 +9,45 @@
(declare-type continue-point basic)
(declare-type game-save basic)
(defenum pickup-type
:bitfield #f
:type int32
(none 0)
(eco-yellow 1)
(eco-red 2)
(eco-blue 3)
(eco-dark 4)
(eco-green 5)
(eco-pill-green 6)
(eco-pill-dark 7)
(eco-pill-random 8)
(money 9)
(fuel-cell 10)
(buzzer 11)
(darkjak 12)
(ammo-yellow 13)
(ammo-red 14)
(ammo-blue 15)
(ammo-dark 16)
(shield 17)
(health 18)
(trick-point 19)
(trick-judge 20)
(gem 21)
(skill 22)
(karma 23)
(gun-red 24)
(gun-yellow 25)
(gun-blue 26)
(gun-dark 27)
(board 28)
(pass-red 29)
(pass-green 30)
(pass-yellow 31)
(pass-blue 32)
(ammo-random 33)
)
(defenum continue-flags
:type uint32
:bitfield #t
@ -251,7 +290,7 @@
(unknown-pad1 uint32 :offset-assert 148)
(purchase-secrets game-secrets :offset-assert 152)
(unknown-pad2 uint32 :offset-assert 156)
(gun-type int32 :offset-assert 160)
(gun-type pickup-type :offset-assert 160)
(gun-ammo float 4 :offset-assert 164)
(shield float :offset-assert 180)
(score float :offset-assert 184)

View file

@ -396,7 +396,7 @@
(set! (-> this unknown-pad6 v1-69) (the-as uint 0))
)
(set! (-> this death-movie-tick) (rand-vu-int-count 10))
(set! (-> this gun-type) 2)
(set! (-> this gun-type) (pickup-type eco-red))
(set! (-> this gun-ammo 0) (-> *FACT-bank* ammo-yellow-start))
(set! (-> this gun-ammo 1) (-> *FACT-bank* ammo-red-start))
(set! (-> this gun-ammo 2) (-> *FACT-bank* ammo-blue-start))

View file

@ -1279,7 +1279,7 @@
)
)
(((game-save-elt gun-type))
(set! (-> this gun-type) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)))
(set! (-> this gun-type) (the-as pickup-type (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)))
)
(((game-save-elt gun-ammo))
(let ((v1-67 (min 4 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))))
@ -1306,7 +1306,8 @@
)
)
(((game-save-elt perm-list))
(let ((s2-3 (min (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) (-> this perm-list allocated-length))))
(let ((s2-3 (min (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) (-> this perm-list allocated-length)))
)
(set! (-> this perm-list length) s2-3)
(dotimes (s1-1 s2-3)
(mem-copy!
@ -1601,7 +1602,13 @@
(set! (-> this allocated-length) s4-0)
)
(when (!= (-> this version) 3)
(format 0 "ERROR: SAVEGAME: save file ~A was version ~d, but only ~d is supported.~%" s5-0 (-> this version) 3)
(format
0
"ERROR: SAVEGAME: save file ~A was version ~d, but only ~d is supported.~%"
s5-0
(-> this version)
3
)
(set! (-> this length) 0)
0
)

View file

@ -697,7 +697,7 @@
)
(while (< i s0-4)
(let ((draw? #f))
(when (and *display-region-inside* (region-method-9 (-> region region) (target-pos 0)))
(when (and *display-region-inside* (!= tree-name 'water) (region-method-9 (-> region region) (target-pos 0)))
(true! draw?)
(format *stdcon* "~1kinside region-~D [~A] (l: ~A)~%" (-> region region id) tree-name (-> lev name)))
(when (and *region-debug-inspect* (or (= *region-debug-inspect* region) (and *merge-region-prims* (= (-> region region id) (-> *region-debug-inspect* region id)))))

View file

@ -410,15 +410,15 @@
)
)
)
(let* ((shrub-dma-buff (-> *display* frames (-> *display* on-screen) global-buf))
(dma-start (-> shrub-dma-buff base)))
(add-pc-camera-data shrub-dma-buff)
(let ((a3-22 (-> shrub-dma-buff base)))
(let ((v1-57 (the-as object (-> shrub-dma-buff base))))
(let* ((dma-buff (-> *display* frames (-> *display* on-screen) global-buf))
(dma-start (-> dma-buff base)))
(add-pc-camera-data dma-buff)
(let ((a3-22 (-> dma-buff base)))
(let ((v1-57 (the-as object (-> dma-buff base))))
(set! (-> (the-as dma-packet v1-57) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-57) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-57) vif1) (new 'static 'vif-tag))
(set! (-> shrub-dma-buff base) (&+ (the-as pointer v1-57) 16))
(set! (-> dma-buff base) (&+ (the-as pointer v1-57) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) bucket-group)

View file

@ -436,6 +436,10 @@ Changes:
:flag-assert #x900000010
)
(defmacro static-vector (x y z w)
"creates a static vector."
`(new 'static 'vector :x ,x :y ,y :z ,z :w ,w)
)
(defmacro static-vectorm (x y z)
"creates a static vector using meters. w is set to 1.0"
`(new 'static 'vector :x (meters ,x) :y (meters ,y) :z (meters ,z) :w 1.0)
@ -577,6 +581,17 @@ Changes:
))
)
(defmacro set-vector-xyz! (v xv yv zv)
"Set xyz fields in a vector"
(with-gensyms (vec)
`(let ((,vec ,v))
(set! (-> ,vec x) ,xv)
(set! (-> ,vec y) ,yv)
(set! (-> ,vec z) ,zv)
,vec
))
)
(defun vector-dot ((a vector) (b vector))
"Take the dot product of two vectors.
Only does the x, y, z compoments.

View file

@ -439,7 +439,7 @@
(defstate idle (gun)
:virtual #t
:trans (behavior ()
(set! (-> self gun-type) (the-as pickup-type (-> (the-as target (-> self parent 0)) game gun-type)))
(set! (-> self gun-type) (-> (the-as target (-> self parent 0)) game gun-type))
(let ((a0-0 (ppointer->process (-> self parent))))
(cond
((focus-test? (the-as target a0-0) in-head)
@ -527,86 +527,86 @@
(let ((v1-0 (-> self gun-type))
(a0-5 (-> (the-as target (-> self parent 0)) game gun-type))
)
(set! (-> self gun-type) (the-as pickup-type a0-5))
(set! (-> self gun-type) a0-5)
(cond
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 2))
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! (-> self draw art-group data 28) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 3))
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! (-> self draw art-group data 27) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 4))
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! (-> self draw art-group data 26) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 1))
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! (-> self draw art-group data 28) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 3))
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! (-> self draw art-group data 30) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 4))
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! (-> self draw art-group data 23) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 1))
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! (-> self draw art-group data 27) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 2))
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! (-> self draw art-group data 30) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 4))
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! (-> self draw art-group data 29) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 1))
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! (-> self draw art-group data 26) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 2))
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! (-> self draw art-group data 23) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 3))
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! (-> self draw art-group data 29) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)

View file

@ -154,8 +154,8 @@
(defbehavior target-gun-setup target ((arg0 symbol))
(when (zero? (-> self gun))
(if (zero? (-> self game gun-type))
(set! (-> self game gun-type) 2)
(if (= (-> self game gun-type) (pickup-type none))
(set! (-> self game gun-type) (pickup-type eco-red))
)
(set! (-> self gun) (new 'process 'gun-info))
(set! (-> self gun process) (the-as (pointer target) (process->ppointer self)))
@ -190,7 +190,7 @@
(none)
)
(defbehavior target-gun-init target ((arg0 int))
(defbehavior target-gun-init target ((arg0 pickup-type))
(let ((gp-0 (-> self gun)))
(if (zero? (-> gp-0 hips))
(set! (-> gp-0 hips) (new 'process 'joint-mod (joint-mod-mode rotate) self 26))
@ -575,8 +575,8 @@
)
)
(defbehavior target-gun-type-set! target ((arg0 int))
(if (zero? arg0)
(defbehavior target-gun-type-set! target ((arg0 pickup-type))
(if (= arg0 (pickup-type none))
(set! arg0 (-> self game gun-type))
)
(when (not (logtest? (the-as game-feature (ash 1 (+ arg0 5)))
@ -589,7 +589,7 @@
(-> self game features)
)
)
(set! arg0 1)
(set! arg0 (pickup-type eco-yellow))
(goto cfg-39)
)
(when (and (logtest? (-> self game features) (game-feature gun))
@ -598,7 +598,7 @@
(-> self game features)
)
)
(set! arg0 2)
(set! arg0 (pickup-type eco-red))
(goto cfg-39)
)
(when (and (logtest? (-> self game features) (game-feature gun))
@ -607,7 +607,7 @@
(-> self game features)
)
)
(set! arg0 3)
(set! arg0 (pickup-type eco-blue))
(goto cfg-39)
)
(when (and (logtest? (-> self game features) (game-feature gun))
@ -616,14 +616,14 @@
(-> self game features)
)
)
(set! arg0 4)
(set! arg0 (pickup-type eco-dark))
(goto cfg-39)
)
(set! arg0 0)
(set! arg0 (pickup-type none))
(label cfg-39)
(cond
((zero? arg0)
(set! arg0 arg0)
((zero? (the-as int arg0))
(set! arg0 (the-as pickup-type arg0))
(goto cfg-190)
)
(else
@ -631,7 +631,7 @@
)
)
)
(set! (-> self game gun-type) arg0)
(set! (-> self game gun-type) (the-as pickup-type arg0))
(set! (-> self gun track-turnv-range) 81920.0)
(set! (-> self gun track-tilt-range) 0.0)
(set! (-> self gun track-turn-range) 0.0)
@ -650,7 +650,7 @@
(let ((s5-0 (-> self gun gun-type)))
(set! (-> self gun gun-type) (the-as pickup-type arg0))
(set! (-> self gun using-gun-type) (the-as pickup-type arg0))
(case arg0
(case (the-as int arg0)
((3)
(set! (-> self gun gun-control) (the-as uint 4))
(set! (-> self gun fire-range) 327680.0)
@ -715,7 +715,7 @@
(set! (-> self skel top-anim frame-post-blend) 0.1333333)
(cond
((focus-test? self pilot-riding)
(let ((v1-164 arg0))
(let ((v1-164 (the-as int arg0)))
(cond
((and (= s5-0 (pickup-type eco-red)) (= v1-164 4))
(push-anim-to-targ
@ -865,7 +865,7 @@
)
)
(else
(let ((v1-227 arg0))
(let ((v1-227 (the-as int arg0)))
(cond
((and (= s5-0 (pickup-type eco-red)) (= v1-227 4))
(if (rand-vu-percent? 0.5)
@ -1534,7 +1534,7 @@
)
(when gp-0
(if (not (using-gun? self))
(send-event self 'change-mode 'gun #f 0)
(send-event self 'change-mode 'gun #f (pickup-type none))
)
(combo-tracker-method-12
(-> self gun attack-combo)

View file

@ -80,7 +80,7 @@
(define-extern target-gun-marking-menu (function target none))
(define-extern gun-init (function none :behavior gun))
(declare-type gun-red-shot process-drawable)
(define-extern target-gun-type-set! (function int none :behavior target))
(define-extern target-gun-type-set! (function pickup-type none :behavior target))
(define-extern target-gun-fire-blue (function (pointer process) :behavior target))
(define-extern target-gun-fire-yellow (function (pointer process) :behavior target))
(define-extern target-gun-fire-red (function (pointer gun-red-shot) :behavior target))
@ -95,7 +95,7 @@
(define-extern target-gun-check (function none :behavior target))
(define-extern target-gun-fire (function pickup-type none :behavior target))
(define-extern target-darkjak-end-mode (function none :behavior target))
(define-extern target-gun-init (function int none :behavior target))
(define-extern target-gun-init (function pickup-type none :behavior target))
(define-extern *hit-ground-hard-mods* surface)
(define-extern *float-mods* surface)

View file

@ -1031,7 +1031,7 @@
(('gun-type)
(cond
((-> arg3 param 0)
(target-gun-type-set! (the-as int (-> arg3 param 0)))
(target-gun-type-set! (the-as pickup-type (-> arg3 param 0)))
)
(else
(set! v0-0 #t)
@ -1230,7 +1230,7 @@
)
((= v1-45 'gun)
(if (logtest? (-> self game features) (game-feature gun))
(target-gun-init (the-as int (-> arg3 param 2)))
(target-gun-init (the-as pickup-type (-> arg3 param 2)))
)
)
((= v1-45 'tube)

View file

@ -330,7 +330,7 @@
)
((want-to-gun? self #t)
(if (logtest? (-> self game features) (game-feature gun))
(target-gun-init (the-as int (-> block param 2)))
(target-gun-init (the-as pickup-type (-> block param 2)))
)
)
)

View file

@ -699,7 +699,7 @@
(progress-controller-options-analog-deadzone #x1295)
(progress-controller-options-ignore-if-unfocused #x1296)
(progress-controller-options-led-hp #x1297)
(progress-controller-options-led-darkjak #x1298)
(progress-controller-options-led-state #x1298)
(progress-input-options-enable-keyboard #x1299)
(progress-input-options-enable-mouse #x129a)
(progress-menu-mouse-options #x129b)
@ -716,6 +716,9 @@
(progress-keybinds-waiting-for-bind #x1306)
(progress-keybinds-unset #x1307)
(progress-unknown-option #x1308)
(progress-hires-sky #x1309)
(progress-fast-airlock #x130a)
(progress-fast-elevator #x130b)
)
;; ---text-id

View file

@ -18,7 +18,7 @@
(define-extern *default-level* level)
(define-extern change-parent (function process-tree process-tree process-tree))
(define-extern search-process-tree (function process-tree (function process-tree object) process-tree))
(define-extern search-process-tree (function process-tree (function process-tree object) process))
(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object))
(define-extern execute-process-tree (function process-tree (function object object) kernel-context object))
(define-extern inspect-process-tree (function process-tree int int symbol process-tree))
@ -1393,23 +1393,13 @@
(defun process-by-name ((arg0 string) (arg1 process-tree))
"Get a process by name."
(set! *global-search-name* arg0)
(the-as process (search-process-tree
arg1
(lambda ((arg0 process)) (string= (-> arg0 name) (the-as string *global-search-name*)))
)
)
(search-process-tree arg1 (lambda ((arg0 process)) (string= (-> arg0 name) (the-as string *global-search-name*))))
)
(defun process-not-name ((arg0 string) (arg1 process-tree))
"Get a process that doesn't have the given name."
(set! *global-search-name* (the-as basic arg0))
(the-as
process
(search-process-tree
arg1
(lambda ((arg0 process)) (not (string= (-> arg0 name) (the-as string *global-search-name*))))
)
)
(search-process-tree arg1 (lambda ((arg0 process)) (not (string= (-> arg0 name) (the-as string *global-search-name*)))))
)
(defun process-count ((arg0 process-tree))
@ -1536,7 +1526,7 @@
"Iterate process tree, returning the process that returns #t first."
(when (zero? (logand (-> arg0 mask) (process-mask process-tree)))
(if (arg1 arg0)
(return arg0)
(return (the process arg0))
)
)
(let ((v1-5 (-> arg0 child)))
@ -1551,7 +1541,7 @@
)
)
)
(the-as process-tree #f)
(the-as process #f)
)
;; decomp deviation

View file

@ -55,7 +55,7 @@
)
(('gun)
(if (logtest? (-> self game features) (game-feature gun))
(target-gun-init (the-as int (-> arg3 param 2)))
(target-gun-init (the-as pickup-type (-> arg3 param 2)))
)
)
)

View file

@ -835,7 +835,7 @@
(let ((gp-32 (-> self mask)))
(logior! (-> self mask) (process-mask no-kill))
(play-task (game-task strip-rescue) 'debug #f)
(set! (-> *game-info* gun-type) 1)
(set! (-> *game-info* gun-type) (pickup-type eco-yellow))
(logior! (-> *game-info* debug-features) (game-feature board))
(logior! (-> *game-info* features) (game-feature board))
(send-event (ppointer->process *time-of-day*) 'change 'hour 8)

View file

@ -1142,8 +1142,8 @@ This commonly includes things such as:
(set! (-> self training?) #t)
)
(set-setting! 'features 'clear 0.0 (game-feature gun-red gun-blue gun-dark))
(if (!= (-> *game-info* gun-type) 1)
(send-event *target* 'change-mode 'gun #f 1)
(if (!= (-> *game-info* gun-type) (pickup-type eco-yellow))
(send-event *target* 'change-mode 'gun #f (pickup-type eco-yellow))
)
)
((= (-> self course) *red-training-path-global-info*)
@ -1158,8 +1158,8 @@ This commonly includes things such as:
(set! (-> self training?) #t)
)
(set-setting! 'features 'clear 0.0 (game-feature gun-yellow gun-blue gun-dark))
(if (!= (-> *game-info* gun-type) 2)
(send-event *target* 'change-mode 'gun #f 2)
(if (!= (-> *game-info* gun-type) (pickup-type eco-red))
(send-event *target* 'change-mode 'gun #f (pickup-type eco-red))
)
)
((= (-> self course) *blue-training-path-global-info*)
@ -1169,8 +1169,8 @@ This commonly includes things such as:
(set! (-> self task-bronze) (the-as uint 100))
(set! (-> *game-info* goal) 4000.0)
(set-setting! 'features 'clear 0.0 (game-feature gun-yellow gun-red gun-dark))
(if (!= (-> *game-info* gun-type) 3)
(send-event *target* 'change-mode 'gun #f 3)
(if (!= (-> *game-info* gun-type) (pickup-type eco-blue))
(send-event *target* 'change-mode 'gun #f (pickup-type eco-blue))
)
)
((= (-> self course) *peace-training-path-global-info*)

View file

@ -9,22 +9,12 @@
(defenum simon-block-flags
:type uint16
:bitfield #t
(sbf0)
(sbf1)
(sbf2)
(blink)
(blink-on)
(ridden)
(sbf3)
(sbf4)
(sbf5)
(sbf6)
(sbf7)
(sbf8)
(sbf9)
(sbf10)
(sbf11)
(sbf12)
(sbf13)
(sbf14)
(sbf15)
(dangerous)
(up-sound-played)
)
;; ---tomb-water:simon-block-flags
@ -580,7 +570,7 @@ This commonly includes things such as:
(t9-0)
)
)
(when (>= (- (current-time) (-> self state-time)) (seconds 4))
(when (time-elapsed? (-> self state-time) (seconds 4))
(if (and *target* (focus-test? *target* grabbed)
;; og:preserve-this added this check to make the beetle button not break everything!!
(< (vector-vector-xz-distance (-> *target* control trans) (-> self root trans)) (meters 10)))
@ -729,7 +719,7 @@ This commonly includes things such as:
)
(deftype tomb-simon-block (base-plat)
((sound-show uint128 :offset-assert 272)
((sound-show sound-name :offset-assert 272)
(color vector :inline :offset-assert 288)
(my-idx int32 :offset-assert 304)
(next-idx int32 :offset-assert 308)
@ -1100,10 +1090,10 @@ This commonly includes things such as:
(when (!= (-> self basetrans y) (-> self base-height))
(seek! (-> self basetrans y) (-> self base-height) (* (-> self move-rate) (seconds-per-frame)))
(when (and (< (- (-> self base-height) (-> self basetrans y)) 21504.0)
(not (logtest? (-> self flags) (simon-block-flags sbf5)))
(not (logtest? (-> self flags) (simon-block-flags up-sound-played)))
)
(sound-play "simon-up")
(logior! (-> self flags) (simon-block-flags sbf5))
(logior! (-> self flags) (simon-block-flags up-sound-played))
)
(if (< (- (-> self base-height) (-> self basetrans y)) 81920.0)
(seek! (-> self move-rate) 0.0 (* 81920.0 (seconds-per-frame)))
@ -1118,22 +1108,28 @@ This commonly includes things such as:
)
(defbehavior tomb-simon-block-trans tomb-simon-block ()
(when (logtest? (-> self flags) (simon-block-flags sbf0))
(when (logtest? (-> self flags) (simon-block-flags blink))
(when (>= (current-time) (-> self blink-timer 1))
(cond
((logtest? (-> self flags) (simon-block-flags sbf1))
((logtest? (-> self flags) (simon-block-flags blink-on))
(set! (-> self draw color-mult quad) (-> self color quad))
(#when PC_PORT
;; og:preserve-this controller led mechanics
(vector-copy! *led-tomb-simon-color* *led-tomb-simon-off-color*))
)
(else
(sound-play-by-name (the-as sound-name (-> self sound-show)) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
(sound-play-by-name (-> self sound-show) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
(#when PC_PORT
;; og:preserve-this controller led mechanics
(vector-copy! *led-tomb-simon-color* (-> self color)))
(set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0)
)
)
(logxor! (-> self flags) (simon-block-flags sbf1))
(logxor! (-> self flags) (simon-block-flags blink-on))
(set! (-> self blink-timer 1) (+ (current-time) (seconds 0.2)))
)
(when (time-elapsed? (-> self blink-timer 0) (seconds 1.2))
(logclear! (-> self flags) (simon-block-flags sbf0))
(logclear! (-> self flags) (simon-block-flags blink))
(set! (-> self draw color-mult quad) (-> self color quad))
)
)
@ -1182,7 +1178,7 @@ This commonly includes things such as:
)
:enter (behavior ()
(set-time! (-> self state-time))
(logclear! (-> self flags) (simon-block-flags sbf0 sbf1 sbf2 sbf5))
(logclear! (-> self flags) (simon-block-flags blink blink-on ridden up-sound-played))
(set! (-> self move-rate) 122880.0)
)
:trans tomb-simon-block-trans
@ -1210,7 +1206,7 @@ This commonly includes things such as:
)
(('touch 'ridden 'bonk 'edge-grabbed)
(set-time! (-> self ride-timer))
(when (logtest? (-> self flags) (simon-block-flags sbf4))
(when (logtest? (-> self flags) (simon-block-flags dangerous))
(let* ((gp-0 *target*)
(a0-10 (if (type? gp-0 process-focusable)
gp-0
@ -1235,7 +1231,7 @@ This commonly includes things such as:
)
)
)
(let ((v0-0 (the-as object (logclear (-> self flags) (simon-block-flags sbf4)))))
(let ((v0-0 (the-as object (logclear (-> self flags) (simon-block-flags dangerous)))))
(set! (-> self flags) (the-as simon-block-flags v0-0))
v0-0
)
@ -1245,9 +1241,12 @@ This commonly includes things such as:
)
:enter (behavior ()
(set-time! (-> self state-time))
(logior! (-> self flags) (simon-block-flags sbf4))
(logior! (-> self flags) (simon-block-flags dangerous))
(set-time! (-> self ride-timer))
(send-event (ppointer->process (-> self parent)) 'die-but (-> self my-idx))
(#when PC_PORT
;; og:preserve-this controller led mechanics
(enable *led-fader-state* (-> self color)))
)
:trans (behavior ()
(when (time-elapsed? (-> self ride-timer) (seconds 1))
@ -1281,6 +1280,9 @@ This commonly includes things such as:
(if (!= (-> self next-idx) -1)
(send-event (ppointer->process (-> self parent)) 'ready-index (-> self next-idx))
)
(#when PC_PORT
;; og:preserve-this controller led mechanics
(vector-copy! (-> *led-fader-state* end-color) (-> self color)))
(go-virtual ridden)
)
)
@ -1368,8 +1370,8 @@ This commonly includes things such as:
(go-virtual die)
)
(('ridden)
(when (not (logtest? (-> self flags) (simon-block-flags sbf2)))
(logior! (-> self flags) (simon-block-flags sbf2))
(when (not (logtest? (-> self flags) (simon-block-flags ridden)))
(logior! (-> self flags) (simon-block-flags ridden))
(let ((v0-0 (the-as object (current-time))))
(set! (-> self ride-timer) (the-as time-frame v0-0))
v0-0
@ -1379,11 +1381,11 @@ This commonly includes things such as:
)
)
:enter (behavior ()
(logclear! (-> self flags) (simon-block-flags sbf0 sbf1 sbf2))
(logclear! (-> self flags) (simon-block-flags blink blink-on ridden))
(set! (-> self draw color-mult quad) (-> self color quad))
)
:trans (behavior ()
(if (and (logtest? (-> self flags) (simon-block-flags sbf2)) (time-elapsed? (-> self ride-timer) (seconds 0.5)))
(if (and (logtest? (-> self flags) (simon-block-flags ridden)) (time-elapsed? (-> self ride-timer) (seconds 0.5)))
(go-virtual wobble-die)
)
(plat-trans)
@ -1443,7 +1445,7 @@ This commonly includes things such as:
;; WARN: Return type mismatch time-frame vs none.
(defmethod set-blink-timers! tomb-simon-block ((this tomb-simon-block))
(logior! (-> this flags) (simon-block-flags sbf0 sbf1))
(logior! (-> this flags) (simon-block-flags blink blink-on))
(set-time! (-> this blink-timer 0))
(set-time! (-> this blink-timer 1))
(none)

View file

@ -357,11 +357,11 @@
(cond
((-> arg value)
(false! (-> arg value))
(logior! (-> *display* vu1-enable-user-menu) (vu1-renderer-mask tfrag tfrag-trans tie tie-envmap))
(logior! (-> *display* vu1-enable-user-menu) (vu1-renderer-mask shrubbery tfrag tfrag-trans tie tie-envmap))
)
(else
(true! (-> arg value))
(logclear! (-> *display* vu1-enable-user-menu) (vu1-renderer-mask tfrag tfrag-trans tie tie-envmap))
(logclear! (-> *display* vu1-enable-user-menu) (vu1-renderer-mask shrubbery tfrag tfrag-trans tie tie-envmap))
)
)
)
@ -713,6 +713,7 @@
(debug-menu-append-item regions-menu (new-dm-func "Print on-exit" 'on-exit dm-print-region-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Display region inside" *display-region-inside* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Show non-sphere bsphere" *debug-region-show-bsphere* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Hide water regions" *debug-region-hide-water* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Region Marks" *display-region-marks* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "region-mode" #f
(lambda (arg (msg debug-menu-msg))
@ -914,9 +915,8 @@
(flag "x16" 16 dm-msaa-pick-func)
)
(menu "LED"
(flag "hp" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-hp-led?)))
(flag "eco" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-eco-led?)))
(flag "heat" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-heat-led?)))
(flag "hp" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-led-hp?)))
(flag "status" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-led-status?)))
)
(menu "Territory"
(flag "GAME_TERRITORY_SCEA" (the binteger GAME_TERRITORY_SCEA) dm-territory-pick-func)

View file

@ -11,8 +11,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; version: 0.1.4.2
(defconstant PC_KERNEL_VERSION (static-pckernel-version 0 1 4 2))
;; version: 0.1.5.2
(defconstant PC_KERNEL_VERSION (static-pckernel-version 0 1 5 2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; types and enums
@ -91,6 +91,9 @@
(smooth-minimap? symbol)
(hires-clouds? symbol)
;; other
(controller-led-status? symbol)
(text-language pc-language) ;; language for game text
;; debug
@ -154,6 +157,16 @@
(set! (-> obj flava-unlocked i) #f))
0)
(defmethod reset-input pc-settings-jak2 ((obj pc-settings-jak2) (device symbol) (call-handlers symbol))
"Set the default input settings"
((method-of-type pc-settings reset-input) obj device call-handlers)
(when (or (= device 'all) (= device 'controller))
(set! (-> obj controller-led-status?) #t)
)
0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; other
@ -163,6 +176,7 @@
(define *hires-sky* #t)
(define *debug-region-color-alt* #t)
(define *debug-region-show-bsphere* #f)
(define *debug-region-hide-water* #t)
;; for debugging

View file

@ -76,6 +76,102 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; fancy controller LED fader mechanics
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftype led-fader-state (structure)
((enable? symbol)
(amount float)
(cur-color vector :inline)
(start-color vector :inline)
(end-color vector :inline)
)
(:methods
(enable (_type_ vector) int)
(update (_type_ float float) vector)
(disable (_type_) int)
)
)
(defmethod enable led-fader-state ((this led-fader-state) (start-from vector))
"begin transition."
(when (-> this enable?)
(disable this))
(vector-copy! (-> this start-color) start-from)
(set! (-> this amount) 0.0)
(true! (-> this enable?))
0)
(defmethod disable led-fader-state ((this led-fader-state))
"disable transition."
(set! (-> this amount) 0.0)
(update this 0.0 0.1)
(false! (-> this enable?))
0)
(defun vector3-lerp! ((dest vector) (a vector) (b vector) (alpha float))
"Linearly interpolate between two vectors. Alpha isn't clamped.
w will be set to what's in vector a."
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
)
(init-vf0-vector)
(.lvf vf1 (&-> a quad))
(.lvf vf2 (&-> b quad))
(.mov vf4 alpha)
(.add.x.vf vf3 vf1 vf0 :mask #b1000)
(.sub.vf vf2 vf2 vf1)
(.mul.x.vf vf2 vf2 vf4)
(.add.vf vf3 vf1 vf2 :mask #b111)
(.svf (&-> dest quad) vf3)
dest
)
)
(defun vector3-copy!! ((dest vector) (src vector))
"copy just the xyz fields of src into dest"
(declare (print-asm))
(rlet ((vf0 :class vf)
(dest-vf :class vf)
(src-vf :class vf))
(init-vf0-vector)
(.lvf dest-vf (&-> dest quad))
(.lvf src-vf (&-> src quad))
(.add.vf dest-vf vf0 src-vf :mask #b111)
(.svf (&-> dest quad) dest-vf)
dest
)
)
(defmethod update led-fader-state ((this led-fader-state) (to float) (duration float))
"disable transition."
(when (-> this enable?)
(seek! (-> this amount) to (/ (-> *target* clock seconds-per-frame) duration))
(vector4-lerp! (-> this cur-color) (-> this start-color) (-> this end-color) (-> this amount))
(if (and (= to 0.0) (= 0.0 (-> this amount)))
(false! (-> this enable?)))
)
(-> this cur-color))
;; global vars
(define *led-fader-state* (new 'static 'led-fader-state :enable? #f))
(define *led-darkjak-color* (static-vector 0.5 0.0 0.5 1.0))
(define *led-tomb-simon-off-color* (static-vector 0.0 0.0 0.0 1.0))
(define *led-tomb-simon-color* (static-vector 0.0 0.0 0.0 1.0))
(define *led-wanted-flash-color* (static-vector 1.0 0.0 0.0 1.0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; methods
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -131,6 +227,11 @@
((method-of-type pc-settings update) obj)
(set! *hires-sky* (-> obj hires-clouds?))
(when (not (led-enabled? obj))
(disable *led-fader-state*)
)
(none))
@ -200,6 +301,142 @@
(-> *pc-cheat-state* airlock-close-speed)
1.0))
(defmethod led-enabled? pc-settings-jak2 ((obj pc-settings-jak2))
"should the controller led be set?"
(or (-> obj controller-led-hp?)
(-> obj controller-led-status?)
))
(defmethod update-led pc-settings-jak2 ((obj pc-settings-jak2))
"set the controller led color by modifying the controller-led-color vector"
;; default color is just blue.
(set-vector-xyz! (-> obj controller-led-color) 0.0 0.0 1.0)
(when *target*
(let ((disable-fader? #t)
(simon-plat (the process #f)))
(when (-> obj controller-led-hp?)
;; flicker led according to hp. lower hp = faster and more intense flicker
(cond
((= (-> *target* fact health) 0.0)
;; dead. just set to minimum brightness.
(set! (-> obj controller-led-color a) (-> obj controller-led-min-brightness))
)
(else
(let ((flicker-speed (lerp-scale 2.0 0.0
(-> *target* fact health)
1.0 (-> *FACT-bank* health-max-default)))
(flicker-amp (lerp-scale (- 1.0 (-> obj controller-led-min-brightness)) (- 1.0 (-> obj controller-led-max-brightness))
(-> *target* fact health)
1.0 (-> *FACT-bank* health-max-default)))
)
(set! (-> obj controller-led-color a) (- 1.0 (* flicker-amp (/ (+ 1.0 (sin (* flicker-speed (degrees (current-time))))) 2.0))))
)
)
)
)
(when (-> obj controller-led-status?)
(set-vector-xyz! (-> obj controller-led-color) 1.0 1.0 1.0)
(cond
;; simon plat
((set! simon-plat (search-process-tree *active-pool*
(lambda ((proc process)) (and (= (-> proc type symbol) 'tomb-plat-simon)
(-> proc next-state)
(eq-any? (-> proc next-state name) 'appear 'show-sequence 'idle)))))
(set! disable-fader? #f)
(case (-> simon-plat next-state name)
(('appear)
;; simon plats appearing - fade to black
(vector-copy! *led-tomb-simon-color* *led-tomb-simon-off-color*)
(vector-copy! (-> *led-fader-state* end-color) *led-tomb-simon-off-color*)
(if (not (-> *led-fader-state* enable?))
(enable *led-fader-state* (-> obj controller-led-color)))
)
(('show-sequence)
;; showing simon sequence - use only the flashing color
(vector-copy! (-> obj controller-led-color) *led-tomb-simon-color*)
;; set fader color to max, if it's not somehow.
(when (!= (-> *led-fader-state* amount) 1.0)
(set! (-> *led-fader-state* amount) 1.0))
)
(('idle)
;; playing simon sequence - simon blocks set end-color here
)
)
(update *led-fader-state* 1.0 2.0)
(unless (= (-> simon-plat next-state name) 'show-sequence)
(vector3-copy!! (-> obj controller-led-color) (-> *led-fader-state* cur-color)))
)
;; simon plat block
((set! simon-plat (search-process-tree *active-pool*
(lambda ((proc process)) (and (= (-> proc type symbol) 'tomb-simon-block)
(-> proc next-state)
(= (-> proc next-state name) 'dangerous)))))
;; simon plat mistake - fade to black (start color was set by simon block)
(set! disable-fader? #f)
(vector-copy! (-> *led-fader-state* end-color) *led-tomb-simon-off-color*)
(update *led-fader-state* 1.0 1.5)
(vector3-copy!! (-> obj controller-led-color) (-> *led-fader-state* cur-color))
)
;; gun
((and (nonzero? (-> *target* gun)) (focus-test? *target* gun))
(case (-> *target* gun gun-type)
(((pickup-type eco-yellow))
(set-vector-xyz! (-> obj controller-led-color) 1.0 0.75 0.125))
(((pickup-type eco-red))
(set-vector-xyz! (-> obj controller-led-color) 0.65 0.0 0.0))
(((pickup-type eco-blue))
(set-vector-xyz! (-> obj controller-led-color) 0.4375 0.8125 1.0))
(((pickup-type eco-dark))
(set-vector-xyz! (-> obj controller-led-color) 0.6875 0.6 0.78125))
)
)
;; darkjak
((and (nonzero? (-> *target* darkjak)) (focus-test? *target* dark))
(vector-copy! (-> *led-fader-state* end-color) *led-darkjak-color*)
(set! disable-fader? #f)
(if (not (-> *led-fader-state* enable?))
(enable *led-fader-state* (-> obj controller-led-color)))
(if (and (-> *target* next-state) (= (-> *target* next-state name) 'target-darkjak-get-off))
(update *led-fader-state* 0.0 0.75)
(update *led-fader-state* 1.0 0.3))
(vector3-copy!! (-> obj controller-led-color) (-> *led-fader-state* cur-color))
)
;; indax
((focus-test? *target* indax)
(set-vector-xyz! (-> obj controller-led-color) 1.0 0.5 0.0)
)
;; mech
((focus-test? *target* mech)
(set-vector-xyz! (-> obj controller-led-color) 1.0 1.0 0.0)
)
;; board
((focus-test? *target* board)
(set-vector-xyz! (-> obj controller-led-color) 0.0 1.0 1.0)
)
)
;; wanted flash
(awhen (the hud-map (process-by-name "hud-map" *active-pool*))
(when (not (hidden? it))
(let ((flash-amount (/ (+ (sin (degrees (-> it values 1 current))) 1.0) 2)))
(vector3-lerp! (-> obj controller-led-color) (-> obj controller-led-color) *led-wanted-flash-color* flash-amount)
))
)
)
(when disable-fader?
(disable *led-fader-state*))
))
#t)
(defmacro flava-unlocked? (flava)
"return #t if the specified flava is unlocked"
`(-> *pc-settings* flava-unlocked ,flava))
@ -323,6 +560,7 @@
(("smooth-minimap?") (set! (-> obj smooth-minimap?) (file-stream-read-symbol file)))
(("hires-clouds?") (set! (-> obj hires-clouds?) (file-stream-read-symbol file)))
(("text-language") (set! (-> obj text-language) (the-as pc-language (file-stream-read-int file))))
(("controller-led-status?") (set! (-> obj controller-led-status?) (file-stream-read-symbol file)))
(("cheats") (set! (-> obj cheats) (the-as pc-cheats (file-stream-read-int file))))
(("cheats-revealed") (set! (-> obj cheats-revealed) (the-as pc-cheats (file-stream-read-int file))))
(("cheats-purchased") (set! (-> obj cheats-purchased) (the-as pc-cheats (file-stream-read-int file))))
@ -350,6 +588,7 @@
(format file " (smooth-minimap? ~A)~%" (-> obj smooth-minimap?))
(format file " (hires-clouds? ~A)~%" (-> obj hires-clouds?))
(format file " (text-language ~D)~%" (-> obj text-language))
(format file " (controller-led-status? ~D)~%" (-> obj controller-led-status?))
(format file " (cheats #x~x)~%" (-> obj cheats))
(format file " (cheats-revealed #x~x)~%" (-> obj cheats-revealed))
(format file " (cheats-purchased #x~x)~%" (-> obj cheats-purchased))

View file

@ -91,18 +91,18 @@ This gives us more freedom to write code how we want.
:should-disable? (lambda () (not (pc-current-controller-has-led?)))
:truthy-text (text-id progress-on)
:falsey-text (text-id progress-off)
:get-value-fn (lambda () (-> *pc-settings* controller-hp-led?))
:get-value-fn (lambda () (-> *pc-settings* controller-led-hp?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* controller-hp-led?) val)
(set! (-> *pc-settings* controller-led-hp?) val)
(commit-to-file *pc-settings*)))
(new 'static 'menu-generic-boolean-option
:name (text-id progress-controller-options-led-darkjak)
:name (text-id progress-controller-options-led-state)
:should-disable? (lambda () (not (pc-current-controller-has-led?)))
:truthy-text (text-id progress-on)
:falsey-text (text-id progress-off)
:get-value-fn (lambda () (-> *pc-settings* controller-eco-led?))
:get-value-fn (lambda () (-> *pc-settings* controller-led-eco?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* controller-eco-led?) val)
(set! (-> *pc-settings* controller-led-eco?) val)
(commit-to-file *pc-settings*)))
(new 'static 'menu-generic-confirm-option
:name (text-id progress-restore-defaults)

View file

@ -373,6 +373,7 @@
)
;; definition for method 2 of type process
;; INFO: this function exists in multiple non-identical object files
(defmethod print process ((this process))
(format #t "#<~A ~S ~A :state ~S " (-> this type) (-> this name) (-> this status) (if (-> this state)
(-> this state name)
@ -863,24 +864,16 @@
(define *global-search-count* 0)
;; definition for function process-by-name
;; INFO: Return type mismatch process-tree vs process.
(defun process-by-name ((arg0 object) (arg1 process-tree))
(set! *global-search-name* (the-as basic arg0))
(the-as
process
(search-process-tree arg1 (lambda ((arg0 process)) (name= (-> arg0 name) *global-search-name*)))
)
)
;; definition for function process-not-name
;; INFO: Return type mismatch process-tree vs process.
(defun process-not-name ((arg0 object) (arg1 process-tree))
(set! *global-search-name* (the-as basic arg0))
(the-as
process
(search-process-tree arg1 (lambda ((arg0 process)) (not (name= (-> arg0 name) *global-search-name*))))
)
)
;; definition for function process-count
(defun process-count ((arg0 process-tree))
@ -904,7 +897,7 @@
;; definition for function kill-by-type
(defun kill-by-type ((arg0 object) (arg1 process-tree))
(local-vars (a0-1 process-tree))
(local-vars (a0-1 process))
(set! *global-search-name* (the-as basic arg0))
(while (begin
(set! a0-1 (search-process-tree arg1 (lambda ((arg0 process)) (= (-> arg0 type) *global-search-name*))))
@ -926,7 +919,7 @@
;; definition for function kill-not-type
(defun kill-not-type ((arg0 object) (arg1 process-tree))
(local-vars (a0-1 process-tree))
(local-vars (a0-1 process))
(set! *global-search-name* (the-as basic arg0))
(while (begin
(set! a0-1 (search-process-tree arg1 (lambda ((arg0 process)) (!= (-> arg0 type) *global-search-name*))))
@ -990,10 +983,11 @@
)
;; definition for function search-process-tree
;; INFO: Return type mismatch process-tree vs process.
(defun search-process-tree ((arg0 process-tree) (arg1 (function process-tree object)))
(when (not (logtest? (-> arg0 mask) (process-mask process-tree)))
(if (arg1 arg0)
(return arg0)
(return (the-as process arg0))
)
)
(let ((v1-5 (-> arg0 child)))
@ -1008,7 +1002,7 @@
)
)
)
(the-as process-tree #f)
(the-as process #f)
)
;; definition for function kernel-dispatcher

View file

@ -3977,7 +3977,7 @@
)
(logior! (-> *game-info* features) (game-feature gun))
(logior! (-> *game-info* debug-features) (game-feature gun))
(send-event *target* 'change-mode 'gun #f 0)
(send-event *target* 'change-mode 'gun #f (pickup-type none))
)
)
(function "darkjak" #f ,(lambda ()
@ -6089,7 +6089,7 @@
)
(logior! (-> *game-info* features) (game-feature gun))
(logior! (-> *game-info* debug-features) (game-feature gun))
(send-event *target* 'change-mode 'gun #f 0)
(send-event *target* 'change-mode 'gun #f (pickup-type none))
)
)
(function "darkjak" #f ,(lambda ()

View file

@ -245,7 +245,7 @@
(unknown-pad1 uint32 :offset-assert 148)
(purchase-secrets game-secrets :offset-assert 152)
(unknown-pad2 uint32 :offset-assert 156)
(gun-type int32 :offset-assert 160)
(gun-type pickup-type :offset-assert 160)
(gun-ammo float 4 :offset-assert 164)
(shield float :offset-assert 180)
(score float :offset-assert 184)

View file

@ -1484,7 +1484,7 @@
)
)
(((game-save-elt gun-type))
(set! (-> this gun-type) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)))
(set! (-> this gun-type) (the-as pickup-type (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)))
)
(((game-save-elt gun-ammo))
(let ((v1-67 (min 4 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))))

View file

@ -534,7 +534,7 @@
(defstate idle (gun)
:virtual #t
:trans (behavior ()
(set! (-> self gun-type) (the-as pickup-type (-> (the-as target (-> self parent 0)) game gun-type)))
(set! (-> self gun-type) (-> (the-as target (-> self parent 0)) game gun-type))
(let ((a0-0 (ppointer->process (-> self parent))))
(cond
((focus-test? (the-as target a0-0) in-head)
@ -623,86 +623,86 @@
(let ((v1-0 (-> self gun-type))
(a0-5 (-> (the-as target (-> self parent 0)) game gun-type))
)
(set! (-> self gun-type) (the-as pickup-type a0-5))
(set! (-> self gun-type) a0-5)
(cond
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 2))
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! (-> self draw art-group data 28) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 3))
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! (-> self draw art-group data 27) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 4))
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! (-> self draw art-group data 26) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 1))
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! (-> self draw art-group data 28) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 3))
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! (-> self draw art-group data 30) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 4))
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! (-> self draw art-group data 23) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 1))
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! (-> self draw art-group data 27) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 2))
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! (-> self draw art-group data 30) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 4))
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! (-> self draw art-group data 29) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 1))
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! (-> self draw art-group data 26) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 2))
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! (-> self draw art-group data 23) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 3))
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! (-> self draw art-group data 29) :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)

View file

@ -153,8 +153,8 @@
;; WARN: Return type mismatch int vs none.
(defbehavior target-gun-setup target ((arg0 symbol))
(when (zero? (-> self gun))
(if (zero? (-> self game gun-type))
(set! (-> self game gun-type) 2)
(if (= (-> self game gun-type) (pickup-type none))
(set! (-> self game gun-type) (pickup-type eco-red))
)
(set! (-> self gun) (new 'process 'gun-info))
(set! (-> self gun process) (the-as (pointer target) (process->ppointer self)))
@ -191,7 +191,7 @@
;; definition for function target-gun-init
;; WARN: Return type mismatch int vs none.
(defbehavior target-gun-init target ((arg0 int))
(defbehavior target-gun-init target ((arg0 pickup-type))
(let ((gp-0 (-> self gun)))
(if (zero? (-> gp-0 hips))
(set! (-> gp-0 hips) (new 'process 'joint-mod (joint-mod-mode rotate) self 26))
@ -582,8 +582,8 @@
;; definition for function target-gun-type-set!
;; WARN: Return type mismatch int vs none.
(defbehavior target-gun-type-set! target ((arg0 int))
(if (zero? arg0)
(defbehavior target-gun-type-set! target ((arg0 pickup-type))
(if (= arg0 (pickup-type none))
(set! arg0 (-> self game gun-type))
)
(when (not (logtest? (the-as game-feature (ash 1 (+ arg0 5)))
@ -596,7 +596,7 @@
(-> self game features)
)
)
(set! arg0 1)
(set! arg0 (pickup-type eco-yellow))
(goto cfg-39)
)
(when (and (logtest? (-> self game features) (game-feature gun))
@ -605,7 +605,7 @@
(-> self game features)
)
)
(set! arg0 2)
(set! arg0 (pickup-type eco-red))
(goto cfg-39)
)
(when (and (logtest? (-> self game features) (game-feature gun))
@ -614,7 +614,7 @@
(-> self game features)
)
)
(set! arg0 3)
(set! arg0 (pickup-type eco-blue))
(goto cfg-39)
)
(when (and (logtest? (-> self game features) (game-feature gun))
@ -623,14 +623,14 @@
(-> self game features)
)
)
(set! arg0 4)
(set! arg0 (pickup-type eco-dark))
(goto cfg-39)
)
(set! arg0 0)
(set! arg0 (pickup-type none))
(label cfg-39)
(cond
((zero? arg0)
(set! arg0 arg0)
((zero? (the-as int arg0))
(set! arg0 (the-as pickup-type arg0))
(goto cfg-190)
)
(else
@ -638,7 +638,7 @@
)
)
)
(set! (-> self game gun-type) arg0)
(set! (-> self game gun-type) (the-as pickup-type arg0))
(set! (-> self gun track-turnv-range) 81920.0)
(set! (-> self gun track-tilt-range) 0.0)
(set! (-> self gun track-turn-range) 0.0)
@ -657,7 +657,7 @@
(let ((s5-0 (-> self gun gun-type)))
(set! (-> self gun gun-type) (the-as pickup-type arg0))
(set! (-> self gun using-gun-type) (the-as pickup-type arg0))
(case arg0
(case (the-as int arg0)
((3)
(set! (-> self gun gun-control) (the-as uint 4))
(set! (-> self gun fire-range) 327680.0)
@ -722,7 +722,7 @@
(set! (-> self skel top-anim frame-post-blend) 0.1333333)
(cond
((focus-test? self pilot-riding)
(let ((v1-164 arg0))
(let ((v1-164 (the-as int arg0)))
(cond
((and (= s5-0 (pickup-type eco-red)) (= v1-164 4))
(push-anim-to-targ
@ -872,7 +872,7 @@
)
)
(else
(let ((v1-227 arg0))
(let ((v1-227 (the-as int arg0)))
(cond
((and (= s5-0 (pickup-type eco-red)) (= v1-227 4))
(if (rand-vu-percent? 0.5)
@ -1556,7 +1556,7 @@
)
(when gp-0
(if (not (using-gun? self))
(send-event self 'change-mode 'gun #f 0)
(send-event self 'change-mode 'gun #f (pickup-type none))
)
(combo-tracker-method-12
(-> self gun attack-combo)

View file

@ -1036,7 +1036,7 @@
(('gun-type)
(cond
((-> arg3 param 0)
(target-gun-type-set! (the-as int (-> arg3 param 0)))
(target-gun-type-set! (the-as pickup-type (-> arg3 param 0)))
)
(else
(set! v0-0 #t)
@ -1237,7 +1237,7 @@
)
((= v1-45 'gun)
(if (logtest? (-> self game features) (game-feature gun))
(target-gun-init (the-as int (-> arg3 param 2)))
(target-gun-init (the-as pickup-type (-> arg3 param 2)))
)
)
((= v1-45 'tube)

View file

@ -328,7 +328,7 @@
)
((want-to-gun? self #t)
(if (logtest? (-> self game features) (game-feature gun))
(target-gun-init (the-as int (-> block param 2)))
(target-gun-init (the-as pickup-type (-> block param 2)))
)
)
)

View file

@ -410,6 +410,7 @@
)
;; definition for method 2 of type process
;; INFO: this function exists in multiple non-identical object files
(defmethod print process ((this process))
(cond
((and (-> this top-thread) (!= (-> this status) 'dead))
@ -953,28 +954,22 @@
(define *global-search-count* 0)
;; definition for function process-by-name
;; WARN: Return type mismatch process-tree vs process.
(defun process-by-name ((arg0 string) (arg1 process-tree))
(set! *global-search-name* arg0)
(the-as process (search-process-tree
(search-process-tree
arg1
(lambda ((arg0 process)) (string= (-> arg0 name) (the-as string *global-search-name*)))
)
)
)
;; definition for function process-not-name
;; WARN: Return type mismatch process-tree vs process.
(defun process-not-name ((arg0 string) (arg1 process-tree))
(set! *global-search-name* arg0)
(the-as
process
(search-process-tree
arg1
(lambda ((arg0 process)) (not (string= (-> arg0 name) (the-as string *global-search-name*))))
)
)
)
;; definition for function process-count
(defun process-count ((arg0 process-tree))
@ -998,7 +993,7 @@
;; definition for function kill-by-type
(defun kill-by-type ((arg0 type) (arg1 process-tree))
(local-vars (a0-1 process-tree))
(local-vars (a0-1 process))
(set! *global-search-name* arg0)
(while (begin
(set! a0-1 (search-process-tree arg1 (lambda ((arg0 process)) (= (-> arg0 type) *global-search-name*))))
@ -1020,7 +1015,7 @@
;; definition for function kill-not-type
(defun kill-not-type ((arg0 type) (arg1 process-tree))
(local-vars (a0-1 process-tree))
(local-vars (a0-1 process))
(set! *global-search-name* arg0)
(while (begin
(set! a0-1 (search-process-tree arg1 (lambda ((arg0 process)) (!= (-> arg0 type) *global-search-name*))))
@ -1085,10 +1080,11 @@
)
;; definition for function search-process-tree
;; WARN: Return type mismatch process-tree vs process.
(defun search-process-tree ((arg0 process-tree) (arg1 (function process-tree object)))
(when (not (logtest? (-> arg0 mask) (process-mask process-tree)))
(if (arg1 arg0)
(return arg0)
(return (the-as process arg0))
)
)
(let ((v1-5 (-> arg0 child)))
@ -1103,7 +1099,7 @@
)
)
)
(the-as process-tree #f)
(the-as process #f)
)
;; definition for function kernel-dispatcher

View file

@ -5,18 +5,7 @@
(define *pilot-mods* (new 'static 'surface :name 'empty :seek0 1.0 :seek90 1.0 :seek180 1.0 :fric 1.0))
;; definition for function target-pilot-handler
;; WARN: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 59]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 64]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 82]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 130]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 150]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 182]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 96]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 114]
;; WARN: disable def twice: 124. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 47]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 9]
(defbehavior target-pilot-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(cond
((and (= arg2 'query) (= (-> arg3 param 0) 'mode))
@ -55,7 +44,7 @@
)
(('gun)
(if (logtest? (-> self game features) (game-feature gun))
(target-gun-init (the-as int (-> arg3 param 2)))
(target-gun-init (the-as pickup-type (-> arg3 param 2)))
)
)
)

View file

@ -858,7 +858,7 @@
(let ((gp-32 (-> self mask)))
(logior! (-> self mask) (process-mask no-kill))
(play-task (game-task strip-rescue) 'debug #f)
(set! (-> *game-info* gun-type) 1)
(set! (-> *game-info* gun-type) (pickup-type eco-yellow))
(logior! (-> *game-info* debug-features) (game-feature board))
(logior! (-> *game-info* features) (game-feature board))
(send-event (ppointer->process *time-of-day*) 'change 'hour 8)

View file

@ -1213,8 +1213,8 @@ This commonly includes things such as:
(set! (-> self training?) #t)
)
(set-setting! 'features 'clear 0.0 (game-feature gun-red gun-blue gun-dark))
(if (!= (-> *game-info* gun-type) 1)
(send-event *target* 'change-mode 'gun #f 1)
(if (!= (-> *game-info* gun-type) (pickup-type eco-yellow))
(send-event *target* 'change-mode 'gun #f (pickup-type eco-yellow))
)
)
((= (-> self course) *red-training-path-global-info*)
@ -1229,8 +1229,8 @@ This commonly includes things such as:
(set! (-> self training?) #t)
)
(set-setting! 'features 'clear 0.0 (game-feature gun-yellow gun-blue gun-dark))
(if (!= (-> *game-info* gun-type) 2)
(send-event *target* 'change-mode 'gun #f 2)
(if (!= (-> *game-info* gun-type) (pickup-type eco-red))
(send-event *target* 'change-mode 'gun #f (pickup-type eco-red))
)
)
((= (-> self course) *blue-training-path-global-info*)
@ -1240,8 +1240,8 @@ This commonly includes things such as:
(set! (-> self task-bronze) (the-as uint 100))
(set! (-> *game-info* goal) 4000.0)
(set-setting! 'features 'clear 0.0 (game-feature gun-yellow gun-red gun-dark))
(if (!= (-> *game-info* gun-type) 3)
(send-event *target* 'change-mode 'gun #f 3)
(if (!= (-> *game-info* gun-type) (pickup-type eco-blue))
(send-event *target* 'change-mode 'gun #f (pickup-type eco-blue))
)
)
((= (-> self course) *peace-training-path-global-info*)

View file

@ -778,7 +778,7 @@ This commonly includes things such as:
;; definition of type tomb-simon-block
(deftype tomb-simon-block (base-plat)
((sound-show uint128 :offset-assert 272)
((sound-show sound-name :offset-assert 272)
(color vector :inline :offset-assert 288)
(my-idx int32 :offset-assert 304)
(next-idx int32 :offset-assert 308)
@ -1207,10 +1207,10 @@ This commonly includes things such as:
(when (!= (-> self basetrans y) (-> self base-height))
(seek! (-> self basetrans y) (-> self base-height) (* (-> self move-rate) (seconds-per-frame)))
(when (and (< (- (-> self base-height) (-> self basetrans y)) 21504.0)
(not (logtest? (-> self flags) (simon-block-flags sbf5)))
(not (logtest? (-> self flags) (simon-block-flags up-sound-played)))
)
(sound-play "simon-up")
(logior! (-> self flags) (simon-block-flags sbf5))
(logior! (-> self flags) (simon-block-flags up-sound-played))
)
(if (< (- (-> self base-height) (-> self basetrans y)) 81920.0)
(seek! (-> self move-rate) 0.0 (* 81920.0 (seconds-per-frame)))
@ -1227,22 +1227,22 @@ This commonly includes things such as:
;; definition for function tomb-simon-block-trans
;; INFO: Used lq/sq
(defbehavior tomb-simon-block-trans tomb-simon-block ()
(when (logtest? (-> self flags) (simon-block-flags sbf0))
(when (logtest? (-> self flags) (simon-block-flags blink))
(when (>= (current-time) (-> self blink-timer 1))
(cond
((logtest? (-> self flags) (simon-block-flags sbf1))
((logtest? (-> self flags) (simon-block-flags blink-on))
(set! (-> self draw color-mult quad) (-> self color quad))
)
(else
(sound-play-by-name (the-as sound-name (-> self sound-show)) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
(sound-play-by-name (-> self sound-show) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
(set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0)
)
)
(logxor! (-> self flags) (simon-block-flags sbf1))
(logxor! (-> self flags) (simon-block-flags blink-on))
(set! (-> self blink-timer 1) (+ (current-time) (seconds 0.2)))
)
(when (time-elapsed? (-> self blink-timer 0) (seconds 1.2))
(logclear! (-> self flags) (simon-block-flags sbf0))
(logclear! (-> self flags) (simon-block-flags blink))
(set! (-> self draw color-mult quad) (-> self color quad))
)
)
@ -1292,7 +1292,7 @@ This commonly includes things such as:
)
:enter (behavior ()
(set-time! (-> self state-time))
(logclear! (-> self flags) (simon-block-flags sbf0 sbf1 sbf2 sbf5))
(logclear! (-> self flags) (simon-block-flags blink blink-on ridden up-sound-played))
(set! (-> self move-rate) 122880.0)
)
:trans tomb-simon-block-trans
@ -1321,7 +1321,7 @@ This commonly includes things such as:
)
(('touch 'ridden 'bonk 'edge-grabbed)
(set-time! (-> self ride-timer))
(when (logtest? (-> self flags) (simon-block-flags sbf4))
(when (logtest? (-> self flags) (simon-block-flags dangerous))
(let* ((gp-0 *target*)
(a0-10 (if (type? gp-0 process-focusable)
gp-0
@ -1346,7 +1346,7 @@ This commonly includes things such as:
)
)
)
(let ((v0-0 (the-as object (logclear (-> self flags) (simon-block-flags sbf4)))))
(let ((v0-0 (the-as object (logclear (-> self flags) (simon-block-flags dangerous)))))
(set! (-> self flags) (the-as simon-block-flags v0-0))
v0-0
)
@ -1356,7 +1356,7 @@ This commonly includes things such as:
)
:enter (behavior ()
(set-time! (-> self state-time))
(logior! (-> self flags) (simon-block-flags sbf4))
(logior! (-> self flags) (simon-block-flags dangerous))
(set-time! (-> self ride-timer))
(send-event (ppointer->process (-> self parent)) 'die-but (-> self my-idx))
)
@ -1482,8 +1482,8 @@ This commonly includes things such as:
(go-virtual die)
)
(('ridden)
(when (not (logtest? (-> self flags) (simon-block-flags sbf2)))
(logior! (-> self flags) (simon-block-flags sbf2))
(when (not (logtest? (-> self flags) (simon-block-flags ridden)))
(logior! (-> self flags) (simon-block-flags ridden))
(let ((v0-0 (the-as object (current-time))))
(set! (-> self ride-timer) (the-as time-frame v0-0))
v0-0
@ -1493,11 +1493,11 @@ This commonly includes things such as:
)
)
:enter (behavior ()
(logclear! (-> self flags) (simon-block-flags sbf0 sbf1 sbf2))
(logclear! (-> self flags) (simon-block-flags blink blink-on ridden))
(set! (-> self draw color-mult quad) (-> self color quad))
)
:trans (behavior ()
(if (and (logtest? (-> self flags) (simon-block-flags sbf2)) (time-elapsed? (-> self ride-timer) (seconds 0.5)))
(if (and (logtest? (-> self flags) (simon-block-flags ridden)) (time-elapsed? (-> self ride-timer) (seconds 0.5)))
(go-virtual wobble-die)
)
(plat-trans)
@ -1560,7 +1560,7 @@ This commonly includes things such as:
;; definition for method 41 of type tomb-simon-block
;; WARN: Return type mismatch time-frame vs none.
(defmethod set-blink-timers! tomb-simon-block ((this tomb-simon-block))
(logior! (-> this flags) (simon-block-flags sbf0 sbf1))
(logior! (-> this flags) (simon-block-flags blink blink-on))
(set-time! (-> this blink-timer 0))
(set-time! (-> this blink-timer 1))
(none)