Initial documentation pass

This commit is contained in:
tom-overton 2021-11-05 05:17:53 -07:00
parent a8ce29dbe0
commit 7bec2709bb
3 changed files with 342 additions and 314 deletions

View File

@ -15,31 +15,39 @@ void ObjTokeidai_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjTokeidai_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjTokeidai_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80AB319C(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3240(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_CollapseGear(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TransformedGearIdle(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB32F0(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3370(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB34CC(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3544(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3598(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB363C(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB365C(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3808(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3880(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB38B0(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB39BC(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3A7C(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3B34(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3BD8(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3BE8(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TransformedClockIdle(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_CollapseTop(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TransformedTopIdle(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_CollapseWalls(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_WallsIdle(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TowerTransformationFinish(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TowerTransformationWait(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TowerTopFall(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TowerRaiseFinished(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_RaiseTower(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_TowerTransformationStart(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_DoNothing(ObjTokeidai* this, GlobalContext* globalCtx);
void ObjTokeidai_StaircaseIntoTowerIdle(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3ED0(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB4040(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB4080(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB4160(ObjTokeidai* this, GlobalContext* globalCtx);
void func_80AB3BB0(ObjTokeidai* this);
void func_80AB4394(Actor* thisx, GlobalContext* globalCtx);
void func_80AB4664(Actor* thisx, GlobalContext* globalCtx);
void func_80AB4894(Actor* thisx, GlobalContext* globalCtx);
void ObjTokeidai_SetupTowerTransformationStart(ObjTokeidai* this);
void ObjTokeidai_DrawClock(Actor* thisx, GlobalContext* globalCtx);
void ObjTokeidai_DrawTowerTop(Actor* thisx, GlobalContext* globalCtx);
void ObjTokeidai_DrawTowerGear(Actor* thisx, GlobalContext* globalCtx);
// Silly overload defines that I'm not sure I should even be doing
#define settleTimer clockFaceAdditionalRotation
#define unk_154 clockFaceAdditionalRotation
#define settleAmount clockFaceRotationTimer
#define unk_156 clockFaceRotationTimer
#define unk_15C sunMoonDiskAdditionalRotation
#define lightIntensity clockHour
const ActorInit Obj_Tokeidai_InitVars = {
ACTOR_OBJ_TOKEIDAI,
@ -61,59 +69,59 @@ static InitChainEntry D_80AB49E0[] = {
ICHAIN_F32(uncullZoneForward, 1100, ICHAIN_STOP),
};
extern Gfx D_06009A08[];
extern Gfx D_0600B0C0[];
extern Gfx D_0600B208[];
extern Gfx D_0600BA78[];
extern Gfx D_0600BEE8[];
extern Gfx D_0600C368[];
extern Gfx D_0600CF28[];
extern Gfx D_0600D388[];
extern Gfx D_0600D8E0[];
extern Gfx D_0600D8E8[];
extern Gfx D_0600E818[];
extern Gfx D_0600F518[];
extern Gfx D_06009A08[]; // central part of the tower
extern Gfx D_0600B0C0[]; // light beam
extern Gfx D_0600B208[]; // thing at the top of the tower
extern Gfx D_0600BA78[]; // gear on the side of the tower
extern Gfx D_0600BEE8[]; // clock center and "hand"
extern Gfx D_0600C368[]; // sun and moon circle
extern Gfx D_0600CF28[]; // outer ring of the clock face
extern Gfx D_0600D388[]; // tower base?
extern Gfx D_0600D8E0[]; // empty dlist
extern Gfx D_0600D8E8[]; // spiral staircase to tower interior
extern Gfx D_0600E818[]; // clock tower clock face
extern Gfx D_0600F518[]; // small and very small clock face
s32 func_80AB2790() {
s32 ObjTokeidai_GetTargetSunMoonDiskRotation() {
if (gSaveContext.isNight) {
return 0x8000;
}
return 0;
}
void func_80AB27B4(ObjTokeidai* this) {
s32 temp;
void ObjTokeidai_SetupClockOrGear(ObjTokeidai* this) {
s32 currentMinute;
temp = (s32)(this->unk_170 * 0.010986328f) % 0x1E;
this->unk_168 = temp;
this->unk_14C = temp * 2184.5334f;
this->unk_14E = 0x3C;
this->unk_150 = 0;
currentMinute = OBJ_TOKEIDAI_GET_CURRENT_MINUTE(this);
this->clockMinute = currentMinute;
this->outerRingOrGearRotation = OBJ_TOKEIDAI_GET_OUTER_RING_OR_GEAR_ROTATION(currentMinute);
this->outerRingOrGearAdditionalRotation = 0x3C;
this->outerRingOrGearRotationTimer = 0;
}
void func_80AB2834(ObjTokeidai* this) {
s32 temp;
void ObjTokeidai_InitClock(ObjTokeidai* this) {
s32 currentHour;
func_80AB27B4(this);
temp = (s32)(this->unk_170 * 0.00036621094f);
this->unk_16C = temp;
this->unk_152 = temp * 2730.6667f;
this->unk_154 = 0;
this->unk_156 = 0;
this->unk_15C = 0;
this->unk_158 = func_80AB2790();
ObjTokeidai_SetupClockOrGear(this);
currentHour = OBJ_TOKEIDAI_GET_CURRENT_HOUR(this);
this->clockHour = currentHour;
this->clockFaceRotation = OBJ_TOKEIDAI_GET_CLOCK_FACE_ROTATION(currentHour);
this->clockFaceAdditionalRotation = 0;
this->clockFaceRotationTimer = 0;
this->sunMoonDiskAdditionalRotation = 0;
this->sunMoonDiskRotation = ObjTokeidai_GetTargetSunMoonDiskRotation();
}
void func_80AB28C8(ObjTokeidai* this, GlobalContext* globalCtx) {
this->actor.draw = func_80AB4894;
this->unk_144 = D_0600BA78;
func_80AB27B4(this);
void ObjTokeidai_InitTowerGear(ObjTokeidai* this, GlobalContext* globalCtx) {
this->actor.draw = ObjTokeidai_DrawTowerGear;
this->opaDList = D_0600BA78;
ObjTokeidai_SetupClockOrGear(this);
if ((globalCtx->sceneNum == SCENE_CLOCKTOWER && gSaveContext.sceneSetupIndex == 2 &&
globalCtx->csCtx.unk_12 == 0) ||
(globalCtx->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 2 && globalCtx->csCtx.unk_12 == 0)) {
func_80AB3BB0(this);
ObjTokeidai_SetupTowerTransformationStart(this);
} else if ((gSaveContext.day % 5 == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || gSaveContext.day % 5 >= 4) {
this->actionFunc = func_80AB3240;
this->actionFunc = ObjTokeidai_TransformedGearIdle;
this->actor.world.pos.y += this->actor.scale.y * 1900.0f;
this->actor.shape.yOffset = 1500.0f;
gSaveContext.weekEventReg[8] |= 0x40;
@ -122,66 +130,66 @@ void func_80AB28C8(ObjTokeidai* this, GlobalContext* globalCtx) {
}
}
void func_80AB29F8(ObjTokeidai* this, GlobalContext* globalCtx) {
this->actor.draw = func_80AB4394;
func_80AB2834(this);
void ObjTokeidai_InitTowerClock(ObjTokeidai* this, GlobalContext* globalCtx) {
this->actor.draw = ObjTokeidai_DrawClock;
ObjTokeidai_InitClock(this);
if ((globalCtx->sceneNum == SCENE_CLOCKTOWER && gSaveContext.sceneSetupIndex == 2 &&
globalCtx->csCtx.unk_12 == 0) ||
(globalCtx->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 2 && globalCtx->csCtx.unk_12 == 0)) {
func_80AB3BB0(this);
ObjTokeidai_SetupTowerTransformationStart(this);
} else if ((gSaveContext.day % 5 == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || gSaveContext.day % 5 >= 4) {
this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f;
this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f;
this->actor.world.pos.z += -Math_CosS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f;
this->unk_162 = -0x140;
this->clockFaceZTranslation = -0x140;
this->actor.shape.rot.x = -0x4000;
this->actor.home.pos = this->actor.world.pos;
this->actor.home.pos.y -= 1178.0f;
this->actor.home.pos.z += 13.0f;
this->actionFunc = func_80AB34CC;
this->actionFunc = ObjTokeidai_TransformedClockIdle;
} else {
this->actionFunc = func_80AB3ED0;
}
}
void func_80AB2BBC(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_InitTowerTop(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 type;
this->actor.draw = func_80AB4664;
this->unk_144 = D_0600B208;
this->unk_148 = D_0600B0C0;
this->actor.draw = ObjTokeidai_DrawTowerTop;
this->opaDList = D_0600B208;
this->xluDList = D_0600B0C0;
if (gSaveContext.isNight) {
this->unk_16C = 100;
this->lightIntensity = 100;
} else {
this->unk_16C = 0;
this->lightIntensity = 0;
}
if ((globalCtx->sceneNum == SCENE_CLOCKTOWER && gSaveContext.sceneSetupIndex == 2 &&
globalCtx->csCtx.unk_12 == 0) ||
(globalCtx->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 2 && globalCtx->csCtx.unk_12 == 0)) {
this->unk_16C = 0;
func_80AB3BB0(this);
this->lightIntensity = 0;
ObjTokeidai_SetupTowerTransformationStart(this);
if (this->actor.child == NULL) {
type = OBJ_TOKEIDAI_TYPE(&this->actor);
if (type == 3 || type == 6) {
if (type == OBJ_TOKEIDAI_TYPE_TOWER_TOP_CLOCK_TOWN || type == OBJ_TOKEIDAI_TYPE_TOWER_TOP_TERMINA_FIELD) {
this->actor.child =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HANABI, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
}
}
if (this->actor.child != NULL) {
if (OBJ_TOKEIDAI_TYPE(&this->actor) == 6) {
if (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_TOP_TERMINA_FIELD) {
this->actor.child->home.rot.x = 0x384;
} else {
this->actor.child->home.rot.x = 0x12C;
}
}
} else if ((gSaveContext.day % 5 == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || gSaveContext.day % 5 >= 4) {
this->unk_16C = 0;
this->lightIntensity = 0;
this->actor.world.pos.y += this->actor.scale.y * -2160.0f;
this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 5400.0f;
this->actor.world.pos.z += -Math_CosS(this->actor.world.rot.y) * this->actor.scale.z * 5400.0f;
this->actor.shape.rot.x = -0x4000;
this->actionFunc = func_80AB3598;
this->actionFunc = ObjTokeidai_TransformedTopIdle;
} else {
this->actionFunc = func_80AB4160;
}
@ -191,60 +199,60 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjTokeidai* this = THIS;
Actor_ProcessInitChain(&this->actor, D_80AB49E0);
this->actionFunc = func_80AB3BD8;
this->unk_144 = NULL;
this->unk_148 = NULL;
this->unk_160 = 0;
this->unk_15E = 0;
this->unk_162 = 0;
this->unk_170 = gSaveContext.time;
this->actionFunc = ObjTokeidai_DoNothing;
this->opaDList = NULL;
this->xluDList = NULL;
this->xRotation = 0;
this->yTranslation = 0;
this->clockFaceZTranslation = 0;
this->currentTime = gSaveContext.time;
this->actor.home.rot.x = 0;
switch (OBJ_TOKEIDAI_TYPE(&this->actor)) {
case 4:
case OBJ_TOKEIDAI_TYPE_TOWER_GEAR_TERMINA_FIELD:
Actor_SetScale(&this->actor, 0.15f);
func_80AB28C8(this, globalCtx);
ObjTokeidai_InitTowerGear(this, globalCtx);
break;
case 0:
func_80AB28C8(this, globalCtx);
case OBJ_TOKEIDAI_TYPE_TOWER_GEAR_CLOCK_TOWN:
ObjTokeidai_InitTowerGear(this, globalCtx);
break;
case 1:
this->unk_144 = D_0600D388;
case OBJ_TOKEIDAI_TYPE_UNUSED_WALL:
this->opaDList = D_0600D388;
break;
case 8:
case OBJ_TOKEIDAI_TYPE_TOWER_WALLS_TERMINA_FIELD:
Actor_SetScale(&this->actor, 1.0f);
this->unk_144 = D_06009A08;
this->actionFunc = func_80AB365C;
this->opaDList = D_06009A08;
this->actionFunc = ObjTokeidai_WallsIdle;
break;
case 5:
case OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD:
Actor_SetScale(&this->actor, 0.15f);
func_80AB29F8(this, globalCtx);
ObjTokeidai_InitTowerClock(this, globalCtx);
break;
case 2:
func_80AB29F8(this, globalCtx);
case OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN:
ObjTokeidai_InitTowerClock(this, globalCtx);
break;
case 9:
case OBJ_TOKEIDAI_TYPE_SMALL_CLOCK:
Actor_SetScale(&this->actor, 0.02f);
this->actor.draw = func_80AB4394;
func_80AB2834(this);
this->actor.draw = ObjTokeidai_DrawClock;
ObjTokeidai_InitClock(this);
this->actionFunc = func_80AB4040;
break;
case 10:
case OBJ_TOKEIDAI_TYPE_VERY_SMALL_CLOCK:
Actor_SetScale(&this->actor, 0.01f);
this->actor.draw = func_80AB4394;
func_80AB2834(this);
this->actor.draw = ObjTokeidai_DrawClock;
ObjTokeidai_InitClock(this);
this->actionFunc = func_80AB4040;
break;
case 6:
case OBJ_TOKEIDAI_TYPE_TOWER_TOP_TERMINA_FIELD:
Actor_SetScale(&this->actor, 0.15f);
func_80AB2BBC(this, globalCtx);
ObjTokeidai_InitTowerTop(this, globalCtx);
break;
case 3:
func_80AB2BBC(this, globalCtx);
case OBJ_TOKEIDAI_TYPE_TOWER_TOP_CLOCK_TOWN:
ObjTokeidai_InitTowerTop(this, globalCtx);
break;
case 11:
this->unk_144 = D_0600D8E8;
this->unk_148 = D_0600D8E0;
this->actionFunc = func_80AB3BE8;
case OBJ_TOKEIDAI_TYPE_STAIRCASE_INTO_TOWER:
this->opaDList = D_0600D8E8;
this->xluDList = D_0600D8E0;
this->actionFunc = ObjTokeidai_StaircaseIntoTowerIdle;
break;
}
}
@ -252,38 +260,38 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) {
void ObjTokeidai_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80AB3010(ObjTokeidai* this, s32 arg1) {
s32 temp;
void func_80AB3010(ObjTokeidai* this, s32 playSound) {
s32 currentMinute;
temp = (s32)(this->unk_170 * 0.010986328f) % 0x1E;
if (temp != this->unk_168) {
if ((this->unk_150 == 8) && (arg1 != 0)) {
currentMinute = OBJ_TOKEIDAI_GET_CURRENT_MINUTE(this);
if (currentMinute != this->clockMinute) {
if (this->outerRingOrGearRotationTimer == 8 && playSound) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CLOCK_TOWER_SECOND_HAND);
}
if (this->unk_150 >= 9) {
this->unk_14E += 0x3C;
this->unk_14C += this->unk_14E;
if (this->outerRingOrGearRotationTimer >= 9) {
this->outerRingOrGearAdditionalRotation += 0x3C;
this->outerRingOrGearRotation += this->outerRingOrGearAdditionalRotation;
} else {
if ((this->unk_150 & 3) == 0) {
this->unk_14C += 0x5A;
if ((this->outerRingOrGearRotationTimer & 3) == 0) {
this->outerRingOrGearRotation += 0x5A;
}
if ((this->unk_150 & 3) == 1) {
this->unk_14C -= 0x5A;
if ((this->outerRingOrGearRotationTimer & 3) == 1) {
this->outerRingOrGearRotation -= 0x5A;
}
}
this->unk_150++;
if ((temp == 0xF && this->unk_14C < 0) || (temp != 0xF && this->unk_14C > (s16)(temp * 2184.5334f))) {
this->unk_14C = temp * 2184.5334f;
this->unk_168 = temp;
this->unk_14E = 0x5A;
this->unk_150 = 0;
this->outerRingOrGearRotationTimer++;
if ((currentMinute == 15 && this->outerRingOrGearRotation < 0) || (currentMinute != 15 && this->outerRingOrGearRotation > OBJ_TOKEIDAI_GET_OUTER_RING_OR_GEAR_ROTATION(currentMinute))) {
this->outerRingOrGearRotation = OBJ_TOKEIDAI_GET_OUTER_RING_OR_GEAR_ROTATION(currentMinute);
this->clockMinute = currentMinute;
this->outerRingOrGearAdditionalRotation = 0x5A;
this->outerRingOrGearRotationTimer = 0;
}
}
}
void func_80AB319C(ObjTokeidai* this, GlobalContext* globalCtx) {
if ((this->actor.bgCheckFlags & 1) != 0 || this->actor.world.pos.y < 0.0f) {
this->actionFunc = func_80AB3BD8;
void ObjTokeidai_CollapseGear(ObjTokeidai* this, GlobalContext* globalCtx) {
if ((this->actor.bgCheckFlags & 1) || this->actor.world.pos.y < 0.0f) {
this->actionFunc = ObjTokeidai_DoNothing;
return;
}
this->actor.shape.rot.x += 0x50;
@ -292,10 +300,10 @@ void func_80AB319C(ObjTokeidai* this, GlobalContext* globalCtx) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
}
void func_80AB3240(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TransformedGearIdle(ObjTokeidai* this, GlobalContext* globalCtx) {
if (func_800EE29C(globalCtx, 0x84) != 0) {
if (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x84)]->unk0 == 2) {
this->actionFunc = func_80AB319C;
this->actionFunc = ObjTokeidai_CollapseGear;
this->actor.speedXZ = this->actor.scale.y * 5.0f;
this->actor.velocity.y = 0.0f;
this->actor.minVelocityY = this->actor.scale.y * -50.0f;
@ -312,7 +320,7 @@ void func_80AB32F0(ObjTokeidai* this, GlobalContext* globalCtx) {
this->actor.world.pos.z += 4.0f;
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
if (this->actor.world.pos.y < 0.0f) {
this->actionFunc = func_80AB3BD8;
this->actionFunc = ObjTokeidai_DoNothing;
}
}
@ -351,7 +359,7 @@ void func_80AB3370(ObjTokeidai* this, GlobalContext* globalCtx) {
thisx->world.pos.z = (1178.0f * sin) + (this->unk_156 * cos) + thisx->home.pos.z;
}
void func_80AB34CC(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TransformedClockIdle(ObjTokeidai* this, GlobalContext* globalCtx) {
if (func_800EE29C(globalCtx, 0x84) != 0 && globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x84)]->unk0 == 1) {
this->actionFunc = func_80AB3370;
this->unk_154 = 0;
@ -359,20 +367,20 @@ void func_80AB34CC(ObjTokeidai* this, GlobalContext* globalCtx) {
}
}
void func_80AB3544(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_CollapseTop(ObjTokeidai* this, GlobalContext* globalCtx) {
if (this->actor.world.pos.y < 0.0f) {
this->actionFunc = func_80AB3BD8;
this->actionFunc = ObjTokeidai_DoNothing;
return;
}
this->unk_160 += 0x64;
this->xRotation += 0x64;
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
}
void func_80AB3598(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TransformedTopIdle(ObjTokeidai* this, GlobalContext* globalCtx) {
if (func_800EE29C(globalCtx, 0x84) != 0) {
if (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x84)]->unk0 == 3) {
this->actionFunc = func_80AB3544;
this->unk_160 = 0;
this->actionFunc = ObjTokeidai_CollapseTop;
this->xRotation = 0;
this->actor.velocity.y = 0.0f;
this->actor.minVelocityY = this->actor.scale.y * -50.0f;
this->actor.gravity = this->actor.scale.y * -5.0f;
@ -380,19 +388,19 @@ void func_80AB3598(ObjTokeidai* this, GlobalContext* globalCtx) {
}
}
void func_80AB363C(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_CollapseWalls(ObjTokeidai* this, GlobalContext* globalCtx) {
if (this->actor.shape.rot.x < 0x4000) {
this->actor.shape.rot.x += +0x28;
}
}
void func_80AB365C(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_WallsIdle(ObjTokeidai* this, GlobalContext* globalCtx) {
if (func_800EE29C(globalCtx, 0x84) != 0 && globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x84)]->unk0 == 1) {
this->actionFunc = func_80AB363C;
this->actionFunc = ObjTokeidai_CollapseWalls;
}
}
void func_80AB36C4(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TowerTransformationEndCutscene(ObjTokeidai* this, GlobalContext* globalCtx) {
if (func_800EE29C(globalCtx, 0x84) != 0 && globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x84)]->unk0 == 5) {
gSaveContext.weekEventReg[8] |= 0x40;
if ((globalCtx->sceneNum == SCENE_CLOCKTOWER && gSaveContext.sceneSetupIndex == 2 &&
@ -412,21 +420,21 @@ void func_80AB36C4(ObjTokeidai* this, GlobalContext* globalCtx) {
gSaveContext.nextTransition = 2;
}
}
this->actionFunc = func_80AB3BD8;
this->actionFunc = ObjTokeidai_DoNothing;
}
}
void func_80AB3808(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TowerTransformationFinish(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 type;
if (this->unk_162 >= -0x13F) {
this->unk_162 -= 0xA;
if (this->clockFaceZTranslation >= -0x13F) {
this->clockFaceZTranslation -= 0xA;
} else {
type = OBJ_TOKEIDAI_TYPE(&this->actor);
if ((type == 2) || (type == 5)) {
func_80AB36C4(this, globalCtx);
if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) {
ObjTokeidai_TowerTransformationEndCutscene(this, globalCtx);
} else {
this->actionFunc = func_80AB3BD8;
this->actionFunc = ObjTokeidai_DoNothing;
if (this->actor.child != NULL) {
this->actor.child->home.rot.x = 0;
}
@ -434,24 +442,24 @@ void func_80AB3808(ObjTokeidai* this, GlobalContext* globalCtx) {
}
}
void func_80AB3880(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TowerTransformationWait(ObjTokeidai* this, GlobalContext* globalCtx) {
if (this->unk_154 > 0) {
this->unk_154--;
} else {
this->actionFunc = func_80AB3808;
this->actionFunc = ObjTokeidai_TowerTransformationFinish;
this->unk_154 = 0;
}
}
void func_80AB38B0(ObjTokeidai* this, GlobalContext* globalCtx) {
this->unk_160 += this->unk_154;
if (this->unk_160 < 0x4000) {
void ObjTokeidai_TowerTopFall(ObjTokeidai* this, GlobalContext* globalCtx) {
this->xRotation += this->unk_154;
if (this->xRotation < 0x4000) {
this->unk_154 += this->unk_156;
return;
}
this->unk_156 = 0x14;
this->unk_160 = 0x4000;
switch (this->unk_164) {
this->xRotation = 0x4000;
switch (this->reboundCount) {
case 0:
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_0);
break;
@ -462,85 +470,85 @@ void func_80AB38B0(ObjTokeidai* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_2);
break;
}
this->unk_164 += 1;
this->reboundCount += 1;
if (this->unk_154 >= 0x191) {
this->unk_154 = -0xC8;
} else if (this->unk_154 >= 0x33) {
this->unk_154 = -(this->unk_154 >> 1);
} else {
this->actionFunc = func_80AB3880;
this->actionFunc = ObjTokeidai_TowerTransformationWait;
this->unk_154 = 0xA;
}
}
void func_80AB39BC(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TowerRaiseFinished(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 type;
if (this->unk_154 > 0) {
if ((this->unk_154 & 1) != 0) {
this->unk_15E = this->unk_156 + 0xD48;
if (this->settleTimer > 0) {
if ((this->settleTimer & 1) != 0) {
this->yTranslation = this->settleAmount + 3400;
} else {
this->unk_15E = 0xD48 - this->unk_156;
if (this->unk_156 > 0) {
this->unk_156 -= 4;
this->yTranslation = 3400 - this->settleAmount;
if (this->settleAmount > 0) {
this->settleAmount -= 4;
}
}
this->unk_154 += -1;
this->settleTimer--;
} else {
type = OBJ_TOKEIDAI_TYPE(&this->actor);
if ((type == 2) || (type == 5)) {
if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CLOCK_TOWER_FALL);
}
this->unk_15E = 0xD48;
this->actionFunc = func_80AB38B0;
this->yTranslation = 3400;
this->actionFunc = ObjTokeidai_TowerTopFall;
this->unk_154 = 0;
this->unk_156 = 0xA;
this->unk_164 = 0;
this->reboundCount = 0;
}
}
void func_80AB3A7C(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_RaiseTower(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 type;
if (this->unk_15E < 0xD48) {
if (this->yTranslation < 3400) {
type = OBJ_TOKEIDAI_TYPE(&this->actor);
this->unk_15E += 0x19;
if ((type == 2) || (type == 5)) {
this->yTranslation += 0x19;
if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) {
func_800B9010(&this->actor, NA_SE_EV_CLOCK_TOWER_UP - SFX_FLAG);
}
} else {
type = OBJ_TOKEIDAI_TYPE(&this->actor);
if ((type == 2) || (type == 5)) {
if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CLOCK_TOWER_STOP);
}
this->unk_15E = 0xD48;
this->actionFunc = func_80AB39BC;
this->unk_154 = 0xA;
this->unk_156 = 0x14;
this->yTranslation = 3400;
this->actionFunc = ObjTokeidai_TowerRaiseFinished;
this->settleTimer = 10;
this->settleAmount = 20;
}
}
void func_80AB3B34(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_TowerTransformationStart(ObjTokeidai* this, GlobalContext* globalCtx) {
if ((func_800EE29C(globalCtx, 0x84) != 0 &&
globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x84)]->unk0 == 4) ||
((gSaveContext.weekEventReg[8] & 0x40) != 0)) {
this->actionFunc = func_80AB3A7C;
this->actionFunc = ObjTokeidai_RaiseTower;
}
}
void func_80AB3BB0(ObjTokeidai* this) {
this->actionFunc = func_80AB3B34;
void ObjTokeidai_SetupTowerTransformationStart(ObjTokeidai* this) {
this->actionFunc = ObjTokeidai_TowerTransformationStart;
this->unk_154 = 0;
this->unk_156 = 0;
this->unk_15E = 0;
this->unk_160 = 0;
this->unk_162 = 0;
this->yTranslation = 0;
this->xRotation = 0;
this->clockFaceZTranslation = 0;
}
void func_80AB3BD8(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_DoNothing(ObjTokeidai* this, GlobalContext* globalCtx) {
}
void func_80AB3BE8(ObjTokeidai* this, GlobalContext* globalCtx) {
void ObjTokeidai_StaircaseIntoTowerIdle(ObjTokeidai* this, GlobalContext* globalCtx) {
if ((gSaveContext.day % 5 == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || (gSaveContext.day % 5 >= 4) ||
((gSaveContext.weekEventReg[8] & 0x40) != 0)) {
this->actor.draw = ObjTokeidai_Draw;
@ -551,131 +559,133 @@ void func_80AB3BE8(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 func_80AB3C50(ObjTokeidai* this, GlobalContext* globalCtx) {
if (gSaveContext.inventory.items[0] == 0xFF) {
return 0;
return false;
}
if (gSaveContext.day % 5 == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) {
func_80AB3BB0(this);
return 1;
ObjTokeidai_SetupTowerTransformationStart(this);
return true;
}
return 0;
return false;
}
void func_80AB3CCC(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 temp;
s32 currentHour;
temp = (s32)(this->unk_170 * 0.00036621094f);
if (temp != this->unk_16C) {
if (this->unk_156 >= 0xD) {
this->unk_154 += 0xA;
this->unk_152 += this->unk_154;
currentHour = OBJ_TOKEIDAI_GET_CURRENT_HOUR(this);
if (currentHour != this->clockHour) {
if (this->clockFaceRotationTimer >= 13) {
this->clockFaceAdditionalRotation += 0xA;
this->clockFaceRotation += this->clockFaceAdditionalRotation;
} else {
if ((this->unk_156 & 3) == 0) {
this->unk_152 += 0x3C;
if ((this->clockFaceRotationTimer & 3) == 0) {
this->clockFaceRotation += 0x3C;
}
if ((this->unk_156 & 3) == 1) {
this->unk_152 -= 0x3C;
if ((this->clockFaceRotationTimer & 3) == 1) {
this->clockFaceRotation -= 0x3C;
}
}
this->unk_156++;
if ((temp == 0xC && this->unk_152 < 0) || (temp != 0xC && this->unk_152 > (s16)(temp * 2730.6667f))) {
this->unk_152 = temp * 2730.6667f;
this->unk_16C = temp;
this->unk_154 = 0;
this->unk_156 = 0;
this->clockFaceRotationTimer++;
if ((currentHour == 12 && this->clockFaceRotation < 0) || (currentHour != 12 && this->clockFaceRotation > OBJ_TOKEIDAI_GET_CLOCK_FACE_ROTATION(currentHour))) {
this->clockFaceRotation = OBJ_TOKEIDAI_GET_CLOCK_FACE_ROTATION(currentHour);
this->clockHour = currentHour;
this->clockFaceAdditionalRotation = 0;
this->clockFaceRotationTimer = 0;
}
}
if (this->unk_158 != func_80AB2790()) {
if (this->unk_16C == 6) {
this->unk_15C += 0x222;
this->unk_158 += this->unk_15C;
if (this->unk_158 >= 0x10001) {
this->unk_158 = func_80AB2790();
this->unk_15C = 0;
if (this->sunMoonDiskRotation != ObjTokeidai_GetTargetSunMoonDiskRotation()) {
if (this->clockHour == 6) {
this->sunMoonDiskAdditionalRotation += 0x222;
this->sunMoonDiskRotation += this->sunMoonDiskAdditionalRotation;
if (this->sunMoonDiskRotation >= 0x10001) {
this->sunMoonDiskRotation = ObjTokeidai_GetTargetSunMoonDiskRotation();
this->sunMoonDiskAdditionalRotation = 0;
}
}
if (this->unk_16C == 0x12) {
this->unk_15C += 0x222;
this->unk_158 += this->unk_15C;
if (this->unk_158 >= 0x8001) {
this->unk_158 = func_80AB2790();
this->unk_15C = 0;
if (this->clockHour == 18) {
this->sunMoonDiskAdditionalRotation += 0x222;
this->sunMoonDiskRotation += this->sunMoonDiskAdditionalRotation;
if (this->sunMoonDiskRotation >= 0x8001) {
this->sunMoonDiskRotation = ObjTokeidai_GetTargetSunMoonDiskRotation();
this->sunMoonDiskAdditionalRotation = 0;
}
}
}
}
void func_80AB3ED0(ObjTokeidai* this, GlobalContext* globalCtx) {
if (gSaveContext.day % 5 == 3 && this->unk_16C < 6 && gSaveContext.time < CLOCK_TIME(6, 0)) {
this->actor.draw = func_80AB4394;
func_80AB3BB0(this);
if (gSaveContext.day % 5 == 3 && this->clockHour < 6 && gSaveContext.time < CLOCK_TIME(6, 0)) {
this->actor.draw = ObjTokeidai_DrawClock;
ObjTokeidai_SetupTowerTransformationStart(this);
gSaveContext.weekEventReg[8] |= 0x40;
return;
}
if (globalCtx->csCtx.state != 0) {
this->actor.home.rot.x = 1;
this->unk_170 += 3;
this->actor.draw = func_80AB4394;
this->currentTime += 3;
this->actor.draw = ObjTokeidai_DrawClock;
} else {
if ((globalCtx->actorCtx.unk5 & 2) == 0 && OBJ_TOKEIDAI_TYPE(&this->actor) == 5 &&
if ((globalCtx->actorCtx.unk5 & 2) == 0 &&
OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD &&
ActorCutscene_GetCurrentIndex() == -1) {
this->actor.draw = NULL;
}
this->unk_170 = gSaveContext.time;
this->currentTime = gSaveContext.time;
if (this->actor.home.rot.x != 0) {
func_80AB2834(this);
ObjTokeidai_InitClock(this);
this->actor.home.rot.x = 0;
}
}
if (gSaveContext.day % 5 != 3 || gSaveContext.time >= CLOCK_TIME(6, 0)) {
func_80AB3010(this, 1);
func_80AB3010(this, true);
}
func_80AB3CCC(this, globalCtx);
}
void func_80AB4040(ObjTokeidai* this, GlobalContext* globalCtx) {
this->unk_170 = gSaveContext.time;
func_80AB3010(this, 1);
this->currentTime = gSaveContext.time;
func_80AB3010(this, true);
func_80AB3CCC(this, globalCtx);
}
void func_80AB4080(ObjTokeidai* this, GlobalContext* globalCtx) {
if (func_80AB3C50(this, globalCtx)) {
this->actor.draw = func_80AB4894;
this->actor.draw = ObjTokeidai_DrawTowerGear;
} else {
if (globalCtx->csCtx.state != 0) {
this->actor.home.rot.x = 1;
this->unk_170 += 3;
this->actor.draw = func_80AB4894;
this->currentTime += 3;
this->actor.draw = ObjTokeidai_DrawTowerGear;
} else {
if ((globalCtx->actorCtx.unk5 & 2) == 0 && OBJ_TOKEIDAI_TYPE(&this->actor) == 4 &&
if ((globalCtx->actorCtx.unk5 & 2) == 0 &&
OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_GEAR_TERMINA_FIELD &&
ActorCutscene_GetCurrentIndex() == -1) {
this->actor.draw = NULL;
}
this->unk_170 = gSaveContext.time;
this->currentTime = gSaveContext.time;
if (this->actor.home.rot.x != 0) {
func_80AB27B4(this);
ObjTokeidai_SetupClockOrGear(this);
this->actor.home.rot.x = 0;
}
}
func_80AB3010(this, 0);
func_80AB3010(this, false);
}
}
void func_80AB4160(ObjTokeidai* this, GlobalContext* globalCtx) {
s32 type;
if (func_80AB3C50(this, globalCtx) != 0) {
this->unk_16C = 0;
if (func_80AB3C50(this, globalCtx)) {
this->lightIntensity = 0;
if ((this->actor.child == NULL)) {
type = OBJ_TOKEIDAI_TYPE(&this->actor);
if (type == 3 || type == 6) {
if (type == OBJ_TOKEIDAI_TYPE_TOWER_TOP_CLOCK_TOWN || type == OBJ_TOKEIDAI_TYPE_TOWER_TOP_TERMINA_FIELD) {
this->actor.child =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HANABI, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
}
}
if (this->actor.child != NULL) {
if (OBJ_TOKEIDAI_TYPE(&this->actor) == 6) {
if (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_TOP_TERMINA_FIELD) {
this->actor.child->home.rot.x = 0x384;
} else {
this->actor.child->home.rot.x = 0x12C;
@ -684,11 +694,11 @@ void func_80AB4160(ObjTokeidai* this, GlobalContext* globalCtx) {
} else {
this->actor.shape.rot.y += -0x40;
if (gSaveContext.isNight != 0) {
if (this->unk_16C < 0x64) {
this->unk_16C += +4;
if (this->lightIntensity < 100) {
this->lightIntensity += +4;
}
} else if (this->unk_16C > 0) {
this->unk_16C -= 4;
} else if (this->lightIntensity > 0) {
this->lightIntensity -= 4;
}
}
}
@ -703,62 +713,63 @@ void ObjTokeidai_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
if (this->unk_144 != 0) {
if (this->opaDList != 0) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C28C(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, this->unk_144);
gSPDisplayList(POLY_OPA_DISP++, this->opaDList);
}
if (this->unk_148 != 0) {
if (this->xluDList != 0) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, this->unk_148);
gSPDisplayList(POLY_XLU_DISP++, this->xluDList);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void func_80AB4394(Actor* thisx, GlobalContext* globalCtx) {
void ObjTokeidai_DrawClock(Actor* thisx, GlobalContext* globalCtx) {
ObjTokeidai* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
Matrix_InsertTranslation(0.0f, this->unk_15E, 0.0f, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, this->yTranslation, 0.0f, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, 0.0f, -1791.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->unk_160, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->xRotation, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, 0.0f, 1791.0f, MTXMODE_APPLY);
Matrix_StatePush();
Matrix_InsertZRotation_s(-this->unk_14C, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->outerRingOrGearRotation, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0600CF28);
Matrix_StatePop();
Matrix_InsertTranslation(0.0f, 0.0f, this->unk_162, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, 0.0f, this->clockFaceZTranslation, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0600BEE8);
Matrix_InsertZRotation_s(-this->unk_152 * 2, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->clockFaceRotation * 2, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if ((OBJ_TOKEIDAI_TYPE(&this->actor) == 9) || (OBJ_TOKEIDAI_TYPE(&this->actor) == 0xA)) {
if (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_SMALL_CLOCK ||
OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_VERY_SMALL_CLOCK) {
gSPDisplayList(POLY_OPA_DISP++, D_0600F518);
} else {
gSPDisplayList(POLY_OPA_DISP++, D_0600E818);
}
Matrix_InsertTranslation(0.0f, -1112.0f, -19.6f, 1);
Matrix_RotateY((s16)this->unk_158, MTXMODE_APPLY);
Matrix_RotateY((s16)this->sunMoonDiskRotation, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0600C368);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void func_80AB4664(Actor* thisx, GlobalContext* globalCtx) {
void ObjTokeidai_DrawTowerTop(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
u32 gameplayFrames = globalCtx->gameplayFrames;
ObjTokeidai* this = THIS;
Matrix_RotateY(-this->actor.shape.rot.y, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, this->unk_15E, 0.0f, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, this->yTranslation, 0.0f, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, -5480.0f, 80.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->unk_160, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->xRotation, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, 5480.0f, -80.0f, MTXMODE_APPLY);
Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
@ -768,27 +779,27 @@ void func_80AB4664(Actor* thisx, GlobalContext* globalCtx) {
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, -gameplayFrames, 0, 0x20, 0x20));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C28C(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, this->unk_144);
gSPDisplayList(POLY_OPA_DISP++, this->opaDList);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C2DC(globalCtx->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 255, 255, 235, 180, (s32)(this->unk_16C * 2.55f));
gSPDisplayList(POLY_XLU_DISP++, this->unk_148);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 255, 255, 235, 180, (s32)(this->lightIntensity * 2.55f));
gSPDisplayList(POLY_XLU_DISP++, this->xluDList);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void func_80AB4894(Actor* thisx, GlobalContext* globalCtx) {
void ObjTokeidai_DrawTowerGear(Actor* thisx, GlobalContext* globalCtx) {
ObjTokeidai* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
Matrix_InsertTranslation(0.0f, this->unk_15E, 0.0f, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, this->yTranslation, 0.0f, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, 0.0f, -1791.0f, MTXMODE_APPLY);
Matrix_RotateY(-this->actor.shape.rot.y, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->unk_160, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->xRotation, MTXMODE_APPLY);
Matrix_RotateY(thisx->shape.rot.y, MTXMODE_APPLY);
Matrix_InsertTranslation(0.0f, 0.0f, 1791.0f, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->unk_14C, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->outerRingOrGearRotation, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C28C(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, D_0600BA78);

View File

@ -4,32 +4,49 @@
#include "global.h"
#define OBJ_TOKEIDAI_TYPE(thisx) (((thisx)->params & 0xF000) >> 12)
#define OBJ_TOKEIDAI_GET_CURRENT_HOUR(this) ((s32)(this->currentTime * (24.0f / 0x10000)))
#define OBJ_TOKEIDAI_GET_CURRENT_MINUTE(this) ((s32)(this->currentTime * (360 * 2.0f / 0x10000)) % 30)
#define OBJ_TOKEIDAI_GET_CLOCK_FACE_ROTATION(currentHour) ((s16)(currentHour * (0x10000 / 24.0f)))
#define OBJ_TOKEIDAI_GET_OUTER_RING_OR_GEAR_ROTATION(currentMinute) ((s16)(currentMinute * (0x10000 * 12.0f / 360)))
typedef enum {
/* 0 */ OBJ_TOKEIDAI_TYPE_TOWER_GEAR_CLOCK_TOWN,
/* 1 */ OBJ_TOKEIDAI_TYPE_UNUSED_WALL,
/* 2 */ OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN,
/* 3 */ OBJ_TOKEIDAI_TYPE_TOWER_TOP_CLOCK_TOWN,
/* 4 */ OBJ_TOKEIDAI_TYPE_TOWER_GEAR_TERMINA_FIELD,
/* 5 */ OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD,
/* 6 */ OBJ_TOKEIDAI_TYPE_TOWER_TOP_TERMINA_FIELD,
/* 8 */ OBJ_TOKEIDAI_TYPE_TOWER_WALLS_TERMINA_FIELD = 8,
/* 9 */ OBJ_TOKEIDAI_TYPE_SMALL_CLOCK,
/* 10 */ OBJ_TOKEIDAI_TYPE_VERY_SMALL_CLOCK,
/* 11 */ OBJ_TOKEIDAI_TYPE_STAIRCASE_INTO_TOWER,
} ObjTokeidaiType;
struct ObjTokeidai;
typedef void (*ObjTokeidaiActionFunc)(struct ObjTokeidai*, GlobalContext*);
typedef struct ObjTokeidai {
/* 0x0000 */ Actor actor;
/* 0x0144 */ Gfx* unk_144;
/* 0x0148 */ Gfx* unk_148;
/* 0x014C */ s16 unk_14C;
/* 0x014E */ s16 unk_14E;
/* 0x0150 */ s16 unk_150;
/* 0x0152 */ s16 unk_152;
/* 0x0154 */ s16 unk_154;
/* 0x0156 */ s16 unk_156;
/* 0x0158 */ s32 unk_158;
/* 0x015C */ s16 unk_15C;
/* 0x015E */ s16 unk_15E;
/* 0x0160 */ s16 unk_160;
/* 0x0162 */ s16 unk_162;
/* 0x0164 */ s16 unk_164;
/* 0x0166 */ char unk_166[0x2];
/* 0x0168 */ s32 unk_168;
/* 0x016C */ s32 unk_16C;
/* 0x0170 */ u16 unk_170;
/* 0x0174 */ ObjTokeidaiActionFunc actionFunc;
/* 0x000 */ Actor actor;
/* 0x144 */ Gfx* opaDList;
/* 0x148 */ Gfx* xluDList;
/* 0x14C */ s16 outerRingOrGearRotation;
/* 0x14E */ s16 outerRingOrGearAdditionalRotation;
/* 0x150 */ s16 outerRingOrGearRotationTimer;
/* 0x152 */ s16 clockFaceRotation;
/* 0x154 */ s16 clockFaceAdditionalRotation; // overloaded in transformation seqeuence
/* 0x156 */ s16 clockFaceRotationTimer; // overloaded in transformation seqeuence
/* 0x158 */ s32 sunMoonDiskRotation;
/* 0x15C */ s16 sunMoonDiskAdditionalRotation; // overloaded to also be something weird with the clock
/* 0x15E */ s16 yTranslation;
/* 0x160 */ s16 xRotation;
/* 0x162 */ s16 clockFaceZTranslation; // amount the clock face recesses inwards once it transforms
/* 0x164 */ s16 reboundCount;
/* 0x168 */ s32 clockMinute; // only 30 minutes in an hour
/* 0x16C */ s32 clockHour; // overloaded to also be the light beam intensity
/* 0x170 */ u16 currentTime;
/* 0x174 */ ObjTokeidaiActionFunc actionFunc;
} ObjTokeidai; // size = 0x178
extern const ActorInit Obj_Tokeidai_InitVars;

View File

@ -11668,33 +11668,33 @@
0x80AB25D8:("func_80AB25D8",),
0x80AB261C:("DmChar09_Draw",),
0x80AB2790:("func_80AB2790",),
0x80AB27B4:("func_80AB27B4",),
0x80AB2834:("func_80AB2834",),
0x80AB28C8:("func_80AB28C8",),
0x80AB29F8:("func_80AB29F8",),
0x80AB2BBC:("func_80AB2BBC",),
0x80AB27B4:("ObjTokeidai_SetupClockOrGear",),
0x80AB2834:("ObjTokeidai_InitClock",),
0x80AB28C8:("ObjTokeidai_InitTowerGear",),
0x80AB29F8:("ObjTokeidai_InitTowerClock",),
0x80AB2BBC:("ObjTokeidai_InitTowerTop",),
0x80AB2DEC:("ObjTokeidai_Init",),
0x80AB3000:("ObjTokeidai_Destroy",),
0x80AB3010:("func_80AB3010",),
0x80AB319C:("func_80AB319C",),
0x80AB3240:("func_80AB3240",),
0x80AB319C:("ObjTokeidai_CollapseGear",),
0x80AB3240:("ObjTokeidai_TransformedGearIdle",),
0x80AB32F0:("func_80AB32F0",),
0x80AB3370:("func_80AB3370",),
0x80AB34CC:("func_80AB34CC",),
0x80AB3544:("func_80AB3544",),
0x80AB3598:("func_80AB3598",),
0x80AB363C:("func_80AB363C",),
0x80AB365C:("func_80AB365C",),
0x80AB36C4:("func_80AB36C4",),
0x80AB3808:("func_80AB3808",),
0x80AB3880:("func_80AB3880",),
0x80AB38B0:("func_80AB38B0",),
0x80AB39BC:("func_80AB39BC",),
0x80AB3A7C:("func_80AB3A7C",),
0x80AB3B34:("func_80AB3B34",),
0x80AB3BB0:("func_80AB3BB0",),
0x80AB3BD8:("func_80AB3BD8",),
0x80AB3BE8:("func_80AB3BE8",),
0x80AB34CC:("ObjTokeidai_TransformedClockIdle",),
0x80AB3544:("ObjTokeidai_CollapseTop",),
0x80AB3598:("ObjTokeidai_TransformedTopIdle",),
0x80AB363C:("ObjTokeidai_CollapseWalls",),
0x80AB365C:("ObjTokeidai_WallsIdle",),
0x80AB36C4:("ObjTokeidai_TowerTransformationEndCutscene",),
0x80AB3808:("ObjTokeidai_TowerTransformationFinish",),
0x80AB3880:("ObjTokeidai_TowerTransformationWait",),
0x80AB38B0:("ObjTokeidai_TowerTopFall",),
0x80AB39BC:("ObjTokeidai_TowerRaiseFinished",),
0x80AB3A7C:("ObjTokeidai_RaiseTower",),
0x80AB3B34:("ObjTokeidai_TowerTransformationStart",),
0x80AB3BB0:("ObjTokeidai_SetupTowerTransformationStart",),
0x80AB3BD8:("ObjTokeidai_DoNothing",),
0x80AB3BE8:("ObjTokeidai_StaircaseIntoTowerIdle",),
0x80AB3C50:("func_80AB3C50",),
0x80AB3CCC:("func_80AB3CCC",),
0x80AB3ED0:("func_80AB3ED0",),
@ -11703,9 +11703,9 @@
0x80AB4160:("func_80AB4160",),
0x80AB4278:("ObjTokeidai_Update",),
0x80AB429C:("ObjTokeidai_Draw",),
0x80AB4394:("func_80AB4394",),
0x80AB4664:("func_80AB4664",),
0x80AB4894:("func_80AB4894",),
0x80AB4394:("ObjTokeidai_DrawClock",),
0x80AB4664:("ObjTokeidai_DrawTowerTop",),
0x80AB4894:("ObjTokeidai_DrawTowerGear",),
0x80AB4D10:("func_80AB4D10",),
0x80AB4E34:("func_80AB4E34",),
0x80AB4E58:("func_80AB4E58",),