mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 23:01:56 -04:00
game: add real-time time of day cheat code (#1595)
This commit is contained in:
@@ -123,6 +123,7 @@
|
||||
(invinc)
|
||||
(sidekick-blue)
|
||||
(tunes)
|
||||
(sky)
|
||||
)
|
||||
|
||||
(defmacro pc-cheats? (obj &rest cheats)
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
|
||||
(none))
|
||||
|
||||
(define *pc-cheat-temp* (the-as (pointer int32) (malloc 'global (* 4 7))))
|
||||
(define *pc-cheat-temp* (the-as (pointer int32) (malloc 'global (* 4 8))))
|
||||
(defmacro pc-cheat-toggle-and-tune (obj cheat)
|
||||
`(begin
|
||||
(cpad-clear! 0 r1)
|
||||
@@ -233,6 +233,11 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defun bcd->dec ((bcd uint))
|
||||
"Convert a number encoded in BCD to its decimal equivalent"
|
||||
(+ (* (shr (logand bcd #xf0) 4) 10) (logand bcd #x0f))
|
||||
)
|
||||
|
||||
(defmethod update pc-settings ((obj pc-settings))
|
||||
"Update settings to/from PC kernel. Call this at the start of every frame.
|
||||
This will update things like the aspect-ratio, which will be used for graphics code later."
|
||||
@@ -365,6 +370,9 @@
|
||||
|
||||
(pc-check-cheat-code (-> *pc-cheat-temp* 6) 0 (t u n e s)
|
||||
(pc-cheat-toggle-and-tune obj tunes))
|
||||
|
||||
(pc-check-cheat-code (-> *pc-cheat-temp* 7) 0 (s k y)
|
||||
(pc-cheat-toggle-and-tune obj sky))
|
||||
)
|
||||
|
||||
(when *target*
|
||||
@@ -421,6 +429,15 @@
|
||||
(set! (-> obj flava-hack) 0)
|
||||
)
|
||||
|
||||
(if (pc-cheats? obj sky)
|
||||
(let ((date (new 'stack 'scf-time)))
|
||||
(scf-get-time date)
|
||||
(when (zero? (-> date stat))
|
||||
(set-time-of-day (+ (the float (bcd->dec (-> date hour))) (/ (the float (bcd->dec (-> date minute))) 60)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(logior! (-> obj cheats-known) (-> obj cheats))
|
||||
0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user