summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--spritetex.yaml6
-rwxr-xr-xsrc/spritetex.S28
-rwxr-xr-xsrc/thundercloud.cpp56
3 files changed, 74 insertions, 16 deletions
diff --git a/spritetex.yaml b/spritetex.yaml
index 79bcf46..adfda78 100644
--- a/spritetex.yaml
+++ b/spritetex.yaml
@@ -1,6 +1,12 @@
---
source_files: [../src/spritetex.S]
hooks:
+
+ # - name: BlackClouds
+ # type: patch
+ # data: '000000000000000000000000'
+ # addr_pal: 0x8042B3A8
+
# - name: TEX_WoodBox
# type: branch_insn
# branch_type: bl
diff --git a/src/spritetex.S b/src/spritetex.S
index b24c77a..850ebb7 100755
--- a/src/spritetex.S
+++ b/src/spritetex.S
@@ -1349,9 +1349,23 @@ GLOW_LightBlock:
.global CloudLT_Execute
CloudLT_Execute:
+
+ # li r9, 0xFF
+ # li r8, 0
+
+ # stb r9, 0x934(r31)
+ # stb r8, 0x935(r31)
+ # stb r8, 0x936(r31)
+ # stb r9, 0x937(r31)
+
+ # stb r9, 0xa60(r31)
+ # stb r8, 0xa61(r31)
+ # stb r8, 0xa62(r31)
+ # stb r9, 0xa63(r31)
+
lwz r8, 4(r31)
- slwi r8, r8, 28
+ srwi r8, r8, 28
cmpwi r8, 1
beq CloudD_Execute
@@ -1367,7 +1381,7 @@ CloudD_Execute:
TEX_CloudLT_A:
lwz r8, 4(r31)
- slwi r8, r8, 28
+ srwi r8, r8, 28
cmpwi r8, 1
beq TEX_CloudLT_Aa
@@ -1385,7 +1399,7 @@ TEX_CloudLT_Aa:
TEX_CloudLT_B:
lwz r8, 4(r31)
- slwi r8, r8, 28
+ srwi r8, r8, 28
cmpwi r8, 1
beq TEX_CloudLT_Ba
@@ -1403,7 +1417,7 @@ TEX_CloudLT_Ba:
TEX_CloudLT_C:
lwz r8, 4(r31)
- slwi r8, r8, 28
+ srwi r8, r8, 28
cmpwi r8, 1
beq TEX_CloudLT_Ca
@@ -1541,12 +1555,12 @@ YoshiStrings:
.align 4
CloudA:
- .string "wny_mist.9"
+ .string "wny_mist.0"
.align 4
CloudB:
- .string "wny_mist.10"
+ .string "wny_mist.1"
.align 4
CloudC:
- .string "wny_mist.11"
+ .string "wny_mist.2"
.align 4
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});