Bosses title cards fixes (#247)

* Boss title fixes.

* Proper X/Y/H/W

* Proper x,y,w,h

* Proper X,Y,W,H

* Actually had wrong height (was 32, should be 40)

* one of the last x,y,h,w fix

* WIP really need a better way to check it.

* Fix Ganondorf title card.

* better conditional logic

* No more workaround!

* Add two var in the TitleCardContext structures

* Added hasTranslation to Phantom Ganon's Horse

funny how that the horse that hold the title card.

* Add hasTranslation to Dodongo.

* Revert workaround and add hasTranslation=false

* Added hasTranslation to big piggy Ganon

* Add hasTranslation to Gohma

* Add hasTranslation to Morpha

* Add hasTranslation to Twins first part.

* Add hastranslation to that eletro "dude"

* Add hastranslation to bongo bongo

* Added hasTranslation to airwing v2

* add hasTranslation to TitleCard_InitBossName init

* isBossCard to true now that I can confirm it work

imagine in TitleCard_InitBossName setting isBossCard to false...

* no need to use bool there is seem to not like it

* change bool to s16
This commit is contained in:
Baoulettes 2022-05-03 00:27:06 +02:00 committed by GitHub
parent c5f120b6f8
commit f1e85d1e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 51 additions and 24 deletions

View File

@ -381,7 +381,7 @@ void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag);
s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag);
void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag);
void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width,
u8 height);
u8 height, s16 hastranslation);
void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y,
s32 width, s32 height, s32 delay);
s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx);

View File

@ -251,6 +251,8 @@ typedef struct {
/* 0x0B */ u8 delayTimer; // how long the title card waits to appear
/* 0x0C */ s16 alpha;
/* 0x0E */ s16 intensity;
/* ---- */ s16 isBossCard; //To detect if that a Boss name title card.
/* ---- */ s16 hasTranslation; // to detect if the current title card has translation (used for bosses only)
} TitleCardContext; // size = 0x10
typedef struct {

View File

@ -758,12 +758,14 @@ void func_8002CDE4(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
}
void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width,
u8 height) {
u8 height, s16 hasTranslation) {
if (ResourceMgr_OTRSigCheck(texture))
texture = ResourceMgr_LoadTexByName(texture);
titleCtx->texture = texture;
titleCtx->isBossCard = true;
titleCtx->hasTranslation = hasTranslation;
titleCtx->x = x;
titleCtx->y = y;
titleCtx->width = width;
@ -981,6 +983,8 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt
titleCtx->texture = ResourceMgr_LoadTexByName(texture);
//titleCtx->texture = texture;
titleCtx->isBossCard = false;
titleCtx->hasTranslation = false;
titleCtx->x = x;
titleCtx->y = y;
titleCtx->width = width;
@ -1009,6 +1013,9 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
s32 doubleWidth;
s32 titleY;
s32 titleSecondY;
s32 textureLanguageOffset;
s32 shiftTopY;
s32 shiftBottomY;
if (titleCtx->alpha != 0) {
width = titleCtx->width;
@ -1022,31 +1029,48 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
height = (width * height > 0x1000) ? 0x1000 / width : height;
titleSecondY = titleY + (height * 4);
textureLanguageOffset = 0x0;
shiftTopY = 0x0;
shiftBottomY = 0x1000;
//if this card is bosses cards, has translation and that is not using English language.
if (titleCtx->isBossCard == 1 && titleCtx->hasTranslation == 1 && gSaveContext.language != LANGUAGE_ENG) {
if (gSaveContext.language == LANGUAGE_GER) {
textureLanguageOffset = (width * height * gSaveContext.language);
shiftTopY = 0x400;
shiftBottomY = 0x1400;
} else if (gSaveContext.language == LANGUAGE_FRA) {
textureLanguageOffset = (width * height * gSaveContext.language);
shiftTopY = 0x800;
shiftBottomY = 0x1800;
}
}
// WORLD_OVERLAY_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP
WORLD_OVERLAY_DISP = func_80093808(WORLD_OVERLAY_DISP);
gDPSetPrimColor(WORLD_OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
(u8)titleCtx->alpha);
gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture, G_IM_FMT_IA,
gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset + shiftBottomY, G_IM_FMT_IA,
G_IM_SIZ_8b,
width, height, 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(WORLD_OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1,
//Removing the -1 there remove the gap between top and bottom textures.
gSPTextureRectangle(WORLD_OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4),
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
height = titleCtx->height - height;
// If texture is bigger than 0x1000, display the rest
if (height > 0) {
gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture + 0x1000,
gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset + shiftBottomY,
G_IM_FMT_IA,
G_IM_SIZ_8b, width, height, 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);
//Removing the -1 there remove the gap between top and bottom textures.
gSPTextureRectangle(WORLD_OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4,
titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
titleSecondY + (height * 4), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2880);

View File

@ -418,7 +418,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) {
if (this->unk_198 == 0x5A) {
if (!(gSaveContext.eventChkInf[7] & 2)) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gKingDodongoTitleCardTex), 0xA0, 0xB4, 0x80, 0x28);
SEGMENTED_TO_VIRTUAL(gKingDodongoTitleCardTex), 160, 180, 128, 40, true);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS);
}

