[decomp] sparticle, sparticle-launcher, set up sprite (#1949)

- fix crash with unhandled sparticle definition (happens with the weird
array int32s that I don't understand yet)
- update mips2c stuff
- add part-tester
- fix some issues around texture uploads
 

![image](https://user-images.githubusercontent.com/48171810/194784675-54e3dc58-7846-450d-a1e9-cefd841dda94.png)
This commit is contained in:
water111
2022-10-09 19:56:07 -04:00
committed by GitHub
parent af5009a29e
commit 9a04c7e311
44 changed files with 6444 additions and 1729 deletions
+1
View File
@@ -1766,6 +1766,7 @@ class DefpartElement : public FormElement {
u16 flags;
std::vector<LinkedWord> data;
goos::Object sound_spec;
goos::Object userdata; // backup
bool is_sp_end(GameVersion version) const {
switch (version) {
@@ -181,6 +181,9 @@ L80:
auto& fld = car(cur_field);
item.sound_spec = cdr(cdr(cdr(cdr(&fld))))->as_pair()->car;
}
if (item.field_id == 48) {
item.userdata = car(cur_field);
}
if (item.is_sp_end(env.version)) {
// sp-end
break;
+8 -4
View File
@@ -616,11 +616,14 @@ Mips2C_Line handle_daddiu(Mips2C_Output& out,
}
}
Mips2C_Line handle_sw(Mips2C_Output& out, const Instruction& i0, const std::string& instr_str) {
Mips2C_Line handle_sw(Mips2C_Output& out,
const Instruction& i0,
const std::string& instr_str,
GameVersion version) {
if (i0.get_src(1).is_sym() && i0.get_src(2).is_reg(rs7())) {
out.require_symbol(i0.get_src(1).get_sym());
return {fmt::format("c->store_symbol({}, cache.{});", reg_to_name(i0.get_src(0)),
goal_to_c_name(i0.get_src(1).get_sym())),
return {fmt::format("c->store_symbol{}({}, cache.{});", version == GameVersion::Jak1 ? "" : "2",
reg_to_name(i0.get_src(0)), goal_to_c_name(i0.get_src(1).get_sym())),
instr_str};
return handle_unknown(instr_str);
// auto name = i0.get_src(1).get_sym();
@@ -998,7 +1001,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
case InstructionKind::OR:
return handle_or(i0, instr_str);
case InstructionKind::SW:
return handle_sw(output, i0, instr_str);
return handle_sw(output, i0, instr_str, version);
case InstructionKind::VMOVE:
return handle_generic_op2_mask(i0, instr_str, "vmove");
case InstructionKind::VITOF0:
@@ -1071,6 +1074,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
case InstructionKind::PAND:
case InstructionKind::PCEQB:
case InstructionKind::PPACW:
case InstructionKind::PCEQW:
return handle_generic_op3(i0, instr_str, {});
case InstructionKind::MULS:
return handle_generic_op3(i0, instr_str, "muls");
+47 -38
View File
@@ -3073,7 +3073,7 @@
(bucket-311 311) ;; depth-cue
(tex-all-sprite 312)
(bucket-313 313) ;; particles
(particles 313) ;; particles
(bucket-314 314) ;; shadow
(bucket-315 315) ;; effects
(tex-all-warp 316) ;; tex
@@ -5008,6 +5008,7 @@
:bitfield #t
(needs-log-in 8)
(bit-9 9)
(backup-sprite-tex 10) ;; set when particle-setup-adgif fails texture lookup.
)
@@ -19622,7 +19623,7 @@
(get-field-spec-by-id
"Returns the [[sp-field-init-spec]] that has the matching [[sp-field-id]]"
(_type_ sp-field-id) sp-field-init-spec 9)
(sparticle-launcher-method-10 (_type_ string) none 10)
(setup-user-array (_type_ string) none 10)
)
)
@@ -19707,11 +19708,11 @@
:size-assert #x70
:flag-assert #x1000000070
(:methods
(initialize (_type_ sparticle-launch-group process) none 9) ;;
(sparticle-launch-control-method-10 (_type_ vector) symbol 10) ;; (is-visible? (_type_ vector) symbol 10)
(initialize (_type_ sparticle-launch-group process) none 9)
(is-visible? (_type_ vector) symbol 10)
(spawn (_type_ vector) none 11) ;; TODO - CFG ;; (spawn (_type_ vector) object 11)
(sparticle-launch-control-method-12 (_type_ matrix) none 12)
(sparticle-launch-control-method-13 (_type_ cspace) none 13)
(spawn-with-matrix (_type_ matrix) none 12)
(spawn-with-cspace (_type_ cspace) none 13)
(kill-and-free-particles (_type_) none 14)
(kill-particles (_type_) none 15)
)
@@ -19752,6 +19753,12 @@
)
;; ---sparticle-h:sp-cpuinfo-flag
(defenum sp-cpuinfo-flag-s32
:bitfield #t
:type int32
:copy-entries sp-cpuinfo-flag
)
(declare-type sparticle-system basic)
(deftype sparticle-cpuinfo (structure)
((sprite sprite-vec-data-2d :offset-assert 0)
@@ -19770,6 +19777,7 @@
(friction float :offset-assert 96)
(timer int32 :offset-assert 100)
(flags sp-cpuinfo-flag :offset-assert 104) ;; NOTE - loaded with lw and lwu?
(flags-s32 sp-cpuinfo-flag-s32 :offset 104)
(user-int32 int32 :offset-assert 108)
(user-uint32 uint32 :offset 108)
(user-float float :offset 108 :score 1)
@@ -19787,7 +19795,7 @@
(key-alt sparticle-launch-state :offset 132)
(binding sparticle-launch-state :offset-assert 136)
(data uint32 1 :offset 12) ;; guessed by decompiler
(datab uint8 4 :offset 12)
(datab int8 4 :offset 12)
(dataf float 1 :offset 12) ;; guessed by decompiler
(datac uint8 1 :offset 12) ;; guessed by decompiler
)
@@ -24225,15 +24233,15 @@
"Verifies if the given pointer, points to a [[sparticle-launch-group]]"
(function pointer symbol))
(define-extern unlink-part-group-by-heap (function kheap int)) ;;
(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object)) ;; TODO - mips2c
(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object))
(define-extern *sp-launcher-lock* symbol) ;;
(define-extern *sp-launch-queue* sp-launch-queue) ;;
(define-extern *sp-launcher-enable* symbol) ;;
;; (define-extern particle-setup-adgif (function adgif-shader texture-id none)) ;; TODO - assertion failure
(define-extern particle-setup-adgif (function adgif-shader int none)) ;; TODO - assertion failure
(define-extern *particle-adgif-cache* particle-adgif-cache) ;;
(define-extern particle-adgif-cache-flush "Clear [[*particle-adgif-cache*]]" (function none))
(define-extern particle-adgif (function adgif-shader texture-id none)) ;; TODO - particle-adgif atomic ops, MIPS2C
(define-extern particle-adgif-callback (function adgif-shader none)) ;; TODO bad VF dependencies
(define-extern particle-adgif (function adgif-shader texture-id none))
(define-extern particle-adgif-callback (function adgif-shader texture-id none))
(define-extern sp-queue-launch (function sparticle-system sparticle-launcher matrix int))
(define-extern sp-adjust-launch (function sparticle-launchinfo sparticle-cpuinfo (inline-array sp-field-init-spec) matrix symbol none)) ;;
(define-extern sp-euler-convert (function sparticle-launchinfo sparticle-cpuinfo none)) ;;
@@ -24258,8 +24266,8 @@
(define-extern sparticle-respawn-heights (function sparticle-system sparticle-cpuinfo vector none))
(define-extern sparticle-respawn-timer (function sparticle-system sparticle-cpuinfo vector none))
(define-extern sparticle-texture-animate (function sparticle-system sparticle-cpuinfo vector none))
(define-extern sparticle-texture-day-night (function sparticle-system sparticle-cpuinfo vector none))
(define-extern sparticle-mode-animate (function sparticle-system sparticle-cpuinfo vector none))
(define-extern sparticle-texture-day-night (function sparticle-system sparticle-cpuinfo sprite-vec-data-2d none))
(define-extern sparticle-mode-animate (function sparticle-system sparticle-cpuinfo sprite-vec-data-2d none))
(define-extern sparticle-motion-blur (function sparticle-system sparticle-cpuinfo vector none))
(define-extern sparticle-motion-blur-old "Unused" (function object sparticle-cpuinfo sprite-vec-data-3d object))
(define-extern sparticle-set-conerot (function sparticle-launcher vector none))
@@ -24280,16 +24288,16 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-extern sp-particle-copy! (function sparticle-cpuinfo sparticle-cpuinfo none)) ;;
(define-extern *sp-particle-system-2d* sparticle-system) ;;
(define-extern *sp-particle-system-3d* sparticle-system) ;; sparticle-system
(define-extern *sp-particle-system-2d* sparticle-system)
(define-extern *sp-particle-system-3d* sparticle-system)
(define-extern sp-get-block-size (function sparticle-system int int)) ;;
(define-extern sp-get-approx-alloc-size (function sparticle-system int int)) ;;
(define-extern sp-free-particle (function sparticle-system int sparticle-cpuinfo sprite-vec-data-2d none)) ;;
(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo)) ;; TODO - manually fixed in jak 1? gross
(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo))
(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol)) ;;
(define-extern sp-orbiter (function sparticle-system sparticle-cpuinfo vector none)) ;;
(define-extern sp-process-block-2d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c
(define-extern sp-process-block-3d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c
(define-extern sp-process-block-2d (function sparticle-system int int int int symbol none))
(define-extern sp-process-block-3d (function sparticle-system int int int int symbol none))
(define-extern sp-copy-to-spr (function int pointer int none)) ;; TODO - these are all actually uints, but this is needed to get the casts right...
(define-extern sp-copy-from-spr (function int pointer int none)) ;; TODO - these are all actually uints, but this is needed to get the casts right...
(define-extern memcpy function) ;; TODO - was done manually as well?
@@ -25548,15 +25556,15 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-extern group-rain-screend-drop sparticle-launch-group) ;;
(define-extern update-snow (function target none))
;; (define-extern birth-func-omega-normal-orient function)
;; (define-extern birth-func-rain function)
;; (define-extern check-drop-level-rain function) ;; (function sparticle-system sparticle-cpuinfo vector none)
;; (define-extern check-drop-level-rain2 function)
;; (define-extern check-drop-level-splash function)
(define-extern update-rain (function target none))
(define-extern update-snow (function float vector vector none))
(define-extern birth-func-omega-normal-orient (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none))
(define-extern birth-func-rain (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none))
(define-extern check-drop-level-rain (function sparticle-system sparticle-cpuinfo vector none))
(define-extern check-drop-level-rain2 (function sparticle-system sparticle-cpuinfo vector none))
(define-extern check-drop-level-splash (function sparticle-system sparticle-cpuinfo vector none))
(define-extern update-rain (function float vector vector none))
(define-extern cam-master-effect (function none :behavior camera-master)) ;;
;; (define-extern sparticle-track-sun function) ;; (function int sparticle-cpuinfo matrix none)
(define-extern sparticle-track-sun (function int sparticle-cpuinfo matrix none))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; time-of-day ;;
@@ -30487,21 +30495,22 @@
;; part-tester ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype part-tester (UNKNOWN)
()
:method-count-assert 0
:size-assert #x0
:flag-assert #x0
(deftype part-tester (process)
((root trsqv)
(part sparticle-launch-control)
(old-group sparticle-launch-group))
:heap-base 16
:size-assert #x8c
:flag-assert #xe0010008c
;; Failed to read fields.
)
|#
;; (define-extern *part-tester-name* object) ;; string
;; (define-extern part-tester-idle state) ;; (state part-tester)
;; (define-extern part-tester-init-by-other function) ;; (function vector none :behavior process-drawable)
;; (define-extern *debug-part-dead-pool* object) ;; dead-pool
;; (define-extern start-part function) ;; (function none)
(define-extern *part-tester-name* string)
(define-extern part-tester-idle (state part-tester))
(define-extern part-tester-init-by-other (function vector none :behavior process-drawable))
(define-extern *debug-part-dead-pool* dead-pool)
(define-extern start-part (function none))
(define-extern *part-tester* (pointer process))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; editable-h ;;
+7 -4
View File
@@ -141,9 +141,6 @@
"(anon-function 4 gun-states)",
"(anon-function 28 grenadier)",
"(anon-function 24 grenadier)",
// no longer bug or asm, not done yet
"particle-adgif-callback",
// texture
"adgif-shader<-texture!"
],
@@ -363,7 +360,13 @@
"render-boundary-quad",
"render-boundary-tri",
"clip-polygon-against-negative-hyperplane",
"clip-polygon-against-positive-hyperplane"
"clip-polygon-against-positive-hyperplane",
"sp-init-fields!",
"particle-adgif",
"sp-launch-particles-var",
"sparticle-motion-blur",
"sp-process-block-2d",
"sp-process-block-3d"
],
"mips2c_jump_table_functions": {},
+2 -1
View File
@@ -274,5 +274,6 @@
"target-gun": [["L595", "uint64", true]],
"tie-methods": [["L328", "(inline-array tie-init-data)", 6]],
"blocking-plane": [["L43", "vector"]],
"elec-gate": [["L141", "attack-info"]]
"elec-gate": [["L141", "attack-info"]],
"part-tester": [["L35", "uint64", true], ["L30", "uint64", true]]
}
@@ -927,5 +927,17 @@
"(method 18 drawable-region-face)": [
[16, "vector"],
[32, "vector"]
],
"particle-adgif-callback": [
[16, ["inline-array", "vector", 4]]
],
"sparticle-respawn-heights": [
[16, "vector"]
],
"sparticle-respawn-timer": [
[16, "vector"]
],
"check-drop-level-rain": [
[16, "vector"]
]
}
+43 -3
View File
@@ -1437,13 +1437,50 @@
[[49, 61], "v1", "dma-packet"]
],
"sparticle-track-root-prim": [[3, "v1", "collide-shape"]],
"(method 10 sparticle-launcher)": [[41, "gp", "(array float)"]],
"birth-func-texture-group": [[3, "s5", "(pointer int32)"]],
"(method 10 sparticle-launcher)": [[[41, 75], "gp", "(array int32)"]],
"birth-func-texture-group": [[[2, 10], "s5", "(array int32)"]],
"(method 9 sparticle-launch-control)": [[22, "a2", "process-drawable"]],
"(method 10 sparticle-launch-control)": [[42, "a3", "float"]],
"execute-part-engine": [
[11, "v1", "connection"],
[137, "a3", "vector"]
[12, "a0", "process-drawable"],
[13, "v1", "connection"],
[[19, 53], "s0", "vector"],
[23, "v1", "connection"],
[28, "v1", "connection"],
[29, "v1", "int"],
[137, "a3", "vector"],
[35, "a0", "process-drawable"]
],
"sparticle-respawn-heights": [
[[0, 58], "gp", "(array int32)"],
[58, "gp", "(array int32)"],
[34, "v1", "int"]
],
"sparticle-respawn-timer": [
[[9, 15], "gp", "(array int32)"],
[34, "gp", "(array int32)"],
[10, "v1", "int"]
],
"sparticle-texture-animate": [
[[0, 31], "v1", "(array int32)"],
[47, "v1", "(array int32)"]
],
"sparticle-texture-day-night": [
[[21, 78], "s2", "(array int32)"]
],
"sparticle-mode-animate": [
[5, "v1", "(array symbol)"],
[[7, 16], "a1", "(array uint32)"],
[18, "a1", "vector4w"],
[21, "a1", "(pointer int32)"],
[26, "a1", "(array int32)"],
[28, "v1", "(array int32)"],
[32, "a0", "(pointer int64)"],
// [33, "a0", "(pointer int64)"],
[44, "v1", "(pointer int32)"],
[46, "v1", "(pointer int32)"]
],
"(method 2 sparticle-cpuinfo)": [[14, "f0", "float"]],
"sp-kill-particle": [
@@ -2939,5 +2976,8 @@
[105, "v1", "dma-packet"],
[99, "a0", "dma-packet"],
[97, "a1", "dma-packet"]
],
"(code part-tester-idle)": [
[[16, 22], "s5", "process-drawable"]
]
}
+23 -1
View File
@@ -781,12 +781,34 @@ goos::Object decompile_sparticle_field_init(const TypeSpec& type,
return result;
}
std::string debug_print(const LinkedWord& word) {
switch (word.kind()) {
case LinkedWord::PLAIN_DATA:
return fmt::format("0x{:08x}", word.data);
case LinkedWord::TYPE_PTR:
return fmt::format("type: {}\n", word.symbol_name());
case LinkedWord::EMPTY_PTR:
return fmt::format("'()");
case LinkedWord::HI_PTR:
return fmt::format("hi ptr");
case LinkedWord::LO_PTR:
return fmt::format("lo ptr");
case LinkedWord::PTR:
return fmt::format("ptr");
case LinkedWord::SYM_OFFSET:
return fmt::format("offset '{}", word.symbol_name());
case LinkedWord::SYM_PTR:
return fmt::format("ptr '{}", word.symbol_name());
}
}
goos::Object decompile_sparticle_userdata_ASSERT(const std::vector<LinkedWord>& words,
const std::string& field_name,
const std::string& flag_name) {
if (flag_name == "int-with-rand" || flag_name == "float-with-rand") {
return decompile_sparticle_float_with_rand_init(words, field_name, flag_name);
} else {
fmt::print("flag name is {}\n", flag_name);
ASSERT(false);
}
}
@@ -849,7 +871,7 @@ goos::Object decompile_sparticle_field_init(const DefpartElement::StaticInfo::Pa
result = decompile_sparticle_func(field.data, field_name, flag_name);
break;
case FieldKind::USERDATA:
result = decompile_sparticle_userdata_ASSERT(field.data, field_name, flag_name);
result = decompile_sparticle_userdata(field.data, field_name, flag_name, field.userdata);
break;
case FieldKind::ROT_X:
result = decompile_sparticle_rot_x(field.data, field_name, flag_name);
+2
View File
@@ -87,6 +87,8 @@ set(RUNTIME_SOURCE
mips2c/jak2_functions/font.cpp
mips2c/jak2_functions/joint.cpp
mips2c/jak2_functions/sky.cpp
mips2c/jak2_functions/sparticle.cpp
mips2c/jak2_functions/sparticle_launcher.cpp
mips2c/jak2_functions/texture.cpp
overlord/dma.cpp
overlord/fake_iso.cpp
@@ -88,23 +88,94 @@ void OpenGLRenderer::init_bucket_renderers_jak2() {
using namespace jak2;
m_bucket_renderers.resize((int)BucketId::MAX_BUCKETS);
m_bucket_categories.resize((int)BucketId::MAX_BUCKETS, BucketCategory::OTHER);
// 0
init_bucket_renderer<VisDataHandler>("vis", BucketCategory::OTHER, BucketId::SPECIAL_BUCKET_2);
init_bucket_renderer<TextureUploadHandler>("tex-lcom-sky-pre", BucketCategory::TEX,
BucketId::TEX_LCOM_SKY_PRE);
init_bucket_renderer<TextureUploadHandler>("tex-l0-tfrag", BucketCategory::TEX,
BucketId::TEX_L0_TFRAG);
init_bucket_renderer<TFragment>("tfrag-l0-tfrag", BucketCategory::TFRAG, BucketId::TFRAG_L0_TFRAG,
std::vector{tfrag3::TFragmentTreeKind::NORMAL}, false, 0);
init_bucket_renderer<Tie3>("tie-l0-tfrag", BucketCategory::TIE, BucketId::TIE_L0_TFRAG, 0);
// 10
init_bucket_renderer<TextureUploadHandler>("tex-l1-tfrag", BucketCategory::TEX,
BucketId::TEX_L1_TFRAG);
init_bucket_renderer<TFragment>("tfrag-l1-tfrag", BucketCategory::TFRAG, BucketId::TFRAG_L1_TFRAG,
std::vector{tfrag3::TFragmentTreeKind::NORMAL}, false, 1);
// 20
init_bucket_renderer<Tie3>("tie-l1-tfrag", BucketCategory::TIE, BucketId::TIE_L1_TFRAG, 1);
// 30
// 40
// 50
// 60
// 70
init_bucket_renderer<TextureUploadHandler>("tex-l0-shrub", BucketCategory::TEX,
BucketId::TEX_L0_SHRUB);
init_bucket_renderer<Shrub>("shrub-l0-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L0_SHRUB);
// 80
init_bucket_renderer<TextureUploadHandler>("tex-l1-shrub", BucketCategory::TEX,
BucketId::TEX_L1_SHRUB);
init_bucket_renderer<Shrub>("shrub-l1-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L1_SHRUB);
// 90
// 100
// 110
// 120
init_bucket_renderer<TFragment>("tfrag-t-l0-alpha", BucketCategory::TFRAG,
BucketId::TFRAG_T_L0_ALPHA,
std::vector{tfrag3::TFragmentTreeKind::TRANS}, false, 0);
// 130
// 140
// 150
// 160
// 170
// 180
init_bucket_renderer<TextureUploadHandler>("tex-lcom-tfrag", BucketCategory::TEX,
BucketId::TEX_LCOM_TFRAG);
// 190
init_bucket_renderer<TextureUploadHandler>("tex-lcom-shrub", BucketCategory::TEX,
BucketId::TEX_LCOM_SHRUB);
init_bucket_renderer<TextureUploadHandler>("tex-l0-pris", BucketCategory::TEX,
BucketId::TEX_L0_PRIS);
// 200
init_bucket_renderer<TextureUploadHandler>("tex-l2-pris", BucketCategory::TEX,
BucketId::TEX_L2_PRIS);
// 210
// 220
init_bucket_renderer<TextureUploadHandler>("tex-lcom-pris", BucketCategory::TEX,
BucketId::TEX_LCOM_PRIS);
// 230
// 240
// 250
init_bucket_renderer<TextureUploadHandler>("tex-l0-water", BucketCategory::TEX,
BucketId::TEX_L0_WATER);
init_bucket_renderer<TFragment>("tfrag-w-l0-alpha", BucketCategory::TFRAG,
BucketId::TFRAG_W_L0_WATER,
std::vector{tfrag3::TFragmentTreeKind::WATER}, false, 0);
// 260
init_bucket_renderer<TextureUploadHandler>("tex-l1-water", BucketCategory::TEX,
BucketId::TEX_L1_WATER);
// 270
init_bucket_renderer<TextureUploadHandler>("tex-l2-water", BucketCategory::TEX,
BucketId::TEX_L2_WATER);
// 280
// 290
// 300
init_bucket_renderer<TextureUploadHandler>("tex-lcom-water", BucketCategory::TEX,
BucketId::TEX_LCOM_WATER);
init_bucket_renderer<TextureUploadHandler>("tex-lcom-sky-post", BucketCategory::TEX,
BucketId::TEX_LCOM_SKY_POST);
// 310
init_bucket_renderer<TextureUploadHandler>("tex-all-sprite", BucketCategory::TEX,
BucketId::TEX_ALL_SPRITE);
init_bucket_renderer<Sprite3>("particles", BucketCategory::SPRITE, BucketId::PARTICLES);
init_bucket_renderer<TextureUploadHandler>("tex-all-warp", BucketCategory::TEX,
BucketId::TEX_ALL_WARP);
init_bucket_renderer<DirectRenderer>("debug-no-zbuf1", BucketCategory::OTHER,
BucketId::DEBUG_NO_ZBUF1, 0x8000);
init_bucket_renderer<TextureUploadHandler>("tex-all-map", BucketCategory::TEX,
BucketId::TEX_ALL_MAP);
// 320
init_bucket_renderer<DirectRenderer>("debug2", BucketCategory::OTHER, BucketId::DEBUG2, 0x8000);
init_bucket_renderer<DirectRenderer>("debug-no-zbuf2", BucketCategory::OTHER,
BucketId::DEBUG_NO_ZBUF2, 0x8000);
+113 -14
View File
@@ -762,7 +762,7 @@ void Sprite3::distort_setup_framebuffer_dims(SharedRenderState* render_state) {
* This should get the dma chain immediately after the call to sprite-draw-distorters.
* It ends right before the sprite-add-matrix-data for the 3d's
*/
void Sprite3::handle_sprite_frame_setup(DmaFollower& dma) {
void Sprite3::handle_sprite_frame_setup(DmaFollower& dma, GameVersion version) {
// first is some direct data
auto direct_data = dma.read_and_advance();
ASSERT(direct_data.size_bytes == 3 * 16);
@@ -771,17 +771,38 @@ void Sprite3::handle_sprite_frame_setup(DmaFollower& dma) {
// next would be the program, but it's 0 size on the PC and isn't sent.
// next is the "frame data"
auto frame_data = dma.read_and_advance();
ASSERT(frame_data.size_bytes == (int)sizeof(SpriteFrameData)); // very cool
ASSERT(frame_data.vifcode0().kind == VifCode::Kind::STCYCL);
VifCodeStcycl frame_data_stcycl(frame_data.vifcode0());
ASSERT(frame_data_stcycl.cl == 4);
ASSERT(frame_data_stcycl.wl == 4);
ASSERT(frame_data.vifcode1().kind == VifCode::Kind::UNPACK_V4_32);
VifCodeUnpack frame_data_unpack(frame_data.vifcode1());
ASSERT(frame_data_unpack.addr_qw == SpriteDataMem::FrameData);
ASSERT(frame_data_unpack.use_tops_flag == false);
memcpy(&m_frame_data, frame_data.data, sizeof(SpriteFrameData));
switch (version) {
case GameVersion::Jak1: {
auto frame_data = dma.read_and_advance();
ASSERT(frame_data.size_bytes == (int)sizeof(SpriteFrameDataJak1)); // very cool
ASSERT(frame_data.vifcode0().kind == VifCode::Kind::STCYCL);
VifCodeStcycl frame_data_stcycl(frame_data.vifcode0());
ASSERT(frame_data_stcycl.cl == 4);
ASSERT(frame_data_stcycl.wl == 4);
ASSERT(frame_data.vifcode1().kind == VifCode::Kind::UNPACK_V4_32);
VifCodeUnpack frame_data_unpack(frame_data.vifcode1());
ASSERT(frame_data_unpack.addr_qw == SpriteDataMem::FrameData);
ASSERT(frame_data_unpack.use_tops_flag == false);
SpriteFrameDataJak1 jak1_data;
memcpy(&jak1_data, frame_data.data, sizeof(SpriteFrameDataJak1));
m_frame_data.from_jak1(jak1_data);
} break;
case GameVersion::Jak2: {
auto frame_data = dma.read_and_advance();
ASSERT(frame_data.size_bytes == (int)sizeof(SpriteFrameData)); // very cool
ASSERT(frame_data.vifcode0().kind == VifCode::Kind::STCYCL);
VifCodeStcycl frame_data_stcycl(frame_data.vifcode0());
ASSERT(frame_data_stcycl.cl == 4);
ASSERT(frame_data_stcycl.wl == 4);
ASSERT(frame_data.vifcode1().kind == VifCode::Kind::UNPACK_V4_32);
VifCodeUnpack frame_data_unpack(frame_data.vifcode1());
ASSERT(frame_data_unpack.addr_qw == SpriteDataMem::FrameData);
ASSERT(frame_data_unpack.use_tops_flag == false);
memcpy(&m_frame_data, frame_data.data, sizeof(SpriteFrameData));
} break;
default:
ASSERT_NOT_REACHED();
}
// next, a MSCALF.
auto mscalf = dma.read_and_advance();
@@ -951,6 +972,84 @@ void Sprite3::render_2d_group1(DmaFollower& dma,
}
void Sprite3::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) {
switch (render_state->version) {
case GameVersion::Jak1:
render_jak1(dma, render_state, prof);
break;
case GameVersion::Jak2:
render_jak2(dma, render_state, prof);
break;
default:
ASSERT_NOT_REACHED();
}
}
void Sprite3::render_jak2(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
m_debug_stats = {};
auto data0 = dma.read_and_advance();
ASSERT(data0.vif1() == 0 || data0.vifcode1().kind == VifCode::Kind::NOP);
ASSERT(data0.vif0() == 0 || data0.vifcode0().kind == VifCode::Kind::MARK);
ASSERT(data0.size_bytes == 0);
if (dma.current_tag_offset() == render_state->next_bucket) {
fmt::print("early exit!");
return;
}
// First is the distorter (temporarily disabled for jak 2)
{
// auto child = prof.make_scoped_child("distorter");
// render_distorter(dma, render_state, child);
}
// next, the normal sprite stuff
render_state->shaders[ShaderId::SPRITE3].activate();
handle_sprite_frame_setup(dma, render_state->version);
// 3d sprites
render_3d(dma);
// 2d draw
// m_sprite_renderer.reset_state();
{
auto child = prof.make_scoped_child("2d-group0");
render_2d_group0(dma, render_state, child);
flush_sprites(render_state, prof, false);
}
// shadow draw
render_fake_shadow(dma);
// 2d draw (HUD)
{
auto child = prof.make_scoped_child("2d-group1");
render_2d_group1(dma, render_state, child);
flush_sprites(render_state, prof, true);
}
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
// TODO finish this up.
// fmt::print("next bucket is 0x{}\n", render_state->next_bucket);
while (dma.current_tag_offset() != render_state->next_bucket) {
// auto tag = dma.current_tag();
// fmt::print("@ 0x{:x} tag: {}", dma.current_tag_offset(), tag.print());
auto data = dma.read_and_advance();
VifCode code(data.vif0());
// fmt::print(" vif0: {}\n", code.print());
if (code.kind == VifCode::Kind::NOP) {
// fmt::print(" vif1: {}\n", VifCode(data.vif1()).print());
}
}
}
void Sprite3::render_jak1(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
m_debug_stats = {};
// First thing should be a NEXT with two nops. this is a jump from buckets to sprite data
auto data0 = dma.read_and_advance();
@@ -976,7 +1075,7 @@ void Sprite3::render(DmaFollower& dma, SharedRenderState* render_state, ScopedPr
render_state->shaders[ShaderId::SPRITE3].activate();
// next, sprite frame setup.
handle_sprite_frame_setup(dma);
handle_sprite_frame_setup(dma, render_state->version);
// 3d sprites
render_3d(dma);
@@ -1160,7 +1259,7 @@ void Sprite3::handle_zbuf(u64 val,
// way - 24-bit, at offset 448.
GsZbuf x(val);
ASSERT(x.psm() == TextureFormat::PSMZ24);
ASSERT(x.zbp() == 448);
ASSERT(x.zbp() == 448 || x.zbp() == 304); // 304 for jak 2.
m_current_mode.set_depth_write_enable(!x.zmsk());
}
+4 -1
View File
@@ -19,6 +19,9 @@ class Sprite3 : public BucketRenderer {
static constexpr int SPRITES_PER_CHUNK = 48;
private:
void render_jak1(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof);
void render_jak2(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof);
void opengl_setup();
void opengl_setup_normal();
void opengl_setup_distort();
@@ -33,7 +36,7 @@ class Sprite3 : public BucketRenderer {
void distort_draw_instanced(SharedRenderState* render_state, ScopedProfilerNode& prof);
void distort_draw_common(SharedRenderState* render_state, ScopedProfilerNode& prof);
void distort_setup_framebuffer_dims(SharedRenderState* render_state);
void handle_sprite_frame_setup(DmaFollower& dma);
void handle_sprite_frame_setup(DmaFollower& dma, GameVersion version);
void render_3d(DmaFollower& dma);
void render_2d_group0(DmaFollower& dma,
SharedRenderState* render_state,
@@ -15,6 +15,7 @@ void TextureUploadHandler::render(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof) {
// this is the data we get from the PC Port modification.
m_upload_count = 0;
std::vector<TextureUpload> uploads;
// loop through all data, grabbing buckets
@@ -60,38 +61,18 @@ void TextureUploadHandler::flush_uploads(std::vector<TextureUpload>& uploads,
if (m_fake_uploads) {
uploads.clear();
} else {
m_upload_count += uploads.size();
// NOTE: we don't actually copy the textures in the dma chain copying because they aren't
// reference by DMA tag. So there's the potential for race conditions if the game gets messed
// up and corrupts the texture memory.
const u8* ee_mem = (const u8*)render_state->ee_main_memory;
if (uploads.size() == 2 && uploads[0].mode == 2 && uploads[1].mode == -2 &&
uploads[0].page == uploads[1].page) {
render_state->texture_pool->handle_upload_now(ee_mem + uploads[0].page, -2, ee_mem,
for (auto& upload : uploads) {
render_state->texture_pool->handle_upload_now(ee_mem + upload.page, upload.mode, ee_mem,
render_state->offset_of_s7);
render_state->texture_pool->handle_upload_now(ee_mem + uploads[0].page, 2, ee_mem,
render_state->offset_of_s7);
} else if (uploads.size() == 1 && uploads[0].mode == -1) {
render_state->texture_pool->handle_upload_now(ee_mem + uploads[0].page, -1, ee_mem,
render_state->offset_of_s7);
} else if (uploads.size() == 1 && uploads[0].mode == -2) {
render_state->texture_pool->handle_upload_now(ee_mem + uploads[0].page, -2, ee_mem,
render_state->offset_of_s7);
} else if (uploads.size() == 1 && uploads[0].mode == 0) {
render_state->texture_pool->handle_upload_now(ee_mem + uploads[0].page, 0, ee_mem,
render_state->offset_of_s7);
}
else if (uploads.empty()) {
// do nothing.
} else {
lg::error("unhandled upload sequence in {}:", m_name);
for (auto& upload : uploads) {
lg::error(" page: 0x{:x} mode: {}", upload.page, upload.mode);
}
ASSERT(false);
}
}
}
void TextureUploadHandler::draw_debug_window() {
ImGui::Checkbox("Fake Uploads", &m_fake_uploads);
ImGui::Text("Uploads: %d", m_upload_count);
}
@@ -21,4 +21,5 @@ class TextureUploadHandler : public BucketRenderer {
};
void flush_uploads(std::vector<TextureUpload>& uploads, SharedRenderState* render_state);
bool m_fake_uploads = false;
int m_upload_count = 0;
};
+19
View File
@@ -82,15 +82,34 @@ namespace jak2 {
enum class BucketId {
SPECIAL_BUCKET_2 = 2,
TEX_LCOM_SKY_PRE = 4,
TEX_L0_TFRAG = 7,
TFRAG_L0_TFRAG = 8,
TIE_L0_TFRAG = 9,
TEX_L1_TFRAG = 18,
TFRAG_L1_TFRAG = 19,
TIE_L1_TFRAG = 20,
TEX_L0_SHRUB = 73,
SHRUB_L0_SHRUB = 74,
TEX_L1_SHRUB = 82,
SHRUB_L1_SHRUB = 83,
TFRAG_T_L0_ALPHA = 128,
TEX_LCOM_TFRAG = 187,
TEX_LCOM_SHRUB = 191,
TEX_L0_PRIS = 196,
TEX_L2_PRIS = 204,
TEX_LCOM_PRIS = 220,
TEX_L0_WATER = 252,
TFRAG_W_L0_WATER = 255,
TEX_L1_WATER = 261,
TEX_L2_WATER = 270,
TEX_LCOM_WATER = 306,
TEX_LCOM_SKY_POST = 309,
TEX_ALL_SPRITE = 312,
PARTICLES = 313,
TEX_ALL_WARP = 316,
DEBUG_NO_ZBUF1 = 318,
TEX_ALL_MAP = 319,
DEBUG2 = 324,
DEBUG_NO_ZBUF2 = 325,
DEBUG3 = 326,
@@ -28,7 +28,7 @@ out flat vec4 fragment_color;
out vec3 tex_coord;
out flat uvec2 tex_info;
const float SCISSOR_ADJUST = 512.0/448.0;
const float SCISSOR_ADJUST = HEIGHT_SCALE * 512.0/448.0;
vec4 matrix_transform(mat4 mtx, vec3 pt) {
return mtx[3]
+68 -2
View File
@@ -12,7 +12,7 @@ using math::Vector4f;
/*!
* GOAL sprite-frame-data, all the data that's uploaded once per frame for the sprite system.
*/
struct SpriteFrameData {
struct SpriteFrameDataJak1 {
Vector4f xy_array[8];
Vector4f st_array[4];
Vector4f xyz_array[4];
@@ -41,6 +41,71 @@ struct SpriteFrameData {
float bonus;
};
struct SpriteFrameData {
Vector4f xy_array[8];
Vector4f st_array[4];
Vector4f xyz_array[4];
Vector4f hmge_scale;
float pfog0;
float deg_to_rad;
float min_scale;
float inv_area;
GifTag adgif_giftag;
GifTag sprite_2d_giftag;
GifTag sprite_2d_giftag2;
Vector4f sincos[5];
Vector4f basis_x;
Vector4f basis_y;
GifTag sprite_3d_giftag;
GifTag sprite_3d_giftag_2;
AdGifData screen_shader;
GifTag clipped_giftag;
Vector4f inv_hmge_scale;
Vector4f stq_offset;
Vector4f stq_scale;
Vector4f rgba_plain;
GifTag warp_giftag;
float fog_min;
float fog_max;
float max_scale;
float bonus;
void from_jak1(const SpriteFrameDataJak1& data) {
for (int i = 0; i < 8; i++) {
xy_array[i] = data.xy_array[i];
}
for (int i = 0; i < 4; i++) {
st_array[i] = data.st_array[i];
xyz_array[i] = data.xyz_array[i];
}
hmge_scale = data.hmge_scale;
pfog0 = data.pfog0;
deg_to_rad = data.deg_to_rad;
min_scale = data.min_scale;
inv_area = data.inv_area;
adgif_giftag = data.adgif_giftag;
sprite_2d_giftag = data.sprite_2d_giftag;
sprite_2d_giftag2 = data.sprite_2d_giftag2;
for (int i = 0; i < 5; i++) {
sincos[i] = data.sincos[i];
}
basis_x = data.basis_x;
basis_y = data.basis_y;
sprite_3d_giftag = data.sprite_3d_giftag;
screen_shader = data.screen_shader;
clipped_giftag = data.clipped_giftag;
inv_hmge_scale = data.inv_hmge_scale;
stq_offset = data.stq_offset;
stq_scale = data.stq_scale;
rgba_plain = data.rgba_plain;
warp_giftag = data.warp_giftag;
fog_min = data.fog_min;
fog_max = data.fog_max;
max_scale = data.max_scale;
bonus = data.bonus;
}
};
/*!
* "Matrix Data" for 3D sprites. This is shared for all 3D sprites
*/
@@ -143,4 +208,5 @@ enum SpriteProgMem {
};
static_assert(offsetof(SpriteFrameData, hmge_scale) == 256);
static_assert(sizeof(SpriteFrameData) == 0x290, "SpriteFrameData size");
static_assert(sizeof(SpriteFrameDataJak1) == 0x290, "SpriteFrameData size");
static_assert(sizeof(SpriteFrameData) == 0x2a0, "SpriteFrameData size");
+712
View File
@@ -0,0 +1,712 @@
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jak2/kscheme.h"
using ::jak2::intern_from_c;
namespace Mips2C::jak2 {
namespace sp_process_block_2d {
struct Cache {
void* fake_scratchpad_data; // *fake-scratchpad-data*
void* add_to_sprite_aux_list; // add-to-sprite-aux-list
void* sp_free_particle; // sp-free-particle
void* sp_orbiter; // sp-orbiter
void* sp_relaunch_particle_2d; // sp-relaunch-particle-2d
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -128); // daddiu sp, sp, -128
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s0, 16, sp); // sq s0, 16(sp)
c->sq(s1, 32, sp); // sq s1, 32(sp)
c->sq(s2, 48, sp); // sq s2, 48(sp)
c->sq(s3, 64, sp); // sq s3, 64(sp)
c->sq(s4, 80, sp); // sq s4, 80(sp)
c->sq(s5, 96, sp); // sq s5, 96(sp)
c->sq(gp, 112, sp); // sq gp, 112(sp)
c->mov64(gp, a0); // or gp, a0, r0
c->mov64(s5, a1); // or s5, a1, r0
c->mov64(s4, a2); // or s4, a2, r0
c->mov64(s1, a3); // or s1, a3, r0
c->mov64(s3, t0); // or s3, t0, r0
c->mov64(s2, t1); // or s2, t1, r0
block_1:
c->lb(v1, 128, s5); // lb v1, 128(s5)
bc = c->sgpr64(v1) == 0; // beq v1, r0, L113
// nop // sll r0, r0, 0
if (bc) {goto block_32;} // branch non-likely
c->lb(a0, 129, s5); // lb a0, 129(s5)
get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672
c->dsll(a0, a0, 4); // dsll a0, a0, 4
c->daddu(v1, v1, a0); // daddu v1, v1, a0
c->lqc2(vf9, 0, v1); // lqc2 vf9, 0(v1)
c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9
c->andi(s0, v1, 255); // andi s0, v1, 255
bc = c->sgpr64(s0) != 0; // bne s0, r0, L103
// nop // sll r0, r0, 0
if (bc) {goto block_9;} // branch non-likely
c->lw(v1, 104, s5); // lw v1, 104(s5)
// nop // sll r0, r0, 0
c->andi(v1, v1, 32896); // andi v1, v1, 32896
bc = c->sgpr64(v1) == 0; // beq v1, r0, L101
// nop // sll r0, r0, 0
if (bc) {goto block_5;} // branch non-likely
c->load_symbol2(t9, cache.add_to_sprite_aux_list);// lw t9, add-to-sprite-aux-list(s7)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a1, s5); // or a1, s5, r0
c->mov64(a2, s4); // or a2, s4, r0
c->mov64(a3, s1); // or a3, s1, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
block_5:
c->lw(v1, 100, s5); // lw v1, 100(s5)
c->addiu(a0, r0, -1); // addiu a0, r0, -1
bc = c->sgpr64(v1) == c->sgpr64(a0); // beq v1, a0, L102
// nop // sll r0, r0, 0
if (bc) {goto block_7;} // branch non-likely
bc = c->sgpr64(v1) == 0; // beq v1, r0, L112
// nop // sll r0, r0, 0
if (bc) {goto block_31;} // branch non-likely
block_7:
c->lw(a0, 104, s5); // lw a0, 104(s5)
c->andi(v1, a0, 32); // andi v1, a0, 32
c->xor_(a0, a0, v1); // xor a0, a0, v1
bc = c->sgpr64(v1) == 0; // beq v1, r0, L113
c->sw(a0, 104, s5); // sw a0, 104(s5)
if (bc) {goto block_32;} // branch non-likely
c->lw(v1, 124, s5); // lw v1, 124(s5)
//beq r0, r0, L113 // beq r0, r0, L113
c->sw(v1, 44, s4); // sw v1, 44(s4)
goto block_32; // branch always
block_9:
c->lw(v1, 100, s5); // lw v1, 100(s5)
c->addiu(a0, r0, -1); // addiu a0, r0, -1
bc = c->sgpr64(v1) == c->sgpr64(a0); // beq v1, a0, L104
c->dsubu(a0, v1, s0); // dsubu a0, v1, s0
if (bc) {goto block_12;} // branch non-likely
bc = c->sgpr64(v1) == 0; // beq v1, r0, L112
c->pmaxw(v1, a0, r0); // pmaxw v1, a0, r0
if (bc) {goto block_31;} // branch non-likely
c->sw(v1, 100, s5); // sw v1, 100(s5)
block_12:
c->lw(v1, 104, s5); // lw v1, 104(s5)
c->andi(a0, v1, 32); // andi a0, v1, 32
c->xor_(v1, v1, a0); // xor v1, v1, a0
bc = c->sgpr64(a0) == 0; // beq a0, r0, L105
c->sw(v1, 104, s5); // sw v1, 104(s5)
if (bc) {goto block_14;} // branch non-likely
c->lw(a0, 124, s5); // lw a0, 124(s5)
c->sw(a0, 44, s4); // sw a0, 44(s4)
block_14:
c->lw(t9, 112, s5); // lw t9, 112(s5)
c->andi(v1, v1, 32896); // andi v1, v1, 32896
c->load_symbol2(a0, cache.add_to_sprite_aux_list);// lw a0, add-to-sprite-aux-list(s7)
c->movn(t9, a0, v1); // movn t9, a0, v1
bc = c->sgpr64(t9) == 0; // beq t9, r0, L106
// nop // sll r0, r0, 0
if (bc) {goto block_16;} // branch non-likely
c->daddiu(sp, sp, -80); // daddiu sp, sp, -80
c->sq(gp, 0, sp); // sq gp, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
c->sq(s4, 32, sp); // sq s4, 32(sp)
c->sq(s1, 48, sp); // sq s1, 48(sp)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a1, s5); // or a1, s5, r0
c->mov64(a2, s4); // or a2, s4, r0
c->mov64(a3, s1); // or a3, s1, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sq(s3, 64, sp); // sq s3, 64(sp)
c->jalr(call_addr); // jalr ra, t9
c->lq(gp, 0, sp); // lq gp, 0(sp)
c->lq(s5, 16, sp); // lq s5, 16(sp)
c->lq(s4, 32, sp); // lq s4, 32(sp)
c->lq(s1, 48, sp); // lq s1, 48(sp)
c->lq(s3, 64, sp); // lq s3, 64(sp)
c->daddiu(sp, sp, 80); // daddiu sp, sp, 80
block_16:
c->lw(a1, 120, s5); // lw a1, 120(s5)
c->lw(v1, 116, s5); // lw v1, 116(s5)
bc = c->sgpr64(a1) == 0; // beq a1, r0, L107
c->dsubu(a0, v1, s0); // dsubu a0, v1, s0
if (bc) {goto block_19;} // branch non-likely
c->daddiu(v1, a0, -1); // daddiu v1, a0, -1
bc = ((s64)c->sgpr64(v1)) >= 0; // bgez v1, L107
c->sw(a0, 116, s5); // sw a0, 116(s5)
if (bc) {goto block_19;} // branch non-likely
c->daddiu(sp, sp, -96); // daddiu sp, sp, -96
c->sq(gp, 0, sp); // sq gp, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
c->sq(s4, 32, sp); // sq s4, 32(sp)
c->sq(s1, 48, sp); // sq s1, 48(sp)
c->sq(s3, 64, sp); // sq s3, 64(sp)
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a3, s4); // or a3, s4, r0
c->mov64(a2, s5); // or a2, s5, r0
c->load_symbol2(t9, cache.sp_relaunch_particle_2d);// lw t9, sp-relaunch-particle-2d(s7)
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->lq(gp, 0, sp); // lq gp, 0(sp)
c->lq(s5, 16, sp); // lq s5, 16(sp)
c->lq(s4, 32, sp); // lq s4, 32(sp)
c->lq(s1, 48, sp); // lq s1, 48(sp)
c->lq(s3, 64, sp); // lq s3, 64(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->daddiu(sp, sp, 96); // daddiu sp, sp, 96
block_19:
c->lqc2(vf1, 0, s4); // lqc2 vf1, 0(s4)
c->lqc2(vf2, 16, s4); // lqc2 vf2, 16(s4)
c->lqc2(vf3, 32, s4); // lqc2 vf3, 32(s4)
c->lqc2(vf4, 16, s5); // lqc2 vf4, 16(s5)
c->lqc2(vf5, 32, s5); // lqc2 vf5, 32(s5)
c->lqc2(vf6, 48, s5); // lqc2 vf6, 48(s5)
c->lqc2(vf7, 64, s5); // lqc2 vf7, 64(s5)
c->lwc1(f0, 96, s5); // lwc1 f0, 96(s5)
c->mfc1(v1, f0); // mfc1 v1, f0
c->vmul_bc(DEST::xyzw, BC::z, vf7, vf7, vf9); // vmulz.xyzw vf7, vf7, vf9
bc = c->sgpr64(v1) == 0; // beq v1, r0, L108
c->vadd(DEST::xyz, vf4, vf4, vf7); // vadd.xyz vf4, vf4, vf7
if (bc) {goto block_21;} // branch non-likely
c->mov128_vf_gpr(vf8, v1); // qmtc2.i vf8, v1
c->vsub_bc(DEST::w, BC::x, vf8, vf0, vf8); // vsubx.w vf8, vf0, vf8
c->vmul_bc(DEST::xyzw, BC::w, vf8, vf8, vf9); // vmulw.xyzw vf8, vf8, vf9
c->vsub_bc(DEST::w, BC::w, vf8, vf0, vf8); // vsubw.w vf8, vf0, vf8
c->vmul_bc(DEST::xyz, BC::w, vf4, vf4, vf8); // vmulw.xyz vf4, vf4, vf8
block_21:
c->vmul_bc(DEST::xyzw, BC::y, vf10, vf4, vf9); // vmuly.xyzw vf10, vf4, vf9
c->vmul_bc(DEST::xyzw, BC::y, vf11, vf5, vf9); // vmuly.xyzw vf11, vf5, vf9
c->vmul_bc(DEST::xyzw, BC::y, vf12, vf6, vf9); // vmuly.xyzw vf12, vf6, vf9
c->vadd(DEST::xyzw, vf1, vf1, vf10); // vadd.xyzw vf1, vf1, vf10
c->vadd(DEST::zw, vf2, vf2, vf11); // vadd.zw vf2, vf2, vf11
c->vadd(DEST::xyzw, vf3, vf3, vf12); // vadd.xyzw vf3, vf3, vf12
c->vmax_bc(DEST::xyzw, BC::x, vf3, vf3, vf0); // vmaxx.xyzw vf3, vf3, vf0
c->sqc2(vf4, 16, s5); // sqc2 vf4, 16(s5)
c->sqc2(vf1, 0, s4); // sqc2 vf1, 0(s4)
c->sqc2(vf2, 16, s4); // sqc2 vf2, 16(s4)
c->sqc2(vf3, 32, s4); // sqc2 vf3, 32(s4)
c->lwc1(f0, 24, s4); // lwc1 f0, 24(s4)
c->cvtws(f0, f0); // cvt.w.s f0, f0
c->mfc1(v1, f0); // mfc1 v1, f0
c->dsll32(v1, v1, 16); // dsll32 v1, v1, 16
c->dsra32(v1, v1, 16); // dsra32 v1, v1, 16
c->mtc1(f0, v1); // mtc1 f0, v1
c->cvtsw(f0, f0); // cvt.s.w f0, f0
c->swc1(f0, 24, s4); // swc1 f0, 24(s4)
c->lw(v1, 104, s5); // lw v1, 104(s5)
c->andi(v1, v1, 64); // andi v1, v1, 64
bc = c->sgpr64(v1) == 0; // beq v1, r0, L109
c->load_symbol2(t9, cache.sp_orbiter); // lw t9, sp-orbiter(s7)
if (bc) {goto block_23;} // branch non-likely
c->daddiu(sp, sp, -96); // daddiu sp, sp, -96
c->sq(gp, 0, sp); // sq gp, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
c->sq(s4, 32, sp); // sq s4, 32(sp)
c->sq(s1, 48, sp); // sq s1, 48(sp)
c->sq(s3, 64, sp); // sq s3, 64(sp)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a1, s5); // or a1, s5, r0
c->mov64(a2, s4); // or a2, s4, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->jalr(call_addr); // jalr ra, t9
c->lq(gp, 0, sp); // lq gp, 0(sp)
c->lq(s5, 16, sp); // lq s5, 16(sp)
c->lq(s4, 32, sp); // lq s4, 32(sp)
c->lq(s1, 48, sp); // lq s1, 48(sp)
c->lq(s3, 64, sp); // lq s3, 64(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->daddiu(sp, sp, 96); // daddiu sp, sp, 96
block_23:
c->lq(v1, 32, s4); // lq v1, 32(s4)
c->lw(a0, 104, s5); // lw a0, 104(s5)
c->andi(a1, a0, 2); // andi a1, a0, 2
bc = c->sgpr64(a1) == 0; // beq a1, r0, L110
c->andi(a1, a0, 4); // andi a1, a0, 4
if (bc) {goto block_26;} // branch non-likely
bc = c->sgpr64(v1) != 0; // bne v1, r0, L110
c->pextuw(t4, v1, r0); // pextuw t4, v1, r0
if (bc) {goto block_26;} // branch non-likely
bc = c->sgpr64(t4) == 0; // beq t4, r0, L112
// nop // sll r0, r0, 0
if (bc) {goto block_31;} // branch non-likely
block_26:
bc = c->sgpr64(a1) == 0; // beq a1, r0, L111
c->andi(a0, a0, 1); // andi a0, a0, 1
if (bc) {goto block_28;} // branch non-likely
c->pcpyud(t4, v1, r0); // pcpyud t4, v1, r0
c->pexew(t4, t4); // pexew t4, t4
bc = ((s64)c->sgpr64(t4)) <= 0; // blez t4, L112
// nop // sll r0, r0, 0
if (bc) {goto block_31;} // branch non-likely
block_28:
bc = c->sgpr64(a0) == 0; // beq a0, r0, L113
// nop // sll r0, r0, 0
if (bc) {goto block_32;} // branch non-likely
c->mov128_gpr_vf(v1, vf1); // qmfc2.i v1, vf1
c->pcpyud(v1, v1, r0); // pcpyud v1, v1, r0
c->pexew(v1, v1); // pexew v1, v1
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L112
c->mov128_gpr_vf(v1, vf2); // qmfc2.i v1, vf2
if (bc) {goto block_31;} // branch non-likely
c->pcpyud(v1, v1, r0); // pcpyud v1, v1, r0
c->pexew(v1, v1); // pexew v1, v1
bc = ((s64)c->sgpr64(v1)) >= 0; // bgez v1, L113
// nop // sll r0, r0, 0
if (bc) {goto block_32;} // branch non-likely
block_31:
c->load_symbol2(t9, cache.sp_free_particle); // lw t9, sp-free-particle(s7)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a1, s1); // or a1, s1, r0
c->mov64(a2, s5); // or a2, s5, r0
c->mov64(a3, s4); // or a3, s4, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
block_32:
c->daddiu(s3, s3, -1); // daddiu s3, s3, -1
c->daddiu(s5, s5, 144); // daddiu s5, s5, 144
c->daddiu(s4, s4, 48); // daddiu s4, s4, 48
bc = c->sgpr64(s3) != 0; // bne s3, r0, L100
c->daddiu(s1, s1, 1); // daddiu s1, s1, 1
if (bc) {goto block_1;} // branch non-likely
c->mov64(v0, s1); // or v0, s1, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 112, sp); // lq gp, 112(sp)
c->lq(s5, 96, sp); // lq s5, 96(sp)
c->lq(s4, 80, sp); // lq s4, 80(sp)
c->lq(s3, 64, sp); // lq s3, 64(sp)
c->lq(s2, 48, sp); // lq s2, 48(sp)
c->lq(s1, 32, sp); // lq s1, 32(sp)
c->lq(s0, 16, sp); // lq s0, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 128); // daddiu sp, sp, 128
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c();
cache.add_to_sprite_aux_list = intern_from_c("add-to-sprite-aux-list").c();
cache.sp_free_particle = intern_from_c("sp-free-particle").c();
cache.sp_orbiter = intern_from_c("sp-orbiter").c();
cache.sp_relaunch_particle_2d = intern_from_c("sp-relaunch-particle-2d").c();
gLinkedFunctionTable.reg("sp-process-block-2d", execute, 256);
}
} // namespace sp_process_block_2d
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jak2/kscheme.h"
using ::jak2::intern_from_c;
namespace Mips2C::jak2 {
namespace sp_process_block_3d {
struct Cache {
void* fake_scratchpad_data; // *fake-scratchpad-data*
void* quaternion; // quaternion*!
void* quaternion_normalize; // quaternion-normalize!
void* sp_free_particle; // sp-free-particle
void* sp_relaunch_particle_3d; // sp-relaunch-particle-3d
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -176); // daddiu sp, sp, -176
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s0, 64, sp); // sq s0, 64(sp)
c->sq(s1, 80, sp); // sq s1, 80(sp)
c->sq(s2, 96, sp); // sq s2, 96(sp)
c->sq(s3, 112, sp); // sq s3, 112(sp)
c->sq(s4, 128, sp); // sq s4, 128(sp)
c->sq(s5, 144, sp); // sq s5, 144(sp)
c->sq(gp, 160, sp); // sq gp, 160(sp)
c->mov64(gp, a0); // or gp, a0, r0
c->mov64(s5, a1); // or s5, a1, r0
c->mov64(s4, a2); // or s4, a2, r0
c->mov64(s0, a3); // or s0, a3, r0
c->mov64(s3, t0); // or s3, t0, r0
c->mov64(s2, t1); // or s2, t1, r0
c->daddiu(s1, sp, 16); // daddiu s1, sp, 16
c->sq(r0, 0, s1); // sq r0, 0(s1)
block_1:
c->lb(v1, 128, s5); // lb v1, 128(s5)
bc = c->sgpr64(v1) == 0; // beq v1, r0, L98
// nop // sll r0, r0, 0
if (bc) {goto block_33;} // branch non-likely
c->lb(a0, 129, s5); // lb a0, 129(s5)
get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672
c->dsll(a0, a0, 4); // dsll a0, a0, 4
c->daddu(v1, v1, a0); // daddu v1, v1, a0
c->lqc2(vf16, 0, v1); // lqc2 vf16, 0(v1)
c->mov128_gpr_vf(v1, vf16); // qmfc2.i v1, vf16
c->andi(v1, v1, 255); // andi v1, v1, 255
c->sq(v1, 32, sp); // sq v1, 32(sp)
c->lq(v1, 32, sp); // lq v1, 32(sp)
bc = c->sgpr64(v1) != 0; // bne v1, r0, L86
// nop // sll r0, r0, 0
if (bc) {goto block_7;} // branch non-likely
c->lw(v1, 100, s5); // lw v1, 100(s5)
c->addiu(a0, r0, -1); // addiu a0, r0, -1
bc = c->sgpr64(v1) == c->sgpr64(a0); // beq v1, a0, L85
// nop // sll r0, r0, 0
if (bc) {goto block_5;} // branch non-likely
bc = c->sgpr64(v1) == 0; // beq v1, r0, L97
// nop // sll r0, r0, 0
if (bc) {goto block_32;} // branch non-likely
block_5:
c->lw(a0, 104, s5); // lw a0, 104(s5)
c->andi(v1, a0, 32); // andi v1, a0, 32
c->xor_(a0, a0, v1); // xor a0, a0, v1
bc = c->sgpr64(v1) == 0; // beq v1, r0, L98
c->sw(a0, 104, s5); // sw a0, 104(s5)
if (bc) {goto block_33;} // branch non-likely
c->lw(v1, 124, s5); // lw v1, 124(s5)
//beq r0, r0, L98 // beq r0, r0, L98
c->sw(v1, 44, s4); // sw v1, 44(s4)
goto block_33; // branch always
block_7:
c->lw(v1, 100, s5); // lw v1, 100(s5)
c->addiu(a0, r0, -1); // addiu a0, r0, -1
bc = c->sgpr64(v1) == c->sgpr64(a0); // beq v1, a0, L87
c->lq(a0, 32, sp); // lq a0, 32(sp)
if (bc) {goto block_10;} // branch non-likely
c->dsubu(a0, v1, a0); // dsubu a0, v1, a0
bc = c->sgpr64(v1) == 0; // beq v1, r0, L97
c->pmaxw(v1, a0, r0); // pmaxw v1, a0, r0
if (bc) {goto block_32;} // branch non-likely
c->sw(v1, 100, s5); // sw v1, 100(s5)
block_10:
c->lw(a0, 104, s5); // lw a0, 104(s5)
c->andi(v1, a0, 32); // andi v1, a0, 32
c->xor_(a0, a0, v1); // xor a0, a0, v1
bc = c->sgpr64(v1) == 0; // beq v1, r0, L88
c->sw(a0, 104, s5); // sw a0, 104(s5)
if (bc) {goto block_12;} // branch non-likely
c->lw(v1, 124, s5); // lw v1, 124(s5)
c->sw(v1, 44, s4); // sw v1, 44(s4)
block_12:
c->lw(t9, 112, s5); // lw t9, 112(s5)
bc = c->sgpr64(t9) == 0; // beq t9, r0, L89
// nop // sll r0, r0, 0
if (bc) {goto block_14;} // branch non-likely
c->daddiu(sp, sp, -96); // daddiu sp, sp, -96
c->sq(gp, 0, sp); // sq gp, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
c->sq(s4, 32, sp); // sq s4, 32(sp)
c->sq(s0, 48, sp); // sq s0, 48(sp)
c->sq(s3, 64, sp); // sq s3, 64(sp)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a1, s5); // or a1, s5, r0
c->mov64(a2, s4); // or a2, s4, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->jalr(call_addr); // jalr ra, t9
c->lq(gp, 0, sp); // lq gp, 0(sp)
c->lq(s5, 16, sp); // lq s5, 16(sp)
c->lq(s4, 32, sp); // lq s4, 32(sp)
c->lq(s0, 48, sp); // lq s0, 48(sp)
c->lq(s3, 64, sp); // lq s3, 64(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->daddiu(sp, sp, 96); // daddiu sp, sp, 96
block_14:
c->lw(a1, 120, s5); // lw a1, 120(s5)
c->lw(v1, 116, s5); // lw v1, 116(s5)
bc = c->sgpr64(a1) == 0; // beq a1, r0, L90
c->lq(a0, 32, sp); // lq a0, 32(sp)
if (bc) {goto block_17;} // branch non-likely
c->dsubu(v1, v1, a0); // dsubu v1, v1, a0
bc = ((s64)c->sgpr64(v1)) >= 0; // bgez v1, L90
c->sw(v1, 116, s5); // sw v1, 116(s5)
if (bc) {goto block_17;} // branch non-likely
c->daddiu(sp, sp, -96); // daddiu sp, sp, -96
c->sq(gp, 0, sp); // sq gp, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
c->sq(s4, 32, sp); // sq s4, 32(sp)
c->sq(s0, 48, sp); // sq s0, 48(sp)
c->sq(s3, 64, sp); // sq s3, 64(sp)
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a3, s4); // or a3, s4, r0
c->mov64(a2, s5); // or a2, s5, r0
c->load_symbol2(t9, cache.sp_relaunch_particle_3d);// lw t9, sp-relaunch-particle-3d(s7)
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->lq(gp, 0, sp); // lq gp, 0(sp)
c->lq(s5, 16, sp); // lq s5, 16(sp)
c->lq(s4, 32, sp); // lq s4, 32(sp)
c->lq(s0, 48, sp); // lq s0, 48(sp)
c->lq(s3, 64, sp); // lq s3, 64(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->daddiu(sp, sp, 96); // daddiu sp, sp, 96
block_17:
c->lqc2(vf8, 0, s4); // lqc2 vf8, 0(s4)
c->lqc2(vf9, 16, s4); // lqc2 vf9, 16(s4)
c->lqc2(vf10, 32, s4); // lqc2 vf10, 32(s4)
c->lqc2(vf11, 16, s5); // lqc2 vf11, 16(s5)
c->lqc2(vf12, 32, s5); // lqc2 vf12, 32(s5)
c->lqc2(vf13, 48, s5); // lqc2 vf13, 48(s5)
c->lqc2(vf14, 64, s5); // lqc2 vf14, 64(s5)
c->lwc1(f0, 96, s5); // lwc1 f0, 96(s5)
c->mfc1(v1, f0); // mfc1 v1, f0
c->vmul_bc(DEST::xyzw, BC::z, vf14, vf14, vf16); // vmulz.xyzw vf14, vf14, vf16
bc = c->sgpr64(v1) == 0; // beq v1, r0, L91
c->vadd(DEST::xyz, vf11, vf11, vf14); // vadd.xyz vf11, vf11, vf14
if (bc) {goto block_19;} // branch non-likely
c->mov128_vf_gpr(vf15, v1); // qmtc2.i vf15, v1
c->vsub_bc(DEST::w, BC::x, vf15, vf0, vf15); // vsubx.w vf15, vf0, vf15
c->vmul_bc(DEST::xyzw, BC::w, vf15, vf15, vf16); // vmulw.xyzw vf15, vf15, vf16
c->vsub_bc(DEST::w, BC::w, vf15, vf0, vf15); // vsubw.w vf15, vf0, vf15
c->vmul_bc(DEST::xyz, BC::w, vf11, vf11, vf15); // vmulw.xyz vf11, vf11, vf15
block_19:
c->vmul_bc(DEST::xyzw, BC::y, vf17, vf11, vf16); // vmuly.xyzw vf17, vf11, vf16
c->vmul_bc(DEST::xyzw, BC::y, vf18, vf12, vf16); // vmuly.xyzw vf18, vf12, vf16
c->vmul_bc(DEST::xyzw, BC::y, vf19, vf13, vf16); // vmuly.xyzw vf19, vf13, vf16
c->vadd(DEST::xyzw, vf8, vf8, vf17); // vadd.xyzw vf8, vf8, vf17
c->vadd_bc(DEST::w, BC::w, vf9, vf9, vf18); // vaddw.w vf9, vf9, vf18
c->vadd(DEST::xyzw, vf10, vf10, vf19); // vadd.xyzw vf10, vf10, vf19
c->vmax_bc(DEST::xyzw, BC::x, vf10, vf10, vf0); // vmaxx.xyzw vf10, vf10, vf0
c->sqc2(vf11, 16, s5); // sqc2 vf11, 16(s5)
c->sqc2(vf8, 0, s4); // sqc2 vf8, 0(s4)
c->sqc2(vf9, 16, s4); // sqc2 vf9, 16(s4)
c->sqc2(vf10, 32, s4); // sqc2 vf10, 32(s4)
c->mov64(v1, s1); // or v1, s1, r0
c->mov64(a0, s4); // or a0, s4, r0
c->lwc1(f0, 16, a0); // lwc1 f0, 16(a0)
c->lwc1(f1, 20, a0); // lwc1 f1, 20(a0)
c->lwc1(f2, 24, a0); // lwc1 f2, 24(a0)
c->swc1(f0, 0, v1); // swc1 f0, 0(v1)
c->swc1(f1, 4, v1); // swc1 f1, 4(v1)
c->swc1(f2, 8, v1); // swc1 f2, 8(v1)
c->lui(a0, 16256); // lui a0, 16256
c->mtc1(f3, a0); // mtc1 f3, a0
c->muls(f2, f2, f2); // mul.s f2, f2, f2
c->subs(f2, f3, f2); // sub.s f2, f3, f2
c->muls(f1, f1, f1); // mul.s f1, f1, f1
c->subs(f1, f2, f1); // sub.s f1, f2, f1
c->muls(f0, f0, f0); // mul.s f0, f0, f0
c->subs(f0, f1, f0); // sub.s f0, f1, f0
c->sqrts(f0, f0); // sqrt.s f0, f0
c->swc1(f0, 12, v1); // swc1 f0, 12(v1)
c->mfc1(a0, f0); // mfc1 a0, f0
c->lq(v1, 32, sp); // lq v1, 32(sp)
c->mov64(v1, v1); // or v1, v1, r0
c->sq(v1, 48, sp); // sq v1, 48(sp)
block_20:
c->load_symbol2(t9, cache.quaternion); // lw t9, quaternion*!(s7)
c->mov64(a0, s1); // or a0, s1, r0
c->mov64(a1, s1); // or a1, s1, r0
c->daddiu(a2, s5, 80); // daddiu a2, s5, 80
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->lq(v1, 48, sp); // lq v1, 48(sp)
c->daddiu(v1, v1, -10); // daddiu v1, v1, -10
c->sq(v1, 48, sp); // sq v1, 48(sp)
// nop // sll r0, r0, 0
c->lq(v1, 48, sp); // lq v1, 48(sp)
bc = ((s64)c->sgpr64(v1)) > 0; // bgtz v1, L92
// nop // sll r0, r0, 0
if (bc) {goto block_20;} // branch non-likely
c->load_symbol2(t9, cache.quaternion_normalize); // lw t9, quaternion-normalize!(s7)
c->mov64(a0, s1); // or a0, s1, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mov64(a0, s4); // or a0, s4, r0
c->mov64(v1, s1); // or v1, s1, r0
c->lwc1(f0, 12, v1); // lwc1 f0, 12(v1)
c->mtc1(f1, r0); // mtc1 f1, r0
cop1_bc = c->fprs[f0] < c->fprs[f1]; // c.lt.s f0, f1
bc = !cop1_bc; // bc1f L93
// nop // sll r0, r0, 0
if (bc) {goto block_23;} // branch non-likely
c->lqc2(vf1, 16, a0); // lqc2 vf1, 16(a0)
c->lqc2(vf2, 0, v1); // lqc2 vf2, 0(v1)
c->vsub(DEST::xyz, vf1, vf0, vf2); // vsub.xyz vf1, vf0, vf2
c->sqc2(vf1, 16, a0); // sqc2 vf1, 16(a0)
c->mov128_gpr_vf(a0, vf1); // qmfc2.i a0, vf1
//beq r0, r0, L94 // beq r0, r0, L94
// nop // sll r0, r0, 0
goto block_24; // branch always
block_23:
c->lqc2(vf1, 16, a0); // lqc2 vf1, 16(a0)
c->lqc2(vf2, 0, v1); // lqc2 vf2, 0(v1)
c->vadd(DEST::xyz, vf1, vf0, vf2); // vadd.xyz vf1, vf0, vf2
c->sqc2(vf1, 16, a0); // sqc2 vf1, 16(a0)
c->mov128_gpr_vf(a0, vf1); // qmfc2.i a0, vf1
block_24:
c->mov128_gpr_vf(v1, vf10); // qmfc2.i v1, vf10
c->lw(a0, 104, s5); // lw a0, 104(s5)
c->andi(a1, a0, 2); // andi a1, a0, 2
bc = c->sgpr64(a1) == 0; // beq a1, r0, L95
c->andi(a1, a0, 4); // andi a1, a0, 4
if (bc) {goto block_27;} // branch non-likely
bc = c->sgpr64(v1) != 0; // bne v1, r0, L95
c->pextuw(a2, v1, r0); // pextuw a2, v1, r0
if (bc) {goto block_27;} // branch non-likely
bc = c->sgpr64(a2) == 0; // beq a2, r0, L97
// nop // sll r0, r0, 0
if (bc) {goto block_32;} // branch non-likely
block_27:
bc = c->sgpr64(a1) == 0; // beq a1, r0, L96
c->andi(a0, a0, 1); // andi a0, a0, 1
if (bc) {goto block_29;} // branch non-likely
c->pcpyud(v1, v1, r0); // pcpyud v1, v1, r0
c->pexew(v1, v1); // pexew v1, v1
bc = ((s64)c->sgpr64(v1)) <= 0; // blez v1, L97
// nop // sll r0, r0, 0
if (bc) {goto block_32;} // branch non-likely
block_29:
bc = c->sgpr64(a0) == 0; // beq a0, r0, L98
// nop // sll r0, r0, 0
if (bc) {goto block_33;} // branch non-likely
c->mov128_gpr_vf(v1, vf8); // qmfc2.i v1, vf8
c->pcpyud(v1, v1, r0); // pcpyud v1, v1, r0
c->pexew(v1, v1); // pexew v1, v1
bc = ((s64)c->sgpr64(v1)) < 0; // bltz v1, L97
c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9
if (bc) {goto block_32;} // branch non-likely
c->pcpyud(v1, v1, r0); // pcpyud v1, v1, r0
c->pexew(v1, v1); // pexew v1, v1
bc = ((s64)c->sgpr64(v1)) >= 0; // bgez v1, L98
// nop // sll r0, r0, 0
if (bc) {goto block_33;} // branch non-likely
block_32:
c->load_symbol2(t9, cache.sp_free_particle); // lw t9, sp-free-particle(s7)
c->mov64(a0, gp); // or a0, gp, r0
c->mov64(a1, s0); // or a1, s0, r0
c->mov64(a2, s5); // or a2, s5, r0
c->mov64(a3, s4); // or a3, s4, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
block_33:
c->daddiu(s3, s3, -1); // daddiu s3, s3, -1
c->daddiu(s5, s5, 144); // daddiu s5, s5, 144
c->daddiu(s4, s4, 48); // daddiu s4, s4, 48
bc = c->sgpr64(s3) != 0; // bne s3, r0, L84
c->daddiu(s0, s0, 1); // daddiu s0, s0, 1
if (bc) {goto block_1;} // branch non-likely
c->mov64(v0, s0); // or v0, s0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 160, sp); // lq gp, 160(sp)
c->lq(s5, 144, sp); // lq s5, 144(sp)
c->lq(s4, 128, sp); // lq s4, 128(sp)
c->lq(s3, 112, sp); // lq s3, 112(sp)
c->lq(s2, 96, sp); // lq s2, 96(sp)
c->lq(s1, 80, sp); // lq s1, 80(sp)
c->lq(s0, 64, sp); // lq s0, 64(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 176); // daddiu sp, sp, 176
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c();
cache.quaternion = intern_from_c("quaternion*!").c();
cache.quaternion_normalize = intern_from_c("quaternion-normalize!").c();
cache.sp_free_particle = intern_from_c("sp-free-particle").c();
cache.sp_relaunch_particle_3d = intern_from_c("sp-relaunch-particle-3d").c();
gLinkedFunctionTable.reg("sp-process-block-3d", execute, 512);
}
} // namespace sp_process_block_3d
} // namespace Mips2C
File diff suppressed because it is too large Load Diff
+41
View File
@@ -274,6 +274,8 @@ struct ExecutionContext {
gprs[gpr].ds64[0] = val; // sign extend and set
}
void store_symbol2(int gpr, void* sym_addr) { memcpy((u8*)sym_addr - 1, &gprs[gpr].ds32[0], 4); }
void load_symbol_addr(int gpr, void* sym_addr) {
gprs[gpr].du64[0] = ((const u8*)sym_addr) - g_ee_main_mem;
}
@@ -719,6 +721,14 @@ struct ExecutionContext {
}
}
void pceqw(int dst, int rs, int rt) {
auto s = gpr_src(rs);
auto t = gpr_src(rt);
for (int i = 0; i < 4; i++) {
gprs[dst].du32[i] = (s.du32[i] == t.du32[i]) ? 0xffffffff : 0;
}
}
void pmfhl_lh(int dest) {
gprs[dest].du16[0] = lo.du16[0];
gprs[dest].du16[1] = lo.du16[2];
@@ -1430,6 +1440,37 @@ struct ExecutionContext {
gprs[dst].du64[0] = (gprs[dst].du64[0] & LDR_MASK[shift]) | (mem >> LDR_SHIFT[shift]);
}
u32 clip(int xyz_idx, int w_idx, u32 old_clip) {
u32 result = (old_clip << 6);
auto xyz_vec = vf_src(xyz_idx);
float w = vf_src(w_idx).f[3];
float plus = std::abs(w);
float minus = -plus;
if (xyz_vec.f[0] > plus) {
result |= 0b1;
}
if (xyz_vec.f[0] < minus) {
result |= 0b10;
}
if (xyz_vec.f[1] > plus) {
result |= 0b100;
}
if (xyz_vec.f[1] < minus) {
result |= 0b1000;
}
if (xyz_vec.f[2] > plus) {
result |= 0b10000;
}
if (xyz_vec.f[2] < minus) {
result |= 0b100000;
}
return result & 0xffffff; // only 24 bits
}
std::string print_vf_float(int vf) {
auto src = vf_src(vf);
return fmt::format("{} {} {} {}", src.f[0], src.f[1], src.f[2], src.f[3]);
+11 -1
View File
@@ -129,6 +129,12 @@ namespace render_boundary_tri { extern void link(); }
namespace render_boundary_quad { extern void link(); }
namespace set_sky_vf27 { extern void link(); }
namespace draw_boundary_polygon { extern void link(); }
namespace sp_init_fields { extern void link(); }
namespace particle_adgif { extern void link(); }
namespace sp_launch_particles_var { extern void link(); }
namespace sparticle_motion_blur { extern void link(); }
namespace sp_process_block_2d { extern void link(); }
namespace sp_process_block_3d { extern void link(); }
}
// clang-format on
@@ -213,7 +219,11 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
{"debug",
{jak2::debug_line_clip::link, jak2::init_boundary_regs::link,
jak2::render_boundary_quad::link, jak2::render_boundary_tri::link, jak2::set_sky_vf27::link,
jak2::draw_boundary_polygon::link}}},
jak2::draw_boundary_polygon::link}},
{"sparticle-launcher",
{jak2::sp_init_fields::link, jak2::particle_adgif::link, jak2::sp_launch_particles_var::link,
jak2::sparticle_motion_blur::link}},
{"sparticle", {jak2::sp_process_block_2d::link, jak2::sp_process_block_3d::link}}},
};
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
@@ -9,11 +9,13 @@
(define-extern position-in-front-of-camera! (function vector float float vector))
;; NOTE - for sparticle-launcher
(define-extern math-camera-matrix
"Returns [[*math-camera*]]'s `inv-camera-rot`"
(function matrix))
(define-extern matrix-local->world (function symbol matrix))
;; DECOMP BEGINS
(define-perm *camera-init-mat* matrix #f)
+138
View File
@@ -7,3 +7,141 @@
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(when *debug-segment*
;; failed to figure out what this is:
(defpartgroup group-part-tester
:id 127
:flags (unk-4 unk-6)
:bounds (static-bspherem 0 0 0 640)
:rotate ((degrees 2) (degrees 0) (degrees 0))
:parts ((sp-item 209))
)
;; definition of type part-tester
(deftype part-tester (process)
((root trsqv :offset-assert 128)
(part sparticle-launch-control :offset-assert 132)
(old-group sparticle-launch-group :offset-assert 136)
)
:heap-base #x10
:method-count-assert 14
:size-assert #x8c
:flag-assert #xe0010008c
)
(define-extern *part-tester* (pointer process))
;; definition for method 3 of type part-tester
(defmethod inspect part-tester ((obj part-tester))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process inspect)))
(t9-0 obj)
)
(format #t "~2Troot: ~A~%" (-> obj root))
(format #t "~2Tpart: ~A~%" (-> obj part))
(format #t "~2Told-group: ~A~%" (-> obj old-group))
(label cfg-4)
obj
)
;; definition for symbol *part-tester-name*, type string
(define *part-tester-name* (the-as string #f))
;; definition for method 10 of type part-tester
(defmethod deactivate part-tester ((obj part-tester))
(if (nonzero? (-> obj part))
(kill-and-free-particles (-> obj part))
)
((method-of-type process deactivate) obj)
(none)
)
;; failed to figure out what this is:
(defstate part-tester-idle (part-tester)
:code (behavior ()
(until #f
(let ((gp-0 (entity-by-name *part-tester-name*)))
(when gp-0
(let ((s5-0 (-> gp-0 extra process)))
(if (and s5-0 (type? s5-0 process-drawable) (nonzero? (-> (the-as process-drawable s5-0) root)))
(set! (-> self root trans quad) (-> (the-as process-drawable s5-0) root trans quad))
(set! (-> self root trans quad) (-> gp-0 extra trans quad))
)
)
)
)
(add-debug-x
#t
(bucket-id debug-no-zbuf1)
(-> self root trans)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
;(let ((gp-1 (-> *part-group-id-table* 127)))
(let ((gp-1 (-> *part-group-id-table* 96)))
(let ((s5-1 (-> self root trans)))
(when (!= gp-1 (-> self old-group))
(when (nonzero? (-> self part))
(kill-and-free-particles (-> self part))
(set! (-> self heap-cur) (&-> (-> self part) type))
)
(set! (-> self part) (create-launch-control gp-1 self))
)
(if (nonzero? (-> self part))
(spawn (-> self part) (cond
((logtest? (-> gp-1 flags) (sp-group-flag screen-space))
*zero-vector*
)
(else
(empty)
s5-1
)
)
)
)
)
(set! (-> self old-group) gp-1)
)
(suspend)
)
#f
(none)
)
)
;; definition for function part-tester-init-by-other
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs none.
(defbehavior part-tester-init-by-other process-drawable ((arg0 vector))
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg0 quad))
(set! *part-tester* (process->ppointer self))
(go part-tester-idle)
(none)
)
;; definition (perm) for symbol *debug-part-dead-pool*, type dead-pool
(define-perm *debug-part-dead-pool* dead-pool (new 'debug 'dead-pool 1 #x10000 "*debug-part-dead-pool*"))
;; definition for function start-part
;; WARN: Return type mismatch (pointer process) vs none.
(defun start-part ()
(kill-by-type part-tester *active-pool*)
(process-spawn
part-tester
(if *anim-tester*
(-> *anim-tester* 0 root trans)
(target-pos 0)
)
:from *debug-part-dead-pool*
)
(none)
)
)
+22 -22
View File
@@ -375,12 +375,12 @@
; )
;; run the sprite/particle system.
; (if (not (paused?))
; (execute-part-engine)
; )
; (if (logtest? (vu1-renderer-mask rn29) (-> *display* vu1-enable-user))
; (sprite-draw *display*)
; )
(if (not (paused?))
(execute-part-engine)
)
(if (logtest? (vu1-renderer-mask sprite) (-> *display* vu1-enable-user))
(sprite-draw *display*)
)
;; debug draw collision stuff before processing it.
(when *debug-segment*
@@ -684,7 +684,7 @@
(*pre-draw-hook* (-> s5-1 calc-buf))
(when (not (paused?))
(clear *stdcon1*)
;(debug-reset-buffers)
(debug-reset-buffers)
;(clear! *simple-sprite-system*)
)
(set! (-> s5-1 bucket-group) (dma-buffer-add-buckets (-> s5-1 calc-buf) 327))
@@ -940,23 +940,23 @@
; (generic-vu1-init-buffers)
;; sprite texture remaps
; (when (-> *texture-pool* update-sprites-flag)
; (update-sprites *texture-pool*)
; (particle-adgif-cache-flush)
; (remap-all-particles)
; )
(when (-> *texture-pool* update-sprites-flag)
(update-sprites *texture-pool*)
(particle-adgif-cache-flush)
(remap-all-particles)
)
;; texture uploads while GS is not doing anything.
; (with-profiler 'texture *profile-texture-color*
; (let ((s3-1 (-> pp clock)))
; (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3))
; (set! (-> pp clock) (-> *display* bg-clock))
; (set! (-> pp clock) (-> *display* real-clock))
; )
; (upload-textures *texture-pool*)
; (set! (-> pp clock) s3-1)
; )
; )
(with-profiler 'texture *profile-texture-color*
(let ((s3-1 (-> pp clock)))
(if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3))
(set! (-> pp clock) (-> *display* bg-clock))
(set! (-> pp clock) (-> *display* real-clock))
)
(upload-textures *texture-pool*)
(set! (-> pp clock) s3-1)
)
)
;; more texture mapping.
; (if (-> *texture-pool* update-flag)
+6 -6
View File
@@ -620,7 +620,7 @@
;; a few things before the actor updates...
; (set! (-> *time-of-day-context* title-updated) #f)
(set! (-> *time-of-day-context* title-updated) #f)
;; update teleport counter
; (set! *teleport* #f)
@@ -630,11 +630,11 @@
; )
;; update particles (we're racing the DMA transfer again, do this asap)
; (let ((gp-1 (-> pp clock)))
; (set! (-> pp clock) (-> *display* part-clock))
; (process-particles)
; (set! (-> pp clock) gp-1)
; )
(let ((gp-1 (-> pp clock)))
(set! (-> pp clock) (-> *display* part-clock))
(process-particles)
(set! (-> pp clock) gp-1)
)
;; set up VU0's VIF for collision code run by actors
; (dma-send
+11 -10
View File
@@ -51,10 +51,10 @@
)
)
(when (and (-> *setting-control* user-current weather) gp-0)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s4-0 (new 'stack-no-clear 'vector))
(v1-8 (-> *math-camera* inv-camera-rot vector 2))
)
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(let ((v1-8 (-> *math-camera* inv-camera-rot vector 2)))
(set! (-> s5-0 quad) (-> *math-camera* trans quad))
(vector-! s4-0 s5-0 (-> *math-camera* prev-trans))
(let ((f0-1 (vector-dot s4-0 v1-8)))
@@ -62,13 +62,13 @@
)
)
(set! (-> s5-0 y) (-> *math-camera* trans y))
(if (< 0.0 (-> *setting-control* user-current rain))
(update-rain (-> *setting-control* user-current rain) s5-0 s4-0)
)
(if (< 0.0 (-> *setting-control* user-current snow))
(update-snow (-> *setting-control* user-current snow) s5-0 s4-0)
)
)
(if (< 0.0 (-> *setting-control* user-current rain))
(update-rain (the-as target (-> *setting-control* user-current rain)))
)
(if (< 0.0 (-> *setting-control* user-current snow))
(update-snow (the-as target (-> *setting-control* user-current snow)))
)
)
(cond
((and (>= (-> self time-of-day) 6.25)
@@ -124,6 +124,7 @@
(none)
)
;; definition for function update-counters
(defbehavior update-counters time-of-day-proc ()
(let ((v1-2 (-> *display* bg-clock frame-counter)))
File diff suppressed because it is too large Load Diff
@@ -36,16 +36,20 @@
)
;; ---sp-cpuinfo-flag
;; NOTE - for relocate
(defenum sp-cpuinfo-flag-s32
:bitfield #t
:type int32
:copy-entries sp-cpuinfo-flag
)
(declare-type sparticle-system basic)
(declare-type sparticle-cpuinfo structure)
(declare-type sparticle-launch-control inline-array-class)
(define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none))
;; NOTE - for many things
(define-extern *part-id-table* (array sparticle-launcher))
;; NOTE - for sparticle-launcher
(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo))
(define-extern kill-all-particles-with-key (function sparticle-launch-control none))
(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol))
@@ -70,7 +74,8 @@
(scalevely float :offset 44)
(friction float :offset-assert 96)
(timer int32 :offset-assert 100)
(flags sp-cpuinfo-flag :offset-assert 104)
(flags sp-cpuinfo-flag :offset-assert 104) ;; NOTE - loaded with lw and lwu?
(flags-s32 sp-cpuinfo-flag-s32 :offset 104)
(user-int32 int32 :offset-assert 108)
(user-uint32 uint32 :offset 108)
(user-float float :offset 108)
@@ -88,7 +93,7 @@
(key-alt sparticle-launch-state :offset 132)
(binding sparticle-launch-state :offset-assert 136)
(data uint32 1 :offset 12)
(datab uint8 4 :offset 12)
(datab int8 4 :offset 12)
(dataf float 1 :offset 12)
(datac uint8 1 :offset 12)
)
@@ -144,3 +149,5 @@
(define-extern *sp-particle-system-2d* sparticle-system)
(define-extern *sp-particle-system-3d* sparticle-system)
@@ -357,7 +357,7 @@
:flag-assert #xb00000010
(:methods
(get-field-spec-by-id (_type_ sp-field-id) sp-field-init-spec 9)
(sparticle-launcher-method-10 (_type_ string) none 10)
(setup-user-array (_type_ string) none 10)
)
)
@@ -447,10 +447,10 @@
:flag-assert #x1000000070
(:methods
(initialize (_type_ sparticle-launch-group process) none 9)
(sparticle-launch-control-method-10 (_type_ vector) symbol 10)
(is-visible? (_type_ vector) symbol 10)
(spawn (_type_ vector) none 11)
(sparticle-launch-control-method-12 (_type_ matrix) none 12)
(sparticle-launch-control-method-13 (_type_ cspace) none 13)
(spawn-with-matrix (_type_ matrix) none 12)
(spawn-with-cspace (_type_ cspace) none 13)
(kill-and-free-particles (_type_) none 14)
(kill-particles (_type_) none 15)
)
@@ -5,6 +5,8 @@
;; name in dgo: sparticle-launcher
;; dgos: ENGINE, GAME
;; TODO sparticle-texture-day-night vf1/vf2 issue
;; og:ignore-form:sp-relaunch-particle-3d
;; og:ignore-form:execute-part-engine
;; og:ignore-form:sparticle-respawn-heights
@@ -19,7 +21,6 @@
(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object)) ;; TODO - mips2c
(define-extern particle-adgif (function adgif-shader texture-id none)) ;; TODO - particle-adgif atomic ops, MIPS2C
(define-extern particle-adgif-callback (function adgif-shader none)) ;; TODO bad VF dependencies
(define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none)) ;; TODO - mips2c
;; DECOMP BEGINS
@@ -95,7 +96,7 @@
0
)
;; ERROR: function was not converted to expressions. Cannot decompile.
(def-mips2c sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object))
(deftype sp-queued-launch-particles (structure)
((sp-system sparticle-system :offset-assert 0)
@@ -128,7 +129,32 @@
(kmemclose)
;; ERROR: function has no type analysis. Cannot decompile.
(defun particle-setup-adgif ((arg0 adgif-shader) (arg1 int))
(let ((a1-1 (lookup-texture-by-id-fast (the-as texture-id arg1)))
(s5-0 #f)
)
(when (not a1-1)
(set! a1-1 (lookup-texture-by-id-fast (new 'static 'texture-id :index #x9b :page #xb)))
(set! s5-0 #t)
)
(set! (-> arg0 tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1))
(set! (-> arg0 tex0 tfx) 0)
(adgif-shader<-texture! arg0 a1-1)
(set! (-> arg0 prims 1) (gs-reg64 tex0-1))
(set! (-> arg0 prims 3) (the-as gs-reg64 (logior arg1 20)))
(set! (-> arg0 prims 5) (gs-reg64 miptbp1-1))
(set! (-> arg0 clamp-reg) (gs-reg64 zbuf-1))
(set! (-> arg0 prims 9) (gs-reg64 alpha-1))
(if s5-0
(logior! (-> arg0 link-test) (link-test-flags backup-sprite-tex))
)
)
(set! (-> arg0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
(set! (-> arg0 clamp) (new 'static 'gs-clamp :minu #x13 :minv #x101))
0
(none)
)
(deftype particle-adgif-cache (basic)
((used int32 :offset-assert 4)
@@ -159,9 +185,46 @@
(none)
)
;; ERROR: function was not converted to expressions. Cannot decompile.
(def-mips2c particle-adgif (function adgif-shader texture-id none))
;; ERROR: function was not converted to expressions. Cannot decompile.
(defun particle-adgif-callback ((arg0 adgif-shader) (arg1 texture-id))
"Callback to update the adgif of a particle, keeping only alpha and clamp.
This is new for jak 2.
There is some funny stuff going on with vf16 - vf20, but it seems like this function just
preserves those registers (which particle-adgif likely clobbers) so this doesn't clobber
registers used by particle system, which it assumes are preserved across callbacks."
(local-vars (v1-0 float))
(rlet ((vf16 :class vf)
(vf17 :class vf)
(vf18 :class vf)
(vf19 :class vf)
(vf20 :class vf)
)
(let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 4)))
(let ((s4-0 (-> arg0 alpha))
(s3-0 (-> arg0 clamp))
)
; (.svf (&-> s5-0 0 quad) vf16)
; (.svf (&-> s5-0 1 quad) vf17)
; (.svf (&-> s5-0 2 quad) vf18)
; (.svf (&-> s5-0 3 quad) vf19)
; (.svf (&-> s5-0 4 quad) vf20)
(particle-adgif arg0 arg1)
(set! (-> arg0 alpha) s4-0)
(set! (-> arg0 clamp) s3-0)
)
; (.lvf vf16 (&-> s5-0 0 quad))
; (.lvf vf17 (&-> s5-0 1 quad))
; (.lvf vf18 (&-> s5-0 2 quad))
; (.lvf vf19 (&-> s5-0 3 quad))
; (.lvf vf20 (&-> s5-0 4 quad))
)
(.mov v1-0 vf20)
0
(none)
)
)
(defun sp-queue-launch ((arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 matrix))
(let ((v1-0 *sp-launch-queue*))
@@ -327,7 +390,7 @@
)
;; ERROR: function was not converted to expressions. Cannot decompile.
(def-mips2c sp-launch-particles-var (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none))
(define *death-adgif* (the-as adgif-shader #f))
@@ -567,11 +630,83 @@
(none)
)
;; ERROR: failed type prop at 32: Could not figure out load: (set! a1 (l.w (+ gp 104)))
(defun sp-relaunch-particle-3d ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d))
(local-vars (v1-9 float) (v1-10 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((s4-0 (new 'stack-no-clear 'quaternion)))
(let* ((v1-0 s4-0)
(a2-1 arg3)
(f0-0 (-> a2-1 qx-qy-qz-sy x))
(f1-0 (-> a2-1 qx-qy-qz-sy y))
(f2-0 (-> a2-1 qx-qy-qz-sy z))
)
(set! (-> v1-0 x) f0-0)
(set! (-> v1-0 y) f1-0)
(set! (-> v1-0 z) f2-0)
(set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0))))
)
(set! (-> arg3 qx-qy-qz-sy x) 0.0)
(set! (-> arg3 qx-qy-qz-sy y) 0.0)
(set! (-> arg3 qx-qy-qz-sy z) 0.0)
(sp-relaunch-setup-fields arg0 arg1 arg2 arg3)
;; TODO stub
(defmethod spawn sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector))
(none)
;; some truly strange flag weirdness.
(let* ((a1-1 (-> arg2 flags-s32))
(v1-1 -2)
(a0-1 (the-as uint (-> arg3 r-g-b-a x)))
(a1-2 (logand a1-1 (sp-cpuinfo-flag-s32 sp-cpuinfo-flag-14)))
)
1
(let ((a1-3 (sar (the-as int a1-2) 14)))
(set! (-> arg3 r-g-b-a x) (the-as float (logior (logand a0-1 (the-as uint v1-1)) a1-3)))
)
)
(let ((a1-4 (new 'stack-no-clear 'vector))
(s3-0 (new 'stack-no-clear 'quaternion))
)
(set-vector! a1-4 (-> arg3 qx-qy-qz-sy x) (-> arg3 qx-qy-qz-sy y) (-> arg3 qx-qy-qz-sy z) 1.0)
(quaternion-zxy! s3-0 a1-4)
(if (logtest? (sp-cpuinfo-flag left-multiply-quat) (-> arg2 flags))
(quaternion*! s3-0 s4-0 s3-0)
)
(cond
((< (-> s3-0 w) 0.0)
(.lvf vf1 (&-> arg3 qx-qy-qz-sy quad))
(.lvf vf2 (&-> s3-0 vec quad))
(.sub.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> arg3 qx-qy-qz-sy quad) vf1)
(.mov v1-9 vf1)
)
(else
(.lvf vf1 (&-> arg3 qx-qy-qz-sy quad))
(.lvf vf2 (&-> s3-0 vec quad))
(.add.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> arg3 qx-qy-qz-sy quad) vf1)
(.mov v1-10 vf1)
)
)
)
)
(cond
(*sp-60-hz*
(set! (-> arg2 rot-syvel x) (* 5.0 (-> arg2 rot-syvel x)))
(set! (-> arg2 rot-syvel y) (* 5.0 (-> arg2 rot-syvel y)))
(set! (-> arg2 rot-syvel z) (* 5.0 (-> arg2 rot-syvel z)))
)
(else
(set! (-> arg2 rot-syvel x) (* 6.0 (-> arg2 rot-syvel x)))
(set! (-> arg2 rot-syvel y) (* 6.0 (-> arg2 rot-syvel y)))
(set! (-> arg2 rot-syvel z) (* 6.0 (-> arg2 rot-syvel z)))
)
)
(quaternion-zxy! (-> arg2 rotvel3d) (-> arg2 rot-syvel))
0
(none)
)
)
(defmethod initialize sparticle-launch-control ((obj sparticle-launch-control) (arg0 sparticle-launch-group) (arg1 process))
@@ -695,7 +830,7 @@
(none)
)
(defmethod sparticle-launch-control-method-10 sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector))
(defmethod is-visible? sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector))
(let* ((v1-0 (-> obj group))
(f0-0 (-> v1-0 bounds r))
)
@@ -726,7 +861,7 @@
)
)
(defmethod sparticle-launch-control-method-12 sparticle-launch-control ((obj sparticle-launch-control) (arg0 matrix))
(defmethod spawn-with-matrix sparticle-launch-control ((obj sparticle-launch-control) (arg0 matrix))
(let* ((a2-0 (-> obj origin))
(a3-0 arg0)
(v1-0 (-> a3-0 vector 0 quad))
@@ -772,7 +907,7 @@
(none)
)
(defmethod sparticle-launch-control-method-13 sparticle-launch-control ((obj sparticle-launch-control) (arg0 cspace))
(defmethod spawn-with-cspace sparticle-launch-control ((obj sparticle-launch-control) (arg0 cspace))
(let* ((v1-0 (-> obj origin))
(a3-0 (-> arg0 bone transform))
(a0-2 (-> a3-0 vector 0 quad))
@@ -818,10 +953,298 @@
(none)
)
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod spawn sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector))
(with-pp
(set! (-> obj origin trans quad) (-> arg0 quad))
(if (not (or (is-visible? obj arg0) (logtest? (-> obj group flags) (sp-group-flag always-draw screen-space))))
(return 0)
)
(let ((s4-0 (the-as int (-> pp clock frame-counter)))
(s5-0 (-> obj last-spawn-time))
)
(let ((v1-10 (-> *display* real-frame-clock integral-frame-counter)))
(if (!= v1-10 (+ (-> obj last-spawn-frame) 1))
(set! s5-0 (the-as int (- (the-as time-frame s4-0) (logand (the-as int (-> pp clock sparticle-data x)) 255))))
)
)
(set! (-> obj last-spawn-frame) (the-as int (-> *display* real-frame-clock integral-frame-counter)))
(set! (-> obj last-spawn-time) s4-0)
(when (logtest? (-> obj group flags) (sp-group-flag use-local-clock))
(set! s5-0 (-> obj local-clock))
(+! (-> obj local-clock) (logand (the-as int (-> pp clock sparticle-data x)) 255))
(set! s4-0 (-> obj local-clock))
)
(let* ((f30-0 (vector-vector-distance arg0 (math-camera-pos)))
(v1-26 1)
(a0-13 *time-of-day*)
(s3-1 (ash v1-26 (if a0-13
(-> a0-13 0 hours)
0
)
)
)
)
(if (nonzero? (-> obj matrix))
(set! f30-0 0.0)
)
(let ((s2-1 (-> obj length)))
(b! #t cfg-95 :delay (nop!))
(label cfg-19)
(+! s2-1 -1)
(let* ((a3-0 (-> obj data s2-1))
(v1-33 (-> a3-0 group-item))
(a1-4 (-> *part-id-table* (-> v1-33 launcher)))
)
(b!
(not (and a1-4 (nonzero? a1-4) (logtest? (-> a3-0 flags) (sp-launch-state-flags launcher-active))))
cfg-95
:delay (empty-form)
)
(let* ((f1-3 (if (!= (-> v1-33 falloff-to) 0.0)
(- 1.0 (/ f30-0 (-> v1-33 falloff-to)))
1.0
)
)
(f0-5 f1-3)
)
(let ((a0-25 sparticle-launcher))
(b! (!= (-> a1-4 type) a0-25) cfg-94 :delay (nop!))
)
(b! (not (logtest? (-> v1-33 flags) (sp-group-item-flag launch-asap))) cfg-42 :delay (nop!))
(when (not (logtest? (-> a3-0 flags) (sp-launch-state-flags particles-active)))
(set! (-> a3-0 spawn-time) (the-as uint s4-0))
(logior! (-> a3-0 flags) (sp-launch-state-flags particles-active))
(when (< 0.0 f0-5)
(b! (not (logtest? (-> v1-33 flags) (sp-group-item-flag bit7))) cfg-37 :delay (nop!))
(let ((t9-3 sp-launch-particles-var))
(b! (not (logtest? (-> v1-33 flags) (sp-group-item-flag is-3d))) cfg-35 :delay (nop!))
(let ((a0-36 *sp-particle-system-3d*))
(b! #t cfg-36 :delay (nop!))
(label cfg-35)
(set! a0-36 *sp-particle-system-2d*)
(label cfg-36)
(t9-3 a0-36 a1-4 (-> obj origin) a3-0 obj f0-5)
)
)
(b! #t cfg-41 :delay (nop!))
(label cfg-37)
(let ((t9-4 sp-launch-particles-var)
(a0-38 (if (logtest? (-> v1-33 flags) (sp-group-item-flag is-3d))
*sp-particle-system-3d*
*sp-particle-system-2d*
)
)
(a2-4 *launch-matrix*)
)
(set! (-> a2-4 trans quad) (-> a3-0 center quad))
(t9-4 a0-38 a1-4 a2-4 a3-0 obj f0-5)
)
)
)
(label cfg-41)
(b! #t cfg-93 :delay (nop!))
(label cfg-42)
(when (or (logtest? s3-1 (-> v1-33 hour-mask))
(not (or (= (-> v1-33 fade-after) 0.0) (< f30-0 (-> v1-33 fade-after))))
)
0
(goto cfg-93)
)
(b! (nonzero? (-> v1-33 period)) cfg-59 :delay (empty-form))
(if (not (logtest? (-> v1-33 flags) (sp-group-item-flag bit6)))
(set! f0-5 (* 0.2 (the float (- s4-0 s5-0)) f0-5))
)
(b! #t cfg-81 :delay (nop!))
(label cfg-59)
0
0
(let* ((a2-5 (-> v1-33 length))
(a0-57 (-> v1-33 period))
(t0-10 (mod (+ (- s5-0 (the-as int (-> obj data s2-1 offset))) a0-57) (the-as int a0-57)))
(a0-58 (mod (the-as uint (+ (- s4-0 (the-as int (-> obj data s2-1 offset))) a0-57)) a0-57))
)
(set! f0-5 (cond
((and (< t0-10 (the-as int a2-5)) (< (the-as int a0-58) (the-as int a2-5)))
(* 0.2 (the float (- s4-0 s5-0)) f0-5)
)
((and (< t0-10 (the-as int a2-5)) (>= (the-as int a0-58) (the-as int a2-5)))
(* 0.2 (the float (- a2-5 (the-as uint t0-10))) f0-5)
)
((and (>= t0-10 (the-as int a2-5)) (< (the-as int a0-58) (the-as int a2-5)))
(* 0.2 (the float a0-58) f0-5)
)
(else
(when (not (logtest? (-> v1-33 flags) (sp-group-item-flag bit1)))
0
(goto cfg-93)
)
(when (< (the-as uint (- s4-0 (the-as int (-> obj data s2-1 spawn-time)))) (-> v1-33 period))
0
(goto cfg-93)
)
(set! (-> obj data s2-1 offset) (- (-> v1-33 period) a0-58))
(* 0.2 (the float (- s4-0 s5-0)) f0-5)
)
)
)
)
(label cfg-81)
(set! (-> a3-0 spawn-time) (the-as uint s4-0))
(logior! (-> a3-0 flags) (sp-launch-state-flags particles-active))
(when (< 0.0 f0-5)
(if (logtest? (-> v1-33 flags) (sp-group-item-flag bit6))
(set! f0-5 f1-3)
)
(cond
((logtest? (-> v1-33 flags) (sp-group-item-flag bit7))
(sp-launch-particles-var
(if (logtest? (-> v1-33 flags) (sp-group-item-flag is-3d))
*sp-particle-system-3d*
*sp-particle-system-2d*
)
a1-4
(-> obj origin)
a3-0
obj
f0-5
)
)
(else
(let ((t9-6 sp-launch-particles-var)
(a0-83 (if (logtest? (-> v1-33 flags) (sp-group-item-flag is-3d))
*sp-particle-system-3d*
*sp-particle-system-2d*
)
)
(a2-22 *launch-matrix*)
)
(set! (-> a2-22 trans quad) (-> a3-0 center quad))
(t9-6 a0-83 a1-4 a2-22 a3-0 obj f0-5)
)
)
)
)
)
)
(label cfg-93)
(b! #t cfg-95 :delay (nop!))
(label cfg-94)
(format 0 "spawn called for non-sparticle-launcher~%")
(label cfg-95)
(b! (nonzero? s2-1) cfg-19 :delay (nop!))
)
)
)
0
(none)
)
)
;; ERROR: failed type prop at 12: Could not figure out load: (set! a1 (l.wu (+ a0 132)))
(defun execute-part-engine ()
(local-vars (sv-96 sparticle-launcher) (sv-104 int))
(let ((gp-0 *sp-particle-system-2d*))
(let* ((s5-0 *part-engine*)
(s4-0 *part-id-table*)
(s3-0 (new 'stack-no-clear 'matrix))
(s2-0 (new 'stack-no-clear 'vector))
(v1-1 (-> s5-0 alive-list next0))
(s1-0 (-> v1-1 next0))
)
(while (!= v1-1 (-> s5-0 alive-list-end))
(let* ((a0-2 (the-as process-drawable (-> (the-as connection v1-1) param1)))
(a1-0 (-> a0-2 draw))
(s0-0 (the-as object (-> (the-as connection v1-1) param3)))
)
(when (and (logtest? (-> a1-0 status) (draw-control-status on-screen))
(< (-> a1-0 distance) (-> (the-as vector s0-0) w))
)
(set! sv-96 (-> s4-0 (-> (the-as connection v1-1) param2)))
(set! sv-104 (the-as int (-> (the-as connection v1-1) param0)))
(when (nonzero? sv-96)
(let ((a1-8 (-> a0-2 node-list data sv-104)))
(let* ((v1-7 s3-0)
(t0-0 (-> a1-8 bone transform))
(a0-5 (-> t0-0 vector 0 quad))
(a2-2 (-> t0-0 vector 1 quad))
(a3-0 (-> t0-0 vector 2 quad))
(t0-1 (-> t0-0 trans quad))
)
(set! (-> v1-7 vector 0 quad) a0-5)
(set! (-> v1-7 vector 1 quad) a2-2)
(set! (-> v1-7 vector 2 quad) a3-0)
(set! (-> v1-7 trans quad) t0-1)
)
(vector<-cspace! (-> s3-0 trans) a1-8)
)
(set! (-> s2-0 quad) (-> (the-as vector s0-0) quad))
(set! (-> s2-0 w) 1.0)
(vector-matrix*! (-> s3-0 trans) s2-0 s3-0)
(sp-launch-particles-var
gp-0
sv-96
s3-0
(the-as sparticle-launch-state #f)
(the-as sparticle-launch-control #f)
1.0
)
)
)
)
(set! v1-1 s1-0)
(set! s1-0 (-> s1-0 next0))
)
)
(let* ((s5-1 (camera-pos))
(v1-12 1)
(a0-14 *time-of-day*)
(s4-1 (ash v1-12 (if a0-14
(-> a0-14 0 hours)
0
)
)
)
)
(dotimes (s3-1 (-> *level* length))
(let ((v1-16 (-> *level* level s3-1)))
(when (= (-> v1-16 status) 'active)
(let ((s2-1 (-> v1-16 part-engine)))
(when s2-1
(countdown (s1-1 (-> s2-1 length))
(let ((s0-1 (-> s2-1 data s1-1)))
(when (and (or (zero? (-> s0-1 param3))
(< (vector-vector-distance s5-1 (the-as vector (&-> s0-1 param0))) (the-as float (-> s0-1 param3)))
)
(zero? (logand s4-1 (the-as int (-> s0-1 prev1))))
)
(let ((a1-14 (-> s0-1 next1))
(t9-5 sp-launch-particles-var)
(a0-25 gp-0)
(a2-5 *launch-matrix*)
)
(set! (-> a2-5 trans quad) (-> (the-as vector (&-> s0-1 param0)) quad))
(t9-5
a0-25
(the-as sparticle-launcher a1-14)
a2-5
(the-as sparticle-launch-state #f)
(the-as sparticle-launch-control #f)
1.0
)
)
)
)
)
)
)
)
)
)
)
)
0
(none)
)
(defun sparticle-track-root ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 vector))
(let ((v1-3 (-> arg1 key proc root trans)))
(set! (-> arg2 x) (-> v1-3 x))
@@ -1027,29 +1450,335 @@
(none)
)
;; ERROR: failed type prop at 12: Could not figure out load: (set! v1 (l.w (+ gp 16)))
(defun sparticle-respawn-heights ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(let ((gp-0 (the-as (array int32) (-> arg1 user-float))))
(when (and (nonzero? gp-0)
(or (and (< (-> arg1 vel-sxvel y) 0.0) (< (-> arg2 y) (the-as float (-> gp-0 1))))
(and (< 0.0 (-> arg1 vel-sxvel y)) (< (the-as float (-> gp-0 2)) (-> arg2 y)))
)
)
(sp-kill-particle arg0 arg1)
(let ((s3-0 (+ (the-as int (-> gp-0 length)) -1)))
(when (< 2 s3-0)
(let ((s2-0 (new 'stack-no-clear 'vector))
(s1-0 (if (zero? (-> gp-0 0))
*sp-particle-system-2d*
*sp-particle-system-3d*
)
)
)
(set-vector! s2-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0)
(let ((s5-1 3))
(while (>= s3-0 s5-1)
(let ((t9-1 sp-launch-particles-var)
(a0-2 s1-0)
(a1-3 (-> *part-id-table* (-> gp-0 s5-1)))
(a2-1 *launch-matrix*)
)
(set! (-> a2-1 trans quad) (-> s2-0 quad))
(t9-1 a0-2 a1-3 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(+! s5-1 1)
)
)
)
)
)
)
)
0
(none)
)
;; ERROR: failed type prop at 9: Could not figure out load: (set! v1 (l.w gp))
;; ERROR: failed type prop at 2: Could not figure out load: (set! a0 (l.w (+ v1 20)))
(defun sparticle-respawn-timer ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(when (<= (-> arg1 timer) 0)
(let ((gp-0 (the-as object (-> arg1 user-float))))
(when (nonzero? (the-as float gp-0))
(sp-kill-particle arg0 arg1)
(let ((s5-0 (+ (the-as int (-> (the-as (array int32) gp-0) length)) -1)))
(when (< 2 s5-0)
(let ((s4-0 (new 'stack-no-clear 'vector))
(s3-0 (if (zero? (-> (the-as (array int32) gp-0) 0))
*sp-particle-system-2d*
*sp-particle-system-3d*
)
)
)
(set-vector! s4-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0)
(let ((s2-1 3))
(while (>= s5-0 s2-1)
(let ((t9-1 sp-launch-particles-var)
(a0-2 s3-0)
(a1-3 (-> *part-id-table* (-> (the-as (array int32) gp-0) s2-1)))
(a2-1 *launch-matrix*)
)
(set! (-> a2-1 trans quad) (-> s4-0 quad))
(t9-1 a0-2 a1-3 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(+! s2-1 1)
)
)
)
)
)
)
)
)
0
(none)
)
;; ERROR: failed type prop at 21: Could not figure out load: (set! a1 (l.w (+ s2 40)))
;; ERROR: Bad vector register dependency: vf1
;; ERROR: Bad vector register dependency: vf2
(defun sparticle-texture-animate ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(let ((v1-0 (the-as (array int32) (-> arg1 user-float))))
(when (nonzero? v1-0)
(if (zero? (-> v1-0 2))
(set! (-> v1-0 2) (-> arg1 timer))
)
(let* ((a0-6 (+ (-> v1-0 length) -3))
(a2-1 (-> v1-0 0))
(a3-0 (-> v1-0 2))
(t0-1 (if (< (-> arg1 timer) 0)
(the-as int (-> *display* base-clock frame-counter))
(- a3-0 (-> arg1 timer))
)
)
)
(cond
((zero? (-> v1-0 1))
(let ((v1-2 (-> v1-0 (+ (max 0 (min (+ (/ t0-1 a2-1) (-> arg1 user1-int16)) (+ a0-6 -1))) 3))))
(if (nonzero? v1-2)
(particle-adgif-callback (-> arg1 adgif) (the-as texture-id v1-2))
)
)
)
(else
(let ((v1-4 (-> v1-0 (+ (mod (max 0 (+ (/ t0-1 a2-1) (-> arg1 user1-int16))) a0-6) 3))))
(if (nonzero? v1-4)
(particle-adgif-callback (-> arg1 adgif) (the-as texture-id v1-4))
)
)
)
)
)
)
)
(none)
)
;; ERROR: failed type prop at 5: Could not figure out load: (set! a1 (l.w (+ v1 12)))
;; TODO: vf1/vf2 get set from somewhere...
(defun sparticle-texture-day-night ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-2d))
(local-vars
(v1-9 uint128)
(v1-10 uint128)
(v1-13 uint128)
(v1-14 uint128)
(v1-23 uint128)
(v1-24 uint128)
(v1-27 uint128)
(v1-28 uint128)
(v1-33 float)
(a0-5 float)
(a0-11 float)
(t7-0 uint) ;; changed
(t7-3 uint) ;; changed
(s3-0 float)
(s4-0 float)
)
(rlet ((vf1 :class vf)
(vf2 :class vf)
)
(let ((s2-0 (the-as object (-> arg1 user-float))))
(when (nonzero? (the-as float s2-0))
(let* ((v1-1 *time-of-day*)
(s1-0 (if v1-1
(-> v1-1 0 hours)
0
)
)
(f0-0 (rand-vu))
)
(.mov s4-0 vf1)
(.mov s3-0 vf2)
(cond
((or (< s1-0 6) (< 18 s1-0))
(let ((a1-1 (-> (the-as (array int32) s2-0) 7)))
(when (nonzero? a1-1)
(let ((v1-6 f0-0))
(.mov vf2 v1-6)
)
(let ((v1-8 (the-as uint128 (make-u128 0 (-> (the-as (array int32) s2-0) 9)))))
(.pextlb v1-9 0 v1-8)
)
(.pextlb v1-10 0 v1-9)
(.mov vf1 v1-10)
(.itof.vf vf1 vf1)
(.mul.x.vf vf1 vf1 vf2)
(let ((v1-12 (the-as uint128 (make-u128 0 (-> (the-as (array int32) s2-0) 8)))))
(.pextlb v1-13 0 v1-12)
)
(.pextlb v1-14 0 v1-13)
(.mov vf2 v1-14)
(.itof.vf vf2 vf2)
(.add.vf vf1 vf1 vf2)
(let ((v1-15 (-> arg1 flags-s32)))
(when (nonzero? (-> (the-as (array int32) s2-0) 10))
(.lvf vf2 (&-> *time-of-day-context* current-prt-color quad))
(.mul.vf vf1 vf1 vf2)
(.mov a0-5 vf1)
)
(let ((v1-16 (logand v1-15 (sp-cpuinfo-flag-s32 sp-cpuinfo-flag-14))))
(.mov t7-0 vf1)
(let ((v1-17 (sar (the-as int v1-16) 14)))
(set! (-> arg2 r-g-b-a quad) (the-as uint128 (logior (logand t7-0 (the-as uint -2)) v1-17)))
)
)
)
(particle-adgif-callback (-> arg1 adgif) (the-as texture-id a1-1))
)
)
)
(else
(let ((a1-2 (-> (the-as (array int32) s2-0) 3)))
(when (nonzero? a1-2)
(let ((v1-20 f0-0))
(.mov vf2 v1-20)
)
(let ((v1-22 (the-as uint128 (make-u128 0 (-> (the-as (array int32) s2-0) 5)))))
(.pextlb v1-23 0 v1-22)
)
(.pextlb v1-24 0 v1-23)
(.mov vf1 v1-24)
(.itof.vf vf1 vf1)
(.mul.x.vf vf1 vf1 vf2)
(let ((v1-26 (the-as uint128 (make-u128 0 (-> (the-as (array int32) s2-0) 4)))))
(.pextlb v1-27 0 v1-26)
)
(.pextlb v1-28 0 v1-27)
(.mov vf2 v1-28)
(.itof.vf vf2 vf2)
(.add.vf vf1 vf1 vf2)
(let ((v1-29 (-> arg1 flags-s32)))
(when (nonzero? (-> (the-as (array int32) s2-0) 6))
(.lvf vf2 (&-> *time-of-day-context* current-prt-color quad))
(.mul.vf vf1 vf1 vf2)
(.mov a0-11 vf1)
)
(let ((v1-30 (logand v1-29 (sp-cpuinfo-flag-s32 sp-cpuinfo-flag-14))))
(.mov t7-3 vf1)
(let ((v1-31 (sar (the-as int v1-30) 14)))
(set! (-> arg2 r-g-b-a quad) (the-as uint128 (logior (logand t7-3 (the-as uint -2)) v1-31)))
)
)
)
(particle-adgif-callback (-> arg1 adgif) (the-as texture-id a1-2))
)
)
)
)
)
(.mov vf1 s4-0)
(.mov vf2 s3-0)
(.mov v1-33 vf2)
)
)
(none)
)
)
;; ERROR: Expression building failed: In sparticle-motion-blur: [OP: 78] - Floating point math attempted on invalid types: uint and float in op (-.s f2-0 f3-0).
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
;; ERROR: Unsupported inline assembly instruction kind - [mula.s f3, f3]
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f3, f4, f4]
;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3]
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
(defun sparticle-mode-animate ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-2d))
(let ((a0-1 (-> arg1 key))
(v1-0 (the-as object (-> arg1 user-float)))
)
(when (nonzero? (the-as float v1-0))
(let ((a1-2 (the-as (array uint32) (-> (the-as (array symbol) v1-0) 0 value))))
(when (nonzero? a1-2)
(let* ((a1-4 (the-as object (-> a1-2 (min (the-as int (+ (-> a0-1 state-mode 0) 1)) (+ (-> a1-2 length) -1)))))
(a0-8 (the-as
object
(-> (the-as (array int32) a1-4)
(+ (mod
(the-as int (/ (-> a0-1 state-counter) (/ (the-as int (-> (the-as vector4w a1-4) w)) 8)))
(+ (-> (the-as (pointer int32) a1-4) 0) -1)
)
1
)
)
)
)
(a1-6 (/ (-> (the-as (array int32) v1-0) 1) 8))
(a2-14 (-> (the-as (pointer int64) a0-8) (/ a1-6 64)))
(a0-11 (logtest? a2-14 (ash 1 (logand a1-6 63))))
(s4-0 (if a0-11
(-> (the-as (pointer int32) v1-0) 6)
(-> (the-as (pointer int32) v1-0) 5)
)
)
)
(if a0-11
(set! (-> arg2 r-g-b-a x) (rand-vu-float-range 64.0 192.0))
(set! (-> arg2 r-g-b-a x) (rand-vu-float-range 32.0 48.0))
)
(set! (-> arg2 r-g-b-a y) (-> arg2 r-g-b-a x))
(set! (-> arg2 r-g-b-a z) (-> arg2 r-g-b-a x))
(if (nonzero? s4-0)
(particle-adgif-callback (-> arg1 adgif) (the-as texture-id s4-0))
)
)
)
)
)
)
0
(none)
)
;; WARN: Return type mismatch int vs object.
(def-mips2c sparticle-motion-blur (function sparticle-system sparticle-cpuinfo vector none))
(defun-debug sparticle-motion-blur-old ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-3d))
"Unused"
(let ((s2-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector4w))
(s3-0 (new 'stack-no-clear 'vector4w))
)
(set! (-> s2-0 x) (-> arg2 x-y-z-sx x))
(set! (-> s2-0 y) (-> arg2 x-y-z-sx y))
(set! (-> s2-0 z) (-> arg2 x-y-z-sx z))
(set! (-> s2-0 w) 1.0)
(when (and (or (!= (-> arg1 vel-sxvel x) 0.0) (!= (-> arg1 vel-sxvel y) 0.0) (!= (-> arg1 vel-sxvel z) 0.0))
(transform-point-qword! s5-0 s2-0)
)
(+! (-> s2-0 x) (* 32.0 (-> arg1 vel-sxvel x)))
(+! (-> s2-0 y) (* 32.0 (-> arg1 vel-sxvel y)))
(+! (-> s2-0 z) (* 32.0 (-> arg1 vel-sxvel z)))
(when (transform-point-qword! s3-0 s2-0)
(let* ((f0-14 (the float (+ (-> s5-0 x) -28672)))
(f1-10 (the float (+ (-> s5-0 y) -29440)))
(f2-4 (the float (+ (-> s3-0 x) -28672)))
(f3-1 (the float (+ (-> s3-0 y) -29440)))
(f30-0 (- f2-4 f0-14))
(f28-0 (- f3-1 f1-10))
)
(set! (-> arg2 qx-qy-qz-sy z) (+ -16384.0 (atan f30-0 f28-0)))
(let ((f0-17 (-> arg1 omega)))
(if (!= f0-17 0.0)
(set! (-> arg2 x-y-z-sx w) (* (sqrtf (+ (* f30-0 f30-0) (* f28-0 f28-0)))
f0-17
(lerp-scale 3.0 0.25 (/ 1.0 (the float (-> s5-0 z))) 0.000001 0.00000014285715)
)
)
)
)
)
(return (the-as object #f))
)
)
)
(if (!= (-> arg1 omega) 0.0)
(set! (-> arg2 x-y-z-sx w) 0.0)
)
0
)
(defun sparticle-set-conerot ((arg0 sparticle-launcher) (arg1 vector))
(let ((s5-0 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-x)))
@@ -1187,6 +1916,21 @@
(none)
)
(defun birth-func-texture-group ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
(let ((s5-0 (the-as (array int32) (-> arg1 user-float))))
(when (nonzero? s5-0)
(let* ((a0-1 (+ (-> s5-0 length) -3))
(a1-1 (-> s5-0 (+ (rand-vu-int-count a0-1) 3)))
)
(if (nonzero? a1-1)
(particle-adgif-callback (-> arg1 adgif) (the-as texture-id a1-1))
)
)
)
)
0
(none)
)
;; WARN: new jak 2 until loop case, check carefully
(defmethod get-field-spec-by-id sparticle-launcher ((obj sparticle-launcher) (arg0 sp-field-id))
@@ -1211,4 +1955,37 @@
(the-as sp-field-init-spec #f)
)
;; ERROR: failed type prop at 45: Could not figure out load: (set! v1 (l.w (+ gp 12)))
(defmethod setup-user-array sparticle-launcher ((obj sparticle-launcher) (arg0 string))
(let ((s5-0 (get-field-spec-by-id obj (sp-field-id spt-texture)))
(v1-1 (lookup-texture-id-by-name arg0 (the-as string #f)))
)
(if s5-0
(set! (-> s5-0 initial-valuef) (the-as float v1-1))
)
)
(let ((v1-3 (get-field-spec-by-id obj (sp-field-id spt-userdata))))
(when (and v1-3 (= (-> v1-3 flags) (sp-flag plain-v2)))
(let ((gp-1 (the-as object (-> v1-3 initial-valuef))))
(when (and (= (logand (the-as int gp-1) 7) 4)
(type? (the-as float gp-1) array)
(logtest? (-> (the-as (array int32) gp-1) 1) 128)
)
(set! (-> (the-as (array int32) gp-1) 0) (/ (-> (the-as (array int32) gp-1) 0) 8))
(set! (-> (the-as (array int32) gp-1) 1) (/ (logand (-> (the-as (array int32) gp-1) 1) 8) 8))
(set! (-> (the-as (array int32) gp-1) 2) (/ (-> (the-as (array int32) gp-1) 2) 8))
(set! (-> (the-as (array int32) gp-1) content-type) int32)
(dotimes (s5-1 (+ (-> (the-as (array int32) gp-1) length) -3))
(set! (-> (the-as (array int32) gp-1) (+ s5-1 3))
(the-as
int
(lookup-texture-id-by-name (the-as string (-> (the-as (array int32) gp-1) (+ s5-1 3))) (the-as string #f))
)
)
)
)
)
)
)
0
(none)
)
@@ -161,12 +161,113 @@
(none)
)
;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2]
;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2]
;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2]
;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2]
;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2]
;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t2, t1]
(defmacro .movn (result value check original)
`(if (!= ,check 0)
(set! ,result (the-as int ,value))
(set! ,result (the-as int ,original))
)
)
(defmacro .movz (result value check original)
`(if (= ,check 0)
(set! ,result (the-as int ,value))
(set! ,result (the-as int ,original))
)
)
(defun sp-get-particle ((arg0 sparticle-system) (arg1 int) (arg2 sparticle-launch-state))
(local-vars
(a2-3 int)
(a2-4 int)
(a2-5 int)
(a2-6 int)
(a2-7 int)
(a2-8 int)
(t1-16 int)
(t1-17 int)
(t1-18 int)
(t1-19 int)
(t1-20 int)
(t3-5 int)
)
(let ((v1-0 0)
(t0-0 (-> arg0 blocks 0))
(a3-0 0)
)
(when (= arg1 1)
(set! v1-0 t0-0)
(set! t0-0 (-> arg0 blocks 1))
)
(when arg2
(set! a3-0 (the-as int (-> arg2 randomize)))
(+! (-> arg2 randomize) 1)
(when (= (-> arg2 randomize) t0-0)
(set! (-> arg2 randomize) (the-as uint 0))
0
)
)
(dotimes (a2-1 t0-0)
(when (nonzero? (-> arg0 alloc-table (+ v1-0 a3-0)))
(let ((a2-2 0)
(t1-15 (-> arg0 alloc-table (+ v1-0 a3-0)))
(t0-4 (* (+ v1-0 a3-0) 64))
)
0
0
(let ((t2-4 (shl t1-15 32))
(t3-0 (+ a2-2 32))
)
(.movn t1-16 t2-4 t2-4 t1-15)
(.movz a2-3 t3-0 t2-4 a2-2)
)
(let ((t2-5 (shl t1-16 16))
(t3-1 (+ a2-3 16))
)
(.movn t1-17 t2-5 t2-5 t1-16)
(.movz a2-4 t3-1 t2-5 a2-3)
)
(let ((t2-6 (* t1-17 256))
(t3-2 (+ a2-4 8))
)
(.movn t1-18 t2-6 t2-6 t1-17)
(.movz a2-5 t3-2 t2-6 a2-4)
)
(let ((t2-7 (* t1-18 16))
(t3-3 (+ a2-5 4))
)
(.movn t1-19 t2-7 t2-7 t1-18)
(.movz a2-6 t3-3 t2-7 a2-5)
)
(let ((t2-8 (* t1-19 4))
(t3-4 (+ a2-6 2))
)
(.movn t1-20 t2-8 t2-8 t1-19)
(.movz a2-7 t3-4 t2-8 a2-6)
(let ((t1-21 (* t1-20 2))
(t2-9 (+ a2-7 1))
)
(.movn t3-5 t1-21 t1-21 t3-4)
(.movz a2-8 t2-9 t1-21 a2-7)
)
)
(let ((t0-5 (+ t0-4 a2-8)))
(logxor! (-> arg0 alloc-table (+ v1-0 a3-0)) (the-as uint (ash 1 a2-8)))
(+! (-> arg0 num-alloc arg1) 1)
(let ((v1-9 (-> arg0 cpuinfo-table t0-5)))
(set! (-> v1-9 valid) (the-as uint 1))
(return v1-9)
)
)
)
)
(+! a3-0 1)
(if (= a3-0 t0-0)
(set! a3-0 0)
)
)
)
(the-as sparticle-cpuinfo #f)
)
(defun sp-kill-particle ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(cond
@@ -226,13 +327,13 @@
(none)
)
;; ERROR: function was not converted to expressions. Cannot decompile.
;; ERROR: function was not converted to expressions. Cannot decompile.
(def-mips2c sp-process-block-2d (function sparticle-system int int int int symbol none))
(def-mips2c sp-process-block-3d (function sparticle-system int int int int symbol none))
(defun sp-copy-to-spr ((arg0 int) (arg1 pointer) (arg2 int))
(let ((a2-1 (/ (+ arg2 15) 16)))
(dma-send-to-spr-no-flush (the-as uint arg0) (the-as uint arg1) (the-as uint a2-1) #t)
;(dma-send-to-spr-no-flush (the-as uint arg0) (the-as uint arg1) (the-as uint a2-1) #t)
(__mem-move (&+ (scratchpad-start) arg0) arg1 (the uint (* a2-1 16)))
)
0
(none)
@@ -240,13 +341,15 @@
(defun sp-copy-from-spr ((arg0 int) (arg1 pointer) (arg2 int))
(let ((a2-1 (/ (+ arg2 15) 16)))
(dma-send-from-spr-no-flush (the-as uint arg1) (the-as uint arg0) (the-as uint a2-1) #t)
;(dma-send-from-spr-no-flush (the-as uint arg1) (the-as uint arg0) (the-as uint a2-1) #t)
(__mem-move arg1 (&+ (scratchpad-start) arg0) (the uint (* a2-1 16)))
)
0
(none)
)
;; ERROR: function was not converted to expressions. Cannot decompile.
;; unused memcpy function
(defun sp-process-block ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d) (arg3 int))
(local-vars (sv-16 int) (sv-32 int) (sv-48 int) (sv-64 int))
@@ -264,8 +367,8 @@
)
(t9-2 sv-16 (the-as pointer a1-7) sv-32)
)
(set! sv-48 (+ #x70000000 s3-0))
(set! sv-64 (+ #x70000000 s1-0))
(set! sv-48 (+ (the int (scratchpad-start)) s3-0))
(set! sv-64 (+ (the int (scratchpad-start)) s1-0))
(let ((t1-0 (paused?)))
(cond
((-> arg0 is-3d)
@@ -292,7 +395,7 @@
(defun sp-process-particle-system ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d))
(countdown (v1-0 13)
(let ((a0-4 (-> *display* clock v1-0 sparticle-data quad)))
(set! (-> (the-as vector (+ #x70000000 (* v1-0 16))) quad) a0-4)
(set! (-> (the-as vector (+ (the int (scratchpad-start)) (* v1-0 16))) quad) a0-4)
)
)
(let* ((v1-3 208)
+11 -68
View File
@@ -6,6 +6,8 @@
;; dgos: ENGINE, GAME
;; the sprite renderer draw 2D or 3D sprites
;; TODO: glow is commented out.
;; TODO: distort is commented out.
(defenum sprite-aux-type
:bitfield #f
@@ -126,21 +128,6 @@
:flag-assert #x900000010
)
(defmethod inspect sprite-aux-elem ((obj sprite-aux-elem))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'sprite-aux-elem)
(format #t "~1Taux-type: ~D~%" (-> obj aux-type))
(format #t "~1Tdata[3] @ #x~X~%" (-> obj data))
(format #t "~1Tvec-data: #<sprite-vec-data-2d @ #x~X>~%" (-> obj vec-data))
(format #t "~1Tgif-data: #<adgif-shader @ #x~X>~%" (-> obj gif-data))
(format #t "~1Taux-data: #<sparticle-cpuinfo @ #x~X>~%" (-> obj aux-data))
(label cfg-4)
obj
)
(deftype sprite-aux-list (basic)
((num-entries int32 :offset-assert 4) ;; capacity
(entry int32 :offset-assert 8) ;; current size
@@ -254,50 +241,6 @@
:flag-assert #x9000002a0
)
(defmethod inspect sprite-frame-data ((obj sprite-frame-data))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'sprite-frame-data)
(format #t "~1Tdata[42] @ #x~X~%" (-> obj cdata))
(format #t "~1Tcdata[16] @ #x~X~%" (-> obj cdata))
(format #t "~1Tfdata[26] @ #x~X~%" (-> obj hmge-scale))
(format #t "~1Txy-array[8] @ #x~X~%" (-> obj cdata))
(format #t "~1Tst-array[4] @ #x~X~%" (-> obj st-array))
(format #t "~1Txyz-array[4] @ #x~X~%" (-> obj xyz-array))
(format #t "~1Thmge-scale: #<vector @ #x~X>~%" (-> obj hmge-scale))
(format #t "~1Tconsts: #<vector @ #x~X>~%" (&-> obj pfog0))
(format #t "~1Tpfog0: ~f~%" (-> obj pfog0))
(format #t "~1Tdeg-to-rad: ~f~%" (-> obj deg-to-rad))
(format #t "~1Tmin-scale: ~f~%" (-> obj min-scale))
(format #t "~1Tinv-area: ~f~%" (-> obj inv-area))
(format #t "~1Tadgif-giftag: #<qword @ #x~X>~%" (-> obj adgif-giftag))
(format #t "~1Tsprite-2d-giftag: #<qword @ #x~X>~%" (-> obj sprite-2d-giftag))
(format #t "~1Tsprite-2d-giftag-2: #<qword @ #x~X>~%" (-> obj sprite-2d-giftag-2))
(format #t "~1Tsincos-01: #<vector @ #x~X>~%" (-> obj sincos-01))
(format #t "~1Tsincos-23: #<vector @ #x~X>~%" (-> obj sincos-23))
(format #t "~1Tsincos-45: #<vector @ #x~X>~%" (-> obj sincos-45))
(format #t "~1Tsincos-67: #<vector @ #x~X>~%" (-> obj sincos-67))
(format #t "~1Tsincos-89: #<vector @ #x~X>~%" (-> obj sincos-89))
(format #t "~1Tbasis-x: #<vector @ #x~X>~%" (-> obj basis-x))
(format #t "~1Tbasis-y: #<vector @ #x~X>~%" (-> obj basis-y))
(format #t "~1Tsprite-3d-giftag: #<qword @ #x~X>~%" (-> obj sprite-3d-giftag))
(format #t "~1Tsprite-3d-giftag-2: #<qword @ #x~X>~%" (-> obj sprite-3d-giftag-2))
(format #t "~1Tscreen-shader: #<adgif-shader @ #x~X>~%" (-> obj screen-shader))
(format #t "~1Tinv-hmge-scale: #<vector @ #x~X>~%" (-> obj inv-hmge-scale))
(format #t "~1Tstq-offset: #<vector @ #x~X>~%" (-> obj stq-offset))
(format #t "~1Tstq-scale: #<vector @ #x~X>~%" (-> obj stq-scale))
(format #t "~1Trgba-plain: #<qword @ #x~X>~%" (-> obj rgba-plain))
(format #t "~1Twarp-giftag: #<qword @ #x~X>~%" (-> obj warp-giftag))
(format #t "~1Tfog-clamp: #<vector @ #x~X>~%" (-> obj fog-clamp))
(format #t "~1Tfog-min: ~f~%" (-> obj fog-clamp x))
(format #t "~1Tfog-max: ~f~%" (-> obj fog-clamp y))
(format #t "~1Tmax-scale: ~f~%" (-> obj max-scale))
(label cfg-4)
obj
)
(defun sprite-setup-frame-data ((data sprite-frame-data) (tbp-offset uint))
"Build the sprite-frame-data. This should be done once per frame"
(set! (-> data hmge-scale quad) (-> *math-camera* hmge-scale quad))
@@ -476,7 +419,7 @@
(none)
)
(define sprite-vu1-block (new 'static 'vu-function :length #x35f :qlength #x1b0))
(define sprite-vu1-block (new 'static 'vu-function :length 0 :qlength 0))
;;;;;;;;;;;;;;;;;;
;; sprite-arrays
@@ -872,10 +815,10 @@
)
;; run the distorters
(when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
(sprite-init-distorter dma-buff)
(sprite-draw-distorters dma-buff)
)
; (when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
; (sprite-init-distorter dma-buff)
; (sprite-draw-distorters dma-buff)
; )
;; first packet - set up the GS registers
(let* ((v1-17 dma-buff)
@@ -987,9 +930,9 @@
;;;;;;;;;;;;;;;;
;; TODO: figure out what this is doing
(sprite-glow-init-engine dma-buff)
(sprite-glow-draw dma-buff)
(simple-sprite-system-method-10 *simple-sprite-system* dma-buff)
; (sprite-glow-init-engine dma-buff)
; (sprite-glow-draw dma-buff)
; (simple-sprite-system-method-10 *simple-sprite-system* dma-buff)
(let* ((v1-26 dma-buff)
(pkt6 (the-as dma-packet (-> v1-26 base)))
)
@@ -1007,7 +950,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) bucket-group)
(bucket-id bucket-313)
(bucket-id particles)
dma-bucket-begin
(the-as (pointer dma-tag) a3-0)
)
@@ -6,4 +6,8 @@
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
(defun update-texture-anim ((id bucket-id))
;; hack!
(none)
)
@@ -289,6 +289,7 @@
:bitfield #t
(needs-log-in 8)
(bit-9 9)
(backup-sprite-tex 10) ;; set when particle-setup-adgif fails texture lookup.
)
;; GS texturing/blending settings, called adgif-shader.
+11 -4
View File
@@ -1111,6 +1111,13 @@
(set! (-> (the-as (pointer gs-reg64) a0-28) 1) (gs-reg64 texflush))
(set! (-> v1-53 base) (&+ a0-28 16))
)
(#when PC_PORT
(dma-buffer-add-cnt-vif2 dma-buf 1 (new 'static 'vif-tag :cmd (vif-cmd pc-port)) (the-as vif-tag 3))
(dma-buffer-add-uint64 dma-buf tpage)
(dma-buffer-add-uint64 dma-buf mode)
)
(let ((a3-3 (-> dma-buf base)))
(let ((v1-54 (the-as dma-packet (-> dma-buf base))))
(set! (-> v1-54 dma) (new 'static 'dma-tag :id (dma-tag-id next)))
@@ -1628,10 +1635,10 @@
)
(((tpage-category sprite))
;; sprite skips uploads if the level isn't drawing, but otherwise uploads the whole thing.
(if (or (= (-> lev display?) 'display) (= (-> lev display?) 'actor) (= (-> lev index) 6))
(set! (-> lev upload-size 7)
(upload-vram-pages pool (-> pool segment-common) tpage (tex-upload-mode seg0-1-2) bucket)
)
(when (or (= (-> lev display?) 'display) (= (-> lev display?) 'actor) (= (-> lev index) 6))
(set! (-> lev upload-size 7)
(upload-vram-pages pool (-> pool segment-common) tpage (tex-upload-mode seg0-1-2) bucket)
)
)
)
(((tpage-category map))
+1 -1
View File
@@ -392,7 +392,7 @@
(bucket-311 311) ;; depth-cue
(tex-all-sprite 312)
(bucket-313 313) ;; particles
(particles 313) ;; particles
(bucket-314 314) ;; shadow
(bucket-315 315) ;; effects
(tex-all-warp 316) ;; tex
+136
View File
@@ -0,0 +1,136 @@
;;-*-Lisp-*-
(in-package goal)
;; this file is debug only
(declare-file (debug))
(when *debug-segment*
;; failed to figure out what this is:
(defpartgroup group-part-tester
:id 127
:flags (unk-4 unk-6)
:bounds (static-bspherem 0 0 0 640)
:rotate ((degrees 2) (degrees 0) (degrees 0))
:parts ((sp-item 209))
)
;; definition of type part-tester
(deftype part-tester (process)
((root trsqv :offset-assert 128)
(part sparticle-launch-control :offset-assert 132)
(old-group sparticle-launch-group :offset-assert 136)
)
:heap-base #x10
:method-count-assert 14
:size-assert #x8c
:flag-assert #xe0010008c
)
;; definition for method 3 of type part-tester
(defmethod inspect part-tester ((obj part-tester))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process inspect)))
(t9-0 obj)
)
(format #t "~2Troot: ~A~%" (-> obj root))
(format #t "~2Tpart: ~A~%" (-> obj part))
(format #t "~2Told-group: ~A~%" (-> obj old-group))
(label cfg-4)
obj
)
;; definition for symbol *part-tester-name*, type string
(define *part-tester-name* (the-as string #f))
;; definition for method 10 of type part-tester
(defmethod deactivate part-tester ((obj part-tester))
(if (nonzero? (-> obj part))
(kill-and-free-particles (-> obj part))
)
((method-of-type process deactivate) obj)
(none)
)
;; failed to figure out what this is:
(defstate part-tester-idle (part-tester)
:code (behavior ()
(until #f
(let ((gp-0 (entity-by-name *part-tester-name*)))
(when gp-0
(let ((s5-0 (-> gp-0 extra process)))
(if (and s5-0 (type? s5-0 process-drawable) (nonzero? (-> (the-as process-drawable s5-0) root)))
(set! (-> self root trans quad) (-> (the-as process-drawable s5-0) root trans quad))
(set! (-> self root trans quad) (-> gp-0 extra trans quad))
)
)
)
)
(add-debug-x
#t
(bucket-id debug-no-zbuf1)
(-> self root trans)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
(let ((gp-1 (-> *part-group-id-table* 127)))
(let ((s5-1 (-> self root trans)))
(when (!= gp-1 (-> self old-group))
(when (nonzero? (-> self part))
(kill-and-free-particles (-> self part))
(set! (-> self heap-cur) (&-> (-> self part) type))
)
(set! (-> self part) (create-launch-control gp-1 self))
)
(if (nonzero? (-> self part))
(spawn (-> self part) (cond
((logtest? (-> gp-1 flags) (sp-group-flag screen-space))
*zero-vector*
)
(else
(empty)
s5-1
)
)
)
)
)
(set! (-> self old-group) gp-1)
)
(suspend)
)
#f
(none)
)
)
;; definition for function part-tester-init-by-other
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs none.
(defbehavior part-tester-init-by-other process-drawable ((arg0 vector))
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg0 quad))
(set! *part-tester* (process->ppointer self))
(go part-tester-idle)
(none)
)
;; definition (perm) for symbol *debug-part-dead-pool*, type dead-pool
(define-perm *debug-part-dead-pool* dead-pool (new 'debug 'dead-pool 1 #x10000 "*debug-part-dead-pool*"))
;; definition for function start-part
;; WARN: Return type mismatch (pointer process) vs none.
(defun start-part ()
(kill-by-type part-tester *active-pool*)
(process-spawn
part-tester
(if *anim-tester*
(-> *anim-tester* 0 root trans)
(target-pos 0)
)
:from *debug-part-dead-pool*
)
(none)
)
)
+10 -14
View File
@@ -43,10 +43,10 @@
)
)
(when (and (-> *setting-control* user-current weather) gp-0)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s4-0 (new 'stack-no-clear 'vector))
(v1-8 (-> *math-camera* inv-camera-rot vector 2))
)
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(let ((v1-8 (-> *math-camera* inv-camera-rot vector 2)))
(set! (-> s5-0 quad) (-> *math-camera* trans quad))
(vector-! s4-0 s5-0 (-> *math-camera* prev-trans))
(let ((f0-1 (vector-dot s4-0 v1-8)))
@@ -54,13 +54,13 @@
)
)
(set! (-> s5-0 y) (-> *math-camera* trans y))
(if (< 0.0 (-> *setting-control* user-current rain))
(update-rain (-> *setting-control* user-current rain) s5-0 s4-0)
)
(if (< 0.0 (-> *setting-control* user-current snow))
(update-snow (-> *setting-control* user-current snow) s5-0 s4-0)
)
)
(if (< 0.0 (-> *setting-control* user-current rain))
(update-rain (the-as target (-> *setting-control* user-current rain)))
)
(if (< 0.0 (-> *setting-control* user-current snow))
(update-snow (the-as target (-> *setting-control* user-current snow)))
)
)
(cond
((and (>= (-> self time-of-day) 6.25)
@@ -691,7 +691,3 @@
;; failed to figure out what this is:
(start-time-of-day)
+963
View File
@@ -0,0 +1,963 @@
;;-*-Lisp-*-
(in-package goal)
;; failed to figure out what this is:
(defpartgroup group-rain-screend-drop-real
:id 1
:flags (screen-space)
:bounds (static-bspherem 0 0 0 16)
:parts ((sp-item 45 :binding 41)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 41 :flags (start-dead launch-asap) :binding 42)
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 42 :flags (start-dead launch-asap))
(sp-item 46 :binding 43)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 43 :flags (start-dead launch-asap) :binding 44)
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
(sp-item 44 :flags (start-dead launch-asap))
)
)
;; definition for symbol group-rain-screend-drop, type sparticle-launch-group
(define group-rain-screend-drop (-> *part-group-id-table* 1))
;; failed to figure out what this is:
(defpart 46
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc))
(sp-flt spt-num 0.1)
(sp-rnd-flt spt-x (meters -4.5) (meters 9) 1.0)
(sp-rnd-flt spt-y (meters -3) (meters 6) 1.0)
(sp-flt spt-scale-x (meters 2.5))
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 128.0)
(sp-flt spt-g 128.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 12.0)
(sp-flt spt-scalevel-x (meters 0.16666667))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.8)
(sp-int spt-timer 10)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
)
)
;; failed to figure out what this is:
(defpart 43
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 1.5))
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 128.0)
(sp-flt spt-g 128.0)
(sp-flt spt-b 255.0)
(sp-flt spt-a 20.0)
(sp-flt spt-scalevel-x (meters 0.033333335))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.8)
(sp-flt spt-accel-y -2.7306666)
(sp-int spt-timer 270)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-int spt-next-time 15)
(sp-launcher-by-id spt-next-launcher 47)
)
)
;; failed to figure out what this is:
(defpart 47
:init-specs ((sp-flt spt-scalevel-x (meters 0.004166667))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.06666667)
)
)
;; failed to figure out what this is:
(defpart 44
:init-specs ((sp-flt spt-num 1.0)
(sp-int spt-rot-x 12)
(sp-flt spt-r 4096.0)
(sp-flt spt-g 3276.8)
(sp-flt spt-b 3276.8)
(sp-flt spt-fade-r 6.068148)
(sp-flt spt-fade-g 68.26667)
(sp-flt spt-fade-b 3.034074)
(sp-flt spt-accel-y -2.7306666)
(sp-int spt-timer 270)
(sp-cpuinfo-flags distort)
(sp-int spt-next-time 30)
(sp-launcher-by-id spt-next-launcher 48)
)
)
;; failed to figure out what this is:
(defpart 48
:init-specs ((sp-flt spt-fade-g -5.1200004))
)
;; failed to figure out what this is:
(defpart 45
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc))
(sp-flt spt-num 0.1)
(sp-rnd-flt spt-x (meters -4.5) (meters 9) 1.0)
(sp-rnd-flt spt-y (meters -3) (meters 6) 1.0)
(sp-flt spt-scale-x (meters 4))
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 128.0)
(sp-flt spt-g 128.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 12.0)
(sp-flt spt-scalevel-x (meters 0.26666668))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.8)
(sp-int spt-timer 10)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
)
)
;; failed to figure out what this is:
(defpart 41
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 2.6))
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 128.0)
(sp-flt spt-g 128.0)
(sp-flt spt-b 255.0)
(sp-flt spt-a 20.0)
(sp-flt spt-scalevel-x (meters 0.06666667))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.8)
(sp-flt spt-accel-y -2.7306666)
(sp-int spt-timer 270)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-int spt-next-time 15)
(sp-launcher-by-id spt-next-launcher 49)
)
)
;; failed to figure out what this is:
(defpart 49
:init-specs ((sp-flt spt-scalevel-x (meters 0.008333334))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.06666667)
)
)
;; failed to figure out what this is:
(defpart 42
:init-specs ((sp-flt spt-num 1.0)
(sp-int spt-rot-x 24)
(sp-flt spt-r 12288.0)
(sp-flt spt-g 6553.6)
(sp-flt spt-b 6553.6)
(sp-flt spt-fade-r 12.136296)
(sp-flt spt-fade-g 136.53334)
(sp-flt spt-fade-b 6.068148)
(sp-flt spt-accel-y -2.7306666)
(sp-int spt-timer 270)
(sp-cpuinfo-flags distort)
(sp-int spt-next-time 30)
(sp-launcher-by-id spt-next-launcher 50)
)
)
;; failed to figure out what this is:
(defpart 50
:init-specs ((sp-flt spt-fade-g -10.240001))
)
;; failed to figure out what this is:
(defpartgroup group-stars
:id 2
:flags (always-draw)
:bounds (static-bspherem 0 0 0 8)
:parts ((sp-item 51 :flags (bit6)) (sp-item 52 :flags (bit6)) (sp-item 53 :flags (bit6)))
)
;; failed to figure out what this is:
(defpart 51
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 30) (meters 20) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 256.0)
(sp-flt spt-g 256.0)
(sp-flt spt-b 256.0)
(sp-flt spt-a 0.0)
(sp-flt spt-fade-a 0.42666668)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-int-plain-rnd spt-next-time 60 239 1)
(sp-launcher-by-id spt-next-launcher 54)
(sp-rnd-flt spt-conerot-x (degrees -89.0) (degrees 178.0) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 1440.0) 1.0)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0)
(sp-flt spt-conerot-radius (meters 5000))
)
)
;; failed to figure out what this is:
(defpart 54
:init-specs ((sp-flt spt-fade-a 0.0) (sp-int spt-next-time 29999700) (sp-launcher-by-id spt-next-launcher 55))
)
;; failed to figure out what this is:
(defpart 55
:init-specs ((sp-flt spt-fade-a -0.42666668))
)
;; failed to figure out what this is:
(defpart 52
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 30) (meters 20) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 256.0)
(sp-flt spt-g 256.0)
(sp-flt spt-b 256.0)
(sp-flt spt-a 0.0)
(sp-flt spt-fade-a 0.42666668)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-int-plain-rnd spt-next-time 60 239 1)
(sp-launcher-by-id spt-next-launcher 54)
(sp-rnd-flt spt-conerot-x (degrees 30.0) (degrees 59.0) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 2880.0) 1.0)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0)
(sp-flt spt-conerot-radius (meters 5000))
)
)
;; failed to figure out what this is:
(defpart 53
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 30) (meters 20) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 128.0)
(sp-flt spt-g 128.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 0.0)
(sp-flt spt-fade-a 0.42666668)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-int-plain-rnd spt-next-time 60 239 1)
(sp-launcher-by-id spt-next-launcher 54)
(sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 29.0) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 5760.0) 1.0)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0)
(sp-flt spt-conerot-radius (meters 5000))
)
)
;; failed to figure out what this is:
(defpart 56
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc))
(sp-flt spt-num 4.0)
(sp-rnd-flt spt-x (meters 10) (meters 10) 1.0)
(sp-rnd-flt spt-y (meters 2) (meters 14) 1.0)
(sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0)
(sp-int spt-rot-x 4)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 255.0)
(sp-flt spt-b 255.0)
(sp-flt spt-a 0.0)
(sp-rnd-flt spt-vel-y (meters -0.01) (meters -0.0033333334) 1.0)
(sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0)
(sp-flt spt-fade-a 0.85333335)
(sp-int spt-timer 1500)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14)
(sp-int-plain-rnd spt-next-time 75 74 1)
(sp-launcher-by-id spt-next-launcher 57)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 180.0) 1.0)
)
)
;; failed to figure out what this is:
(defpart 58
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc))
(sp-flt spt-num 0.0)
(sp-rnd-flt spt-x (meters 0) (meters 20) 1.0)
(sp-flt spt-y (meters 16))
(sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0)
(sp-int spt-rot-x 4)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 255.0)
(sp-flt spt-b 255.0)
(sp-flt spt-a 0.0)
(sp-rnd-flt spt-vel-y (meters -0.01) (meters -0.0033333334) 1.0)
(sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0)
(sp-flt spt-fade-a 0.85333335)
(sp-int spt-timer 1500)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14)
(sp-int-plain-rnd spt-next-time 75 74 1)
(sp-launcher-by-id spt-next-launcher 57)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0)
)
)
;; failed to figure out what this is:
(defpart 57
:init-specs ((sp-flt spt-fade-a 0.0) (sp-int spt-next-time 1200) (sp-launcher-by-id spt-next-launcher 59))
)
;; failed to figure out what this is:
(defpart 59
:init-specs ((sp-flt spt-fade-a -0.85333335))
)
;; definition for function update-snow
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defun update-snow ((arg0 float) (arg1 vector) (arg2 vector))
(let ((f0-0 (lerp-scale 0.0 1.0 (vector-length arg2) 2048.0 40960.0)))
(set! (-> *part-id-table* 58 init-specs 1 initial-valuef) (- 1.0 f0-0))
(set! (-> *part-id-table* 56 init-specs 1 initial-valuef) (* 4.0 f0-0))
)
(set! (-> *part-id-table* 56 init-specs 19 initial-valuef) (+ 32768.0 (vector-y-angle arg2)))
(let ((t9-2 sp-launch-particles-var)
(a0-3 *sp-particle-system-2d*)
(a1-2 (-> *part-id-table* 58))
(a2-2 *launch-matrix*)
)
(set! (-> a2-2 trans quad) (-> arg1 quad))
(t9-2 a0-3 a1-2 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-3 sp-launch-particles-var)
(a0-4 *sp-particle-system-2d*)
(a1-3 (-> *part-id-table* 56))
(a2-3 *launch-matrix*)
)
(set! (-> a2-3 trans quad) (-> arg1 quad))
(t9-3 a0-4 a1-3 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
0
(none)
)
;; failed to figure out what this is:
(defpart 60
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-func spt-birth-func 'birth-func-rain)
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-x (meters -20) (meters 40) 1.0)
(sp-flt spt-y (meters 30))
(sp-rnd-flt spt-scale-x (meters 0.03) (meters 0.03) 1.0)
(sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0)
(sp-rnd-flt spt-r 32.0 32.0 1.0)
(sp-copy-from-other spt-g -1)
(sp-rnd-flt spt-b 64.0 32.0 1.0)
(sp-rnd-flt spt-a 32.0 64.0 1.0)
(sp-rnd-flt spt-vel-y (meters -0.1) (meters -0.2) 1.0)
(sp-int spt-timer 900)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-flt spt-userdata 0.0)
(sp-func spt-func 'check-drop-level-rain)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0)
)
)
;; failed to figure out what this is:
(defpart 61
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-func spt-birth-func 'birth-func-rain)
(sp-flt spt-num 4.0)
(sp-rnd-flt spt-x (meters -20) (meters 40) 1.0)
(sp-flt spt-y (meters 30))
(sp-rnd-flt spt-scale-x (meters 0.03) (meters 0.03) 1.0)
(sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0)
(sp-rnd-flt spt-r 32.0 32.0 1.0)
(sp-copy-from-other spt-g -1)
(sp-rnd-flt spt-b 64.0 32.0 1.0)
(sp-rnd-flt spt-a 32.0 64.0 1.0)
(sp-rnd-flt spt-vel-y (meters -0.06666667) (meters -0.033333335) 1.0)
(sp-int spt-timer 900)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(sp-flt spt-userdata 0.0)
(sp-func spt-func 'check-drop-level-rain2)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0)
)
)
;; failed to figure out what this is:
(defpart 62
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-rnd-flt spt-num 1.0 3.0 1.0)
(sp-rnd-flt spt-scale-x (meters 0.08) (meters 0.03) 1.0)
(sp-int spt-rot-x 4)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 32.0 32.0 1.0)
(sp-copy-from-other spt-g -1)
(sp-rnd-flt spt-b 64.0 32.0 1.0)
(sp-rnd-flt spt-a 64.0 64.0 1.0)
(sp-rnd-flt spt-omega 2.8672 1.6384 1.0)
(sp-rnd-flt spt-vel-y (meters 0.033333335) (meters 0.06666667) 1.0)
(sp-rnd-flt spt-fade-a -0.21333334 -0.21333334 1.0)
(sp-rnd-flt spt-accel-y -20.48 -2.7306666 1.0)
(sp-flt spt-friction 0.98)
(sp-int spt-timer 300)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 use-global-acc)
(sp-flt spt-userdata 0.0)
(sp-func spt-func 'check-drop-level-splash)
(sp-int-plain-rnd spt-next-time 0 99 1)
(sp-launcher-by-id spt-next-launcher 63)
(sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 50.000004) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0)
(sp-flt spt-rotate-x (degrees 0.0))
(sp-flt spt-rotate-y (degrees 0.0))
)
)
;; failed to figure out what this is:
(defpart 64
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc))
(sp-func spt-birth-func 'birth-func-omega-normal-orient)
(sp-flt spt-num 1.0)
(sp-flt spt-y (meters 0.2))
(sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 32.0 32.0 1.0)
(sp-copy-from-other spt-g -1)
(sp-rnd-flt spt-b 64.0 32.0 1.0)
(sp-rnd-flt spt-a 64.0 32.0 1.0)
(sp-flt spt-omega 0.0)
(sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.006666667) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -1.2)
(sp-int spt-timer 300)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)
(new 'static 'sp-field-init-spec
:field (sp-field-id spt-userdata)
:flags (sp-flag plain-v2)
:object (new 'static 'boxed-array :type int32 10 0 0 #xc0c900 #xc02600 #xc03300 #xc02c00)
)
(sp-func spt-func 'sparticle-texture-animate)
)
)
;; failed to figure out what this is:
(defpart 65
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x92 :page #xc))
(sp-rnd-flt spt-num 2.0 4.0 1.0)
(sp-flt spt-scale-x (meters 2.5))
(sp-int spt-rot-x 4)
(sp-rnd-flt spt-scale-y (meters 0.06) (meters 0.03) 1.0)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 128.0 128.0 1.0)
(sp-rnd-flt spt-b 0.0 128.0 1.0)
(sp-flt spt-a 128.0)
(sp-rnd-flt spt-omega 3.2768 2.048 1.0)
(sp-rnd-flt spt-vel-y (meters 0.1) (meters 0.06666667) 1.0)
(sp-rnd-flt spt-fade-g -2.55 -2.55 1.0)
(sp-flt spt-fade-b -8.0)
(sp-rnd-flt spt-fade-a -0.32 -0.64 1.0)
(sp-rnd-flt spt-friction 0.8 0.02 1.0)
(sp-int-plain-rnd spt-timer 100 99 1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)
(sp-func spt-func 'sparticle-motion-blur)
(sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 80.0) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0)
)
)
;; failed to figure out what this is:
(defpart 66
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 0.25))
(sp-flt spt-rot-x 40.96)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 196.0 128.0 1.0)
(sp-rnd-flt spt-b 128.0 64.0 1.0)
(sp-rnd-flt spt-a 96.0 16.0 1.0)
(sp-flt spt-omega 656998.4)
(sp-flt spt-scalevel-x (meters 0.08))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-g -6.375)
(sp-flt spt-fade-b -13.066667)
(sp-flt spt-fade-a -2.8)
(sp-int-plain-rnd spt-timer 15 9 1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 2048.0)
)
)
;; definition for function birth-func-omega-normal-orient
;; WARN: Return type mismatch int vs none.
(defun birth-func-omega-normal-orient ((arg0 sparticle-system)
(arg1 sparticle-cpuinfo)
(arg2 sprite-vec-data-3d)
(arg3 sparticle-launcher)
(arg4 sparticle-launch-state)
)
(local-vars (v1-6 float) (v1-7 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((s4-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'quaternion))
)
(set! (-> s4-0 x) (* 0.007874016 (the float (-> arg1 datab 2))))
(set! (-> s4-0 y) 0.0)
(set! (-> s4-0 z) (* -0.007874016 (the float (-> arg1 datab 0))))
(vector-normalize! s4-0 1.0)
(quaternion-vector-angle! gp-0 s4-0 (acos (* 0.007874016 (the float (-> arg1 datab 1)))))
(cond
((< (-> gp-0 w) 0.0)
(.lvf vf1 (&-> arg2 qx-qy-qz-sy quad))
(.lvf vf2 (&-> gp-0 vec quad))
(.sub.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> arg2 qx-qy-qz-sy quad) vf1)
(.mov v1-6 vf1)
)
(else
(.lvf vf1 (&-> arg2 qx-qy-qz-sy quad))
(.lvf vf2 (&-> gp-0 vec quad))
(.add.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> arg2 qx-qy-qz-sy quad) vf1)
(.mov v1-7 vf1)
)
)
)
0
(none)
)
)
;; definition for function birth-func-rain
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defun birth-func-rain ((arg0 sparticle-system)
(arg1 sparticle-cpuinfo)
(arg2 sprite-vec-data-3d)
(arg3 sparticle-launcher)
(arg4 sparticle-launch-state)
)
(let ((s4-0 (new 'stack-no-clear 'collide-query)))
(set! (-> s4-0 start-pos quad) (-> arg2 x-y-z-sx quad))
(set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0)
(let ((v1-2 s4-0))
(set! (-> v1-2 radius) 40.96)
(set! (-> v1-2 collide-with) (collide-spec backgnd))
(set! (-> v1-2 ignore-process0) #f)
(set! (-> v1-2 ignore-process1) #f)
(set! (-> v1-2 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> v1-2 action-mask) (collide-action solid))
)
(fill-using-line-sphere *collide-cache* s4-0)
(cond
((>= (collide-cache-method-16 *collide-cache* s4-0) 0.0)
(set! (-> arg1 user-float) (-> s4-0 best-other-tri intersect y))
(let ((f0-8 (+ 65536.0 (-> *math-camera* trans y))))
(if (< (-> arg1 user-float) f0-8)
(set! (-> arg2 x-y-z-sx y) f0-8)
)
)
(set! (-> arg1 datab 0) (the int (* 127.0 (-> s4-0 best-other-tri normal x))))
(set! (-> arg1 datab 1) (the int (* 127.0 (-> s4-0 best-other-tri normal y))))
(set! (-> arg1 datab 2) (the int (* 127.0 (-> s4-0 best-other-tri normal z))))
(set! (-> arg1 datab 3) (the-as int (-> s4-0 best-other-tri pat event)))
)
(else
(set! (-> arg1 omega) 65280.0)
(set! (-> arg1 user-float) (+ -204800.0 (-> arg2 x-y-z-sx y)))
)
)
)
(let ((f0-21 (ocean-method-11 *ocean* (the-as (inline-array vector) (-> arg2 x-y-z-sx)) #f)))
(when (!= f0-21 4095996000.0)
(when (< (-> arg1 user-float) f0-21)
(set! (-> arg1 user-float) f0-21)
(set! (-> arg1 datab 0) 0)
(set! (-> arg1 datab 1) 127)
(set! (-> arg1 datab 2) 0)
(set! (-> arg1 datab 3) 0)
0
)
)
)
0
(none)
)
;; definition for function check-drop-level-rain
;; INFO: Used lq/sq
(defun check-drop-level-rain ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(when (< (-> arg2 y) (-> arg1 user-float))
(let ((s4-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'matrix))
)
(let ((f30-0 (-> arg1 user-float)))
(sp-kill-particle arg0 arg1)
(set-vector! s4-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0)
(-> arg1 omega)
(set-vector!
(-> gp-0 vector 1)
(* 0.007874016 (the float (-> arg1 datab 0)))
(* 0.007874016 (the float (-> arg1 datab 1)))
(* 0.007874016 (the float (-> arg1 datab 2)))
0.0
)
(set-vector! (-> gp-0 vector 2) 0.0 0.0 1.0 0.0)
(vector-cross! (the-as vector (-> gp-0 vector)) (-> gp-0 vector 1) (-> gp-0 vector 2))
(set! (-> gp-0 trans quad) (-> s4-0 quad))
(set! (-> *part-id-table* 62 init-specs 23 initial-valuef) (vector-y-angle (-> gp-0 vector 1)))
(set! (-> *part-id-table* 62 init-specs 22 initial-valuef) (- 16384.0 (vector-x-angle (-> gp-0 vector 1))))
(set! (-> *part-id-table* 62 init-specs 16 initial-valuef) f30-0)
)
(sp-launch-particles-var
*sp-particle-system-2d*
(-> *part-id-table* 62)
gp-0
(the-as sparticle-launch-state #f)
(the-as sparticle-launch-control #f)
1.0
)
(case (-> arg1 datab 3)
((11 10)
(sound-play "sizzle-drips")
(sp-launch-particles-var
*sp-particle-system-2d*
(-> *part-id-table* 66)
gp-0
(the-as sparticle-launch-state #f)
(the-as sparticle-launch-control #f)
1.0
)
(sp-launch-particles-var
*sp-particle-system-2d*
(-> *part-id-table* 65)
gp-0
(the-as sparticle-launch-state #f)
(the-as sparticle-launch-control #f)
1.0
)
)
(else
(sound-play "dry-drips")
(set! (-> *part-id-table* 64 init-specs 10 initial-valuef) (-> arg1 omega))
(sp-launch-particles-var
*sp-particle-system-3d*
(-> *part-id-table* 64)
gp-0
(the-as sparticle-launch-state #f)
(the-as sparticle-launch-control #f)
1.0
)
)
)
)
)
(none)
)
;; definition for function check-drop-level-rain2
;; WARN: Return type mismatch symbol vs none.
(defun check-drop-level-rain2 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(if (< (-> arg2 y) (-> arg1 user-float))
(sp-kill-particle arg0 arg1)
)
(none)
)
;; definition for function check-drop-level-splash
;; WARN: Return type mismatch symbol vs none.
(defun check-drop-level-splash ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(sparticle-motion-blur arg0 arg1 arg2)
(if (< (-> arg2 y) (-> arg1 user-float))
(sp-kill-particle arg0 arg1)
)
(none)
)
;; definition for function update-rain
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defun update-rain ((arg0 float) (arg1 vector) (arg2 vector))
(let ((v1-0 (new 'stack-no-clear 'vector)))
(set! (-> v1-0 x) (-> arg2 x))
(set! (-> v1-0 y) 0.0)
(set! (-> v1-0 z) (-> arg2 z))
(set! (-> v1-0 w) 1.0)
(let ((gp-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 v1-0 0.0)))
(let ((t9-0 matrix-local->world)
(a0-3 #f)
)
(let* ((s4-0 (t9-0 a0-3))
(f28-0 (lerp-scale 122.88 245.76 (fabs (-> s4-0 vector 2 y)) 0.0 0.7))
(f30-0 (lerp-scale 2048.0 245.76 (fabs (-> s4-0 vector 2 y)) 0.0 0.7))
)
(let ((f26-0 (lerp-scale 0.0 0.1 (-> s4-0 vector 2 y) 0.3 0.7))
(f0-11 (lerp-scale 1.0 0.1 (-> s4-0 vector 2 y) 0.3 0.7))
)
(if (< 0.0 f26-0)
(send-event *camera* 'part-water-drip f26-0 f0-11)
)
)
(set! (-> *part-id-table* 60 init-specs 5 initial-valuef) f28-0)
(set! (-> *part-id-table* 60 init-specs 5 random-rangef) f28-0)
(set! (-> *part-id-table* 61 init-specs 5 initial-valuef) f28-0)
(set! (-> *part-id-table* 61 init-specs 5 random-rangef) f28-0)
(set! (-> *part-id-table* 60 init-specs 6 initial-valuef) f30-0)
(set! (-> *part-id-table* 60 init-specs 6 random-rangef) f30-0)
(set! (-> *part-id-table* 61 init-specs 6 initial-valuef) f30-0)
(set! (-> *part-id-table* 61 init-specs 6 random-rangef) f30-0)
)
)
(set! (-> *part-id-table* 60 init-specs 2 initial-valuef) arg0)
(set! (-> *part-id-table* 61 init-specs 2 initial-valuef) (* 4.0 arg0))
(let ((t9-6 sp-launch-particles-var)
(a0-10 *sp-particle-system-2d*)
(a1-7 (-> *part-id-table* 60))
(a2-5 *launch-matrix*)
)
(set! (-> a2-5 trans quad) (-> gp-1 quad))
(t9-6 a0-10 a1-7 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-7 sp-launch-particles-var)
(a0-11 *sp-particle-system-2d*)
(a1-8 (-> *part-id-table* 61))
(a2-6 *launch-matrix*)
)
(set! (-> a2-6 trans quad) (-> gp-1 quad))
(t9-7 a0-11 a1-8 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
)
0
(none)
)
;; definition for function cam-master-effect
;; WARN: Return type mismatch int vs none.
(defbehavior cam-master-effect camera-master ()
(when (not (or (movie?) (>= (+ (-> self clock frame-counter) (seconds -10)) (-> self water-drip-time))))
(set! (-> *part-id-table* 46 init-specs 1 initial-valuef) (-> self water-drip-mult))
(set! (-> *part-id-table* 45 init-specs 1 initial-valuef) (* 0.9 (-> self water-drip-mult)))
(set! (-> *part-id-table* 43 init-specs 11 initial-valuef) (* -2.7306666 (-> self water-drip-speed)))
(set! (-> *part-id-table* 44 init-specs 8 initial-valuef) (* -2.7306666 (-> self water-drip-speed)))
(set! (-> *part-id-table* 41 init-specs 11 initial-valuef) (* -2.7306666 (-> self water-drip-speed)))
(set! (-> *part-id-table* 42 init-specs 8 initial-valuef) (* -2.7306666 (-> self water-drip-speed)))
(spawn (-> self water-drip) *zero-vector*)
)
0
(none)
)
;; definition for function sparticle-track-sun
;; WARN: Return type mismatch int vs none.
(defun sparticle-track-sun ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 matrix))
(-> arg1 key)
(let* ((s3-0 (the int (-> arg1 user-float)))
(s5-0 (math-camera-pos))
(s4-0 (+ (the-as uint (-> *sky-work* upload-data)) (* (/ s3-0 4) 64)))
)
(let ((v1-3 (/ s3-0 4)))
(cond
((zero? v1-3)
(set! (-> arg2 vector 1 z) (+ 8192.0 (* 0.5 (vector-y-angle (-> (math-camera-matrix) vector 2)))))
)
((= v1-3 1)
(set! (-> arg2 vector 1 z) (+ -8192.0 (* 0.5 (vector-y-angle (-> (math-camera-matrix) vector 2)))))
)
)
)
(let ((v1-12 (vector+float*! (new 'stack-no-clear 'vector) s5-0 (the-as vector s4-0) 4096.0)))
(set! (-> arg2 vector 0 x) (-> v1-12 x))
(set! (-> arg2 vector 0 y) (-> v1-12 y))
(set! (-> arg2 vector 0 z) (-> v1-12 z))
)
)
0
(none)
)
;; failed to figure out what this is:
(defpartgroup group-sun
:id 3
:flags (always-draw)
:bounds (static-bspherem 0 0 0 70)
:parts ((sp-item 67 :flags (bit6)) (sp-item 68 :flags (bit6)))
)
;; failed to figure out what this is:
(defpart 67
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 2550))
(sp-flt spt-rot-x 307200.0)
(sp-flt spt-rot-z (degrees 30.0))
(sp-flt spt-scale-y (meters 2550))
(sp-flt spt-r 64.0)
(sp-flt spt-g 64.0)
(sp-flt spt-b 16.0)
(sp-flt spt-a 70.0)
(sp-flt spt-omega 0.0)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)
(sp-flt spt-userdata 1.0)
(sp-func spt-func 'sparticle-track-sun)
)
)
;; failed to figure out what this is:
(defpart 68
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 12000))
(sp-flt spt-rot-x 307200.0)
(sp-flt spt-rot-z (degrees 30.0))
(sp-flt spt-scale-y (meters 12000))
(sp-flt spt-r 64.0)
(sp-flt spt-g 32.0)
(sp-flt spt-b 0.0)
(sp-flt spt-a 80.0)
(sp-flt spt-omega 0.0)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)
(sp-flt spt-userdata 1.0)
(sp-func spt-func 'sparticle-track-sun)
)
)
;; failed to figure out what this is:
(defpartgroup group-green-sun
:id 4
:flags (always-draw)
:bounds (static-bspherem 0 0 0 70)
:parts ((sp-item 69 :flags (bit6)) (sp-item 70 :flags (bit6)))
)
;; failed to figure out what this is:
(defpart 69
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 1500))
(sp-flt spt-rot-x 204800.0)
(sp-flt spt-rot-z (degrees 30.0))
(sp-flt spt-scale-y (meters 1500))
(sp-flt spt-r 16.0)
(sp-flt spt-g 64.0)
(sp-flt spt-b 32.0)
(sp-flt spt-a 64.0)
(sp-flt spt-omega 0.0)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)
(sp-flt spt-userdata 4.0)
(sp-func spt-func 'sparticle-track-sun)
)
)
;; failed to figure out what this is:
(defpart 70
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 3000))
(sp-flt spt-rot-x 204800.0)
(sp-flt spt-rot-z (degrees 30.0))
(sp-flt spt-scale-y (meters 3000))
(sp-flt spt-r 0.0)
(sp-flt spt-g 43.0)
(sp-flt spt-b 8.0)
(sp-flt spt-a 64.0)
(sp-flt spt-omega 0.0)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)
(sp-flt spt-userdata 4.0)
(sp-func spt-func 'sparticle-track-sun)
)
)
;; failed to figure out what this is:
(defpartgroup group-moon
:id 5
:flags (always-draw)
:bounds (static-bspherem 0 0 0 70)
:parts ((sp-item 71 :flags (bit6)))
)
;; failed to figure out what this is:
(defpart 71
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 6000))
(sp-flt spt-rot-x 544768.0)
(sp-flt spt-rot-z (degrees 30.0))
(sp-flt spt-scale-y (meters 6000))
(sp-flt spt-r 16.0)
(sp-flt spt-g 32.0)
(sp-flt spt-b 64.0)
(sp-flt spt-a 64.0)
(sp-flt spt-omega 0.0)
(sp-int spt-timer -1)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)
(sp-flt spt-userdata 8.0)
(sp-func spt-func 'sparticle-track-sun)
)
)
@@ -22,6 +22,7 @@
(friction float :offset-assert 96)
(timer int32 :offset-assert 100)
(flags sp-cpuinfo-flag :offset-assert 104)
(flags-s32 sp-cpuinfo-flag-s32 :offset 104)
(user-int32 int32 :offset-assert 108)
(user-uint32 uint32 :offset 108)
(user-float float :offset 108)
@@ -39,7 +40,7 @@
(key-alt sparticle-launch-state :offset 132)
(binding sparticle-launch-state :offset-assert 136)
(data uint32 1 :offset 12)
(datab uint8 4 :offset 12)
(datab int8 4 :offset 12)
(dataf float 1 :offset 12)
(datac uint8 1 :offset 12)
)
@@ -96,7 +96,7 @@
:flag-assert #xb00000010
(:methods
(get-field-spec-by-id (_type_ sp-field-id) sp-field-init-spec 9)
(sparticle-launcher-method-10 (_type_ string) none 10)
(setup-user-array (_type_ string) none 10)
)
)
@@ -272,10 +272,10 @@
:flag-assert #x1000000070
(:methods
(initialize (_type_ sparticle-launch-group process) none 9)
(sparticle-launch-control-method-10 (_type_ vector) symbol 10)
(is-visible? (_type_ vector) symbol 10)
(spawn (_type_ vector) none 11)
(sparticle-launch-control-method-12 (_type_ matrix) none 12)
(sparticle-launch-control-method-13 (_type_ cspace) none 13)
(spawn-with-matrix (_type_ matrix) none 12)
(spawn-with-cspace (_type_ cspace) none 13)
(kill-and-free-particles (_type_) none 14)
(kill-particles (_type_) none 15)
)
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -894,7 +894,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) bucket-group)
(bucket-id bucket-313)
(bucket-id particles)
dma-bucket-begin
(the-as (pointer dma-tag) a3-0)
)