1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Merge branch 'master' into ovl_Demo_Geff

This commit is contained in:
Ethan Roseman 2020-03-19 20:07:08 -04:00
commit 2d00e319fe
93 changed files with 1361 additions and 5148 deletions

View file

@ -6,6 +6,8 @@
#include "z_demo_go.h"
#include <vt.h>
#define ROOM 0x00
#define FLAGS 0x00000010
@ -25,7 +27,7 @@ void func_8097D130(DemoGo* this, GlobalContext* globalCtx);
void func_8097D290(DemoGo* this, GlobalContext* globalCtx);
void func_8097D29C(DemoGo* this, GlobalContext* globalCtx);
u32 D_8097D440[] = {0x0600CE80, 0x0600D280, 0x0600D680};
UNK_PTR D_8097D440[] = {0x0600CE80, 0x0600D280, 0x0600D680};
ActorFunc D_8097D44C[] =
{
@ -58,9 +60,10 @@ const ActorInit Demo_Go_InitVars =
(ActorFunc)DemoGo_Draw,
};
extern u32 D_060029A8;
extern u32 D_0600FEF0;
extern u32 D_06004930;
extern UNK_TYPE D_060029A8;
extern UNK_TYPE D_06004930;
extern UNK_TYPE D_0600E680;
extern UNK_TYPE D_0600FEF0;
UNK_TYPE func_8097C870(DemoGo *this)
{
@ -149,33 +152,36 @@ void func_8097CA78(DemoGo* this, GlobalContext* globalCtx)
func_8097C9B8(this);
}
// Not equivalent, I believe in part due to actorAction->endPos being the wrong type, holding floats instead of ints
#ifdef NON_MATCHING
void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) {
void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx)
{
Actor* thisx = &this->actor;
PosRot* posRot = &thisx->posRot;
CutsceneContext* csCtx = &globalCtx->csCtx;
Vec3f startPos;
f32 temp_ret;
CsCmdActorAction* actorAction;
f32 temp_ret;
s32 pad;
Vec3f startPos;
Vec3f endPos;
if (globalCtx->csCtx.state != 0)
{
actorAction = csCtx->actorActions[func_8097C870(this)];
if (actorAction != 0)
if (actorAction != NULL)
{
temp_ret = func_8006F93C(actorAction->endFrame, actorAction->startFrame, csCtx->frames);
startPos = actorAction->startPos;
thisx->posRot.pos.x = (((actorAction->endPos.x - startPos.x) * temp_ret) + startPos.x);
thisx->posRot.pos.y = (((actorAction->endPos.y - startPos.y) * temp_ret) + startPos.y);
thisx->posRot.pos.z = (((actorAction->endPos.z - startPos.z) * temp_ret) + startPos.z);
thisx->shape.rot.y = actorAction->rot.y;
thisx->posRot.rot.y = actorAction->rot.y;
startPos.x = actorAction->startPos.x;
startPos.y = actorAction->startPos.y;
startPos.z = actorAction->startPos.z;
endPos.x = actorAction->endPos.x;
endPos.y = actorAction->endPos.y;
endPos.z = actorAction->endPos.z;
posRot->pos.x = (((endPos.x - startPos.x) * temp_ret) + startPos.x);
posRot->pos.y = (((endPos.y - startPos.y) * temp_ret) + startPos.y);
posRot->pos.z = (((endPos.z - startPos.z) * temp_ret) + startPos.z);
posRot->rot.y = thisx->shape.rot.y = actorAction->rot.y;
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Go/func_8097CB0C.s")
#endif
void func_8097CC08(DemoGo* this)
{
@ -207,7 +213,7 @@ void func_8097CCE0(DemoGo* this, GlobalContext* globalCtx)
if (globalCtx->csCtx.state != 0)
{
actorAction = globalCtx->csCtx.actorActions[func_8097C870(this)];
if (actorAction != 0)
if (actorAction != NULL)
{
thisRotY = thisx->posRot.rot.y;
rotYDelta = actorAction->rot.y - thisRotY;
@ -234,15 +240,15 @@ UNK_TYPE DemoGo_FrameUpdateMatrix(DemoGo* this)
return SkelAnime_FrameUpdateMatrix(&this->skelAnime);
}
// This is probably at least close to equivalent but not necessarily so
#ifdef NON_MATCHING
UNK_TYPE func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 csCmdActorAction)
// return value isn't produced in the same way
s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 csCmdActorAction)
{
CutsceneContext* csCtx = &globalCtx->csCtx;
CsCmdActorAction* actorAction = csCtx->actorActions[func_8097C870(this)];
if (csCtx->state != 0)
{
if (actorAction != 0 && actorAction->action == csCmdActorAction)
if (actorAction != NULL && actorAction->action == csCmdActorAction)
{
return 1;
}
@ -277,7 +283,7 @@ void func_8097CE78(DemoGo* this, GlobalContext* globalCtx)
if (globalCtx->csCtx.state != 0)
{
actorAction = csCtx->actorActions[func_8097C870(this)];
if (actorAction != 0 && csCtx->frames >= actorAction->endFrame)
if (actorAction != NULL && csCtx->frames >= actorAction->endFrame)
{
func_8097CA78(this, globalCtx);
this->action = 3;
@ -369,7 +375,7 @@ void DemoGo_Update(DemoGo* this, GlobalContext* globalCtx)
{
if (this->action < 0 || this->action >= 7 || D_8097D44C[this->action] == 0)
{
osSyncPrintf("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n");
osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
D_8097D44C[this->action](this, globalCtx);
@ -391,32 +397,31 @@ void func_8097D290(DemoGo* this, GlobalContext* globalCtx)
}
// Not equivalent yet - the gSPSegment calls are probably the main issue
#ifdef NON_MATCHING
extern u32 D_0600E680;
void func_8097D29C(DemoGo* this, GlobalContext* globalCtx)
{
u32 addr = D_8097D440[this->unk_190];
GraphicsContext* gfxCtx = &globalCtx->state.gfxCtx;
s32 pad;
s16 temp = this->unk_190;
SkelAnime* skelAnime = &this->skelAnime;
void* srcSegment8 = D_8097D440[temp];
void* srcSegment9 = &D_0600E680;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_demo_go.c", 732);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(srcSegment8));
gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(srcSegment9));
gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr));
gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_0600E680));
func_800A1AC8(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, NULL, NULL, &this->actor);
func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, 0, 0, &this->actor);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_demo_go.c", 746);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Go/func_8097D29C.s")
#endif
void DemoGo_Draw(DemoGo* this, GlobalContext* globalCtx) {
if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == 0)
{
osSyncPrintf("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n");
osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
D_8097D468[this->drawConfig](this, globalCtx);

View file

@ -8,7 +8,6 @@ typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x018C */ char unk_18C[0x4];
/* 0x0190 */ s16 unk_190;
/* 0x0192 */ s16 unk_192;
/* 0x0194 */ s32 action;

View file

@ -1,14 +1,25 @@
/*
* File: z_door_ana.c
* Overlay: ovl_Door_Ana
* Description: Grottos Entrances/Exits
*/
#include "z_door_ana.h"
#define ROOM 0x00
#define FLAGS 0x02000000
void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx);
void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx);
void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx);
void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_SetupAction(DoorAna* this, ActorFunc func);
static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx);
/*
const ActorInit Door_Ana_InitVars =
{
ACTOR_DOOR_ANA,
@ -22,19 +33,186 @@ const ActorInit Door_Ana_InitVars =
(ActorFunc)DoorAna_Update,
(ActorFunc)DoorAna_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/func_80993EF0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/DoorAna_Init.s")
// initial collision data
static ColliderCylinderInit colliderInit =
{
0x0A, 0x00, 0x09, 0x00,
0x00, 0x01, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00,
0x00000000, 0x00, 0x00,
0x00, 0x00, 0x00000048,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00,
0x0032, 0x000A, 0x0000,
0x0000, 0x0000, 0x0000
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/DoorAna_Destroy.s")
// array of entrance table entries to grotto destinations
static s16 entrances[] = {
0x036D, 0x003F, 0x0598, 0x059C,
0x05A0, 0x05A4, 0x05A8, 0x05AC,
0x05B0, 0x05B4, 0x05B8, 0x05BC,
0x05C0, 0x05C4, 0x05FC
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/func_80993FEC.s")
// display list
extern Gfx* D_05001390;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/func_80994124.s")
// sets current actionFunc to be ran on next update call
static void DoorAna_SetupAction(DoorAna* this, ActorFunc func)
{
this->actionFunc = func;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/func_809942D8.s")
static void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* collider;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/DoorAna_Update.s")
this->actor.shape.rot.z = 0;
this->actor.shape.rot.y = this->actor.shape.rot.z;
// init block for grottos that are initially "hidden" (require explosives/hammer/song of storms to open)
if ((this->actor.params & 0x300) != 0)
{
// only allocate collider for grottos that need bombing/hammering open
if ((this->actor.params & 0x200) != 0)
{
collider = &this->collider;
ActorCollider_AllocCylinder(globalCtx, collider);
ActorCollider_InitCylinder(globalCtx, collider, &this->actor, &colliderInit);
}
else
{
this->actor.flags |= 0x10;
}
Actor_SetScale(&this->actor, 0);
DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Hidden);
}
else
{
DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Open);
}
this->actor.unk_1F = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Ana/DoorAna_Draw.s")
static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx)
{
// free collider if it has one
if ((this->actor.params & 0x200) != 0)
{
ActorCollider_FreeCylinder(globalCtx, &this->collider);
}
}
// update routine for grottos that are currently "hidden"/unopened
static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx)
{
bool openGrotto = false;
if ((this->actor.params & 0x200) == 0)
{
// opening with song of storms
if (this->actor.waterSurfaceDist < 40000.0f && func_8006C4A4(globalCtx, 5) != 0)
{
openGrotto = true;
this->actor.flags &= ~0x10;
}
}
else
{
// bombing/hammering open a grotto
if ((this->collider.base.collideFlags & 2) != 0)
{
openGrotto = true;
ActorCollider_FreeCylinder(globalCtx, &this->collider);
}
else
{
ActorCollider_Cylinder_Update(&this->actor, &this->collider);
Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->collider);
}
}
// open the grotto
if (openGrotto)
{
this->actor.params &= ~0x0300;
DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Open);
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
func_8002F5F0(&this->actor, globalCtx);
}
// update routine for grottos that are open
static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx)
{
Player* player;
s32 destinationIdx;
player = PLAYER;
if (Math_ApproxF(&this->actor.scale.x, 0.01f, 0.001f) != 0)
{
if ((this->actor.unk_1F != 0) && (globalCtx->sceneLoadFlag == 0) &&
(player->stateFlags1 & 0x80000000) && (player->unk_84F == 0))
{
destinationIdx = ((this->actor.params >> 0xC) & 7) - 1;
func_800C0AF4(globalCtx, 1, 0x4FF);
gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.posRot.pos.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.initPosRot.rot.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF;
if (destinationIdx < 0)
{
destinationIdx = this->actor.initPosRot.rot.z + 1;
}
globalCtx->nextEntranceIndex = entrances[destinationIdx];
DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Entering);
}
else
{
if (func_8008E988(globalCtx) == 0 && !(player->stateFlags1 & 0x8800000) &&
this->actor.xzDistanceFromLink <= 15.0f && -50.0f <= this->actor.yDistanceFromLink &&
this->actor.yDistanceFromLink <= 15.0f)
{
player->stateFlags1 |= 0x80000000;
this->actor.unk_1F = 1;
}
else
{
this->actor.unk_1F = 0;
}
}
}
Actor_SetScale(&this->actor, this->actor.scale.x);
}
// update function for after the player has triggered the grotto
static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx)
{
Player* player;
if (this->actor.yDistanceFromLink <= 0.0f && 15.0f < this->actor.xzDistanceFromLink)
{
player = PLAYER;
player->actor.posRot.pos.x = Math_Sins(this->actor.rotTowardsLinkY) * 15.0f + this->actor.posRot.pos.x;
player->actor.posRot.pos.z = Math_Coss(this->actor.rotTowardsLinkY) * 15.0f + this->actor.posRot.pos.z;
}
}
static void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx)
{
this->actionFunc(this, globalCtx);
// changes the grottos facing angle based on camera angle
this->actor.shape.rot.y = func_8005A9F4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]) + 0x8000;
}
static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx** dList = &D_05001390; // required for stack placement?
Gfx* gfxArr[3];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 440);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyXlu.p++, dList);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 449);
}

View file

@ -7,7 +7,8 @@
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x50];
/* 0x014C */ ColliderCylinderMain collider;
/* 0x0198 */ ActorFunc actionFunc;
} DoorAna; // size = 0x019C
extern const ActorInit Door_Ana_InitVars;

