EnMag OK and documented (#547)

* Name textures in object_mag

* Corrections

* tabs -> spaces

* OK, data imported

* Remove obsolete comment

* Start documentation

* Defines for most texture sizes

* Name most static variables, add state enum

* Macros, name all the statics

* Couple of minor tweaks to other files

* Name some more effect stuff

* Fix kanfont data

* Name everything else, move macros

* Format

* Review
This commit is contained in:
EllipticEllipsis
2022-01-16 17:55:03 +00:00
committed by GitHub
parent b47941968d
commit 924fa9aadf
12 changed files with 1045 additions and 67 deletions
+14 -12
View File
@@ -5,18 +5,20 @@
<Texture Name="gTitleScreenMajorasMaskSubtitleMaskTex" OutName="title_screen_majoras_mask_subtitle_mask" Format="i8" Width="104" Height="16" Offset="0x9680"/><!-- Masking the flame effect -->
<Texture Name="gTitleScreenTheLegendOfTextTex" OutName="title_screen_the_legend_of_text" Format="i8" Width="72" Height="8" Offset="0x9D00"/>
<Texture Name="gTitleScreenMaskGlowDim00Tex" OutName="title_screen_mask_glow_dim_0_0" Format="i4" Width="64" Height="64" Offset="0x9F40"/>
<Texture Name="gTitleScreenMaskGlowDim01Tex" OutName="title_screen_mask_glow_dim_0_1" Format="i4" Width="64" Height="64" Offset="0xA740"/>
<Texture Name="gTitleScreenMaskGlowDim10Tex" OutName="title_screen_mask_glow_dim_1_0" Format="i4" Width="64" Height="64" Offset="0xAF40"/>
<Texture Name="gTitleScreenMaskGlowDim11Tex" OutName="title_screen_mask_glow_dim_1_1" Format="i4" Width="64" Height="64" Offset="0xB740"/>
<Texture Name="gTitleScreenZeldaGlow0Tex" OutName="title_screen_zelda_glow_0" Format="i4" Width="64" Height="64" Offset="0xBF40"/>
<Texture Name="gTitleScreenZeldaGlow1Tex" OutName="title_screen_zelda_glow_1" Format="i4" Width="64" Height="64" Offset="0xC740"/>
<Texture Name="gTitleScreenMaskGlowBright00Tex" OutName="title_screen_mask_glow_bright_0_0" Format="i4" Width="64" Height="64" Offset="0xCF40"/>
<Texture Name="gTitleScreenMaskGlowBright01Tex" OutName="title_screen_mask_glow_bright_0_1" Format="i4" Width="64" Height="64" Offset="0xD740"/>
<Texture Name="gTitleScreenMaskGlowBright10Tex" OutName="title_screen_mask_glow_bright_1_0" Format="i4" Width="64" Height="64" Offset="0xDF40"/>
<Texture Name="gTitleScreenMaskGlowBright11Tex" OutName="title_screen_mask_glow_bright_1_1" Format="i4" Width="64" Height="64" Offset="0xE740"/>
<Texture Name="gTitleScreenGlowRight0Tex" OutName="title_screen_glow_right_0" Format="i4" Width="64" Height="64" Offset="0xEF40"/>
<Texture Name="gTitleScreenGlowRight1Tex" OutName="title_screen_glow_right_1" Format="i4" Width="64" Height="64" Offset="0xF740"/>
<Texture Name="gTitleScreenDisplayEffectMask00Tex" OutName="title_screen_display_effect_mask_0_0" Format="i4" Width="64" Height="64" Offset="0x9F40"/>
<Texture Name="gTitleScreenDisplayEffectMask01Tex" OutName="title_screen_display_effect_mask_0_1" Format="i4" Width="64" Height="64" Offset="0xA740"/>
<Texture Name="gTitleScreenDisplayEffectMask10Tex" OutName="title_screen_display_effect_mask_1_0" Format="i4" Width="64" Height="64" Offset="0xAF40"/>
<Texture Name="gTitleScreenDisplayEffectMask11Tex" OutName="title_screen_display_effect_mask_1_1" Format="i4" Width="64" Height="64" Offset="0xB740"/>
<Texture Name="gTitleScreenDisplayEffectMask02Tex" OutName="title_screen_display_effect_mask_0_2" Format="i4" Width="64" Height="64" Offset="0xBF40"/>
<Texture Name="gTitleScreenDisplayEffectMask12Tex" OutName="title_screen_display_effect_mask_1_2" Format="i4" Width="64" Height="64" Offset="0xC740"/>
<Texture Name="gTitleScreenAppearEffectMask00Tex" OutName="title_screen_appear_effect_mask_0_0" Format="i4" Width="64" Height="64" Offset="0xCF40"/>
<Texture Name="gTitleScreenAppearEffectMask01Tex" OutName="title_screen_appear_effect_mask_0_1" Format="i4" Width="64" Height="64" Offset="0xD740"/>
<Texture Name="gTitleScreenAppearEffectMask10Tex" OutName="title_screen_appear_effect_mask_1_0" Format="i4" Width="64" Height="64" Offset="0xDF40"/>
<Texture Name="gTitleScreenAppearEffectMask11Tex" OutName="title_screen_appear_effect_mask_1_1" Format="i4" Width="64" Height="64" Offset="0xE740"/>
<Texture Name="gTitleScreenAppearEffectMask02Tex" OutName="title_screen_appear_effect_mask_0_2" Format="i4" Width="64" Height="64" Offset="0xEF40"/>
<Texture Name="gTitleScreenAppearEffectMask12Tex" OutName="title_screen_appear_effect_mask_1_2" Format="i4" Width="64" Height="64" Offset="0xF740"/>
<Texture Name="gTitleScreenFlame0Tex" OutName="title_screen_flame_0" Format="i8" Width="32" Height="32" Offset="0xFF40"/>
<Texture Name="gTitleScreenFlame1Tex" OutName="title_screen_flame_1" Format="i8" Width="32" Height="32" Offset="0x10340"/>
<Texture Name="gTitleScreenFlame2Tex" OutName="title_screen_flame_2" Format="i8" Width="32" Height="32" Offset="0x10740"/>
+1 -1
View File
@@ -3768,7 +3768,7 @@ void func_801A3CD8(s8 param_1);
// void func_801A3D98(void);
// void func_801A3E38(void);
// void func_801A3EC0(void);
void func_801A3F54(s32 arg0);
void func_801A3F54(u8 flag);
// void func_801A3F6C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_801A3FB4(void);
// void func_801A3FFC(UNK_TYPE1 param_1);
+15
View File
@@ -127,6 +127,21 @@ extern GraphicsContext* __gfxCtx;
#define GRAPH_ALLOC(gfxCtx, size) ((void*)((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - (size))))
// Custom gbi macro
#define gDPSetTileCustom(pkt, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
{ \
gDPPipeSync(pkt); \
gDPTileSync(pkt); \
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, \
masks, shifts); \
gDPTileSync(pkt); \
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, \
cms, masks, shifts); \
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \
((height)-1) << G_TEXTURE_IMAGE_FRAC); \
} \
(void)0
#define ALIGN8(val) (((val) + 7) & ~7)
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
+3 -1
View File
@@ -167,8 +167,10 @@ typedef struct {
/* 0x5 */ Color_RGB8 envColor;
} FireObjLightParams; // size = 0x8
#define FONT_CHAR_TEX_WIDTH 16
#define FONT_CHAR_TEX_HEIGHT 16
//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)`
#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2)
#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture
// Font textures are loaded into here
typedef struct {
+1 -2
View File
@@ -1754,8 +1754,7 @@ beginseg
name "ovl_En_Mag"
compress
include "build/src/overlays/actors/ovl_En_Mag/z_en_mag.o"
include "build/data/ovl_En_Mag/ovl_En_Mag.data.o"
include "build/data/ovl_En_Mag/ovl_En_Mag.reloc.o"
include "build/src/overlays/actors/ovl_En_Mag/ovl_En_Mag_reloc.o"
endseg
beginseg
+1 -1
View File
@@ -34,7 +34,7 @@ f32 func_80179400(s32 n) {
//! @bug No check for negative argument. Will read the array out-of-bounds if the argument is negative.
//! (The OoT version does an unsigned check instead, which will return sFactorialTbl[12] for a negative argument.)
if (n > 12) {
if (n >= ARRAY_COUNT(sFactorialTbl)) {
ret = sFactorialTbl[12];
for (i = 13; i <= n; i++) {
ret *= i;
+8 -6
View File
@@ -19,11 +19,13 @@ void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
FONT_CHAR_TEX_SIZE);
}
static u8 sFontOrdering[] = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
"!\"#$%&\'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"\x00\x0D\x0E\x1A"
"afjmosvwxyz{|}~"
"\x7F\x80\x81\x84\x86\x87\x88\x89\x8A\x8B\x8C";
static u8 sFontOrdering[] = {
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x41, 0x42,
0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
0x56, 0x57, 0x58, 0x59, 0x5A, 0x00, 0x0D, 0x0E, 0x1A, 0x61, 0x66, 0x6A, 0x6D, 0x6F, 0x73, 0x76, 0x77, 0x78, 0x79,
0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x84, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C,
};
void Font_LoadOrderedFont(Font* font) {
u32 loadOffset;
@@ -36,7 +38,7 @@ void Font_LoadOrderedFont(Font* font) {
if (sFontOrdering[codePointIndex] == 0) {
loadOffset = 0;
}
// UB to convert pointer to u32
DmaMgr_SendRequest0(writeLocation, (uintptr_t)SEGMENT_ROM_START(nes_font_static) + loadOffset,
FONT_CHAR_TEX_SIZE);
if (sFontOrdering[codePointIndex] == 0x8C) {
File diff suppressed because it is too large Load Diff
+39 -1
View File
@@ -7,7 +7,45 @@ struct EnMag;
typedef struct EnMag {
/* 0x00000 */ Actor actor;
/* 0x00144 */ char unk_00144[0x11E34];
/* 0x00144 */ UNK_TYPE1 unk144[0x2C];
/* 0x00170 */ Font font;
/* 0x11EFC */ UNK_TYPE1 unk11EFC[4];
/* 0x11F00 */ s16 unk11F00; // Set and not used.
/* 0x11F02 */ s16 unk11F02; // Set and not used.
/* 0x11F04 */ s16 state; // State of whole actor, uses EnMagState enum
/* 0x11F06 */ s16 appearEffectPrimLodFrac;
/* 0x11F08 */ s16 appearEffectPrimColor[3];
/* 0x11F08 */ s16 appearEffectEnvColor[3];
/* 0x11F14 */ s16 appearEffectAlpha;
/* 0x11F16 */ s16 displayEffectPrimLodFrac;
/* 0x11F18 */ s16 displayEffectPrimColor[3];
/* 0x11F18 */ s16 displayEffectEnvColor[3];
/* 0x11F24 */ s16 displayEffectAlpha;
/* 0x11F26 */ s16 majorasMaskAlpha;
/* 0x11F28 */ s16 majorasMaskEnvColor[3];
/* 0x11F2E */ s16 mainTitleAlpha;
/* 0x11F30 */ s16 subtitleAlpha;
/* 0x11F32 */ s16 unk11F32; // Set but not used, likely a spare alpha.
/* 0x11F34 */ s16 copyrightAlpha;
/* 0x11F36 */ s16 effectScrollSs[6];
/* 0x11F42 */ UNK_TYPE1 unk11F42[2];
/* 0x11F44 */ s16 effectScrollTs[6];
/* 0x11F50 */ UNK_TYPE1 unk11F50[4];
/* 0x11F54 */ s16 unk11F54; // Set but not used.
/* 0x11F56 */ s16 unk11F56; // Set but not used.
/* 0x11F58 */ s16 unk11F58; // Set but not used.
/* 0x11F5A */ s16 unk11F5A; // Set but not used.
/* 0x11F5C */ s32 unk11F5C; // Set but not used.
/* 0x11F60 */ s32 unk11F60; // Set but not used.
/* 0x11F64 */ s16 majorasMaskEffectsFadeInTimer;
/* 0x11F66 */ s16 majorasMaskFadeInTimer;
/* 0x11F68 */ s16 mainTitleAlphaFadeInTimer;
/* 0x11F6A */ s16 effectAlphaFadeInTimer;
/* 0x11F6C */ s16 subtitleFadeInTimer;
/* 0x11F6E */ s16 copyrightFadeInTimer;
/* 0x11F70 */ s16 fadeOutTimer;
/* 0x11F72 */ s16 delayTimer; // Delays start of next action in Update.
/* 0x11F74 */ UNK_TYPE1 unk11F74[4];
} EnMag; // size = 0x11F78
extern const ActorInit En_Mag_InitVars;
+2 -1
View File
@@ -105,7 +105,8 @@ void Title_Draw(GameState* thisx) {
G_TX_NOLOD, G_TX_NOLOD);
gDPSetTileSize(POLY_OPA_DISP++, 1, this->uls, (this->ult & 0x7F) - idx * 4, 0, 0);
gSPTextureRectangle(POLY_OPA_DISP++, 388, y << 2, 1156, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(POLY_OPA_DISP++, 97 << 2, y << 2, (97 + 192) << 2, (y + 2) << 2, G_TX_RENDERTILE, 0, 0,
1 << 10, 1 << 10);
}
func_800FC444(this->gameState.gfxCtx, 0, 0, 0, this->coverAlpha, 2);
+7 -7
View File
@@ -7992,14 +7992,14 @@
0x8096B260:("EnOkarinaEffect_Update",),
0x8096B310:("EnMag_Init",),
0x8096B5F4:("EnMag_Destroy",),
0x8096B604:("func_8096B604",),
0x8096B604:("EnMag_UpdateDisplayEffectColors",),
0x8096B94C:("EnMag_Update",),
0x8096C998:("func_8096C998",),
0x8096CBB0:("func_8096CBB0",),
0x8096CDC8:("func_8096CDC8",),
0x8096D230:("func_8096D230",),
0x8096D60C:("func_8096D60C",),
0x8096D74C:("func_8096D74C",),
0x8096C998:("EnMag_DrawTextureI8",),
0x8096CBB0:("EnMag_DrawTextureIA8",),
0x8096CDC8:("EnMag_DrawEffectTextures",),
0x8096D230:("EnMag_DrawImageRGBA32",),
0x8096D60C:("EnMag_DrawCharTexture",),
0x8096D74C:("EnMag_DrawInner",),
0x8096E868:("EnMag_Draw",),
0x8096EC40:("ElfMsg2_SetupAction",),
0x8096EC4C:("func_8096EC4C",),
+21 -21
View File
@@ -8997,28 +8997,28 @@
0x8096AD3C:("jtbl_8096AD3C","UNK_PTR","",0x4),
0x8096B290:("En_Okarina_Effect_InitVars","UNK_TYPE1","",0x1),
0x8096B2B0:("D_8096B2B0","f32","",0x4),
0x8096E910:("D_8096E910","UNK_TYPE2","",0x2),
0x8096E914:("D_8096E914","UNK_TYPE2","",0x2),
0x8096E918:("D_8096E918","UNK_TYPE2","",0x2),
0x8096E91C:("D_8096E91C","UNK_TYPE2","",0x2),
0x8096E920:("D_8096E920","UNK_TYPE2","",0x2),
0x8096E910:("sInputDelayTimer","s16","",0x2),
0x8096E914:("sZeldaEffectColorTimer","s16","",0x2),
0x8096E918:("sZeldaEffectColorTargetIndex","s16","",0x2),
0x8096E91C:("sTextAlphaTargetIndex","s16","",0x2),
0x8096E920:("sTextAlphaTimer","s16","",0x2),
0x8096E924:("En_Mag_InitVars","UNK_TYPE1","",0x1),
0x8096E944:("D_8096E944","UNK_TYPE1","",0x1),
0x8096E948:("D_8096E948","UNK_TYPE1","",0x1),
0x8096E94C:("D_8096E94C","UNK_TYPE1","",0x1),
0x8096E950:("D_8096E950","UNK_TYPE1","",0x1),
0x8096E954:("D_8096E954","UNK_TYPE1","",0x1),
0x8096E958:("D_8096E958","UNK_TYPE2","",0x2),
0x8096E95C:("D_8096E95C","UNK_TYPE2","",0x2),
0x8096E960:("D_8096E960","UNK_TYPE2","",0x2),
0x8096E964:("D_8096E964","UNK_TYPE1","",0x1),
0x8096E970:("D_8096E970","UNK_TYPE4","",0x4),
0x8096E988:("D_8096E988","UNK_TYPE4","",0x4),
0x8096E9A0:("D_8096E9A0","UNK_TYPE4","",0x4),
0x8096E9B8:("D_8096E9B8","UNK_TYPE2","",0x2),
0x8096E9C4:("D_8096E9C4","UNK_TYPE2","",0x2),
0x8096E9D0:("D_8096E9D0","UNK_TYPE2","",0x2),
0x8096E9D4:("D_8096E9D4","UNK_TYPE1","",0x1),
0x8096E944:("sDisplayEffectPrimRedTargets","s16","[2]",0x4),
0x8096E948:("sDisplayEffectPrimGreenTargets","s16","[2]",0x4),
0x8096E94C:("sDisplayEffectPrimBlueTargets","s16","[2]",0x4),
0x8096E950:("sDisplayEffectEnvRedTargets","s16","[2]",0x4),
0x8096E954:("sDisplayEffectEnvBlueTargets","s16","[2]",0x4),
0x8096E958:("sAppearEffectPrimGreenTargets","s16","[2]",0x4),
0x8096E95C:("sAppearEffectEnvRedTargets","s16","[2]",0x4),
0x8096E960:("sAppearEffectEnvBlueTargets","s16","[2]",0x4),
0x8096E964:("pressStartFontIndices","u8","[10]",0x1),
0x8096E970:("sAppearEffectMaskTextures","TexturePtr","[6]",0x18),
0x8096E988:("sDisplayEffectMaskTextures","TexturePtr","[6]",0x18),
0x8096E9A0:("sEffectTextures","TexturePtr","[6]",0x18),
0x8096E9B8:("sEffectScrollVelocitySs","s16","[6]",0xC),
0x8096E9C4:("sEffectScrollVelocityTs","s16","[6]",0xC),
0x8096E9D0:("sTextAlpha","s16","",0x2),
0x8096E9D4:("sTextAlphaTargets","s16","[2]",0x4),
0x8096E9E0:("jtbl_8096E9E0","UNK_PTR","",0x4),
0x8096F090:("Elf_Msg2_InitVars","UNK_TYPE1","",0x1),
0x8096F0B0:("D_8096F0B0","UNK_TYPE1","",0x1),