Files
jak-project/goal_src/engine/game/task/hint-control.gc
T
water111 bcbd1159dd Continue cleanup of source files (#1138)
* more cleanup

* tests
2022-02-06 18:53:43 -05:00

584 lines
14 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: hint-control.gc
;; name in dgo: hint-control
;; dgos: GAME, ENGINE
;; 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)
(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 (game-task training-gimmie)
:delay #x2bf20
)
(new 'static 'task-hint-control
:task (game-task training-door)
:delay #x57e40
)
(new 'static 'task-hint-control
:task (game-task training-climb)
: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 (game-task beach-gimmie)
:delay #x41eb0
)
(new 'static 'task-hint-control
:task (game-task beach-sentinel)
:delay #x83d60
)
(new 'static 'task-hint-control
:task (game-task beach-cannon)
: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 (game-task jungle-plant)
:delay #x57e40
)
(new 'static 'task-hint-control
:task (game-task jungle-canyon-end)
: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 (game-task misty-boat)
:delay #x57e40
)
(new 'static 'task-hint-control
:task (game-task misty-warehouse)
:delay #x83d60
)
(new 'static 'task-hint-control
:task (game-task misty-bike-jump)
:delay #xafc80
)
(new 'static 'task-hint-control
:task (game-task misty-eco-challenge)
: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 (game-task sunken-spinning-room)
:delay #x57e40
)
(new 'static 'task-hint-control
:task (game-task sunken-sharks)
:delay #x83d60
)
(new 'static 'task-hint-control
:task (game-task sunken-slide)
: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 (game-task swamp-battle)
: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 (game-task rolling-lake)
: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 (game-task ogre-secret)
: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 (game-task village3-extra1)
: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 (game-task snow-bumpers)
:delay #x57e40
)
(new 'static 'task-hint-control :task (game-task snow-cage) :delay #x83d60)
(new 'static 'task-hint-control :task (game-task snow-ball) :delay #xafc80)
(new 'static 'task-hint-control
:task (game-task snow-bunnies)
: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 (game-task cave-dark-climb)
:delay #x57e40
)
(new 'static 'task-hint-control
:task (game-task cave-robot-climb)
:delay #x83d60
)
(new 'static 'task-hint-control
:task (game-task cave-swing-poles)
:delay #xafc80
)
(new 'static 'task-hint-control
:task (game-task cave-platforms)
: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 game-text-id))
(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 game-text-id))
(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 game-text-id))
(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 game-text-id) (arg1 entity) (arg2 string))
(let ((v1-0 (not (str-is-playing?))))
(if (and v1-0 (nonzero? arg0))
(set! v1-0 (not (seen-text? *game-info* arg0)))
)
(when v1-0
(when *hint-semaphore*
(set!
v1-0
(appeared-for-long-enough? (the-as level-hint (ppointer->process *hint-semaphore*)))
)
0
)
(when
(and
v1-0
(<
(- (-> *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))
(>= (-> *display* base-frame-counter) (-> *game-info* blackout-time))
)
)
0
)
(cond
(v1-0
(let ((v1-16 (find-hint-control-index 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) (< a0-24 30))
(+! (-> gp-1 start-time) a0-24)
)
(cond
((and
(!= (-> gp-1 num-attempts-before-playing) 1)
(nonzero? (-> gp-1 last-time-called))
(<
(- (-> *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
(<
(-> 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) 0)
(set! (-> a1-2 last-time-called) 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 (-> gp-0 s4-0 task))
(((task-status need-hint) (task-status unknown))
(if (< (the-as uint (-> gp-0 s4-0 delay)) (the-as uint s5-0))
(close-specific-task!
(-> gp-0 s4-0 task)
(task-status need-hint)
)
)
)
)
)
)
)
)
)
)
)
)
)
0
(none)
)