View file

@ -7,6 +7,8 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
//temp struct until we can reference other actors outside of their file
typedef struct
{
@ -56,7 +58,7 @@ static void EnAnubiceTag_Init(EnAnubiceTag* this, GlobalContext* globalCtx)
{
osSyncPrintf("\n\n");
//"Anubis control tag generated"
osSyncPrintf("☆☆☆☆☆ アヌビス制御タグ発生 ☆☆☆☆☆ %d\n", this->actor.params);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ アヌビス制御タグ発生 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params);
if (this->actor.params < (s16)0xFFFF)
{

View file

@ -11,7 +11,6 @@ typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x018C */ char unk_18C[0x4];
/* 0x0190 */ ActorFunc updateFunc;
/* 0x0194 */ u32 unk_194;
/* 0x0198 */ s32 unk_198;

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

@ -11,7 +11,6 @@ typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x018C */ char unk_18C[0x4];
/* 0x0190 */ UNK_PTR unkSkelAnimeStruct;
/* 0x0194 */ char unk_194[0x32];
/* 0x01C6 */ s16 unk_1C6;

View file

@ -7,6 +7,8 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
typedef struct
{
/* 0x0000 */ Actor actor;
@ -58,7 +60,7 @@ static void EnOkarinaEffect_Init(EnOkarinaEffect* this, GlobalContext* globalCtx
{
osSyncPrintf("\n\n");
//"Ocarina Storm Effect"
osSyncPrintf("☆☆☆☆☆ オカリナあらし効果ビカビカビカ〜 ☆☆☆☆☆ \n");
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ オカリナあらし効果ビカビカビカ〜 ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf("\n\n");
if (globalCtx->unk_10B12[1] != 0)
{

View file

@ -4,24 +4,16 @@
* Description: Flying pot enemy
*/
#include <ultra64.h>
#include <global.h>
#include "z_en_tubo_trap.h"
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ ActorFunc playfunc;
/* 0x0150 */ f32 pos_y_seek;
/* 0x0154 */ Vec3f pos_init;
/* 0x0160 */ ColliderCylinderMain capsule;
} EnTuboTrap; // size = 0x01AC
#include <vt.h>
void EnTuboTrap_Init(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Destroy(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Update(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Draw(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_TestLevitate(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_InitializeAttack(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx);
#define ROOM 0x00
@ -44,7 +36,7 @@ static ColliderCylinderInit cylinderInitData =
0x0000, 0x0000, 0x0000
};
ActorInit En_Tubo_Trap_InitVars =
const ActorInit En_Tubo_Trap_InitVars =
{
ACTOR_EN_TUBO_TRAP,
ACTORTYPE_PROP,
@ -58,321 +50,277 @@ ActorInit En_Tubo_Trap_InitVars =
(ActorFunc)EnTuboTrap_Draw,
};
extern u32 DL_SHARD;
extern u32 DL_TUBO;
extern UNK_TYPE D_05017A60;
extern Gfx D_05017870[];
void EnTuboTrap_Init(EnTuboTrap* this, GlobalContext* globalCtx)
{
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 2.0f);
osSyncPrintf("\n\n");
osSyncPrintf("\x1b[32m☆☆☆☆☆ 壷トラップ ☆☆☆☆☆ %x\n\x1b[m", this->actor.params);
ActorCollider_AllocCylinder(globalCtx, &this->capsule);
ActorCollider_InitCylinder(globalCtx, &this->capsule, &this->actor, &cylinderInitData);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 壷トラップ ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); // "Urn Trap"
ActorCollider_AllocCylinder(globalCtx, &this->collider);
ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData);
Actor_SetScale(&this->actor, 0.1f);
this->playfunc = (ActorFunc*)EnTuboTrap_TestLevitate;
this->actionFunc = (ActorFunc)EnTuboTrap_WaitForProximity;
}
void EnTuboTrap_Destroy(EnTuboTrap* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* capsule = &this->capsule;
ActorCollider_FreeCylinder(globalCtx, capsule);
ColliderCylinderMain* collider = &this->collider;
ActorCollider_FreeCylinder(globalCtx, collider);
}
void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx)
{
s16 params = this->actor.params;
s16 param1 = (params >> 6) & 0x03FF;
if (param1 >= 0 && param1 < 0x1A)
s16 param3FF = (params >> 6) & 0x3FF;
if (param3FF >= 0 && param3FF < 0x1A)
{
Item_DropCollectible(globalCtx, &this->actor.posRot, param1 | ((params & 0x03F) << 8));
Item_DropCollectible(globalCtx, &this->actor.posRot, param3FF | ((params & 0x3F) << 8));
}
}
#ifdef NON_MATCHING
void EnTuboTrap_Fragments(EnTuboTrap* this, GlobalContext* globalCtx)
// regalloc and stack usage differences, most likely the same differences as EnTuboTrap_SpawnWaterFragments
void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx)
{
u32 uVar1;
s32 rando_seed = 0;
s32 shard_count = 0;
Vec3f* actorPos;
f32 rand;
f32 cos;
f32 sin;
u32 addr;
Vec3f spC8;
Vec3f spBC;
s16 var;
s32 temp;
s32 i;
/* spawn fragments */
do
addr = &D_05017A60;
actorPos = &this->actor.posRot.pos;
for (i = 0, var = 0; i < 15; i++, var += 20000)
{
Vec3f burst_depth[2];
f32 rng;
sin = Math_Sins(var);
cos = Math_Coss(var);
spC8.x = sin * 8.0f;
spC8.y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
spC8.z = cos * 8.0f;
/* burst_depth_x */
burst_depth[0].x = Math_Sins(rando_seed) * 8.0f;
burst_depth[0].y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
burst_depth[0].z = Math_Coss(rando_seed) * 8.0f;
spBC.x = spC8.x * 0.23f;
spBC.y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
spBC.z = spC8.z * 0.23f;
/* burst_depth_y */
burst_depth[1].x = (f32)(burst_depth[0].x * 0.23f);
burst_depth[1].y = (f32)(Math_Rand_ZeroOne() * 5.0f) + 2.0f;
burst_depth[1].z = (f32)(burst_depth[0].z * 0.23f);
spC8.x += actorPos->x;
spC8.y += actorPos->y;
spC8.z += actorPos->z;
VEC3_ADD(burst_depth[0], this->actor.posRot.pos)
rng = Math_Rand_ZeroOne();
if (rng < 0.2f)
{
uVar1 = 0x60;
}
rand = Math_Rand_ZeroOne();
if (rand < 0.2f)
temp = 96;
else if (rand < 0.6f)
temp = 64;
else
{
uVar1 = 0x20;
temp = 32;
if (rng < 0.6f)
{
uVar1 = 0x40;
}
}
/* The Heavy Lifting */
Effect_SpawnFragment(globalCtx, &burst_depth[0], &burst_depth[1], &this->actor.posRot.pos, -239, uVar1, 10, 10, 0,
(Math_Rand_ZeroOne() * 65.0f) + 15.0f, 0, 0x20, 0x3C, -1, 3, DL_SHARD);
shard_count++;
rando_seed = (s32)((rando_seed + 0x4E20) * 0x10000) >> 0x10;
Effect_SpawnFragment(globalCtx, &spC8, &spBC, actorPos, -240, temp, 10, 10, 0,
(Math_Rand_ZeroOne() * 65.0f) + 15.0f, 0, 32, 60, -1, 3, addr);
}
while(shard_count != 15);
func_80033480(globalCtx, &this->actor.posRot.pos, 30.0f, 4, 20, 50, 0);
func_80033480(globalCtx, actorPos, 30.0f, 4, 20, 50, 0);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_Fragments.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_SpawnFragments.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_FragmentsWater(EnTuboTrap* this, GlobalContext* globalCtx)
// regalloc and stack usage differences, most likely the same differences as EnTuboTrap_SpawnFragments
void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx)
{
u32 uVar1;
s32 rando_seed = 0;
s32 shard_count = 0;
Vec3f burst_depth[2];
f32 rng;
Vec3f* actorPos;
f32 rand;
f32 cos;
f32 sin;
u32 addr;
Vec3f spC8;
Vec3f spBC;
s16 var;
s32 temp;
s32 i;
Math_Vec3f_Copy(&burst_depth[0], &this->actor.posRot.pos);
burst_depth[0].y += this->actor.waterSurfaceDist;
addr = &D_05017A60;
actorPos = &this->actor.posRot.pos;
/* spawn a small splash */
func_8002949C(globalCtx, &burst_depth[0], 0, 0, 0, 0x190);
spC8 = *actorPos;
spC8.y += this->actor.unk_84;
/* spawn fragments */
do
func_8002949C(globalCtx, &spC8, 0, 0, 0, 400);
for (i = 0, var = 0; i < 15; i++, var += 20000)
{
/* burst_depth_x */
burst_depth[0].x = Math_Sins(rando_seed) * 8.0f;
burst_depth[0].y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
burst_depth[0].z = Math_Coss(rando_seed) * 8.0f;
sin = Math_Sins(var);
cos = Math_Coss(var);
spC8.x = sin * 8.0f;
spC8.y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
spC8.z = cos * 8.0f;
/* burst_depth_y */
burst_depth[1].x = (f32)(burst_depth[0].x * 0.23f);
burst_depth[1].y = (f32)(Math_Rand_ZeroOne() * 5.0f) + 2.0f;
burst_depth[1].z = (f32)(burst_depth[0].z * 0.23f);
spBC.x = spC8.x * 0.23f;
spBC.y = (Math_Rand_ZeroOne() * 4.0f) + 2.0f;
spBC.z = spC8.z * 0.23f;
VEC3_ADD(burst_depth[0], this->actor.posRot.pos)
spC8.x += actorPos->x;
spC8.y += actorPos->y;
spC8.z += actorPos->z;
rng = Math_Rand_ZeroOne();
if (rng < 0.2f)
{
uVar1 = 0x60;
}
rand = Math_Rand_ZeroOne();
if (rand < 0.2f)
temp = 64;
else
{
uVar1 = 0x20;
temp = 32;
if (rng < 0.6f)
{
uVar1 = 0x40;
}
}
/* The Heavy Lifting */
Effect_SpawnFragment(globalCtx, &burst_depth[0], &burst_depth[1], &this->actor.posRot.pos, -239, uVar1,
10, 10, 0, (Math_Rand_ZeroOne() * 65.0f) + 15.0f, 0, 0x20, 0x3C, -1, 3, DL_SHARD);
shard_count++;
rando_seed = (s32)((rando_seed + 0x4E20) * 0x10000) >> 0x10;
Effect_SpawnFragment(globalCtx, &spC8, &spBC, actorPos, -180, temp, 30, 30, 0,
(Math_Rand_ZeroOne() * 65.0f) + 15.0f, 0, 32, 70, -1, 3, addr);
}
while(shard_count != 15);
func_80033480(globalCtx, &this->actor.posRot.pos, 30.0f, 4, 20, 50, 0);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_FragmentsWater.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_SpawnWaterFragments.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_TestCollider(EnTuboTrap* this, GlobalContext* globalCtx)
void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx)
{
u8 bVar1, bVar2;
u16 uVar3;
Actor* collided_this;
s32 pad;
Player* player = PLAYER;
if (!(this->actor.bgCheckFlags & 20))
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.unk_84 > 15.0f))
{
bVar1 = this->capsule.base.colliderFlags;
EnTuboTrap_SpawnWaterFragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_BOMB_DROP_WATER);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
return;
}
else
if (this->collider.base.colliderFlags & 4)
{
if (this->actor.waterSurfaceDist > 15.0f)
this->collider.base.colliderFlags &= ~4;
EnTuboTrap_SpawnFragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
return;
}
if (this->collider.base.collideFlags & 2)
{
this->collider.base.collideFlags &= ~2;
EnTuboTrap_SpawnFragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_EXPLOSION);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
return;
}
if (this->collider.base.colliderFlags & 2)
{
this->collider.base.colliderFlags &= ~2;
if (this->collider.base.at == &player->actor)
{
EnTuboTrap_FragmentsWater(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_BOMB_DROP_WATER);
EnTuboTrap_SpawnFragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN);
Audio_PlaySoundAtPosition(globalCtx, &player->actor.posRot.pos, 40, 0x83E);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
return;
}
bVar1 = this->capsule.base.collideFlags;
}
if (!(bVar1 & 4))
if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1))
{
bVar2 = this->capsule.base.collideFlags;
if (!(bVar2 & 2))
{
if (!(bVar1 & 2))
{
uVar3 = this->actor.bgCheckFlags;
}
else
{
collided_this = this->capsule.base.actor;
this->capsule.base.colliderFlags = bVar1 & 0xFD;
if (collided_this == &player->actor)
{
EnTuboTrap_Fragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 0x28, NA_SE_EV_POT_BROKEN);
Audio_PlaySoundAtPosition(globalCtx, &player->actor.posRot.pos, 0x28, NA_SE_PL_BODY_HIT);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
return;
}
uVar3 = this->actor.bgCheckFlags;
}
if ((uVar3 & 8) || (uVar3 & 1))
{
EnTuboTrap_Fragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 0x28, NA_SE_EV_POT_BROKEN);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
}
}
else
{
this->capsule.base.collideFlags = bVar2 & 0xFD;
EnTuboTrap_Fragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 0x28, NA_SE_EV_EXPLOSION);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 0x28, NA_SE_EV_POT_BROKEN);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
}
}
else
{
this->capsule.base.colliderFlags = bVar1 & 0xFB;
EnTuboTrap_Fragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 0x28, NA_SE_IT_SHIELD_REFLECT_SW);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 0x28, NA_SE_EV_POT_BROKEN);
EnTuboTrap_SpawnFragments(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_Kill(&this->actor);
return;
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_TestCollider.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_HandleImpact.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_TestLevitate(EnTuboTrap* this, GlobalContext* globalCtx)
void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx)
{
Player* player = PLAYER;
f32 seekY;
f32 targetHeight;
if (BREG(2) != 0)
{
osSyncPrintf("[32m☆☆☆☆☆ わて ☆☆☆☆☆ %f\n", globalCtx, this->actor.posRot.pos.y);
osSyncPrintf("[32m☆☆☆☆☆ おいどん ☆☆☆☆☆ %f\n");
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ わて ☆☆☆☆☆ %f\n" VT_RST, this->actor.posRot.pos.y); // "You"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ おいどん ☆☆☆☆☆ %f\n" VT_RST, player->actor.posRot.pos.y); // "Me"
osSyncPrintf("\n\n");
}
if (this->actor.xzDistanceFromLink < 200.00000000 && this->actor.posRot.pos.y <= player->actor.posRot.pos.y)
if (this->actor.xzDistanceFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y)
{
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, this, ACTORTYPE_ENEMY);
this->actor.flags |= 1;
seekY = (f32)gSaveContext.link_age * -10.00000000 + 40.00000000;
this->pos_y_seek = player->actor.posRot.pos.y;
targetHeight = 40.0f + -10.0f * gSaveContext.link_age;
if (this->pos_y_seek < this->actor.posRot.pos.y)
this->pos_y_seek = this->actor.posRot.pos.y + seekY;
this->actor.initPosRot.pos = this->actor.posRot.pos;
this->targetY = player->actor.posRot.pos.y + targetHeight;
if (this->targetY < this->actor.posRot.pos.y)
this->targetY = this->actor.posRot.pos.y + targetHeight;
this->originPos = this->actor.posRot.pos;
Audio_PlayActorSound2(this, NA_SE_EV_POT_MOVE_START);
this->playfunc = (ActorFunc)EnTuboTrap_InitializeAttack;
this->actionFunc = (ActorFunc)EnTuboTrap_Levitate;
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_TestLevitate.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_InitializeAttack(EnTuboTrap* this, GlobalContext* globalCtx)
void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx)
{
this->actor.posRot.rot.y += 5000;
Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->pos_y_seek, 0.8f, 3.0f); /* Tween levitation */
this->actor.shape.rot.y += 5000;
Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->targetY, 0.8f, 3.0f);
if (ABS(this->actor.posRot.pos.y - this->pos_y_seek) < 10.0f)
if (fabsf(this->actor.posRot.pos.y - this->targetY) < 10.0f)
{
this->actor.speedXZ = 10.0f;
this->actor.posRot.rot.y = this->actor.rotTowardsLinkY;
this->playfunc = (ActorFunc)EnTuboTrap_Fly;
this->actionFunc = (ActorFunc)EnTuboTrap_Fly;
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_InitializeAttack.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx)
{
Vec3f pos_delta;
f32 dx = this->originPos.x - this->actor.posRot.pos.x;
f32 dy = this->originPos.y - this->actor.posRot.pos.y;
f32 dz = this->originPos.z - this->actor.posRot.pos.z;
VEC3_SUB(pos_delta, this->pos_init, this->actor.posRot.pos);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_TUBOOCK_FLY);
Audio_PlayActorSound2(&this->actor, 0x3037);
if (240.0f < sqrtf(SQ(pos_delta.x) + SQ(pos_delta.y) + SQ(pos_delta.z)))
Math_SmoothScaleMaxF(&this->actor.gravity, -3.0f, 0.2f, 0.5f); /* Tween to ground */
if (240.0f < sqrtf(SQ(dx) + SQ(dy) + SQ(dz)))
Math_SmoothScaleMaxF(&this->actor.gravity, -3.0f, 0.2f, 0.5f);
this->actor.posRot.rot.y += 5000;
EnTuboTrap_TestCollider(this, globalCtx);
this->actor.shape.rot.y += 5000;
EnTuboTrap_HandleImpact(this, globalCtx);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_Fly.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_Update(EnTuboTrap* this, GlobalContext* globalCtx)
{
this->playfunc(this, globalCtx);
Actor_MoveForward(&this->actor); /* Probably to haul ass towards Link */
func_8002E4B4(globalCtx, &this->actor, 10.0f, 10.0f, 20.0f, 0x1D); /* Necessary for drawing a shadow */
Actor_SetHeight(&this->actor, 0.0f);
ActorCollider_Cylinder_Update(&this->actor, &this->capsule);
Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->capsule);
Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->capsule);
EnTuboTrap* tuboTrap = this;
SubGlobalContext11E60* sub_11E60 = &globalCtx->sub_11E60;
tuboTrap->actionFunc(tuboTrap, globalCtx);
Actor_MoveForward(&tuboTrap->actor);
func_8002E4B4(globalCtx, &tuboTrap->actor, 10.0f, 10.0f, 20.0f, 0x1D);
Actor_SetHeight(&tuboTrap->actor, 0.0f);
ActorCollider_Cylinder_Update(&tuboTrap->actor, &tuboTrap->collider);
Actor_CollisionCheck_SetAC(globalCtx, sub_11E60, &tuboTrap->collider);
Actor_CollisionCheck_SetAT(globalCtx, sub_11E60, &tuboTrap->collider);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_Update.s")
#endif
void EnTuboTrap_Draw(EnTuboTrap* this, GlobalContext* globalCtx)
{
Draw_DListOpa(globalCtx, &DL_TUBO);
Draw_DListOpa(globalCtx, D_05017870);
}

View file

@ -0,0 +1,18 @@
#ifndef _Z_EN_TUBO_TRAP_H_
#define _Z_EN_TUBO_TRAP_H_
#include <ultra64.h>
#include <global.h>
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ ActorFunc actionFunc;
/* 0x0150 */ f32 targetY;
/* 0x0154 */ Vec3f originPos;
/* 0x0160 */ ColliderCylinderMain collider;
} EnTuboTrap; // size = 0x01AC
extern const ActorInit En_Tubo_Trap_InitVars;
#endif

View file

@ -14,7 +14,6 @@ typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x018C */ char unk_18C[0x4];
/* 0x0190 */ ActorFunc actionFunc;
/* 0x0194 */ s16 timer;
/* 0x0196 */ s16 switchFlag;

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;
}