summaryrefslogtreecommitdiff
path: root/src/topman.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-03-08 15:38:03 -0600
committerColin Noga <Tempus@chronometry.ca>2012-03-08 15:38:03 -0600
commite1e747c5d256570a3d8caf459e24274397de7235 (patch)
tree1658ec435748c6575d5e219184d5eeb87e329b22 /src/topman.cpp
parent19632e9b183402bb9a05030e12d0f1003765c31a (diff)
downloadkamek-e1e747c5d256570a3d8caf459e24274397de7235.tar.gz
kamek-e1e747c5d256570a3d8caf459e24274397de7235.zip
Electric line, topman boss, and BROKEN YOSHIS
Diffstat (limited to '')
-rw-r--r--src/topman.cpp119
1 files changed, 101 insertions, 18 deletions
diff --git a/src/topman.cpp b/src/topman.cpp
index 4509272..a255a82 100644
--- a/src/topman.cpp
+++ b/src/topman.cpp
@@ -27,6 +27,7 @@ class daTopman : public dEn_c {
bool isBouncing;
char isInSpace;
char fromBehind;
+ char isWaiting;
static daTopman *build();
@@ -51,10 +52,13 @@ class daTopman : public dEn_c {
void _vf148();
void _vf14C();
+ bool CreateIceActors();
+ void addScoreWhenHit(void *other);
USING_STATES(daTopman);
DECLARE_STATE(Walk);
DECLARE_STATE(Turn);
+ DECLARE_STATE(Wait);
DECLARE_STATE(KnockBack);
DECLARE_STATE(Die);
};
@@ -81,6 +85,7 @@ daTopman *daTopman::build() {
CREATE_STATE(daTopman, Walk);
CREATE_STATE(daTopman, Turn);
+ CREATE_STATE(daTopman, Wait);
CREATE_STATE(daTopman, KnockBack);
CREATE_STATE(daTopman, Die);
@@ -106,20 +111,18 @@ daTopman *daTopman::build() {
hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);
if(hitType == 1) { // regular jump
- apOther->someFlagByte |= 2;
- this->dEn_c::playerCollision(apThis, apOther);
this->_vf220(apOther->owner);
}
else if(hitType == 3) { // spinning jump or whatever?
- apOther->someFlagByte |= 2;
- this->dEn_c::playerCollision(apThis, apOther);
this->_vf220(apOther->owner);
}
else if(hitType == 0) {
EN_LandbarrelPlayerCollision(this, apThis, apOther);
- if (this->direction == apOther->owner->direction) {
- this->direction ^= 1;
- this->fromBehind = 1;
+ if (this->pos.x > apOther->owner->pos.x) {
+ this->direction = 1;
+ }
+ else {
+ this->direction = 0;
}
doStateChange(&StateID_KnockBack);
}
@@ -163,6 +166,10 @@ daTopman *daTopman::build() {
doStateChange(&StateID_Die);
}
+ void daTopman::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
+ doStateChange(&StateID_Die);
+ }
+
void daTopman::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){
doStateChange(&StateID_KnockBack);
}
@@ -189,10 +196,35 @@ daTopman *daTopman::build() {
doStateChange(&StateID_Die);
}
- void daTopman::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
- doStateChange(&StateID_Die);
+ struct DoSomethingCool {
+ u32 unk_01; //0000
+ Vec3 pos; //0004
+ Vec3 scale; //0010
+ f32 unk_02; //001C
+ f32 unk_03; //0020
+ f32 unk_04; //0024
+ f32 unk_05; //0028
+ f32 unk_06; //002C
+ f32 unk_07; //0030
+ f32 unk_08; //0034
+ f32 unk_09; //0038
+ } my_struct;
+
+ extern "C" void sub_80024C20(void);
+ extern "C" void __destroy_arr(void*, void(*)(void), int, int);
+ //extern "C" __destroy_arr(struct DoSomethingCool, void(*)(void), int cnt, int bar);
+
+ bool daTopman::CreateIceActors()
+ {
+ struct DoSomethingCool my_struct = { 0, this->pos, {2.5, 2.5, 2.5}, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+ this->frzMgr.Create_ICEACTORs( (void*)&my_struct, 1 );
+ __destroy_arr( (void*)&my_struct, sub_80024C20, 0x3C, 1 );
+ return true;
}
+ void daTopman::addScoreWhenHit(void *other) {}
+
+
bool daTopman::calculateTileCollisions() {
// Returns true if sprite should turn, false if not.
@@ -303,6 +335,7 @@ int daTopman::onCreate() {
this->XSpeed = 0.8;
this->isInSpace = this->settings & 0xF;
+ this->isWaiting = (this->settings >> 4) & 0xF;
this->fromBehind = 0;
ActivePhysics::Info HitMeBaby;
@@ -352,7 +385,10 @@ int daTopman::onCreate() {
// State Changers
bindAnimChr_and_setUpdateRate("begoman_wait2", 1, 0.0, 1.0);
- doStateChange(&StateID_Walk);
+ if (this->isWaiting == 0) {
+ doStateChange(&StateID_Walk); }
+ else {
+ doStateChange(&StateID_Wait); }
this->onExecute();
return true;
@@ -371,7 +407,6 @@ int daTopman::onExecute() {
int daTopman::onDraw() {
bodyModel.scheduleForDrawing();
- bodyModel._vf1C();
return true;
}
@@ -399,16 +434,20 @@ void daTopman::updateModelMatrices() {
}
void daTopman::executeState_Walk() {
+ PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5
+
bool ret = calculateTileCollisions();
if (ret) {
doStateChange(&StateID_Turn);
}
+ bodyModel._vf1C();
if(this->chrAnimation.isAnimationDone()) {
this->chrAnimation.setCurrentFrame(0.0);
}
}
- void daTopman::endState_Walk() { }
+ void daTopman::endState_Walk() { this->timer += 1; }
+
///////////////
// Turn State
@@ -419,6 +458,7 @@ void daTopman::updateModelMatrices() {
}
void daTopman::executeState_Turn() {
+ bodyModel._vf1C();
if(this->chrAnimation.isAnimationDone()) {
this->chrAnimation.setCurrentFrame(0.0);
}
@@ -434,6 +474,34 @@ void daTopman::updateModelMatrices() {
///////////////
+// Wait State
+///////////////
+ void daTopman::beginState_Wait() {
+ this->max_speed.x = 0;
+ this->speed.x = 0;
+
+ this->max_speed.y = (this->isInSpace) ? -2.0 : -4.0;
+ this->speed.y = (this->isInSpace) ? -2.0 : -4.0;
+ this->y_speed_inc = (this->isInSpace) ? -0.09375 : -0.1875;
+ }
+ void daTopman::executeState_Wait() {
+
+ PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5
+
+ bool ret = calculateTileCollisions();
+ if (ret) {
+ doStateChange(&StateID_Turn);
+ }
+
+ bodyModel._vf1C();
+ if(this->chrAnimation.isAnimationDone()) {
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+ }
+ void daTopman::endState_Wait() { }
+
+
+///////////////
// Die State
///////////////
void daTopman::beginState_Die() {
@@ -444,6 +512,9 @@ void daTopman::updateModelMatrices() {
}
void daTopman::executeState_Die() {
+ bodyModel._vf1C();
+
+ PlaySound(this, SE_EMY_MECHAKOOPA_DAMAGE);
if(this->chrAnimation.isAnimationDone()) {
this->kill();
this->Delete(1);
@@ -457,24 +528,36 @@ void daTopman::updateModelMatrices() {
///////////////
void daTopman::beginState_KnockBack() {
bindAnimChr_and_setUpdateRate("begoman_damage", 1, 0.0, 0.75);
- this->timer = 0;
+
this->max_speed.x = (this->direction) ? this->XSpeed*5.0 : -this->XSpeed*5.0;
- this->speed.x = (direction) ? 4.0f : -4.0f;
+ this->speed.x = (this->direction) ? 4.0f : -4.0f;
}
void daTopman::executeState_KnockBack() {
bool ret = calculateTileCollisions();
this->speed.x = this->speed.x / 1.1;
+ bodyModel._vf1C();
if(this->chrAnimation.isAnimationDone()) {
- doStateChange(&StateID_Walk);
+ if (this->isWaiting == 0) {
+ doStateChange(&StateID_Walk); }
+ else {
+ doStateChange(&StateID_Wait); }
}
}
void daTopman::endState_KnockBack() {
- if (this->fromBehind == 0) {
- this->direction ^= 1; }
- this->fromBehind = 0;
+ if (this->rot.y == 0x2800) {
+ // CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 175);
+ this->direction = 0;
+ }
+ else {
+ // CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 192);
+ this->direction = 1;
+ }
+ // OSReport("Rotation: %x", this->rot.y);
+ // OSReport("Direction: %d", this->direction);
+ // this->direction ^= 1;
bindAnimChr_and_setUpdateRate("begoman_wait2", 1, 0.0, 1.0);
}
\ No newline at end of file