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
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod relocate ((this hud) (arg0 int))
|
2023-09-26 10:17:00 -04:00
|
|
|
(dotimes (v1-0 (-> this nb-of-particles))
|
|
|
|
(if (nonzero? (-> this particles v1-0 part))
|
|
|
|
(&+! (-> this particles v1-0 part) arg0)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(the-as hud ((method-of-type process relocate) this arg0))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod deactivate ((this hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
(dotimes (v1-0 9)
|
2023-09-26 10:17:00 -04:00
|
|
|
(if (and (-> *hud-parts* parts v1-0) (= (ppointer->process (-> *hud-parts* parts v1-0)) this))
|
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
|
|
|
)
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(dotimes (s5-0 (-> this nb-of-particles))
|
|
|
|
(kill-and-free-particles (-> this particles s5-0 part))
|
|
|
|
(set! (-> this particles s5-0 part matrix) -1)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
((method-of-type process deactivate) this)
|
2021-12-30 21:27:35 -05:00
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod draw-hud ((this hud))
|
2023-09-26 10:17:00 -04:00
|
|
|
(when (and (not (hidden? this)) (not (paused?)))
|
|
|
|
(dotimes (s5-0 (-> this nb-of-particles))
|
|
|
|
(when (!= s5-0 (-> this skip-particle))
|
|
|
|
(if (or (!= (-> this particles 0 pos x) 0.0) (!= (-> this particles 0 pos y) 0.0))
|
|
|
|
(spawn (-> this particles s5-0 part) *null-vector*)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod tally-value ((this hud) (arg0 int) (arg1 int))
|
2023-09-26 10:17:00 -04:00
|
|
|
(if (= arg0 (-> this target-value))
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> this last-target-equal-time))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(when (and (not *progress-process*)
|
2023-10-29 23:20:02 -04:00
|
|
|
(and (!= (-> this last-hide-time) (current-time))
|
2022-01-15 20:01:38 -05:00
|
|
|
(not (movie?))
|
2023-10-29 23:20:02 -04:00
|
|
|
(time-elapsed? (-> *game-info* letterbox-time) (seconds 0.1))
|
|
|
|
(time-elapsed? (-> *game-info* blackout-time) (seconds 0.1))
|
2022-06-12 15:29:30 -04:00
|
|
|
(not (and *target* (logtest? (-> *target* state-flags) (state-flags grabbed))))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(when (or (!= (-> this value) arg0)
|
|
|
|
(!= (-> this value2) arg1)
|
|
|
|
(-> this force-on-screen)
|
|
|
|
(or (and (cpad-hold? 0 l2) (not (-> this disable)))
|
2022-01-15 20:01:38 -05:00
|
|
|
(and (not *cheat-mode*) (cpad-hold? 0 r2))
|
2023-09-26 10:17:00 -04:00
|
|
|
(-> this first-init)
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2022-09-24 12:27:44 -04:00
|
|
|
;; modified for pc port
|
|
|
|
(cond
|
|
|
|
((cpad-hold? 0 up)
|
|
|
|
(set! *hud-collectable-view* (hud-collectable-view game-totals))
|
|
|
|
)
|
|
|
|
((cpad-hold? 0 down)
|
|
|
|
(set! *hud-collectable-view* (hud-collectable-view level-totals))
|
|
|
|
)
|
|
|
|
((or (cpad-hold? 0 left) (cpad-hold? 0 right))
|
|
|
|
(set! *hud-collectable-view* (hud-collectable-view original))
|
|
|
|
)
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
(cond
|
2023-09-26 10:17:00 -04:00
|
|
|
((and (-> this increment-on-event)
|
|
|
|
(< (-> this value) arg0)
|
|
|
|
(not (-> this first-init))
|
2023-10-29 23:20:02 -04:00
|
|
|
(not (time-elapsed? (-> this last-target-equal-time) (seconds 1.5)))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2023-10-29 23:20:02 -04:00
|
|
|
(when (and (!= (-> this value) (-> this target-value)) (time-elapsed? (-> this last-increment-time) (seconds 0.1)))
|
2022-06-13 18:39:22 -04:00
|
|
|
(sound-play "cursor-options")
|
2023-09-26 10:17:00 -04:00
|
|
|
(+! (-> this value) 1)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> this last-increment-time))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(else
|
2023-10-29 23:20:02 -04:00
|
|
|
(if (not (and (not (-> this first-init)) (time-elapsed? (-> this last-target-equal-time) (seconds 1.5))))
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this value) arg0)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this target-value) arg0)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> this last-target-equal-time))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this value2) arg1)
|
|
|
|
(when (and (not (movie?)) (= *master-mode* 'game) (not (-> this first-init)) (not (-> this disable)))
|
|
|
|
(if (>= (-> this friend) 0)
|
|
|
|
(send-event (ppointer->process (-> *hud-parts* parts (-> this friend))) 'show)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
(go hud-arriving)
|
|
|
|
)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> this trigger-time))
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this first-init) #f)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod draw-icons ((this hud))
|
2023-09-26 10:17:00 -04:00
|
|
|
(dotimes (v1-0 (-> this nb-of-icons))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set-vector!
|
2023-09-26 10:17:00 -04:00
|
|
|
(-> this icons v1-0 icon 0 root scale)
|
|
|
|
(* (-> this icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
|
|
|
|
(* (-> this icons v1-0 scale-y) (-> *video-parms* relative-y-scale))
|
|
|
|
(* (-> this icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
|
2021-12-30 21:27:35 -05:00
|
|
|
1.0
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this icons v1-0 icon 0 root trans x)
|
|
|
|
(the float (+ (-> this icons v1-0 icon-x) -256 (* (-> this x-sgn) (-> this offset))))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this icons v1-0 icon 0 root trans y)
|
|
|
|
(- (+ (the float (-> this icons v1-0 icon-y))
|
|
|
|
(* (the float (-> this y-sgn))
|
|
|
|
(the float (-> this offset))
|
2022-01-15 20:01:38 -05:00
|
|
|
(-> *video-parms* relative-y-scale)
|
|
|
|
(-> *video-parms* relative-y-scale)
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(* (the float (-> this 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))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod draw-particles ((this hud))
|
2023-09-26 10:17:00 -04:00
|
|
|
(dotimes (s5-0 (-> this nb-of-particles))
|
|
|
|
(when (!= (-> this skip-particle) -2)
|
|
|
|
(set! (-> this particles s5-0 pos x)
|
|
|
|
(+ -256.0 (the float (* (-> this x-sgn) (-> this offset))) (-> this particles s5-0 init-pos x))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this particles s5-0 pos y)
|
2021-12-30 21:27:35 -05:00
|
|
|
(* 0.5 (- (* (-> *video-parms* relative-y-scale)
|
2023-09-26 10:17:00 -04:00
|
|
|
(+ (-> this particles s5-0 init-pos y)
|
|
|
|
(the float (* (-> this y-sgn) (-> this offset)))
|
|
|
|
;; og:preserve-this
|
2022-02-27 16:44:43 -05:00
|
|
|
(#if PC_PORT
|
|
|
|
(if (not (-> *pc-settings* use-vis?))
|
2023-09-26 10:17:00 -04:00
|
|
|
(* (the float (-> this y-offset)) (-> *video-parms* relative-y-scale))
|
|
|
|
(* (the float (-> this y-offset)) (-> *video-parms* relative-x-scale-reciprical))
|
2022-02-27 16:44:43 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(* (the float (-> this y-offset)) (-> *video-parms* relative-x-scale-reciprical))
|
2022-02-27 16:44:43 -05:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
|
|
|
)
|
2021-12-30 21:27:35 -05:00
|
|
|
(the float (-> *video-parms* screen-sy))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this particles s5-0 pos z) (-> this particles s5-0 init-pos z))
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(if (> (-> this particles s5-0 part matrix) 0)
|
2021-12-30 21:27:35 -05:00
|
|
|
(set-vector!
|
2023-09-26 10:17:00 -04:00
|
|
|
(sprite-get-user-hvdf (-> this particles s5-0 part matrix))
|
|
|
|
(the float (+ (the int (-> this particles s5-0 pos x)) 2048))
|
|
|
|
(the float (+ (the int (-> this particles s5-0 pos y)) 2048))
|
|
|
|
(- (-> *math-camera* hvdf-off z) (* 1024.0 (-> this particles s5-0 pos z)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(-> *math-camera* hvdf-off w)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod hud-update ((this hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod init-particles! ((this hud) (arg0 int))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod get-icon-pos-x ((this hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod get-icon-pos-y ((this hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod get-icon-scale-x ((this hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0.0
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod get-icon-scale-y ((this hud))
|
2021-12-30 21:27:35 -05:00
|
|
|
0.0
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod set-pos-and-scale ((this hud) (arg0 symbol) (arg1 symbol))
|
2021-12-30 21:27:35 -05:00
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod hidden? ((this hud))
|
2023-09-26 10:17:00 -04:00
|
|
|
(= (-> this next-state name) 'hud-hidden)
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defstate hud-hidden (hud)
|
2023-09-22 05:54:49 -04:00
|
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
2021-12-30 21:27:35 -05:00
|
|
|
(local-vars (v0-0 object))
|
2023-09-22 05:54:49 -04:00
|
|
|
(case message
|
2021-12-30 21:27:35 -05:00
|
|
|
(('show)
|
2023-10-29 23:20:02 -04:00
|
|
|
(if (and (not *progress-process*) (!= (-> self last-hide-time) (current-time)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(go hud-arriving)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(('hide)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set! v0-0 (current-time))
|
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)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set! v0-0 (current-time))
|
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)
|
|
|
|
)
|
|
|
|
)
|
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))
|
|
|
|
)
|
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)
|
|
|
|
)
|
|
|
|
)
|
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
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate hud-arriving (hud)
|
2023-09-22 05:54:49 -04:00
|
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
2021-12-30 21:27:35 -05:00
|
|
|
(local-vars (v0-3 object))
|
2023-09-22 05:54:49 -04:00
|
|
|
(case message
|
2021-12-30 21:27:35 -05:00
|
|
|
(('hide-quick)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-hide-time))
|
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)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-hide-time))
|
2021-12-30 21:27:35 -05:00
|
|
|
(set! (-> self force-on-screen) #f)
|
|
|
|
(go hud-leaving 10)
|
|
|
|
)
|
|
|
|
(('show)
|
2023-10-29 23:20:02 -04:00
|
|
|
(if (and (not *progress-process*) (!= (-> self last-hide-time) (current-time)))
|
2021-12-30 21:27:35 -05:00
|
|
|
(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))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
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?)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-hide-time))
|
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)
|
|
|
|
)
|
|
|
|
)
|
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
|
|
|
)
|
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 ()
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self trigger-time))
|
|
|
|
(while (and (not (time-elapsed? (-> 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?)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-hide-time))
|
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)
|
|
|
|
)
|
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?)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-hide-time))
|
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)
|
|
|
|
)
|
|
|
|
)
|
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)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-increment-time))
|
|
|
|
(set-time! (-> self last-target-equal-time))
|
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)
|
2023-10-29 23:20:02 -04:00
|
|
|
(set-time! (-> self last-hide-time))
|
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)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
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
|
2023-10-29 23:20:02 -04:00
|
|
|
(let ((f0-7 (* f30-0 (seconds-per-frame))))
|
2021-12-30 21:27:35 -05:00
|
|
|
(+! 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)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:post ja-post
|
2021-12-30 21:27:35 -05:00
|
|
|
)
|