Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Missing TextIDs for MQ PAL and change lava size #3449

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion soh/assets/xml/GC_MQ_D/overlays/ovl_Boss_Dodongo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Root>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808C1190" RangeStart="0x6238" RangeEnd="0x9238">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="64" Height="64" Offset="0x6238"/>
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="32" Height="64" Offset="0x6238"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x8238"/>
</File>
</Root>
4 changes: 2 additions & 2 deletions soh/assets/xml/GC_MQ_PAL_F/overlays/ovl_Boss_Dodongo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Root>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808B7370" RangeStart="0x61E8" RangeEnd="0x9238">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="64" Height="64" Offset="0x61E8"/>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808B7370" RangeStart="0x61E8" RangeEnd="0x91E8">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="32" Height="64" Offset="0x61E8"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x81E8"/>
</File>
</Root>
8 changes: 4 additions & 4 deletions soh/assets/xml/GC_MQ_PAL_F/text/message_data_static.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Root>
<File Name="nes_message_data_static">
<Text Name="nes_message_data_static" CodeOffset="0xF6910"/>
<Text Name="nes_message_data_static" CodeOffset="0xF68F0"/>
</File>
<File Name="ger_message_data_static">
<Text Name="ger_message_data_static" CodeOffset="0xF6910" LangOffset="0xFAB38"/>
<Text Name="ger_message_data_static" CodeOffset="0xF68F0" LangOffset="0xFAB18"/>
</File>
<File Name="fra_message_data_static">
<Text Name="fra_message_data_static" CodeOffset="0xF6910" LangOffset="0xFCC48"/>
<Text Name="fra_message_data_static" CodeOffset="0xF68F0" LangOffset="0xFCC28"/>
</File>
<File Name="staff_message_data_static">
<Text Name="staff_message_data_static" CodeOffset="0xFED58"/>
<Text Name="staff_message_data_static" CodeOffset="0xFED38"/>
</File>
</Root>
2 changes: 1 addition & 1 deletion soh/assets/xml/GC_NMQ_D/overlays/ovl_Boss_Dodongo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Root>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808C1210" RangeStart="0x6238" RangeEnd="0x9238">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="64" Height="64" Offset="0x6238"/>
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="32" Height="64" Offset="0x6238"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x8238"/>
</File>
</Root>
6 changes: 3 additions & 3 deletions soh/assets/xml/GC_NMQ_PAL_F/overlays/ovl_Boss_Dodongo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Root>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808C1190" RangeStart="0x6238" RangeEnd="0x9238">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="64" Height="64" Offset="0x6238"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x8238"/>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808C1190" RangeStart="0x61E8" RangeEnd="0x91E8">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="32" Height="64" Offset="0x61E8"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x81E8"/>
</File>
</Root>
2 changes: 1 addition & 1 deletion soh/assets/xml/N64_PAL_10/overlays/ovl_Boss_Dodongo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Root>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x8089E470" RangeStart="0x61C8" RangeEnd="0x91C8">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="64" Height="64" Offset="0x61C8"/>
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="32" Height="64" Offset="0x61C8"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x81C8"/>
</File>
</Root>
2 changes: 1 addition & 1 deletion soh/assets/xml/N64_PAL_11/overlays/ovl_Boss_Dodongo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Root>
<File Name="ovl_Boss_Dodongo" BaseAddress="0x808C1190" RangeStart="0x61C8" RangeEnd="0x91C8">
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="64" Height="64" Offset="0x61C8"/>
<Texture Name="sLavaFloorLavaTex" OutName="lava_floor_lava" Format="rgba16" Width="32" Height="64" Offset="0x61C8"/>
<Texture Name="sLavaFloorRockTex" OutName="lava_floor_rock" Format="rgba16" Width="32" Height="64" Offset="0x81C8"/>
</File>
</Root>
6 changes: 6 additions & 0 deletions soh/soh/z_message_OTR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) {
_message_0xFFFC_nes = (char*)file->messages[i].msg.c_str();
}

// Assert that the first message starts at the first text ID
assert(table[0].textId == 0x0001);

return table;
}

Expand Down Expand Up @@ -104,6 +107,9 @@ extern "C" void OTRMessage_Init()
sStaffMessageEntryTablePtr[i].segment = file2->messages[i].msg.c_str();
sStaffMessageEntryTablePtr[i].msgSize = file2->messages[i].msg.size();
}

// Assert staff credits start at the first credits ID
assert(sStaffMessageEntryTablePtr[0].textId == 0x0500);
}

CustomMessageManager::Instance->AddCustomMessageTable(customMessageTableID);
Expand Down
29 changes: 16 additions & 13 deletions soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ void gfx_texture_cache_clear();

