1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Merge branch 'master' into z_en_tk

This commit is contained in:
glank 2020-03-21 12:31:29 +01:00
commit fa4c848cad
72 changed files with 994 additions and 2402 deletions

View file

@ -45,7 +45,7 @@ static ColliderCylinderInit colliderInit =
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00,
0x0032, 0x000A, 0x0000,
0x0000, 0x0000, 0x0000
0x0000, 0x0000, 0x0000,
};
// array of entrance table entries to grotto destinations
@ -53,7 +53,7 @@ static s16 entrances[] = {
0x036D, 0x003F, 0x0598, 0x059C,
0x05A0, 0x05A4, 0x05A8, 0x05AC,
0x05B0, 0x05B4, 0x05B8, 0x05BC,
0x05C0, 0x05C4, 0x05FC
0x05C0, 0x05C4, 0x05FC,
};
// display list

View file

@ -1,14 +1,19 @@
/*
* File: z_en_lightbox.c
* Overlay: ovl_En_Lightbox
* Description:
*/
#include "z_en_lightbox.h"
#define ROOM 0x00
#define FLAGS 0x00000010
void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx);
void EnLightbox_Destroy(EnLightbox* this, GlobalContext* globalCtx);
void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx);
void EnLightbox_Draw(EnLightbox* this, GlobalContext* globalCtx);
static void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx);
static void EnLightbox_Destroy(EnLightbox* this, GlobalContext* globalCtx);
static void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx);
static void EnLightbox_Draw(EnLightbox* this, GlobalContext* globalCtx);
/*
const ActorInit En_Lightbox_InitVars =
{
ACTOR_EN_LIGHTBOX,
@ -22,11 +27,105 @@ const ActorInit En_Lightbox_InitVars =
(ActorFunc)EnLightbox_Update,
(ActorFunc)EnLightbox_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Lightbox/EnLightbox_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Lightbox/EnLightbox_Destroy.s")
extern u32 D_06000B70;
extern u32 D_06001F10;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Lightbox/EnLightbox_Update.s")
static void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx)
{
u32 local_c = 0;
Actor* thisx = &this->dyna.actor;
s32 pad[4];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Lightbox/EnLightbox_Draw.s")
switch(thisx->params){
case 0:
Actor_SetScale(thisx, 0.025f);
break;
case 1:
Actor_SetScale(thisx, 0.05f);
break;
case 2:
Actor_SetScale(thisx, 0.075f);
break;
case 3:
Actor_SetScale(thisx, 0.1f);
default:
break;
}
thisx->posRot2.pos = thisx->posRot.pos;
thisx->sub_98.unk_10 = 0x1E;
thisx->sub_98.unk_12 = 0x32;
ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFunc_Circle, 6.0f);
this->dyna.unk_160 = 0;
this->dyna.unk_15C = 0;
thisx->unk_1F = 0;
thisx->gravity = -2.0f;
DynaPolyInfo_Alloc(&D_06001F10, &local_c);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c);
}
static void EnLightbox_Destroy(EnLightbox* this, GlobalContext* globalCtx)
{
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
static void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx)
{
Actor* thisx = &this->dyna.actor;
if (this->dyna.unk_162 != 0)
{
if (func_8002F5A0(thisx, globalCtx))
{
this->dyna.unk_162 = 0;
}
}
else
{
if (func_8002F410(thisx, globalCtx))
{
this->dyna.unk_162++;
}
else
{
if (thisx->speedXZ)
{
if (thisx->bgCheckFlags & 8)
{
thisx->posRot.rot.y = (thisx->posRot.rot.y + thisx->unk_7E) - thisx->posRot.rot.y;
Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
thisx->speedXZ *= 0.7f;
thisx->bgCheckFlags &= ~0x8;
}
}
if ((thisx->bgCheckFlags & 1) == 0)
{
Math_ApproxF(&thisx->speedXZ, 0, IREG(57) / 100.0f);
}
else
{
Math_ApproxF(&thisx->speedXZ, 0, IREG(58) / 100.0f);
if ((thisx->bgCheckFlags & 2) && (thisx->velocity.y < IREG(59) / 100.0f))
{
Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
thisx->velocity.y *= IREG(60) / 100.0f;
thisx->bgCheckFlags &= ~0x1;
}
else
{
func_8002F580(thisx, globalCtx);
}
}
}
}
Actor_MoveForward(thisx);
func_8002E4B4(globalCtx, thisx, thisx->sub_98.unk_12, thisx->sub_98.unk_10, thisx->sub_98.unk_10, 0x1D);
thisx->posRot2.pos = thisx->posRot.pos;
}
static void EnLightbox_Draw(EnLightbox* this, GlobalContext* globalCtx)
{
Draw_DListOpa(globalCtx, &D_06000B70);
}

View file

@ -6,8 +6,7 @@
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x18];
/* 0x0000 */ DynaPolyActor dyna;
} EnLightbox; // size = 0x0164
extern const ActorInit En_Lightbox_InitVars;

