2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: hud.gc
|
|
|
|
;; name in dgo: hud
|
|
|
|
;; dgos: GAME, ENGINE
|
|
|
|
|
2021-12-30 21:27:35 -05:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
|
|
|
(defmethod relocate hud ((obj hud) (arg0 int))
|
|
|
|
(dotimes (v1-0 (-> obj nb-of-particles))
|
|
|
|
(if (nonzero? (-> obj particles v1-0 part))
|
|
|
|
(&+! (-> obj particles v1-0 part) arg0)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(the-as hud ((method-of-type process relocate) obj arg0))
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod deactivate hud ((obj hud))
|
|
|
|
(dotimes (v1-0 9)
|
|
|
|
(if (and (-> *hud-parts* parts v1-0) (= (ppointer->process (-> *hud-parts* parts v1-0)) obj))
|
2022-05-31 22:19:37 -04:00
|
|
|
(set! (-> *hud-parts* parts v1-0) (the-as (pointer hud) #f))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(dotimes (s5-0 (-> obj nb-of-particles))
|
|
|
|
(kill-and-free-particles (-> obj particles s5-0 part))
|
|
|
|
(set! (-> obj particles s5-0 part matrix) -1)
|
|
|
|
)
|
|
|
|
((method-of-type process deactivate) obj)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod draw-hud hud ((obj hud))
|
|
|
|
(when (and (not (hidden? obj)) (not (paused?)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(dotimes (s5-0 (-> obj nb-of-particles))
|
|
|
|
(when (!= s5-0 (-> obj skip-particle))
|
2022-02-12 12:26:19 -05:00
|
|
|
(if (or (!= (-> obj particles 0 pos x) 0.0) (!= (-> obj particles 0 pos y) 0.0))
|
2021-12-30 21:27:35 -05:00
|
|
|
(spawn (-> obj particles s5-0 part) *null-vector*)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod tally-value hud ((obj hud) (arg0 int) (arg1 int))
|
2021-12-30 21:27:35 -05:00
|
|
|
(if (= arg0 (-> obj target-value))
|
2022-01-15 20:01:38 -05:00
|
|
|
(set! (-> obj last-target-equal-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(when (and (not *progress-process*)
|
|
|
|
(and (!= (-> obj last-hide-time) (-> *display* base-frame-counter))
|
|
|
|
(not (movie?))
|
2022-02-12 12:26:19 -05:00
|
|
|
(>= (- (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) (seconds 0.1))
|
|
|
|
(>= (- (-> *display* base-frame-counter) (-> *game-info* blackout-time)) (seconds 0.1))
|
2022-05-02 18:35:17 -04:00
|
|
|
(not (and *target* (logtest? (-> *target* state-flags) (state-flags sf08))))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(when (or (!= (-> obj value) arg0)
|
|
|
|
(!= (-> obj value2) arg1)
|
|
|
|
(-> obj force-on-screen)
|
|
|
|
(or (and (cpad-hold? 0 l2) (not (-> obj disable)))
|
|
|
|
(and (not *cheat-mode*) (cpad-hold? 0 r2))
|
|
|
|
(-> obj first-init)
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
(cond
|
2022-01-15 20:01:38 -05:00
|
|
|
((and (-> obj increment-on-event)
|
|
|
|
(< (-> obj value) arg0)
|
|
|
|
(not (-> obj first-init))
|
2022-02-12 12:26:19 -05:00
|
|
|
(< (- (-> *display* base-frame-counter) (-> obj last-target-equal-time)) (seconds 1.5))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
|
|
|
(when (and (!= (-> obj value) (-> obj target-value))
|
2022-02-12 12:26:19 -05:00
|
|
|
(>= (- (-> *display* base-frame-counter) (-> obj last-increment-time)) (seconds 0.1))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
|
|
|
|
(+! (-> obj value) 1)
|
2022-01-15 20:01:38 -05:00
|
|
|
(set! (-> obj last-increment-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(else
|
2022-02-12 12:26:19 -05:00
|
|
|
(if (not (and (not (-> obj first-init))
|
|
|
|
(>= (- (-> *display* base-frame-counter) (-> obj last-target-equal-time)) (seconds 1.5))
|
|
|
|
)
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> obj value) arg0)
|
|
|
|
)
|
|
|
|
(set! (-> obj target-value) arg0)
|
2022-01-15 20:01:38 -05:00
|
|
|
(set! (-> obj last-target-equal-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> obj value2) arg1)
|
|
|
|
(when (and (not (movie?)) (= *master-mode* 'game) (not (-> obj first-init)) (not (-> obj disable)))
|
|
|
|
(if (>= (-> obj friend) 0)
|
|
|
|
(send-event (ppointer->process (-> *hud-parts* parts (-> obj friend))) 'show)
|
|
|
|
)
|
|
|
|
(go hud-arriving)
|
|
|
|
)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> obj trigger-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> obj first-init) #f)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod draw-icons hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
(dotimes (v1-0 (-> obj nb-of-icons))
|
|
|
|
(set-vector!
|
|
|
|
(-> obj icons v1-0 icon 0 root scale)
|
|
|
|
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
|
|
|
|
(* (-> obj icons v1-0 scale-y) (-> *video-parms* relative-y-scale))
|
|
|
|
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
|
|
|
|
1.0
|
|
|
|
)
|
|
|
|
(set! (-> obj icons v1-0 icon 0 root trans x)
|
|
|
|
(the float (+ (-> obj icons v1-0 icon-x) -256 (* (-> obj x-sgn) (-> obj offset))))
|
|
|
|
)
|
|
|
|
(set! (-> obj icons v1-0 icon 0 root trans y)
|
|
|
|
(- (+ (the float (-> obj icons v1-0 icon-y))
|
2022-01-15 20:01:38 -05:00
|
|
|
(* (the float (-> obj y-sgn))
|
|
|
|
(the float (-> obj offset))
|
|
|
|
(-> *video-parms* relative-y-scale)
|
|
|
|
(-> *video-parms* relative-y-scale)
|
|
|
|
)
|
|
|
|
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
(the float (-> *video-parms* screen-sy))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod draw-particles hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
(dotimes (s5-0 (-> obj nb-of-particles))
|
|
|
|
(when (!= (-> obj skip-particle) -2)
|
|
|
|
(set! (-> obj particles s5-0 pos x)
|
|
|
|
(+ -256.0 (the float (* (-> obj x-sgn) (-> obj offset))) (-> obj particles s5-0 init-pos x))
|
|
|
|
)
|
|
|
|
(set! (-> obj particles s5-0 pos y)
|
|
|
|
(* 0.5 (- (* (-> *video-parms* relative-y-scale)
|
2022-01-15 20:01:38 -05:00
|
|
|
(+ (-> obj particles s5-0 init-pos y)
|
|
|
|
(the float (* (-> obj y-sgn) (-> obj offset)))
|
2022-02-27 16:44:43 -05:00
|
|
|
(#if PC_PORT
|
|
|
|
(if (not (-> *pc-settings* use-vis?))
|
|
|
|
(* (the float (-> obj y-offset)) (-> *video-parms* relative-y-scale))
|
|
|
|
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
|
|
|
|
)
|
|
|
|
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
|
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
(the float (-> *video-parms* screen-sy))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z))
|
|
|
|
)
|
2022-03-01 20:15:15 -05:00
|
|
|
(#when PC_PORT
|
|
|
|
(if (= *cheat-mode* 'camera) (set! (-> obj particles s5-0 pos x) 1024.0)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(if (> (-> obj particles s5-0 part matrix) 0)
|
|
|
|
(set-vector!
|
|
|
|
(sprite-get-user-hvdf (-> obj particles s5-0 part matrix))
|
|
|
|
(the float (+ (the int (-> obj particles s5-0 pos x)) 2048))
|
|
|
|
(the float (+ (the int (-> obj particles s5-0 pos y)) 2048))
|
|
|
|
(- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z)))
|
|
|
|
(-> *math-camera* hvdf-off w)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod hud-update hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod init-particles! hud ((obj hud) (arg0 int))
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod get-icon-pos-x hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod get-icon-pos-y hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod get-icon-scale-x hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0.0
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod get-icon-scale-y hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0.0
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod set-pos-and-scale hud ((obj hud) (arg0 symbol) (arg1 symbol))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defmethod hidden? hud ((obj hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
(= (-> obj next-state name) 'hud-hidden)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate hud-hidden (hud)
|
2022-06-09 21:18:08 -04:00
|
|
|
:event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
2021-12-30 21:27:35 -05:00
|
|
|
(local-vars (v0-0 object))
|
|
|
|
(case arg2
|
|
|
|
(('show)
|
|
|
|
(if (and (not *progress-process*) (!= (-> self last-hide-time) (-> *display* base-frame-counter)))
|
|
|
|
(go hud-arriving)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(('hide)
|
|
|
|
(set! v0-0 (-> *display* base-frame-counter))
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (the-as time-frame v0-0))
|
2021-12-30 21:27:35 -05:00
|
|
|
v0-0
|
|
|
|
)
|
|
|
|
(('hide-quick)
|
|
|
|
(set! v0-0 (-> *display* base-frame-counter))
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (the-as time-frame v0-0))
|
2021-12-30 21:27:35 -05:00
|
|
|
v0-0
|
|
|
|
)
|
|
|
|
(('increment)
|
|
|
|
(set! v0-0 (+ (-> self target-value) 1))
|
|
|
|
(set! (-> self target-value) (the-as int v0-0))
|
|
|
|
v0-0
|
|
|
|
)
|
|
|
|
(('sync)
|
|
|
|
(set! v0-0 #t)
|
|
|
|
(set! (-> self first-init) (the-as symbol v0-0))
|
|
|
|
v0-0
|
|
|
|
)
|
|
|
|
(('disable)
|
|
|
|
(set! v0-0 #t)
|
|
|
|
(set! (-> self disable) (the-as symbol v0-0))
|
|
|
|
v0-0
|
|
|
|
)
|
|
|
|
(('enable)
|
|
|
|
(set! (-> self disable) #f)
|
|
|
|
#f
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:enter (behavior ()
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self offset) 128)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-icons self)
|
|
|
|
(draw-particles self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(let ((gp-0 (-> self child)))
|
|
|
|
(while gp-0
|
|
|
|
(send-event (ppointer->process gp-0) 'draw #f)
|
|
|
|
(set! gp-0 (-> gp-0 0 brother))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(dotimes (gp-1 (-> self nb-of-particles))
|
|
|
|
(kill-and-free-particles (-> self particles gp-1 part))
|
|
|
|
(set! (-> self particles gp-1 part matrix) -1)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:exit (behavior ()
|
2022-01-15 20:01:38 -05:00
|
|
|
(set! (-> self y-offset) (-> self next-y-offset))
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:code (behavior ()
|
2021-12-30 21:27:35 -05:00
|
|
|
(logior! (-> self mask) (process-mask sleep-code))
|
2022-05-19 21:30:14 -04:00
|
|
|
(loop
|
2021-12-30 21:27:35 -05:00
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:post (behavior ()
|
2021-12-30 21:27:35 -05:00
|
|
|
(if (-> self deactivate-when-hidden)
|
|
|
|
(deactivate self)
|
|
|
|
)
|
2022-05-31 22:19:37 -04:00
|
|
|
(hud-update self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(none)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate hud-arriving (hud)
|
2022-06-09 21:18:08 -04:00
|
|
|
:event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
2021-12-30 21:27:35 -05:00
|
|
|
(local-vars (v0-3 object))
|
|
|
|
(case arg2
|
|
|
|
(('hide-quick)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(set! (-> self offset) 128)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-particles self)
|
|
|
|
(draw-icons self)
|
|
|
|
(hud-update self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(go hud-hidden)
|
|
|
|
)
|
|
|
|
(('hide)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(go hud-leaving 10)
|
|
|
|
)
|
|
|
|
(('show)
|
|
|
|
(if (and (not *progress-process*) (!= (-> self last-hide-time) (-> *display* base-frame-counter)))
|
|
|
|
(go hud-arriving)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(('increment)
|
|
|
|
(set! v0-3 (+ (-> self target-value) 1))
|
|
|
|
(set! (-> self target-value) (the-as int v0-3))
|
|
|
|
v0-3
|
|
|
|
)
|
|
|
|
(('sync)
|
|
|
|
(set! v0-3 #t)
|
|
|
|
(set! (-> self first-init) (the-as symbol v0-3))
|
|
|
|
v0-3
|
|
|
|
)
|
|
|
|
(('disable)
|
|
|
|
(set! v0-3 #t)
|
|
|
|
(set! (-> self disable) (the-as symbol v0-3))
|
|
|
|
v0-3
|
|
|
|
)
|
|
|
|
(('enable)
|
|
|
|
(set! (-> self disable) #f)
|
|
|
|
#f
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:enter (behavior ()
|
2021-12-30 21:27:35 -05:00
|
|
|
(let ((gp-0 (-> self child)))
|
|
|
|
(while gp-0
|
|
|
|
(send-event (ppointer->process gp-0) 'draw #t)
|
|
|
|
(set! gp-0 (-> gp-0 0 brother))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(dotimes (gp-1 (-> self nb-of-particles))
|
|
|
|
(if (= (-> self particles gp-1 part matrix) -1)
|
|
|
|
(set! (-> self particles gp-1 part matrix) (sprite-allocate-user-hvdf))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:code (behavior ()
|
2022-05-19 21:30:14 -04:00
|
|
|
(loop
|
2021-12-30 21:27:35 -05:00
|
|
|
(if (not (paused?))
|
2022-04-18 15:01:44 -04:00
|
|
|
(seekl! (-> self offset) 0 (the int (* 15.0 (-> *display* time-adjust-ratio))))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-icons self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(if (<= (-> self offset) 0)
|
|
|
|
(go hud-in)
|
|
|
|
)
|
|
|
|
(when (movie?)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(set! (-> self offset) 128)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-particles self)
|
|
|
|
(draw-icons self)
|
|
|
|
(hud-update self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(go hud-hidden)
|
|
|
|
)
|
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:post (behavior ()
|
2022-05-31 22:19:37 -04:00
|
|
|
(hud-update self)
|
|
|
|
(draw-particles self)
|
|
|
|
(draw-hud self)
|
2022-01-15 20:01:38 -05:00
|
|
|
(none)
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defstate hud-in (hud)
|
2022-06-09 21:18:08 -04:00
|
|
|
:event (-> hud-arriving event)
|
|
|
|
:code (behavior ()
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self trigger-time) (-> *display* base-frame-counter))
|
|
|
|
(while (and (< (- (-> *display* base-frame-counter) (-> self trigger-time)) (seconds 2)) (not (movie?)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self offset) 0)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-icons self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
(when (movie?)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(set! (-> self offset) 128)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-particles self)
|
|
|
|
(draw-icons self)
|
|
|
|
(hud-update self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(go hud-hidden)
|
|
|
|
)
|
|
|
|
(go hud-leaving 5)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:post (-> hud-arriving post)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defstate hud-leaving (hud)
|
2022-06-09 21:18:08 -04:00
|
|
|
:event (-> hud-arriving event)
|
|
|
|
:code (behavior ((arg0 int))
|
2022-05-19 21:30:14 -04:00
|
|
|
(loop
|
2021-12-30 21:27:35 -05:00
|
|
|
(if (not (paused?))
|
2022-04-18 15:01:44 -04:00
|
|
|
(seekl! (-> self offset) 128 (the int (* (the float arg0) (-> *display* time-adjust-ratio))))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-icons self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(when (movie?)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(set! (-> self offset) 128)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-particles self)
|
|
|
|
(draw-icons self)
|
|
|
|
(hud-update self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(go hud-hidden)
|
|
|
|
)
|
|
|
|
(if (>= (-> self offset) 128)
|
|
|
|
(go hud-hidden)
|
|
|
|
)
|
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:post (-> hud-arriving post)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defbehavior hud-init-by-other hud ((arg0 int))
|
|
|
|
(set! (-> self nb-of-icons) 0)
|
|
|
|
(set! (-> self nb-of-particles) 0)
|
|
|
|
(set! (-> self max-nb-of-particles) 7)
|
|
|
|
(set! (-> self first-init) #t)
|
|
|
|
(set! (-> self friend) -1)
|
2022-01-15 20:01:38 -05:00
|
|
|
(set! (-> self last-increment-time) (-> *display* base-frame-counter))
|
|
|
|
(set! (-> self last-target-equal-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self increment-on-event) #f)
|
|
|
|
(set! (-> self skip-particle) -1)
|
|
|
|
(set! (-> self disable) #f)
|
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(set! (-> self deactivate-when-hidden) #f)
|
|
|
|
(set! (-> self y-offset) 0)
|
|
|
|
(set! (-> self next-y-offset) 0)
|
2022-02-12 12:26:19 -05:00
|
|
|
(set! (-> self last-hide-time) (-> *display* base-frame-counter))
|
2021-12-30 21:27:35 -05:00
|
|
|
(logior! (-> self mask) (process-mask menu))
|
|
|
|
(logclear! (-> self mask) (process-mask pause progress))
|
|
|
|
(init-particles! self arg0)
|
2022-05-31 22:19:37 -04:00
|
|
|
(draw-icons self)
|
|
|
|
(draw-particles self)
|
2021-12-30 21:27:35 -05:00
|
|
|
(go hud-hidden)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun send-hud-increment-event ((arg0 hud))
|
|
|
|
(if (-> arg0 increment-on-event)
|
|
|
|
(send-event arg0 'increment)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2022-05-31 22:19:37 -04:00
|
|
|
(defstate hud-collecting (process-drawable)
|
2022-06-09 21:18:08 -04:00
|
|
|
:trans (behavior ()
|
2021-12-30 21:27:35 -05:00
|
|
|
(case (-> self type)
|
|
|
|
((fuel-cell)
|
|
|
|
(fuel-cell-animate)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:code (behavior ((arg0 handle))
|
2021-12-30 21:27:35 -05:00
|
|
|
(let ((s5-0 (new 'stack-no-clear 'vector)))
|
|
|
|
(let ((s4-0 (handle->process arg0)))
|
2022-05-31 22:19:37 -04:00
|
|
|
(set! (-> s5-0 x) (- (the float (+ (get-icon-pos-x (the-as hud s4-0)) -256)) (-> self root trans x)))
|
|
|
|
(set! (-> s5-0 y)
|
|
|
|
(- (the float (- (get-icon-pos-y (the-as hud s4-0)) (-> *video-parms* screen-sy))) (-> self root trans y))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(let ((f30-0 4.0)
|
|
|
|
(f26-0 0.0)
|
2022-05-31 22:19:37 -04:00
|
|
|
(f28-0 (-> self root scale x))
|
|
|
|
(f24-0 (-> self root scale y))
|
|
|
|
(f22-0 (-> self root scale z))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-05-19 21:30:14 -04:00
|
|
|
(loop
|
2021-12-30 21:27:35 -05:00
|
|
|
(let ((f0-7 (* f30-0 (-> *display* seconds-per-frame))))
|
|
|
|
(+! f26-0 f0-7)
|
|
|
|
(when (< 1.0 f26-0)
|
|
|
|
(let ((f0-8 (- f26-0 f0-7)))
|
|
|
|
(set! f0-7 (- 1.0 f0-8))
|
|
|
|
)
|
|
|
|
(set! f26-0 1.0)
|
|
|
|
)
|
2022-05-31 22:19:37 -04:00
|
|
|
(+! (-> self root trans x) (* f0-7 (-> s5-0 x)))
|
|
|
|
(+! (-> self root trans y) (* f0-7 (-> s5-0 y)))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
(set-vector!
|
2022-05-31 22:19:37 -04:00
|
|
|
(-> self root scale)
|
2021-12-30 21:27:35 -05:00
|
|
|
(* f28-0 (-> *video-parms* relative-x-scale))
|
|
|
|
(* f24-0 (-> *video-parms* relative-y-scale) (-> *video-parms* relative-y-scale))
|
|
|
|
(* f22-0 (-> *video-parms* relative-x-scale))
|
|
|
|
1.0
|
|
|
|
)
|
2022-05-31 22:19:37 -04:00
|
|
|
(let ((a0-12 (-> self root)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set-yaw-angle-clear-roll-pitch!
|
|
|
|
a0-12
|
|
|
|
(- (y-angle a0-12) (* 182.04445 (* 8.0 (-> *display* time-adjust-ratio))))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(suspend)
|
|
|
|
(when (>= f26-0 1.0)
|
|
|
|
(send-hud-increment-event (the-as hud (handle->process arg0)))
|
|
|
|
(deactivate self)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:post ja-post
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-02 09:28:06 -04:00
|
|
|
|