View File

@ -493,7 +493,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) {
}
if ((this->timers[3] == 130) && !(gSaveContext.eventChkInf[7] & 8)) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gVolvagiaBossTitleCardTex), 0xA0, 0xB4, 0x80, 0x28);
SEGMENTED_TO_VIRTUAL(gVolvagiaBossTitleCardTex), 160, 180, 128, 40, true);
}
if (this->timers[3] <= 100) {
this->camData.eyeVel.x = this->camData.eyeVel.y = this->camData.eyeVel.z = 2.0f;

View File

@ -1088,7 +1088,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
if (!(gSaveContext.eventChkInf[7] & 0x100)) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gDorfTitleCardTex), 160, 180, 128, 40);
SEGMENTED_TO_VIRTUAL(gDorfTitleCardTex), 160, 180, 128, 40, false);
}
gSaveContext.eventChkInf[7] |= 0x100;
@ -5044,4 +5044,4 @@ static EnGanonMant* sCape;
memset(sEffectBuf, 0, sizeof(sEffectBuf));
}
}

View File

@ -671,7 +671,8 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
if (this->unk_398 == 80) {
BossGanon2_SetObjectSegment(this, globalCtx, OBJECT_GANON2, false);
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(object_ganon2_Tex_021A90), 160, 180, 128, 40);
SEGMENTED_TO_VIRTUAL(object_ganon2_Tex_021A90), 160, 180, 128, 40, true);
//It has translation but they are all the same. they all say "GANON" only
}
this->unk_3A4.x = ((this->actor.world.pos.x + 500.0f) - 350.0f) + 100.0f;
this->unk_3A4.y = this->actor.world.pos.y;
@ -3087,4 +3088,4 @@ void BossGanon2_Reset(void) {
memset(D_809105D8, 0, sizeof(D_809105D8));
memset(D_80910608, 0, sizeof(D_80910608));
memset(sParticles, 0, sizeof(sParticles));
}
}

View File

@ -926,7 +926,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) {
if (!(gSaveContext.eventChkInf[7] & 1)) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gGohmaTitleCardTex), 0xA0, 0xB4, 0x80, 0x28);
SEGMENTED_TO_VIRTUAL(gGohmaTitleCardTex), 160, 180, 128, 40, true);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);

View File

@ -1423,7 +1423,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) {
}
if (this->timers[2] == 130) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gMorphaTitleCardTex), 0xA0, 0xB4, 0x80, 0x28);
SEGMENTED_TO_VIRTUAL(gMorphaTitleCardTex), 160, 180, 128, 40, true);
gSaveContext.eventChkInf[7] |= 0x10;
}
break;
@ -3591,4 +3591,4 @@ void BossMo_Reset(void) {
sSeed1 = 0;
sSeed2 = 0;
sSeed3 = 0;
}
}

View File

@ -598,7 +598,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) {
} else if (revealStateTimer == 85) {
if (!(gSaveContext.eventChkInf[7] & 0x80)) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gBongoTitleCardTex), 160, 180, 128, 40);
SEGMENTED_TO_VIRTUAL(gBongoTitleCardTex), 160, 180, 128, 40, true);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
Animation_MorphToPlayOnce(&this->skelAnime, &gBongoHeadEyeCloseAnim, -5.0f);
@ -3245,4 +3245,4 @@ void BossSst_Reset(void) {
sCutsceneCamera= 0;
sBodyStatic = false;
}
}

View File

@ -2220,7 +2220,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) {
globalCtx->envCtx.unk_BE = 1;
globalCtx->envCtx.unk_BD = 1;
globalCtx->envCtx.unk_D8 = 0.0f;
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gTwinrovaTitleCardTex), 160, 180, 128, 40); // OTRTODO
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gTwinrovaTitleCardTex), 160, 180, 128, 40, true);
gSaveContext.eventChkInf[7] |= 0x20;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
}
@ -5469,4 +5469,4 @@ void BossTw_TwinrovaLaugh(BossTw* this, GlobalContext* globalCtx) {
void BossTw_Reset(void) {
sTwInitalized = false;
memset(sTwEffects, 0, sizeof(sTwEffects));
}
}

View File

@ -979,7 +979,7 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) {
if (!(gSaveContext.eventChkInf[7] & 0x40)) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gBarinadeTitleCardTex), 0xA0, 0xB4, 0x80, 0x28);
SEGMENTED_TO_VIRTUAL(gBarinadeTitleCardTex), 160, 180, 128, 40, true);
}
if (Rand_ZeroOne() < 0.1f) {
@ -4028,4 +4028,4 @@ void BossVa_Reset(void) {
sZapperRot.z = 0;
sPhase2Timer = 0;
sPhase4HP = 0;
}
}

View File

@ -332,7 +332,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, 0.05f);
if (this->timers[0] == 75) {
TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx,
SEGMENTED_TO_VIRTUAL(gPhantomGanonTitleCardTex), 160, 180, 128, 40);
SEGMENTED_TO_VIRTUAL(gPhantomGanonTitleCardTex), 160, 180, 128, 40, true);
}
if (this->timers[0] == 0) {
this->cutsceneState = INTRO_RETREAT;