summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-03-21 13:12:22 -0500
committerColin Noga <Tempus@chronometry.ca>2012-03-21 13:12:22 -0500
commit0dc4aae6128eb16acef1b6faeabcb546762ebe36 (patch)
tree6754bbf4c92ffc315d4978b95519492484c62963 /src
parent800f3920d31c2562cc2f0af112c9efa5d5343d6e (diff)
downloadkamek-0dc4aae6128eb16acef1b6faeabcb546762ebe36.tar.gz
kamek-0dc4aae6128eb16acef1b6faeabcb546762ebe36.zip
more fixes
Diffstat (limited to 'src')
-rw-r--r--src/bossCaptainBowser.cpp22
-rw-r--r--src/bossPlayerClown.cpp65
-rw-r--r--src/challengeStar.cpp8
-rw-r--r--src/shyguy.cpp22
4 files changed, 85 insertions, 32 deletions
diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp
index 6152b42..729c1cf 100644
--- a/src/bossCaptainBowser.cpp
+++ b/src/bossCaptainBowser.cpp
@@ -29,13 +29,6 @@ const char* effects_name_list [] = {
-void ShipPhysicsCallback(daBoss *self, dStageActor_c *other) {
- if (other->name == EN_CANNON_BULLET) {
-
- }
-}
-
-
class daCaptainBowser : public daBoss {
public:
int onCreate();
@@ -92,6 +85,21 @@ daCaptainBowser *daCaptainBowser::build() {
return new(buffer) daCaptainBowser;
}
+void ShipPhysicsCallback(daCaptainBowser *self, dStageActor_c *other) {
+ if (other->name == EN_CANNON_BULLET) {
+ OSReport("CANNON COLLISION");
+ if (self->isInvulnerable) {
+ return;
+ }
+ self->damage += 1;
+
+ if (self->damage == 10) { self->doStateChange(&daCaptainBowser::StateID_Roar); }
+ else if (self->damage > 20) { self->doStateChange(&daCaptainBowser::StateID_Outro); }
+ else { self->doStateChange(&daCaptainBowser::StateID_Damage); }
+
+ }
+}
+
///////////////////////
// Externs and States
///////////////////////
diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp
index bfd6671..5831748 100644
--- a/src/bossPlayerClown.cpp
+++ b/src/bossPlayerClown.cpp
@@ -2,47 +2,94 @@
#include <game.h>
#include <g3dhax.h>
#include <sfx.h>
-#include <stage.h>
#include "boss.h"
#define CLOWN_MODEL(clown) ((m3d::mdl_c*)( ((u32)(clown)) + 0xFD0 ))
+#define playerOccupying (((u32)(clown)) + 0x738 )
+
+// candidates for player are 0x738. Load the vtable from the actor at 0x738, then fire function 0x6C
+// Or just fire 0x6C
+// or just check 0x38D
extern "C" int PClownCarExecute(dEn_c *clown);
extern "C" void PClownCarAfterCreate(dEn_c *clown, u32);
extern "C" int PClownCarDraw(dEn_c *clown);
extern "C" void PClownCarMove(dEn_c *clown);
+
int CConDraw(dEn_c *clown) {
- // setup matrices
- OSReport("Drawing");
- // CLOWN_MODEL(clown)->scheduleForDrawing();
+ // setup cannon model
+ matrix.translation(pos.x, pos.y, pos.z);
+ newrot = rot.y + 0x4000;
+ matrix.applyRotationYXZ(&rot.x, &newrot, &rot.z);
+
+ CLOWN_MODEL(clown).setDrawMatrix(matrix);
+ CLOWN_MODEL(clown).setScale(&scale);
+ CLOWN_MODEL(clown).calcWorld(false);
+
+ CLOWN_MODEL(clown).scheduleForDrawing();
+
return PClownCarDraw(clown);
// run normal clown function
}
int CConExecute(dEn_c *clown) {
- OSReport("Executing");
-
return PClownCarExecute(clown);
- // run normal execute
}
void CCafterCreate(dEn_c *clown, u32 param) {
- OSReport("Creating");
clown->scale.x *= 1.25;
clown->scale.y *= 1.25;
clown->scale.z *= 1.25;
// setup the model
+ mHeapAllocator_c allocator;
+ nw4r::g3d::ResFile resFile;
+
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
+
+ this->resFile.data = getResource("koopaJr_clown_ply", "g3d/cannon.brres");
+ nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("Cannon");
+ CLOWN_MODEL(clown).setup(mdl, &allocator, 0x224, 1, 0);
+ SetupTextures_MapObject(&CLOWN_MODEL(clown), 0);
+ allocator.unlink();
+
+ // Original AfterCreate
PClownCarAfterCreate(clown, param);
}
void CConExecuteMove(dEn_c *clown) {
- OSReport("Moving");
+
+ u8 player = ((dStageActor_c *)playerOccupying)->which_player;
+ OSReport("Angle = %x, %x, %x", (GetSpecificPlayerActor(player))->rot.y, (GetSpecificPlayerActor(player))->rot.x, (GetSpecificPlayerActor(player))->rot.z);
+ OSReport("Clown = %x, %x, %x", (clown)->rot.y, (clown)->rot.x, (clown)->rot.z);
+
+ RemoconMngClass* Remo = GetRemoconMng();
+
+ Vec tempPos;
+
+ u32 buttonPushed = Remocon_GetPressed(Remo->controllers[player]);
+ if (buttonPushed & 0x0100) {
+
+ if (clown->direction == 0) { // Going right
+ tempPos = (Vec){clown->pos.x + 32.0, clown->pos.y + 32.0, 3564.0};
+ dStageActor_c *spawned = CreateActor(347, clown->direction, tempPos, 0, 0);
+ spawned->speed.x = 5.0;
+ }
+ else {
+ tempPos = (Vec){clown->pos.x - 32.0, clown->pos.y + 32.0, 3564.0};
+ dStageActor_c *spawned = CreateActor(347, clown->direction, tempPos, 0, 0);
+ spawned->speed.x = -5.0;
+ }
+
+ SpawnEffect("Wm_en_killervanish", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
+ PlaySoundAsync(clown, SE_OBJ_HOUDAI_S_SHOT);
+
+ }
// run normal move
PClownCarMove(clown);
diff --git a/src/challengeStar.cpp b/src/challengeStar.cpp
index 97c4364..ae73851 100644
--- a/src/challengeStar.cpp
+++ b/src/challengeStar.cpp
@@ -35,6 +35,9 @@ class dChallengeStar : public dEn_c {
void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther);
void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther);
};
@@ -57,6 +60,9 @@ void dChallengeStar::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
void dChallengeStar::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
void dChallengeStar::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
+void dChallengeStar::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
+void dChallengeStar::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
+void dChallengeStar::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
dChallengeStar *dChallengeStar::build() {
@@ -83,7 +89,7 @@ int dChallengeStar::onCreate() {
HitMeBaby.category1 = 0x5;
HitMeBaby.category2 = 0x0;
HitMeBaby.bitfield1 = 0x4F;
- HitMeBaby.bitfield2 = 0xFFFFFFFF;
+ HitMeBaby.bitfield2 = 0x200;
HitMeBaby.unkShort1C = 0;
HitMeBaby.callback = &dEn_c::collisionCallback;
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index 5679e49..f65ed17 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -295,19 +295,11 @@ daShyGuy *daShyGuy::build() {
dStateBase_c *stateVar;
if (this->type < 6) { // Regular Shy Guys Except Jumper
- char FirePos;
- if (this->pos.x < apOther->owner->pos.x) { FirePos = 0; } // Fire is to the right
- else { FirePos = 1; } // Fire is to the left
+ if (this->pos.x < apOther->owner->pos.x) { this->backFire = 0; } // Fire is to the right
+ else { this->backFire = 1; } // Fire is to the left
-
- if (this->direction != FirePos) { // Fire is from behind
- this->backFire = 1;
- stateVar = &StateID_FireKnockBack;
- }
- else {
- stateVar = &StateID_FireKnockBack;
- }
+ stateVar = &StateID_FireKnockBack;
}
else if (this->type > 8) { // Giants
return;
@@ -1338,10 +1330,10 @@ void daShyGuy::updateModelMatrices() {
void daShyGuy::beginState_FireKnockBack() {
bindAnimChr_and_setUpdateRate("c18_C_BLOCK_BREAK_R", 1, 0.0, 1.0);
- if (this->backFire == 0) { this->direction ^= 1; }
- else { this->backFire = 0; }
+ // if (this->backFire == 0) { this->direction ^= 1; }
+ // else { this->backFire = 0; }
- this->speed.x = (this->direction) ? -this->XSpeed / 6.0f : this->XSpeed / 6.0f;
+ this->speed.x = (this->backFire) ? this->XSpeed / 6.0f : -this->XSpeed / 6.0f;
}
void daShyGuy::executeState_FireKnockBack() {
@@ -1354,7 +1346,7 @@ void daShyGuy::updateModelMatrices() {
}
}
void daShyGuy::endState_FireKnockBack() {
- this->direction ^= 1;
+ // this->direction ^= 1;
speed.x = (direction) ? -1.0f : 1.0f;
this->max_speed.x = (direction) ? -this->XSpeed : this->XSpeed;
}