minor fixes to pc goal code (#1442)

* sound fixes especially for inf eco

* minor cleanup

* blue eco fixes
This commit is contained in:
ManDude
2022-06-11 21:52:19 +01:00
committed by GitHub
parent 9fdf0bbc2f
commit 7c5c7003b3
6 changed files with 650 additions and 750 deletions
@@ -506,7 +506,7 @@
],
"game-info": [
[17, "(function symbol symbol continue-point symbol none)"],
[17, "(function symbol symbol continue-point game-save none)"],
[6, "(function process-drawable none)"],
[7, "(function none :behavior process-drawable)"],
[8, "(function object)"]
File diff suppressed because it is too large Load Diff
+14 -31
View File
@@ -337,20 +337,16 @@
`(with-pp
(let ((proc (the process-drawable pp)))
;(format 0 "get proc~%")
(when (= ,sound-trans #t)
;(format 0 "trans #t~%")
(if (and proc
(type-type? (-> proc type) process-drawable)
(nonzero? (-> proc root)))
(set! ,sound-trans (-> proc root trans))
(set! ,sound-trans (the vector #f))
)
;(format 0 "trans is ~A~%" ,sound-trans)
)
)
;(format 0 "convert~%" ,sound-trans)
(sound-trans-convert (-> ,cmd parms trans) ,sound-trans)
)
)
@@ -359,37 +355,24 @@
"Play a sound called name with the specified params"
(local-vars (sv-16 int))
(with-pp
(set! sv-16 group)
(let ((sound-trans (the-as structure trans)))
(set! sv-16 group)
(let ((sound-trans (the-as vector trans)))
(when *sound-player-enable*
(let ((cmd (the-as sound-rpc-play (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command play))
(set! (-> cmd id) id)
(set! (-> cmd name) name)
(set! (-> cmd parms mask) (sound-mask))
(set! (-> cmd parms group) (the-as uint sv-16))
(set! (-> cmd parms volume) vol)
(set! (-> cmd parms pitch-mod) pitch)
(set! (-> cmd parms bend) bend)
(let ((proc (the-as process-drawable pp)))
(when (= (the-as symbol sound-trans) #t)
(if
(and
proc
(type-type? (-> proc type) process-drawable)
(nonzero? (-> proc root))
)
(set! sound-trans (-> proc root trans))
(set! sound-trans #f)
)
(let ((cmd (the-as sound-rpc-play (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command play))
(set! (-> cmd id) id)
(set! (-> cmd name) name)
(set! (-> cmd parms mask) (sound-mask))
(set! (-> cmd parms group) (the-as uint sv-16))
(set! (-> cmd parms volume) vol)
(set! (-> cmd parms pitch-mod) pitch)
(set! (-> cmd parms bend) bend)
(sound-trans-from-process cmd sound-trans)
)
)
(sound-trans-convert (-> cmd parms trans) (the-as vector sound-trans))
)
)
)
)
id
)
+1 -1
View File
@@ -82,7 +82,7 @@
&key scale-y
&key (entity #f)
)
`(when (< (-> ,obj nb-of-icons) 6)
`(when (< (-> ,obj nb-of-icons) ,max)
(let ((icon-idx (-> ,obj nb-of-icons)))
(set! (-> ,obj icons icon-idx) (new 'static 'hud-icon))
(let ((new-manipy (manipy-spawn (new 'static 'vector :w 1.0) ,entity ,skel #f
+33 -19
View File
@@ -90,7 +90,7 @@
(defmethod commit-to-file pc-settings ((obj pc-settings))
"commits the current settings to the file"
;; auto load settings if available
(format (clear *pc-temp-string-1*) "~S/pc-settings.gc" *pc-settings-folder*)
(pc-mkdir-file-path *pc-temp-string-1*)
(write-to-file obj *pc-temp-string-1*)
@@ -320,44 +320,58 @@
(when *target*
;; TODO green eco hack here as well
(with-pp (protect ((-> *target* fact-info-target eco-source) *sound-player-enable*)
;; act as if this isnt a new source of eco to prevent spamming sounds. then restore the old source!
(when (< 0 (-> *target* fact-info-target eco-level))
(set! (-> *target* fact-info-target eco-source) (process->handle pp))
(false! *sound-player-enable*)
)
;; blue eco!
(when (and (pc-cheats? obj eco-blue)
(or (= (-> *target* fact-info-target eco-type) (pickup-type eco-blue))
(<= (-> *target* fact-info-target eco-level) 0.0)))
(send-event *target* 'get-pickup (pickup-type eco-blue) (-> *FACT-bank* eco-full-inc)))
(protect ((-> *target* event-hook))
(set! (-> *target* event-hook) target-generic-event-handler)
(send-event *target* 'get-pickup (pickup-type eco-blue) (-> *FACT-bank* eco-full-inc))
)
(send-event *target* 'boost (-> *FACT-bank* eco-single-inc)))
;; yellow eco!
(when (and (pc-cheats? obj eco-yellow)
(or (= (-> *target* fact-info-target eco-type) (pickup-type eco-yellow))
(<= (-> *target* fact-info-target eco-level) 0.0)))
(send-event *target* 'get-pickup (pickup-type eco-yellow) (-> *FACT-bank* eco-full-inc)))
;; red eco!
(when (and (pc-cheats? obj eco-red)
(or (= (-> *target* fact-info-target eco-type) (pickup-type eco-red))
(<= (-> *target* fact-info-target eco-level) 0.0)))
(send-event *target* 'get-pickup (pickup-type eco-red) (-> *FACT-bank* eco-full-inc)))
;; green eco!
(when (and (pc-cheats? obj eco-green)
(or (= (-> *target* fact-info-target eco-type) (pickup-type eco-green))
(<= (-> *target* fact-info-target eco-level) 0.0)))
(with-pp
(define-extern vent type)
(protect ((-> (the basic pp) type) (-> *target* control root-prim prim-core action))
(set! (-> (the basic pp) type) vent)
(logior! (-> *target* control root-prim prim-core action) #x200)
(protect ((-> pp type) (-> *target* control root-prim prim-core action))
(set! (-> pp type) vent)
(logior! (-> *target* control root-prim prim-core action) (collide-action ca-9))
(send-event *target* 'get-pickup (pickup-type eco-green) (-> *FACT-bank* eco-full-inc)))
))
)
))
(when (pc-cheats? obj invinc)
(logior! (-> *target* state-flags) 16)
(logior! (-> *target* state-flags) (state-flags sf04))
)
)
(if (pc-cheats? obj tunes)
(set! (-> obj flava-hack) -1)
(set! (-> obj flava-hack) 0)
)
(logior! (-> obj cheats-known) (-> obj cheats))
0)
@@ -365,7 +379,7 @@
(defmethod add-to-music-log pc-settings ((obj pc-settings) (music symbol) (flava int))
"add music and flava information to the music log.
if music already exists, adds flava. if flava already exists, nothing happens."
;; go through our music log
(dotimes (i PC_MUSIC_LOG_LENGTH)
(cond
@@ -383,15 +397,15 @@
;; something else. maybe the wrong entry, in which case nothing to do.
)
)
0)
(defmethod update-music-log pc-settings ((obj pc-settings))
"update music log settings."
;; add whatever is playing to the music log.
(add-to-music-log obj (-> *setting-control* current music) (the int (-> *setting-control* current sound-flava)))
;; special cases. for example, npc's that despawn and you can't hear their music anymore.
(if (task-closed? (game-task beach-ecorocks) (task-status need-introduction))
(add-to-music-log obj 'village1 1))
@@ -428,7 +442,7 @@
(add-to-music-log obj 'credits 1)
(add-to-music-log obj 'credits 2)
)
0)
@@ -472,12 +486,12 @@
(defun-debug print-music-log ((out object))
"prints the *pc-settings* music log."
(dotimes (i PC_MUSIC_LOG_LENGTH)
(if (-> *pc-settings* secrets music i name)
(format out "music log ~D: ~A (f #x~x)~%" i (-> *pc-settings* secrets music i name) (-> *pc-settings* secrets music i flava-mask)))
)
0)
@@ -883,7 +897,7 @@
(defmethod load-settings pc-settings ((obj pc-settings))
"load"
(format (clear *pc-temp-string-1*) "~S/pc-settings.gc" *pc-settings-folder*)
(if (pc-filepath-exists? *pc-temp-string-1*)
(begin
+2 -2
View File
@@ -257,12 +257,12 @@
)
(let ((s2-0 (the-as (function cpu-thread function object object object object pointer) set-to-run))
(s1-0 (-> s3-1 main-thread))
(s0-0 (lambda ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 symbol))
(s0-0 (lambda ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save))
(stop arg0)
(reset-actors arg1)
(set-continue! *game-info* arg2)
(when arg3
(load-game! *game-info* (the-as game-save arg3))
(load-game! *game-info* arg3)
(set! arg2 (get-or-create-continue! *game-info*))
)
(suspend)