[jak3] implement pckernel (#3472)

Most debug features do not work, but that's fine.
pull/3473/head
ManDude 2024-04-15 19:26:48 +01:00 committed by GitHub
parent 20b76e318d
commit e601a3dcb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 2643 additions and 248 deletions

View File

@ -37208,7 +37208,7 @@
:size-assert #x1d
:flag-assert #x90000001d
(:methods
(new (symbol type string int (function object object)) _type_) ;; 0
(new (symbol type string object (function object object)) _type_) ;; 0
)
)
@ -37230,7 +37230,7 @@
:size-assert #x20
:flag-assert #x900000020
(:methods
(new (symbol type string int (function object debug-menu-msg object)) _type_) ;; 0
(new (symbol type string object (function object debug-menu-msg object)) _type_) ;; 0
)
)
@ -38950,7 +38950,6 @@
;; part-tester ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype part-tester (process)
((root trsqv :offset-assert 128) ;; guessed by decompiler
(part sparticle-launch-control :offset-assert 132) ;; guessed by decompiler
@ -38963,12 +38962,13 @@
part-tester-idle ;; associated process guessed by decompiler, old: (state part-tester)
)
)
|#
;; (define-extern *part-tester-name* object) ;; string
;; (define-extern part-tester-init-by-other function) ;; (function vector none :behavior process-drawable)
;; (define-extern *debug-part-dead-pool* object) ;; dead-pool
;; (define-extern start-part function) ;; (function none)
(define-extern *part-tester-name* string)
(define-extern part-tester-init-by-other (function vector none :behavior process-drawable))
(define-extern *debug-part-dead-pool* dead-pool)
(define-extern start-part (function none))
(define-extern *part-tester* (pointer part-tester))
(define-extern part-tester-idle (state part-tester))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; manipulator ;;

View File

@ -957,5 +957,9 @@
["L13", "vector"],
["L12", "vector"],
["L11", "vector"]
],
"part-tester": [
["L49", "uint64", true],
["L44", "uint64", true]
]
}

View File

@ -6619,5 +6619,6 @@
"(method 62 v-fox)": [[[4, 48], "s5", "collide-shape-prim-group"]],
"(method 62 v-rhino)": [[[4, 41], "s5", "collide-shape-prim-group"]],
"(method 62 v-mirage)": [[[4, 48], "s5", "collide-shape-prim-group"]],
"(method 62 v-x-ride)": [[[4, 48], "s5", "collide-shape-prim-group"]]
"(method 62 v-x-ride)": [[[4, 48], "s5", "collide-shape-prim-group"]],
"(code part-tester-idle)": [[[6, 22], "s5", "process-drawable"]]
}

View File

@ -128,6 +128,7 @@ set(RUNTIME_SOURCE
kernel/jak3/klink.cpp
kernel/jak3/klisten.cpp
kernel/jak3/kmachine.cpp
kernel/jak3/kmachine_extras.cpp
kernel/jak3/kmalloc.cpp
kernel/jak3/kmemcard.cpp
kernel/jak3/kprint.cpp

View File

@ -21,6 +21,7 @@
#include "game/kernel/jak3/kboot.h"
#include "game/kernel/jak3/kdgo.h"
#include "game/kernel/jak3/klisten.h"
#include "game/kernel/jak3/kmachine_extras.h"
#include "game/kernel/jak3/kmalloc.h"
#include "game/kernel/jak3/kscheme.h"
#include "game/kernel/jak3/ksound.h"
@ -351,38 +352,6 @@ void PutDisplayEnv(u32 alp) {
void aybabtu() {}
void pc_set_levels(u32 lev_list) {
if (!Gfx::GetCurrentRenderer()) {
return;
}
std::vector<std::string> levels;
for (int i = 0; i < LEVEL_MAX; i++) {
u32 lev = *Ptr<u32>(lev_list + i * 4);
std::string ls = Ptr<String>(lev).c()->data();
if (ls != "none" && ls != "#f" && ls != "") {
levels.push_back(ls);
}
}
Gfx::GetCurrentRenderer()->set_levels(levels);
}
void pc_set_active_levels(u32 lev_list) {
if (!Gfx::GetCurrentRenderer()) {
return;
}
std::vector<std::string> levels;
for (int i = 0; i < LEVEL_MAX; i++) {
u32 lev = *Ptr<u32>(lev_list + i * 4);
std::string ls = Ptr<String>(lev).c()->data();
if (ls != "none" && ls != "#f" && ls != "") {
levels.push_back(ls);
}
}
Gfx::GetCurrentRenderer()->set_active_levels(levels);
}
//// PC Stuff
void InitMachine_PCPort() {
// PC Port added functions
@ -396,11 +365,12 @@ void InitMachine_PCPort() {
},
make_string_from_c);
make_function_symbol_from_c("__pc-set-levels", (void*)pc_set_levels);
make_function_symbol_from_c("__pc-set-active-levels", (void*)pc_set_active_levels);
make_function_symbol_from_c("__pc-set-levels", (void*)kmachine_extras::pc_set_levels);
make_function_symbol_from_c("__pc-set-active-levels",
(void*)kmachine_extras::pc_set_active_levels);
make_function_symbol_from_c("__pc-get-tex-remap", (void*)lookup_jak3_texture_dest_offset);
// make_function_symbol_from_c("pc-init-autosplitter-struct", (void*)init_autosplit_struct);
// make_function_symbol_from_c("pc-encode-utf8-string", (void*)encode_utf8_string);
make_function_symbol_from_c("pc-encode-utf8-string", (void*)kmachine_extras::encode_utf8_string);
// discord rich presence
// make_function_symbol_from_c("pc-discord-rpc-update", (void*)update_discord_rpc);

View File

@ -0,0 +1,65 @@
#include "kmachine_extras.h"
#include <bitset>
#include <regex>
#include "kscheme.h"
#include "common/symbols.h"
#include "common/util/FontUtils.h"
#include "game/kernel/common/Symbol4.h"
#include "game/kernel/common/kmachine.h"
#include "game/kernel/common/kscheme.h"
namespace kmachine_extras {
using namespace jak3;
void pc_set_levels(u32 lev_list) {
if (!Gfx::GetCurrentRenderer()) {
return;
}
std::vector<std::string> levels;
for (int i = 0; i < LEVEL_MAX; i++) {
u32 lev = *Ptr<u32>(lev_list + i * 4);
std::string ls = Ptr<String>(lev).c()->data();
if (ls != "none" && ls != "#f" && ls != "") {
levels.push_back(ls);
}
}
Gfx::GetCurrentRenderer()->set_levels(levels);
}
void pc_set_active_levels(u32 lev_list) {
if (!Gfx::GetCurrentRenderer()) {
return;
}
std::vector<std::string> levels;
for (int i = 0; i < LEVEL_MAX; i++) {
u32 lev = *Ptr<u32>(lev_list + i * 4);
std::string ls = Ptr<String>(lev).c()->data();
if (ls != "none" && ls != "#f" && ls != "") {
levels.push_back(ls);
}
}
Gfx::GetCurrentRenderer()->set_active_levels(levels);
}
inline u64 bool_to_symbol(const bool val) {
return val ? static_cast<u64>(s7.offset) + true_symbol_offset(g_game_version) : s7.offset;
}
inline bool symbol_to_bool(const u32 symptr) {
return symptr != s7.offset;
}
// TODO - move to common
void encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr) {
auto str = std::string(Ptr<String>(src_str_ptr).c()->data());
std::string converted = get_font_bank(GameTextVersion::JAK3)->convert_utf8_to_game(str);
strcpy(Ptr<String>(str_dest_ptr).c()->data(), converted.c_str());
}
} // namespace kmachine_extras

View File

@ -0,0 +1,16 @@
#pragma once
#include <optional>
#include <string>
#include "common/common_types.h"
#include "common/util/json_util.h"
namespace kmachine_extras {
void pc_set_levels(u32 lev_list);
void pc_set_active_levels(u32 lev_list);
u32 alloc_vagdir_names(u32 heap_sym);
inline u64 bool_to_symbol(const bool val);
// TODO - move to common
void encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr);
} // namespace kmachine_extras

View File

@ -1,6 +1,7 @@
#include "ksound.h"
#include "game/kernel/common/kdgo.h"
#include "game/kernel/common/ksound.h"
#include "game/kernel/jak3/kscheme.h"
namespace jak3 {
@ -11,5 +12,9 @@ void InitSoundScheme() {
make_function_symbol_from_c("rpc-busy?", (void*)RpcBusy);
make_function_symbol_from_c("test-load-dgo-c", (void*)LoadDGOTest);
make_stack_arg_function_symbol_from_c("rpc-call", (void*)RpcCall_wrapper);
// PC port interns
make_function_symbol_from_c("pc-sound-set-flava-hack", (void*)set_flava_hack);
make_function_symbol_from_c("pc-sound-set-fade-hack", (void*)set_fade_hack);
}
} // namespace jak3

View File

