From e6ee3da5031225fd3db68bd331be77971d7fccaa Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Mon, 16 Oct 2023 17:26:05 +0200 Subject: [PATCH] add jak 2 `test-zone` --- custom_levels/jak2/test-zone/test-zone.jsonc | 83 ++++++++++++++++++ custom_levels/jak2/test-zone/test-zone2.glb | Bin 0 -> 8264 bytes custom_levels/jak2/test-zone/testzone.gd | 8 ++ goal_src/jak2/engine/level/level-info.gc | 87 ++++++++++++++++++- goal_src/jak2/game.gp | 11 +++ goal_src/jak2/lib/project-lib.gp | 17 ++++ 6 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 custom_levels/jak2/test-zone/test-zone.jsonc create mode 100644 custom_levels/jak2/test-zone/test-zone2.glb create mode 100644 custom_levels/jak2/test-zone/testzone.gd diff --git a/custom_levels/jak2/test-zone/test-zone.jsonc b/custom_levels/jak2/test-zone/test-zone.jsonc new file mode 100644 index 0000000000..c2278aa0db --- /dev/null +++ b/custom_levels/jak2/test-zone/test-zone.jsonc @@ -0,0 +1,83 @@ +{ + // The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name) + // the name of this file, and the folder this file is in must have the same name. + "long_name": "test-zone", + // The file name, should be upper case and 8 characters or less. + "iso_name": "TESTZONE", + // The nickname, should be exactly 3 characters + "nickname": "tsz", // 3 char name, all lowercase + // Background mesh file. + // Must have vertex colors. Use the blender cycles renderer, bake, diffuse, uncheck color, + // and bake to vertex colors. For now, only the first vertex color group is used, so make sure you + // only have 1. + "gltf_file": "custom_levels/jak2/test-zone/test-zone2.glb", + + // automatically set wall vs. ground based on angle. Useful if you don't want to assign this yourself + "automatic_wall_detection": true, + "automatic_wall_angle": 45.0, + + // if your mesh has triangles with incorrect orientation, set this to make all collision mesh triangles double sided + // this makes collision 2x slower and bigger, so only use if really needed + "double_sided_collide": false, + + // available res-lump tag data types: + // int32, float, meters, vector, vector4m (meters) + // + // examples: + // + // adds a float tag 'spring-height' with value of 200 meters (1 meter = 4096.0 units): + // "spring-height": ["meters", 200.0] + // + // adds a vector tag 'movie-pos': + // "movie-pos": ["vector", [4096000.0, -176128.0, 1353973.76, 1.0]] + + // The base actor id for your custom level. If you have multiple levels, this should be unique! + "base_id": 100, + + // All art groups you want to use in your custom level. Will add their models and corresponding textures to the FR3 file. + "art_groups": ["prsn-torture-ag"], + + // Any textures you want to include in your custom level. + // This is mainly useful for textures which are not in the common level files and have no art group associated with them. + // To get a list of all the textures, you can extract all of the game's textures + // by setting "save_texture_pngs" to true in the decompiler config. + "textures": [], + + "actors" : [ + { + "trans": [-15.2818, 15.2461, 17.1360], // translation + "etype": "crate", // actor type + "game_task": 0, // associated game task (for powercells, etc) + "kill_mask": 0, + "quat": [0, 0, 0, 1], // quaternion + "bsphere": [-15.2818, 15.2461, 17.1360, 10], // bounding sphere + "lump": { + "name": "test-crate", + "eco-info": ["int32", 18, 2] + } + }, + + { + "trans": [-5.4630, 17.4553, 1.6169], // translation + "etype": "eco-yellow", // actor type + "game_task": 0, // associated game task (for powercells, etc) + "kill_mask": 0, + "quat": [0, 0, 0, 1], // quaternion + "bsphere": [-5.4630, 17.4553, 1.6169, 10], // bounding sphere + "lump": { + "name": "test-eco" + } + }, + + { + "trans": [-7.41, 13.5, 28.42], // translation + "etype": "prsn-torture", // actor type + "game_task": 0, // associated game task (for powercells, etc) + "quat": [0, 0, 0, 1], // quaternion + "bsphere": [-7.41, 13.5, 28.42, 10], // bounding sphere + "lump": { + "name": "test-torture" + } + } + ] +} \ No newline at end of file diff --git a/custom_levels/jak2/test-zone/test-zone2.glb b/custom_levels/jak2/test-zone/test-zone2.glb new file mode 100644 index 0000000000000000000000000000000000000000..2df7f4d59537ba09ff5baa8b42fe6e3aefb196d1 GIT binary patch literal 8264 zcmcIoTaO#J6`s^do1|&eq)qxN%=1_!Im5Z^L%WWfqHbMpU>iXI!-(XyycV!48ItTa zSS+A_ru>Nfpnf04v!dpvb=-16p8JJ|XE>uhJAeGQUqn&#_dy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E_4KDu!6L3tZ4Ji$uQ_ZTJRt<5;_O+s7U!M{Jz5#uqtl zrH4BGAWmJ!+57m6(`gHtlRE=0+aWx$6}r<8b6^~fwOidHdA0drzd1f3rt3dg4SY_7 z93#?ReoP+l2$1@u2bduoQOC>0E`-!4U5E51b|Iu5={oG~`OS83PKWV0h1Z5tc4&$n z_1bXZ5%%FC?}M8l-!7c?lo7V!kh!t;fV9WS5gX!lzGJ~B`HbNPa1KYW9qJaT+m_hp zlVTk4->`+u$(W3f<`kIo5UPNpf%V!+vvoLQL0xuo?KA2suWiz5JLw;1MA8 zNe?hXIHHc1i(Lq*Pr452PwYZSJ<@e3bzjrp#?LmKJmGiYo4`jGEJCM+c>G$Ax>Y{a1Hv9AIR%E&feQOfADk7^SGlCOX5kM z!oP;luj{yY;LC954_|JqJp_=vB!|!s`_0jWn6Cd|Gw?YPa*RlO`7wFGBS7kt9$(^|yAV>JbRE*4*oBaKr1#-}0kv~_egFUf literal 0 HcmV?d00001 diff --git a/custom_levels/jak2/test-zone/testzone.gd b/custom_levels/jak2/test-zone/testzone.gd new file mode 100644 index 0000000000..1aaf42635f --- /dev/null +++ b/custom_levels/jak2/test-zone/testzone.gd @@ -0,0 +1,8 @@ +;; DGO definition file for Awful Village level +;; We use the convention of having a longer DGO name for levels without precomputed visibility. + +;; the actual file name still needs to be 8.3 +("TSZ.DGO" + ("test-zone.go" + "prison-obs.o" + )) \ No newline at end of file diff --git a/goal_src/jak2/engine/level/level-info.gc b/goal_src/jak2/engine/level/level-info.gc index bfc9737d74..5d052cfc4f 100644 --- a/goal_src/jak2/engine/level/level-info.gc +++ b/goal_src/jak2/engine/level/level-info.gc @@ -14690,7 +14690,7 @@ 0 ) -;; added in PC port: test levels from the ps3 version +;; og:preserve-this added in PC port: test levels from the ps3 version (#when USE_PS3_LEVELS (define 4aaron (new 'static 'level-load-info :index 1 @@ -15724,3 +15724,88 @@ (cons! *level-load-list* 'wasall) (cons! *level-load-list* 'stadocc) ) + +;; og:preserve-this added test-zone level +(define test-zone + (new 'static 'level-load-info + :index #x9e + :name 'test-zone + :visname 'test-zone-vis + :nickname 'tsz + :dbname 'test-zone + :taskname 'default + :packages '() + ;; :memory-mode (load-buffer-mode small-center) + :music-bank #f + :ambient-sounds '() + :mood-func 'update-mood-default + :mood-init #f + :ocean #f + :sky #t + :use-camera-other #f + :part-engine-max 16 + :continues '((new 'static 'continue-point + :name "test-zone-start" + :level 'test-zone + :trans (new 'static 'vector :x 0.0 :y (meters 10) :z (meters 10) :w 1.0) + :quat (new 'static 'vector :y 0.061 :w 0.9981) + :camera-trans (new 'static 'vector :x 0.0 :y (meters 1) :z 0.0 :w 1.0) + :camera-rot (new 'static 'inline-array vector3s 3 + (new 'static 'vector3s :data (new 'static 'array float 3 1.0 0.0 0.0)) + (new 'static 'vector3s :data (new 'static 'array float 3 0.0 1.0 0.0)) + (new 'static 'vector3s :data (new 'static 'array float 3 0.0 0.0 1.0)) + ) + :on-goto #f + :vis-nick #f + :want (new 'static 'inline-array level-buffer-state 6 + (new 'static 'level-buffer-state :name 'test-zone :display? 'display :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name 'ctywide :display? 'display :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + ) + :want-sound (new 'static 'array symbol 3 #f #f #f) + ) + ) + :tasks '() + :priority 100 + :load-commands '() + :alt-load-commands '() + :bsp-mask #xffffffffffffffff + :buttom-height (meters -10000000) + :run-packages '() + :wait-for-load #t + :login-func #f + :activate-func #f + :deactivate-func #f + :kill-func #f + :borrow-level (new 'static 'array symbol 2 #f #f) + :borrow-display? (new 'static 'array symbol 2 #f #f) + :base-task-mask (task-mask task0) + :texture-anim-tfrag #f + :texture-anim-pris #f + :texture-anim-shrub #f + :texture-anim-alpha #f + :texture-anim-water #f + :texture-anim-twarp #f + :texture-anim-pris2 #f + :texture-anim-sprite #f + :texture-anim-map #f + :texture-anim-sky #f + :draw-priority 10.0 + :fog-height 327680.0 + :bigmap-id (bigmap-id bigmap-id-20) + :ocean-near-translucent? #t + :ocean-far? #t + :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) + :max-rain 1.0 + :fog-mult 1.0 + :ocean-alpha 1.0 + :extra-sound-bank #f + ) + ) + +(#when PC_PORT + (cons! *level-load-list* 'test-zone) + ) diff --git a/goal_src/jak2/game.gp b/goal_src/jak2/game.gp index fef36ee837..29f3973ffc 100644 --- a/goal_src/jak2/game.gp +++ b/goal_src/jak2/game.gp @@ -291,6 +291,17 @@ (cgo-file "wasall.gd" common-dep) ) +;;;;;;;;;;;;;;;;;;;;;;;;; +;; Example Custom Level +;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Set up the build system to build the level geometry +;; this path is relative to the custom_levels/jak2 folder +;; it should point to the .jsonc file that specifies the level. +(build-custom-level "test-zone") +;; the DGO file +(custom-level-cgo "TSZ.DGO" "test-zone/testzone.gd") + ;;;;;;;;;;;;;;;;;;;;; ;; ANIMATIONS ;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/jak2/lib/project-lib.gp b/goal_src/jak2/lib/project-lib.gp index 7596a61318..1ace9a754e 100644 --- a/goal_src/jak2/lib/project-lib.gp +++ b/goal_src/jak2/lib/project-lib.gp @@ -83,6 +83,17 @@ ) ) +(defun custom-level-cgo (output-name desc-file-name) + "Add a CGO with the given output name (in $OUT/iso) and input name (in custom_levels/jak2/)" + (let ((out-name (string-append "$OUT/iso/" output-name))) + (defstep :in (string-append "custom_levels/jak2/" desc-file-name) + :tool 'dgo + :out `(,out-name) + ) + (set! *all-cgos* (cons out-name *all-cgos*)) + ) + ) + (defun cgo (output-name desc-file-name) "Add a CGO with the given output name (in $OUT/iso) and input name (in goal_src/jak2/dgos)" (let ((out-name (string-append "$OUT/iso/" output-name))) @@ -124,6 +135,12 @@ ) ) +(defmacro build-custom-level (name) + (let* ((path (string-append "custom_levels/jak2/" name "/" name ".jsonc"))) + `(defstep :in ,path + :tool 'build-level2 + :out '(,(string-append "$OUT/obj/" name ".go"))))) + (defmacro group (name &rest stuff) `(defstep :in "" :tool 'group