Various Lakebed Temple/water-related object debug equivalencies (#3070)

* d_a_obj_syRock + waterPillar debug equivalent
* Implemented HIO genMessage
* Added drawCylinder debug drawing

* d_a_obj_waterfall debug equivalent
* Implemented HIO genMessage
* Added unused tri collider and cull box data

* Various LV3 d_a_obj_* actors debug equivalent
* Added/modified some documentation
* Added some widescreen support functions
* Added relevant HIO stuff
* Noted weak ordering issues in configure.py

* Refactoring according to feedback
This commit is contained in:
Huitzi
2026-01-28 14:21:47 -08:00
committed by GitHub
parent 5812194fad
commit 414a650f9f
18 changed files with 1450 additions and 952 deletions
+10 -10
View File
@@ -2524,7 +2524,7 @@ config.libs = [
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_bombf"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_boumato"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_brg"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_bsGate"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_bsGate"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_bubblePilar"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_catdoor"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_cb"),
@@ -2626,12 +2626,12 @@ config.libs = [
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lp"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv1Candle00"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv1Candle01"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3Candle"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3Water"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3Water2"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3WaterB"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3saka00"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3waterEff"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3Candle"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3Water"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3Water2"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3WaterB"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3saka00"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv3waterEff"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv4CandleDemoTag"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv4CandleTag"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_lv4EdShutter"),
@@ -2757,7 +2757,7 @@ config.libs = [
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_swpush2"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_swspinner"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_swturn"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_syRock"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_syRock"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_szbridge"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_taFence"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_table"),
@@ -2789,8 +2789,8 @@ config.libs = [
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_warp_kbrg"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_warp_obrg"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_waterGate"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_waterPillar"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_waterfall"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_waterPillar"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_waterfall"), # debug weak func order
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_wchain"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_wdStick"),
ActorRel(MatchingFor(ALL_GCN), "d_a_obj_web0"),
-14
View File
@@ -48,18 +48,4 @@ private:
STATIC_ASSERT(sizeof(daBsGate_c) == 0x5B8);
class daBsGate_HIO_c : public mDoHIO_entry_c {
public:
daBsGate_HIO_c();
~daBsGate_HIO_c() {}
void genMessage(JORMContext*);
/* 0x4 */ f32 mOpenSpeed;
/* 0x8 */ f32 mCloseSpeed;
/* 0xC */ u8 mShockStrength;
};
STATIC_ASSERT(sizeof(daBsGate_HIO_c) == 0x10);
#endif /* D_A_OBJ_BSGATE_H */
+3 -14
View File
@@ -3,7 +3,7 @@
#include "d/d_cc_d.h"
#include "f_op/f_op_actor_mng.h"
#include "m_Do/m_Do_hostIO.h"
#include "d/d_kankyo.h"
/**
@@ -26,8 +26,8 @@ public:
int Draw();
int Delete();
u8 getSwBit() { return fopAcM_GetParamBit(this, 0, 8); }
u8 getType() { return fopAcM_GetParamBit(this, 8, 8); }
int getSwBit() { return fopAcM_GetParamBit(this, 0, 8); }
int getType() { return fopAcM_GetParamBit(this, 8, 8); }
private:
/* 0x568 */ request_of_phase_process_class mPhaseReq;
@@ -51,15 +51,4 @@ private:
STATIC_ASSERT(sizeof(daLv3Candle_c) == 0x754);
class daLv3Candle_HIO_c : public mDoHIO_entry_c {
public:
daLv3Candle_HIO_c();
virtual ~daLv3Candle_HIO_c() {}
void genMessage(JORMContext*);
/* 0x00 vtable */
/* 0x04 */ u8 field_0x04;
};
#endif /* D_A_OBJ_LV3CANDLE_H */
+9 -10
View File
@@ -40,10 +40,9 @@ public:
virtual ~daLv3Water_c() {}
virtual bool eventStart();
int getParam() { return fpcM_GetParam(this) >> 0xC & 0x0FFF; }
int getParamSw() { return fpcM_GetParam(this) & 0xFF; }
int getParam(int shift, int bit) { return fopAcM_GetParamBit(this, shift, bit); }
int getParamEvent() { return shape_angle.x & 0xFF; }
u8 getParamType() { return (shape_angle.x >> 8) & 0xFF; }
int getParamType() { return (shape_angle.x & 0xFF00) >> 8; }
u8 getType() { return mType; }
private:
@@ -54,13 +53,13 @@ private:
/* 0x5E0 */ mDoExt_btkAnm mBtk2;
/* 0x5F8 */ u8 mMode;
/* 0x5F9 */ u8 mType;
/* 0x5FC */ f32 field_0x5fc;
/* 0x600 */ u8 field_0x600;
/* 0x601 */ u8 field_0x601;
/* 0x602 */ u8 mSwitch1;
/* 0x603 */ u8 mSwitch2;
/* 0x604 */ u8 field_0x604;
/* 0x605 */ u8 field_0x605;
/* 0x5FC */ f32 mWaterLv; // Amount that the water's y coodinate should increase
/* 0x600 */ u8 mCurrentWaterLvFrame; // Number of frames that the water level has been changing
/* 0x601 */ u8 mWaterLvFrame; // Number of frames that should be taken for the water level to change
/* 0x602 */ u8 mSwInitialState;
/* 0x603 */ u8 mSwCurrentState;
/* 0x604 */ u8 mLvControlWaitFrames;
/* 0x605 */ u8 mSwStatePostEvent; // Only when true (i.e event initiated water raising instead of lowering) should anything be drawn
/* 0x608 */ u32 mEmitterIDs[8];
};
+13 -13
View File
@@ -32,21 +32,21 @@ public:
private:
/* 0x5B8 */ request_of_phase_process_class mPhase;
/* 0x5C0 */ J3DModel* mpModel;
/* 0x5C4 */ mDoExt_btkAnm mWaterSurfaceRefractionAnm;
/* 0x5C4 */ mDoExt_btkAnm mRefractionAnm; // Applied to water surface
/* 0x5DC */ u8 mMode;
/* 0x5DD */ u8 mResourceIndex;
/* 0x5E0 */ f32 mWaterLv;
/* 0x5E4 */ u8 mCurrentWaterLvFrame;
/* 0x5E5 */ u8 mWaterLvFrame;
/* 0x5E6 */ u8 mFullRatio;
/* 0x5E7 */ u8 mEastSwInitialStatus; // East SW is the lever in the east-most room on 2F, which can only be pulled after raising the water level in that room by pulling the lever in 4F
/* 0x5E8 */ u8 mWestSwInitialStatus; // West SW is the lever in the west-most room on 2F, which can only be pulled after raising the water level in that room by pulling the lever in 4F
/* 0x5E9 */ u8 mEastSwCurrentStatus;
/* 0x5EA */ u8 mWestSwCurrentStatus;
/* 0x5EB */ u8 mLevelControlWaitFrames;
/* 0x5DD */ u8 mResIdx;
/* 0x5E0 */ f32 mWaterLv; // Amount that the water's y coodinate should increase
/* 0x5E4 */ u8 mCurrentWaterLvFrame; // Number of frames that the water level has been changing
/* 0x5E5 */ u8 mWaterLvFrame; // Number of frames that should be taken for the water level to change
/* 0x5E6 */ u8 mEvActivatorSwState;
/* 0x5E7 */ u8 mEastSwInitialState; // East SW is the lever in the east-most room on 2F, which can only be pulled after raising the water level in that room by pulling the lever in 4F
/* 0x5E8 */ u8 mWestSwInitialState; // West SW is the lever in the west-most room on 2F, which can only be pulled after raising the water level in that room by pulling the lever in 4F
/* 0x5E9 */ u8 mEastSwCurrentState;
/* 0x5EA */ u8 mWestSwCurrentState;
/* 0x5EB */ u8 mLvControlWaitFrames;
/* 0x5EC */ f32 mBaseYPos;
/* 0x5F0 */ u32 mEastWaterParticles[4]; // If the central staircase isn't rotated to allow water from the east to flow down it, the water falls into the basin; these are the splash particles where the basin water and falling water meet
/* 0x600 */ u32 mWestWaterParticles[4]; // If the central staircase isn't rotated to allow water from the west to flow down it, the water falls into the basin; these are the splash particles where the basin water and falling water meet
/* 0x5F0 */ u32 mEastParticles[4]; // If the central staircase isn't rotated to allow water from the east to flow down it, the water falls into the basin; these are the splash particles where the basin water and falling water meet
/* 0x600 */ u32 mWestParticles[4]; // If the central staircase isn't rotated to allow water from the west to flow down it, the water falls into the basin; these are the splash particles where the basin water and falling water meet
enum Mode_e {
WAIT, LEVEL_CTRL
+17 -18
View File
@@ -1,8 +1,8 @@
#ifndef D_A_OBJ_SYROCK_H
#define D_A_OBJ_SYROCK_H
#include "d/actor/d_a_obj_waterPillar.h"
#include "d/d_bg_s_movebg_actor.h"
#include "d/actor/d_a_obj_waterPillar.h"
/**
* @ingroup actors-objects
@@ -50,20 +50,20 @@ private:
/* 0x5B8 */ request_of_phase_process_class mPhase;
/* 0x5C0 */ J3DModel* mpModels[2];
/* 0x5C8 */ u8 mMode;
/* 0x5C9 */ u8 mDropAutomaticallySwitchNo;
/* 0x5C9 */ u8 mAutoDropSwNo;
/* 0x5CC */ dCcD_Stts mStts;
/* 0x608 */ dCcD_Cyl mUnbrokenCylinderCollider; // Collider used to check for bomb/bomb arrow for breaking stalactite
/* 0x608 */ dCcD_Cyl mUnbrokenCollider; // Collider used to check for bomb/bomb arrow for breaking stalactite
/* 0x744 */ u8 mWaitFrames;
/* 0x748 */ u32 mShakeOscillationAngleStep;
/* 0x74C */ csXyz mShakeXZAngleOffset;
/* 0x748 */ u32 mShakeOscAngStep;
/* 0x74C */ csXyz mShakeAngOffset; // Y component is always 0
/* 0x754 */ f32 mShakeAmplitude;
/* 0x758 */ f32 mShakeXOscillationAngle;
/* 0x75C */ f32 mShakeZOscillationAngle;
/* 0x760 */ f32 mShakeDamping;
/* 0x758 */ f32 mShakeXOscAngQuantum;
/* 0x75C */ f32 mShakeZOscAngQuantum;
/* 0x760 */ f32 mShakeDampingScale;
/* 0x764 */ f32 mShakeMaxDecay;
/* 0x768 */ f32 mShakeMinDecay;
/* 0x76C */ cXyz mUnderwaterRotatedStalactiteOffset;
/* 0x778 */ bool mInWaterPreviousFrame;
/* 0x76C */ cXyz mUnderwaterOffset;
/* 0x778 */ u8 mInWaterPrevFrame;
/* 0x779 */ u8 field_0x779; // Redundant variable, thus left unnamed
/* 0x77C */ dBgS_AcchCir mAcchCir;
/* 0x7BC */ dBgS_ObjAcch mAcch;
@@ -77,31 +77,30 @@ private:
}
// Switch to determine whether or not the stalactite has been broken
u32 getSwBit1() {
int getSwBit1() {
return fopAcM_GetParamBit(this, 0, 8);
}
// Switch to determine whether or not the stalactite should be broken automatically when player is in range
u32 getSwBit2() {
int getSwBit2() {
return fopAcM_GetParamBit(this, 8, 8);
}
// Event ID for Midna to stop and note the stalactite that fell by itself
s32 getEvetID() {
int getEvetID() {
return fopAcM_GetParamBit(this, 16, 8);
}
enum Mode_e {
MODE_WAIT,
MODE_DROP_INIT,
MODE_WAIT,
MODE_DROP_INIT,
MODE_DROP,
MODE_SINK,
MODE_MOVE,
MODE_SINK,
MODE_MOVE,
MODE_DROP_END
};
};
STATIC_ASSERT(sizeof(daSyRock_c) == 0x9a0);
#endif /* D_A_OBJ_SYROCK_H */
+33 -31
View File
@@ -1,11 +1,6 @@
#ifndef D_A_OBJ_WATERPILLAR_H
#define D_A_OBJ_WATERPILLAR_H
#include "d/d_bg_s_acch.h"
#include "d/d_cc_d.h"
#include "d/d_event_lib.h"
#include "f_op/f_op_actor_mng.h"
/**
* @ingroup actors-objects
* @class daWtPillar_c
@@ -15,6 +10,13 @@
*
*/
#include "d/d_bg_s_acch.h"
#include "d/d_cc_d.h"
#include "d/d_event_lib.h"
#include "f_op/f_op_actor.h"
#include "f_op/f_op_actor_mng.h"
#include "m_Do/m_Do_ext.h"
#include "SSystem/SComponent/c_phase.h"
class daWtPillar_c : public fopAc_ac_c, public request_of_phase_process_class, public dEvLib_callback_c {
public:
daWtPillar_c() : dEvLib_callback_c(this) {}
@@ -59,7 +61,7 @@ public:
static dCcD_SrcCyl mCcDCyl;
void onRockFlag() {
mIsCarryingStalactite = true;
mCarryingStalactite = true;
}
cXyz getPos() {
@@ -67,18 +69,18 @@ public:
}
u8 isRockYure() {
return mStalactiteShouldStartShaking;
return mStartStalactiteShake;
}
void clearRockYure() {
mStalactiteShouldStartShaking = false;
mStartStalactiteShake = false;
}
private:
/* 0x584 */ request_of_phase_process_class mPhase;
/* 0x58C */ J3DModel* mpModel;
/* 0x590 */ mDoExt_btkAnm mVerticalTextureScrollAnimation;
/* 0x5A8 */ mDoExt_bckAnm mModelRotationAnimation;
/* 0x590 */ mDoExt_btkAnm mVTexScrollAnm;
/* 0x5A8 */ mDoExt_bckAnm mModelRotAnm;
/* 0x5C4 */ dBgS_ObjAcch mAcch;
/* 0x79C */ dBgS_AcchCir mAcchCir;
/* 0x7DC */ dCcD_Stts mStts;
@@ -86,34 +88,34 @@ private:
/* 0x95C */ dCcD_Cyl mCylinderCollider;
/* 0xA98 */ u8 pad0[0x30];
/* 0xAC8 */ cXyz field_0xAC8; // unused.
/* 0xAD4 */ cXyz mScale; // Modified but never read; unused?
/* 0xAD4 */ cXyz mDbgDrawScale;
/* 0xAE0 */ f32 mCurrentHeight;
/* 0xAE4 */ cM3dGCpsS mCapsuleSource;
/* 0xB00 */ u8 mAction;
/* 0xB02 */ u16 mWaitFrameDelay;
/* 0xB04 */ f32 mTargetMaxSpeed;
/* 0xB02 */ u16 mWaitFrames;
/* 0xB04 */ f32 mTargetSpeed;
/* 0xB08 */ u8 mSwitchNo;
/* 0xB09 */ u8 mType;
/* 0xB0A */ u8 pad2[0x6];
/* 0xB10 */ f32 mFirstTargetHeight;
/* 0xB10 */ f32 mUpFirstTargetHeight;
/* 0xB14 */ f32 mMaxHeight;
/* 0xB18 */ f32 mTargetHeightStalactiteOffset;
/* 0xB1C */ f32 mRelativeWaterHeight;
/* 0xB20 */ u32 mEffectOscillationAngleStep;
/* 0xB24 */ cXyz mEffectOscillationVerticalOffset;
/* 0xB30 */ f32 mEffectOscillationAngle;
/* 0xB34 */ f32 mEffectOscillationAmplitude;
/* 0xB38 */ f32 mEffectOscillationDampingScale;
/* 0xB3C */ f32 mEffectOscillationMaxDecay;
/* 0xB40 */ f32 mEffectOscillationMinDecay;
/* 0xB20 */ u32 mVOscAngleStep;
/* 0xB24 */ cXyz mVOscVOffset;
/* 0xB30 */ f32 mVOscAngleQuantum;
/* 0xB34 */ f32 mVOscAmplitude;
/* 0xB38 */ f32 mVOscDampingScale;
/* 0xB3C */ f32 mVOscMaxDecay;
/* 0xB40 */ f32 mVOscMinDecay;
/* 0xB44 */ u8 field_0xB44; // Modified, but never read; unused?
/* 0xB45 */ u8 mStartedRisingOrDoesNotRiseAndFall;
/* 0xB46 */ u8 mPillarIsPreparingToRise;
/* 0xB48 */ u32 mBottomAndTopParticleEmmitters[7];
/* 0xB64 */ u32 mWaterSurfaceParticleEmitters[2];
/* 0xB45 */ u8 mIsUpOrStatic;
/* 0xB46 */ u8 mIsUpFirst;
/* 0xB48 */ u32 mBotAndTopEmmitters[7];
/* 0xB64 */ u32 mWaterSurfaceEmitters[2];
/* 0xB6C */ cXyz mTopPos;
/* 0xB78 */ s8 mStalactiteShouldStartShaking; // Modified by d_a_obj_syRock
/* 0xB79 */ u8 mIsCarryingStalactite; // Modified by d_a_obj_syRock
/* 0xB78 */ u8 mStartStalactiteShake; // Modified by d_a_obj_syRock
/* 0xB79 */ u8 mCarryingStalactite; // Modified by d_a_obj_syRock
s32 getEventID() {
return shape_angle.x & 0xFF;
@@ -124,11 +126,11 @@ private:
}
enum Action_e {
ACTION_SW_WAIT,
ACTION_WAIT,
ACTION_SW_WAIT,
ACTION_WAIT,
ACTION_UP_FIRST, ACTION_UP_FIRST_WAIT,
ACTION_UP, ACTION_UP_WAIT,
ACTION_DOWN,
ACTION_UP, ACTION_UP_WAIT,
ACTION_DOWN,
ACTION_ROCK_WAIT, ACTION_ROCK_ON,
ACTION_END
};
+9 -9
View File
@@ -8,9 +8,9 @@
/**
* @ingroup actors-objects
* @class daObjWaterFall_c
* @brief Waterfall With Collision Object
* @brief Waterfall Collision
*
* @details Waterfalls that player cannot move through (e.g. those in Zora's Domain)
* @details Collision added to waterfalls that player shouldn't move through (e.g. those in Zora's Domain). Doesn't actually draw the waterfall.
*/
class daObjWaterFall_c : public fopAc_ac_c {
public:
@@ -30,23 +30,23 @@ private:
/* 0x574 */ dCcD_Stts mCylColliderStts;
/* 0x5B0 */ dCcD_Tri mUnusedTriCollider[2];
/* 0x868 */ dCcD_Cyl mCylCollider;
/* 0x9A4 */ cXyz mCylColliderCenterOscillationTargets[2];
/* 0x9BC */ cXyz mCylColliderCenter;
/* 0x9C8 */ s8 mCylColliderCenterQuantizedOscillation;
/* 0x9A4 */ cXyz mColOscPosTargets[2];
/* 0x9BC */ cXyz mColCenter;
/* 0x9C8 */ s8 mColOscDir;
enum Type_e {
ALLOW_ARROWS_e
};
BOOL checkFallOut() {
return fopAcM_GetParamBit(this, 10, 4);
return (BOOL) fopAcM_GetParamBit(this, 10, 4) == TRUE;
}
Type_e getType() {
return static_cast<Type_e>(fopAcM_GetParamBit(this, 8, 2));
u8 getType() {
return fopAcM_GetParamBit(this, 8, 2);
}
u32 getSwbit() {
u8 getSwbit() {
return fopAcM_GetParamBit(this, 0, 8);
}
};
+73 -8
View File
@@ -9,12 +9,58 @@
#include "d/d_com_inf_game.h"
#include "d/d_procname.h"
class daBsGate_HIO_c : public mDoHIO_entry_c {
public:
daBsGate_HIO_c();
~daBsGate_HIO_c() {}
void genMessage(JORMContext*);
/* 0x4 */ f32 mOpenSpeed;
/* 0x8 */ f32 mCloseSpeed;
/* 0xC */ u8 mShockStrength;
};
STATIC_ASSERT(sizeof(daBsGate_HIO_c) == 0x10);
static daBsGate_HIO_c l_HIO;
daBsGate_HIO_c::daBsGate_HIO_c() {
mOpenSpeed = 2.0f;
mCloseSpeed = 12.0f;
mShockStrength = 3;
}
#if DEBUG
void daBsGate_HIO_c::genMessage(JORMContext* mctx) {
// OPEN speed
mctx->genSlider("OPEN速度", &mOpenSpeed, 0.1f, 100.0f);
// CLOSE speed
mctx->genSlider("CLOSE速度", &mCloseSpeed, 0.1f, 100.0f);
/* Vibration */
/* Vibration */
mctx->startComboBox("振動", &mShockStrength);
// Strength 1
mctx->genComboBoxItem("強さ1", VIBMODE_S_POWER1);
// Strength 2
mctx->genComboBoxItem("強さ2", VIBMODE_S_POWER2);
// Strength 3
mctx->genComboBoxItem("強さ3", VIBMODE_S_POWER3);
// Strength 4
mctx->genComboBoxItem("強さ4", VIBMODE_S_POWER4);
// Strength 5
mctx->genComboBoxItem("強さ5", VIBMODE_S_POWER5);
// Strength 6
mctx->genComboBoxItem("強さ6", VIBMODE_S_POWER6);
// Strength 7
mctx->genComboBoxItem("強さ7", VIBMODE_S_POWER7);
// Strength 8
mctx->genComboBoxItem("強さ8", VIBMODE_S_POWER8);
mctx->endComboBox();
}
#endif
void daBsGate_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
@@ -24,8 +70,11 @@ void daBsGate_c::setBaseMtx() {
}
int daBsGate_c::CreateHeap() {
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("S_Zgate", 4);
mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084);
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("S_Zgate", 4);
JUT_ASSERT(178, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (mpModel == NULL) {
return 0;
}
@@ -42,10 +91,14 @@ cPhs_Step daBsGate_c::create() {
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
fopAcM_setCullSizeBox2(this, mpModel->getModelData());
mOpen = fopAcM_isSwitch(this, fopAcM_GetParam(this) & 0xff);
mSide = (fopAcM_GetParam(this) >> 8) & 0xff;
mSide = (fopAcM_GetParam(this) & 0xFF00) >> 8;
mTargetDist = -250.0f;
if (mSide == 1) {
#if DEBUG
shape_angle.y += static_cast<s16>(0x8000);
#else
shape_angle.y += 0x8000;
#endif
}
mOpenDist = 0.0f;
if (mOpen) {
@@ -53,6 +106,10 @@ cPhs_Step daBsGate_c::create() {
}
init_modeWait();
setBaseMtx();
#if DEBUG
l_HIO.entryHIO("ぶら下がりスイッチゲート"); // "Hanging Switch Gate" / "Pull-Down Switch Gate"
#endif
}
return step;
}
@@ -64,11 +121,9 @@ int daBsGate_c::Execute(Mtx** i_mtxP) {
return 1;
}
static daBsGate_HIO_c l_HIO;
void daBsGate_c::moveGate() {
typedef void (daBsGate_c::*daBsGate_modeFunc)();
static daBsGate_modeFunc mode_proc[3] = {
static const daBsGate_modeFunc mode_proc[3] = {
&daBsGate_c::modeWait,
&daBsGate_c::modeOpen,
&daBsGate_c::modeClose,
@@ -102,7 +157,9 @@ void daBsGate_c::modeOpen() {
mDoAud_seStartLevel(Z2SE_OBJ_SW_W_DR_OP, &current.pos, 0,
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
if (cLib_addCalc(&mOpenDist, mTargetDist, 0.2f, l_HIO.mOpenSpeed, 0.5f) == 0.0f) {
const f32 distanceToOpenPosition = cLib_addCalc(&mOpenDist, mTargetDist, 0.2f, l_HIO.mOpenSpeed, 0.5f);
if (distanceToOpenPosition == 0.0f) {
if (mSide == 0) {
mDoAud_seStart(Z2SE_OBJ_SW_W_DR_OP_STOP, &current.pos, 0,
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
@@ -121,7 +178,9 @@ void daBsGate_c::modeClose() {
mDoAud_seStartLevel(Z2SE_OBJ_SW_W_DR_CL, &current.pos, 0,
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
if (cLib_addCalc(&mOpenDist, 0.0f, 0.4f, l_HIO.mCloseSpeed, 0.5f) == 0.0f) {
const f32 distanceToClosedPosition = cLib_addCalc(&mOpenDist, 0.0f, 0.4f, l_HIO.mCloseSpeed, 0.5f);
if (distanceToClosedPosition == 0.0f) {
if (mSide == 0) {
mDoAud_seStart(Z2SE_OBJ_SW_W_DR_CL_STOP, &current.pos, 0,
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
@@ -142,6 +201,11 @@ int daBsGate_c::Draw() {
int daBsGate_c::Delete() {
dComIfG_resDelete(&mPhaseReq, "S_Zgate");
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
@@ -155,6 +219,7 @@ static int daBsGate_Execute(daBsGate_c* i_this) {
}
static int daBsGate_Delete(daBsGate_c* i_this) {
fopAcM_RegisterDeleteID(i_this, "daBsGate");
return i_this->MoveBGDelete();
}
+44 -18
View File
@@ -8,13 +8,32 @@
#include "d/actor/d_a_obj_lv3Candle.h"
#include "d/d_com_inf_game.h"
#include "d/d_s_play.h"
#include "d/d_cc_uty.h"
class daLv3Candle_HIO_c : public mDoHIO_entry_c {
public:
daLv3Candle_HIO_c();
virtual ~daLv3Candle_HIO_c() {}
void genMessage(JORMContext*);
/* 0x00 vtable */
/* 0x04 */ u8 mTimer; // Written to, but never read
};
static daLv3Candle_HIO_c l_HIO;
daLv3Candle_HIO_c::daLv3Candle_HIO_c() {
field_0x04 = 0x1e;
mTimer = 0x1e;
}
#if DEBUG
void daLv3Candle_HIO_c::genMessage(JORMContext* mctx) {
mctx->genSlider("timer", &mTimer, 0, 0xFF);
}
#endif
dCcD_SrcGObjInf const daLv3Candle_c::mCcDObjInfo = {
{0, {{0x200, 0, 0x13}, {0xd8fbfdff, 0x1f}, {0x79}}},
{1, 0, 0, 0, 0},
@@ -36,9 +55,12 @@ void daLv3Candle_c::setBaseMtx() {
static u32 const l_bmdIdx[] = {0x03, 0x03};
int daLv3Candle_c::CreateHeap() {
J3DModelData* model_data =
J3DModelData* modelData =
(J3DModelData*)dComIfG_getObjectRes(l_resNameIdx[mType], l_bmdIdx[mType]);
mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084);
JUT_ASSERT(226, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (mpModel == NULL) {
return FALSE;
@@ -95,7 +117,8 @@ cPhs_Step daLv3Candle_c::create() {
}
int daLv3Candle_c::createHeapCallBack(fopAc_ac_c* i_this) {
return static_cast<daLv3Candle_c*>(i_this)->CreateHeap();
daLv3Candle_c* actor = static_cast<daLv3Candle_c*>(i_this);
return actor->CreateHeap();
}
void daLv3Candle_c::lightInit() {
@@ -116,14 +139,14 @@ void daLv3Candle_c::lightInit() {
}
void daLv3Candle_c::pointLightProc() {
if (!mIsLit) {
GXColor color = {188, 102, 66, 255};
cLib_addCalc(&mIntensity, 1.0f, 0.5f, 0.1f, 0.0001f);
if (mIsLit)
return;
if (mIntensity >= 0.000001f) {
dKy_BossLight_set(&mLightPos, &color, mIntensity, 0);
}
}
GXColor color = {188, 102, 66, 255};
cLib_addCalc(&mIntensity, 1.0f, 0.5f, 0.1f, 0.0001f);
if (mIntensity >= 0.000001f)
dKy_BossLight_set(&mLightPos, &color, mIntensity, 0);
}
int daLv3Candle_c::Execute() {
@@ -137,8 +160,8 @@ int daLv3Candle_c::Execute() {
if (mSph.ChkTgHit()) {
cCcD_Obj* obj = mSph.GetTgHitObj();
if (obj != NULL) {
bool play_sound = true;
fopAc_ac_c* actor = obj->GetAc();
u8 play_sound = true;
fopAc_ac_c* actor = dCc_GetAc(obj->GetAc());
if (fopAcM_GetName(actor) == PROC_ALINK) {
dCcD_GObjInf* gobj = mSph.GetTgHitGObj();
if (gobj->GetAtType() & AT_TYPE_NORMAL_SWORD && mTgHit != 0) {
@@ -160,11 +183,11 @@ int daLv3Candle_c::Execute() {
cXyz pos = current.pos;
if (mType == 0) {
mSph.SetR(90.0f);
pos.z += 70.0f;
mSph.SetR(90.0f + oREG_F(0));
pos.z += 70.0f + oREG_F(1);
} else {
mSph.SetR(60.0f);
pos.y -= 200.0f;
mSph.SetR(60.0f + oREG_F(3));
pos.y -= 200.0f + oREG_F(2);
}
mSph.SetC(pos);
@@ -205,11 +228,14 @@ static int daLv3Candle_Execute(daLv3Candle_c* i_this) {
}
static int daLv3Candle_Delete(daLv3Candle_c* i_this) {
fopAcM_RegisterDeleteID(i_this, "daLv3Candle");
return static_cast<daLv3Candle_c*>(i_this)->Delete();
}
static int daLv3Candle_Create(fopAc_ac_c* i_this) {
return static_cast<daLv3Candle_c*>(i_this)->create();
daLv3Candle_c* const actor = static_cast<daLv3Candle_c*>(i_this);
fopAcM_RegisterCreateID(i_this, "daLv3Candle");
return actor->create();
}
static actor_method_class l_daLv3Candle_Method = {
+152 -97
View File
@@ -10,8 +10,15 @@
#include "d/d_bg_w.h"
#include "d/d_com_inf_game.h"
#include "d/d_procname.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_msg_mng.h"
#if DEBUG
#include "f_ap/f_ap_game.h"
#include "m_Do/m_Do_graphic.h"
#include "CaptureScreen.h"
#endif
class daLv3Water_HIO_c : public mDoHIO_entry_c {
public:
daLv3Water_HIO_c();
@@ -20,26 +27,21 @@ public:
void genMessage(JORMContext*);
/* 0x00 */ /* vtable */
/* 0x04 */ u8 field_0x04;
};
static daLv3Water_HIO_c l_HIO;
static char* l_resNameIdx[] = {
"Kr10water", "Kr10wat01", "Kr02wat00", "Kr03wat00", "Kr03wat01", "Kr03wat02", "Kr03wat03",
"Kr03wat04", "Kr07wat00", "Kr08wat00", "Kr08wat01", "Kr02wat01", "Kr02wat02", "Kr02wat03",
"Kr11wat00", "Kr12wat00", "Kr13wat00", "Kr13wat01", "Kr13wat02", "Kr03wat05", "Kr03wat06",
};
static daLv3Water_c::modeFunc l_mode_func[] = {
&daLv3Water_c::mode_proc_wait,
&daLv3Water_c::mode_proc_levelCtrl,
/* 0x04 */ u8 mLevelControlWaitFrames;
};
daLv3Water_HIO_c::daLv3Water_HIO_c() {
field_0x04 = NULL;
mLevelControlWaitFrames = NULL;
}
#if DEBUG
void daLv3Water_HIO_c::genMessage(JORMContext* mctx) {
mctx->genSlider("wait time", &mLevelControlWaitFrames, 0, 0xFF);
}
#endif
static daLv3Water_HIO_c l_HIO;
void daLv3Water_c::setBaseMtx() {
if (mpModel2 != NULL) {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
@@ -76,23 +78,33 @@ static const int l_btkIdrIdx[] = {
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, -1, -1,
};
static char* l_resNameIdx[] = {
"Kr10water", "Kr10wat01", "Kr02wat00", "Kr03wat00", "Kr03wat01", "Kr03wat02", "Kr03wat03",
"Kr03wat04", "Kr07wat00", "Kr08wat00", "Kr08wat01", "Kr02wat01", "Kr02wat02", "Kr02wat03",
"Kr11wat00", "Kr12wat00", "Kr13wat00", "Kr13wat01", "Kr13wat02", "Kr03wat05", "Kr03wat06",
};
int daLv3Water_c::CreateHeap() {
J3DModelData* modelData =
(J3DModelData*)dComIfG_getObjectRes(l_resNameIdx[mType], l_bmdIdx[mType]);
JUT_ASSERT(384, modelData != NULL);
mpModel1 = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284);
if (mpModel1 == NULL) {
return 0;
}
J3DAnmTextureSRTKey* btk =
(J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_resNameIdx[mType], l_btkIdx[mType]);
mBtk1.init(modelData, btk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1);
int res = mBtk1.init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_resNameIdx[mType], l_btkIdx[mType]),
TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1);
JUT_ASSERT(400, res == 1);
if (l_bmdIdrIdx[mType] != -1) {
J3DModelData* modelData =
(J3DModelData*)dComIfG_getObjectRes(l_resNameIdx[mType], l_bmdIdrIdx[mType]);
modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameIdx[mType], l_bmdIdrIdx[mType]);
JUT_ASSERT(404, modelData != NULL);
mpModel2 = mDoExt_J3DModel__create(modelData, 0x80000, 0x19000284);
@@ -100,9 +112,8 @@ int daLv3Water_c::CreateHeap() {
return 0;
}
J3DAnmTextureSRTKey* btk =
(J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_resNameIdx[mType], l_btkIdrIdx[mType]);
mBtk2.init(modelData, btk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1);
res = mBtk2.init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_resNameIdx[mType], l_btkIdrIdx[mType]),
TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1);
} else {
mpModel2 = NULL;
}
@@ -110,35 +121,31 @@ int daLv3Water_c::CreateHeap() {
return 1;
}
static u16 const estimateSizeTbl[] = {
0x1CE0,
0x4F90,
0x1C80,
0x1C30,
0x1C30,
0x1C30,
0x1C30,
0x8000,
0x27D0,
0x2490,
0x1E60,
0x1C80,
0x1C80,
0x1C80,
0x4F90,
0x2880,
0x29D0,
0x2B00,
0x2040,
0x1360,
0x1360,
/* padding */
0x0000,
0x0000,
0x0000,
};
int daLv3Water_c::create() {
static u16 const estimateSizeTbl[] = {
0x1CE0,
0x4F90,
0x1C80,
0x1C30,
0x1C30,
0x1C30,
0x1C30,
0x8000,
0x27D0,
0x2490,
0x1E60,
0x1C80,
0x1C80,
0x1C80,
0x4F90,
0x2880,
0x29D0,
0x2B00,
0x2040,
0x1360,
0x1360,
};
fopAcM_ct(this, daLv3Water_c);
mType = getParamType();
@@ -146,37 +153,49 @@ int daLv3Water_c::create() {
int phase = dComIfG_resLoad(&mPhase, l_resNameIdx[mType]);
if (phase == cPhs_COMPLEATE_e) {
if (MoveBGCreate(l_resNameIdx[mType], l_dzbIdx[mType], NULL, estimateSizeTbl[mType],
u32 heapSize = estimateSizeTbl[mType];
OS_REPORT("l3water: == type:%d [0x%04x:%s] ==\n", mType, heapSize, l_resNameIdx[mType]);
if (MoveBGCreate(l_resNameIdx[mType], l_dzbIdx[mType], NULL, heapSize,
NULL) == cPhs_ERROR_e)
{
return cPhs_ERROR_e;
}
field_0x5fc = getParam();
mSwitch1 = dComIfGs_isSwitch(getParamSw(), fopAcM_GetHomeRoomNo(this));
field_0x605 = 1;
mWaterLv = getParam(12, 12);
mSwInitialState = fopAcM_isSwitch(this, getParam(0, 8));
mSwStatePostEvent = true;
if (mType == 1 || mType == 10 || mType == 15 || mType == 17 || mType == 19 || mType == 20) {
if (mSwitch1 == 0) {
if (!mSwInitialState) {
if (mpBgW != NULL) {
dComIfG_Bgsp().Release(mpBgW);
}
field_0x605 = 0;
mSwStatePostEvent = false; // Water is not raised upon creation, ensure it is drawn accordingly
} else if (mType == 1) {
current.pos.y = home.pos.y + field_0x5fc;
current.pos.y = home.pos.y + mWaterLv;
}
} else if (mSwitch1 != 0) {
current.pos.y = home.pos.y + field_0x5fc;
} else if (mSwInitialState) {
current.pos.y = home.pos.y + mWaterLv;
}
fopAcM_SetMtx(this, mpModel1->getBaseTRMtx());
setBaseMtx();
mMode = WAIT;
#if DEBUG
l_HIO.entryHIO("LV3水面"); // "LV3 water surface"
#endif
}
return phase;
}
static daLv3Water_c::modeFunc l_mode_func[] = {
&daLv3Water_c::mode_proc_wait,
&daLv3Water_c::mode_proc_levelCtrl,
};
int daLv3Water_c::Execute(Mtx** i_mtx) {
mBtk1.play();
@@ -185,7 +204,7 @@ int daLv3Water_c::Execute(Mtx** i_mtx) {
}
eventUpdate();
mSwitch2 = dComIfGs_isSwitch(getParamSw(), fopAcM_GetHomeRoomNo(this));
mSwCurrentState = fopAcM_isSwitch(this, getParam(0, 8));
(this->*l_mode_func[mMode])();
effectSet();
*i_mtx = &mpModel1->getBaseTRMtx();
@@ -205,7 +224,7 @@ void daLv3Water_c::effectSet() {
}
break;
case 9:
if (mSwitch1) {
if (mSwInitialState) {
mEmitterIDs[0] =
dComIfGp_particle_set(mEmitterIDs[0], 0X8AB4, &current.pos, NULL, NULL);
mEmitterIDs[1] =
@@ -243,7 +262,7 @@ void daLv3Water_c::effectSet() {
}
break;
case 17:
if (mSwitch1) {
if (mSwInitialState) {
mEmitterIDs[0] =
dComIfGp_particle_set(mEmitterIDs[0], 0X8AC4, &current.pos, NULL, NULL);
mEmitterIDs[1] =
@@ -255,7 +274,7 @@ void daLv3Water_c::effectSet() {
}
break;
case 16:
if (mSwitch1) {
if (mSwInitialState) {
mEmitterIDs[0] =
dComIfGp_particle_set(mEmitterIDs[0], 0X8AC8, &current.pos, NULL, NULL);
mEmitterIDs[1] =
@@ -269,10 +288,10 @@ void daLv3Water_c::effectSet() {
}
void daLv3Water_c::mode_proc_wait() {
if (mSwitch1 != mSwitch2) {
int event = getParamEvent();
if (event != 0xFF) {
orderEvent(event, 0xFF, 1);
// Only change the water level when the pull switch is activated (i.e. its initial state differs from its current state)
if (mSwInitialState != mSwCurrentState) {
if (getParamEvent() != 0xFF) {
orderEvent(getParamEvent(), 0xFF, 1);
} else {
eventStart();
}
@@ -280,40 +299,48 @@ void daLv3Water_c::mode_proc_wait() {
}
void daLv3Water_c::mode_init_levelCtrl() {
field_0x600 = 0;
field_0x604 = l_HIO.field_0x04;
mCurrentWaterLvFrame = 0;
mLvControlWaitFrames = l_HIO.mLevelControlWaitFrames;
if (mType == 9) {
fopAcM_seStartCurrent(this, Z2SE_ENV_FILL_UP_LV3WTR3, 0);
mDoAud_seStart(Z2SE_ENV_FILL_UP_LV3WTR3, &current.pos, 0,
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
mMode = LEVEL_CTRL;
}
void daLv3Water_c::mode_proc_levelCtrl() {
if (field_0x604 != NULL) {
field_0x604 = field_0x604 - 1;
} else {
f32 fVar = fopMsgM_valueIncrease(field_0x601, field_0x600, mSwitch1);
f32 ratioOfWaterLevelFramesAdvancedToTarget;
if (mSwitch1 == 0) {
fVar = 1.0f - fVar;
if (mLvControlWaitFrames != 0) {
mLvControlWaitFrames--;
} else {
ratioOfWaterLevelFramesAdvancedToTarget = fopMsgM_valueIncrease(mWaterLvFrame, mCurrentWaterLvFrame, mSwInitialState);
if (!mSwInitialState) {
// Water level should lower, invert the ratio so that it goes (1.0f -> 0.0f)
ratioOfWaterLevelFramesAdvancedToTarget = 1.0f - ratioOfWaterLevelFramesAdvancedToTarget;
}
field_0x600 = field_0x600 + 1;
if (field_0x600 >= field_0x601) {
fVar = mSwitch1;
mCurrentWaterLvFrame++;
if (mCurrentWaterLvFrame >= mWaterLvFrame) {
ratioOfWaterLevelFramesAdvancedToTarget = mSwInitialState;
mMode = WAIT;
}
current.pos.y = home.pos.y + field_0x5fc * fVar;
current.pos.y = mWaterLv * ratioOfWaterLevelFramesAdvancedToTarget + home.pos.y;
}
}
int daLv3Water_c::Draw() {
if (field_0x605 == NULL) {
J3DTexMtxInfo* texMtxInfo;
J3DMaterial* material;
J3DModelData* modelData;
// Only draw if the water is raised
if (!mSwStatePostEvent)
return 0;
}
g_env_light.settingTevStruct(0x10, &current.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mpModel1, &tevStr);
@@ -322,10 +349,12 @@ int daLv3Water_c::Draw() {
g_env_light.setLightTevColorType_MAJI(mpModel2, &tevStr);
}
mBtk1.entry(mpModel1->getModelData());
modelData = mpModel1->getModelData();
mBtk1.entry(modelData);
if (mpModel2 != NULL) {
mBtk2.entry(mpModel2->getModelData());
modelData = mpModel2->getModelData();
mBtk2.entry(modelData);
}
dComIfGd_setXluListDarkBG();
@@ -333,20 +362,38 @@ int daLv3Water_c::Draw() {
dComIfGd_setList();
if (mpModel2 != NULL) {
J3DModelData* modelData = mpModel2->getModelData();
J3DMaterial* material = modelData->getMaterialNodePointer(0);
modelData = mpModel2->getModelData();
material = modelData->getMaterialNodePointer(0);
dComIfGd_setListInvisisble();
J3DTexMtx* texMtx = material->getTexGenBlock()->getTexMtx(0);
if (texMtx != NULL) {
J3DTexMtxInfo* texMtxInfo = &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (material->getTexGenBlock()->getTexMtx(0) != NULL) {
texMtxInfo = &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if (texMtxInfo != NULL) {
Mtx lightProjMtx;
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy,
dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0.0f);
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightProjMtx);
#endif
#if DEBUG
if(fapGm_HIO_c::isCaptureScreen()) {
Mtx44 screenCaptureMtx;
MTXCopy(lightProjMtx, screenCaptureMtx);
screenCaptureMtx[2][3] = -2.0f;
CPerspDivider perspectiveDivider(screenCaptureMtx, fapGm_HIO_c::getCaptureScreenDivH(), fapGm_HIO_c::getCaptureScreenDivV());
perspectiveDivider.divide(screenCaptureMtx, fapGm_HIO_c::getCaptureScreenNumH(), fapGm_HIO_c::getCaptureScreenNumV());
screenCaptureMtx[2][3] = 0.0f;
MTXCopy(screenCaptureMtx, lightProjMtx);
}
#endif
texMtxInfo->setEffectMtx(lightProjMtx);
modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx);
modelData->simpleCalcMaterial((MtxP)j3dDefaultMtx);
}
}
@@ -359,21 +406,26 @@ int daLv3Water_c::Draw() {
int daLv3Water_c::Delete() {
dComIfG_resDelete(&mPhase, l_resNameIdx[mType]);
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
bool daLv3Water_c::eventStart() {
field_0x601 = fpcM_GetParam(this) >> 0x18;
mSwitch1 = mSwitch2;
mWaterLvFrame = getParam(24, 8);
mSwInitialState = mSwCurrentState; // Ensure the water raise event isn't activated again
if (mType == 1 || mType == 10 || mType == 15 || mType == 17 || mType == 19 || mType == 20) {
if (mpBgW != NULL) {
dComIfG_Bgsp().Regist(mpBgW, this);
}
if (mType == 1) {
current.pos.y = home.pos.y + field_0x5fc;
current.pos.y = home.pos.y + mWaterLv;
}
field_0x605 = mSwitch2;
mSwStatePostEvent = mSwCurrentState;
mMode = WAIT;
} else {
mode_init_levelCtrl();
@@ -383,7 +435,7 @@ bool daLv3Water_c::eventStart() {
}
static int daLv3Water_Draw(daLv3Water_c* i_this) {
return i_this->Draw();
return i_this->MoveBGDraw();
}
static int daLv3Water_Execute(daLv3Water_c* i_this) {
@@ -391,11 +443,14 @@ static int daLv3Water_Execute(daLv3Water_c* i_this) {
}
static int daLv3Water_Delete(daLv3Water_c* i_this) {
fopAcM_RegisterDeleteID(i_this, "daTreeSh"); //! @note Suggests copy-and-pasting from d_a_obj_treesh
return i_this->MoveBGDelete();
}
static int daLv3Water_Create(fopAc_ac_c* i_this) {
return static_cast<daLv3Water_c*>(i_this)->create();
daLv3Water_c* const actor = static_cast<daLv3Water_c*>(i_this);
fopAcM_RegisterCreateID(i_this, "daLv3Water");
return actor->create();
}
static actor_method_class l_daLv3Water_Method = {
+242 -221
View File
@@ -1,12 +1,13 @@
/**
* @file d_a_obj_lv3Water2.cpp
*
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_lv3Water2.h"
#include "d/d_com_inf_game.h"
#include "f_ap/f_ap_game.h"
#include "f_op/f_op_msg_mng.h"
#include "m_Do/m_Do_graphic.h"
@@ -40,10 +41,249 @@ void daLv3Water2_HIO_c::genMessage(JORMContext* ctx) {
static char* l_resNameIdx[] = {"Kr03wat04"};
void daLv3Water2_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::YrotM(shape_angle.y);
mpModel->setBaseScale(scale);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
static const int l_bmdIdx[] = {5};
static const int l_dzbIdx[] = {13};
static const int l_btkIdx[] = {9};
int daLv3Water2_c::CreateHeap() {
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(l_resNameIdx[mResIdx], l_bmdIdx[mResIdx]));
JUT_ASSERT(171, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, (1 << 19), 0x19000284);
if(!mpModel)
return 0;
int res = mRefractionAnm.init(modelData, static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(l_resNameIdx[mResIdx], l_btkIdx[mResIdx])), 1, 2, 1.0f, 0, -1);
JUT_ASSERT(188, res == 1);
return 1;
}
cPhs_Step daLv3Water2_c::create() {
fopAcM_ct(this, daLv3Water2_c);
mResIdx = getParam(0, 4);
cPhs_Step resPhase = static_cast<cPhs_Step>(dComIfG_resLoad(&mPhase, l_resNameIdx[mResIdx]));
if(resPhase == cPhs_COMPLEATE_e) {
if(MoveBGCreate(l_resNameIdx[mResIdx], l_dzbIdx[mResIdx], NULL, 0x2D00, NULL) == cPhs_ERROR_e)
return cPhs_ERROR_e;
mEastSwInitialState = fopAcM_isSwitch(this, getParamSw1());
mWestSwInitialState = fopAcM_isSwitch(this, getParamSw2());
setBaseMtx();
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
if(mEastSwInitialState)
current.pos.y = home.pos.y + getParamLevel1() * 5.0f;
if(mWestSwInitialState)
current.pos.y = home.pos.y + getParamLevel1() * 5.0f + getParamLevel1() * 5.0f;
mMode = WAIT;
// "LV3 Water surface (2SW)"
#if DEBUG
l_HIO.entryHIO("LV3水面(2SW)");
#endif
}
return resPhase;
}
static actionFunc l_mode_func[] = {
&daLv3Water2_c::mode_proc_wait, &daLv3Water2_c::mode_proc_levelCtrl
&daLv3Water2_c::mode_proc_wait, &daLv3Water2_c::mode_proc_levelCtrl
};
int daLv3Water2_c::Execute(Mtx** i_mtx) {
mRefractionAnm.play();
eventUpdate();
mEastSwCurrentState = fopAcM_isSwitch(this, getParamSw1());
mWestSwCurrentState = fopAcM_isSwitch(this, getParamSw2());
(this->*l_mode_func[mMode])();
if(fopAcM_isSwitch(this, 0xE)) {
mEastParticles[0] = dComIfGp_particle_set(mEastParticles[0], 0x8AAC, &current.pos, NULL, NULL);
mEastParticles[1] = dComIfGp_particle_set(mEastParticles[1], 0x8AAD, &current.pos, NULL, NULL);
mEastParticles[2] = dComIfGp_particle_set(mEastParticles[2], 0x8AAE, &current.pos, NULL, NULL);
mEastParticles[3] = dComIfGp_particle_set(mEastParticles[3], 0x8AAF, &current.pos, NULL, NULL);
}
if(fopAcM_isSwitch(this, 0xF)) {
mWestParticles[0] = dComIfGp_particle_set(mWestParticles[0], 0x8AA8, &current.pos, NULL, NULL);
mWestParticles[1] = dComIfGp_particle_set(mWestParticles[1], 0x8AA9, &current.pos, NULL, NULL);
mWestParticles[2] = dComIfGp_particle_set(mWestParticles[2], 0x8AAA, &current.pos, NULL, NULL);
mWestParticles[3] = dComIfGp_particle_set(mWestParticles[3], 0x8AAB, &current.pos, NULL, NULL);
}
*i_mtx = &mpModel->getBaseTRMtx();
setBaseMtx();
return 1;
}
void daLv3Water2_c::mode_proc_wait() {
if(mEastSwInitialState != mEastSwCurrentState) {
if(getParamEvent() != 0xFF)
orderEvent(getParamEvent(), 0xFF, 1);
else
eventStart();
}
else if(mWestSwInitialState != mWestSwCurrentState) {
if(getParamEvent2() != 0xFF)
orderEvent(getParamEvent2(), 0xFF, 1);
else
eventStart();
}
}
void daLv3Water2_c::mode_init_levelCtrl() {
mCurrentWaterLvFrame = 0;
mLvControlWaitFrames = l_HIO.mLevelControlWaitFrames;
mBaseYPos = current.pos.y;
mMode = LEVEL_CTRL;
}
void daLv3Water2_c::mode_proc_levelCtrl() {
if(mLvControlWaitFrames) {
mLvControlWaitFrames--;
return;
}
f32 ratioOfWaterLevelFramesAdvancedToTarget = fopMsgM_valueIncrease(mWaterLvFrame, mCurrentWaterLvFrame, mEvActivatorSwState);
if(!mEastSwInitialState) {
// Water level should lower, invert the ratio so that it goes (1.0f -> 0.0f)
ratioOfWaterLevelFramesAdvancedToTarget = 1.0f - ratioOfWaterLevelFramesAdvancedToTarget;
}
mCurrentWaterLvFrame++;
if(mCurrentWaterLvFrame >= mWaterLvFrame) {
ratioOfWaterLevelFramesAdvancedToTarget = mEvActivatorSwState;
mMode = WAIT;
}
current.pos.y = mWaterLv * ratioOfWaterLevelFramesAdvancedToTarget + mBaseYPos;
}
int daLv3Water2_c::Draw() {
J3DTexMtxInfo* texMtxInfo;
J3DModelData* modelData;
J3DMaterial* btkMaterial;
g_env_light.settingTevStruct(16, &current.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
modelData = mpModel->getModelData();
mRefractionAnm.entry(modelData);
btkMaterial = modelData->getMaterialNodePointer(0);
dComIfGd_setListInvisisble();
if(btkMaterial->getTexGenBlock()->getTexMtx(0)) {
texMtxInfo = &btkMaterial->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if(texMtxInfo) {
Mtx lightProjMtx;
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0);
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightProjMtx);
#endif
#if DEBUG
if(fapGm_HIO_c::isCaptureScreen()) {
Mtx44 screenCaptureMtx;
MTXCopy(lightProjMtx, screenCaptureMtx);
screenCaptureMtx[2][3] = -2.0f;
CPerspDivider perspectiveDivider(screenCaptureMtx, fapGm_HIO_c::getCaptureScreenDivH(), fapGm_HIO_c::getCaptureScreenDivV());
perspectiveDivider.divide(screenCaptureMtx, fapGm_HIO_c::getCaptureScreenNumH(), fapGm_HIO_c::getCaptureScreenNumV());
screenCaptureMtx[2][3] = 0.0f;
MTXCopy(screenCaptureMtx, lightProjMtx);
}
#endif
texMtxInfo->setEffectMtx(lightProjMtx);
modelData->simpleCalcMaterial(const_cast<MtxP>(j3dDefaultMtx));
}
}
mDoExt_modelUpdateDL(mpModel);
dComIfGd_setList();
return 1;
}
int daLv3Water2_c::Delete() {
dComIfG_resDelete(&mPhase, l_resNameIdx[mResIdx]);
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
bool daLv3Water2_c::eventStart() {
// Check which switch initiated the event
if(mEastSwInitialState != mEastSwCurrentState) {
mWaterLv = getParamLevel1() * 5.0f;
mWaterLvFrame = static_cast<u8>(getParamFrame1());
mEvActivatorSwState = mEastSwCurrentState;
mEastSwInitialState = mEastSwCurrentState;
mDoAud_seStart(Z2SE_ENV_FILL_UP_LV3WTR1, &current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
else {
mWaterLv = getParamLevel1() * 5.0f;
mWaterLvFrame = static_cast<u8>(getParamFrame2());
mEvActivatorSwState = mWestSwCurrentState;
mWestSwInitialState = mWestSwCurrentState;
mDoAud_seStart(Z2SE_ENV_FILL_UP_LV3WTR2, &current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
OS_REPORT("== mWaterLv %f mWaterLvFrame %d ==\n", mWaterLv, mWaterLvFrame);
mode_init_levelCtrl();
return true;
}
static int daLv3Water2_Draw(daLv3Water2_c* i_this) {
return i_this->MoveBGDraw();
}
static int daLv3Water2_Execute(daLv3Water2_c* i_this) {
return i_this->MoveBGExecute();
}
static int daLv3Water2_Delete(daLv3Water2_c* i_this) {
fopAcM_RegisterDeleteID(i_this, "daLv3Water2");
return i_this->MoveBGDelete();
}
static int daLv3Water2_Create(fopAc_ac_c* i_this) {
daLv3Water2_c* const actor = static_cast<daLv3Water2_c*>(i_this);
fopAcM_RegisterCreateID(i_this, "daLv3Water2");
return actor->create();
}
static actor_method_class l_daLv3Water2_Method = {
(process_method_func)daLv3Water2_Create,
(process_method_func)daLv3Water2_Delete,
@@ -68,222 +308,3 @@ actor_process_profile_definition g_profile_Obj_Lv3Water2 = {
fopAc_ACTOR_e, // mActorType
fopAc_CULLBOX_CUSTOM_e, // cullType
};
void daLv3Water2_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::YrotM(shape_angle.y);
mpModel->setBaseScale(scale);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
static const int l_bmdIdx[] = {5};
static const int l_dzbIdx[] = {13};
static const int l_btkIdx[] = {9};
int daLv3Water2_c::CreateHeap() {
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(l_resNameIdx[mResourceIndex], l_bmdIdx[mResourceIndex]));
JUT_ASSERT(171, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, (1 << 19), 0x19000284);
if(!mpModel)
return 0;
int res = mWaterSurfaceRefractionAnm.init(modelData, static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(l_resNameIdx[mResourceIndex], l_btkIdx[mResourceIndex])), 1, 2, 1.0f, 0, -1);
JUT_ASSERT(188, res == 1);
return 1;
}
cPhs_Step daLv3Water2_c::create() {
fopAcM_ct(this, daLv3Water2_c);
mResourceIndex = getParam(0, 4);
cPhs_Step resPhase = static_cast<cPhs_Step>(dComIfG_resLoad(&mPhase, l_resNameIdx[mResourceIndex]));
if(resPhase == cPhs_COMPLEATE_e) {
if(MoveBGCreate(l_resNameIdx[mResourceIndex], l_dzbIdx[mResourceIndex], NULL, 0x2D00, NULL) == cPhs_ERROR_e)
return cPhs_ERROR_e;
mEastSwInitialStatus = fopAcM_isSwitch(this, getParamSw1());
mWestSwInitialStatus = fopAcM_isSwitch(this, getParamSw2());
setBaseMtx();
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
if(mEastSwInitialStatus)
current.pos.y = home.pos.y + getParamLevel1() * 5.0f;
if(mWestSwInitialStatus)
current.pos.y = home.pos.y + getParamLevel1() * 5.0f + getParamLevel1() * 5.0f;
mMode = WAIT;
// "LV3 Water surface (2SW)"
#if DEBUG
l_HIO.entryHIO("LV3水面(2SW)");
#endif
}
return resPhase;
}
int daLv3Water2_c::Execute(Mtx** i_mtx) {
mWaterSurfaceRefractionAnm.play();
eventUpdate();
mEastSwCurrentStatus = fopAcM_isSwitch(this, getParamSw1());
mWestSwCurrentStatus = fopAcM_isSwitch(this, getParamSw2());
(this->*l_mode_func[mMode])();
if(fopAcM_isSwitch(this, 0xE)) {
mEastWaterParticles[0] = dComIfGp_particle_set(mEastWaterParticles[0], 0x8AAC, &current.pos, NULL, NULL);
mEastWaterParticles[1] = dComIfGp_particle_set(mEastWaterParticles[1], 0x8AAD, &current.pos, NULL, NULL);
mEastWaterParticles[2] = dComIfGp_particle_set(mEastWaterParticles[2], 0x8AAE, &current.pos, NULL, NULL);
mEastWaterParticles[3] = dComIfGp_particle_set(mEastWaterParticles[3], 0x8AAF, &current.pos, NULL, NULL);
}
if(fopAcM_isSwitch(this, 0xF)) {
mWestWaterParticles[0] = dComIfGp_particle_set(mWestWaterParticles[0], 0x8AA8, &current.pos, NULL, NULL);
mWestWaterParticles[1] = dComIfGp_particle_set(mWestWaterParticles[1], 0x8AA9, &current.pos, NULL, NULL);
mWestWaterParticles[2] = dComIfGp_particle_set(mWestWaterParticles[2], 0x8AAA, &current.pos, NULL, NULL);
mWestWaterParticles[3] = dComIfGp_particle_set(mWestWaterParticles[3], 0x8AAB, &current.pos, NULL, NULL);
}
*i_mtx = &mpModel->getBaseTRMtx();
setBaseMtx();
return 1;
}
void daLv3Water2_c::mode_proc_wait() {
if(mEastSwInitialStatus != mEastSwCurrentStatus) {
if(getParamEvent() != 0xFF)
orderEvent(getParamEvent(), 0xFF, 1);
else
eventStart();
}
else if(mWestSwInitialStatus != mWestSwCurrentStatus) {
if(getParamEvent2() != 0xFF)
orderEvent(getParamEvent2(), 0xFF, 1);
else
eventStart();
}
}
void daLv3Water2_c::mode_init_levelCtrl() {
mCurrentWaterLvFrame = 0;
mLevelControlWaitFrames = l_HIO.mLevelControlWaitFrames;
mBaseYPos = current.pos.y;
mMode = LEVEL_CTRL;
}
void daLv3Water2_c::mode_proc_levelCtrl() {
if(mLevelControlWaitFrames) {
mLevelControlWaitFrames--;
}
else {
f32 currentRatio = fopMsgM_valueIncrease(mWaterLvFrame, mCurrentWaterLvFrame, mFullRatio);
if(!mEastSwInitialStatus)
currentRatio = 1.0f - currentRatio;
mCurrentWaterLvFrame++;
if(mCurrentWaterLvFrame >= mWaterLvFrame) {
currentRatio = mFullRatio;
mMode = WAIT;
}
current.pos.y = mWaterLv * currentRatio + mBaseYPos;
}
}
int daLv3Water2_c::Draw() {
g_env_light.settingTevStruct(16, &current.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
J3DModelData* modelData = mpModel->getModelData();
mWaterSurfaceRefractionAnm.entry(modelData);
J3DMaterial* const btkMaterial = modelData->getMaterialNodePointer(0);
dComIfGd_setListInvisisble();
if(btkMaterial->getTexGenBlock()->getTexMtx(0)) {
J3DTexMtxInfo* texMtxInfo = &btkMaterial->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo();
if(texMtxInfo) {
Mtx lightProjMtx;
C_MTXLightPerspective(lightProjMtx, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0);
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(lightProjMtx);
/* TODO: Handle screen capture perspective calculations */
#endif
texMtxInfo->setEffectMtx(lightProjMtx);
modelData->simpleCalcMaterial(const_cast<MtxP>(j3dDefaultMtx));
}
}
mDoExt_modelUpdateDL(mpModel);
dComIfGd_setList();
return 1;
}
int daLv3Water2_c::Delete() {
dComIfG_resDelete(&mPhase, l_resNameIdx[mResourceIndex]);
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
bool daLv3Water2_c::eventStart() {
if(mEastSwInitialStatus != mEastSwCurrentStatus) {
mWaterLv = getParamLevel1() * 5.0f;
mWaterLvFrame = static_cast<u8>(getParamFrame1());
mFullRatio = mEastSwCurrentStatus;
mEastSwInitialStatus = mEastSwCurrentStatus;
mDoAud_seStart(Z2SE_ENV_FILL_UP_LV3WTR1, &current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
else {
mWaterLv = getParamLevel1() * 5.0f;
mWaterLvFrame = static_cast<u8>(getParamFrame2());
mFullRatio = mWestSwCurrentStatus;
mWestSwInitialStatus = mWestSwCurrentStatus;
mDoAud_seStart(Z2SE_ENV_FILL_UP_LV3WTR2, &current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
OS_REPORT("== mWaterLv %f mWaterLvFrame %d ==\n", mWaterLv, mWaterLvFrame);
mode_init_levelCtrl();
return true;
}
static int daLv3Water2_Draw(daLv3Water2_c* i_this) {
return i_this->MoveBGDraw();
}
static int daLv3Water2_Execute(daLv3Water2_c* i_this) {
return i_this->MoveBGExecute();
}
static int daLv3Water2_Delete(daLv3Water2_c* i_this) {
const fpc_ProcID procID = fopAcM_GetID(i_this);
return i_this->MoveBGDelete();
}
static int daLv3Water2_Create(fopAc_ac_c* i_this) {
daLv3Water2_c* const lv3Water2 = static_cast<daLv3Water2_c*>(i_this);
const fpc_ProcID procID = fopAcM_GetID(i_this);
return lv3Water2->create();
}
+57 -42
View File
@@ -9,10 +9,15 @@
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "d/d_bg_w.h"
#include "d/d_com_inf_game.h"
#include "d/d_s_play.h"
#include "f_op/f_op_actor.h"
#include "f_op/f_op_actor_mng.h"
static int daObj_Lv3waterB_Draw(obj_lv3WaterB_class* i_this) {
g_env_light.settingTevStruct(0x10, &i_this->current.pos, &i_this->tevStr);
g_env_light.setLightTevColorType_MAJI(i_this->mpBWaterModel, &i_this->tevStr);
fopAc_ac_c* const actor = i_this;
g_env_light.settingTevStruct(0x10, &actor->current.pos, &actor->tevStr);
g_env_light.setLightTevColorType_MAJI(i_this->mpBWaterModel, &actor->tevStr);
i_this->mpBWaterBtk->entry(i_this->mpBWaterModel->getModelData());
@@ -24,15 +29,19 @@ static int daObj_Lv3waterB_Draw(obj_lv3WaterB_class* i_this) {
Mtx m;
C_MTXLightPerspective(m, dComIfGd_getView()->fovy, dComIfGd_getView()->aspect, 1.0f,
1.0f, -0.015f, 0.0f);
#if WIDESCREEN_SUPPORT
mDoGph_gInf_c::setWideZoomLightProjection(m);
#endif
tex_mtx_info->setEffectMtx(m);
i_this->mpBWaterModel->getModelData()->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx);
i_this->mpBWaterModel->getModelData()->simpleCalcMaterial((MtxP)j3dDefaultMtx);
}
}
mDoExt_modelUpdateDL(i_this->mpBWaterModel);
if (i_this->mpOctHibiModel != NULL) {
g_env_light.setLightTevColorType_MAJI(i_this->mpOctHibiModel, &i_this->tevStr);
g_env_light.setLightTevColorType_MAJI(i_this->mpOctHibiModel, &actor->tevStr);
dComIfGd_setListBG();
mDoExt_modelUpdateDL(i_this->mpOctHibiModel);
@@ -43,6 +52,8 @@ static int daObj_Lv3waterB_Draw(obj_lv3WaterB_class* i_this) {
}
static void action(obj_lv3WaterB_class* i_this) {
fopAc_ac_c* const actor = i_this;
switch (i_this->mAction) {
case LV3WATERB_ACT_WAIT:
break;
@@ -55,16 +66,16 @@ static void action(obj_lv3WaterB_class* i_this) {
dKy_custom_colset(4, 4, 0.0f);
if (i_this->field_0x586 == 0) {
i_this->current.pos.y = (i_this->home.pos.y - 14450.0f) + 160.0f + 4000.0f;
actor->current.pos.y = (actor->home.pos.y - 14450.0f) + AREG_F(17) + 160.0f + 4000.0f + AREG_F(16);
i_this->field_0x586 = 1;
}
cLib_addCalc2(&i_this->current.pos.y, (i_this->home.pos.y - 14450.0f) + 160.0f, 0.05f,
10.0f);
cLib_addCalc2(&actor->current.pos.y, (actor->home.pos.y - 14450.0f) + AREG_F(17) + 160.0f, 0.05f,
10.0f + AREG_F(19));
break;
}
mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z);
mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z);
i_this->mpBWaterModel->setBaseTRMtx(mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), i_this->mpBWaterMtx);
@@ -81,6 +92,8 @@ static void action(obj_lv3WaterB_class* i_this) {
}
static int daObj_Lv3waterB_Execute(obj_lv3WaterB_class* i_this) {
fopAc_ac_c* const actor = i_this;
action(i_this);
return 1;
}
@@ -90,7 +103,9 @@ static int daObj_Lv3waterB_IsDelete(obj_lv3WaterB_class* i_this) {
}
static int daObj_Lv3waterB_Delete(obj_lv3WaterB_class* i_this) {
fopAcM_GetID(i_this);
fopAc_ac_c* const actor = i_this;
fopAcM_RegisterDeleteID(i_this, "Obj_Lv3waterB");
dComIfG_resDelete(&i_this->mBWaterPhase, "L3_bwater");
dComIfG_resDelete(&i_this->mOcthibiPhase, "S_octhibi");
@@ -104,53 +119,53 @@ static int daObj_Lv3waterB_Delete(obj_lv3WaterB_class* i_this) {
}
static int useHeapInit(fopAc_ac_c* i_this) {
obj_lv3WaterB_class* a_this = static_cast<obj_lv3WaterB_class*>(i_this);
obj_lv3WaterB_class* const actor = static_cast<obj_lv3WaterB_class*>(i_this);
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("L3_bwater", 5);
JUT_ASSERT(0, modelData != NULL);
JUT_ASSERT(308, modelData != NULL);
a_this->mpBWaterModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284);
if (a_this->mpBWaterModel == NULL) {
actor->mpBWaterModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284);
if (actor->mpBWaterModel == NULL) {
return 0;
}
a_this->mpBWaterBtk = new mDoExt_btkAnm();
if (a_this->mpBWaterBtk == NULL) {
actor->mpBWaterBtk = new mDoExt_btkAnm();
if (actor->mpBWaterBtk == NULL) {
return 0;
}
J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("L3_bwater", 8);
if (!a_this->mpBWaterBtk->init(a_this->mpBWaterModel->getModelData(), btk, TRUE,
J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1))
if (!actor->mpBWaterBtk->init(actor->mpBWaterModel->getModelData(),
(J3DAnmTextureSRTKey*)dComIfG_getObjectRes("L3_bwater", 8),
TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1))
{
return 0;
}
a_this->mpBWaterBgW = new dBgW();
if (a_this->mpBWaterBgW == NULL) {
actor->mpBWaterBgW = new dBgW();
if (actor->mpBWaterBgW == NULL) {
return 0;
}
cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes("L3_bwater", 11);
if (a_this->mpBWaterBgW->Set(dzb, dBgW::MOVE_BG_e, &a_this->mpBWaterMtx) == true) {
if (actor->mpBWaterBgW->Set((cBgD_t*)dComIfG_getObjectRes("L3_bwater", 11),
dBgW::MOVE_BG_e, &actor->mpBWaterMtx) == true) {
return 0;
}
modelData = (J3DModelData*)dComIfG_getObjectRes("S_octhibi", 4);
JUT_ASSERT(0, modelData != NULL);
JUT_ASSERT(343, modelData != NULL);
a_this->mpOctHibiModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (a_this->mpOctHibiModel == NULL) {
actor->mpOctHibiModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (actor->mpOctHibiModel == NULL) {
return 0;
}
a_this->mpOctHibiBgW = new dBgW();
if (a_this->mpOctHibiBgW == NULL) {
actor->mpOctHibiBgW = new dBgW();
if (actor->mpOctHibiBgW == NULL) {
return 0;
}
dzb = (cBgD_t*)dComIfG_getObjectRes("S_octhibi", 7);
if (a_this->mpOctHibiBgW->Set(dzb, dBgW::MOVE_BG_e, &a_this->mpOctHibiMtx) == true) {
if (actor->mpOctHibiBgW->Set((cBgD_t*) dComIfG_getObjectRes("S_octhibi", 7),
dBgW::MOVE_BG_e, &actor->mpOctHibiMtx) == true) {
return 0;
}
@@ -158,38 +173,38 @@ static int useHeapInit(fopAc_ac_c* i_this) {
}
static int daObj_Lv3waterB_Create(fopAc_ac_c* i_this) {
obj_lv3WaterB_class* a_this = static_cast<obj_lv3WaterB_class*>(i_this);
fopAcM_ct(a_this, obj_lv3WaterB_class);
obj_lv3WaterB_class* const actor = static_cast<obj_lv3WaterB_class*>(i_this);
fopAcM_ct(actor, obj_lv3WaterB_class);
int phase_state = dComIfG_resLoad(&a_this->mBWaterPhase, "L3_bwater");
int octhibi_phase_state = dComIfG_resLoad(&a_this->mOcthibiPhase, "S_octhibi");
int phase_state = dComIfG_resLoad(&actor->mBWaterPhase, "L3_bwater");
int octhibi_phase_state = dComIfG_resLoad(&actor->mOcthibiPhase, "S_octhibi");
if (phase_state == cPhs_COMPLEATE_e && octhibi_phase_state == cPhs_COMPLEATE_e) {
OS_REPORT("OBJ_LV3WATERB PARAM %x\n", fopAcM_GetParam(a_this));
OS_REPORT("OBJ_LV3WATERB PARAM %x\n", fopAcM_GetParam(i_this));
OS_REPORT("OBJ_LV3WATERB//////////////OBJ_LV3WATERB SET 1 !!\n");
if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x4B000)) {
if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x4B000)) {
OS_REPORT("//////////////OBJ_LV3WATERB SET NON !!\n");
return cPhs_ERROR_e;
}
OS_REPORT("//////////////OBJ_LV3WATERB SET 2 !!\n");
if (dComIfG_Bgsp().Regist(a_this->mpBWaterBgW, a_this)) {
if (dComIfG_Bgsp().Regist(actor->mpBWaterBgW, actor)) {
return cPhs_ERROR_e;
}
if (dComIfG_Bgsp().Regist(a_this->mpOctHibiBgW, a_this)) {
if (dComIfG_Bgsp().Regist(actor->mpOctHibiBgW, actor)) {
return cPhs_ERROR_e;
}
if (dComIfGs_isStageBossEnemy()) {
a_this->current.pos.y = (a_this->home.pos.y - 14450.0f) + 160.0f;
a_this->mAction = LV3WATERB_ACT_END;
a_this->field_0x586 = 1;
a_this->mpOctHibiModel = NULL;
i_this->current.pos.y = (i_this->home.pos.y - 14450.0f) + AREG_F(17) + 160.0f;
actor->mAction = LV3WATERB_ACT_END;
actor->field_0x586 = 1;
actor->mpOctHibiModel = NULL;
}
daObj_Lv3waterB_Execute(a_this);
daObj_Lv3waterB_Execute(actor);
return phase_state;
} else if (phase_state == cPhs_COMPLEATE_e) {
return octhibi_phase_state;
+49 -4
View File
@@ -9,14 +9,44 @@
#include "d/d_bg_w.h"
#include "d/d_com_inf_game.h"
#include "d/d_procname.h"
#include "m_Do/m_Do_mtx.h"
static char* l_arcName[] = {"Obj_saka", "Obj_saka2"};
#if DEBUG
class daObjLv3saka_HIO_c : public mDoHIO_entry_c {
public:
daObjLv3saka_HIO_c();
~daObjLv3saka_HIO_c() {}
void genMessage(JORMContext*);
/* 0x08 */ f32 field_0x08;
/* 0x0C */ u8 field_0x0C;
};
static daObjLv3saka_HIO_c l_HIO;
daObjLv3saka_HIO_c::daObjLv3saka_HIO_c() {
field_0x08 = 0.0f;
field_0x0C = 0;
}
void daObjLv3saka_HIO_c::genMessage(JORMContext* mctx) {
/* Flowing Water Slippery Surface */
mctx->genLabel("水が流れると滑る", 0);
mctx->genCheckBox("チェック描画", &field_0x0C, 0x1);
}
#endif
void daObjLv3saka_c::initBaseMtx() {
setBaseMtx();
}
void daObjLv3saka_c::setBaseMtx() {
MTXTrans(mDoMtx_stack_c::now, current.pos.x, current.pos.y, current.pos.z);
mDoMtx_YrotM(mDoMtx_stack_c::get(), shape_angle.y);
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::YrotM(shape_angle.y);
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
}
@@ -42,8 +72,6 @@ static int const l_dzbIdx[] = {3, 3};
static int const l_dzbIdx2[] = {4, 4};
static char* l_arcName[] = {"Obj_saka", "Obj_saka2"};
int daObjLv3saka_c::CreateHeap() {
mpBgW2 = new dBgW();
if (mpBgW2 == NULL ||
@@ -67,6 +95,10 @@ int daObjLv3saka_c::create1st() {
if (phase == cPhs_ERROR_e) {
return phase;
}
#if DEBUG
l_HIO.entryHIO("水が流れると滑る"); // "Flowing water slippery surface"
#endif
}
return phase;
}
@@ -105,6 +137,14 @@ void daObjLv3saka_c::setWtrDzb() {
}
int daObjLv3saka_c::Draw() {
#if DEBUG
if(l_HIO.field_0x0C) {
if(mpBgW->ChkUsed())
mpBgW->DebugDraw();
else if(mpBgW2->ChkUsed())
mpBgW2->DebugDraw();
}
#endif
return 1;
}
@@ -113,6 +153,11 @@ int daObjLv3saka_c::Delete() {
dComIfG_Bgsp().Release(mpBgW2);
}
dComIfG_resDelete(&mPhase, l_arcName[getType()]);
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
+10 -1
View File
@@ -8,6 +8,7 @@
#include "d/actor/d_a_obj_lv3waterEff.h"
#include "d/d_com_inf_game.h"
#include "d/d_procname.h"
#include "f_op/f_op_actor_mng.h"
static u16 const l_eff_id[] = {
0x86D2,
@@ -20,6 +21,11 @@ int daObjWaterEff_c::Create() {
for (int i = 0; i < 4; i++) {
mParticles[i] = dComIfGp_particle_set(l_eff_id[i], &current.pos, NULL, NULL, 0xFF, NULL, -1,
NULL, NULL, NULL);
if(mParticles[i] == NULL) {
// "LV3R09 Water flow effect: Effect <%d> could not be set"
OS_REPORT_ERROR("Lv3R09水流エフェクト:エフェクト<%d>セットできませんでした\n");
}
}
mSePositions[0].set(14420.0f, -1100.0f, -4950.0f);
@@ -76,11 +82,14 @@ static int daObjWaterEff_Execute(daObjWaterEff_c* i_this) {
}
static int daObjWaterEff_Delete(daObjWaterEff_c* i_this) {
const fpc_ProcID id = fopAcM_GetID(i_this);
return i_this->_delete();
}
static int daObjWaterEff_Create(fopAc_ac_c* i_this) {
return static_cast<daObjWaterEff_c*>(i_this)->create();
daObjWaterEff_c* const actor = static_cast<daObjWaterEff_c*>(i_this);
const fpc_ProcID id = fopAcM_GetID(i_this);
return actor->create();
}
static actor_method_class l_daObjWaterEff_Method = {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+231 -152
View File
@@ -4,11 +4,18 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep
#if DEBUG
#include "d/d_debug_viewer.h"
#endif
#include "d/actor/d_a_obj_waterfall.h"
#include "d/actor/d_a_arrow.h"
#include "d/d_com_inf_game.h"
#include "d/d_bomb.h"
#include "SSystem/SComponent/c_math.h"
#include "f_op/f_op_actor.h"
#include "f_op/f_op_actor_mng.h"
#include "m_Do/m_Do_mtx.h"
#define MAX_TARGET_INFO_COUNT 10
@@ -17,18 +24,88 @@ static int daObjWaterFall_Execute(daObjWaterFall_c* i_this);
static int daObjWaterFall_Delete(daObjWaterFall_c* i_this);
static int daObjWaterFall_Create(fopAc_ac_c* i_this);
static fopAc_ac_c* target_info[MAX_TARGET_INFO_COUNT];
static fopAc_ac_c* target_info[MAX_TARGET_INFO_COUNT]; // Mutually exclusive list of bomb/arrow actors to be potentially deleted
static int target_info_count;
static s32 target_info_count;
const char* l_arcName = "sample";
#if DEBUG
static cull_box l_cull_box = {
{-200.0f, -100.0f, -200.0f},
{200.0f, 100.0f, 200.0f}
};
static dCcD_SrcTri l_tri_src = {
{
{0, {{0, 0, 0}, {0x6002, 0x11}, 0}},
{dCcD_SE_NONE, 0, 0, 0, {0}},
{dCcD_SE_NONE, 0, 0, 0, {0x84}},
{0},
},
{
{
{0.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.0f},
},
},
};
#endif
static dCcD_SrcCyl l_cyl_src = {
{
{0x0, {{0x0, 0x0, 0x0}, {0x2, 0x10}, 0x119}}, // mObj
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x84}, // mGObjTg
{0x2}, // mGObjCo
}, // mObjInf
{
{
{0.0f, 0.0f, 0.0f}, // mCenter
0.0f, // mRadius
0.0f // mHeight
} // mCyl
}
};
#if DEBUG
class daObjWaterFall_HIO_c : public mDoHIO_entry_c {
public:
daObjWaterFall_HIO_c();
~daObjWaterFall_HIO_c() {}
void genMessage(JORMContext*);
/* 0x08 */ f32 mPushStrengthHuman;
/* 0x0C */ f32 mPushStrengthWolf;
};
static daObjWaterFall_HIO_c l_HIO;
daObjWaterFall_HIO_c::daObjWaterFall_HIO_c() {
mPushStrengthHuman = 10.0f;
mPushStrengthWolf = 25.0f;
}
void daObjWaterFall_HIO_c::genMessage(JORMContext* mctx) {
/* Waterfall */
mctx->genLabel("", 0);
// Pushing force ・ human
mctx->genSlider("押す力・人間", &mPushStrengthHuman, 0.0f, 100.0f);
// Pushing force ・ wolf
mctx->genSlider("押す力・狼", &mPushStrengthWolf, 0.0f, 100.0f);
}
#endif
static void* s_b_sub(void* param_0, void* unused) {
if(fopAcM_IsActor(param_0) && fopAcM_GetName(param_0) == PROC_NBOMB) {
dBomb_c* foundBomb = static_cast<dBomb_c*>(param_0);
if(!foundBomb->checkWaterBomb(foundBomb) && fopAcM_GetParam(foundBomb) != dBomb_c::PRM_NORMAL_BOMB_EXPLODE) {
const u32 idx = target_info_count; // Regalloc issues if this isn't done
#define BOMB_ACTOR static_cast<dBomb_c*>(param_0)
UNUSED(unused);
if(fopAcM_IsActor(param_0) && dBomb_c::checkBombActor(BOMB_ACTOR)) {
if(!dBomb_c::checkWaterBomb(BOMB_ACTOR) && !BOMB_ACTOR->checkStateExplode()) {
if(target_info_count < MAX_TARGET_INFO_COUNT) {
target_info[idx] = foundBomb;
target_info[target_info_count] = BOMB_ACTOR;
target_info_count++;
}
}
@@ -37,12 +114,11 @@ static void* s_b_sub(void* param_0, void* unused) {
}
static void* s_a_sub(void* param_0, void* unused) {
UNUSED(unused);
if(fopAcM_IsActor(param_0) && fopAcM_GetName(param_0) == PROC_ARROW) {
const u32 idx = target_info_count; // Regalloc issues if this isn't done
if(target_info_count < MAX_TARGET_INFO_COUNT) {
daArrow_c* arrow_0 = static_cast<daArrow_c*>(param_0);
target_info[idx] = arrow_0;
target_info[target_info_count] = static_cast<daArrow_c*>(param_0);
target_info_count++;
}
}
@@ -50,10 +126,10 @@ static void* s_a_sub(void* param_0, void* unused) {
}
void daObjWaterFall_c::search_bomb() {
if(checkFallOut() != TRUE) {
if(!checkFallOut()) {
// Get rid of previously found arrow or bomb processes populating target_info
target_info_count = 0;
for(u32 i = 0; i < MAX_TARGET_INFO_COUNT; i++) {
for(int i = 0; i < MAX_TARGET_INFO_COUNT; i++) {
target_info[i] = NULL;
}
@@ -75,21 +151,23 @@ void daObjWaterFall_c::search_bomb() {
mDoMtx_stack_c::multVec(&vectorToOldBombPos, &vectorToOldBombPos);
mDoMtx_stack_c::multVec(&vectorToCurrentBombPos, &vectorToCurrentBombPos);
bool bombPassedZOriginPrevAndCurrentBombPosAreWithinXYBounds = (
(vectorToOldBombPos.z * vectorToCurrentBombPos.z) < 0.0f &&
(vectorToOldBombPos.x > -scale.x * 50.0f && vectorToOldBombPos.x < scale.x * 50.0f) &&
// Bomb's Z position passed that of waterfall, and was within X,Y bounds both in the previous frame and current frame
bool multiFrameDeleteCondition = (
(vectorToOldBombPos.z * vectorToCurrentBombPos.z) < 0.0f &&
(vectorToOldBombPos.x > -scale.x * 50.0f && vectorToOldBombPos.x < scale.x * 50.0f) &&
(vectorToCurrentBombPos.x > -scale.x * 50.0f && vectorToCurrentBombPos.x < scale.x * 50.0f) &&
(vectorToOldBombPos.y > 0.0f && vectorToOldBombPos.y < scale.y * 100.0f) &&
(vectorToCurrentBombPos.y > 0.0f && vectorToCurrentBombPos.y < scale.y * 100.0f)
);
bool currentBombPosIsWithinXYZBounds = (
// Bomb is within X,Y,Z bounds in the current frame
bool currentFrameDeleteCondition = (
(vectorToCurrentBombPos.x > -scale.x * 50.0f && vectorToCurrentBombPos.x < scale.x * 50.0f) &&
(vectorToCurrentBombPos.y > 0.0f && vectorToCurrentBombPos.y < scale.y * 100.0f) &&
(vectorToCurrentBombPos.z > -scale.z * 50.0f && vectorToCurrentBombPos.z < scale.z * 50.0f)
);
if(bombPassedZOriginPrevAndCurrentBombPosAreWithinXYBounds || currentBombPosIsWithinXYZBounds)
if(multiFrameDeleteCondition || currentFrameDeleteCondition)
fopAcM_delete(bomb);
}
}
@@ -98,12 +176,12 @@ void daObjWaterFall_c::search_bomb() {
void daObjWaterFall_c::search_arrow() {
// Some waterfalls (e.g. in the Lakebed Temple) allow arrows to fly through them
if(getType() == ALLOW_ARROWS_e || checkFallOut() == TRUE)
if(getType() == ALLOW_ARROWS_e || checkFallOut())
return;
// Get rid of previously found arrow or bomb processes populating target_info
target_info_count = 0;
for(u32 i = 0; i < MAX_TARGET_INFO_COUNT; i++) {
for(int i = 0; i < MAX_TARGET_INFO_COUNT; i++) {
target_info[i] = NULL;
}
@@ -125,21 +203,23 @@ void daObjWaterFall_c::search_arrow() {
mDoMtx_stack_c::multVec(&vectorToOldArrowPos, &vectorToOldArrowPos);
mDoMtx_stack_c::multVec(&vectorToCurrentArrowPos, &vectorToCurrentArrowPos);
bool arrowPassedZOriginPrevAndCurrentArrowPosAreWithinXYBounds = (
(vectorToOldArrowPos.z * vectorToCurrentArrowPos.z) < 0.0f &&
(vectorToOldArrowPos.x > -scale.x * 50.0f && vectorToOldArrowPos.x < scale.x * 50.0f) &&
// Arrow's Z position passed that of waterfall, and was within X,Y bounds both in the previous frame and current frame
bool multiFrameDeleteCondition = (
(vectorToOldArrowPos.z * vectorToCurrentArrowPos.z) < 0.0f &&
(vectorToOldArrowPos.x > -scale.x * 50.0f && vectorToOldArrowPos.x < scale.x * 50.0f) &&
(vectorToCurrentArrowPos.x > -scale.x * 50.0f && vectorToCurrentArrowPos.x < scale.x * 50.0f) &&
(vectorToOldArrowPos.y > 0.0f && vectorToOldArrowPos.y < scale.y * 100.0f) &&
(vectorToCurrentArrowPos.y > 0.0f && vectorToCurrentArrowPos.y < scale.y * 100.0f)
);
bool currentArrowPosIsWithinXYZBounds = (
// Arrow is within X,Y,Z bounds in the current frame
bool currentFrameDeleteCondition = (
(vectorToCurrentArrowPos.x > -scale.x * 50.0f && vectorToCurrentArrowPos.x < scale.x * 50.0f) &&
(vectorToCurrentArrowPos.y > 0.0f && vectorToCurrentArrowPos.y < scale.y * 100.0f) &&
(vectorToCurrentArrowPos.z > -scale.z * 50.0f && vectorToCurrentArrowPos.z < scale.z * 50.0f)
);
if(arrowPassedZOriginPrevAndCurrentArrowPosAreWithinXYBounds || currentArrowPosIsWithinXYZBounds)
if(multiFrameDeleteCondition || currentFrameDeleteCondition)
fopAcM_delete(arrow);
}
}
@@ -150,31 +230,10 @@ void daObjWaterFall_c::initBaseMtx() {
}
void daObjWaterFall_c::setBaseMtx() {
cXyz* pos = fopAcM_GetPosition_p(this);
PSMTXTrans(mDoMtx_stack_c::get(), pos->x, pos->y, pos->z);
csXyz* shapeAngle = fopAcM_GetShapeAngle_p(this);
mDoMtx_stack_c::ZXYrotM(shapeAngle->x, shapeAngle->y, shapeAngle->z);
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
}
static const char* l_arcName = "sample";
static dCcD_SrcCyl l_cyl_src = {
{
{0x0, {{0x0, 0x0, 0x0}, {0x2, 0x10}, 0x119}}, // mObj
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x84}, // mGObjTg
{0x2}, // mGObjCo
}, // mObjInf
{
{
{0.0f, 0.0f, 0.0f}, // mCenter
0.0f, // mRadius
0.0f // mHeight
} // mCyl
}
};
cPhs_Step daObjWaterFall_c::Create() {
initBaseMtx();
@@ -190,35 +249,148 @@ cPhs_Step daObjWaterFall_c::Create() {
mCylCollider.OnCoNoCamHit();
// If a waterfall process is not a circular cylinder (i.e. scale.x != scale.z), the circular cylindrical collider
// is oscillated in order to approximate the elliptical shape of the process.
// If a waterfall process is not a circular cylinder (i.e. scale.x != scale.z), the circular cylindrical collider
// is oscillated in order to approximate an elliptical shape
//
// The member variable speedF (inherited from fopAc_ac_c) is used to control the speed of oscillation
// speedF is used to control the speed of oscillation
//
// This effect can be observed at the largest waterfall in Zora's Domain
if(scale.x > scale.z) {
mCylColliderCenterOscillationTargets[0].set((scale.x * -50.0f) + (scale.z * 50.0f), 0.0f,0.0f);
mCylColliderCenterOscillationTargets[1].set((scale.x * 50.0f) - (scale.z * 50.0f), 0.0f,0.0f);
mColOscPosTargets[0].set((scale.x * -50.0f) + (scale.z * 50.0f), 0.0f,0.0f);
mColOscPosTargets[1].set((scale.x * 50.0f) - (scale.z * 50.0f), 0.0f,0.0f);
speedF = ((scale.x * 100.0f) - (scale.z * 100.0f)) / 10.0f;
}
else {
mCylColliderCenterOscillationTargets[0].set(0.0f, 0.0f,(scale.z * -50.0f) + (scale.x * 50.0f));
mCylColliderCenterOscillationTargets[1].set(0.0f, 0.0f,(scale.z * 50.0f) - (scale.x * 50.0f));
// Oscillation position targets are <0, 0, 0> if scale.x == scale.z
mColOscPosTargets[0].set(0.0f, 0.0f,(scale.z * -50.0f) + (scale.x * 50.0f));
mColOscPosTargets[1].set(0.0f, 0.0f,(scale.z * 50.0f) - (scale.x * 50.0f));
speedF = ((scale.z * 100.0f) - (scale.x * 100.0f)) / 10.0f;
}
mDoMtx_stack_c::transS(home.pos);
mDoMtx_stack_c::YrotM(home.angle.y);
PSMTXMultVec(mDoMtx_stack_c::get(), &mCylColliderCenterOscillationTargets[0], &mCylColliderCenterOscillationTargets[0]);
PSMTXMultVec(mDoMtx_stack_c::get(), &mCylColliderCenterOscillationTargets[1], &mCylColliderCenterOscillationTargets[1]);
mDoMtx_stack_c::multVec(&mColOscPosTargets[0], &mColOscPosTargets[0]);
mDoMtx_stack_c::multVec(&mColOscPosTargets[1], &mColOscPosTargets[1]);
mCylColliderCenter = mCylColliderCenterOscillationTargets[0];
mCylColliderCenterQuantizedOscillation = 1;
mColCenter = mColOscPosTargets[0];
mColOscDir = 1; // Move collider toward mColOscPosTargets[1]
return cPhs_LOADING_e;
}
cPhs_Step daObjWaterFall_c::create() {
fopAcM_ct(this, daObjWaterFall_c);
if(Create() == cPhs_INIT_e) {
return cPhs_ERROR_e;
}
#if DEBUG
l_HIO.entryHIO(""); // "Waterfall"
#endif
return cPhs_COMPLEATE_e;
}
int daObjWaterFall_c::execute() {
if(getSwbit() != 0xFF && !fopAcM_isSwitch(this, getSwbit()))
return 1;
push_player();
search_bomb();
search_arrow();
if(mColOscDir > 0) {
if(cLib_chasePosXZ(&mColCenter, mColOscPosTargets[1], speedF))
mColOscDir = -1; // Move collider toward mColOscPosTargets[0]
}
else if(cLib_chasePosXZ(&mColCenter, mColOscPosTargets[0], speedF)) {
mColOscDir = 1; // Move collider toward mColOscPosTargets[1]
}
mCylCollider.SetC(mColCenter);
dComIfG_Ccsp()->Set(&mCylCollider);
return 1;
}
void daObjWaterFall_c::push_player() {
daPy_py_c* const player = daPy_getPlayerActorClass();
#if DEBUG
f32 outMagnitude = l_HIO.mPushStrengthHuman;
#else
f32 outMagnitude = 10.0f;
#endif
if(player->checkNowWolf()) {
#if DEBUG
outMagnitude = l_HIO.mPushStrengthWolf;
#else
outMagnitude = 25.0f;
#endif
}
if(scale.x == scale.z) {
// Waterfall is a circular cylinder
if(fopAcM_searchPlayerDistanceXZ(this) < scale.x * 50.0f) {
cXyz vectorToPlayer = player->current.pos - current.pos;
player->setOutPower(outMagnitude, cM_atan2s(vectorToPlayer.x, vectorToPlayer.z) , FALSE);
}
}
else {
// Waterfall is an elliptic cylinder
cXyz vectorToPlayer = player->current.pos - current.pos;
mDoMtx_stack_c::YrotS(-current.angle.y);
mDoMtx_stack_c::multVec(&vectorToPlayer, &vectorToPlayer);
if((vectorToPlayer.x > -scale.x * 50.0f && vectorToPlayer.x < scale.x * 50.0f) &&
vectorToPlayer.y > -10.0f && vectorToPlayer.y < scale.y * 100.0f) {
if(vectorToPlayer.z >= scale.z * 10.0f && vectorToPlayer.z < scale.z * 60.0f) {
player->setOutPower(outMagnitude, current.angle.y, FALSE);
}
else if(vectorToPlayer.z < scale.z * -10.0f && vectorToPlayer.z > scale.z * -60.0f) {
player->setOutPower(outMagnitude, (current.angle.y + (1 << 16)) - 0x8000, FALSE);
}
}
}
}
int daObjWaterFall_c::draw() {
return 1;
}
int daObjWaterFall_c::_delete() {
dComIfG_resDelete(&mPhase, l_arcName);
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
static int daObjWaterFall_Draw(daObjWaterFall_c* i_this) {
return i_this->draw();
}
static int daObjWaterFall_Execute(daObjWaterFall_c* i_this) {
return i_this->execute();
}
static int daObjWaterFall_Delete(daObjWaterFall_c* i_this) {
fopAcM_RegisterDeleteID(i_this, "WaterFall");
return i_this->_delete();
}
static int daObjWaterFall_Create(fopAc_ac_c* i_this) {
daObjWaterFall_c* const actor = static_cast<daObjWaterFall_c*>(i_this);
fopAcM_RegisterCreateID(i_this, "WaterFall");
return actor->create();
}
static actor_method_class l_daObjWaterFall_Method = {
(process_method_func)daObjWaterFall_Create,
(process_method_func)daObjWaterFall_Delete,
@@ -243,96 +415,3 @@ actor_process_profile_definition g_profile_Obj_WaterFall = {
fopAc_ACTOR_e, // mActorType
fopAc_CULLBOX_CUSTOM_e, // cullType
};
cPhs_Step daObjWaterFall_c::create() {
fopAcM_ct(this, daObjWaterFall_c);
if(Create() == cPhs_INIT_e) {
return cPhs_ERROR_e;
}
return cPhs_COMPLEATE_e;
}
int daObjWaterFall_c::execute() {
if(getSwbit() != 0xFF && !fopAcM_isSwitch(this, getSwbit()))
return 1;
push_player();
search_bomb();
search_arrow();
if(mCylColliderCenterQuantizedOscillation > 0) {
if(cLib_chasePosXZ(&mCylColliderCenter, mCylColliderCenterOscillationTargets[1], speedF))
mCylColliderCenterQuantizedOscillation = -1;
}
else if(cLib_chasePosXZ(&mCylColliderCenter, mCylColliderCenterOscillationTargets[0], speedF)) {
mCylColliderCenterQuantizedOscillation = 1;
}
mCylCollider.SetC(mCylColliderCenter);
dComIfG_Ccsp()->Set(&mCylCollider);
return 1;
}
void daObjWaterFall_c::push_player() {
daPy_py_c* const player = daPy_getPlayerActorClass();
f32 outMagnitude = 10.0f;
if(daPy_getLinkPlayerActorClass()->checkWolf())
outMagnitude = 25.0f;
if(scale.x == scale.z) {
// Waterfall is a circular cylinder
const f32 distToPlayer = fopAcM_searchPlayerDistanceXZ(this);
if(distToPlayer < scale.x * 50.0f) {
cXyz vectorToPlayer = player->current.pos - current.pos;
s16 outAngle = cM_atan2s(vectorToPlayer.x, vectorToPlayer.z);
player->setOutPower(outMagnitude,outAngle,FALSE);
}
}
else {
// Waterfall is an elliptic cylinder
cXyz vectorToPlayer = player->current.pos - current.pos;
mDoMtx_YrotS(mDoMtx_stack_c::get(), -current.angle.y);
PSMTXMultVec(mDoMtx_stack_c::get(), &vectorToPlayer, &vectorToPlayer);
if((vectorToPlayer.x > -scale.x * 50.0f && vectorToPlayer.x < scale.x * 50.0f) &&
vectorToPlayer.y > -10.0f && vectorToPlayer.y < scale.y * 100.0f) {
if(vectorToPlayer.z >= scale.z * 10.0f && vectorToPlayer.z < scale.z * 60.0f) {
player->setOutPower(outMagnitude, current.angle.y, FALSE);
}
else if(vectorToPlayer.z < scale.z * -10.0f && vectorToPlayer.z > scale.z * -60.0f) {
player->setOutPower(outMagnitude, (current.angle.y + (1 << 16)) - 0x8000, FALSE);
}
}
}
}
int daObjWaterFall_c::draw() {
return 1;
}
int daObjWaterFall_c::_delete() {
dComIfG_resDelete(&mPhase, l_arcName);
return 1;
}
static int daObjWaterFall_Draw(daObjWaterFall_c* i_this) {
return i_this->draw();
}
static int daObjWaterFall_Execute(daObjWaterFall_c* i_this) {
return i_this->execute();
}
static int daObjWaterFall_Delete(daObjWaterFall_c* i_this) {
return i_this->_delete();
}
static int daObjWaterFall_Create(fopAc_ac_c* i_this) {
return static_cast<daObjWaterFall_c*>(i_this)->create();
}