@ -29,17 +29,19 @@
(remain (the float ,remain))
(bar-width (the int (/ (the float MEM_BAR_WIDTH) (-> *pc-settings* aspect-ratio-scale))))
(bar-x (- MEM_BAR_RIGHT bar-width MEM_BAR_HORZ_PAD)) ;; x coord for left side of the bar list
(used-p (if (zero? total) 0.5 (/ (- total remain) total)))
(used-p (if (zero? total) 0.0 (/ (- total remain) total)))
(used-x (the int (* used-p bar-width)))
(used-y (+ MEM_BAR_Y (* ,idx MEM_BAR_HEIGHT)))
)
(draw-sprite2d-xy ,buf bar-x used-y used-x MEM_BAR_HEIGHT ,color)
(draw-sprite2d-xy ,buf (+ bar-x used-x) used-y (- bar-width used-x) MEM_BAR_HEIGHT MEM_BAR_BG_COL)
(if (zero? total) (set! used-x (the int (* 0.5 bar-width))))
(draw-string-xy ,name ,buf (- bar-x MEM_BAR_HORZ_PAD) used-y (font-color red) (font-flags shadow kerning right))
(draw-string-xy (if (zero? total) "NO HEAP" (string-format "~,,2f%" (* used-p 100))) ,buf (+ bar-x used-x) used-y (font-color default) (font-flags shadow kerning middle))
(draw-string-xy (string-format "~,,1fM" (/ total (* 1024 1024))) ,buf (+ bar-x bar-width MEM_BAR_HORZ_PAD) used-y (font-color red) (font-flags shadow kerning middle-vert))
)
)
(defmacro draw-memory-bar-kheap (buf heap &key (name #f) &key idx &key color)
"draw a memory usage bar for a kheap"
`(let ((heap ,heap))

View File

@ -387,7 +387,7 @@
"return the debug font scale factor to be used."
(declare (inline))
(if (-> this debug-font-scale-auto?)
(/ (-> this debug-font-scale) (max 1.0 (/ (the float (get-current-game-height this)) PC_BASE_HEIGHT)))
(/ (-> this debug-font-scale) (fmax 1.0 (/ (the float (get-current-game-height this)) PC_BASE_HEIGHT)))
(-> this debug-font-scale)))

View File

@ -456,6 +456,7 @@
(cat-string<-string_to_charp arg0 arg1 s4-0)
)
)
(defmacro is-whitespace-char? (c)
;; 32 = space
;; 9 = \t

View File

@ -69,7 +69,7 @@
(icelandic 17)
(russian 18)
(polish 19)
(lithuanian 19)
(lithuanian 20)
(custom 999) ;; temp
)

View File

@ -30,6 +30,9 @@
"dma-buffer.o"
"dma-bucket.o"
"dma-disasm.o"
"pckernel-h.o" ;; added
"pckernel-impl.o" ;; added
"pc-debug-common.o" ;; added
"pad.o"
"gs.o"
"display-h.o"
@ -246,6 +249,7 @@
"sky-data.o"
"sky-tng.o"
"load-state.o"
"pc-debug-methods.o" ;; added
"level-info.o"
"level.o"
"text.o"
@ -344,6 +348,8 @@
"prototype.o"
"main-collide.o"
"video.o"
"pckernel-common.o" ;; added
"pckernel.o" ;; added
"main.o"
"collide-cache.o"
"collide-debug.o"
@ -402,6 +408,7 @@
"visvol-edit.o"
"collision-editor.o"
"speech-manager.o"
"default-menu-pc.o" ;; added
"dir-tpages.go"
"tpage-1.go"
"tpage-2.go"

View File

@ -144,18 +144,18 @@
(hilite-timer int8)
)
(:methods
(new (symbol type string int (function object object)) _type_)
(new (symbol type string object (function object object)) _type_)
)
)
(defmethod new debug-menu-item-function ((allocation symbol) (type-to-make type) (arg0 string) (arg1 int) (arg2 (function object object)))
(defmethod new debug-menu-item-function ((allocation symbol) (type-to-make type) (arg0 string) (arg1 object) (arg2 (function object object)))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> v0-0 name) arg0)
(set! (-> v0-0 parent) #f)
(set! (-> v0-0 refresh-delay) 0)
(set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay))
(set! (-> v0-0 id) arg1)
(set! (-> v0-0 id) (the-as int arg1))
(set! (-> v0-0 activate-func) arg2)
(set! (-> v0-0 hilite-timer) 0)
v0-0
@ -167,7 +167,7 @@
(is-on symbol)
)
(:methods
(new (symbol type string int (function object debug-menu-msg object)) _type_)
(new (symbol type string object (function object debug-menu-msg object)) _type_)
)
)
@ -175,7 +175,7 @@
(defmethod new debug-menu-item-flag ((allocation symbol)
(type-to-make type)
(arg0 string)
(arg1 int)
(arg1 object)
(arg2 (function object debug-menu-msg object))
)
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
@ -183,7 +183,7 @@
(set! (-> v0-0 parent) #f)
(set! (-> v0-0 refresh-delay) 23)
(set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay))
(set! (-> v0-0 id) arg1)
(set! (-> v0-0 id) (the-as int arg1))
(set! (-> v0-0 activate-func) arg2)
(set! (-> v0-0 is-on) #f)
v0-0
@ -585,7 +585,7 @@
'debug
'debug-menu-item-flag
(the-as string s4-1)
(the-as int (car (cdr (cdr arg1))))
(car (cdr (cdr arg1)))
(the-as (function object debug-menu-msg object) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
)
)
@ -594,7 +594,7 @@
'debug
'debug-menu-item-function
(the-as string s4-1)
(the-as int (car (cdr (cdr arg1))))
(car (cdr (cdr arg1)))
(the-as (function object object) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
)
)

View File

@ -5,5 +5,178 @@
;; name in dgo: part-tester
;; dgos: GAME
(#when PC_PORT
(define *part-tester-id* 127)
)
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(defpartgroup group-part-tester
:id 198
:flags (sp0 sp4)
:bounds (static-bspherem 0 0 0 20)
:parts ((sp-item 249))
)
(defpartgroup group-debug-placeholder-small
:id 199
:flags (sp0 sp4)
:bounds (static-bspherem 0 0 0 20)
:parts ((sp-item 822 :flags (sp7)))
)
(defpart 822
:init-specs ((:texture (middot level-default-sprite))
(:num 1.0)
(:scale-x (meters 0.2))
(:scale-y :copy scale-x)
(:r 128.0)
(:g 0.0)
(:b 0.0)
(:a 128.0)
(:timer (seconds 0.017))
(:flags ())
)
)
(defpartgroup group-debug-placeholder-single
:id 200
:flags (sp0 sp4)
:bounds (static-bspherem 0 0 0 20)
:parts ((sp-item 823 :flags (sp7)))
)
(defpart 823
:init-specs ((:texture (middot level-default-sprite))
(:num 1.0)
(:scale-x (meters 5))
(:scale-y :copy scale-x)
(:r 128.0)
(:g 0.0)
(:b 0.0)
(:a 128.0)
(:timer (seconds 0.017))
(:flags ())
)
)
(defpartgroup group-debug-placeholder-multiple
:id 201
:flags (sp0 sp4)
:bounds (static-bspherem 0 0 0 20)
:parts ((sp-item 824 :flags (sp7)))
)
(defpart 824
:init-specs ((:texture (middot level-default-sprite))
(:num 1.0)
(:scale-x (meters 0.3))
(:scale-y :copy scale-x)
(:r 128.0)
(:g 128.0)
(:b 128.0)
(:a 128.0)
(:vel-y (meters 0.01))
(:timer (seconds 2))
(:flags ())
(:conerot-x (degrees -45) (degrees 90))
(:rotate-y (degrees 0) (degrees 3600))
)
)
(deftype part-tester (process)
((root trsqv)
(part sparticle-launch-control)
(old-group sparticle-launch-group)
)
(:states
part-tester-idle
)
)
(define *part-tester-name* (the-as string #f))
(defmethod deactivate ((this part-tester))
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
(if (nonzero? (-> this part))
(kill-particles (-> this part))
)
((method-of-type process deactivate) this)
(none)
)
(defstate part-tester-idle (part-tester)
:code (behavior ()
(until #f
(let ((gp-0 (entity-by-name *part-tester-name*)))
(when gp-0
(let ((s5-0 (the-as process-drawable (-> gp-0 extra process))))
(if (and s5-0 (type? s5-0 process-drawable) (nonzero? (-> s5-0 root)))
(set! (-> self root trans quad) (-> s5-0 root trans quad))
(set! (-> self root trans quad) (-> gp-0 extra trans quad))
)
)
)
)
(add-debug-x
#t
(bucket-id debug-no-zbuf1)
(-> self root trans)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
(let ((gp-1 (-> *part-group-id-table* 198)))
(let ((s5-1 (-> self root trans)))
(when (!= gp-1 (-> self old-group))
(when (nonzero? (-> self part))
(kill-particles (-> self part))
(set! (-> self heap-cur) (&-> (-> self part) type))
)
(set! (-> self part) (create-launch-control gp-1 self))
)
(if (nonzero? (-> self part))
(spawn (-> self part) (cond
((logtest? (-> gp-1 flags) (sp-group-flag sp2))
*zero-vector*
)
(else
(empty)
s5-1
)
)
)
)
)
(set! (-> self old-group) gp-1)
)
(suspend)
)
#f
)
)
(define-extern *part-tester* (pointer part-tester))
;; WARN: Return type mismatch object vs none.
(defbehavior part-tester-init-by-other process-drawable ((arg0 vector))
(+! (-> self clock ref-count) -1)
(+! (-> *display* part-clock ref-count) 1)
(set! (-> self clock) (-> *display* part-clock))
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg0 quad))
(set! *part-tester* (the-as (pointer part-tester) (process->ppointer self)))
(go part-tester-idle)
(none)
)
(define-perm *debug-part-dead-pool* dead-pool (new 'debug 'dead-pool 1 #x10000 "*debug-part-dead-pool*"))
;; WARN: Return type mismatch (pointer process) vs none.
(defun start-part ()
(kill-by-type part-tester *active-pool*)
(process-spawn part-tester (target-pos 0) :name "part-tester" :from *debug-part-dead-pool*)
(none)
)

View File

@ -1957,6 +1957,12 @@
(s1-7 *temp-string* s2-7 448 210 (font-color default) (font-flags shadow kerning))
)
)
(#when PC_PORT
(draw *pc-settings* s2-7)
(draw-memory *pc-settings* s2-7)
(print-debug-misc *pc-settings*)
)
(display-file-info)
)
)

View File

@ -1661,6 +1661,12 @@
(with-profiler 'actors *profile-actors-color*
(suspend)
)
;; run the pc port hooks and code
(#when PC_PORT
(update *pc-settings*)
(if (and *display-sha* *debug-segment*)
(draw-build-revision)))
)
)
(set! *dproc* #f)

View File

@ -5,6 +5,11 @@
;; name in dgo: level-h
;; dgos: GAME
;; max amount of levels in level heap
(defconstant LEVEL_MAX 10)
;; total amount of levels, including ones outside level heap (default-level)
(defconstant LEVEL_TOTAL 11)
(declare-type bsp-header basic)
(declare-type drawable basic)
(declare-type entity-links-array inline-array-class)

View File

@ -96,7 +96,7 @@
;; the case of a .o appearing in multiple dgos. But, if we depend on the last item in both lists, it
;; works out.
(define common-dep '("$OUT/obj/default-menu.o"))
(define common-dep '("$OUT/obj/default-menu-pc.o"))
;; wascity
(cgo-file "wwd.gd" common-dep) ;; waswide

View File

@ -184,7 +184,9 @@
(define-extern pc-waiting-for-bind? (function symbol))
(define-extern pc-set-waiting-for-bind! (function int symbol symbol int none))
(define-extern pc-stop-waiting-for-bind! (function none))
(define-extern pc-get-controller-index (function int int))
(define-extern pc-set-controller! (function int int none))
(define-extern pc-get-keyboard-enabled? (function symbol))
(define-extern pc-set-keyboard-enabled! (function symbol none))
(define-extern pc-set-mouse-options! (function symbol symbol symbol none))
(define-extern pc-set-mouse-camera-sens! (function float float none))
@ -197,16 +199,18 @@
;; Display Related Functions
(define-extern pc-get-display-mode (function symbol))
(define-extern pc-get-active-display-size (function (pointer int32) (pointer int32) none))
(define-extern pc-get-active-display-size (function (pointer int64) (pointer int64) none))
(define-extern pc-get-active-display-refresh-rate (function int))
(define-extern pc-get-display-count (function int))
(define-extern pc-get-display-name (function int string))
(define-extern pc-get-display-name (function int string symbol))
(define-extern pc-get-os (function symbol))
(define-extern pc-get-window-size (function (pointer int32) (pointer int32) none))
(define-extern pc-get-window-size (function (pointer int64) (pointer int64) none))
(define-extern pc-get-window-scale (function (pointer float) (pointer float) none))
(define-extern pc-set-window-size (function int int none))
(define-extern pc-set-fullscreen-display (function int none))
(define-extern pc-set-display-mode (function symbol none))
(define-extern pc-get-num-resolutions (function int))
(define-extern pc-get-resolution (function int (pointer int64) (pointer int64) none))
(define-extern pc-set-frame-rate (function int none))
(define-extern pc-set-vsync (function symbol none))

View File

@ -447,6 +447,22 @@
)
)
(defmacro is-whitespace-char? (c)
;; 32 = space
;; 9 = \t
;; 13 = \r
;; 10 = \n
`(or (= ,c 32)
(= ,c 9)
(= ,c 13)
(= ,c 10)
)
)
(defmacro not-whitespace-char? (c)
`(not (is-whitespace-char? ,c))
)
(defun string-skip-whitespace ((arg0 (pointer uint8)))
"Jump over whitespace chars."
(while (and (nonzero? (-> arg0 0)) (or (= (-> arg0 0) 32) (= (-> arg0 0) 9) (= (-> arg0 0) 13) (= (-> arg0 0) 10)))
@ -799,4 +815,24 @@
(define *temp-string* (new 'global 'string 2048 (the-as string #f)))
(#when PC_PORT (define *pc-encoded-temp-string* (new 'global 'string 2048 (the-as string #f))))
(kmemclose)
(defmacro string-format (&rest args)
"Formats into *temp-string* and returns it, for in-place string formating.
DO NOT USE *temp-string* WITH THIS MACRO! It is read as input AFTER all of the args evaluate."
`(begin
(format (clear *temp-string*) ,@args)
*temp-string*
)
)
(defmacro temp-string-format (buf &rest args)
"Like [[string-format]], but takes a string as an argument."
`(begin
(format (clear ,buf) ,@args)
,buf
)
)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,110 @@
;;-*-Lisp-*-
(in-package goal)
#|
Various debugging displays made for the pc port. This file includes overrides or game-specific implementations.
|#
;; debug-only file!
(declare-file (debug))
;; updated macro for jak 3, draw-sprite2d-xy also has z now
(defmacro draw-memory-bar-generic (buf &key remain &key total &key name &key idx &key color)
"draw a memory usage bar"
`(let* (
(total (the float ,total))
(remain (the float ,remain))
(bar-width (the int (/ (the float MEM_BAR_WIDTH) (-> *pc-settings* aspect-ratio-scale))))
(bar-x (- MEM_BAR_RIGHT bar-width MEM_BAR_HORZ_PAD)) ;; x coord for left side of the bar list
(used-p (if (zero? total) 0.0 (/ (- total remain) total)))
(used-x (the int (* used-p bar-width)))
(used-y (+ MEM_BAR_Y (* ,idx MEM_BAR_HEIGHT)))
)
(draw-sprite2d-xy ,buf bar-x used-y used-x MEM_BAR_HEIGHT ,color #x3fffff)
(draw-sprite2d-xy ,buf (+ bar-x used-x) used-y (- bar-width used-x) MEM_BAR_HEIGHT MEM_BAR_BG_COL #x3fffff)
(if (zero? total) (set! used-x (the int (* 0.5 bar-width))))
(draw-string-xy ,name ,buf (- bar-x MEM_BAR_HORZ_PAD) used-y (font-color red) (font-flags shadow kerning right))
(draw-string-xy (if (zero? total) "NO HEAP" (string-format "~,,2f%" (* used-p 100))) ,buf (+ bar-x used-x) used-y (font-color default) (font-flags shadow kerning middle))
(draw-string-xy (string-format "~,,1fM" (/ total (* 1024 1024))) ,buf (+ bar-x bar-width MEM_BAR_HORZ_PAD) used-y (font-color red) (font-flags shadow kerning middle-vert))
)
)
(defmethod print-debug-misc pc-settings-jak3 ((obj pc-settings-jak3))
"prints various miscellaneous debug text to the game console, according to what's enabled in this object."
#f
)
(defconstant MEM_BAR_HEIGHT (the int (* 14.0 (get-debug-font-scale-factor)))) ;; total height of the bar
(defconstant MEM_BAR_BOTTOM 416) ;; x coord for the bottom side of the bar list
(defconstant MEM_BAR_NUM (+ LEVEL_MAX 5)) ;; amount of memory usage bars (override later if wanted)
(defmethod draw-memory pc-settings-jak3 ((obj pc-settings-jak3) (buf dma-buffer))
"draw the memory heap status in the bottom right corner"
(when *display-heap-status*
(let ((idx 0)
(level-heap-colors (new 'static 'array rgba 3 (static-rgba 32 255 255 64)
(static-rgba 255 32 255 64)
(static-rgba 255 255 32 64)
)))
(draw-memory-bar-kheap buf global :idx idx :color (static-rgba 32 32 255 64))
(draw-memory-bar-kheap buf debug :idx (1+! idx) :color (static-rgba 255 32 32 64))
(dotimes (i LEVEL_MAX)
(draw-memory-bar-kheap buf (-> *level* level i heap)
:name (aif (-> *level* level i borrow-from-level)
(string-format "(~A)l~D<-l~D" (-> *level* level i name) i (-> it index))
(string-format "(~A)l~D" (-> *level* level i name) i))
:idx (1+! idx) :color (-> level-heap-colors (mod i 3)))
)
(draw-memory-bar-dead-pool-heap buf *nk-dead-pool* :name "actor" :idx (1+! idx) :color (static-rgba 32 255 32 64))
(draw-memory-bar-generic buf
:remain (* 16 (dma-buffer-free (-> *display* frames (-> *display* on-screen) global-buf)))
:total (length (-> *display* frames (-> *display* on-screen) global-buf))
:name "dma-global" :idx (1+! idx) :color (static-rgba 32 32 255 64))
(draw-memory-bar-generic buf
:remain (* 16 (dma-buffer-free (-> *display* frames (-> *display* on-screen) debug-buf)))
:total (length (-> *display* frames (-> *display* on-screen) debug-buf))
:name "dma-debug" :idx (1+! idx) :color (static-rgba 255 32 32 64))
)
#t)
)
(define *region-debug-inspect* (the drawable-region-prim #f))
(define *display-region-inside* #f)
(define *merge-region-prims* #f)
(define *display-city-info* #f)
(define *city-info-x* 0)
(define *city-info-y* 0)
(define *city-info-z* 0)
(define *debug-track-skill* #f)
(defun debug-track-skill ()
"draws a line and prints the distance to every skill in every active level"
(let ((start-pos (target-pos 0)))
(dotimes (i (-> *level* length))
(let ((lev (-> *level* level i)))
(when (= (-> lev status) 'active)
;; actor entities
(let ((actors (-> lev bsp actors)))
(when (nonzero? actors)
(dotimes (ii (-> actors length))
(let ((e (-> actors data ii actor)))
(when (and (= (-> e etype symbol) 'skill) (or (not (-> e extra)) (zero? (-> e extra)) (not (logtest? (-> e extra perm status) (entity-perm-status dead)))))
(add-debug-line #t (bucket-id debug-no-zbuf1) start-pos (-> e trans) (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1))
(format *stdcon* "~S at ~m ~m ~m (~m away)~%" (res-lump-struct e 'name string) (-> e trans x) (-> e trans y) (-> e trans z) (vector-vector-distance start-pos (-> e trans)))
)
)
)
)
)
)
)
)
)
#f)

View File

@ -0,0 +1,272 @@
;;-*-Lisp-*-
(in-package goal)
#|
This file has the game-specific implementation of the pckernel (see pckernel-h.gc and pckernel.gc).
|#
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; version: 0.3.0.0
(defconstant PC_KERNEL_VERSION (static-pckernel-version 0 3 0 0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; types and enums
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; cheats
(defenum pc-cheats
:bitfield #t
:type uint64
(turbo-board)
(health-bars)
(vehicle-health-bars)
(vehicle-invuln)
(statistics)
(suck-in-all)
(music-player)
(no-textures)
(fast-speed)
(slow-speed)
(fast-travel)
(orb-tracker)
(real-time-of-day)
(city-peace)
(board-tricks)
(weather-bad)
(weather-good)
)
;; pc enum for languages. this is the game's languages + custom ones.
(defenum pc-language
:type uint16
(english 0)
(french 1)
(german 2)
(spanish 3)
(italian 4)
(commentary 5)
(japanese 6)
(korean 7)
(russian 8)
(portuguese 9)
(dutch 10)
(uk-english 11)
;; custom
(finnish 12)
(swedish 13)
(danish 14)
(norwegian 15)
(br-portuguese 16)
(hungarian 17)
(catalan 18)
(icelandic 19)
(polish 20)
(lithuanian 21)
(custom 999) ;; temp
)
;; The Jak 2 version of the pc-settings object.
(deftype pc-settings-jak3 (pc-settings)
(;; cheats
(cheats pc-cheats)
(cheats-revealed pc-cheats)
(cheats-purchased pc-cheats)
(cheats-unlocked pc-cheats)
(cheats-mask pc-cheats)
;; music
(music-unlocked bit-array)
(flava-unlocked symbol 6)
;; misc
(fast-airlock? symbol)
(fast-elevator? symbol)
(fast-progress? symbol)
;(stats statistics)
;; gfx
(smooth-minimap? symbol)
(hires-clouds? symbol)
;; other
(controller-led-status? symbol)
(speedrunner-mode-custom-bind uint32)
)
(:methods
(eligible-for-fast-elevator? (_type_ process) symbol)
(get-airlock-speed (_type_) float)
(get-airlock-close-speed (_type_) float)
)
)
(define *pc-settings* (the pc-settings-jak3 #f))
;; jak 3 discord rpc structure
(deftype discord-info (structure)
((orb-count float)
(gem-count float)
(death-count int32)
(status string)
(level string)
(cutscene? symbol)
(time-of-day float)
(percent-complete float)
(focus-status uint32)
(task string) ;; currenly active game-task used for mission specific images
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; resets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod reset-misc ((obj pc-settings-jak3) (call-handlers symbol))
"Set the default misc settings"
((method-of-type pc-settings reset-misc) obj call-handlers)
(true! (-> obj fast-airlock?))
(true! (-> obj fast-elevator?))
(false! (-> obj fast-progress?))
(true! (-> obj smooth-minimap?))
(false! (-> obj hires-clouds?))
(set! (-> obj speedrunner-mode-custom-bind) 0)
0)
(defmethod reset-extra ((obj pc-settings-jak3) (call-handlers symbol))
"Set the default goodies settings"
((method-of-type pc-settings reset-extra) obj call-handlers)
(set! (-> obj cheats) (pc-cheats))
(set! (-> obj cheats-revealed) (pc-cheats))
(set! (-> obj cheats-purchased) (pc-cheats))
(set! (-> obj cheats-unlocked) (pc-cheats))
(set! (-> obj cheats-mask) (pc-cheats))
(clear-all! (-> obj music-unlocked))
(dotimes (i 6)
(set! (-> obj flava-unlocked i) #f))
;(set! (-> obj stats) *statistics*)
0)
(defmethod reset-input ((obj pc-settings-jak3) (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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define *hires-sky* #t)
(define *debug-region-color-alt* #t)
(define *debug-region-show-bsphere* #f)
(define *debug-region-hide-water* #t)
(define *debug-region-hide-empty* #t)
(define *fallback-text-lookup?* #t)
(defun pc-settings-save ()
(commit-to-file *pc-settings*)
)
(defun get-video-params () *video-params*)
;; for debugging
(defenum pc-pat-skip-hack
:bitfield #t
(noentity 0)
(nocamera 1)
(noedge 2)
(nogrind 3)
(nojak 4)
(noboard 5)
(nopilot 6)
(nolineofsight 16)
(unknowncamera 17)
(probe 24)
(nomech 25)
(noproj 26)
(noendlessfall 27)
(noprobe 28)
)
;; cheat stuff
(defenum pc-cheat-state-flag
:bitfield #t
:type uint8
(turbo-board) ;; should turbo board be used
(clear-time-mod)
)
(deftype pc-cheat-state (structure)
((progress-speed float)
(airlock-speed float)
(airlock-close-speed float)
(turbo-board-speed float)
(hijack-speech-chance float)
(flags pc-cheat-state-flag)
)
)
(define *pc-cheat-state* (new 'static 'pc-cheat-state
:progress-speed 1.5
:airlock-speed 1.75
:airlock-close-speed 1.75
:turbo-board-speed 1.5
:hijack-speech-chance 0.45
))
(defmacro cheat-state-flag? (&rest flags)
"are the specified flags enabled?"
`(logtest? (-> *pc-cheat-state* flags) (pc-cheat-state-flag ,@flags)))
(defmacro set-cheat-state-flag! (&rest flags)
"set the specified flags"
`(logior! (-> *pc-cheat-state* flags) (pc-cheat-state-flag ,@flags)))
(defmacro clear-cheat-state-flag! (&rest flags)
"clear the specified flags"
`(logclear! (-> *pc-cheat-state* flags) (pc-cheat-state-flag ,@flags)))
(defmacro give-cheat! (&rest cheats)
`(begin
(logior! (-> *pc-settings* cheats) (pc-cheats ,@cheats))
)
)
(defmacro lock-cheat! (&rest cheats)
`(begin
(logclear! (-> *pc-settings* cheats) (pc-cheats ,@cheats))
(logclear! (-> *pc-settings* cheats-purchased) (pc-cheats ,@cheats))
(logclear! (-> *pc-settings* cheats-unlocked) (pc-cheats ,@cheats))
(logclear! (-> *pc-settings* cheats-revealed) (pc-cheats ,@cheats))
)
)

View File

@ -0,0 +1,769 @@
;;-*-Lisp-*-
(in-package goal)
#|
This file runs the game-specific version of the pckernel.
See pckernel-common.gc for the bulk of the pckernel.
|#
(define-extern get-active-mission-description (function discord-info string))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; pc cheats list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftype pc-cheat-info (basic)
((name text-id)
(unlock text-id)
(unlock-func symbol) ;; function symbol
(skill int) ;; skill points required. leave as 0 if you only want a custom unlock func
(flag pc-cheats)
(can-toggle symbol) ;; how it can be toggled
;; only show after this point in the story
(avail-after game-task-node)
(avail-after-hero game-task-node)
)
)
;;;;; pc cheat unlock functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun pc-cheat-vehicle-health-bars-unlock ()
"#t = cheat unlock requirements met. #f = locked"
#f)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; pc cheat unlock functions end
(defmacro static-pc-cheat-info (name flag can-toggle avail-after &key (skill 0) &key (unlock (null true-func)))
"helper for making a new static pc-cheat-info
unlock is a pair in format (unlock-text-id unlock-func) where unlock-func returns #t if the unlock requirement is met and #f otherwise
skill is the skill requirement. until the requirement is met (and avail-after is closed), it will show 'X required' in the menu
avail-after can be a single task-node or a pair of two, car is for normal game and cadr for hero mode"
`(new 'static 'pc-cheat-info :name (text-id ,name)
:unlock (text-id ,(car unlock))
:unlock-func (quote ,(cadr unlock))
:skill ,skill
:flag (pc-cheats ,flag)
:avail-after (game-task-node ,(if (pair? avail-after) (car avail-after) avail-after))
:avail-after-hero (game-task-node ,(if (pair? avail-after) (cadr avail-after) avail-after))
:can-toggle (quote ,can-toggle))
)
(defmacro def-pc-cheat-list (name &rest items)
"helper for making a list of pc cheats. see static-pc-cheat-info for parameters"
`(define ,name (new 'static 'boxed-array :type pc-cheat-info ,@(apply (lambda (x) `(static-pc-cheat-info ,@x)) items)))
)
;; the list of cheats
(def-pc-cheat-list *pc-cheats-list*
;; name cheat flag can-toggle avail-after
;(progress-cheats-music-player music-player #f fortress-escape-introduction)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; music player list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defenum music-player-flava
:bitfield #t :type uint8
(default)
(gun)
(board)
(mech)
(darkjak)
(pilot)
)
(deftype music-player-track-info (basic)
((text text-id)
(name symbol)
(mode int8)
(icon int16)
(flava music-player-flava)
(avail-after game-task-node)
)
)
(defmacro static-music-track-info (name &key text &key avail-after &key (mode 0) &key icon &key (flava ()))
`(new 'static 'music-player-track-info :text (text-id ,text) :name ,name :icon ,icon :avail-after (game-task-node ,avail-after) :mode ,mode :flava (music-player-flava ,@flava))
)
(define *music-player-tracks* (new 'static 'boxed-array :type music-player-track-info
))
;; automatically add the default flava to all tracks that had flavas marked
(dotimes (i (-> *music-player-tracks* length))
(if (nonzero? (-> *music-player-tracks* i flava))
(logior! (-> *music-player-tracks* i flava) (music-player-flava default)))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; 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 ((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 ((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"
(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 ((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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod initialize ((obj pc-settings-jak3))
"initial initialize method to be run after allocating"
(set! (-> obj music-unlocked) (new 'global 'bit-array (-> *music-player-tracks* length)))
((method-of-type pc-settings initialize) obj)
obj)
(defmethod set-game-setting! ((obj pc-settings-jak3) (setting symbol) (value symbol))
(case setting
(('video-mode)
(set! (-> *setting-control* user-current video-mode) #f)
(set! (-> *setting-control* user-default video-mode) value)
)
(('aspect-ratio)
(set! (-> *setting-control* user-default aspect-ratio) value)
)
(else
(format #t "unknown setting ~A (~A) to set-game-setting!" setting value))
)
)
(defmethod get-game-setting ((obj pc-settings-jak3) (setting symbol))
(case setting
(('video-mode)
(-> *setting-control* user-default video-mode)
)
(('aspect-ratio)
(-> *setting-control* user-default aspect-ratio)
)
(else
(format #t "unknown setting ~A to get-game-setting" setting)
#f)
)
)
(defmethod set-game-language! ((obj pc-settings-jak3) (lang language-enum))
(set! (-> *setting-control* user-default language) lang)
)
(defmethod get-game-language ((obj pc-settings-jak3))
(get-current-language)
)
(defmethod update ((obj pc-settings-jak3))
"Set the default misc settings"
((method-of-type pc-settings update) obj)
(set! *hires-sky* (-> obj hires-clouds?))
(when (not (led-enabled? obj))
(disable *led-fader-state*)
)
(none))
(defun real-movie? ()
"are we in an actual cutscene and should letterbox the view?"
(and (!= #f *scene-player*) (nonzero? movie?) (movie?)))
(defmethod update-discord-rpc ((obj pc-settings-jak3))
"update discord rpc module"
(when #f
(let ((info (new 'stack 'discord-info)))
(set! (-> info orb-count) (-> *game-info* skill-total))
(set! (-> info gem-count) (-> *game-info* gem-total))
(set! (-> info death-count) (-> *game-info* total-deaths))
(set! (-> info task) "unknown")
(set! (-> info status) (get-active-mission-description info))
;; grab the name of the level we're in
(cond
;; ((or (aif (level-get *level* 'title) (= (-> it status) 'active))
;; (and *progress-process*
;; (= 'title (-> *progress-process* 0 state-stack 0))))
;; ;; in title screen.
;; (set! (-> info level) (symbol->string 'title))
;; (set! (-> info status) "In title screen"))
(else
(set! (-> info level) (aif (-> *load-state* vis-nick) (symbol->string it) "unknown")))
)
(set! (-> info cutscene?) (real-movie?))
(set! (-> info time-of-day) (-> *time-of-day-context* time))
(set! (-> info percent-complete) (calculate-percentage *game-info*))
(set! (-> info focus-status) (if *target* (-> *target* focus-status) 0))
;; TODO - update to new with-profiler syntax
(pc-discord-rpc-update info)
))
(none))
(defmethod update-speedrun ((obj pc-settings-jak3))
"update speedrun module"
;; TODO - update to new with-profiler syntax
;; (with-profiler "speedrun-update"
;(update! *speedrun-info*)
;;)
(none))
(defmethod update-video-hacks ((obj pc-settings-jak3))
"update the graphics hacks used for the progress menu. ugh."
(set! (-> (get-video-params) relative-x-scale) (-> obj aspect-ratio-reciprocal))
(set! (-> (get-video-params) relative-x-scale-reciprical) (-> obj aspect-ratio-scale))
)
(defmethod eligible-for-fast-elevator? ((obj pc-settings-jak3) (proc process))
"is this a valid process for a fast elevator?"
(and (-> obj fast-elevator?) (not (or (string= (-> proc name) "drill-lift-1")
(string= (-> proc name) "drill-lift-2"))))
)
(defmethod get-airlock-speed ((obj pc-settings-jak3))
"return the current speed modifier for airlocks"
(if (-> obj fast-airlock?)
(-> *pc-cheat-state* airlock-speed)
1.0))
(defmethod get-airlock-close-speed ((obj pc-settings-jak3))
"return the current closing speed modifier for airlocks"
(if (-> obj fast-airlock?)
(-> *pc-cheat-state* airlock-close-speed)
1.0))
(defmethod led-enabled? ((obj pc-settings-jak3))
"should the controller led be set?"
(or (-> obj controller-led-hp?)
(-> obj controller-led-status?)
))
(defmethod update-led ((obj pc-settings-jak3))
"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
;; 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))
(defun inside-city? ()
"are we inside haven city?"
(symbol-member? (-> *game-info* current-continue vis-nick) ;; TODO get actual level we're in?
'(ctysluma ctyslumb ctyslumc
ctygena ctygenb ctygenc
ctymarka ctymarkb
ctyfarma ctyfarmb
ctyinda ctyindb
ctypal ctyport stadium)))
(defmethod update-cheats ((obj pc-settings-jak3))
"run cheats."
;; run cheats here.
;;;;;;;;;;;;;;;;;;;
(when (pc-cheats? (-> obj cheats) real-time-of-day)
(let ((date (new 'stack-no-clear 'scf-time)))
(scf-get-time date)
(when (zero? (-> date stat))
(let* ((cur-time (-> *display* bg-clock frame-counter))
(day-len (seconds 1440)) ;; a full in-game day
(want-hour (bcd->dec (-> date hour)))
(want-minute (bcd->dec (-> date minute)))
(target-hour-frame (/ (the int (* (fsec 3600) want-hour)) 60))
(target-minute-frame (/ (the int (* (fsec 60) want-minute)) 60))
)
(set! (-> *display* bg-clock frame-counter) (+ (- cur-time (mod cur-time day-len)) day-len (+ target-hour-frame target-minute-frame)))
))
))
;; turbo jet board cheat
(cond
((and (pc-cheats? (-> obj cheats) turbo-board)
*target*
(focus-test? *target* board)
(inside-city?))
(set-setting! 'string-spline-max-move 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 2)) 0)
(set-setting! 'string-spline-accel 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 0.045)) 0)
(set-setting! 'string-spline-max-move-player 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 1.5)) 0)
(set-setting! 'string-spline-accel-player 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 0.035)) 0)
(set-cheat-state-flag! turbo-board)
)
(else
(remove-setting! 'string-spline-max-move)
(remove-setting! 'string-spline-accel)
(remove-setting! 'string-spline-max-move-player)
(remove-setting! 'string-spline-accel-player)
(clear-cheat-state-flag! turbo-board)
)
)
(pc-set-gfx-hack (pc-gfx-hack no-tex) (pc-cheats? (-> obj cheats) no-textures))
;; run cheats end!!!
;;;;;;;;;;;;;;;;;;;;
;; check unlocked cheats
;;;;;;;;;;;;;;;;;;;;;;;;
(let ((old (-> *pc-settings* cheats))
(old-unlocked (-> *pc-settings* cheats-unlocked))
(old-purchased (-> *pc-settings* cheats-purchased))
(old-revealed (-> *pc-settings* cheats-revealed)))
(dotimes (i (-> *pc-cheats-list* length))
;; reveals cheats if they have been purchased, purchases cheats if they have been unlocked, unlocks cheats if they have been enabled.
;; the cheat process requires the steps to be filled in this order, see sequential checking below
(logior! (-> *pc-settings* cheats-revealed) (logior! (-> *pc-settings* cheats-purchased) (logior! (-> *pc-settings* cheats-unlocked) (-> *pc-settings* cheats))))
(let* ((cheat (-> *pc-cheats-list* i))
(cost (-> cheat skill))
(unlock-func (the (function symbol) (-> cheat unlock-func value))))
(when (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode))
(task-node-closed? (-> cheat avail-after-hero))
(task-node-closed? (-> cheat avail-after)))
(logior! (-> obj cheats-revealed) (-> cheat flag))
(when (>= (-> *game-info* skill-total) cost)
(logior! (-> obj cheats-purchased) (-> cheat flag))
(when (or (zero? unlock-func)
(not unlock-func)
(unlock-func))
(logior! (-> obj cheats-unlocked) (-> cheat flag)))))
(case (-> cheat can-toggle)
((#f)
(when (logtest? (-> obj cheats-unlocked) (-> cheat flag))
(logior! (-> obj cheats) (-> cheat flag)))
)
)))
;; when speedrunning...the cheats are manually modified to facilitate the chosen category
;; don't persist these and don't spam the pc-settings saving routine every frame.
(when (and (not (-> *pc-settings* speedrunner-mode?))
(or (!= old (-> *pc-settings* cheats))
(!= old-unlocked (-> *pc-settings* cheats-unlocked))
(!= old-purchased (-> *pc-settings* cheats-purchased))
(!= old-revealed (-> *pc-settings* cheats-revealed))))
;; save pc-settings if we made new progress
(pc-settings-save)))
0)
(defmethod update-music-log ((obj pc-settings-jak3))
"update the music log"
(dotimes (i (-> *music-player-tracks* length))
(when (or (logtest? (-> *game-info* secrets) (game-secrets hero-mode))
(task-node-closed? (-> *music-player-tracks* i avail-after)))
(set-bit (-> obj music-unlocked) i)
)
)
(true! (-> obj flava-unlocked 0)) ;; default always unlocked
0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; file I/O
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun bit-array<-int64 ((arr bit-array) (start-offset int) (val int))
"starting from start-offset at arr, fill the next 64 bits of the array from an int64"
(let ((i start-offset)
(end-offset (min (+ start-offset 64) (-> arr length))))
(while (< i end-offset)
(if (nonzero? (logand val (ash 1 (- i start-offset))))
(set-bit arr i))
(1+! i)
)
val)
)
(defun int64<-bit-array ((arr bit-array) (start-offset int))
"starting from start-offset at arr, pack the next 64 bits into a single value and return it"
(let ((val 0)
(i start-offset)
(end-offset (min (+ start-offset 64) (-> arr length))))
(while (< i end-offset)
(if (get-bit arr i)
(logior! val (ash 1 (- i start-offset))))
(1+! i)
)
val)
)
(defmethod handle-input-settings ((obj pc-settings-jak3) (file file-stream))
"handle the text parsing input for the 'settings' group"
((method-of-type pc-settings handle-input-settings) obj file)
(case-str *pc-temp-string*
(("fast-airlock?") (set! (-> obj fast-airlock?) (file-stream-read-symbol file)))
(("fast-elevator?") (set! (-> obj fast-elevator?) (file-stream-read-symbol file)))
(("fast-progress?") (set! (-> obj fast-progress?) (file-stream-read-symbol file)))
(("smooth-minimap?") (set! (-> obj smooth-minimap?) (file-stream-read-symbol file)))
(("hires-clouds?") (set! (-> obj hires-clouds?) (file-stream-read-symbol file)))
(("controller-led-status?") (set! (-> obj controller-led-status?) (file-stream-read-symbol file)))
(("speedrunner-mode-custom-bind") (set! (-> obj speedrunner-mode-custom-bind) (file-stream-read-int 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))))
(("cheats-unlocked") (set! (-> obj cheats-unlocked) (the-as pc-cheats (file-stream-read-int file))))
(("cheats-backup") (file-stream-read-int file)) ;; TODO - Don't remove this, parsing code can't handle unexpected keys
(("music-unlocked")
(dotimes (i (/ (align64 (-> obj music-unlocked length)) 64))
(bit-array<-int64 (-> obj music-unlocked) (* i 64) (file-stream-read-int file))
)
)
(("flava-unlocked")
(dotimes (i 6)
(set! (-> obj flava-unlocked i) (file-stream-read-symbol file))
)
)
;; (("stats")
;; (dosettings (file)
;; (case-str *pc-temp-string*
;; (("kill-stats")
;; (initialize (-> obj stats kill-stats))
;; (dosettings (file)
;; (let ((enemy-stats (alloc-slot (-> obj stats kill-stats) (string->symbol *pc-temp-string*))))
;; (dosettings (file)
;; (let ((source (string->kill-source *pc-temp-string*))
;; (amount (file-stream-read-int file)))
;; (when (!= source (kill-stats-source unknown))
;; (set! (-> enemy-stats sources source) amount)
;; )
;; )
;; )
;; )
;; )
;; )
;; )
;; )
;; )
)
0)
(defmethod handle-output-settings ((obj pc-settings-jak3) (file file-stream))
"handle the text writing output for the 'settings' group"
((method-of-type pc-settings handle-output-settings) obj file)
(format file " (fast-airlock? ~A)~%" (-> obj fast-airlock?))
(format file " (fast-elevator? ~A)~%" (-> obj fast-elevator?))
(format file " (fast-progress? ~A)~%" (-> obj fast-progress?))
(format file " (smooth-minimap? ~A)~%" (-> obj smooth-minimap?))
(format file " (hires-clouds? ~A)~%" (-> obj hires-clouds?))
(format file " (controller-led-status? ~A)~%" (-> obj controller-led-status?))
(format file " (speedrunner-mode-custom-bind ~D)~%" (-> obj speedrunner-mode-custom-bind))
(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))
(format file " (cheats-unlocked #x~x)~%" (-> obj cheats-unlocked))
(format file " (music-unlocked")
(dotimes (i (/ (align64 (-> obj music-unlocked length)) 64))
(format file " #x~x" (int64<-bit-array (-> obj music-unlocked) (* i 64)))
)
(format file ")~%")
;; (format file " (stats~%")
;; (format file " (kill-stats~%")
;; (dotimes (i KILL_STATS_MAX_ENEMY_TYPES)
;; (when (-> obj stats kill-stats enemies i name)
;; (format file " (~A~%" (-> obj stats kill-stats enemies i name))
;; (dotimes (ii KILL_STATS_MAX_SOURCE)
;; (when (nonzero? (-> obj stats kill-stats enemies i sources ii))
;; (format file " (~A ~D)~%" (string->symbol (kill-source->string (the kill-stats-source ii))) (-> obj stats kill-stats enemies i sources ii))
;; ))
;; (format file " )~%")
;; ))
;; (format file " )~%")
;; (format file " )~%")
0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; PC settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-once *pc-settings* (new 'global 'pc-settings-jak3))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; other
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun draw-build-revision ()
(with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf))
(bucket-id debug-no-zbuf2))
;; reset bucket settings prior to drawing - font won't do this for us, and
;; draw-raw-image can sometimes mess them up.
(dma-buffer-add-gs-set-flusha buf
(alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))
(tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)))
(clear *pc-encoded-temp-string*)
(clear *temp-string*)
(format *temp-string* "<COLOR_WHITE>~S" *pc-settings-built-sha*)
(pc-encode-utf8-string *temp-string* *pc-encoded-temp-string*)
(let ((font-ctx (new 'stack 'font-context *font-default-matrix* 2 406 0.0 (font-color default) (font-flags shadow kerning large))))
(set! (-> font-ctx scale) 0.25)
(draw-string-adv *pc-encoded-temp-string* buf font-ctx))))
(defun print-level-types ((lev level))
"print the level-type linked list for a level"
(format #t "print-level-types for ~A~%" (-> lev nickname))
(let ((cur-type (-> lev level-type)))
(while (and cur-type (nonzero? cur-type) (= type (-> cur-type type)))
(format #t "~A~%" cur-type)
(set! cur-type (the type (-> cur-type method-table 8))))
(format #t "~%"))
)
(defun-debug pc-cheat->string ((cheat pc-cheats))
(doenum (name val pc-cheats)
(if (= cheat val)
(return name))
)
"*unknown*")
(defun-debug print-cheat-status (out)
(dotimes (i (-> *pc-cheats-list* length))
(let ((flag (-> *pc-cheats-list* i flag)))
(cond
((logtest? (-> *pc-settings* cheats) flag) (format out " ~20S(#x~6x): enabled~%" (pc-cheat->string flag) flag))
((logtest? (-> *pc-settings* cheats-unlocked) flag) (format out " ~20S(#x~6x): unlocked~%" (pc-cheat->string flag) flag))
((logtest? (-> *pc-settings* cheats-purchased) flag) (format out " ~20S(#x~6x): purchased~%" (pc-cheat->string flag) flag))
((logtest? (-> *pc-settings* cheats-revealed) flag) (format out " ~20S(#x~6x): revealed~%" (pc-cheat->string flag) flag))
(else (format out " ~20S(#x~6x): locked~%" (pc-cheat->string flag) flag))
)
))
out)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; process pools
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the actor pool for PC processes! it has space for 4 processes, with 16K of space.
(define *pc-dead-pool* (new 'global 'dead-pool 4 (* 16 1024) "*pc-dead-pool*"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; progress adjustments
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstant CENTER_X (/ 512 2))
(defun adjust-game-x-centered ((origin int) (x float))
"given an x position ranging from [0, 512) adjust for aspect ratio towards the origin point specified
such that it does not get stretched away with the framebuffer"
(+ origin (* (- x origin) (-> *pc-settings* aspect-ratio-reciprocal))))
(defmacro adjust-game-x (x)
`(adjust-game-x-centered CENTER_X ,x))
(defmacro adjust-game-x-int (x-float)
`(the int (adjust-game-x-centered CENTER_X (the float ,x-float))))

View File

@ -1,4 +1,4 @@
@echo off
cd ..\..
out\build\Release\bin\goalc-test --gtest_filter="Jak3TypeConsistency.TypeConsistency"
out\build\Release\bin\goalc-test --gtest_filter="Jak3TypeConsistency.TypeConsistency*"
pause

View File

@ -1310,25 +1310,13 @@
(let ((s3-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub)))
(dotimes (s2-0 (-> s3-0 length))
(let ((a1-4
(new
'global
'debug-menu-item-flag
(-> s3-0 data s2-0 name)
(the-as int (-> s3-0 data s2-0 name))
dm-instance-pick-func
)
(new 'global 'debug-menu-item-flag (-> s3-0 data s2-0 name) (-> s3-0 data s2-0 name) dm-instance-pick-func)
)
)
(debug-menu-append-item *instance-shrub-menu* a1-4)
)
(let ((a1-6
(new
'debug
'debug-menu-item-flag
(-> s3-0 data s2-0 name)
(the-as int (-> s3-0 data s2-0 name))
dm-enable-instance-func
)
(new 'debug 'debug-menu-item-flag (-> s3-0 data s2-0 name) (-> s3-0 data s2-0 name) dm-enable-instance-func)
)
)
(set! (-> a1-6 is-on) #t)
@ -1345,7 +1333,7 @@
'debug
'debug-menu-item-flag
(-> s3-1 array-data s2-1 name)
(the-as int (-> s3-1 array-data s2-1 name))
(-> s3-1 array-data s2-1 name)
dm-instance-pick-func
)
)
@ -1357,7 +1345,7 @@
'debug
'debug-menu-item-flag
(-> s3-1 array-data s2-1 name)
(the-as int (-> s3-1 array-data s2-1 name))
(-> s3-1 array-data s2-1 name)
dm-enable-instance-func
)
)
@ -1514,61 +1502,61 @@
(let ((a1-3 (new 'debug 'debug-menu-item-submenu "Mode" arg1)))
(debug-menu-append-item arg0 a1-3)
)
(let ((a1-5 (new 'debug 'debug-menu-item-flag "Default" (the-as int #f) dm-cam-mode-default)))
(let ((a1-5 (new 'debug 'debug-menu-item-flag "Default" #f dm-cam-mode-default)))
(debug-menu-append-item arg1 a1-5)
)
(let ((a1-7 (new 'debug 'debug-menu-item-flag "Free-floating" (the-as int cam-free-floating) dm-cam-mode-func)))
(let ((a1-7 (new 'debug 'debug-menu-item-flag "Free-floating" cam-free-floating dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-7)
)
(let ((a1-9 (new 'debug 'debug-menu-item-flag "Fixed" (the-as int cam-fixed) dm-cam-mode-func)))
(let ((a1-9 (new 'debug 'debug-menu-item-flag "Fixed" cam-fixed dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-9)
)
(let ((a1-11 (new 'debug 'debug-menu-item-flag "No Trans" (the-as int cam-no-trans) dm-cam-mode-func)))
(let ((a1-11 (new 'debug 'debug-menu-item-flag "No Trans" cam-no-trans dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-11)
)
(let ((a1-13 (new 'debug 'debug-menu-item-flag "Pov" (the-as int cam-pov) dm-cam-mode-func)))
(let ((a1-13 (new 'debug 'debug-menu-item-flag "Pov" cam-pov dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-13)
)
(let ((a1-15 (new 'debug 'debug-menu-item-flag "Pov180" (the-as int cam-pov180) dm-cam-mode-func)))
(let ((a1-15 (new 'debug 'debug-menu-item-flag "Pov180" cam-pov180 dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-15)
)
(let ((a1-17 (new 'debug 'debug-menu-item-flag "Pov-track" (the-as int cam-pov-track) dm-cam-mode-func)))
(let ((a1-17 (new 'debug 'debug-menu-item-flag "Pov-track" cam-pov-track dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-17)
)
(let ((a1-19 (new 'debug 'debug-menu-item-flag "Decel" (the-as int cam-decel) dm-cam-mode-func)))
(let ((a1-19 (new 'debug 'debug-menu-item-flag "Decel" cam-decel dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-19)
)
(let ((a1-21 (new 'debug 'debug-menu-item-flag "Endless fall" (the-as int cam-endlessfall) dm-cam-mode-func)))
(let ((a1-21 (new 'debug 'debug-menu-item-flag "Endless fall" cam-endlessfall dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-21)
)
(let ((a1-23 (new 'debug 'debug-menu-item-flag "Eye" (the-as int cam-eye) dm-cam-mode-func)))
(let ((a1-23 (new 'debug 'debug-menu-item-flag "Eye" cam-eye dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-23)
)
(let ((a1-25 (new 'debug 'debug-menu-item-flag "Stick" (the-as int cam-stick) dm-cam-mode-func)))
(let ((a1-25 (new 'debug 'debug-menu-item-flag "Stick" cam-stick dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-25)
)
(let ((a1-27 (new 'debug 'debug-menu-item-flag "String" (the-as int cam-string) dm-cam-mode-func)))
(let ((a1-27 (new 'debug 'debug-menu-item-flag "String" cam-string dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-27)
)
(let ((a1-29 (new 'debug 'debug-menu-item-flag "Standoff" (the-as int cam-standoff) dm-cam-mode-func)))
(let ((a1-29 (new 'debug 'debug-menu-item-flag "Standoff" cam-standoff dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-29)
)
(let ((a1-31 (new 'debug 'debug-menu-item-flag "Circular" (the-as int cam-circular) dm-cam-mode-func)))
(let ((a1-31 (new 'debug 'debug-menu-item-flag "Circular" cam-circular dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-31)
)
(let ((a1-33 (new 'debug 'debug-menu-item-flag "Look At" (the-as int cam-lookat) dm-cam-mode-func)))
(let ((a1-33 (new 'debug 'debug-menu-item-flag "Look At" cam-lookat dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-33)
)
(let ((a1-35 (new 'debug 'debug-menu-item-flag "Center of world" (the-as int cam-point-watch) dm-cam-mode-func)))
(let ((a1-35 (new 'debug 'debug-menu-item-flag "Center of world" cam-point-watch dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-35)
)
(let ((a1-37 (new 'debug 'debug-menu-item-flag "Spline" (the-as int cam-spline) dm-cam-mode-func)))
(let ((a1-37 (new 'debug 'debug-menu-item-flag "Spline" cam-spline dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-37)
)
(let ((a1-39 (new 'debug 'debug-menu-item-flag "Tube Sled" (the-as int cam-tube-sled) dm-cam-mode-func)))
(let ((a1-39 (new 'debug 'debug-menu-item-flag "Tube Sled" cam-tube-sled dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-39)
)
(let ((a1-41 (new 'debug 'debug-menu-item-flag "Bike" (the-as int cam-bike) dm-cam-mode-func)))
(let ((a1-41 (new 'debug 'debug-menu-item-flag "Bike" cam-bike dm-cam-mode-func)))
(debug-menu-append-item arg1 a1-41)
)
)
@ -1585,29 +1573,26 @@
(let ((a1-6 (new 'debug 'debug-menu-item-submenu "External" s3-0)))
(debug-menu-append-item gp-0 a1-6)
)
(let ((a1-8 (new 'debug 'debug-menu-item-flag "CPad 0" (the-as int 'pad-0) dm-cam-externalize)))
(let ((a1-8 (new 'debug 'debug-menu-item-flag "CPad 0" 'pad-0 dm-cam-externalize)))
(debug-menu-append-item s3-0 a1-8)
)
(let ((a1-10 (new 'debug 'debug-menu-item-flag "CPad 1" (the-as int 'pad-1) dm-cam-externalize)))
(let ((a1-10 (new 'debug 'debug-menu-item-flag "CPad 1" 'pad-1 dm-cam-externalize)))
(debug-menu-append-item s3-0 a1-10)
)
(let ((a1-12 (new 'debug 'debug-menu-item-flag "Lock" (the-as int 'locked) dm-cam-externalize)))
(let ((a1-12 (new 'debug 'debug-menu-item-flag "Lock" 'locked dm-cam-externalize)))
(debug-menu-append-item s3-0 a1-12)
)
(let ((a1-14 (new 'debug 'debug-menu-item-flag "Reset" (the-as int 'reset) dm-cam-externalize)))
(let ((a1-14 (new 'debug 'debug-menu-item-flag "Reset" 'reset dm-cam-externalize)))
(debug-menu-append-item s3-0 a1-14)
)
(let ((a1-16 (new 'debug 'debug-menu-item-flag "Allow z rot" (the-as int 'allow-z) dm-cam-externalize)))
(let ((a1-16 (new 'debug 'debug-menu-item-flag "Allow z rot" 'allow-z dm-cam-externalize)))
(debug-menu-append-item s3-0 a1-16)
)
(let ((s2-0 (new 'debug 'debug-menu-item-var "Fov" 0 80)))
(debug-menu-item-var-make-float s2-0 dm-cam-render-float 1.0 #t 15.0 180.0 1)
(debug-menu-append-item s3-0 s2-0)
)
(let ((a1-21
(new 'debug 'debug-menu-item-flag "turbo free" (the-as int '*camera-turbo-free*) dm-boolean-toggle-pick-func)
)
)
(let ((a1-21 (new 'debug 'debug-menu-item-flag "turbo free" '*camera-turbo-free* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s3-0 a1-21)
)
)
@ -1615,25 +1600,13 @@
(let ((a1-24 (new 'debug 'debug-menu-item-submenu "Collision" s3-1)))
(debug-menu-append-item gp-0 a1-24)
)
(let ((a1-26 (new
'debug
'debug-menu-item-flag
"Record"
(the-as int '*record-cam-collide-history*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-26 (new 'debug 'debug-menu-item-flag "Record" '*record-cam-collide-history* dm-boolean-toggle-pick-func))
)
(debug-menu-append-item s3-1 a1-26)
)
(let ((a1-28 (new
'debug
'debug-menu-item-flag
"Display"
(the-as int '*display-cam-collide-history*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-28
(new 'debug 'debug-menu-item-flag "Display" '*display-cam-collide-history* dm-boolean-toggle-pick-func)
)
)
(debug-menu-append-item s3-1 a1-28)
)
@ -1642,13 +1615,10 @@
(let ((a1-31 (new 'debug 'debug-menu-item-submenu "Settings" s4-1)))
(debug-menu-append-item gp-0 a1-31)
)
(let ((a1-33 (new 'debug 'debug-menu-item-flag "Default" (the-as int #f) dm-cam-settings-default)))
(let ((a1-33 (new 'debug 'debug-menu-item-flag "Default" #f dm-cam-settings-default)))
(debug-menu-append-item s4-1 a1-33)
)
(let ((a1-35
(new 'debug 'debug-menu-item-flag "turbo free" (the-as int '*camera-turbo-free*) dm-boolean-toggle-pick-func)
)
)
(let ((a1-35 (new 'debug 'debug-menu-item-flag "turbo free" '*camera-turbo-free* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-35)
)
(let ((s3-2 (new 'debug 'debug-menu-item-var "Fov" (the-as int 'fov) 80)))
@ -1704,127 +1674,66 @@
'debug
'debug-menu-item-flag
"no mip/lod correction"
(the-as int '*camera-no-mip-correction*)
'*camera-no-mip-correction*
dm-boolean-toggle-pick-func
)
)
)
(debug-menu-append-item s4-1 a1-65)
)
(let ((a1-67 (new
'debug
'debug-menu-item-flag
"last attacker"
(the-as int '*display-camera-last-attacker*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-67
(new 'debug 'debug-menu-item-flag "last attacker" '*display-camera-last-attacker* dm-boolean-toggle-pick-func)
)
)
(debug-menu-append-item s4-1 a1-67)
)
(let ((a1-69 (new
'debug
'debug-menu-item-flag
"old stats"
(the-as int '*display-camera-old-stats*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-69 (new 'debug 'debug-menu-item-flag "old stats" '*display-camera-old-stats* dm-boolean-toggle-pick-func))
)
(debug-menu-append-item s4-1 a1-69)
)
(let ((a1-71 (new 'debug 'debug-menu-item-flag "Amy cam" (the-as int '*amy-cam*) dm-boolean-toggle-pick-func)))
(let ((a1-71 (new 'debug 'debug-menu-item-flag "Amy cam" '*amy-cam* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-71)
)
(let ((a1-73
(new 'debug 'debug-menu-item-flag "xyz axes" (the-as int '*display-xyz-axes*) dm-boolean-toggle-pick-func)
)
)
(let ((a1-73 (new 'debug 'debug-menu-item-flag "xyz axes" '*display-xyz-axes* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-73)
)
(let ((a1-75 (new
'debug
'debug-menu-item-flag
"Master Marks"
(the-as int '*display-cam-master-marks*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-75
(new 'debug 'debug-menu-item-flag "Master Marks" '*display-cam-master-marks* dm-boolean-toggle-pick-func)
)
)
(debug-menu-append-item s4-1 a1-75)
)
(let ((a1-77
(new 'debug 'debug-menu-item-flag "Other Marks" (the-as int '*display-cam-other*) dm-boolean-toggle-pick-func)
)
)
(let ((a1-77 (new 'debug 'debug-menu-item-flag "Other Marks" '*display-cam-other* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-77)
)
(let ((a1-79 (new
'debug
'debug-menu-item-flag
"los debug"
(the-as int '*display-cam-los-debug*)
dm-boolean-toggle-pick-func
)
)
)
(let ((a1-79 (new 'debug 'debug-menu-item-flag "los debug" '*display-cam-los-debug* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-79)
)
(let ((a1-81
(new 'debug 'debug-menu-item-flag "los info" (the-as int '*display-cam-los-info*) dm-boolean-toggle-pick-func)
)
)
(let ((a1-81 (new 'debug 'debug-menu-item-flag "los info" '*display-cam-los-info* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-81)
)
(let ((a1-83 (new
'debug
'debug-menu-item-flag
"los Marks"
(the-as int '*display-cam-los-marks*)
dm-boolean-toggle-pick-func
)
)
)
(let ((a1-83 (new 'debug 'debug-menu-item-flag "los Marks" '*display-cam-los-marks* dm-boolean-toggle-pick-func)))
(debug-menu-append-item s4-1 a1-83)
)
(let ((a1-85 (new
'debug
'debug-menu-item-flag
"coll Marks"
(the-as int '*display-cam-coll-marks*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-85 (new 'debug 'debug-menu-item-flag "coll Marks" '*display-cam-coll-marks* dm-boolean-toggle-pick-func))
)
(debug-menu-append-item s4-1 a1-85)
)
(let ((a1-87 (new
'debug
'debug-menu-item-flag
"Camera Marks"
(the-as int '*display-camera-marks*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-87 (new 'debug 'debug-menu-item-flag "Camera Marks" '*display-camera-marks* dm-boolean-toggle-pick-func))
)
(debug-menu-append-item s4-1 a1-87)
)
)
(let ((a1-89 (new
'debug
'debug-menu-item-flag
"Edit"
(the-as int '*cam-layout*)
(lambda ((arg0 symbol) (arg1 debug-menu-msg))
(when (= arg1 (debug-menu-msg press))
(if (-> arg0 value)
(cam-layout-stop)
(cam-layout-start)
)
)
(-> arg0 value)
)
)
(let ((a1-89 (new 'debug 'debug-menu-item-flag "Edit" '*cam-layout* (lambda ((arg0 symbol) (arg1 debug-menu-msg))
(when (= arg1 (debug-menu-msg press))
(if (-> arg0 value)
(cam-layout-stop)
(cam-layout-start)
)
)
(-> arg0 value)
)
)
)
)
(debug-menu-append-item gp-0 a1-89)
@ -1833,7 +1742,7 @@
'debug
'debug-menu-item-function
"Save Pos"
(the-as int #f)
#f
(the-as (function object object) debug-create-cam-restore)
)
)
@ -1855,14 +1764,7 @@
(debug-menu-append-item gp-0 a1-4)
)
)
(let ((a1-6 (new
'debug
'debug-menu-item-function
"Refresh"
(the-as int #f)
(the-as (function object object) build-shader-list)
)
)
(let ((a1-6 (new 'debug 'debug-menu-item-function "Refresh" #f (the-as (function object object) build-shader-list)))
)
(debug-menu-append-item gp-0 a1-6)
)
@ -1917,7 +1819,7 @@
'debug
'debug-menu-item-function
"all tweak+"
(the-as int #f)
#f
(the-as (function object object) (lambda () (all-texture-tweak-adjust *texture-page-dir* 0.1)))
)
)
@ -1928,7 +1830,7 @@
'debug
'debug-menu-item-function
"all tweak-"
(the-as int #f)
#f
(the-as (function object object) (lambda () (all-texture-tweak-adjust *texture-page-dir* -0.1)))
)
)
@ -2772,17 +2674,12 @@
(debug-menu-append-item gp-0 a1-7)
)
)
(let ((a1-9 (new 'debug 'debug-menu-item-function "Refresh" (the-as int #f) build-instance-list)))
(let ((a1-9 (new 'debug 'debug-menu-item-function "Refresh" #f build-instance-list)))
(debug-menu-append-item gp-0 a1-9)
)
(let ((a1-11 (new
'debug
'debug-menu-item-function
"Print Info"
(the-as int #f)
(the-as (function object object) print-prototype-list)
)
)
(let ((a1-11
(new 'debug 'debug-menu-item-function "Print Info" #f (the-as (function object object) print-prototype-list))
)
)
(debug-menu-append-item gp-0 a1-11)
)
@ -2893,14 +2790,9 @@
(debug-menu-append-item gp-0 a1-31)
)
)
(let ((a1-33 (new
'debug
'debug-menu-item-flag
"Instance Info"
(the-as int '*display-instance-info*)
dm-boolean-toggle-pick-func
)
)
(let ((a1-33
(new 'debug 'debug-menu-item-flag "Instance Info" '*display-instance-info* dm-boolean-toggle-pick-func)
)
)
(debug-menu-append-item gp-0 a1-33)
)

View File

@ -200,7 +200,7 @@
(hilite-timer int8)
)
(:methods
(new (symbol type string int (function object object)) _type_)
(new (symbol type string object (function object object)) _type_)
)
)
@ -223,13 +223,13 @@
)
;; definition for method 0 of type debug-menu-item-function
(defmethod new debug-menu-item-function ((allocation symbol) (type-to-make type) (arg0 string) (arg1 int) (arg2 (function object object)))
(defmethod new debug-menu-item-function ((allocation symbol) (type-to-make type) (arg0 string) (arg1 object) (arg2 (function object object)))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> v0-0 name) arg0)
(set! (-> v0-0 parent) #f)
(set! (-> v0-0 refresh-delay) 0)
(set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay))
(set! (-> v0-0 id) arg1)
(set! (-> v0-0 id) (the-as int arg1))
(set! (-> v0-0 activate-func) arg2)
(set! (-> v0-0 hilite-timer) 0)
v0-0
@ -242,7 +242,7 @@
(is-on symbol)
)
(:methods
(new (symbol type string int (function object debug-menu-msg object)) _type_)
(new (symbol type string object (function object debug-menu-msg object)) _type_)
)
)
@ -268,7 +268,7 @@
(defmethod new debug-menu-item-flag ((allocation symbol)
(type-to-make type)
(arg0 string)
(arg1 int)
(arg1 object)
(arg2 (function object debug-menu-msg object))
)
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
@ -276,7 +276,7 @@
(set! (-> v0-0 parent) #f)
(set! (-> v0-0 refresh-delay) 23)
(set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay))
(set! (-> v0-0 id) arg1)
(set! (-> v0-0 id) (the-as int arg1))
(set! (-> v0-0 activate-func) arg2)
(set! (-> v0-0 is-on) #f)
v0-0
@ -735,7 +735,7 @@
'debug
'debug-menu-item-flag
(the-as string s4-1)
(the-as int (car (cdr (cdr arg1))))
(car (cdr (cdr arg1)))
(the-as (function object debug-menu-msg object) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
)
)
@ -744,7 +744,7 @@
'debug
'debug-menu-item-function
(the-as string s4-1)
(the-as int (car (cdr (cdr arg1))))
(car (cdr (cdr arg1)))
(the-as (function object object) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
)
)