summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-02-12 02:20:48 +0100
committerTreeki <treeki@gmail.com>2013-02-12 02:20:48 +0100
commit1c1521acafbef0a024bfeb3d7408e5d7c8123dda (patch)
tree497e1a13c5081016b98b5b898419199a2268d932
parent629307bf47f6b7097128352999bd789cfeb93402 (diff)
downloadkamek-1c1521acafbef0a024bfeb3d7408e5d7c8123dda.tar.gz
kamek-1c1521acafbef0a024bfeb3d7408e5d7c8123dda.zip
failed/unfinished thing for the ship collisions
-rw-r--r--src/bossCaptainBowser.cpp68
1 files changed, 48 insertions, 20 deletions
diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp
index 4867afb..de3e017 100644
--- a/src/bossCaptainBowser.cpp
+++ b/src/bossCaptainBowser.cpp
@@ -56,7 +56,8 @@ public:
m3d::anmChr_c chrAnimation;
m3d::anmChr_c shipAnm;
- Physics ShipPhysics;
+ static const int SHIP_COLL_COUNT = 7;
+ ActivePhysics shipCollisions[SHIP_COLL_COUNT];
ActivePhysics Roar;
mEf::es2 effect;
@@ -145,20 +146,23 @@ daCaptainBowser *daCaptainBowser::build() {
}
}
- void ShipPhysicsCallback(daCaptainBowser *self, dEn_c *other) {
- if (other->name == 657) {
+ void ShipAPhysicsCallback(ActivePhysics *apThis, ActivePhysics *apOther) {
+ daCaptainBowser *self = (daCaptainBowser*)apThis->owner;
+ if (apOther->owner->name == 657) {
OSReport("CANNON COLLISION");
if (self->isInvulnerable) {
return;
}
self->damage -= 1;
- SpawnEffect("Wm_en_burst_m", 0, &other->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
- PlaySound(other, SE_OBJ_TARU_BREAK);
- other->Delete(1);
+ SpawnEffect("Wm_en_burst_m", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
+ PlaySound(apOther->owner, SE_OBJ_TARU_BREAK);
+ apOther->owner->Delete(1);
if (self->damage == self->maxDamage/2) { self->doStateChange(&daCaptainBowser::StateID_Roar); }
else if (self->damage < 0) { self->doStateChange(&daCaptainBowser::StateID_Outro); }
+
+ apThis->someFlagByte |= 2;
}
}
@@ -216,19 +220,43 @@ int daCaptainBowser::onCreate() {
this->damage = this->maxDamage;
- // Ship Physics!
- // Normal rects are { left, top, right, bottom }
- // Callbacks are Touching upwards, Touching Downwards, and unknown
-
- ShipPhysics.baseSetup(this, (void*)&ShipPhysicsCallback, 0, 0, 1, 0);
-
- ShipPhysics.x = 8.0;
- ShipPhysics.y = 20.0;
-
- ShipPhysics.diameter = 12.0 * 16.0;
- ShipPhysics.isRound = 1;
-
+ for (int i = 0; i < SHIP_COLL_COUNT; i++) {
+ shipCollisions[i].owner = this;
+ shipCollisions[i].info.category1 = 3;
+ shipCollisions[i].info.category2 = 0;
+ shipCollisions[i].info.bitfield1 = 0x4F;
+ shipCollisions[i].info.bitfield2 = 0x8028E;
+ shipCollisions[i].info.unkShort1C = 0;
+ shipCollisions[i].info.callback = &ShipAPhysicsCallback;
+ }
+ static const float xToCentres[] = {-56.541185, 161.824968, 106.258581};
+ static const float yToCentres[] = {-91.176745, -66.957921, 57.935231};
+ static const float xToEdges[] = {39.481380, 11.698187, 24.371222};
+ static const float yToEdges[] = {37.040555, 12.821730, 21.844430};
+ static const float trpValues0[] = {-39.481380, -11.698187, -24.371222};
+ static const float trpValues1[] = {-39.481380, -11.698187, 24.371222};
+ static const float trpValues2[] = {-39.481380, -11.698187, -24.371222};
+ static const float trpValues3[] = {39.481380, 11.698187, -24.371222};
+ static const float scX1[] = {-176.447600, 64.340078, -157.925471, -157.925471};
+ static const float scY1[] = {-128.217300, 112.570378, -109.695171, -109.695171};
+ static const float scX2[] = {-176.447600, 64.340078, -157.925471, -157.925471};
+ static const float scY2[] = {-128.217300, 112.570378, -109.695171, -109.695171};
+
+ for (int i = 0; i < SHIP_COLL_COUNT; i++) {
+ shipCollisions[i].info.xDistToCenter = xToCentres[i];
+ shipCollisions[i].info.yDistToCenter = yToCentres[i];
+ shipCollisions[i].info.xDistToEdge = xToEdges[i];
+ shipCollisions[i].info.yDistToEdge = yToEdges[i];
+ if (i >= 4) {
+ int xi = i - 4;
+ shipCollisions[i].trpValue0 = trpValues0[xi];
+ shipCollisions[i].trpValue1 = trpValues1[xi];
+ shipCollisions[i].trpValue2 = trpValues2[xi];
+ shipCollisions[i].trpValue3 = trpValues3[xi];
+ shipCollisions[i].collisionCheckType = 3;
+ }
+ }
// Bowser Physics!
ActivePhysics::Info BowserPhysics;
@@ -280,7 +308,6 @@ int daCaptainBowser::onDelete() {
int daCaptainBowser::onExecute() {
acState.execute();
- this->ShipPhysics.update();
PlaySound(this, SE_BOSS_SHIP_PRPL);
@@ -430,7 +457,8 @@ int daCaptainBowser::onDraw() {
}
void daCaptainBowser::endState_Intro() {
- this->ShipPhysics.addToList();
+ for (int i = 0; i < SHIP_COLL_COUNT; i++)
+ shipCollisions[i].addToList();
this->aPhysics.addToList();
this->isInvulnerable = 0;