summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSonic Dreamcaster <alejandro.asenjo88@gmail.com>2025-04-11 05:34:26 -0300
committerSonic Dreamcaster <alejandro.asenjo88@gmail.com>2025-04-11 05:34:26 -0300
commitaf686894f2048db4e5094eaa9c86de0285b72646 (patch)
tree474a1813d824a83c1b29a497515a9b877b5f93a3
parentdaa711f29001a67bd3925fa54bb1a87337d4e23e (diff)
fix Electric Arc interpolation
-rw-r--r--include/sf64_tagging.h31
-rw-r--r--src/engine/fox_effect.c8
-rw-r--r--src/engine/fox_std_lib.c4
3 files changed, 40 insertions, 3 deletions
diff --git a/include/sf64_tagging.h b/include/sf64_tagging.h
new file mode 100644
index 00000000..26503a54
--- /dev/null
+++ b/include/sf64_tagging.h
@@ -0,0 +1,31 @@
+#ifndef SF64_TAGGING
+#define SF64_TAGGING
+
+/* For dynamic actors */
+#define TAG_ADDRESS(ptr) ((u32) (ptr) & 0x0FFFFFFF)
+
+/*
+ X XXX XX XX
+ TYPE ID INDEX CUSTOM
+*/
+#define TAG_OBJ(ptr) (((((ptr)->obj.id) << 16) & 0x0FFF0000) | ((((ptr)->index) << 8) & 0x0000FF00))
+
+/* Actor Types */
+#define TAG_ACTOR(actor) ((u32) (0x10000000 | (TAG_OBJ(actor))))
+#define TAG_ACTOR_EVENT(actor) ((u32) (0x20000000 | (TAG_OBJ(actor))))
+#define TAG_ACTOR_EVENT_COMMON(actor) ((u32) (0x90000000 | (TAG_OBJ(actor))))
+#define TAG_BOSS(boss) ((u32) (0x30000000 | (TAG_OBJ(boss))))
+#define TAG_SCENERY(scenery) ((u32) (0x40000000 | (TAG_OBJ(scenery))))
+#define TAG_SCENERY_360(scenery360) ((u32) (0x50000000 | (TAG_ADDRESS(scenery360))))
+#define TAG_EFFECT(effect) ((u32) (0x60000000 | (TAG_OBJ(effect))))
+#define TAG_ITEM(item) ((u32) (0x70000000 | (TAG_OBJ(item))))
+#define TAG_PLAYER_SHOT(shot) ((u32) (0xC0000000 | (TAG_OBJ(shot))))
+
+/* Skeletons */
+#define TAG_LIMB_ADDRESS(ptr, data) ((((u32) (ptr) << 16) & 0xFFFF0000) | ((u32) (data) & 0x0000FFFF))
+#define TAG_LIMB(limb, data) ((u32) (0x80000000 | (TAG_LIMB_ADDRESS(limb, data))))
+
+/* Others */
+#define TAG_ARWING_SKEL(arwing) (0xB0000000 | (((u32) (arwing) << 16) & 0x0FFF0000))
+
+#endif
diff --git a/src/engine/fox_effect.c b/src/engine/fox_effect.c
index 83bb3066..010d8bab 100644
--- a/src/engine/fox_effect.c
+++ b/src/engine/fox_effect.c
@@ -24,6 +24,7 @@
#include "assets/ast_zoness.h"
#include "port/interpolation/FrameInterpolation.h"
#include "port/mods/PortEnhancements.h"
+#include "sf64_tagging.h"
// rodata
const char D_800D7230[] = "Enm->wrk3=<%d>\n";
@@ -363,11 +364,18 @@ void Effect_Effect389_Draw(Effect389* this) {
for (i = 0; i < 10; i++) {
if ((i >= this->unk_48) && (i < this->unk_46)) {
Matrix_Push(&gGfxMatrix);
+
+ // @port: Tag the transform.
+ FrameInterpolation_RecordOpenChild("ElectricArc1", TAG_EFFECT(this) + i);
+
Matrix_Translate(gGfxMatrix, 0.0f, -60.0f, 0.0f, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, 0.8f, 3.0f, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_102F5E0);
Matrix_Pop(&gGfxMatrix);
+
+ // @port: Pop the transform.
+ FrameInterpolation_RecordCloseChild();
}
Matrix_Translate(gGfxMatrix, 0.0f, -120.0f, 0.0f, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, D_800D1534[this->unk_4C][i] * M_DTOR, MTXF_APPLY);
diff --git a/src/engine/fox_std_lib.c b/src/engine/fox_std_lib.c
index b4f96e5f..47be8b2a 100644
--- a/src/engine/fox_std_lib.c
+++ b/src/engine/fox_std_lib.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "assets/ast_text.h"
+#include "sf64_tagging.h"
char D_801619A0[100];
@@ -206,9 +207,6 @@ s32 Animation_GetLimbIndex(Limb* limb, Limb** skeleton) {
return 0;
}
-#define TAG_LIMB_ADDRESS(ptr, data) ((((u32) (ptr) << 16) & 0xFFFF0000) | ((u32) (data) & 0x0000FFFF))
-#define TAG_LIMB(limb, data) ((u32) (0x80000000 | (TAG_LIMB_ADDRESS(limb, data))))
-
void Animation_DrawLimb(s32 mode, Limb* limb, Limb** skeleton, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw,
PostLimbDraw postLimbDraw, void* data) {
bool override;