mirror of
https://github.com/open-goal/jak-project
synced 2026-05-30 00:47:20 -04:00
262 lines
6.1 KiB
Common Lisp
262 lines
6.1 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
#|
|
|
This file has the game-specific implementation of the pckernel (see pckernel-h.gc and pckernel.gc).
|
|
|#
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; constants
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
;; version: 0.1.6.2
|
|
(defconstant PC_KERNEL_VERSION (static-pckernel-version 0 1 6 2))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; types and enums
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
;; cheats
|
|
(defconstant PC_CHEAT_MAX 19) ;; number of 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-movies)
|
|
(slow-movies)
|
|
(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)
|
|
(japanese 5)
|
|
(korean 6)
|
|
(uk-english 7)
|
|
;; custom
|
|
(portuguese 8)
|
|
(finnish 9)
|
|
(swedish 10)
|
|
(danish 11)
|
|
(norwegian 12)
|
|
(dutch 13)
|
|
(br-portuguese 14)
|
|
(hungarian 15)
|
|
(catalan 16)
|
|
(icelandic 17)
|
|
(russian 18)
|
|
(polish 19)
|
|
(lithuanian 19)
|
|
|
|
(custom 999) ;; temp
|
|
)
|
|
|
|
;; The Jak 2 version of the pc-settings object.
|
|
(deftype pc-settings-jak2 (pc-settings)
|
|
(;; cheats
|
|
(cheats pc-cheats)
|
|
(cheats-revealed pc-cheats)
|
|
(cheats-purchased pc-cheats)
|
|
(cheats-backup pc-cheats) ;; backup for 'cheats', persisted to disk to be restored when disabling speedrunner mode
|
|
;; music
|
|
(music-unlocked bit-array)
|
|
(flava-unlocked symbol 6)
|
|
|
|
;; misc
|
|
(fast-airlock? symbol)
|
|
(fast-elevator? symbol)
|
|
(fast-progress? symbol)
|
|
|
|
;; gfx
|
|
(smooth-minimap? symbol)
|
|
(hires-clouds? symbol)
|
|
|
|
;; other
|
|
(controller-led-status? symbol)
|
|
|
|
(text-language pc-language) ;; language for game text
|
|
|
|
;; debug
|
|
(jetboard-trick-text? symbol) ;; enable rendering jetboard trick combo during minigame
|
|
)
|
|
|
|
(: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-jak2 #f))
|
|
|
|
|
|
;; jak 2 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-jak2) (call-handlers symbol))
|
|
"Set the default misc settings"
|
|
|
|
((method-of-type pc-settings reset-misc) obj call-handlers)
|
|
(true! (-> obj jetboard-trick-text?))
|
|
|
|
(true! (-> obj fast-airlock?))
|
|
(true! (-> obj fast-elevator?))
|
|
(false! (-> obj fast-progress?))
|
|
(true! (-> obj smooth-minimap?))
|
|
(false! (-> obj hires-clouds?))
|
|
0)
|
|
|
|
(defmethod reset-extra ((obj pc-settings-jak2) (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))
|
|
|
|
(clear-all! (-> obj music-unlocked))
|
|
(dotimes (i 6)
|
|
(set! (-> obj flava-unlocked i) #f))
|
|
0)
|
|
|
|
(defmethod reset-input ((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
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
(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)
|
|
|
|
|
|
;; 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)
|
|
)
|
|
|
|
|
|
(defun get-video-params () *video-params*)
|
|
|
|
|
|
(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)
|
|
(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
|
|
))
|
|
|
|
(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))
|
|
(logior! (-> *pc-settings* cheats-revealed) (pc-cheats ,@cheats))
|
|
(logior! (-> *pc-settings* cheats-purchased) (pc-cheats ,@cheats))
|
|
)
|
|
)
|
|
|
|
(defmacro lock-cheat! (&rest cheats)
|
|
`(begin
|
|
(logclear! (-> *pc-settings* cheats) (pc-cheats ,@cheats))
|
|
(logclear! (-> *pc-settings* cheats-revealed) (pc-cheats ,@cheats))
|
|
(logclear! (-> *pc-settings* cheats-purchased) (pc-cheats ,@cheats))
|
|
)
|
|
)
|
|
|
|
|