summaryrefslogtreecommitdiff
path: root/src/bossWrenchThrow.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bossWrenchThrow.cpp88
1 files changed, 47 insertions, 41 deletions
diff --git a/src/bossWrenchThrow.cpp b/src/bossWrenchThrow.cpp
index e99797b..beea815 100644
--- a/src/bossWrenchThrow.cpp
+++ b/src/bossWrenchThrow.cpp
@@ -6,11 +6,6 @@
#include <sfx.h>
-extern "C" void *PlaySound(dEn_c *, int soundID);
-extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daWrench *);
-extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
-
-
class daWrench : public dEn_c {
int onCreate();
int onExecute();
@@ -52,6 +47,14 @@ CREATE_STATE(daWrench, Straight);
+extern "C" void *PlaySound(dEn_c *, int soundID);
+extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daWrench *);
+extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
+extern "C" void *HandleXSpeed(daWrench *);
+extern "C" void *HandleYSpeed(daWrench *);
+
+
+
void daWrench::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
this->_vf220(apOther->owner);
@@ -99,17 +102,18 @@ int daWrench::onCreate() {
allocator.unlink();
- this->homing = this->settings & 0xF;
- this->direction = (this->settings >> 4) & 0xF;
+ this->direction = this->settings & 0xF;
+ this->homing = (this->settings >> 4) & 0xF;
this->front = (this->settings >> 8) & 0xF;
ActivePhysics::Info HitMeBaby;
if (this->homing == 0) {
- HitMeBaby.yDistToCenter = 21.0;
- HitMeBaby.xDistToEdge = 27.0;
- HitMeBaby.yDistToEdge = 21.0;
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 0.0;
+ HitMeBaby.xDistToEdge = 6.0;
+ HitMeBaby.yDistToEdge = 6.0;
this->scale.x = 1.5;
this->scale.y = 1.5;
@@ -117,16 +121,16 @@ int daWrench::onCreate() {
}
else {
- HitMeBaby.yDistToCenter = 42.0;
- HitMeBaby.xDistToEdge = 54.0;
- HitMeBaby.yDistToEdge = 42.0;
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 0.0;
+ HitMeBaby.xDistToEdge = 12.0;
+ HitMeBaby.yDistToEdge = 12.0;
this->scale.x = 3.0;
this->scale.y = 3.0;
this->scale.z = 3.0;
}
- HitMeBaby.xDistToCenter = 0.0;
HitMeBaby.category1 = 0x3;
HitMeBaby.category2 = 0x0;
HitMeBaby.bitfield1 = 0x47;
@@ -168,6 +172,7 @@ void daWrench::updateModelMatrices() {
int daWrench::onExecute() {
+ acState.execute();
updateModelMatrices();
return true;
@@ -175,7 +180,7 @@ int daWrench::onExecute() {
-void daRamboo_c::beginState_HandThrow() {
+void daWrench::beginState_HandThrow() {
if (this->direction == 0) { // Ground Facing Left
this->pos.x += 32.0;
@@ -198,13 +203,13 @@ void daRamboo_c::beginState_HandThrow() {
this->rot.z = 0xC000;
}
- if (this->front == 1) { this->pos.z = -804.0; }
+ if (this->front == 1) { this->pos.z = -1804.0; }
this->lifespan = 0;
}
-void daRamboo_c::executeState_HandThrow() {
+void daWrench::executeState_HandThrow() {
- if (this->lifespan == 60) {
+ if (this->lifespan > 30) {
if (this->homing == 0) {
doStateChange(&StateID_Straight); }
@@ -216,11 +221,11 @@ void daRamboo_c::executeState_HandThrow() {
this->lifespan += 1;
}
-void daRamboo_c::endState_HandThrow() { }
+void daWrench::endState_HandThrow() { }
-void daRamboo_c::beginState_Homing() {
+void daWrench::beginState_Homing() {
this->lifespan = 360;
Vec tempPos = this->pos;
@@ -246,28 +251,28 @@ void daRamboo_c::beginState_Homing() {
else {
this->ymod = 0.0; }
- if (this->direction == 0) { this->speed.x = -7.0; }
- else { this->speed.x = 7.0; }
-
+ if (this->direction & 1) { this->speed.x = -1.5; }
+ else { this->speed.x = 1.5; }
+ this->speed.y = 0;
}
-void daRamboo_c::executeState_Homing() {
+void daWrench::executeState_Homing() {
if (this->direction && 1) { // directions 1 and 3 spin clockwise, fly rightwards
- this->rot.z += 0x400; }
+ this->rot.z -= 0x1000; }
else { // directions 0 and 2 spin anti-clockwise, fly leftwards
- this->rot.z -= 0x400; }
+ this->rot.z += 0x1000; }
- UpdateObjectPosBasedOnSpeedValues_real(this);
+ this->pos.y += this->ymod * this->lifespan / 360;
- this->pos.y += this->ymod;
+ UpdateObjectPosBasedOnSpeedValues_real(this);
if (this->lifespan < 1) {
PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH);
- CreateEffect(&this->homingWrench->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 242);
+ CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 242);
this->Delete();
}
@@ -276,11 +281,11 @@ void daRamboo_c::executeState_Homing() {
this->lifespan -= 1;
}
-void daRamboo_c::endState_Homing() { }
+void daWrench::endState_Homing() { }
-void daRamboo_c::beginState_Straight() {
+void daWrench::beginState_Straight() {
char PlayerID = NearestPlayer(this);
dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
@@ -290,26 +295,27 @@ void daRamboo_c::beginState_Straight() {
Vec tempPos = this->pos;
- if (this->direction == 0) {
- this->speed.x = -6.0;
- this->speed.y = -6.0 * slope;
+ if (this->direction & 1) {
+ this->speed.x = -2.0;
+ this->speed.y = 2.0 * slope;
}
else {
- this->speed.x = 6.0;
- this->speed.y = 6.0 * slope;
+ this->speed.x = 2.0;
+ this->speed.y = 2.0 * slope;
}
}
-void daRamboo_c::executeState_Straight() {
+void daWrench::executeState_Straight() {
this->lifespan = 360;
if (this->direction && 1) { // directions 1 and 3 spin clockwise, fly rightwards
- this->rot.z += 0x400; }
+ this->rot.z -= 0x1000; }
else { // directions 0 and 2 spin anti-clockwise, fly leftwards
- this->rot.z -= 0x400; }
+ this->rot.z += 0x1000; }
+
UpdateObjectPosBasedOnSpeedValues_real(this);
PlaySound(this, SE_EMY_CHOROPU_M_SPANNER);
@@ -320,13 +326,13 @@ void daRamboo_c::executeState_Straight() {
PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH);
- CreateEffect(&this->homingWrench->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 242);
+ CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 242);
this->Delete();
}
this->lifespan -= 1;
}
-void daRamboo_c::endState_Straight() { }
+void daWrench::endState_Straight() { }