Add custom build rule for material display lists with image addresses in them

This commit is contained in:
LagoLunatic
2024-11-01 19:32:15 -04:00
parent a16d8cee02
commit e9f82ff359
9 changed files with 543 additions and 114 deletions
+4 -37
View File
@@ -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() {