#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)

#define LAVA_TEX_WIDTH 32
#define LAVA_TEX_HEIGHT 64
#define LAVA_TEX_SIZE 2048

void BossDodongo_Init(Actor* thisx, PlayState* play);
void BossDodongo_Destroy(Actor* thisx, PlayState* play);
void BossDodongo_Update(Actor* thisx, PlayState* play);
Expand Down Expand Up @@ -69,8 +73,8 @@ static u8 sMaskTexLava[32 * 64] = { { 0 } };

static u32* sLavaFloorModifiedTexRaw = NULL;
static u32* sLavaWavyTexRaw = NULL;
static u16 sLavaFloorModifiedTex[4096];
static u16 sLavaWavyTex[2048];
static u16 sLavaFloorModifiedTex[LAVA_TEX_SIZE];
static u16 sLavaWavyTex[LAVA_TEX_SIZE];

static u8 hasRegisteredBlendedHook = 0;

Expand Down Expand Up @@ -104,7 +108,7 @@ void BossDodongo_RegisterBlendedLavaTextureUpdate() {

// When the texture is HD (raw) we need to work with u32 values for RGBA32
// Otherwise the original asset is u16 for RGBA16
if (ResourceMgr_TexIsRaw(sLavaFloorLavaTex)) {
if (ResourceMgr_TexIsRaw(gDodongosCavernBossLavaFloorTex)) {
u32* lavaTex = ResourceGetDataByName(sLavaFloorLavaTex);
size_t lavaSize = ResourceGetSizeByName(sLavaFloorLavaTex);
size_t floorSize = ResourceGetSizeByName(gDodongosCavernBossLavaFloorTex);
Expand All @@ -126,14 +130,13 @@ void BossDodongo_RegisterBlendedLavaTextureUpdate() {
// Register the blended effect for the raw texture
Gfx_RegisterBlendedTexture(gDodongosCavernBossLavaFloorTex, sMaskTexLava, sLavaWavyTexRaw);
} else {
u16* lavaTex = ResourceGetDataByName(sLavaFloorLavaTex);
memcpy(sLavaFloorModifiedTex, lavaTex, sizeof(sLavaFloorModifiedTex));

// When KD is dead, just immediately copy the rock texture
if (Flags_GetClear(gPlayState, gPlayState->roomCtx.curRoom.num)) {
u16* rockTex = ResourceGetDataByName(sLavaFloorRockTex);
size_t rockSize = ResourceGetSizeByName(sLavaFloorRockTex);
memcpy(sLavaFloorModifiedTex, rockTex, rockSize);
memcpy(sLavaFloorModifiedTex, rockTex, sizeof(sLavaFloorModifiedTex));
} else {
u16* lavaTex = ResourceGetDataByName(sLavaFloorLavaTex);
memcpy(sLavaFloorModifiedTex, lavaTex, sizeof(sLavaFloorModifiedTex));
}

// Register the blended effect for the non-raw texture
Expand Down Expand Up @@ -182,7 +185,7 @@ void func_808C1554_Raw(void* arg0, void* floorTex, s32 arg2, f32 arg3) {
// Applying sqrt(multiplier) to arg3 is to control how many pixels move left/right for the selected row
// Applying to arg2 and M_PI help to space out the wave effect
// It's not perfect but close enough
u16 multiplier = width / 32;
u16 multiplier = width / LAVA_TEX_WIDTH;

for (i = 0; i < size; i += width) {
temp = sinf((((i / width) + (s32)(((arg2 * multiplier) * 50.0f) / 100.0f)) & (width - 1)) * (M_PI / (16 * multiplier))) * (arg3 * sqrt(multiplier));
Expand Down Expand Up @@ -1165,14 +1168,14 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) {
s16 i2;

// Get the scale based on the original texture size
u16 widthScale = width / 32;
u16 heightScale = height / 64;
u16 widthScale = width / LAVA_TEX_WIDTH;
u16 heightScale = height / LAVA_TEX_HEIGHT;
u32 size = width * height;

for (i2 = 0; i2 < 20; i2++) {
s16 new_var = this->unk_1C2 & 0x7FF;
s16 new_var = this->unk_1C2 & (LAVA_TEX_SIZE - 1);
// Compute the index to a scaled position (scaling pseudo x,y as a 1D value)
s32 indexStart = ((new_var % 32) * widthScale) + ((new_var / 32) * width * heightScale);
s32 indexStart = ((new_var % LAVA_TEX_WIDTH) * widthScale) + ((new_var / LAVA_TEX_WIDTH) * width * heightScale);

// From the starting index, apply extra pixels right/down based on the scale
for (size_t j = 0; j < heightScale; j++) {
Expand Down