summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-11-01 19:32:15 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-11-01 19:32:15 -0400
commite9f82ff359b9cffb9770ebab263770e207d6ee79 (patch)
tree5a16c138f43b90035e307f9e08fdcbeab38eff7a /src
parenta16d8cee02c7cd1410215f389ae69ac86eeb5e58 (diff)
Add custom build rule for material display lists with image addresses in them
Diffstat (limited to 'src')
-rw-r--r--src/d/actor/d_a_hookshot.cpp41
-rw-r--r--src/d/d_chain.cpp23
-rw-r--r--src/d/d_tree.cpp41
3 files changed, 10 insertions, 95 deletions
diff --git a/src/d/actor/d_a_hookshot.cpp b/src/d/actor/d_a_hookshot.cpp
index 4f0c2219..2b67e7c9 100644
--- a/src/d/actor/d_a_hookshot.cpp
+++ b/src/d/actor/d_a_hookshot.cpp
@@ -9,18 +9,14 @@
#include "SSystem/SComponent/c_counter.h"
#include "d/actor/d_a_player_main.h"
#include "d/d_procname.h"
-#include "global.h"
#include "weak_data_2100_2080.h" // IWYU pragma: keep
-#define CONST_U32(v) ((u8)((v) >> 16)), ((u8)((v) >> 8)), ((u8)((v) >> 0))
-#define IMAGE_ADDR(addr) CONST_U32((u32)(addr) >> 5)
-
#include "assets/l_chainS3TCTEX__d_hookshot.h"
const u16 l_chainS3TCTEX__width = 32;
const u16 l_chainS3TCTEX__height = 32;
-static Vec l_pos[0xC] = {
+static Vec l_pos[] = {
{-2.0f, 1.522254f, -0.0f},
{-2.0f, 1.522254f, 7.0f},
{2.0f, 1.522254f, -0.0f},
@@ -35,7 +31,7 @@ static Vec l_pos[0xC] = {
{2.0f, -1.522254f, 7.0f},
};
-static cXy l_texCoord[0xC] = {
+static cXy l_texCoord[] = {
{0.02736f, 0.041406f},
{0.97264f, 0.041406f},
{0.830848f, 0.40324f},
@@ -52,37 +48,8 @@ static cXy l_texCoord[0xC] = {
#include "assets/l_chainDL__d_hookshot.h"
-static u8 l_matDL[] ALIGN_DECL(32) = {
- 0x61, 0x80, 0x00, 0x01, 0x3A,
- 0x61, 0x84, 0x00, 0x00, 0x00,
- 0x61, 0x88, 0xE0, 0x7C, 0x1F,
- // TX_SETIMAGE3_I0 BP command. Statically insert the pointer to the chain texture into the display list array by extracting each byte.
- 0x61, 0x94, IMAGE_ADDR(&l_chainS3TCTEX),
- 0x61, 0x30, 0x00, (l_chainS3TCTEX__width >> 0x08), (l_chainS3TCTEX__width >> 0x00),
- 0x61, 0x31, 0x00, (l_chainS3TCTEX__height >> 0x08), (l_chainS3TCTEX__height >> 0x00),
- 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80,
- 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00,
- 0x10, 0x00, 0x00, 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00,
- 0x10, 0x00, 0x00, 0x10, 0x0E, 0x00, 0x00, 0x05, 0x43,
- 0x61, 0x28, 0x3C, 0x00, 0x00,
- 0x61, 0xC0, 0x08, 0x24, 0xAF,
- 0x61, 0xC1, 0x08, 0xFF, 0xF0,
- 0x61, 0x28, 0x3C, 0x00, 0x00,
- 0x61, 0xC2, 0x08, 0xF0, 0x8F,
- 0x61, 0xC3, 0x08, 0xFF, 0xC0,
- 0x61, 0x43, 0x00, 0x00, 0x01,
- 0x61, 0x40, 0x00, 0x00, 0x17,
- 0x61, 0x41, 0x00, 0x01, 0x0C,
- 0x61, 0xF3, 0x64, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00, 0x00, 0x01,
- 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x01,
- 0x61, 0x00, 0x00, 0x04, 0x11,
-
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
+#include "assets/l_matDL__d_hookshot.h"
+l_matDL__d_hookshot(l_chainS3TCTEX);
/* 800F104C-800F12C8 .text draw__16daHookshot_shapeFv */
void daHookshot_shape::draw() {
diff --git a/src/d/d_chain.cpp b/src/d/d_chain.cpp
index 4d6e6e44..a61e4989 100644
--- a/src/d/d_chain.cpp
+++ b/src/d/d_chain.cpp
@@ -10,9 +10,6 @@
#include "weak_data_2100_2080.h" // IWYU pragma: keep
-#define CONST_U32(v) ((u8)((v) >> 16)), ((u8)((v) >> 8)), ((u8)((v) >> 0))
-#define IMAGE_ADDR(addr) CONST_U32((u32)(addr) >> 5)
-
#include "assets/l_chainS3TCTEX__d_chain.h"
const u16 l_chainS3TCTEX__width = 32;
const u16 l_chainS3TCTEX__height = 32;
@@ -49,24 +46,8 @@ static cXy l_texCoord[] = {
#include "assets/l_chainDL__d_chain.h"
-static u8 l_matDL[0xa8] ALIGN_DECL(32) = {
- 0x61, 0x80, 0x00, 0x01, 0x3A,
- 0x61, 0x84, 0x00, 0x00, 0x00,
- 0x61, 0x88, 0xE0, 0x7C, 0x1F,
- 0x61, 0x94, IMAGE_ADDR(&l_chainS3TCTEX),
- 0x61, 0x30, 0x00, (l_chainS3TCTEX__width >> 0x08), (l_chainS3TCTEX__width >> 0x00),
- 0x61, 0x31, 0x00, (l_chainS3TCTEX__height >> 0x08), (l_chainS3TCTEX__height >> 0x00),
- 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80,
- 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00,
- 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00, 0x10, 0x0E, 0x00, 0x00, 0x05, 0x43, 0x61,
- 0x28, 0x3C, 0x00, 0x00, 0x61, 0xC0, 0x08, 0x24, 0xAF, 0x61, 0xC1, 0x08, 0xFF, 0xF0, 0x61, 0x28,
- 0x3C, 0x00, 0x00, 0x61, 0xC2, 0x08, 0xF0, 0x8F, 0x61, 0xC3, 0x08, 0xFF, 0xC0, 0x61, 0x43, 0x00,
- 0x00, 0x01, 0x61, 0x40, 0x00, 0x00, 0x17, 0x61, 0x41, 0x00, 0x01, 0x0C, 0x61, 0xF3, 0x64, 0x00,
- 0x00, 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x10, 0x09, 0x00,
- 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x04, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
+#include "assets/l_matDL__d_chain.h"
+l_matDL__d_chain(l_chainS3TCTEX);
/* 800628B4-80062954 .text __ct__15dChain_packet_cFiP12dKy_tevstr_cf */
dChain_packet_c::dChain_packet_c(int num, dKy_tevstr_c* tevstr, f32 scale) {
diff --git a/src/d/d_tree.cpp b/src/d/d_tree.cpp
index b6e8672b..f61565e2 100644
--- a/src/d/d_tree.cpp
+++ b/src/d/d_tree.cpp
@@ -8,9 +8,6 @@
#include "weak_data_2100_2080.h" // IWYU pragma: keep
-#define CONST_U32(v) ((u8)((v) >> 16)), ((u8)((v) >> 8)), ((u8)((v) >> 0))
-#define IMAGE_ADDR(addr) CONST_U32((u32)(addr) >> 5)
-
#include "assets/l_Txa_swood_aTEX.h"
const u16 l_Txa_swood_aTEX__width = 64;
const u16 l_Txa_swood_aTEX__height = 64;
@@ -137,24 +134,8 @@ cXy l_texCoord[] = {
#include "assets/l_Oba_swood_a_hapaDL.h"
#include "assets/l_Oba_swood_a_mikiDL.h"
-u8 l_matDL[] ALIGN_DECL(32) = {
- 0x61, 0x80, 0x00, 0x01, 0x3A,
- 0x61, 0x84, 0x00, 0x00, 0x00,
- 0x61, 0x88, 0xE0, 0xFC, 0x3F,
- 0x61, 0x94, IMAGE_ADDR(&l_Txa_swood_aTEX),
- 0x61, 0x30, 0x00, (l_Txa_swood_aTEX__width >> 0x08), (l_Txa_swood_aTEX__width >> 0x00),
- 0x61, 0x31, 0x00, (l_Txa_swood_aTEX__height >> 0x08), (l_Txa_swood_aTEX__height >> 0x00),
- 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80,
- 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00,
- 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00, 0x10, 0x0E, 0x00, 0x00, 0x05, 0x43, 0x61,
- 0x28, 0x3C, 0x00, 0x00, 0x61, 0xC0, 0x08, 0x24, 0xAF, 0x61, 0xC1, 0x08, 0xFF, 0xF0, 0x61, 0x28,
- 0x3C, 0x00, 0x00, 0x61, 0xC2, 0x08, 0xF0, 0x8F, 0x61, 0xC3, 0x08, 0xEE, 0x70, 0x61, 0x40, 0x00,
- 0x00, 0x17, 0x61, 0x41, 0x00, 0x01, 0x0C, 0x61, 0xF3, 0x64, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10,
- 0x3F, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x01, 0x61, 0x00,
- 0x00, 0x04, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
-};
+#include "assets/l_matDL__d_tree.h"
+l_matDL__d_tree(l_Txa_swood_aTEX);
#include "assets/l_Txa_kage_32TEX.h"
const u16 l_Txa_kage_32TEX__width = 32;
@@ -176,22 +157,8 @@ u8 g_dTree_shadowTexCoord[][2] = {
#include "assets/g_dTree_Oba_kage_32DL.h"
-u8 g_dTree_shadowMatDL[] ALIGN_DECL(32) = {
- 0x61, 0x80, 0x00, 0x01, 0x35,
- 0x61, 0x84, 0x00, 0x00, 0x00,
- 0x61, 0x88, 0x00, 0x7C, 0x1F,
- 0x61, 0x94, IMAGE_ADDR(&l_Txa_kage_32TEX),
- 0x61, 0x30, 0x00, (l_Txa_kage_32TEX__width >> 0x08), (l_Txa_kage_32TEX__width >> 0x00),
- 0x61, 0x31, 0x00, (l_Txa_kage_32TEX__height >> 0x08), (l_Txa_kage_32TEX__height >> 0x00),
- 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80,
- 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00,
- 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, 0x61, 0x28, 0x38, 0x03, 0xC0, 0x61, 0xC0, 0x08, 0xFF, 0xFF,
- 0x61, 0xC1, 0x08, 0xE6, 0x70, 0x61, 0x43, 0x00, 0x00, 0x01, 0x61, 0x40, 0x00, 0x00, 0x07, 0x61,
- 0x41, 0x00, 0x04, 0xAD, 0x61, 0xF3, 0x64, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00,
- 0x00, 0x01, 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x40, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
+#include "assets/g_dTree_shadowMatDL.h"
+g_dTree_shadowMatDL(l_Txa_kage_32TEX);
const u32 g_dTree_Oba_kage_32DL_SIZE = sizeof(g_dTree_Oba_kage_32DL);
const u32 g_dTree_shadowMatDL_SIZE = sizeof(g_dTree_shadowMatDL);