Fix powder keg crash by creating and using a larger texture. (#170)

This commit is contained in:
louist103
2024-05-22 09:05:01 -05:00
committed by Garrett Cox
parent c93ccc387f
commit 3e0771e566
4 changed files with 29 additions and 4 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

@@ -3,6 +3,9 @@
#include "align_asset_macro.h"
#define dgPowderKegFuseVtx "__OTR__overlays/ovl_En_Bom/gPowderKegFuseVtx"
static const ALIGN_ASSET(2) char gPowderKegFuseVtx[] = dgPowderKegFuseVtx;
#define dgPowderKegFuseTex "__OTR__overlays/ovl_En_Bom/gPowderKegFuseTex"
static const ALIGN_ASSET(2) char gPowderKegFuseTex[] = dgPowderKegFuseTex;
+3
View File
@@ -2,6 +2,9 @@
<!-- Assets for the Powder Keg -->
<File Name="ovl_En_Bom" BaseAddress="0x80870DB0" RangeStart="0x2160" RangeEnd="0x3610">
<!-- Texture and DisplayLists for the Powder Keg's fuse -->
<Array Name="gPowderKegFuseVtx" Count="8" Offset="0x2160">
<Vtx/>
</Array>
<Texture Name="gPowderKegFuseTex" OutName="powder_keg_fuse" Format="i8" Width="2" Height="2" Offset="0x21E0"/>
<DList Name="gPowderKegFuseMaterialDL" Offset="0x21E8"/>
<DList Name="gPowderKegFuseModel1DL" Offset="0x2270"/>
+23 -4
View File
@@ -787,7 +787,12 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a
Math_Vec3f_Copy(arg1, &fuseSegmentPtr->pos);
}
void EnBom_DrawKeg(PlayState* play, s32 arg1) {
// 2S2H [Port] See comment in the draw function.
#define dgPowderKegFuseTexLarger "__OTR__overlays/ovl_En_Bom/gPowderKegFuseTexLarger"
static const ALIGN_ASSET(2) char gPowderKegFuseTexLarger[] = dgPowderKegFuseTexLarger;
void EnBom_DrawKeg(PlayState* play, s32 timer) {
s32 temp_s5;
s32 i;
PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0];
@@ -800,9 +805,23 @@ void EnBom_DrawKeg(PlayState* play, s32 arg1) {
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseMaterialDL);
temp_s5 = (arg1 / 240) + 1;
// 2S2H [Port] This was originally a static DL in the OTR file. The normal texture is too small to be rendered by Fast3D
// and causes a crash.
// This adds a custom texture in the OTR file and changes the DList to use the new size. At some point this should be
// done in the GFX patcher.
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_NONE);
gSPClearGeometryMode(POLY_OPA_DISP++, G_CULL_BOTH);
gSPSetGeometryMode(POLY_OPA_DISP++, G_LIGHTING);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIDECALA, G_CC_MODULATEI_PRIM2);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
gSPTexture(POLY_OPA_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gDPLoadTextureBlock(POLY_OPA_DISP++, gPowderKegFuseTexLarger, G_IM_FMT_I, G_IM_SIZ_8b, 8, 8, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 1, 1, G_TX_NOLOD, G_TX_NOLOD);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 200, 0, 255);
gSPVertex(POLY_OPA_DISP++, gPowderKegFuseVtx, 4, 0);
temp_s5 = (timer / 240) + 1;
fuseSegmentPtr2 = &sPowderKegFuseSegments[1];
for (i = 1; i < temp_s5; i++, fuseSegmentPtr2++) {