View file

@ -1,14 +1,22 @@
/*
* File: z_obj_bombiwa.c
* Overlay: ovl_Obj_Bombiwa
* Description: Round, brown, breakable boulder
*/
#include "z_obj_bombiwa.h"
#define ROOM 0x00
#define FLAGS 0x00000000
void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx);
void ObjBombiwa_Destroy(ObjBombiwa* this, GlobalContext* globalCtx);
void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx);
void ObjBombiwa_Draw(ObjBombiwa* this, GlobalContext* globalCtx);
static void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx);
static void ObjBombiwa_Destroy(ObjBombiwa* this, GlobalContext* globalCtx);
static void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx);
static void ObjBombiwa_Draw(ObjBombiwa* this, GlobalContext* globalCtx);
static void ObjBombiwa_InitCollision(ObjBombiwa* this, GlobalContext* globalCtx);
static void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx);
/*
const ActorInit Obj_Bombiwa_InitVars =
{
ACTOR_OBJ_BOMBIWA,
@ -22,18 +30,133 @@ const ActorInit Obj_Bombiwa_InitVars =
(ActorFunc)ObjBombiwa_Update,
(ActorFunc)ObjBombiwa_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Bombiwa/func_80B915F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Bombiwa/ObjBombiwa_Init.s")
static ColliderCylinderInit colliderInit =
{
0x0C, 0x00, 0x0D, 0x39,
0x20, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00000000, 0x00, 0x00,
0x00, 0x00, 0x4FC1FFFE,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x00,
0x0037, 0x0046, 0x0000,
0x0000, 0x0000, 0x0000,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Bombiwa/ObjBombiwa_Destroy.s")
static u32 damageChart[] =
{
0x0000000C, 0x003CFF00,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Bombiwa/func_80B91738.s")
static InitChainEntry initChain[] =
{
ICHAIN_VEC3F_DIV1000(scale, 0x64, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F4, 0x7D0, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F8, 0x15E, ICHAIN_CONTINUE),
ICHAIN_F32(unk_FC, 0x3E8, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Bombiwa/ObjBombiwa_Update.s")
static s16 effectScales[] =
{
17, 14, 10, 8, 7, 5, 3, 2,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Bombiwa/ObjBombiwa_Draw.s")
extern Gfx* D_060009E0; //dlist
static void ObjBombiwa_InitCollision(ObjBombiwa* this, GlobalContext* globalCtx)
{
ObjBombiwa* thisLocal = this;
ActorCollider_AllocCylinder(globalCtx, &thisLocal->collider);
ActorCollider_InitCylinder(globalCtx, &thisLocal->collider, &thisLocal->actor, &colliderInit);
ActorCollider_Cylinder_Update(&thisLocal->actor, &thisLocal->collider);
}
static void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx)
{
Actor_ProcessInitChain(&this->actor, initChain);
ObjBombiwa_InitCollision(this, globalCtx);
if ((Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) != 0))
{
Actor_Kill(&this->actor);
}
else
{
func_80061ED4(&this->actor.sub_98.damageChart, NULL, damageChart);
if (this->actor.shape.rot.y == 0)
{
s16 rand = (s16) Math_Rand_ZeroFloat(65536.0f);
this->actor.posRot.rot.y = rand;
this->actor.shape.rot.y = rand;
}
this->actor.shape.unk_08 = -200.0f;
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y + 20.0f;
}
}
static void ObjBombiwa_Destroy(ObjBombiwa* this, GlobalContext* globalCtx)
{
ActorCollider_FreeCylinder(globalCtx, &this->collider);
}
static void ObjBombiwa_Break(ObjBombiwa *this, GlobalContext *globalCtx)
{
Vec3f temp_s2;
Vec3f temp_s3;
Gfx** dlist;
s16 u0;
s16 scale;
s32 i;
dlist = &D_060009E0;
for (i = 0; i < ARRAY_COUNT(effectScales); i++)
{
temp_s2.x = ((Math_Rand_ZeroOne() - 0.5f) * 10.0f) + this->actor.initPosRot.pos.x;
temp_s2.y = ((Math_Rand_ZeroOne() * 5.0f) + this->actor.initPosRot.pos.y) + 8.0f;
temp_s2.z = ((Math_Rand_ZeroOne() - 0.5f) * 10.0f) + this->actor.initPosRot.pos.z;
temp_s3.x = (Math_Rand_ZeroOne() - 0.5f) * 15.0f;
temp_s3.y = (Math_Rand_ZeroOne() * 16.0f) + 5.0f;
temp_s3.z = (Math_Rand_ZeroOne() - 0.5f) * 15.0f;
scale = effectScales[i];
u0 = (scale >= 11) ? 37 : 33;
Effect_SpawnFragment(globalCtx, &temp_s2, &temp_s3, &temp_s2, -400, u0, 10, 2, 0, scale, 1, 0, 80, -1, OBJECT_BOMBIWA, dlist);
}
func_80033480(globalCtx, &this->actor.posRot.pos, 60.0f, 8, 100, 160, 1);
}
static void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx)
{
SubGlobalContext11E60* sub_11E60;
ColliderCylinderMain* collider;
if (func_80033684(globalCtx, &this->actor) != NULL ||
((this->collider.base.collideFlags & 2) != 0 &&
(this->collider.body.colliding->toucher.flags & 0x40000040) != 0))
{
ObjBombiwa_Break(this, globalCtx);
Flags_SetSwitch(globalCtx, this->actor.params & 0x3F);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 80, NA_SE_EV_WALL_BROKEN);
if (((this->actor.params >> 0xF) & 1) != 0)
{
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
Actor_Kill(&this->actor);
}
else
{
this->collider.base.collideFlags &= ~0x2;
if (this->actor.xzDistanceFromLink < 800.0f)
{
sub_11E60 = &globalCtx->sub_11E60;
collider = &this->collider;
Actor_CollisionCheck_SetAC(globalCtx, sub_11E60, collider);
Actor_CollisionCheck_SetOT(globalCtx, sub_11E60, collider);
}
}
}
static void ObjBombiwa_Draw(ObjBombiwa* this, GlobalContext* globalCtx)
{
Draw_DListOpa(globalCtx, &D_060009E0);
}

View file

@ -7,7 +7,7 @@
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x4C];
/* 0x014C */ ColliderCylinderMain collider;
} ObjBombiwa; // size = 0x0198
extern const ActorInit Obj_Bombiwa_InitVars;

