mirror of https://github.com/zeldaret/mm.git
Document Object Ctower Rot (#530)
* Clean up actors * Start documenting object * Finish object and some other cleanup * Review comments * palette -> tlut * File header * DL as prefix for empties
This commit is contained in:
parent
ade2f678b8
commit
5ebc7c0e35
|
|
@ -1,63 +1,100 @@
|
|||
<Root>
|
||||
<!-- Interior clocktower objects including the ceiling cog, rotating corridor, organ, center cog, stone doors, and water wheel -->
|
||||
<File Name="object_ctower_rot" Segment="6">
|
||||
<Texture Name="object_ctower_rot_TLUT_000000" OutName="tlut_000000" Format="rgba16" Width="4" Height="4" Offset="0x0" />
|
||||
<Texture Name="object_ctower_rot_TLUT_000020" OutName="tlut_000020" Format="rgba16" Width="4" Height="4" Offset="0x20" />
|
||||
<Texture Name="object_ctower_rot_TLUT_000040" OutName="tlut_000040" Format="rgba16" Width="16" Height="16" Offset="0x40" />
|
||||
<Texture Name="object_ctower_rot_TLUT_000240" OutName="tlut_000240" Format="rgba16" Width="16" Height="16" Offset="0x240" />
|
||||
<Texture Name="object_ctower_rot_TLUT_000440" OutName="tlut_000440" Format="rgba16" Width="4" Height="4" Offset="0x440" />
|
||||
<Texture Name="object_ctower_rot_Tex_000460" OutName="tex_000460" Format="ci4" Width="64" Height="64" Offset="0x460" />
|
||||
<Texture Name="object_ctower_rot_Tex_000C60" OutName="tex_000C60" Format="ci4" Width="64" Height="64" Offset="0xC60" />
|
||||
<Texture Name="object_ctower_rot_Tex_001460" OutName="tex_001460" Format="ci8" Width="32" Height="32" Offset="0x1460" />
|
||||
<Texture Name="object_ctower_rot_Tex_001860" OutName="tex_001860" Format="ci8" Width="32" Height="32" Offset="0x1860" />
|
||||
<Texture Name="object_ctower_rot_Tex_001C60" OutName="tex_001C60" Format="ci8" Width="32" Height="64" Offset="0x1C60" />
|
||||
<Texture Name="object_ctower_rot_Tex_002460" OutName="tex_002460" Format="ci8" Width="32" Height="64" Offset="0x2460" />
|
||||
<Texture Name="object_ctower_rot_Tex_002C60" OutName="tex_002C60" Format="ci8" Width="32" Height="64" Offset="0x2C60" />
|
||||
<Texture Name="object_ctower_rot_Tex_003460" OutName="tex_003460" Format="ci8" Width="32" Height="64" Offset="0x3460" />
|
||||
<Texture Name="object_ctower_rot_Tex_003C60" OutName="tex_003C60" Format="ci8" Width="32" Height="32" Offset="0x3C60" />
|
||||
<Texture Name="object_ctower_rot_Tex_004060" OutName="tex_004060" Format="rgba16" Width="32" Height="64" Offset="0x4060" />
|
||||
<Texture Name="object_ctower_rot_Tex_005060" OutName="tex_005060" Format="ci8" Width="16" Height="64" Offset="0x5060" />
|
||||
<Texture Name="object_ctower_rot_Tex_005460" OutName="tex_005460" Format="ci8" Width="64" Height="32" Offset="0x5460" />
|
||||
<Texture Name="object_ctower_rot_Tex_005C60" OutName="tex_005C60" Format="ci8" Width="8" Height="64" Offset="0x5C60" />
|
||||
<Texture Name="object_ctower_rot_Tex_005E60" OutName="tex_005E60" Format="ci8" Width="32" Height="32" Offset="0x5E60" />
|
||||
<Texture Name="object_ctower_rot_Tex_006260" OutName="tex_006260" Format="ci8" Width="16" Height="128" Offset="0x6260" />
|
||||
<Texture Name="object_ctower_rot_Tex_006A60" OutName="tex_006A60" Format="ia16" Width="32" Height="32" Offset="0x6A60" />
|
||||
<Texture Name="object_ctower_rot_Tex_007260" OutName="tex_007260" Format="ci8" Width="16" Height="16" Offset="0x7260" />
|
||||
<Texture Name="object_ctower_rot_Tex_007360" OutName="tex_007360" Format="ia16" Width="32" Height="64" Offset="0x7360" />
|
||||
<Texture Name="object_ctower_rot_Tex_008360" OutName="tex_008360" Format="ia16" Width="16" Height="16" Offset="0x8360" />
|
||||
<Texture Name="object_ctower_rot_Tex_008560" OutName="tex_008560" Format="i8" Width="32" Height="32" Offset="0x8560" />
|
||||
<Texture Name="object_ctower_rot_Tex_008960" OutName="tex_008960" Format="ia8" Width="64" Height="64" Offset="0x8960" />
|
||||
<Texture Name="object_ctower_rot_Tex_009960" OutName="tex_009960" Format="ia8" Width="64" Height="64" Offset="0x9960" />
|
||||
<Texture Name="object_ctower_rot_Tex_00A960" OutName="tex_00A960" Format="ia16" Width="32" Height="32" Offset="0xA960" />
|
||||
<Texture Name="object_ctower_rot_Tex_00B160" OutName="tex_00B160" Format="ia16" Width="32" Height="32" Offset="0xB160" />
|
||||
<Texture Name="object_ctower_rot_Tex_00B960" OutName="tex_00B960" Format="ia16" Width="8" Height="64" Offset="0xB960" />
|
||||
<Texture Name="object_ctower_rot_Tex_00BD60" OutName="tex_00BD60" Format="ia16" Width="32" Height="32" Offset="0xBD60" />
|
||||
<Texture Name="object_ctower_rot_Tex_00C560" OutName="tex_00C560" Format="rgba16" Width="32" Height="32" Offset="0xC560" />
|
||||
<Texture Name="object_ctower_rot_Tex_00CD60" OutName="tex_00CD60" Format="ia8" Width="64" Height="64" Offset="0xCD60" />
|
||||
<Texture Name="object_ctower_rot_Tex_00DD60" OutName="tex_00DD60" Format="ci4" Width="64" Height="64" Offset="0xDD60" />
|
||||
<Texture Name="object_ctower_rot_Tex_00E560" OutName="tex_00E560" Format="rgba16" Width="32" Height="32" Offset="0xE560" />
|
||||
<Texture Name="object_ctower_rot_Tex_00ED60" OutName="tex_00ED60" Format="rgba16" Width="32" Height="32" Offset="0xED60" />
|
||||
<Texture Name="object_ctower_rot_Tex_00F560" OutName="tex_00F560" Format="ia4" Width="32" Height="32" Offset="0xF560" />
|
||||
<Texture Name="object_ctower_rot_Tex_00F760" OutName="tex_00F760" Format="ia4" Width="32" Height="32" Offset="0xF760" />
|
||||
<Texture Name="object_ctower_rot_Tex_00F960" OutName="tex_00F960" Format="i4" Width="32" Height="16" Offset="0xF960" />
|
||||
<Texture Name="object_ctower_rot_Tex_00FA60" OutName="tex_00FA60" Format="i4" Width="32" Height="16" Offset="0xFA60" />
|
||||
<Texture Name="object_ctower_rot_Tex_00FB60" OutName="tex_00FB60" Format="i4" Width="32" Height="16" Offset="0xFB60" />
|
||||
<Texture Name="object_ctower_rot_Tex_00FC60" OutName="tex_00FC60" Format="i4" Width="32" Height="16" Offset="0xFC60" />
|
||||
<DList Name="object_ctower_rot_DL_010820" Offset="0x10820" />
|
||||
<DList Name="object_ctower_rot_DL_010828" Offset="0x10828" />
|
||||
<DList Name="object_ctower_rot_DL_0129D0" Offset="0x129D0" />
|
||||
<DList Name="object_ctower_rot_DL_012DA0" Offset="0x12DA0" />
|
||||
<Collision Name="object_ctower_rot_Colheader_0142E8" Offset="0x142E8" />
|
||||
<DList Name="object_ctower_rot_DL_015F30" Offset="0x15F30" />
|
||||
<DList Name="object_ctower_rot_DL_0160A0" Offset="0x160A0" />
|
||||
<Collision Name="object_ctower_rot_Colheader_016E70" Offset="0x16E70" />
|
||||
<DList Name="object_ctower_rot_DL_017010" Offset="0x17010" />
|
||||
<DList Name="object_ctower_rot_DL_017018" Offset="0x17018" />
|
||||
<DList Name="object_ctower_rot_DL_017220" Offset="0x17220" />
|
||||
<Collision Name="object_ctower_rot_Colheader_017410" Offset="0x17410" />
|
||||
<DList Name="object_ctower_rot_DL_0174E0" Offset="0x174E0" />
|
||||
<Collision Name="object_ctower_rot_Colheader_017650" Offset="0x17650" />
|
||||
<DList Name="object_ctower_rot_DL_018110" Offset="0x18110" />
|
||||
<DList Name="object_ctower_rot_DL_018118" Offset="0x18118" />
|
||||
<Collision Name="object_ctower_rot_Colheader_018588" Offset="0x18588" />
|
||||
<!-- TLUTs -->
|
||||
<Texture Name="gClockTowerCeilingCogWoodTLUT" OutName="clocktower_ceiling_cog_wood_tlut" Format="rgba16" Width="4" Height="4" Offset="0x0" />
|
||||
<Texture Name="gClockTowerCeilingCogWoodMetalTLUT" OutName="clocktower_ceiling_cog_wood_metal_tlut" Format="rgba16" Width="4" Height="4" Offset="0x20" />
|
||||
<Texture Name="gClockTowerCooridorTLUT" OutName="clocktower_cooridor_tlut" Format="rgba16" Width="16" Height="16" Offset="0x40" />
|
||||
<Texture Name="gClockTowerOrganTLUT" OutName="clocktower_organ_tlut" Format="rgba16" Width="16" Height="16" Offset="0x240" />
|
||||
<Texture Name="gClockTowerStoneDoorTLUT" OutName="clocktower_stone_door_tlut" Format="rgba16" Width="4" Height="4" Offset="0x440" />
|
||||
|
||||
<!-- Textures -->
|
||||
|
||||
<!-- CeilingCog -->
|
||||
<Texture Name="gClockTowerCeilingCogWoodTex" OutName="clocktower_ceiling_cog_wood" Format="ci4" Width="64" Height="64" Offset="0x460" />
|
||||
<Texture Name="gClockTowerCeilingCogWoodMetalTex" OutName="clocktower_ceiling_cog_wood_metal" Format="ci4" Width="64" Height="64" Offset="0xC60" />
|
||||
|
||||
<!-- Corridor -->
|
||||
<Texture Name="gClockTowerCorridorStonePath1Tex" OutName="clocktower_corridor_stone_path_1" Format="ci8" Width="32" Height="32" Offset="0x1460" />
|
||||
<Texture Name="gClockTowerCorridorStonePath2Tex" OutName="clocktower_corridor_stone_path_2" Format="ci8" Width="32" Height="32" Offset="0x1860" />
|
||||
<Texture Name="gClockTowerCorridorStoneWallTex" OutName="clocktower_corridor_stone_wall" Format="ci8" Width="32" Height="64" Offset="0x1C60" />
|
||||
<Texture Name="gClockTowerCorridorGrassyStoneWallTex" OutName="clocktower_corridor_grassy_stone_wall" Format="ci8" Width="32" Height="64" Offset="0x2460" />
|
||||
<Texture Name="gClockTowerCorridorStonePillarTex" OutName="clocktower_corridor_stone_pillar" Format="ci8" Width="32" Height="64" Offset="0x2C60" />
|
||||
<Texture Name="gClockTowerCorridorStoneCeilingTex" OutName="clocktower_corridor_stone_ceiling" Format="ci8" Width="32" Height="64" Offset="0x3460" />
|
||||
<Texture Name="gClockTowerCorridorDirtPathTex" OutName="clocktower_corridor_dirt_path" Format="ci8" Width="32" Height="32" Offset="0x3C60" />
|
||||
<Texture Name="gClockTowerCooridorFoliageTex" OutName="clocktower_corridor_foliage" Format="rgba16" Width="32" Height="64" Offset="0x4060" />
|
||||
<Texture Name="gClockTowerCorridorWoodPillarTex" OutName="clocktower_corridor_wood_pillar" Format="ci8" Width="16" Height="64" Offset="0x5060" />
|
||||
<Texture Name="gClockTowerCorridorWoodWallTex" OutName="clocktower_corridor_wood_wall" Format="ci8" Width="64" Height="32" Offset="0x5460" />
|
||||
<Texture Name="gClockTowerCorridorGrassyCeilingTex" OutName="clocktower_corridor_grassy_ceiling" Format="ci8" Width="8" Height="64" Offset="0x5C60" />
|
||||
<Texture Name="gClockTowerCorridorDirtTex" OutName="clocktower_corridor_dirt" Format="ci8" Width="32" Height="32" Offset="0x5E60" />
|
||||
|
||||
<!-- Organ -->
|
||||
<Texture Name="gClockTowerOrganBackTex" OutName="clocktower_organ_back" Format="ci8" Width="16" Height="128" Offset="0x6260" />
|
||||
<Texture Name="gClockTowerOrganSeatLegsTex" OutName="clocktower_organ_seat_legs" Format="ia16" Width="32" Height="32" Offset="0x6A60" />
|
||||
<Texture Name="gClockTowerOrganSeatCushionTex" OutName="clocktower_organ_seat_cushion" Format="ci8" Width="16" Height="16" Offset="0x7260" />
|
||||
<Texture Name="gClockTowerOrganSeatBackTex" OutName="clocktower_organ_seat_back" Format="ia16" Width="32" Height="64" Offset="0x7360" />
|
||||
<Texture Name="gClockTowerOrganPedalTex" OutName="clocktower_organ_pedal" Format="ia16" Width="16" Height="16" Offset="0x8360" />
|
||||
<Texture Name="gClockTowerOrganWoodTex" OutName="clocktower_organ_wood" Format="i8" Width="32" Height="32" Offset="0x8560" />
|
||||
<Texture Name="gClockTowerOrganMetalPiece1Tex" OutName="clocktower_organ_metal_piece_1" Format="ia8" Width="64" Height="64" Offset="0x8960" />
|
||||
<Texture Name="gClockTowerOrganMetalPiece2Tex" OutName="clocktower_organ_metal_piece_2" Format="ia8" Width="64" Height="64" Offset="0x9960" />
|
||||
<Texture Name="gClockTowerOrganMetalPiece3Tex" OutName="clocktower_organ_metal_piece_3" Format="ia16" Width="32" Height="32" Offset="0xA960" />
|
||||
<Texture Name="gClockTowerOrganMetalPiece4Tex" OutName="clocktower_organ_metal_piece_4" Format="ia16" Width="32" Height="32" Offset="0xB160" />
|
||||
<Texture Name="gClockTowerOrganMetalPiece5Tex" OutName="clocktower_organ_metal_piece_5" Format="ia16" Width="8" Height="64" Offset="0xB960" />
|
||||
<Texture Name="gClockTowerOrganMetalPiece6Tex" OutName="clocktower_organ_metal_piece_6" Format="ia16" Width="32" Height="32" Offset="0xBD60" />
|
||||
|
||||
<!-- CenterCog -->
|
||||
<Texture Name="gClockTowerCenterCogBeamTex" OutName="clocktower_center_cog_beam" Format="rgba16" Width="32" Height="32" Offset="0xC560" />
|
||||
<Texture Name="gClockTowerCenterCogTex" OutName="clocktower_center_cog" Format="ia8" Width="64" Height="64" Offset="0xCD60" />
|
||||
|
||||
<!-- StoneDoors -->
|
||||
<Texture Name="gClockTowerStoneDoorTex" OutName="clocktower_stone_door" Format="ci4" Width="64" Height="64" Offset="0xDD60" />
|
||||
|
||||
<!-- Waterwheel -->
|
||||
<Texture Name="gClockTowerWaterWheelWoodTex" OutName="clocktower_water_wheel_wood" Format="rgba16" Width="32" Height="32" Offset="0xE560" />
|
||||
<Texture Name="gClockTowerWaterWheelGrassyWoodTex" OutName="clocktower_water_wheel_grassy_wood" Format="rgba16" Width="32" Height="32" Offset="0xED60" />
|
||||
|
||||
<!-- Organ Pipes -->
|
||||
<Texture Name="gClockTowerOrganPipesThinTex" OutName="clocktower_organ_pipes_thin" Format="ia4" Width="32" Height="32" Offset="0xF560" />
|
||||
<Texture Name="gClockTowerOrganPipesThickTex" OutName="clocktower_organ_pipes_thick" Format="ia4" Width="32" Height="32" Offset="0xF760" />
|
||||
|
||||
<!-- Organ Keys -->
|
||||
<!-- Keys get progressively blurrier-->
|
||||
<Texture Name="gClockTowerOrganKeys1Tex" OutName="clocktower_organ_keys_1" Format="i4" Width="32" Height="16" Offset="0xF960" />
|
||||
<Texture Name="gClockTowerOrganKeys2Tex" OutName="clocktower_organ_keys_2" Format="i4" Width="32" Height="16" Offset="0xFA60" />
|
||||
<Texture Name="gClockTowerOrganKeys3Tex" OutName="clocktower_organ_keys_3" Format="i4" Width="32" Height="16" Offset="0xFB60" />
|
||||
<Texture Name="gClockTowerOrganKeys4Tex" OutName="clocktower_organ_keys_4" Format="i4" Width="32" Height="16" Offset="0xFC60" />
|
||||
|
||||
<!-- DLists and Collision -->
|
||||
|
||||
<!-- CeilingCog -->
|
||||
<DList Name="gClockTowerEmpty1DL" Offset="0x10820" />
|
||||
<DList Name="gClockTowerCeilingCogDL" Offset="0x10828" />
|
||||
|
||||
<!-- Corridor -->
|
||||
<DList Name="gClockTowerCorridorFoliageDL" Offset="0x129D0" />
|
||||
<DList Name="gClockTowerCorridorDL" Offset="0x12DA0" />
|
||||
<Collision Name="gClockTowerCorridorCol" Offset="0x142E8" />
|
||||
|
||||
<!-- Organ -->
|
||||
<DList Name="gClockTowerOrganPipesDL" Offset="0x15F30" />
|
||||
<DList Name="gClockTowerOrganDL" Offset="0x160A0" />
|
||||
<Collision Name="gClockTowerOrganCol" Offset="0x16E70" />
|
||||
|
||||
<!-- CenterCog -->
|
||||
<DList Name="gClockTowerEmpty2DL" Offset="0x17010" />
|
||||
<DList Name="gClockTowerCenterCogDL" Offset="0x17018" />
|
||||
|
||||
<!-- StoneDoorMain -->
|
||||
<DList Name="gClockTowerStoneDoorMainDL" Offset="0x17220" />
|
||||
<Collision Name="gClockTowerStoneDoorMainCol" Offset="0x17410" />
|
||||
|
||||
<!-- StoneDoor -->
|
||||
<DList Name="gClockTowerStoneDoorDL" Offset="0x174E0" />
|
||||
<Collision Name="gClockTowerStoneDoorCol" Offset="0x17650" />
|
||||
|
||||
<!-- WaterWheel -->
|
||||
<DList Name="gClockTowerEmpty3DL" Offset="0x18110" />
|
||||
<DList Name="gClockTowerWaterWheelDL" Offset="0x18118" />
|
||||
<Collision Name="gClockTowerWaterWheelCol" Offset="0x18588" />
|
||||
</File>
|
||||
</Root>
|
||||
|
|
|
|||
|
|
@ -11,15 +11,6 @@
|
|||
|
||||
#define THIS ((BgCtowerGear*)thisx)
|
||||
|
||||
#define BGCTOWERGEAR_GET_TYPE(this) (((BgCtowerGear*)this)->dyna.actor.params & 3)
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ CEILING_COG,
|
||||
/* 0x01 */ CENTER_COG,
|
||||
/* 0x02 */ WATER_WHEEL,
|
||||
/* 0x03 */ ORGAN
|
||||
} BgCtowerGearType;
|
||||
|
||||
void BgCtowerGear_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgCtowerGear_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgCtowerGear_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
|
@ -40,11 +31,14 @@ const ActorInit Bg_Ctower_Gear_InitVars = {
|
|||
(ActorFunc)BgCtowerGear_Draw,
|
||||
};
|
||||
|
||||
static Vec3f D_80AD3270[] = {
|
||||
{ -70.0f, -60.0f, 8.0f }, { -60.0f, -60.0f, -9.1f }, { -75.0f, -60.0f, -9.1f }, { -70.0f, -60.0f, -26.2f }
|
||||
static Vec3f sExitSplashOffsets[] = {
|
||||
{ -70.0f, -60.0f, 8.0f },
|
||||
{ -60.0f, -60.0f, -9.1f },
|
||||
{ -75.0f, -60.0f, -9.1f },
|
||||
{ -70.0f, -60.0f, -26.2f },
|
||||
};
|
||||
|
||||
static Vec3f D_80AD32A0[] = {
|
||||
static Vec3f sEnterSplashOffsets[] = {
|
||||
{ 85.0f, -60.0f, 8.0f },
|
||||
{ 80.0f, -60.0f, -9.1f },
|
||||
{ 85.0f, -60.0f, -26.2f },
|
||||
|
|
@ -68,28 +62,26 @@ static InitChainEntry sInitChainOrgan[] = {
|
|||
ICHAIN_F32(uncullZoneDownward, 570, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
static Gfx* D_80AD32E8[] = { object_ctower_rot_DL_010828, object_ctower_rot_DL_017018, object_ctower_rot_DL_018118 };
|
||||
static Gfx* sDLists[] = { gClockTowerCeilingCogDL, gClockTowerCenterCogDL, gClockTowerWaterWheelDL };
|
||||
|
||||
void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) {
|
||||
int i;
|
||||
s32 flags;
|
||||
s32 i;
|
||||
s32 flag40 = this->dyna.actor.flags & 0x40;
|
||||
Vec3f splashSpawnPos;
|
||||
Vec3f splashOffset;
|
||||
s32 pad;
|
||||
int j;
|
||||
s16 rotZ;
|
||||
s32 j;
|
||||
s16 rotZ = this->dyna.actor.shape.rot.z & 0x1FFF;
|
||||
|
||||
flags = this->dyna.actor.flags & 0x40;
|
||||
rotZ = this->dyna.actor.shape.rot.z & 0x1FFF;
|
||||
if ((flags != 0) && (rotZ < 0x1B58) && (rotZ >= 0x1388)) {
|
||||
if (flag40 && (rotZ < 0x1B58) && (rotZ >= 0x1388)) {
|
||||
Matrix_RotateY(this->dyna.actor.home.rot.y, MTXMODE_NEW);
|
||||
Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, MTXMODE_APPLY);
|
||||
for (i = 0; i < 4; i++) {
|
||||
if ((u32)Rand_Next() >= 0x40000000) {
|
||||
splashOffset.x = D_80AD3270[i].x - (Rand_ZeroOne() * 30.0f);
|
||||
splashOffset.y = D_80AD3270[i].y;
|
||||
splashOffset.z = D_80AD3270[i].z;
|
||||
splashOffset.x = sExitSplashOffsets[i].x - (Rand_ZeroOne() * 30.0f);
|
||||
splashOffset.y = sExitSplashOffsets[i].y;
|
||||
splashOffset.z = sExitSplashOffsets[i].z;
|
||||
Matrix_MultiplyVector3fByState(&splashOffset, &splashSpawnPos);
|
||||
splashSpawnPos.x += this->dyna.actor.world.pos.x + ((Rand_ZeroOne() * 20.0f) - 10.0f);
|
||||
splashSpawnPos.y += this->dyna.actor.world.pos.y;
|
||||
|
|
@ -99,15 +91,15 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
if ((rotZ < 0x1F4) && (rotZ >= 0)) {
|
||||
if (flags != 0) {
|
||||
if (flag40) {
|
||||
Matrix_RotateY(this->dyna.actor.home.rot.y, MTXMODE_NEW);
|
||||
Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, MTXMODE_APPLY);
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
splashOffset.x = D_80AD32A0[i].x + (Rand_ZeroOne() * 10.0f);
|
||||
splashOffset.y = D_80AD32A0[i].y;
|
||||
splashOffset.z = D_80AD32A0[i].z;
|
||||
splashOffset.x = sEnterSplashOffsets[i].x + (Rand_ZeroOne() * 10.0f);
|
||||
splashOffset.y = sEnterSplashOffsets[i].y;
|
||||
splashOffset.z = sEnterSplashOffsets[i].z;
|
||||
Matrix_MultiplyVector3fByState(&splashOffset, &splashSpawnPos);
|
||||
splashSpawnPos.x += this->dyna.actor.world.pos.x + ((Rand_ZeroOne() * 20.0f) - 10.0f);
|
||||
splashSpawnPos.y += this->dyna.actor.world.pos.y;
|
||||
|
|
@ -122,50 +114,47 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) {
|
|||
|
||||
void BgCtowerGear_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgCtowerGear* this = THIS;
|
||||
s32 type;
|
||||
s32 type = BGCTOWERGEAR_GET_TYPE(&this->dyna.actor);
|
||||
|
||||
type = BGCTOWERGEAR_GET_TYPE(this);
|
||||
Actor_SetScale(&this->dyna.actor, 0.1f);
|
||||
if (type == CENTER_COG) {
|
||||
if (type == BGCTOWERGEAR_CENTER_COG) {
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChainCenterCog);
|
||||
} else if (type == ORGAN) {
|
||||
} else if (type == BGCTOWERGEAR_ORGAN) {
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChainOrgan);
|
||||
this->dyna.actor.draw = NULL;
|
||||
this->dyna.actor.update = BgCtowerGear_UpdateOrgan;
|
||||
} else {
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
}
|
||||
if (type == WATER_WHEEL) {
|
||||
if (type == BGCTOWERGEAR_WATER_WHEEL) {
|
||||
DynaPolyActor_Init(&this->dyna, 3);
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ctower_rot_Colheader_018588);
|
||||
} else if (type == ORGAN) {
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerWaterWheelCol);
|
||||
} else if (type == BGCTOWERGEAR_ORGAN) {
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ctower_rot_Colheader_016E70);
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerOrganCol);
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
}
|
||||
|
||||
void BgCtowerGear_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgCtowerGear* this = THIS;
|
||||
s32 type;
|
||||
s32 type = BGCTOWERGEAR_GET_TYPE(&this->dyna.actor);
|
||||
|
||||
type = BGCTOWERGEAR_GET_TYPE(this);
|
||||
if ((type == WATER_WHEEL) || (type == ORGAN)) {
|
||||
if ((type == BGCTOWERGEAR_WATER_WHEEL) || (type == BGCTOWERGEAR_ORGAN)) {
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
}
|
||||
|
||||
void BgCtowerGear_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgCtowerGear* this = THIS;
|
||||
s32 type;
|
||||
s32 type = BGCTOWERGEAR_GET_TYPE(&this->dyna.actor);
|
||||
|
||||
type = BGCTOWERGEAR_GET_TYPE(this);
|
||||
if (type == CEILING_COG) {
|
||||
if (type == BGCTOWERGEAR_CEILING_COG) {
|
||||
this->dyna.actor.shape.rot.x -= 0x1F4;
|
||||
} else if (type == CENTER_COG) {
|
||||
} else if (type == BGCTOWERGEAR_CENTER_COG) {
|
||||
this->dyna.actor.shape.rot.y += 0x1F4;
|
||||
func_800B9010(&this->dyna.actor, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG);
|
||||
} else if (type == WATER_WHEEL) {
|
||||
} else if (type == BGCTOWERGEAR_WATER_WHEEL) {
|
||||
this->dyna.actor.shape.rot.z -= 0x1F4;
|
||||
BgCtowerGear_Splash(this, globalCtx);
|
||||
}
|
||||
|
|
@ -191,18 +180,17 @@ void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
// Using BgCtowerGear *this = THIS causes regalloc issues
|
||||
void BgCtowerGear_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_DrawDListOpa(globalCtx, D_80AD32E8[BGCTOWERGEAR_GET_TYPE(thisx)]);
|
||||
Gfx_DrawDListOpa(globalCtx, sDLists[BGCTOWERGEAR_GET_TYPE(thisx)]);
|
||||
}
|
||||
|
||||
void BgCtowerGear_DrawOrgan(Actor* thisx, GlobalContext* globalCtx) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_ctower_rot_DL_0160A0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gClockTowerOrganDL);
|
||||
func_8012C2DC(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_ctower_rot_DL_015F30);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClockTowerOrganPipesDL);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,16 @@
|
|||
|
||||
struct BgCtowerGear;
|
||||
|
||||
|
||||
#define BGCTOWERGEAR_GET_TYPE(thisx) ((thisx)->params & 3)
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ BGCTOWERGEAR_CEILING_COG,
|
||||
/* 0x01 */ BGCTOWERGEAR_CENTER_COG,
|
||||
/* 0x02 */ BGCTOWERGEAR_WATER_WHEEL,
|
||||
/* 0x03 */ BGCTOWERGEAR_ORGAN
|
||||
} BgCtowerGearType;
|
||||
|
||||
typedef struct BgCtowerGear {
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
} BgCtowerGear; // size = 0x15C
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* File: z_bg_ctower_rot.c
|
||||
* Overlay: ovl_Bg_CtowerRot
|
||||
* Description: Twisting path along with the Doors to Clock Tower
|
||||
* Description: Twisting path along with the Stone Doors to Clock Tower
|
||||
*/
|
||||
|
||||
#include "z_bg_ctower_rot.h"
|
||||
|
|
@ -37,28 +37,28 @@ static InitChainEntry sInitChain[] = {
|
|||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
static Gfx* bgCtowerRotDlists[] = { object_ctower_rot_DL_012DA0, object_ctower_rot_DL_017220,
|
||||
object_ctower_rot_DL_0174E0 };
|
||||
static Gfx* sDLists[] = { gClockTowerCorridorDL, gClockTowerStoneDoorMainDL, gClockTowerStoneDoorDL };
|
||||
|
||||
void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgCtowerRot* this = THIS;
|
||||
s32 pad;
|
||||
BgCtowerRot* this = THIS;
|
||||
Player* player;
|
||||
Vec3f offset;
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
if (this->dyna.actor.params == CORRIDOR) {
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ctower_rot_Colheader_0142E8);
|
||||
if (this->dyna.actor.params == BGCTOWERROT_CORRIDOR) {
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerCorridorCol);
|
||||
this->actionFunc = BgCtowerRot_CorridorRotate;
|
||||
return;
|
||||
}
|
||||
|
||||
player = GET_PLAYER(globalCtx);
|
||||
if (this->dyna.actor.params == MAIN_DOOR) {
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ctower_rot_Colheader_017410);
|
||||
if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) {
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerStoneDoorMainCol);
|
||||
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y + 0x4000;
|
||||
} else {
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ctower_rot_Colheader_017650);
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerStoneDoorCol);
|
||||
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y - 0x4000;
|
||||
}
|
||||
Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos);
|
||||
|
|
@ -82,22 +82,18 @@ void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) {
|
|||
Player* player = GET_PLAYER(globalCtx);
|
||||
Vec3f offset;
|
||||
f32 rotZ;
|
||||
f32 offsetDiffZ;
|
||||
f32 rotZtmp;
|
||||
|
||||
Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos);
|
||||
if (offset.z > 1100.0f) {
|
||||
rotZ = 0.0f;
|
||||
} else {
|
||||
offsetDiffZ = 1100.0f - offset.z;
|
||||
rotZtmp = (offsetDiffZ > 1000.0f)
|
||||
? 1000.0f
|
||||
: offsetDiffZ; // Removing rotZtmp just causes regalloc issues and a missing instruction
|
||||
rotZtmp = CLAMP_MAX(1100.0f - offset.z, 1000.0f);
|
||||
rotZ = rotZtmp;
|
||||
}
|
||||
func_800DFAC8(globalCtx->cameraPtrs[0], 0x11);
|
||||
func_800DFAC8(globalCtx->cameraPtrs[MAIN_CAM], 17);
|
||||
this->dyna.actor.shape.rot.z = rotZ * 16.384f;
|
||||
if (globalCtx->csCtx.frames == 0x84) {
|
||||
if (globalCtx->csCtx.frames == 132) {
|
||||
play_sound(NA_SE_SY_SPIRAL_DASH);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,12 +103,12 @@ void BgCtowerRot_DoorDoNothing(BgCtowerRot* this, GlobalContext* globalCtx) {
|
|||
|
||||
void BgCtowerRot_DoorClose(BgCtowerRot* this, GlobalContext* globalCtx) {
|
||||
if (!Math_SmoothStepToF(&this->timer, 0.0f, 0.1f, 15.0f, 0.1f)) {
|
||||
if (this->dyna.actor.params == MAIN_DOOR) {
|
||||
if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) {
|
||||
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP);
|
||||
ActorCutscene_Stop(this->dyna.actor.cutscene);
|
||||
}
|
||||
this->actionFunc = BgCtowerRot_DoorDoNothing;
|
||||
} else if (this->dyna.actor.params == 1) {
|
||||
} else if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) {
|
||||
func_800B9010(&this->dyna.actor, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG);
|
||||
}
|
||||
this->dyna.actor.world.pos.x =
|
||||
|
|
@ -135,7 +131,7 @@ void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx) {
|
|||
|
||||
void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, GlobalContext* globalCtx) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
|
||||
if (this->dyna.actor.params == MAIN_DOOR) {
|
||||
if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) {
|
||||
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
|
||||
}
|
||||
this->actionFunc = BgCtowerRot_DoorClose;
|
||||
|
|
@ -153,8 +149,8 @@ void BgCtowerRot_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
void BgCtowerRot_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgCtowerRot* this = THIS;
|
||||
|
||||
Gfx_DrawDListOpa(globalCtx, bgCtowerRotDlists[this->dyna.actor.params]);
|
||||
if (this->dyna.actor.params == CORRIDOR) {
|
||||
Gfx_DrawDListXlu(globalCtx, object_ctower_rot_DL_0129D0);
|
||||
Gfx_DrawDListOpa(globalCtx, sDLists[this->dyna.actor.params]);
|
||||
if (this->dyna.actor.params == BGCTOWERROT_CORRIDOR) {
|
||||
Gfx_DrawDListXlu(globalCtx, gClockTowerCorridorFoliageDL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ struct BgCtowerRot;
|
|||
typedef void (*BgCtowerRotActionFunc)(struct BgCtowerRot*, GlobalContext*);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ CORRIDOR,
|
||||
/* 1 */ MAIN_DOOR, // Main door controls cutscene flow (updating Link fields and playing sounds). It is the one on
|
||||
// the left when entering from the Lost Woods
|
||||
/* 2 */ DOOR,
|
||||
/* 0 */ BGCTOWERROT_CORRIDOR,
|
||||
/* 1 */ BGCTOWERROT_STONE_DOOR_MAIN, // Main door controls cutscene flow (updating Link fields and playing sounds).
|
||||
// It is the one on the left when entering from the Lost Woods
|
||||
/* 2 */ BGCTOWERROT_STONE_DOOR,
|
||||
} BgCtowerRotType;
|
||||
|
||||
typedef struct BgCtowerRot {
|
||||
|
|
|
|||
Loading…
Reference in New Issue