Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion game/assets/jak3/text/game_custom_text_en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,23 @@
"1369": "Light Regeneration",
"136a": "Light Flight",
"136b": "Flash Freeze",
"136c": "Light Shield"
"136c": "Light Shield",

"2000": "<PAD_TRIANGLE>",
"2001": "<PAD_CIRCLE>",
"2002": "<PAD_X>",
"2003": "<PAD_SQUARE>",

"10000": "Haven City Port",
"10001": "Desert Wasteland",
"10002": "Volcano",
"10003": "Temple (Entrance)",
"10004": "Temple (Oracle)",
"10005": "Temple (Ruins)",
"10006": "Power Station",

"100000": "Select Destination",
"100001": "No Menu Data",
"100002": "Next Page",
"100003": "Previous Page"
}
2 changes: 1 addition & 1 deletion goal_src/jak2/engine/mods/air-train-menu/air-train-menu.gc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
:trans (behavior ()
;(format *stdcon* "selected: ~D~%" *wm-selected*)
;(format *stdcon* "page: ~D~%" (-> self page))
(when (time-elapsed? (-> self state-time) (seconds 1.5))
(when (time-elapsed? (-> self state-time) (seconds 0.5))
(warp-select-menu self)
(when (cpad-pressed? 0 triangle)
(when (and (not (process-grab? *target* #f)) (not (real-movie?)))
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/engine/mods/warp-gate-menu/warp-gate-menu.gc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
:trans (behavior ()
;(format *stdcon* "selected: ~D~%" *wm-selected*)
;(format *stdcon* "page: ~D~%" (-> self page))
(when (time-elapsed? (-> self state-time) (seconds 1.5))
(when (time-elapsed? (-> self state-time) (seconds 0.5))
(warp-select-menu self)
(when (cpad-pressed? 0 triangle)
(when (and (not (process-grab? *target* #f)) (not (real-movie?)))
Expand Down
13 changes: 12 additions & 1 deletion goal_src/jak3/dgos/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
"pckernel.o" ;; added
"subtitle3-h.o" ;; added
"subtitle3.o" ;; added
"input-display.o" ;;added ;;mod-base-change
"main.o"
"collide-cache.o"
"collide-debug.o"
Expand Down Expand Up @@ -481,7 +482,12 @@
"simple-nav-sphere.o"
"process-taskable.o"
"scene-actor.o"
"warp-gate.o"
"warp-gate.o" ;; original warp-gate logic - be sure to comment this out if using the menu system logic below
;"warp-gate-menu-h.o" ;; added - warp-gate menu definitions file (commented out by default)
;"air-train-menu-h.o" ;; added - air-train menu definitions file (commented out by default)
;"warp-gate-menu-data.o" ;; added - type definitions for warp-gate and air-train with menu logic (commented out by default)
;"warp-gate-menu.o" ;; added - warp-gate menu logic (commented out by default)
;"air-train-menu.o" ;; added - air-train menu logic (commented out by default)
"guard-projectile.o"
"metalhead-projectile.o"
"los-control.o"
Expand All @@ -490,4 +496,9 @@
"debris.o"
"shield-sphere.o"
"entity-debug.o" ;; added
"mod-settings.o" ;; added ;;mod-base-change
"mod-common-functions.o" ;; added
"orb-placer.o" ;; added
"mod-custom-code.o" ;; added
"mod-debug.o" ;; added
))
1 change: 1 addition & 0 deletions goal_src/jak3/engine/debug/default-menu.gc
Original file line number Diff line number Diff line change
Expand Up @@ -4024,6 +4024,7 @@
arg0
'(menu
"Display"
(flag "Input Display" *show-input-display* dm-boolean-toggle-pick-func) ;; mod-base-change
(flag "Profile" *display-profile* dm-boolean-toggle-pick-func)
(flag "Ticks" *profile-ticks* dm-boolean-toggle-pick-func)
(flag "File Info" *display-file-info* dm-boolean-toggle-pick-func)
Expand Down
2 changes: 2 additions & 0 deletions goal_src/jak3/engine/game/main.gc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

(define-extern menu-respond-to-pause (function symbol))
(define-extern anim-tester-add-object (function string none))
(defun-extern runs-every-frame (none)) ;; mod-base-change

;; DECOMP BEGINS

Expand Down Expand Up @@ -1493,6 +1494,7 @@
(if (-> *level* loading-level)
(load-continue (-> *level* loading-level))
)
(runs-every-frame) ;; mod-base-change

;; run the drawing system!
;; (note that this does a significant amount of non-drawing stuff, like collision callbacks, actors-update,
Expand Down
13 changes: 13 additions & 0 deletions goal_src/jak3/engine/gfx/font.gc
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@
)
(none)
)

;; Added for PC port
(defun draw-string-xy-scaled ((str string) (buf dma-buffer) (x int) (y int) (color font-color) (flags font-flags) (scale float))
"Draw a string at the given xy location, with the given scale."
(let ((font-ctxt (new 'stack 'font-context *font-default-matrix* x y 0.0 color flags)))
(*! (-> font-ctxt scale) scale)
(*! (-> font-ctxt width) scale)
(*! (-> font-ctxt height) scale)
(draw-string str buf font-ctxt)
)
(none)
)

11 changes: 6 additions & 5 deletions goal_src/jak3/engine/level/level-info.gc
Original file line number Diff line number Diff line change
Expand Up @@ -17846,10 +17846,11 @@
:name "templed-warp"
:level 'templed
:flags (continue-flags no-auto warp-gate)
:trans (new 'static 'vector :x 17512212.0 :y 389120.0 :z 18223136.0 :w 1.0)
:camera-trans (new 'static 'vector :x 17555770.0 :y 409207.2 :z 18242222.0 :w 1.0)
:quat (new 'static 'vector4h :data (new 'static 'array int16 4 0 -19542 0 -26298))
:camera-rot (new 'static 'array int16 9 -13637 0 #x745f -4384 #x7e99 -2005 -29467 -4823 -13490)
;; mod-base-change changed jak and camera misaligned initial transforms for this checkpoint
:trans (new 'static 'vector :x (meters 4279.29) :y (meters 95.18) :z (meters 4446.81) :w 1.0)
:camera-trans (new 'static 'vector :x 17576318.0 :y 410942.1562 :z 18230798.0 :w 1.0)
:quat (new 'static 'vector4h :data (new 'static 'array int16 4 0 -19005 0 -26542))
:camera-rot (new 'static 'array int16 9 -10636 0 31001 -4712 32384 -1615 -30631 -4984 -10511)
:on-goto #f
:vis-nick 'templed
:vehicle-type #x1b
Expand Down Expand Up @@ -18166,7 +18167,7 @@
:camera-trans (new 'static 'vector :x -519551.78 :y 18144.46 :z -1833278.2 :w 1.0)
:quat (new 'static 'vector4h :data (new 'static 'array int16 4 -3 -24001 0 -22304))
:camera-rot (new 'static 'array int16 9 -4826 0 #x7e96 -6097 #x7db4 -907 -31829 -6166 -4741)
:on-goto #f
:on-goto '(begin (kill "vol-holo-eye-1" store #f)) ;;mod-base-change kill "vol-holo-eye-1" when entering volcano via warp-gate
:vis-nick 'volcanox
:vehicle-type #x1b
:want-count 1
Expand Down
125 changes: 125 additions & 0 deletions goal_src/jak3/engine/mods/air-train-menu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## Air Train / Warp Gate Destination Menu System

This branch implements a menu system that allows you to select and teleport to a destination using any Air Train or Warp Gate in the game.
It also supports adding custom destination menus for Air Trains and Warp Gates in your own custom levels.

**Note:** This system is **disabled by default**. To enable it, go to:
`<ROOT FOLDER>\goal_src\jak3\dgos\game.gd`
Scroll to the bottom of the file and **uncomment all the lines related to the menu system**, and **comment out** the original `warp-gate.gc` line.

The image below highlights the files that need to be uncommented:

<img width="1161" height="465" alt="img1" src="https://github.com/user-attachments/assets/8ff658af-0f3e-4a7e-a6d2-649e353f9274" />

Below are two examples: one showing **how to add new options to existing menus for Air Trains**, and another demonstrating **how to assign a new menu to an Air Train entity placed in a custom level**.

### 1. How to add new options to existing menus for Air Trains

#### 1.1. Open the Menu Definitions File
Go to:
`<ROOT FOLDER>\goal_src\jak3\engine\mods\air-train-menu\air-train-menu-h.gc`
After opening this file, you will see this:

<img width="1246" height="919" alt="img2" src="https://github.com/user-attachments/assets/f65239e9-39ad-4e0c-b84d-5e472fe00098" />

As you can see, this file defines the Air Train destination menus for all vanilla entities.

Just below that, you’ll find the definition for `*air-train-1-menu-data*`, which in this case defines a menu with only one destination option: `Desert Wasteland` for the Haven City Port Air Train.

#### 1.2. Add a New Entry for Eco Mine (Example)
Now, let’s suppose you want to add a new destination where Jak can be teleported to **Eco Mine**.
To do this, simply copy the existing entry and paste it below.

Then adjust the values as follows:
- Set the `level-name` to `'minec`
- Set the `continue-name` to `"minec-start"` (the name of the checkpoint Jak will warp to)
- Set `allow-when` to `#f` if you don’t want to restrict it to a specific task
- Leave `on-activate` empty or remove it if no action is needed

You should end up with something like this:

<img width="1053" height="462" alt="img3" src="https://github.com/user-attachments/assets/7009897b-6fc2-4bec-ae69-c96304a7a82e" />

#### 1.3. Add the Display Text

Now, for the `text-id`, you’ll need to add a new text entry so that the option appears as **Eco Mine** instead of reusing a label like `Desert Wasteland`.

Go to:
`<ROOT FOLDER>\game\assets\jak3\text\game_custom_text_en-US.json`
Scroll to the end and add:

<img width="676" height="306" alt="img4" src="https://github.com/user-attachments/assets/ec222c3f-a823-4888-93c4-30729e23df04" />

Then go to:
`<ROOT FOLDER>\goal_src\jak3\engine\ui\text-h.gc`
Scroll down and add the corresponding `text-id` constant:

<img width="621" height="361" alt="img5" src="https://github.com/user-attachments/assets/15d497b0-40a7-4420-af72-74045bda19c7" />

Finally, go back to:
`<ROOT FOLDER>\goal_src\jak3\engine\mods\air-train-menu\air-train-menu-h.gc`
and update the entry to use your new `text-id`:

<img width="612" height="246" alt="img6" src="https://github.com/user-attachments/assets/36fa6a86-8e0f-4d08-b2a9-09d0143c1b9b" />

#### 1.4. Test in Game

Once you’ve done all this, rebuild the game and head to the Haven City Port Air Train to test your new destination!

<img width="1919" height="1053" alt="img7" src="https://github.com/user-attachments/assets/37989016-b127-4bb7-9c73-fd0812440d0c" />
<img width="1919" height="1033" alt="img8" src="https://github.com/user-attachments/assets/673e4b47-1bc8-4aff-b011-f9dd85278f0e" />

### 2. How to assign a new menu to an Air Train entity placed in a custom level

Now, let’s say you want to create a new menu and assign it to an Air Train entity placed in your custom level. The process is similar to the previous one, but this time you’ll define a new menu list in `air-train-menu-h.gc`.

**Note:** This example uses the custom level `test-zone`.

#### 2.1. Create a New Menu Data

Define a simple menu list like this:

<img width="1304" height="592" alt="img9" src="https://github.com/user-attachments/assets/9bcc6971-5094-4f5f-af5d-4b9d7c5183b3" />

In this example, Jak will be able to teleport to `Haven City Port`.

#### 2.2. Add a Return Option to an Existing Menu

To allow Jak to return to your custom level, add a new entry to `*air-train-1-menu-data*` (Haven City Port Air Train):

<img width="1114" height="614" alt="img10" src="https://github.com/user-attachments/assets/a13eab90-3ad4-41b3-9169-9c4e08f8ad3d" />

Also, make sure to add a new text entry, so the option appears with your custom level's name, following the same process from the previous example.

#### 2.3. Place the Entity in Your Custom Level

Next, in your custom level `.jsonc` file, add the Air Train entity like this:

<img width="888" height="480" alt="img11" src="https://github.com/user-attachments/assets/bbacec20-a1e3-4cdd-a75c-4890f6361dc8" />

**Note:** Make sure to include `air-train-ag.go` in your custom level’s `.gd` file. Also, don’t forget to set the `"distance"` lump to define how close Jak needs to be to interact with the Air Train.

#### 2.4. Assign the Menu to the Entity

Go to:
`<ROOT FOLDER>\goal_src\jak3\engine\mods\warp-gate-menu\warp-gate-menu-data.gc`
Scroll down to the `init-defaults!` method of the `air-train` type:

<img width="1286" height="782" alt="img12" src="https://github.com/user-attachments/assets/3edc32a9-ab62-4036-bf1c-a57632b4280c" />

Then, add a new case with the name of the Air Train entity you placed in your custom level:

<img width="1213" height="840" alt="img13" src="https://github.com/user-attachments/assets/edb4d65d-9192-4419-a2ec-40d639614831" />

#### 2.5. Test in Game

Once you’ve done all this, rebuild the game and head to the Haven City Port Air Train. You should now be able to teleport to your custom level and test your custom menu!

<img width="1919" height="982" alt="img14" src="https://github.com/user-attachments/assets/27734f9f-9a48-41ff-b0b3-a79f7c71bfe4" />
<img width="1918" height="983" alt="img15" src="https://github.com/user-attachments/assets/e9d598a4-67c3-4994-9a00-141903aa0066" />

**Note:** The logic is the same for Warp Gates. However, to add new entries or menus, go to: `<ROOT FOLDER>\goal_src\jak3\engine\mods\warp-gate-menu\warp-gate-menu-h.gc`. To assign a menu to a Warp Gate entity, edit the `init-defaults!` method of the `warp-gate` type in: `<ROOT FOLDER>\goal_src\jak3\engine\mods\warp-gate-menu\warp-gate-menu-data.gc`

I hope this contributes to the development of your mods!

*~~Nick07*
86 changes: 86 additions & 0 deletions goal_src/jak3/engine/mods/air-train-menu/air-train-menu-h.gc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
;;-*-Lisp-*-
(in-package goal)

#| This file defines the air-train destination menu structure and its related lists.
Each menu list corresponds to a specific air-train entity and contains
destinations Jak can warp to, based on mission/task progress.

Also, check the method `init-defaults!` of the `air-train` type in `warp-gate-menu-data.gc`,
which is responsible for assigning a menu entry list to a specific entity. Do this if you
want to add custom air-train menus in your own custom levels.
|#

(deftype air-train-menu-entry (structure)
((level-name symbol) ;; level name
(continue-name string) ;; name of the checkpoint Jak will be teleported to
(text-id text-id) ;; text ID that defines the name displayed for this destination in the menu
(allow-when (function symbol)) ;; optional: function that must return true for this entry to become available
(forbid-when (function symbol)) ;; optional: function that hides this entry if it returns true, regardless of `allow-when`
(on-activate pair) ;; optional: actions executed when the destination is selected (e.g., play scenes, load levels, close tasks)
)
)

(defmacro static-air-train-menu-entry (&key level-name
&key continue-name
&key text-id
&key (allow-when #f)
&key (forbid-when #f)
&key (on-activate #f))
`(new 'static 'air-train-menu-entry
:level-name ,level-name
:continue-name ,continue-name
:text-id ,text-id
:allow-when ,allow-when
:forbid-when ,forbid-when
:on-activate ,on-activate
)
)

(deftype air-train-menu-data (structure)
((visible-when (function symbol)) ;; optional: function to control visibility; if null or returns true, air-train is shown
(menu-list (array air-train-menu-entry)) ;; the list of menu entries
)
)

(defmacro static-air-train-menu-data (&key (visible-when #f) &key menu-list)
`(new 'static 'air-train-menu-data
:visible-when ,visible-when
:menu-list (new 'static 'boxed-array :type air-train-menu-entry ,@menu-list)
)
)

;; just an empty array. leave it at is.
;; used as a fallback when an entity doesn't have a defined menu.
(define *empty-air-train-menu-data* (static-air-train-menu-data :visible-when #f :menu-list ()))

;; ctyport air-train
(define *air-train-1-menu-data* (static-air-train-menu-data
:visible-when #f ;; air-train will be always visible
:menu-list (
(static-air-train-menu-entry
:level-name 'desertb
:continue-name "desert-warp"
:text-id (text-id desert-name) ;"Desert Wasteland"
:allow-when (lambda () (task-closed? "city-destroy-grid-resolution")) ;; jinx's mission required
:forbid-when #f
:on-activate '(scene-play '("city-air-train-in-desert" "desert-air-train-out"))
)
)
)
)

;; desert air-train
(define *air-train-5-menu-data* (static-air-train-menu-data
:visible-when (lambda () (task-closed? "city-destroy-grid-resolution")) ;; air-train will be invisible until jinx's mission is completed
:menu-list (
(static-air-train-menu-entry
:level-name 'ctyport
:continue-name "ctyport-warp"
:text-id (text-id ctyport-name) ;"Haven City Port"
:allow-when #f
:forbid-when #f
:on-activate '(scene-play '("desert-air-train-in" "city-air-train-out"))
)
)
)
)
Loading