Skip to content

Commit 1d275fa

Browse files
authored
[ntsc-1.2] Partially match z_en_mag (zeldaret#2079)
* Partially match z_en_mag * review * Match func_80AEEA48_unknown (thanks cadmic)
1 parent 7c2e038 commit 1d275fa

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

src/overlays/actors/ovl_En_Mag/z_en_mag.c

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
#include "z_en_mag.h"
88
#include "assets/objects/object_mag/object_mag.h"
9+
#if PLATFORM_N64
10+
#include "n64dd.h"
11+
#endif
912
#include "versions.h"
1013

1114
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
@@ -255,8 +258,13 @@ void EnMag_Update(Actor* thisx, PlayState* play) {
255258

256259
if (this->globalState == MAG_STATE_FADE_IN) {
257260
if (this->effectFadeInState == 0) {
261+
#if PLATFORM_N64
262+
this->effectPrimLodFrac += 0.8f;
263+
this->effectAlpha += 6.375f;
264+
#else
258265
this->effectAlpha += 6.375f;
259266
this->effectPrimLodFrac += 0.8f;
267+
#endif
260268

261269
this->effectPrimColor[0] += 6.375f;
262270
this->effectPrimColor[1] += 3.875f;
@@ -280,15 +288,19 @@ void EnMag_Update(Actor* thisx, PlayState* play) {
280288
this->effectFadeInState = 1;
281289
}
282290
} else if (this->effectFadeInState == 1) {
291+
#if PLATFORM_N64
292+
this->effectPrimLodFrac += 2.4f;
293+
#endif
283294
#if !OOT_MQ
284295
this->effectPrimColor[2] += -2.125f;
285296
this->effectEnvColor[1] += -3.875f;
286297
#else
287298
this->effectPrimColor[0] += -2.125f;
288299
this->effectEnvColor[0] += -1.375f;
289300
#endif
290-
301+
#if !PLATFORM_N64
291302
this->effectPrimLodFrac += 2.4f;
303+
#endif
292304

293305
this->effectFadeInTimer--;
294306

@@ -459,6 +471,35 @@ void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32
459471
*gfxP = gfx;
460472
}
461473

474+
#if PLATFORM_N64
475+
// TODO n64dd functions
476+
s32 func_801C79BC_unknown(void);
477+
478+
void func_80AEEA48_unknown(Gfx** gfxP, s16 arg1, s16 arg2, u32 arg3) {
479+
if ((B_80121AE2 != 0) && (func_801C79BC_unknown() != 0)) {
480+
Gfx* gfx = *gfxP;
481+
s32 temp_a3 = (arg1 + 0x40) << 2;
482+
s32 temp_t0 = (arg2 + 5) << 2;
483+
484+
gDPPipeSync(gfx++);
485+
gDPSetCycleType(gfx++, G_CYC_1CYCLE);
486+
gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
487+
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
488+
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
489+
gDPSetPrimColor(gfx++, 0x00, 0x00, 255, 255, 255, arg3);
490+
gDPSetEnvColor(gfx++, 48, 36, 146, 255);
491+
gDPLoadTextureBlock(gfx++, gTitleDiskTex, G_IM_FMT_IA, G_IM_SIZ_8b, 48, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
492+
G_TX_NOMIRROR | G_TX_WRAP, 0, 0, 0, 0);
493+
gSPTextureRectangle(gfx++, temp_a3, temp_t0, temp_a3 + (48 << 2), temp_t0 + (16 << 2), G_TX_RENDERTILE, 0, 0,
494+
(1 << 10), (1 << 10));
495+
gDPPipeSync(gfx++);
496+
gDPSetCycleType(gfx++, G_CYC_2CYCLE);
497+
498+
*gfxP = gfx;
499+
}
500+
}
501+
#endif
502+
462503
void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) {
463504
Gfx* gfx = *gfxP;
464505

@@ -540,6 +581,9 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
540581

541582
if ((s16)this->mainAlpha != 0) {
542583
EnMag_DrawImageRGBA32(&gfx, 160 + LOGO_X_SHIFT, 100, (u8*)gTitleZeldaShieldLogoTex, 160, 160);
584+
#if PLATFORM_N64
585+
func_80AEEA48_unknown(&gfx, 160, 100, (u32)this->mainAlpha);
586+
#endif
543587
}
544588

545589
Gfx_SetupDL_39Ptr(&gfx);
@@ -641,7 +685,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
641685

642686
if ((s16)this->copyrightAlpha != 0) {
643687
#if PLATFORM_N64
644-
gDPLoadTextureBlock(gfx++, gTitleCopyright1998Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 16, 0,
688+
gDPLoadTextureBlock(gfx++, gTitleCopyright1998Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 128, 16, 0,
645689
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
646690
G_TX_NOLOD, G_TX_NOLOD);
647691
#elif OOT_VERSION < OOT_GC_US
@@ -664,7 +708,11 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
664708
G_TX_NOLOD, G_TX_NOLOD);
665709
#endif
666710

711+
#if PLATFORM_N64
712+
gSPTextureRectangle(gfx++, 94 << 2, 198 << 2, 222 << 2, 214 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
713+
#else
667714
gSPTextureRectangle(gfx++, 78 << 2, 198 << 2, 238 << 2, 214 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
715+
#endif
668716
}
669717

670718
if (gSaveContext.fileNum == 0xFEDC) {

undefined_syms.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ func_801C8510_unknown = 0x801C8510;
3131
D_801DA410 = 0x801DA410;
3232
D_801E8090 = 0x801E8090;
3333

34+
// z_en_mag.c
35+
func_801C79BC_unknown = 0x801C79BC;
36+
3437
// z_setup.c
3538
n64dd_SetDiskVersion = 0x801C8808;
3639

0 commit comments

Comments
 (0)