mirror of
https://github.com/open-goal/jak-project
synced 2026-05-26 23:47:57 -04:00
521 lines
14 KiB
Common Lisp
Vendored
521 lines
14 KiB
Common Lisp
Vendored
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; failed to figure out what this is:
|
|
(set!
|
|
(-> *game-info* hint-control)
|
|
(the-as
|
|
(array level-hint-control)
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type level-hint-control :length 25 :allocated-length 25
|
|
(new 'static 'level-hint-control
|
|
:id #x917
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 3
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x90a
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x284
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing 3
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x285
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x251
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x2af
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x384
|
|
:id #x239
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x5dc
|
|
:id #x29d
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x384
|
|
:id #x25b
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x2a4
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x384
|
|
:id #x2aa
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x5dc
|
|
:id #x33a
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x1194
|
|
:id #x34b
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing 2
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x4650
|
|
:id #x34a
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x34d
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x345
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing 2
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x352
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x2328
|
|
:id #x347
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x34e
|
|
:num-attempts-before-playing 3
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x444
|
|
:num-attempts-before-playing 5
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x384
|
|
:id #x438
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x433
|
|
:num-attempts-before-playing 4
|
|
:num-success-before-killing -1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:id #x70d
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 2
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x5dc
|
|
:id #x806
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
(new 'static 'level-hint-control
|
|
:delay-before-playing #x5dc
|
|
:id #x809
|
|
:num-attempts-before-playing 1
|
|
:num-success-before-killing 1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(set!
|
|
(-> *game-info* task-hint-control)
|
|
(the-as
|
|
(array task-hint-control-group)
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control-group :length 16 :allocated-length 16
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 3 :allocated-length 3
|
|
(new 'static 'task-hint-control :task #x5c :delay #x2bf20)
|
|
(new 'static 'task-hint-control :task #x5d :delay #x57e40)
|
|
(new 'static 'task-hint-control :task #x5e :delay #x83d60)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 3 :allocated-length 3
|
|
(new 'static 'task-hint-control :task #x15 :delay #x41eb0)
|
|
(new 'static 'task-hint-control :task #x16 :delay #x83d60)
|
|
(new 'static 'task-hint-control :task #x13 :delay #xc5c10)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 2 :allocated-length 2
|
|
(new 'static 'task-hint-control :task #x6 :delay #x57e40)
|
|
(new 'static 'task-hint-control :task #x8 :delay #xafc80)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 4 :allocated-length 4
|
|
(new 'static 'task-hint-control :task #x18 :delay #x57e40)
|
|
(new 'static 'task-hint-control :task #x19 :delay #x83d60)
|
|
(new 'static 'task-hint-control :task #x1d :delay #xafc80)
|
|
(new 'static 'task-hint-control :task #x1e :delay #xdbba0)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group)
|
|
(new 'static 'task-hint-control-group)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 3 :allocated-length 3
|
|
(new 'static 'task-hint-control :task #x33 :delay #x57e40)
|
|
(new 'static 'task-hint-control :task #x30 :delay #x83d60)
|
|
(new 'static 'task-hint-control :task #x2e :delay #xafc80)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 1 :allocated-length 1
|
|
(new 'static 'task-hint-control :task #x26 :delay #xafc80)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 1 :allocated-length 1
|
|
(new 'static 'task-hint-control :task #x38 :delay #xafc80)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 1 :allocated-length 1
|
|
(new 'static 'task-hint-control :task #x6e :delay #x107ac0)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 1 :allocated-length 1
|
|
(new 'static 'task-hint-control :task #x4a :delay #x107ac0)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 4 :allocated-length 4
|
|
(new 'static 'task-hint-control :task #x42 :delay #x57e40)
|
|
(new 'static 'task-hint-control :task #x43 :delay #x83d60)
|
|
(new 'static 'task-hint-control :task #x3f :delay #xafc80)
|
|
(new 'static 'task-hint-control :task #x40 :delay #xdbba0)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group
|
|
:tasks
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type task-hint-control :length 4 :allocated-length 4
|
|
(new 'static 'task-hint-control :task #x50 :delay #x57e40)
|
|
(new 'static 'task-hint-control :task #x51 :delay #x83d60)
|
|
(new 'static 'task-hint-control :task #x52 :delay #xafc80)
|
|
(new 'static 'task-hint-control :task #x54 :delay #xdbba0)
|
|
)
|
|
)
|
|
(new 'static 'task-hint-control-group)
|
|
(new 'static 'task-hint-control-group)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function find-hint-control-index
|
|
(defun find-hint-control-index ((arg0 level-hint-control))
|
|
(let ((gp-0 -1))
|
|
(let ((v1-2 (length (-> *game-info* hint-control))))
|
|
(dotimes (a0-2 v1-2)
|
|
(when (= (-> *game-info* hint-control a0-2 id) arg0)
|
|
(set! gp-0 a0-2)
|
|
(set! a0-2 v1-2)
|
|
)
|
|
)
|
|
)
|
|
gp-0
|
|
)
|
|
)
|
|
|
|
;; definition for function start-hint-timer
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun start-hint-timer ((arg0 level-hint-control))
|
|
(let ((v1-0 (find-hint-control-index arg0)))
|
|
(when
|
|
(and
|
|
(>= v1-0 0)
|
|
(zero? (-> *game-info* hint-control v1-0 start-time))
|
|
(!= (-> *game-info* hint-control v1-0 num-attempts-before-playing) 1)
|
|
)
|
|
(set!
|
|
(-> *game-info* hint-control v1-0 start-time)
|
|
(-> *display* base-frame-counter)
|
|
)
|
|
0
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function increment-success-for-hint
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun increment-success-for-hint ((arg0 level-hint-control))
|
|
(let ((gp-0 (find-hint-control-index arg0)))
|
|
(when (>= gp-0 0)
|
|
(set!
|
|
(-> *game-info* hint-control gp-0 num-success)
|
|
(seekl (-> *game-info* hint-control gp-0 num-success) 127 1)
|
|
)
|
|
0
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function can-hint-be-played?
|
|
;; WARN: disable def twice: 139. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
|
|
(defun can-hint-be-played? ((arg0 int))
|
|
(let ((v1-0 (not (str-is-playing?))))
|
|
(if (and v1-0 (nonzero? arg0))
|
|
(set! v1-0 (not (seen-text? *game-info* (the-as game-text-id arg0))))
|
|
)
|
|
(when v1-0
|
|
(when *hint-semaphore*
|
|
(let ((v1-3 *hint-semaphore*))
|
|
(set! v1-0 (dummy-15 (the-as level-hint (if v1-3
|
|
(-> v1-3 0 self)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
)
|
|
(when
|
|
(and
|
|
v1-0
|
|
(<
|
|
(the-as
|
|
int
|
|
(- (-> *display* base-frame-counter) (-> *game-info* hint-play-time))
|
|
)
|
|
30
|
|
)
|
|
)
|
|
(set! v1-0 #f)
|
|
0
|
|
)
|
|
(set!
|
|
v1-0
|
|
(and
|
|
v1-0
|
|
(not (-> *setting-control* current talking))
|
|
(not (-> *setting-control* current spooling))
|
|
(not (-> *setting-control* current hint))
|
|
(not (-> *setting-control* current ambient))
|
|
(>=
|
|
(the-as int (-> *display* base-frame-counter))
|
|
(the-as int (-> *game-info* blackout-time))
|
|
)
|
|
)
|
|
)
|
|
0
|
|
)
|
|
(cond
|
|
(v1-0
|
|
(let ((v1-16 (find-hint-control-index (the-as level-hint-control arg0))))
|
|
(cond
|
|
((< v1-16 0)
|
|
#t
|
|
)
|
|
(else
|
|
(let ((gp-1 (-> *game-info* hint-control v1-16))
|
|
(a0-24
|
|
(-
|
|
(-> *display* base-frame-counter)
|
|
(-> *game-info* hint-control v1-16 last-time-called)
|
|
)
|
|
)
|
|
(v1-21 #t)
|
|
)
|
|
(if
|
|
(and
|
|
(= (-> gp-1 num-attempts-before-playing) 1)
|
|
(< (the-as int a0-24) 30)
|
|
)
|
|
(+! (-> gp-1 start-time) a0-24)
|
|
)
|
|
(cond
|
|
((and
|
|
(!= (-> gp-1 num-attempts-before-playing) 1)
|
|
(nonzero? (-> gp-1 last-time-called))
|
|
(<
|
|
(the-as
|
|
int
|
|
(- (-> *display* base-frame-counter) (-> gp-1 last-time-called))
|
|
)
|
|
150
|
|
)
|
|
)
|
|
(set! (-> gp-1 last-time-called) (-> *display* base-frame-counter))
|
|
#f
|
|
)
|
|
(else
|
|
(set! (-> gp-1 last-time-called) (-> *display* base-frame-counter))
|
|
(when (nonzero? (-> gp-1 delay-before-playing))
|
|
(if
|
|
(<
|
|
(the-as int (-> gp-1 start-time))
|
|
(the-as int (-> gp-1 delay-before-playing))
|
|
)
|
|
(set! v1-21 #f)
|
|
)
|
|
0
|
|
)
|
|
(cond
|
|
(v1-21
|
|
(set! (-> gp-1 num-attempts) (seekl (-> gp-1 num-attempts) 127 1))
|
|
(and
|
|
(>= (-> gp-1 num-attempts) (-> gp-1 num-attempts-before-playing))
|
|
(or
|
|
(= (-> gp-1 num-success-before-killing) -1)
|
|
(< (-> gp-1 num-success) (-> gp-1 num-success-before-killing))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function reset-all-hint-controls
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun reset-all-hint-controls ()
|
|
(let ((v1-2 (length (-> *game-info* hint-control))))
|
|
(dotimes (a0-1 v1-2)
|
|
(let ((a1-2 (-> *game-info* hint-control a0-1)))
|
|
(set! (-> a1-2 start-time) (the-as uint 0))
|
|
(set! (-> a1-2 last-time-called) (the-as uint 0))
|
|
(set! (-> a1-2 num-attempts) 0)
|
|
(set! (-> a1-2 num-success) 0)
|
|
)
|
|
0
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function update-task-hints
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun update-task-hints ()
|
|
(when *target*
|
|
(let ((a0-0 (+ (-> *target* current-level info index) -1))
|
|
(v1-7 (-> *game-info* task-hint-control))
|
|
)
|
|
(when (and (>= a0-0 0) (< a0-0 (-> *level-task-data-remap* length)))
|
|
(let ((a0-3 (-> *level-task-data-remap* a0-0)))
|
|
(when (< a0-3 (-> v1-7 length))
|
|
(let ((gp-0 (-> v1-7 a0-3 tasks)))
|
|
(when (and (!= gp-0 0) (nonzero? (-> gp-0 length)))
|
|
(let ((s5-0 (-> *game-info* in-level-time a0-3)))
|
|
(dotimes (s4-0 (-> gp-0 length))
|
|
(case (get-task-status (the-as game-task (-> gp-0 s4-0 task)))
|
|
(((task-status need-hint) (task-status unknown))
|
|
(if (< (-> gp-0 s4-0 delay) s5-0)
|
|
(close-specific-task!
|
|
(the-as game-task (-> gp-0 s4-0 task))
|
|
(task-status need-hint)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|