jak-project/goal_src/jak3/engine/common-obs/speech-manager.gc
Hat Kid 949508d0ed
decomp3: traffic/citizen/faction code, desert-rescue (#3506)
- `cty-faction-h`
- `nav-graph`
- `citizen-h`
- `citizen`
- `civilian`
- `traffic-engine`
- `traffic-manager`
- `cty-attack-controller`
- `cty-faction`
- `formation-object`
- `formations`
- `squad-control-city-h`
- `squad-control-city`
- `traffic-util`
- `wlander-female`
- `wlander-h`
- `wlander-male`
- `speech-manager`
- `desert-rescue`
- `desresc-path`
- `neo-satellite`
- `rope-prim-system-h`
- `rope-prim-system`
- `rope-system`
- `wland-passenger`
- `cty-guard-projectile`
- `ctywide-init`
- `ff-squad-control`
- `guard-grenade`
- `guard-rifle`
- `guard-states`
- `guard-tazer`
- `ctywide-speech`
- `citizen-chick`
- `citizen-fat`
- `citizen-norm`
- `guard`
- `bike`
- `car`
- `test-bike`
- `vehicle-rider`
- `desert-rescue-bbush`
- `ff-squad-control-h`
- `flee-info`
- `guard-h`
- `mission-squad-control`
- `kg-squad-control`
- `kg-squad-member-h`
- `kg-squad-member`
- `mh-squad-control`
- `mh-squad-member-h`
- `mh-squad-member`
- `ctywide-obs-h`
- `ctywide-obs`
- `ctywide-part`
- `ctywide-scenes`
- `ctywide-tasks`
- `ctywide-texture`
- `billiards`
- `guide-arrow`
- `kg-vehicles`
- `flying-turret`
- `roboguard-city`
- `citizen-enemy`
- `metalhead-flitter`
- `metalhead-grunt`
- `metalhead-predator`
- `spydroid`
- `kg-squad-control-h`
- `mh-squad-control-h`
- `krimson-wall`
- `ctyport-obs`
- `ctyinda-obs`
- `ctyinda-part`
- `ctyindb-obs`
- `ctyindb-part`
- `ctyport-attack`
- `h-torpedo`
- `ctyport-part`
- `ctyport-scenes`
- `external-player-control`
- `desert-chase-path-h`
- `desert-chase-path`
- `desert-chase`
- `desert-jump`
- `wcar-catapult`
- `bombbot-h`
- `bombbot`
- `bombbot-path`
- `cty-hijack-missile`
- `cty-hijack`
- `ctyport-attack-bbush`
- `ctysluma-part`
- `ctyslumb-part`
- `ctyslumc-obs`
- `ctyslumc-part`
- `searchlight`
- `cty-destroy-grid`
- `ctyfarm-obs`
- `ctyfarma-part`
- `ctyfarmb-part`
- `freehq-part`
- `freehq-scenes`
- `onintent-scenes`
- `onintent-part`
- `cty-sniper-battery`
- `cty-sniper-turret`
- `intro-obs`
- `intro-part`
- `intro-scenes`
- `palcab-part`
- `palroof-part`
2024-05-09 19:18:55 -04:00

127 lines
3.3 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: speech-manager.gc
;; name in dgo: speech-manager
;; dgos: GAME
;; +++speech-info-flag
(defenum speech-info-flag
:type uint64
:bitfield #t
(si0 0)
(si1 1)
(si2 2)
(si3 3)
(si4 4)
(si5 5)
(si6 6)
(si7 7)
(si8 8)
)
;; ---speech-info-flag
;; DECOMP BEGINS
(deftype speech-instance (structure)
((speech uint16)
(num-play-times int8)
(probability float)
)
)
(deftype speech-info (structure)
((speeches (array speech-instance))
(flags speech-info-flag)
(play-time time-frame)
)
)
(defun mark-speech-played ((arg0 speech-info) (arg1 int))
(logior! (-> arg0 flags) (speech-info-flag si6 si7))
(+! (-> arg0 speeches arg1 num-play-times) 1)
(let ((v0-0 (current-time)))
(set! (-> arg0 play-time) v0-0)
v0-0
)
)
(defun speech-play ((arg0 (array speech-info)) (arg1 int) (arg2 (inline-array talker-speech-class)) (arg3 vector))
(local-vars (v0-0 int))
(let ((s1-0 (-> arg0 arg1))
(v1-2 #xf4240)
(a1-1 0)
(s2-0 #f)
)
(if (and (logtest? (-> s1-0 flags) (speech-info-flag si0)) (logtest? (-> s1-0 flags) (speech-info-flag si6)))
(return -1)
)
(when (and (logtest? (-> s1-0 flags) (speech-info-flag si3)) (logtest? (-> s1-0 flags) (speech-info-flag si7)))
(set! s2-0 #t)
(set! s1-0 (-> arg0 (+ arg1 1)))
)
(if (and (logtest? (-> s1-0 flags) (speech-info-flag si0)) (logtest? (-> s1-0 flags) (speech-info-flag si6)))
(return -1)
)
(dotimes (a0-20 (-> s1-0 speeches length))
(set! v1-2 (min (-> s1-0 speeches a0-20 num-play-times) v1-2))
)
(if (and (> v1-2 0) (logtest? (-> s1-0 flags) (speech-info-flag si4)))
(return -1)
)
(dotimes (a0-26 (-> s1-0 speeches length))
(if (< v1-2 (-> s1-0 speeches a0-26 num-play-times))
(set! a1-1 (logior a1-1 (ash 1 a0-26)))
)
)
(let ((s0-0 0))
(set! s0-0 (cond
((logtest? (-> s1-0 flags) (speech-info-flag si5))
(dotimes (v1-7 (-> s1-0 speeches length))
(when (not (logtest? a1-1 (ash 1 v1-7)))
(set! s0-0 v1-7)
0
(goto cfg-45)
)
)
(label cfg-45)
s0-0
)
(else
(rand-vu-int-count-excluding (-> s1-0 speeches length) a1-1)
)
)
)
(if (logtest? (-> s1-0 flags) (speech-info-flag si8))
(set! arg2 *talker-speech*)
)
(mark-speech-played s1-0 s0-0)
(talker-spawn-func (-> arg2 (-> s1-0 speeches s0-0 speech)) *entity-pool* arg3 (the-as region #f))
(if s2-0
(set-time! (-> arg0 arg1 play-time))
)
(return s0-0)
)
)
v0-0
)
(defun speeches-reset ((arg0 (array speech-info)))
(dotimes (v1-0 (-> arg0 length))
(logclear! (-> arg0 v1-0 flags) (speech-info-flag si6))
(set! (-> arg0 v1-0 play-time) 0)
)
#f
)
(defun speeches-debug-reset ((arg0 (array speech-info)))
(dotimes (v1-0 (-> arg0 length))
(logclear! (-> arg0 v1-0 flags) (speech-info-flag si6 si7))
(set! (-> arg0 0 play-time) 0)
)
#f
)