View file

@ -6,23 +6,209 @@
#include <ultra64.h>
#include <global.h>
#include <alloca.h>
#pragma GLOBAL_ASM("asm/non_matchings/overlays/gamestates/ovl_title/func_80800000.s")
extern Gfx D_01002720[];
extern u8 D_01001800[];
extern u8 D_01000000[];
void func_80800128(TitleContext* this)
void Title_PrintBuildInfo(Gfx** gfxp)
{
this->unk_1E1 = 1;
Gfx* g;
GfxPrint* printer;
g = *gfxp;
g = func_8009411C(g);
printer = alloca(0x30);
GfxPrint_Ctor(printer);
GfxPrint_Open(printer, g);
GfxPrint_SetColor(printer, 0xFF, 0x9B, 0xFF, 0xFF);
GfxPrint_SetPos(printer, 9, 21);
GfxPrint_Printf(printer, "NOT MARIO CLUB VERSION");
GfxPrint_SetColor(printer, 0xFF, 0xFF, 0xFF, 0xFF);
GfxPrint_SetPos(printer, 7, 23);
GfxPrint_Printf(printer, "[Creator:%s]", gBuildTeam);
GfxPrint_SetPos(printer, 7, 24);
GfxPrint_Printf(printer, "[Date:%s]", gBuildDate);
g = GfxPrint_Close(printer);
GfxPrint_Dtor(printer);
*gfxp = g;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/gamestates/ovl_title/func_80800134.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/gamestates/ovl_title/func_808001C8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/gamestates/ovl_title/func_8080073C.s")
void func_80800858(TitleContext* this)
// Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate the fade-in/fade-out + the duration of the n64 logo animation
void Title_Calc(TitleContext* this)
{
func_800A9AD0(this, &this->unk_1D0);
this->exit = 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/gamestates/ovl_title/func_80800878.s")
void Title_InitView(TitleContext* this, f32 x, f32 y, f32 z)
{
View* view;
Vec3f v1;
Vec3f v2;
Vec3f v3;
view = &this->view;
v3.z = 0;
v3.x = 0;
v2.z = 0;
v2.y = 0;
v2.x = 0;
v1.x = x;
v1.y = y;
v1.z = z;
v3.y = 1.0;
func_800AA460(view, 30.0f, 10.0f, 12800.0f);
func_800AA358(view, &v1, &v2, &v3);
func_800AAA50(view, 0xF);
}
void Title_Draw(TitleContext* this)
{
static s16 sTitleRotY = 0;
static u32 D_808009A4 = 0;
static Lights1 sTitleLights = gdSPDefLights1(0x64, 0x64, 0x64, 0xFF, 0xFF, 0xFF, 0x45, 0x45, 0x45);
u16 y;
u16 idx;
char pad1[0x4];
Vec3f v3;
Vec3f v1;
Vec3f v2;
char pad2[0x8];
GraphicsContext* gfxCtx = this->state.gfxCtx;
Gfx* gfxArr[4];
func_800C6AC4(&gfxArr, this->state.gfxCtx, "../z_title.c", 395);
v3.x = 69;
v3.y = 69;
v3.z = 69;
v2.x = -4949.148;
v2.y = 4002.5417;
v1.x = 0;
v1.y = 0;
v1.z = 0;
v2.z = 1119.0837;
func_8002EABC(&v1, &v2, &v3, this->state.gfxCtx);
gSPSetLights1(gfxCtx->polyOpa.p++, sTitleLights);
Title_InitView(this, 0, 150.0, 300.0);
func_80093D18(this->state.gfxCtx);
Matrix_Translate(-53.0, -5.0, 0, MTXMODE_NEW);
Matrix_Scale(1.0, 1.0, 1.0, MTXMODE_APPLY);
Matrix_RotateXYZ(0, sTitleRotY, 0, MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(this->state.gfxCtx, "../z_title.c", 424), G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, &D_01002720);
func_800944C4(this->state.gfxCtx);
gDPPipeSync(gfxCtx->polyOpa.p++);
gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_2CYCLE);
gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP);
gDPSetCombineLERP(gfxCtx->polyOpa.p++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0);
gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 170, 255, 255, 255);
gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 255, 128);
gDPLoadMultiBlock(gfxCtx->polyOpa.p++,
&D_01001800,
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(gfxCtx->polyOpa.p++,
&D_01000000[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(gfxCtx->polyOpa.p++, 1, this->uls, (this->ult & 0x7F) - idx*4, 0, 0);
gSPTextureRectangle(gfxCtx->polyOpa.p++, 388, y << 2, 1156, (y+2)<<2, G_TX_RENDERTILE, 0, 0, 1024, 1024);
}
func_8007672C(this->state.gfxCtx, 0, 0, 0, (s16)this->coverAlpha, 2);
sTitleRotY += 300;
func_800C6B54(&gfxArr, this->state.gfxCtx, "../z_title.c", 483);
}
void Title_Update(TitleContext* this)
{
GraphicsContext* gfxCtx = this->state.gfxCtx;
u32 pad;
Gfx* gfxArr[4];
u32 pad2;
Gfx* gfx[2];
func_800C6AC4(&gfxArr, this->state.gfxCtx, "../z_title.c", 494);
gSPSegment(gfxCtx->polyOpa.p++, 0, NULL);
gSPSegment(gfxCtx->polyOpa.p++, 1, this->staticSegment);
func_80095248(this->state.gfxCtx, 0, 0, 0);
Title_Calc(this);
Title_Draw(this);
if (D_8012DBC0)
{
gfx[0] = gfxCtx->polyOpa.p;
Title_PrintBuildInfo(&gfx);
gfxCtx->polyOpa.p = gfx[0];
}
if (this->exit)
{
gSaveContext.seq_index = -1;
gSaveContext.night_sfx = -1;
gSaveContext.game_mode = 1;
this->state.running = false;
this->state.init = Opening_Init; this->state.size = sizeof(OpeningContext);
}
func_800C6B54(&gfxArr, this->state.gfxCtx, "../z_title.c", 541);
}
void Title_Destroy(TitleContext* this)
{
func_800A9AD0(this, &this->sram);
}
void Title_Init(TitleContext* this)
{
u32 size = (u32)_nintendo_rogo_staticSegmentRomEnd - (u32)_nintendo_rogo_staticSegmentRomStart;
u32 pad;
this->staticSegment = Game_Alloc(&this->state, size, "../z_title.c", 611);
osSyncPrintf("z_title.c\n");
if (this->staticSegment == NULL)
{
__assert("this->staticSegment != NULL", "../z_title.c", 614);
}
DmaMgr_SendRequest1(this->staticSegment, (u32)_nintendo_rogo_staticSegmentRomStart, size, "../z_title.c", 615);
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
func_800AA278(&this->view, this->state.gfxCtx);
this->state.main = Title_Update;
this->state.destroy = Title_Destroy;
this->exit = false;
gSaveContext.file_num = 0xFF;
func_800A9CD4(&this->state, &this->sram);
this->ult = 0;
this->unk_1D4 = 0x14;
this->coverAlpha = 0xFF;
this->addAlpha = -3;
this->visibleDuration = 0x3C;
}