`ovl_title` OK (#311)

* OK, asset XML made and symbols imported

* Missed a GLOBAL_ASM

* Remove data from spec

* engineer's review

* Correct arg

* Un-format functions.h

* Hopefully fix it
This commit is contained in:
EllipticEllipsis 2021-09-28 02:29:30 +01:00 committed by GitHub
parent a6d26c82f2
commit 14ad66b4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 204 additions and 37 deletions

View File

@ -0,0 +1,8 @@
<Root>
<File Name="nintendo_rogo_static" Segment="1" Game="MM">
<Texture Name="gNintendo64LogoTextTex" OutName="nintendo_64_logo_text" Format="i8" Width="192" Height="32" Offset="0x0"/>
<Texture Name="gNintendo64LogoTextShineTex" OutName="nintendo_64_logo_text_shine" Format="i8" Width="32" Height="32" Offset="0x1800"/>
<DList Name="gNintendo64LogoNDL" Offset="0x2720"/>
<Texture Name="gNintendo64LogoNShineTex" OutName="nintendo_64_logo_n_shine" Format="i8" Width="32" Height="32" Offset="0x29C0"/>
</File>
</Root>

View File

@ -789,7 +789,7 @@ void func_800B75A0(CollisionPoly* param_1, Vec3f* param_2, s16* param_3);
// UNK_TYPE4 func_800B7678(GlobalContext* globalCtx, Actor* param_2, s32 param_3, u32 param_4);
void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, u32 flags);
// void func_800B7E04(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
s32 func_800B7FE0(f32* param_1, f32* param_2, f32* param_3, GraphicsContext* gfxCtx);
Hilite* func_800B7FE0(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx);
// void func_800B8018(void);
void func_800B8050(Actor* actor, GlobalContext* globalCtx, s32 iParm3);
void func_800B8118(Actor* actor, GlobalContext* globalCtx, s32 iParm3);
@ -1775,7 +1775,7 @@ void func_800FB320(GlobalContext* globalCtx, u8 param_2);
void func_800FBF3C(GlobalContext* globalCtx);
// void func_800FC158(void);
// void func_800FC3DC(void);
// void func_800FC444(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6);
void func_800FC444(GraphicsContext* gfxCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4, UNK_TYPE arg5);
// void func_800FC64C(void);
// void func_800FD2B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
void func_800FD538(Color_RGB8* param_1, Color_RGB8* param_2, f32 param_3, Vec3s* param_4);
@ -2831,8 +2831,8 @@ void func_80146580(s32 param_1, SramContext* param_2, s32 param_3);
// void func_80146628(void);
// void func_80146AA0(void);
// void func_80146DF8(void);
// void func_80146E40(void);
void Sram_Alloc(GameState* gamestate, SramContext* iParm2);
void func_80146E40(GameState* gameState, SramContext* sramCtx);
void Sram_Alloc(GameState* gamestate, SramContext* sramCtx);
// void func_80146EBC(SramContext* param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3);
// void func_80146EE8(void);
// void func_80146F5C(void);
@ -2918,18 +2918,18 @@ void func_8015E7EC(GlobalContext* globalCtx, UNK_PTR puParm2);
// void func_80160B40(void);
// void func_80160B80(void);
// void func_80160BC0(void);
void ShrinkWindow_SetLetterboxTarget(s8 target);
// s32 ShrinkWindow_GetLetterboxTarget(void);
void ShrinkWindow_SetLetterboxMagnitude(s8 magnitude);
void ShrinkWindow_SetLetterboxTarget(s32 target);
s32 ShrinkWindow_GetLetterboxTarget(void);
void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetLetterboxMagnitude(void);
void ShrinkWindow_SetPillarboxTarget(s8 target);
// s32 ShrinkWindow_GetPillarboxTarget(void);
void ShrinkWindow_SetPillarboxMagnitude(u8 magnitude);
// s32 ShrinkWindow_GetPillarboxMagnitude(void);
// void ShrinkWindow_Init(void);
void ShrinkWindow_SetPillarboxTarget(s32 target);
s32 ShrinkWindow_GetPillarboxTarget(void);
void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetPillarboxMagnitude(void);
void ShrinkWindow_Init(void);
void ShrinkWindow_Fini(void);
void ShrinkWindow_Step(s32 framerateDivisor);
void ShrinkWindow_Draw(GlobalContext* globalCtx);
void ShrinkWindow_Draw(GraphicsContext* gfxCtx);
// void func_80161180(void);
// void func_8016119C(void);
// void func_8016122C(void);
@ -3186,7 +3186,7 @@ void func_80174AA0(ListAlloc* alloc);
// void func_80174B20(void);
void func_80174BA0(ListAlloc* alloc);
void Main(void* arg);
// u32 Padmgr_GetControllerBitmask(void);
u32 Padmgr_GetControllerBitmask(void);
// void func_80174F24(void);
// void func_80174F44(void);
// void func_80174F7C(void);

