summaryrefslogtreecommitdiff
path: root/src/thundercloud.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/thundercloud.cpp56
1 files changed, 47 insertions, 9 deletions
diff --git a/src/thundercloud.cpp b/src/thundercloud.cpp
index 4c7e647..5ba1143 100755
--- a/src/thundercloud.cpp
+++ b/src/thundercloud.cpp
@@ -27,6 +27,7 @@ class dThunderCloud : public dEn_c {
u32 timer;
int dying;
char killFlag;
+ bool stationary;
u64 eventFlag;
@@ -61,6 +62,7 @@ class dThunderCloud : public dEn_c {
USING_STATES(dThunderCloud);
DECLARE_STATE(Follow);
DECLARE_STATE(Lightning);
+ DECLARE_STATE(Wait);
};
dThunderCloud *dThunderCloud::build() {
@@ -71,6 +73,7 @@ dThunderCloud *dThunderCloud::build() {
CREATE_STATE(dThunderCloud, Follow);
CREATE_STATE(dThunderCloud, Lightning);
+CREATE_STATE(dThunderCloud, Wait);
// Collision Callbacks
@@ -89,6 +92,8 @@ CREATE_STATE(dThunderCloud, Lightning);
}
else { dAcPy_vf3F4(apOther->owner, this, 9); }
+
+ this->counter_504[apOther->owner->which_player] = 0x40;
}
void dThunderCloud::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
@@ -154,9 +159,8 @@ void dThunderCloud::dieFall_Execute() {
if (this->timer > 450) {
- if ((this->settings >> 28) > 0) {
- this->kill();
- this->pos.y = this->pos.y + 800.0;
+ if (((this->settings >> 28) > 0) || (stationary)) {
+ this->Delete(1);
this->killFlag = 1;
return;
}
@@ -202,7 +206,7 @@ int dThunderCloud::onCreate() {
SetupTextures_Enemy(&bodyModel, 0);
bool ret;
- nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait_cloud");
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("cloud_wait");
ret = this->anm.setup(mdl, anmChr, &this->allocator, 0);
allocator.unlink();
@@ -250,13 +254,15 @@ int dThunderCloud::onCreate() {
this->killFlag = 0;
this->pos.z = 5750.0f; // sun
+ stationary = this->settings & 0xF;
char eventNum = (this->settings >> 16) & 0xFF;
this->eventFlag = (u64)1 << (eventNum - 1);
// State Change!
- doStateChange(&StateID_Follow);
+ if (stationary) { doStateChange(&StateID_Wait); }
+ else { doStateChange(&StateID_Follow); }
this->onExecute();
return true;
@@ -271,7 +277,7 @@ int dThunderCloud::onExecute() {
updateModelMatrices();
bodyModel._vf1C();
- if (dFlagMgr_c::instance->flags & this->eventFlag) {
+ if ((dFlagMgr_c::instance->flags & this->eventFlag) && (!stationary)) {
if (this->killFlag == 0) {
this->kill();
this->pos.y = this->pos.y + 800.0;
@@ -305,7 +311,7 @@ void dThunderCloud::updateModelMatrices() {
void dThunderCloud::beginState_Follow() {
this->timer = 0;
- this->bindAnimChr_and_setUpdateRate("wait_cloud", 1, 0.0, 1.0);
+ this->bindAnimChr_and_setUpdateRate("cloud_wait", 1, 0.0, 1.0);
this->rot.x = 0;
this->rot.y = 0;
this->rot.z = 0;
@@ -357,6 +363,37 @@ void dThunderCloud::endState_Follow() {
// Wait State
+void dThunderCloud::beginState_Wait() {
+ this->timer = 0;
+ this->bindAnimChr_and_setUpdateRate("cloud_wait", 1, 0.0, 1.0);
+ this->rot.x = 0;
+ this->rot.y = 0;
+ this->rot.z = 0;
+ PlaySound(this, SE_AMB_THUNDER_CLOUD);
+}
+void dThunderCloud::executeState_Wait() {
+
+ charge.spawn("Wm_mr_electricshock_biri02_s", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5});
+
+ if(this->anm.isAnimationDone()) {
+ this->anm.setCurrentFrame(0.0); }
+
+ if ((this->settings >> 16) & 0xFF) {
+ if (dFlagMgr_c::instance->flags & this->eventFlag) {
+ dFlagMgr_c::instance->flags = dFlagMgr_c::instance->flags ^ this->eventFlag;
+ this->doStateChange(&StateID_Lightning);
+ }
+ }
+ else {
+ if (this->timer > 200) { this->doStateChange(&StateID_Lightning); }
+ timer += 1;
+ }
+}
+void dThunderCloud::endState_Wait() { }
+
+
+// Lightning State
+
void dThunderCloud::beginState_Lightning() {
this->timer = 0;
this->speed.x = 0.0;
@@ -376,7 +413,7 @@ void dThunderCloud::executeState_Lightning() {
PlaySound(this, SE_BOSS_JR_DAMAGE_ELEC);
PlaySound(this, SE_OBJ_KAZAN_ERUPTION);
- bolt.spawn("Wm_jr_electricline", 0, &(Vec){pos.x, pos.y - 98.0, 0}, &(S16Vec){0,0,0}, &(Vec){1.0, 2.5, 1.0});
+ bolt.spawn("Wm_jr_electricline", 0, &(Vec){pos.x, pos.y - 98.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 2.5, 1.0});
break;
case 3:
this->Lightning.removeFromList();
@@ -386,7 +423,8 @@ void dThunderCloud::executeState_Lightning() {
charge.spawn("Wm_mr_electricshock_biri02_s", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5});
break;
case 5:
- this->doStateChange(&StateID_Follow);
+ if (stationary) { doStateChange(&StateID_Wait); }
+ else { doStateChange(&StateID_Follow); }
break;
default:
charge.spawn("Wm_mr_electricshock_biri02_s", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5});