Skip to content

Commit

Permalink
Add palace skip (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zedb0T authored and dallmeyer committed Aug 29, 2024
1 parent 7f1a21f commit 0fa576d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 17 deletions.
16 changes: 16 additions & 0 deletions goal_src/jak2/engine/level/level.gc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ into 7 sections, which might explain the weird sizes in the center.

(define-extern level-update-after-load (function level login-state level))
(define-extern *level-type-list* type)
(defun-extern do-palace-skip none)

(defglobalconstant NUM_LEVEL_PAGES 146)
(defglobalconstant LEVEL_PAGE_SIZE_KB 126) ;; original value
Expand Down Expand Up @@ -2785,6 +2786,21 @@ into 7 sections, which might explain the weird sizes in the center.
)
)
)
;;Add hook for palace skip
(when #t
(dotimes (s5-3 (-> this length))
(let ((v1-96 (-> this level s5-3)))
(when (= (-> v1-96 status) 'active)
(if (and (= (-> v1-96 status) 'active)
(!= (-> v1-96 display?) 'special)
(nonzero? (-> v1-96 bsp cam-outside-bsp))
)
(do-palace-skip)
)
)
)
)
)
(countdown (v1-100 LEVEL_MAX)
(when (-> this level v1-100 inside-boxes)
(set! v1-101 #f)
Expand Down
41 changes: 24 additions & 17 deletions goal_src/jak2/engine/mods/mod-common-functions.gc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
;; Useful GOAL modding documentation
;;;;;;;;;;;;;;;;;;;;;;;;;;

#|
#|
Checks the condition and if it is true it does first argument if false it does optional second argument
(if (condition) (do if true) (do if false))
Expand All @@ -45,6 +45,13 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't

;; add your own unique custom functions here!

(defun do-palace-skip ()
(if (= (-> (level-get-target-inside *level* ) name) 'palshaft)
(set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "palshaft-lobby"))
)
(none)
)

;; Macros can be used more-or-less just like functions
(defmacro current-cell-count ()
`(-> *game-info* fuel)
Expand All @@ -53,7 +60,7 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't
(defmacro set-current-cell-count (count)
`(set! (-> *game-info* fuel) ,count)
)

(defun increase-power-cell-by-one ()
(set-current-cell-count (+ (current-cell-count) 1))
;; with the two macros defined above, this is equivalent to
Expand Down Expand Up @@ -83,7 +90,7 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't
(defmacro current-level-name ()
`(-> (level-get-target-inside *level*) name)
)

(defmacro current-orb-count ()
`(-> *game-info* money)
)
Expand All @@ -102,14 +109,14 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't
(when actor
(case (-> actor type)
((skill)

(set-vector! (-> entity-actor trans) (meters x) (meters y) (meters z) 1.0)
(set-vector! (-> entity-actor extra trans) (meters x) (meters y) (meters z) 1.0)
(set-vector! (-> (the process-drawable actor) root trans) (meters x) (meters y) (meters z) 1.0)
(set-vector! (-> (the money actor) base) (meters x) (meters y) (meters z) 1.0)



)
((crate)
;; only move crates if they're not jumping
Expand Down Expand Up @@ -168,7 +175,7 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't
(none)
)


)
)

Expand Down Expand Up @@ -275,11 +282,11 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't

;;This returns true or false depending on if jak is within a provided distance from an actor
(defun close? ((actor-ename string) (dist float))
(and
(and
(process-by-ename actor-ename)
(<=
(vector-vector-distance
(target-pos 0)
(<=
(vector-vector-distance
(target-pos 0)
(-> (the process-drawable (process-by-ename actor-ename)) root trans)
)
dist
Expand All @@ -290,9 +297,9 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't

;;This returns true or false if jak is within a bubble defined by coordiantes and width
(defun in-bubble? ((x float) (y float) (z float) (w float))
(<=
(vector-vector-distance
(target-pos 0)
(<=
(vector-vector-distance
(target-pos 0)
(set-vector! (new-stack-vector0) x y z 1.0)
)
(/ w 2.0)
Expand Down Expand Up @@ -345,9 +352,9 @@ if the result of rand-vu-int-range is 1, then DANCE! if it is not 1, then Don't
;; make sure it doesn't timeout and disappear
(logior! (-> fax options) (actor-option fade-out))
(set! (-> fax fade-time) (the-as time-frame 0))

(let ((proc (the skill (ppointer->process (birth-pickup-at-point vec (pickup-type skill) amount #t *active-pool* fax)))))
(when bob?
(when bob?
(set! (-> proc bob-amount) 1024.0)
)
(format 0 "spawned ~A~%" proc)
Expand Down

0 comments on commit 0fa576d

Please sign in to comment.