mirror of
https://github.com/open-goal/jak-project
synced 2026-06-27 10:52:59 -04:00
212 lines
5.0 KiB
Common Lisp
212 lines
5.0 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.1.2
|
|
(defconstant PC_KERNEL_VERSION (static-pckernel-version 0 1 1 2))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; types and enums
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
;; cheats
|
|
(defconstant PC_CHEAT_MAX 20) ;; number of cheats
|
|
(defenum pc-cheats
|
|
:bitfield #t
|
|
:type uint64
|
|
(eco-green)
|
|
(eco-red)
|
|
(eco-blue)
|
|
(eco-yellow)
|
|
(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)
|
|
)
|
|
|
|
;; 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)
|
|
|
|
(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)
|
|
;; music
|
|
(music-unlocked bit-array)
|
|
(flava-unlocked symbol 6)
|
|
|
|
(fast-airlock? symbol)
|
|
(fast-elevator? symbol)
|
|
(fast-progress? 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 pc-settings-jak2 ((obj pc-settings-jak2) (call-handlers symbol))
|
|
"Set the default misc settings"
|
|
|
|
((method-of-type pc-settings reset-misc) obj call-handlers)
|
|
(set! (-> obj jetboard-trick-text?) #t)
|
|
|
|
(set! (-> obj fast-airlock?) #t)
|
|
(set! (-> obj fast-elevator?) #t)
|
|
(set! (-> obj fast-progress?) #f)
|
|
0)
|
|
|
|
(defmethod reset-extra pc-settings-jak2 ((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)
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; other
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
(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))
|
|
)
|
|
)
|
|
|
|
|