Shipwright/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c

1027 lines
35 KiB
C
Raw Normal View History

/*
* File: z_en_mag.c
* Overlay: ovl_En_Mag
* Description: Title Screen Manager & Logo
*/
#include "z_en_mag.h"
#include "objects/object_mag/object_mag.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void EnMag_Init(Actor* thisx, PlayState* play);
void EnMag_InitMq(Actor* thisx, PlayState* play);
void EnMag_InitVanilla(Actor* thisx, PlayState* play);
void EnMag_Destroy(Actor* thisx, PlayState* play);
void EnMag_UpdateMq(Actor* thisx, PlayState* play);
void EnMag_UpdateVanilla(Actor* thisx, PlayState* play);
void EnMag_Draw(Actor* thisx, PlayState* play);
void EnMag_DrawInnerVanilla(Actor* thisx, PlayState* play, Gfx** gfxp);
void EnMag_DrawInnerMq(Actor* thisx, PlayState* play, Gfx** gfxp);
typedef void (*EnMagDrawInnerFunc)(struct Actor*, PlayState*, Gfx**);
static EnMagDrawInnerFunc drawInnerFunc;
const ActorInit En_Mag_InitVars = {
ACTOR_EN_MAG,
ACTORCAT_PROP,
FLAGS,
OBJECT_MAG,
sizeof(EnMag),
(ActorFunc)EnMag_Init,
(ActorFunc)EnMag_Destroy,
(ActorFunc)NULL,
(ActorFunc)EnMag_Draw,
NULL,
};
const char* noControllerMsg[] = {
"NO CONTROLLER",
"CONTROLLER FEHLT",
"MANETTE DEBRANCHEE",
};
const char* pressStartMsg[] = {
"PRESS START",
"DRUCKE START",
"APPUYEZ SUR START",
};
void EnMag_Init(Actor* thisx, PlayState* play) {
if (ResourceMgr_IsGameMasterQuest()) {
EnMag_InitMq(thisx, play);
drawInnerFunc = EnMag_DrawInnerMq;
thisx->update = EnMag_UpdateMq;
} else {
EnMag_InitVanilla(thisx, play);
thisx->update = EnMag_UpdateVanilla;
drawInnerFunc = EnMag_DrawInnerVanilla;
}
}
static s16 sDelayTimer = 0;
void EnMag_InitMq(Actor* thisx, PlayState* play) {
EnMag* this = (EnMag*)thisx;
YREG(1) = 63;
YREG(3) = 80;
YREG(4) = 255;
YREG(5) = 30;
YREG(6) = 30;
YREG(7) = 119;
YREG(8) = 7;
YREG(9) = 5;
YREG(10) = 3;
VREG(4) = 1;
VREG(5) = 6;
VREG(6) = 2;
this->copyrightAlphaStep = 6;
this->fadeOutAlphaStep = 10;
VREG(19) = 99;
VREG(21) = 9;
VREG(23) = 10;
VREG(24) = 8;
this->effectScroll = 0;
this->unk_E30C = 0;
this->effectPrimColor[0] = 0.0f;
this->effectPrimColor[1] = 100.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[0] = 0.0f;
this->effectEnvColor[1] = 100.0f;
this->effectEnvColor[2] = 0.0f;
this->effectFadeInTimer = 40;
this->effectFadeInState = this->effectPrimLodFrac = this->globalState = this->effectAlpha = this->mainAlpha =
this->subAlpha = this->copyrightAlpha = 0.0f;
if (gSaveContext.unk_13E7 != 0) {
this->mainAlpha = 210;
this->subAlpha = 255;
this->copyrightAlpha = 255;
this->effectPrimLodFrac = 128.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 170;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 255.0f;
this->effectEnvColor[0] = 200.0f;
this->effectEnvColor[1] = 255.0f;
this->effectEnvColor[2] = 0;
gSaveContext.unk_13E7 = 0;
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
gSaveContext.transFadeDuration = 1;
gSaveContext.transWipeSpeed = 255;
}
Font_LoadOrderedFont(&this->font);
this->unk_E316 = 0;
this->unk_E318 = 0;
this->unk_E31C = 0;
this->unk_E320 = 0;
}
void EnMag_InitVanilla(Actor* thisx, PlayState* play) {
EnMag* this = (EnMag*)thisx;
YREG(1) = 63;
YREG(3) = 80;
YREG(4) = 255;
YREG(5) = 30;
YREG(6) = 30;
YREG(7) = 119;
YREG(8) = 7;
YREG(9) = 5;
YREG(10) = 3;
VREG(4) = 1;
VREG(5) = 6;
VREG(6) = 2;
this->copyrightAlphaStep = 6;
this->fadeOutAlphaStep = 10;
VREG(19) = 99;
VREG(21) = 9;
VREG(23) = 10;
VREG(24) = 8;
this->effectScroll = 0;
this->unk_E30C = 0;
this->effectPrimColor[0] = 0.0f;
this->effectPrimColor[1] = 100.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[0] = 0.0f;
this->effectEnvColor[1] = 100.0f;
this->effectEnvColor[2] = 0.0f;
this->effectFadeInTimer = 40;
this->effectFadeInState = this->effectPrimLodFrac = this->globalState = this->effectAlpha = this->mainAlpha =
this->subAlpha = this->copyrightAlpha = 0.0f;
if (gSaveContext.unk_13E7 != 0) {
this->mainAlpha = 210;
this->subAlpha = 255;
this->copyrightAlpha = 255;
this->effectPrimLodFrac = 128.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 100.0f;
this->effectEnvColor[2] = 0.0f;
gSaveContext.unk_13E7 = 0;
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
gSaveContext.transFadeDuration = 1;
gSaveContext.transWipeSpeed = 255;
}
Font_LoadOrderedFont(&this->font);
this->unk_E316 = 0;
this->unk_E318 = 0;
this->unk_E31C = 0;
this->unk_E320 = 0;
}
void EnMag_Destroy(Actor* thisx, PlayState* play) {
}
void EnMag_UpdateMq(Actor* thisx, PlayState* play) {
s32 pad[2];
EnMag* this = (EnMag*)thisx;
if (gSaveContext.fileNum != 0xFEDC) {
if (this->globalState < MAG_STATE_DISPLAY) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->mainAlpha = 210;
this->subAlpha = 255;
this->copyrightAlpha = 255;
this->effectPrimLodFrac = 128.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 170;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 255.0f;
this->effectEnvColor[0] = 200.0f;
this->effectEnvColor[1] = 255.0f;
this->effectEnvColor[2] = 0;
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
gSaveContext.transFadeDuration = 1;
gSaveContext.transWipeSpeed = 255;
}
} else if (this->globalState >= MAG_STATE_DISPLAY) {
if (sDelayTimer == 0) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) {
if (play->sceneLoadFlag != 20) {
Audio_SetCutsceneFlag(0);
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
gSaveContext.gameMode = 2;
play->sceneLoadFlag = 20;
play->fadeTransition = 2;
}
this->copyrightAlphaStep = 15;
this->fadeOutAlphaStep = 25;
this->globalState = MAG_STATE_FADE_OUT;
}
} else {
sDelayTimer--;
}
}
}
if (this->globalState == MAG_STATE_FADE_IN) {
if (this->effectFadeInState == 0) {
this->effectAlpha += 6.375f;
this->effectPrimLodFrac += 0.8f;
this->effectPrimColor[0] += 6.375f;
this->effectPrimColor[1] += 3.875f;
this->effectPrimColor[2] += 2.125f;
this->effectEnvColor[0] += 6.375f;
this->effectEnvColor[1] += 3.875f;
this->effectFadeInTimer--;
if (this->effectFadeInTimer == 0) {
this->effectPrimLodFrac = 32.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 255.0f;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 255.0f;
this->effectFadeInTimer = 40;
this->effectFadeInState = 1;
}
} else if (this->effectFadeInState == 1) {
this->effectPrimColor[0] += -2.125f;
this->effectEnvColor[0] += -1.375f;
this->effectPrimLodFrac += 2.4f;
this->effectFadeInTimer--;
if (this->effectFadeInTimer == 0) {
this->effectPrimLodFrac = 128.0f;
this->effectPrimColor[0] = 170.0f;
this->effectEnvColor[0] = 200.0f;
this->effectFadeInTimer = 32;
this->effectFadeInState = 2;
}
}
if (this->effectAlpha > 160) {
this->mainAlpha += VREG(5);
if (this->mainAlpha >= 210.0f) {
this->mainAlpha = 210.0f;
}
if (this->mainAlpha >= 210) {
this->subAlpha += VREG(6);
if (this->subAlpha >= 255.0f) {
this->subAlpha = 255.0f;
}
if (this->subAlpha >= 200) {
this->copyrightAlpha += this->copyrightAlphaStep;
if (this->copyrightAlpha >= 255.0f) {
this->copyrightAlpha = 255.0f;
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
}
}
}
}
} else if (this->globalState == MAG_STATE_FADE_OUT) {
this->effectAlpha -= this->fadeOutAlphaStep;
if (this->effectAlpha < 0.0f) {
this->effectAlpha = 0.0f;
}
this->mainAlpha -= this->fadeOutAlphaStep;
if (this->mainAlpha < 0.0f) {
this->mainAlpha = 0.0f;
}
this->subAlpha -= this->fadeOutAlphaStep;
if (this->subAlpha < 0.0f) {
this->subAlpha = 0.0f;
}
this->copyrightAlpha -= this->copyrightAlphaStep;
if (this->copyrightAlpha < 0.0f) {
this->copyrightAlpha = 0.0f;
this->globalState = MAG_STATE_POST_DISPLAY;
}
}
if (this->globalState == MAG_STATE_INITIAL) {
if (Flags_GetEnv(play, 3)) {
this->effectFadeInTimer = 40;
this->globalState = MAG_STATE_FADE_IN;
}
} else if (this->globalState == MAG_STATE_DISPLAY) {
if (Flags_GetEnv(play, 4)) {
this->globalState = MAG_STATE_FADE_OUT;
}
}
}
void EnMag_UpdateVanilla(Actor* thisx, PlayState* play) {
s32 pad[2];
EnMag* this = (EnMag*)thisx;
if (gSaveContext.fileNum != 0xFEDC) {
if (this->globalState < MAG_STATE_DISPLAY) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->mainAlpha = 210;
this->subAlpha = 255;
this->copyrightAlpha = 255;
this->effectPrimLodFrac = 128.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 100.0f;
this->effectEnvColor[2] = 0.0f;
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
gSaveContext.transFadeDuration = 1;
gSaveContext.transWipeSpeed = 255;
}
} else if (this->globalState >= MAG_STATE_DISPLAY) {
if (sDelayTimer == 0) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) {
if (play->sceneLoadFlag != 20) {
Audio_SetCutsceneFlag(0);
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
gSaveContext.gameMode = 2;
play->sceneLoadFlag = 20;
play->fadeTransition = 2;
}
this->copyrightAlphaStep = 15;
this->fadeOutAlphaStep = 25;
this->globalState = MAG_STATE_FADE_OUT;
}
} else {
sDelayTimer--;
}
}
}
if (this->globalState == MAG_STATE_FADE_IN) {
if (this->effectFadeInState == 0) {
this->effectAlpha += 6.375f;
this->effectPrimLodFrac += 0.8f;
this->effectPrimColor[0] += 6.375f;
this->effectPrimColor[1] += 3.875f;
this->effectPrimColor[2] += 2.125f;
this->effectEnvColor[0] += 6.375f;
this->effectEnvColor[1] += 3.875f;
this->effectFadeInTimer--;
if (this->effectFadeInTimer == 0) {
this->effectPrimLodFrac = 32.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 255.0f;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 255.0f;
this->effectFadeInTimer = 40;
this->effectFadeInState = 1;
}
} else if (this->effectFadeInState == 1) {
this->effectPrimColor[2] += -2.125f;
this->effectEnvColor[1] += -3.875f;
this->effectPrimLodFrac += 2.4f;
this->effectFadeInTimer--;
if (this->effectFadeInTimer == 0) {
this->effectPrimLodFrac = 128.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[1] = 100.0f;
this->effectFadeInTimer = 32;
this->effectFadeInState = 2;
}
}
if (this->effectAlpha > 160) {
this->mainAlpha += VREG(5);
if (this->mainAlpha >= 210.0f) {
this->mainAlpha = 210.0f;
}
if (this->mainAlpha >= 210) {
this->subAlpha += VREG(6);
if (this->subAlpha >= 255.0f) {
this->subAlpha = 255.0f;
}
if (this->subAlpha >= 200) {
this->copyrightAlpha += this->copyrightAlphaStep;
if (this->copyrightAlpha >= 255.0f) {
this->copyrightAlpha = 255.0f;
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
}
}
}
}
} else if (this->globalState == MAG_STATE_FADE_OUT) {
this->effectAlpha -= this->fadeOutAlphaStep;
if (this->effectAlpha < 0.0f) {
this->effectAlpha = 0.0f;
}
this->mainAlpha -= this->fadeOutAlphaStep;
if (this->mainAlpha < 0.0f) {
this->mainAlpha = 0.0f;
}
this->subAlpha -= this->fadeOutAlphaStep;
if (this->subAlpha < 0.0f) {
this->subAlpha = 0.0f;
}
this->copyrightAlpha -= this->copyrightAlphaStep;
if (this->copyrightAlpha < 0.0f) {
this->copyrightAlpha = 0.0f;
this->globalState = MAG_STATE_POST_DISPLAY;
}
}
if (this->globalState == MAG_STATE_INITIAL) {
if (Flags_GetEnv(play, 3)) {
this->effectFadeInTimer = 40;
this->globalState = MAG_STATE_FADE_IN;
}
} else if (this->globalState == MAG_STATE_DISPLAY) {
if (Flags_GetEnv(play, 4)) {
this->globalState = MAG_STATE_FADE_OUT;
}
}
}
void EnMag_DrawTextureI8(Gfx** gfxp, const void* texture, s16 texWidth, s16 texHeight, s16 rectLeft, s16 rectTop,
s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) {
Gfx* gfx = *gfxp;
gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_I, G_IM_SIZ_8b, texWidth, texHeight, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
G_TX_RENDERTILE, 0, 0, dsdx, dtdy);
*gfxp = gfx;
}
void EnMag_DrawEffectTextures(Gfx** gfxp, const void* maskTex, void* effectTex, s16 maskWidth, s16 maskHeight,
s16 effectWidth, s16 effectHeight, s16 rectLeft, s16 rectTop, s16 rectWidth,
s16 rectHeight, u16 dsdx, u16 dtdy, u16 shifts, u16 shiftt, u16 flag, EnMag* this) {
Gfx* gfx = *gfxp;
gDPLoadMultiBlock_4b(gfx++, maskTex, 0x0000, 0, G_IM_FMT_I, maskWidth, maskHeight, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
if (!flag) {
gDPLoadMultiBlock(gfx++, effectTex, 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, effectWidth, effectHeight, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, 5, shifts, shiftt);
gDPSetTileSize(gfx++, 1, 0, this->effectScroll & 0x7F, 0x7C, (this->effectScroll & 0x7F) + 0x7C);
}
gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
G_TX_RENDERTILE, 0, 0, dsdx, dtdy);
*gfxp = gfx;
}
void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, const char* source, u32 width, u32 height) {
Gfx* gfx = *gfxp;
u8* curTexture;
s32 textureCount;
u32 rectLeft;
u32 rectTop;
u32 textureHeight;
s32 remainingSize;
s32 textureSize;
s32 pad;
s32 i;
Gfx_SetupDL_56Ptr(&gfx);
spockalicious (#2751) * Rough mockup of LUS XML loading * Updated code for merge * Loading from FS support and custom DList WIP implementation * Added current directory support to F3D and impl most of the dlist cmds * WIP Skeleton support * Almost done * Rebase fixes * Submodule updates * HD Texture Support * Fixes * bump lus * fix exporter build, header update * soh builds * setMesh image path cleanup * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update OTRExporter/OTRExporter/Main.cpp * Update ZAPDTR/ZAPD/ZResource.h * Update soh/src/code/z_skelanime.c * Update OTRExporter/OTRExporter/Main.cpp * Fixed jpeg backgrounds and decreased icon buffer size * Bump lus * Increased even more the buffer because it crashes on long texts * Removed print because sometimes the if is not triggered when the image is already byteswapped * fix non-windows build * fix build Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * add hd checkbox * Various fixes for custom model support (#23) * Some fixes * Updated LUS Version * Fixed issue with Link Skirt on pause menu * Added CVar for custom link model changes * Fixed headers * Additional header fixes * Tweaks * Unload HD game assets on scene transition. (#16) * Unload game assets on scene transition. * Bump LUS * Unloads all HD assets on scene transition. * Only unload hd assets if hd assets are turned on. * Fixes issues on toggling between HD and non HD assets. --------- Co-authored-by: briaguya <briaguya@alice> * fix: actually load hd debug font (#27) * fix: actually load hd debug font * toggle debug text correctly --------- Co-authored-by: briaguya <briaguya> * Yes. (#28) * Merge branch 'develop' into dev-to-ghost * HD Skeleton Swapping and Language Fixes (#32) * Yes. * HD Skeleton Swapping and Language Fixes * Test * Fixed issues with ganon cape (#34) * Fixed Bongo Bongo Crash (#35) * Added HD Assets Toggle (#37) * Ivan the Fairy - Coop Mode (#36) * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * done with all main items * bug fixes & ready * added imgui button * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * fix own dungeon items on shuffled boss rooms (#2683) * bump lus (#2692) * fix: lowercase package names for vcpkg (#2693) vcpkg was throwing an error `error: invalid character in package name (must be lowercase, digits, '-')` this updates our calls to `vcpkg_install_packages` to use lowercase package names instead of uppercase * fix death mountain cloud in rando (#2691) * Fix: Switch Age No Longer Reloads Start Room (#2679) * [Reduced Clutter] Disable Hot/Underwater Warning Text (#2684) * Disable Warning Text * Moved to Reduced Clutter * done with all main items * bug fixes & ready * fix: process roms in consistent order (#2696) * chore: move rando savefile setup and document flags (#2697) * remove rando save init from sram * move rando savefile init logic and set more flags * document flags for rando save creation * Fix: Use correct fps value for frame interpolation with match refresh rate (#2694) * Fix: Kak GS placement on construction site (#2695) * added imgui button * addressed kenix's comments * fixed useless null * added rupee dash mode in extra modes * changed menu position --------- Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> * LUS Scancodes (#42) * Added HD Assets Toggle * Switched out SDL for LUS scancodes * Ivan tweaks (#45) * Magic consumption slowed down; Bosses now affected by Ivan's Din spell * Adjust magic timer * clean up imgui * model fixes/improvements (#50) * replace `gUseCustomLinkModel` with custom resource check * handle adult/child * bump lus * fix model switching with tab * use lus main * fix carpet man (#52) Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> * get ship model and lus texture into soh.otr, use `gAuthenticLogo` to toggle between ship and authentic (#55) * Use libultra features for CPU-modified textures (#40) * Use libultra features for CPU-modified textures * Comment * bump lus on ghost (#58) * fix: properly use `Interface_LoadActionLabel` to display start button text (#61) * Changes hd -> alt for texture replacement. (#65) * Changes hd -> alt for texture replacement. * Renames variables in gfxprint for hd -> alt change. * Update soh/soh/resource/type/Skeleton.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Fixes kaleido dungeon maps (#67) * skeleton stuff (#69) * comment out wii u build (#70) * bump lus (#71) * Rework readme (#72) * Update README.md * docs * put custom music docs somewhere * Update README.md * Update README.md * Update README.md * Update README.md * dark/light title image * lus * Update README.md * Fixed vanilla minimap (#73) * Fixed vanilla minimap * Workaround for pulsing SD maps with non-broken HD maps. --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> * Skeleton fix fixed (#75) * WIP skelton patcher fix * Fixes skeleton reference change. * Adds const back to name in ResourceMgr_LoadSkeletonByName --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * Fixes z_message_otr memory leak. * Update soh/soh/z_message_OTR.cpp * Update soh/src/code/game.c * docs: add how to find otr files to switch instructions (#78) * bump lus (#79) * comment out RegisterBlendedTexture in king d (#80) --------- Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: briaguya <briaguya> Co-authored-by: Ralphie Morell <stratomaster64@gmail.com> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Lywx <36680385+KiritoDv@users.noreply.github.com>
2023-04-27 19:20:41 -04:00
rectLeft = centerX - (width / 2);
rectTop = centerY - (height / 2);
spockalicious (#2751) * Rough mockup of LUS XML loading * Updated code for merge * Loading from FS support and custom DList WIP implementation * Added current directory support to F3D and impl most of the dlist cmds * WIP Skeleton support * Almost done * Rebase fixes * Submodule updates * HD Texture Support * Fixes * bump lus * fix exporter build, header update * soh builds * setMesh image path cleanup * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update OTRExporter/OTRExporter/Main.cpp * Update ZAPDTR/ZAPD/ZResource.h * Update soh/src/code/z_skelanime.c * Update OTRExporter/OTRExporter/Main.cpp * Fixed jpeg backgrounds and decreased icon buffer size * Bump lus * Increased even more the buffer because it crashes on long texts * Removed print because sometimes the if is not triggered when the image is already byteswapped * fix non-windows build * fix build Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * add hd checkbox * Various fixes for custom model support (#23) * Some fixes * Updated LUS Version * Fixed issue with Link Skirt on pause menu * Added CVar for custom link model changes * Fixed headers * Additional header fixes * Tweaks * Unload HD game assets on scene transition. (#16) * Unload game assets on scene transition. * Bump LUS * Unloads all HD assets on scene transition. * Only unload hd assets if hd assets are turned on. * Fixes issues on toggling between HD and non HD assets. --------- Co-authored-by: briaguya <briaguya@alice> * fix: actually load hd debug font (#27) * fix: actually load hd debug font * toggle debug text correctly --------- Co-authored-by: briaguya <briaguya> * Yes. (#28) * Merge branch 'develop' into dev-to-ghost * HD Skeleton Swapping and Language Fixes (#32) * Yes. * HD Skeleton Swapping and Language Fixes * Test * Fixed issues with ganon cape (#34) * Fixed Bongo Bongo Crash (#35) * Added HD Assets Toggle (#37) * Ivan the Fairy - Coop Mode (#36) * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * done with all main items * bug fixes & ready * added imgui button * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * fix own dungeon items on shuffled boss rooms (#2683) * bump lus (#2692) * fix: lowercase package names for vcpkg (#2693) vcpkg was throwing an error `error: invalid character in package name (must be lowercase, digits, '-')` this updates our calls to `vcpkg_install_packages` to use lowercase package names instead of uppercase * fix death mountain cloud in rando (#2691) * Fix: Switch Age No Longer Reloads Start Room (#2679) * [Reduced Clutter] Disable Hot/Underwater Warning Text (#2684) * Disable Warning Text * Moved to Reduced Clutter * done with all main items * bug fixes & ready * fix: process roms in consistent order (#2696) * chore: move rando savefile setup and document flags (#2697) * remove rando save init from sram * move rando savefile init logic and set more flags * document flags for rando save creation * Fix: Use correct fps value for frame interpolation with match refresh rate (#2694) * Fix: Kak GS placement on construction site (#2695) * added imgui button * addressed kenix's comments * fixed useless null * added rupee dash mode in extra modes * changed menu position --------- Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> * LUS Scancodes (#42) * Added HD Assets Toggle * Switched out SDL for LUS scancodes * Ivan tweaks (#45) * Magic consumption slowed down; Bosses now affected by Ivan's Din spell * Adjust magic timer * clean up imgui * model fixes/improvements (#50) * replace `gUseCustomLinkModel` with custom resource check * handle adult/child * bump lus * fix model switching with tab * use lus main * fix carpet man (#52) Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> * get ship model and lus texture into soh.otr, use `gAuthenticLogo` to toggle between ship and authentic (#55) * Use libultra features for CPU-modified textures (#40) * Use libultra features for CPU-modified textures * Comment * bump lus on ghost (#58) * fix: properly use `Interface_LoadActionLabel` to display start button text (#61) * Changes hd -> alt for texture replacement. (#65) * Changes hd -> alt for texture replacement. * Renames variables in gfxprint for hd -> alt change. * Update soh/soh/resource/type/Skeleton.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Fixes kaleido dungeon maps (#67) * skeleton stuff (#69) * comment out wii u build (#70) * bump lus (#71) * Rework readme (#72) * Update README.md * docs * put custom music docs somewhere * Update README.md * Update README.md * Update README.md * Update README.md * dark/light title image * lus * Update README.md * Fixed vanilla minimap (#73) * Fixed vanilla minimap * Workaround for pulsing SD maps with non-broken HD maps. --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> * Skeleton fix fixed (#75) * WIP skelton patcher fix * Fixes skeleton reference change. * Adds const back to name in ResourceMgr_LoadSkeletonByName --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * Fixes z_message_otr memory leak. * Update soh/soh/z_message_OTR.cpp * Update soh/src/code/game.c * docs: add how to find otr files to switch instructions (#78) * bump lus (#79) * comment out RegisterBlendedTexture in king d (#80) --------- Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: briaguya <briaguya> Co-authored-by: Ralphie Morell <stratomaster64@gmail.com> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Lywx <36680385+KiritoDv@users.noreply.github.com>
2023-04-27 19:20:41 -04:00
gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, height, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
spockalicious (#2751) * Rough mockup of LUS XML loading * Updated code for merge * Loading from FS support and custom DList WIP implementation * Added current directory support to F3D and impl most of the dlist cmds * WIP Skeleton support * Almost done * Rebase fixes * Submodule updates * HD Texture Support * Fixes * bump lus * fix exporter build, header update * soh builds * setMesh image path cleanup * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update OTRExporter/OTRExporter/Main.cpp * Update ZAPDTR/ZAPD/ZResource.h * Update soh/src/code/z_skelanime.c * Update OTRExporter/OTRExporter/Main.cpp * Fixed jpeg backgrounds and decreased icon buffer size * Bump lus * Increased even more the buffer because it crashes on long texts * Removed print because sometimes the if is not triggered when the image is already byteswapped * fix non-windows build * fix build Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * add hd checkbox * Various fixes for custom model support (#23) * Some fixes * Updated LUS Version * Fixed issue with Link Skirt on pause menu * Added CVar for custom link model changes * Fixed headers * Additional header fixes * Tweaks * Unload HD game assets on scene transition. (#16) * Unload game assets on scene transition. * Bump LUS * Unloads all HD assets on scene transition. * Only unload hd assets if hd assets are turned on. * Fixes issues on toggling between HD and non HD assets. --------- Co-authored-by: briaguya <briaguya@alice> * fix: actually load hd debug font (#27) * fix: actually load hd debug font * toggle debug text correctly --------- Co-authored-by: briaguya <briaguya> * Yes. (#28) * Merge branch 'develop' into dev-to-ghost * HD Skeleton Swapping and Language Fixes (#32) * Yes. * HD Skeleton Swapping and Language Fixes * Test * Fixed issues with ganon cape (#34) * Fixed Bongo Bongo Crash (#35) * Added HD Assets Toggle (#37) * Ivan the Fairy - Coop Mode (#36) * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * done with all main items * bug fixes & ready * added imgui button * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * fix own dungeon items on shuffled boss rooms (#2683) * bump lus (#2692) * fix: lowercase package names for vcpkg (#2693) vcpkg was throwing an error `error: invalid character in package name (must be lowercase, digits, '-')` this updates our calls to `vcpkg_install_packages` to use lowercase package names instead of uppercase * fix death mountain cloud in rando (#2691) * Fix: Switch Age No Longer Reloads Start Room (#2679) * [Reduced Clutter] Disable Hot/Underwater Warning Text (#2684) * Disable Warning Text * Moved to Reduced Clutter * done with all main items * bug fixes & ready * fix: process roms in consistent order (#2696) * chore: move rando savefile setup and document flags (#2697) * remove rando save init from sram * move rando savefile init logic and set more flags * document flags for rando save creation * Fix: Use correct fps value for frame interpolation with match refresh rate (#2694) * Fix: Kak GS placement on construction site (#2695) * added imgui button * addressed kenix's comments * fixed useless null * added rupee dash mode in extra modes * changed menu position --------- Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> * LUS Scancodes (#42) * Added HD Assets Toggle * Switched out SDL for LUS scancodes * Ivan tweaks (#45) * Magic consumption slowed down; Bosses now affected by Ivan's Din spell * Adjust magic timer * clean up imgui * model fixes/improvements (#50) * replace `gUseCustomLinkModel` with custom resource check * handle adult/child * bump lus * fix model switching with tab * use lus main * fix carpet man (#52) Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> * get ship model and lus texture into soh.otr, use `gAuthenticLogo` to toggle between ship and authentic (#55) * Use libultra features for CPU-modified textures (#40) * Use libultra features for CPU-modified textures * Comment * bump lus on ghost (#58) * fix: properly use `Interface_LoadActionLabel` to display start button text (#61) * Changes hd -> alt for texture replacement. (#65) * Changes hd -> alt for texture replacement. * Renames variables in gfxprint for hd -> alt change. * Update soh/soh/resource/type/Skeleton.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Fixes kaleido dungeon maps (#67) * skeleton stuff (#69) * comment out wii u build (#70) * bump lus (#71) * Rework readme (#72) * Update README.md * docs * put custom music docs somewhere * Update README.md * Update README.md * Update README.md * Update README.md * dark/light title image * lus * Update README.md * Fixed vanilla minimap (#73) * Fixed vanilla minimap * Workaround for pulsing SD maps with non-broken HD maps. --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> * Skeleton fix fixed (#75) * WIP skelton patcher fix * Fixes skeleton reference change. * Adds const back to name in ResourceMgr_LoadSkeletonByName --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * Fixes z_message_otr memory leak. * Update soh/soh/z_message_OTR.cpp * Update soh/src/code/game.c * docs: add how to find otr files to switch instructions (#78) * bump lus (#79) * comment out RegisterBlendedTexture in king d (#80) --------- Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: briaguya <briaguya> Co-authored-by: Ralphie Morell <stratomaster64@gmail.com> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Lywx <36680385+KiritoDv@users.noreply.github.com>
2023-04-27 19:20:41 -04:00
gDPSetTextureImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, source);
gDPLoadSync(gfx++);
gDPLoadTile(gfx++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (height - 1) << 2);
gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2,
(rectTop + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
*gfxp = gfx;
}
void EnMag_DrawCharTexture(Gfx** gfxp, u8* texture, s32 rectLeft, s32 rectTop) {
Gfx* gfx = *gfxp;
YREG(0) = 1024.0f / (YREG(1) / 100.0f);
YREG(2) = 16.0f * (YREG(1) / 100.0f);
gDPLoadTextureBlock_4b(gfx++, texture, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + YREG(2)) << 2, (rectTop + YREG(2)) << 2,
G_TX_RENDERTILE, 0, 0, YREG(0), YREG(0));
*gfxp = gfx;
}
s16 GetCharArraySize(const char* str) {
s16 length = 0;
char c = str[length];
while (c != 0) {
length++;
c = str[length];
}
return length;
}
void EnMag_DrawInnerMq(Actor* thisx, PlayState* play, Gfx** gfxp) {
static s16 textAlpha = 0;
static s16 textFadeDirection = 0;
static s16 textFadeTimer = 0;
static void* effectMaskTextures[] = {
gTitleEffectMask00Tex, gTitleEffectMask01Tex, gTitleEffectMask02Tex,
gTitleEffectMask10Tex, gTitleEffectMask11Tex, gTitleEffectMask12Tex,
gTitleEffectMask20Tex, gTitleEffectMask21Tex, gTitleEffectMask22Tex,
};
EnMag* this = (EnMag*)thisx;
Font* font = &this->font;
s32 pad;
Gfx* gfx = *gfxp;
u16 i, j, k;
u16 rectLeft;
u16 rectTop;
u16 length;
int lang = LANGUAGE_ENG;
if (CVarGetInteger("gTitleScreenTranslation", 0)) {
lang = gSaveContext.language;
}
gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
Gfx_SetupDL_39Ptr(&gfx);
this->effectScroll -= 2;
gDPSetCycleType(gfx++, G_CYC_2CYCLE);
gDPSetAlphaCompare(gfx++, G_AC_THRESHOLD);
gDPSetRenderMode(gfx++, G_RM_PASS, G_RM_CLD_SURF2);
gDPSetCombineLERP(gfx++, TEXEL1, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL1, 1, PRIM_LOD_FRAC, TEXEL0, PRIMITIVE,
ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0);
gDPSetPrimColor(gfx++, 0, (s16)this->effectPrimLodFrac, (s16)this->effectPrimColor[0],
(s16)this->effectPrimColor[1], (s16)this->effectPrimColor[2], (s16)this->effectAlpha);
gDPSetEnvColor(gfx++, (s16)this->effectEnvColor[0], (s16)this->effectEnvColor[1], (s16)this->effectEnvColor[2],
255);
if ((s16)this->effectPrimLodFrac != 0) {
for (k = 0, i = 0, rectTop = 0; i < 3; i++, rectTop += 64) {
for (j = 0, rectLeft = 56; j < 3; j++, k++, rectLeft += 64) {
EnMag_DrawEffectTextures(&gfx, effectMaskTextures[k], gTitleFlameEffectTex, 64, 64, 32, 32, rectLeft,
rectTop, 64, 64, 1024, 1024, 1, 1, k, this);
}
}
}
gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, (s16)this->mainAlpha);
if ((s16)this->mainAlpha != 0) {
EnMag_DrawImageRGBA32(&gfx, 152, 100, (u8*)gTitleZeldaShieldLogoMQTex, 160, 160);
}
Gfx_SetupDL_39Ptr(&gfx);
gDPPipeSync(gfx++);
gDPSetAlphaCompare(gfx++, G_AC_NONE);
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if ((s16)this->mainAlpha < 100) {
gDPSetRenderMode(gfx++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
} else {
gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
}
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, (s16)this->mainAlpha);
gDPSetEnvColor(gfx++, 0, 0, 100, 255);
if ((s16)this->mainAlpha != 0) {
EnMag_DrawTextureI8(&gfx, gTitleTheLegendOfTextTex, 72, 8, 146, 73, 72, 8, 1024, 1024);
EnMag_DrawTextureI8(&gfx, gTitleOcarinaOfTimeTMTextTex, 96, 8, 144, 127, 96, 8, 1024, 1024);
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, 100, 150, 255, (s16)this->mainAlpha);
gDPSetEnvColor(gfx++, 20, 80, 160, 255);
EnMag_DrawTextureI8(&gfx, gTitleTheLegendOfTextTex, 72, 8, 145, 72, 72, 8, 1024, 1024);
EnMag_DrawTextureI8(&gfx, gTitleOcarinaOfTimeTMTextTex, 96, 8, 143, 126, 96, 8, 1024, 1024);
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, (s16)this->subAlpha);
EnMag_DrawImageRGBA32(&gfx, 174, 145, "__OTR__objects/object_mag/gTitleMasterQuestSubtitleTex", 128, 32);
}
Gfx_SetupDL_39Ptr(&gfx);
gDPSetAlphaCompare(gfx++, G_AC_NONE);
gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(gfx++, 0, 0, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha,
(s16)this->copyrightAlpha);
if ((s16)this->copyrightAlpha != 0) {
gDPLoadTextureBlock(gfx++, gTitleCopyright19982003Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(gfx++, 312, 792, 952, 856, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
if (gSaveContext.fileNum == 0xFEDC) {
// Draw "NO CONTROLLER" Text
textAlpha = textFadeTimer * 10;
if (textAlpha >= 255) {
textAlpha = 255;
}
// Text Shadow
gDPPipeSync(gfx++);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha);
length = GetCharArraySize(noControllerMsg[lang]);
rectLeft = VREG(19) + 1 + ((length - 13) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (noControllerMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 172);
if (noControllerMsg[lang][i] == ' ') {
rectLeft += VREG(23);
} else {
rectLeft += VREG(21);
}
}
// Actual Text
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, 100, 255, 255, textAlpha);
rectLeft = VREG(19) + ((length - 13) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (noControllerMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 171);
if (noControllerMsg[lang][i] == ' ') {
rectLeft += VREG(23);
} else {
rectLeft += VREG(21);
}
}
} else if (this->copyrightAlpha >= 200.0f) {
// Draw "PRESS START" Text
textAlpha = textFadeTimer * 10;
if (textAlpha >= 255) {
textAlpha = 255;
}
// Text Shadow
gDPPipeSync(gfx++);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha);
length = GetCharArraySize(pressStartMsg[lang]);
rectLeft = YREG(7) + 1 + ((length - 11) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (pressStartMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 172);
if (pressStartMsg[lang][i] == ' ') {
rectLeft += YREG(9);
} else {
rectLeft += YREG(8);
}
}
// Actual Text
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, YREG(4), YREG(5), YREG(6), textAlpha);
rectLeft = YREG(7) + ((length - 11) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (pressStartMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 171);
if (pressStartMsg[lang][i] == ' ') {
rectLeft += YREG(9);
} else {
rectLeft += YREG(8);
}
}
}
if (textFadeDirection != 0) {
if (--textFadeTimer == 0) {
textFadeDirection = 0;
}
} else {
if (++textFadeTimer >= 26) {
textFadeDirection = 1;
}
}
*gfxp = gfx;
}
void EnMag_DrawInnerVanilla(Actor* thisx, PlayState* play, Gfx** gfxp) {
static s16 textAlpha = 0;
static s16 textFadeDirection = 0;
static s16 textFadeTimer = 0;
static const void* effectMaskTextures[] = {
gTitleEffectMask00Tex, gTitleEffectMask01Tex, gTitleEffectMask02Tex,
gTitleEffectMask10Tex, gTitleEffectMask11Tex, gTitleEffectMask12Tex,
gTitleEffectMask20Tex, gTitleEffectMask21Tex, gTitleEffectMask22Tex,
};
EnMag* this = (EnMag*)thisx;
Font* font = &this->font;
s32 pad;
Gfx* gfx = *gfxp;
u16 i, j, k;
u16 rectLeft;
u16 rectTop;
u16 length;
int lang = LANGUAGE_ENG;
if (CVarGetInteger("gTitleScreenTranslation", 0)) {
lang = gSaveContext.language;
}
gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
Gfx_SetupDL_39Ptr(&gfx);
this->effectScroll -= 2;
gDPSetCycleType(gfx++, G_CYC_2CYCLE);
gDPSetAlphaCompare(gfx++, G_AC_THRESHOLD);
gDPSetRenderMode(gfx++, G_RM_PASS, G_RM_CLD_SURF2);
gDPSetCombineLERP(gfx++, TEXEL1, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL1, 1, PRIM_LOD_FRAC, TEXEL0, PRIMITIVE,
ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0);
gDPSetPrimColor(gfx++, 0, (s16)this->effectPrimLodFrac, (s16)this->effectPrimColor[0],
(s16)this->effectPrimColor[1], (s16)this->effectPrimColor[2], (s16)this->effectAlpha);
gDPSetEnvColor(gfx++, (s16)this->effectEnvColor[0], (s16)this->effectEnvColor[1], (s16)this->effectEnvColor[2],
255);
if ((s16)this->effectPrimLodFrac != 0) {
for (k = 0, i = 0, rectTop = 0; i < 3; i++, rectTop += 64) {
for (j = 0, rectLeft = 64; j < 3; j++, k++, rectLeft += 64) {
EnMag_DrawEffectTextures(&gfx, effectMaskTextures[k], gTitleFlameEffectTex, 64, 64, 32, 32, rectLeft,
rectTop, 64, 64, 1024, 1024, 1, 1, k, this);
}
}
}
gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, (s16)this->mainAlpha);
if ((s16)this->mainAlpha != 0) {
EnMag_DrawImageRGBA32(&gfx, 160, 100, (u8*)gTitleZeldaShieldLogoTex, 160, 160);
}
Gfx_SetupDL_39Ptr(&gfx);
gDPPipeSync(gfx++);
gDPSetAlphaCompare(gfx++, G_AC_NONE);
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if ((s16)this->mainAlpha < 100) {
gDPSetRenderMode(gfx++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
} else {
gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
}
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, (s16)this->mainAlpha);
gDPSetEnvColor(gfx++, 100, 0, 100, 255);
if ((s16)this->mainAlpha != 0) {
EnMag_DrawTextureI8(&gfx, gTitleTheLegendOfTextTex, 72, 8, 154, 73, 72, 8, 1024, 1024);
EnMag_DrawTextureI8(&gfx, gTitleOcarinaOfTimeTMTextTex, 96, 8, 152, 127, 96, 8, 1024, 1024);
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, 200, 200, 150, (s16)this->mainAlpha);
gDPSetEnvColor(gfx++, 100, 100, 50, 255);
EnMag_DrawTextureI8(&gfx, gTitleTheLegendOfTextTex, 72, 8, 153, 72, 72, 8, 1024, 1024);
EnMag_DrawTextureI8(&gfx, gTitleOcarinaOfTimeTMTextTex, 96, 8, 151, 126, 96, 8, 1024, 1024);
}
Gfx_SetupDL_39Ptr(&gfx);
gDPSetAlphaCompare(gfx++, G_AC_NONE);
gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(gfx++, 0, 0, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha,
(s16)this->copyrightAlpha);
if ((s16)this->copyrightAlpha != 0) {
gDPLoadTextureBlock(gfx++, gTitleCopyright19982003Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(gfx++, 312, 792, 952, 856, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
if (gSaveContext.fileNum == 0xFEDC) {
// Draw "NO CONTROLLER" Text
textAlpha = textFadeTimer * 10;
if (textAlpha >= 255) {
textAlpha = 255;
}
// Text Shadow
gDPPipeSync(gfx++);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha);
length = GetCharArraySize(noControllerMsg[lang]);
rectLeft = VREG(19) + 1 + ((length - 13) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (noControllerMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 172);
if (noControllerMsg[lang][i] == ' ') {
rectLeft += VREG(23);
} else {
rectLeft += VREG(21);
}
}
// Actual Text
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, 100, 255, 255, textAlpha);
rectLeft = VREG(19) + ((length - 13) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (noControllerMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 171);
if (noControllerMsg[lang][i] == ' ') {
rectLeft += VREG(23);
} else {
rectLeft += VREG(21);
}
}
} else if (this->copyrightAlpha >= 200.0f) {
// Draw "PRESS START" Text
textAlpha = textFadeTimer * 10;
if (textAlpha >= 255) {
textAlpha = 255;
}
// Text Shadow
gDPPipeSync(gfx++);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha);
length = GetCharArraySize(pressStartMsg[lang]);
rectLeft = YREG(7) + 1 + ((length - 11) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (pressStartMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 172);
if (pressStartMsg[lang][i] == ' ') {
rectLeft += YREG(9);
} else {
rectLeft += YREG(8);
}
}
// Actual Text
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, YREG(4), YREG(5), YREG(6), textAlpha);
rectLeft = YREG(7) + ((length - 11) * -3);
for (i = 0; i < length; i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + (pressStartMsg[lang][i] - '\x37') * FONT_CHAR_TEX_SIZE,
rectLeft, YREG(10) + 171);
if (pressStartMsg[lang][i] == ' ') {
rectLeft += YREG(9);
} else {
rectLeft += YREG(8);
}
}
}
if (textFadeDirection != 0) {
if (--textFadeTimer == 0) {
textFadeDirection = 0;
}
} else {
if (++textFadeTimer >= 26) {
textFadeDirection = 1;
}
}
*gfxp = gfx;
}
void EnMag_Draw(Actor* thisx, PlayState* play) {
s32 pad;
Gfx* gfx;
Gfx* gfxRef;
OPEN_DISPS(play->state.gfxCtx);
gfxRef = POLY_OPA_DISP;
gfx = Graph_GfxPlusOne(gfxRef);
gSPDisplayList(OVERLAY_DISP++, gfx);
drawInnerFunc(thisx, play, &gfx);
gSPEndDisplayList(gfx++);
Graph_BranchDlist(gfxRef, gfx);
POLY_OPA_DISP = gfx;
CLOSE_DISPS(play->state.gfxCtx);
}