6
spec
View File

@ -697,8 +697,7 @@ beginseg
compress
address 0x80800000
include "build/src/overlays/gamestates/ovl_title/z_title.o"
include "build/data/ovl_title/ovl_title.data.o"
include "build/data/ovl_title/ovl_title.reloc.o"
include "build/src/overlays/gamestates/ovl_title/ovl_title_reloc.o"
endseg
beginseg
@ -8881,7 +8880,8 @@ beginseg
name "nintendo_rogo_static"
compress
romalign 0x1000
include "build/baserom/nintendo_rogo_static.o"
include "build/assets/static/nintendo_rogo_static/nintendo_rogo_static.o"
number 1
endseg
beginseg

View File

@ -1,22 +1,182 @@
/*
* File: z_title.c
* Overlay: ovl_title
* Description:
* Description: Nintendo 64 logo shown on startup
*/
#include "z_title.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "static/nintendo_rogo_static/nintendo_rogo_static.h"
extern UNK_TYPE D_01002720;
void Title_UpdateCounters(TitleContext* this) {
if ((this->coverAlpha == 0) && (this->visibleDuration != 0)) {
this->timer--;
this->visibleDuration--;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_title/Title_UpdateCounters.s")
if (this->timer == 0) {
this->timer = 400;
}
} else {
this->coverAlpha += this->addAlpha;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_title/Title_RenderView.s")
if (this->coverAlpha <= 0) {
this->coverAlpha = 0;
this->addAlpha = 12;
} else if (this->coverAlpha >= 255) {
this->coverAlpha = 255;
this->exit = true;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_title/Title_Draw.s")
this->uls = this->ult & 0x7F;
this->ult++;
}
void Title_Main(GameState* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_title/Title_Main.s")
void Title_RenderView(TitleContext* this, f32 x, f32 y, f32 z) {
View* view = &this->view;
Vec3f eye;
Vec3f at;
Vec3f up;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_title/Title_Destroy.s")
eye.x = x;
eye.y = y;
eye.z = z;
up.x = up.z = 0.0f;
at.x = at.y = at.z = 0.0f;
up.y = 1.0f;
func_8013F0D0(view, 30.0f, 10.0f, 12800.0f);
View_SetViewOrientation(view, &eye, &at, &up);
View_RenderView(view, 0xF);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_title/Title_Init.s")
void Title_Draw(GameState* thisx) {
static s16 titleRotation = 0;
static Lights1 sTitleLights = gdSPDefLights1(100, 100, 100, 255, 255, 255, 69, 69, 69);
TitleContext* this = (TitleContext*)thisx;
u16 y;
u16 idx;
Vec3f lightDir;
Vec3f object;
Vec3f eye;
s32 pad[2];
OPEN_DISPS(this->gameState.gfxCtx);
lightDir.x = 69.0f;
lightDir.y = 69.0f;
lightDir.z = 69.0f;
object.x = 0.0f;
object.y = 0.0f;
object.z = 0.0f;
eye.x = -4949.148f;
eye.y = 4002.5417f;
eye.z = 1119.0837f;
func_800B7FE0(&object, &eye, &lightDir, this->gameState.gfxCtx);
gSPSetLights1(POLY_OPA_DISP++, sTitleLights);
Title_RenderView(this, 0.0f, 150.0f, 300.0f);
func_8012C28C(this->gameState.gfxCtx);
SysMatrix_InsertTranslation(-53.0f, -5.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
SysMatrix_InsertRotation(0, titleRotation, 0, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(this->gameState.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoNDL);
func_8012C628(this->gameState.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_2CYCLE);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP);
gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT,
COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 170, 255, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 255, 128);
gDPLoadMultiBlock(POLY_OPA_DISP++, gNintendo64LogoTextShineTex, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 11);
for (idx = 0, y = 94; idx < 16; idx++, y += 2) {
gDPLoadTextureBlock(POLY_OPA_DISP++, &((u8*)gNintendo64LogoTextTex)[0x180 * idx], G_IM_FMT_I, G_IM_SIZ_8b, 192,
2, 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);
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);
}
func_800FC444(this->gameState.gfxCtx, 0, 0, 0, this->coverAlpha, 2);
titleRotation += 300;
CLOSE_DISPS(this->gameState.gfxCtx);
}
void Title_Main(GameState* thisx) {
TitleContext* this = (TitleContext*)thisx;
func_8012CF0C(this->gameState.gfxCtx, 1, 1, 0, 0, 0);
OPEN_DISPS(this->gameState.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x01, this->staticSegment);
Title_UpdateCounters(this);
Title_Draw(&this->gameState);
if (this->exit) {
gSaveContext.seqIndex = 0xFF;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.gameMode = 1;
{
GameState* gameState = &this->gameState;
gameState->running = false;
}
SET_NEXT_GAMESTATE(&this->gameState, Opening_Init, OpeningContext);
}
CLOSE_DISPS(this->gameState.gfxCtx);
}
void Title_Destroy(GameState* thisx) {
TitleContext* this = (TitleContext*)thisx;
func_80146E40(&this->gameState, &this->sramCtx);
ShrinkWindow_Fini();
CIC6105_Nop80081828();
}
void Title_Init(GameState* thisx) {
TitleContext* this = (TitleContext*)thisx;
uintptr_t segmentSize =
(uintptr_t)_nintendo_rogo_staticSegmentRomEnd - (uintptr_t)_nintendo_rogo_staticSegmentRomStart;
this->staticSegment = THA_AllocEndAlign16(&this->gameState.heap, segmentSize);
DmaMgr_SendRequest0(this->staticSegment, (uintptr_t)_nintendo_rogo_staticSegmentRomStart, segmentSize);
Game_SetFramerateDivisor(thisx, 1);
SysMatrix_StateAlloc(thisx);
ShrinkWindow_Init();
View_Init(&this->view, thisx->gfxCtx);
thisx->main = Title_Main;
thisx->destroy = Title_Destroy;
this->exit = false;
if (!(Padmgr_GetControllerBitmask() & 1)) {
gSaveContext.fileNum = 0xFEDC;
} else {
gSaveContext.fileNum = 0xFF;
}
gSaveContext.unk_3F3F = 1;
Sram_Alloc(thisx, &this->sramCtx);
this->ult = 0;
this->timer = 20;
this->coverAlpha = 255;
this->addAlpha = -12;
this->visibleDuration = 60;
}

View File

@ -1,5 +1,5 @@
#ifndef _Z64_TITLE_H_
#define _Z64_TITLE_H_
#ifndef Z64_TITLE_H
#define Z64_TITLE_H
#include "global.h"
@ -7,18 +7,17 @@ void Title_Init(GameState* thisx);
void Title_Destroy(GameState* thisx);
typedef struct {
/* 0x000 */ GameState state;
/* 0x000 */ GameState gameState;
/* 0x0A4 */ u8* staticSegment;
/* 0x0A8 */ View view;
/* 0x210 */ SramContext sramCtx;
/* 0x238 */ s16 mode;
/* 0x23A */ s16 timer;
/* 0x23C */ s16 coverAlpha;
/* 0x23E */ s16 addAlpha;
/* 0x240 */ s16 visibleDuration;
/* 0x242 */ s16 ult;
/* 0x244 */ s16 uls;
/* 0x246 */ u8 exit;
/* 0x238 */ s16 timer;
/* 0x23A */ s16 coverAlpha;
/* 0x23C */ s16 addAlpha;
/* 0x23E */ s16 visibleDuration;
/* 0x240 */ s16 ult;
/* 0x242 */ s16 uls;
/* 0x244 */ u8 exit;
} TitleContext; // size = 0x248
#endif