summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegazig <megazig@megazig.(none)>2012-01-11 01:45:32 -0600
committermegazig <megazig@megazig.(none)>2012-01-11 01:45:32 -0600
commit81edb47b7f677ba37e81f896645ecdc023f4adb9 (patch)
tree6ae00bb3d5bcae69a10869f58dde6147f4767a2d /src
parentef5d3be97708ba98f242a25e4a63127a8138dbf9 (diff)
downloadkamek-81edb47b7f677ba37e81f896645ecdc023f4adb9.tar.gz
kamek-81edb47b7f677ba37e81f896645ecdc023f4adb9.zip
changed class1EC to collisionMgr class
changed class484 to freezeMgr class added daEnDosun_c definition fixed bossMegaGecko to use new collisionMgr class changed bossThwompaDomp to inherit from daEnDosun_c (need to make it actually different now)
Diffstat (limited to '')
-rw-r--r--src/bossMegaGoomba.cpp39
-rw-r--r--src/bossThwompaDomp.cpp179
2 files changed, 203 insertions, 15 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp
index d70f6cd..996a609 100644
--- a/src/bossMegaGoomba.cpp
+++ b/src/bossMegaGoomba.cpp
@@ -130,7 +130,6 @@ extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
extern "C" void doSpriteMovement(dStageActor_c* actor);
extern "C" int SomeStrangeModification(dStageActor_c* actor);
-extern "C" int CollidedWithTile(u8* c_1EC);
extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk);
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
@@ -194,8 +193,25 @@ void daMegaGoomba_c::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOth
void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
OSReport("Mario collision.\n");
+ /* * * * * * * * * * * * * * * * * * * * *
+ * 0=normal??,1=dontHit,2=dontKill
+ * daEnBrosBase_c ::player = 0
+ * daEnBrosBase_c::yoshi = 0
+ * daEnPipePirahna::player = 1
+ * daEnPipePirahna::yoshi = 1
+ * daEnKuriboBase_c::player = 0
+ * daEnKuriboBase_c::yoshi = 0
+ * daEnLargeKuribo_c::player = 0
+ * daEnLargeKuribo_c::yoshi = 2
+ * daEnNokonoko_c::player = 0
+ * daEnNokonoko_c::yoshi = 0
+ * daEnSubBoss_c = 2
+ *
+ * * * * * * * * * * * * * * * * * * * * */
//FIXME rename and make part of dStageActor_c
- char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);
+ //unk=0 does _vfs, unk=1 does playSeCmnStep
+ //char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);
+ char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2);
if(ret == 1) { // regular jump
apOther->someFlagByte |= 2;
OSReport("ret == 1; regular jump;\n");
@@ -303,18 +319,16 @@ void daMegaGoomba_c::setupBodyModel() {
allocator.unlink();
}
-extern "C" void ClassAt1EC_Init(u8*, dStageActor_c*, u8*, u8*, u8*);
-
void daMegaGoomba_c::setupCollision() {
//POINTLESS WITH GROWTH
this->scale.x = this->scale.y = this->scale.z = 0.666;
- ClassAt1EC_Init(this->classAt1EC, this, struct_1, 0, struct_3);
+ this->collMgr.Init(this, struct_1, 0, struct_3);
char foo = this->_391;
- this->_D0.x = 0.0;
- this->_D0.y = 16.0;
- this->_D0.z = 0.0;
+ this->pos_delta2.x = 0.0;
+ this->pos_delta2.y = 16.0;
+ this->pos_delta2.z = 0.0;
this->spriteSomeRectX = 32.0;
this->spriteSomeRectY = 32.0;
@@ -645,13 +659,13 @@ void daMegaGoomba_c::executeState_Walk() {
int ret = SomeStrangeModification(this);
if(ret & 1)
this->speed.y = 0.0;
- u32 bitfield = *(u32*)(this->classAt1EC+0x88);
+ u32 bitfield = this->collMgr.bitfield_for_checks;
if(bitfield & (0x15<<this->direction)) {
this->pos.x = this->last_pos.x;
this->doStateChange(&StateID_Turn);
//this->acState.setField10ToOne();
}
- u32 bitfield2 = *(u32*)(this->classAt1EC+0xb0+(4-(this->direction*4)));
+ u32 bitfield2 = this->collMgr.directional_bitfields[this->direction];
if(bitfield2) {
OSReport("Found wall: %08x\n", bitfield2);
this->doStateChange(&StateID_Turn);
@@ -679,8 +693,9 @@ void daMegaGoomba_c::executeState_Walk() {
}
#if 0
- if(CollidedWithTile(this->classAt1EC)) {
- OSReport("CollidedWithTile() : true [%08x]\n", *(u32*)(this->classAt1EC+0x88));
+ //if(CollidedWithTile(this->classAt1EC)) {
+ if( this->collMgr.CollidedWithTile() {
+ OSReport("CollidedWithTile() : true [%08x]\n", this->collMgr.bitfield_for_checks);
}
#endif
diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp
index 70a3d17..1c366b8 100644
--- a/src/bossThwompaDomp.cpp
+++ b/src/bossThwompaDomp.cpp
@@ -2,7 +2,173 @@
#include <game.h>
#include <g3dhax.h>
+#include "daEnDosun_c.h"
+#if 0
+/* called from _vf228 */
+/* handles overall scale */
+void sub_8009ea50( _464_struct* data ) {
+ u32 ctr = data->ctr; // _0x14
+ dEn_c* en = data->en; // _0x18
+
+ if(!ctr) {
+ en->scale.x = en->scale.y = en->scale.z = 1.0;
+ data->x = data->y = data->z = data->_0xC = 1.0
+ return;
+ }
+ data->ctr--;
+
+ /*FIXME continue */
+}
+#endif
+
+class daEnMegaDosun_c : public daEnDosun_c {
+ //int onCreate(); // overload for mega
+ //int onExecute();
+ static daEnMegaDosun_c *build();
+
+ //int checkZoneBoundaries(int);
+
+ //FIXME
+ //USING_STATES(daEnMegaDosun_c);
+ //DECLARE_STATE(Wait);
+};
+
+daEnMegaDosun_c *daEnMegaDosun_c::build() {
+ void *buffer = AllocFromGameHeap1(sizeof(daEnMegaDosun_c));
+ return new(buffer) daEnMegaDosun_c;
+}
+
+#if 0
+int daEnMegaDosun_c::onCreate() {
+ //FIXME
+ this->bigOrSmall = 1; // 0=small,1=big,2=mega
+
+ this->setupBodyModel(); // add this for linking/rename
+
+ this->_36D = 0; // byte
+ this->holdsFromSettings = this->settings & 0xf; //0=normal,1=??,2=fall
+
+ this->frzMgr.setSomething(1,1,1); //@0x809f5c5c
+
+ this->pos.y -= 21.0;
+ this->pos.z = -280.0; // behind layer1 (hides spikes)
+
+ //FIXME might be u32 0x11804101
+ /*
+ this->collision_struct[0] = 0x11;
+ this->collision_struct[1] = 0x80;
+ this->collision_struct[2] = 0x41;
+ this->collision_struct[3] = 0x01;
+ */
+ this->collision_struct = 0x11804101;
+ this->_5C0 = 0xFFFE1000;
+ this->_5C4 = 0x1F000;
+ this->_5C8 = 0x5000;
+
+ /*
+ //0x80ACF990 + 0x8C = 80acfa1C
+ 0.0,41.0,36.0,38.0,
+ 0x03, 0x00, 0x0000,0x0000004F,0x0000820E,0x0100,0x0000
+ dEn_c::collisionCallback (0x80095950)
+ */
+ ActivePhysics::Info hm;
+ hm.xDistToCenter = 0.0;
+ hm.yDistToCenter = 41.0;
+ hm.xDistToEdge = 36.0;
+ hm.yDistToEdge = 38.0;
+ hm.category1 = 0x03;
+ hm.category2 = 0x00;
+ hm.bitfield1 = 0x0000004F;
+ hm.bitfield2 = 0x0000820E;
+ hm.unkShort1C = 0x0100;
+ hm.callback = &dEn_c::collisionCallback;
+ this->aPhysics.initWithStruct(this, &hm);
+
+ /* 0x00000001,0xfffe1000,0x0001f000,0x00055000,
+ * 0.0,20.0,16.0,19.0
+ * 0x03000000,0x0000004f,0x0000820e,0x01000000,
+ * dEn_c::collisionCallback
+ */
+ u8 s3[] = {0,0,0,1,0xff,0xfe,0x10,0,0,1,0xf0,0,0,5,0x50,0};
+ //FIXME 0x80ACF990 + 0x58 = 80acf9e8
+ this->collMgr.Init(this,(u8*)&this->collision_struct,(u8*)&s3,0);
+
+ this->pos_delta2.x = 0.0;
+ this->pos_delta2.y = 36.0;
+ this->pos_delta2.z = 0.0;
+ this->_320 = 0.0;
+ this->_324 = 48.0;
+
+ this->aPhysics.addToList();
+
+ this->scale.x = 1.0;
+ this->scale.y = 1.0;
+ this->scale.z = 1.0;
+ this->max_speed.x = 0.0;
+ this->max_speed.y = -8.0;
+ this->max_speed.z = 0.0;
+ this->y_speed_inc = -0.25;
+ this->rot.x = 0;
+ this->rot.y = 0;
+ this->rot.z = 0;
+
+ // check settings bit
+ if(this->holdsFromSettings == 2) {
+ this->doStateChange(&StateID_DownMove_Kameck);
+ }else{
+ this->doStateChange(&StateID_UpWait);
+ }
+
+ return 1;
+}
+#endif
+
+#if 0
+int daEnMegaDosun_c::onExecute() {
+
+ acState.execute();
+
+ //FIXME change to do outro when leaving screen
+ //this->checkZoneBoundaries(0);
+
+ return 1;
+}
+#endif
+
+//FIXME
+#if 0
+int daEnMegaDosun_c::checkZoneBoundaries(int foo) {
+ if(this->_36C == 2) { // is eaten
+ return 0;
+ }
+
+ if( (0 == (foo&0x8)) && \
+ (this->collMgr.checkBits15and16ofBitfield() != 0) ) {
+ return 0;
+ }
+
+ int ret = 0;
+
+#if 0
+ Rect tempRect = (Rect){this->_320, this->_324,
+ 0.5 * this->spriteSomeRectX, 0.5 * this->spriteSomeRectY};
+ Rect tempRect2 = (Rect){_338, _33C, _340, _344};
+ if(this->s800064da0(pos, &tempRect, currentZoneId) ||
+ (!(foo&0x4) && s_800b56e0(pos, &tempRect, &tempRect2, currentZoneId)) )
+ {
+ ret = 1;
+ }
+#endif
+
+ if(ret && !(foo & 0x2))
+ this->Delete(this->_390);
+
+ return ret;
+}
+#endif
+
+#if 0
extern "C" bool CollidedWithTile(u8 *);
extern "C" void *SomeStrangeModification(dEn_c *);
@@ -14,9 +180,9 @@ void ThwompaDompMoveC(dEn_c *Sprite) {
bool SecondCheck;
// Check for collisions with walls?
- FirstCheck = CollidedWithTile(Sprite->classAt1EC);
+ FirstCheck = CollidedWithTile(Sprite->collMgr);
SomeStrangeModification(Sprite);
- SecondCheck = CollidedWithTile(Sprite->classAt1EC);
+ SecondCheck = CollidedWithTile(Sprite->collMgr);
OSReport("XPos = %f, FirstCheck = %d, SecondCheck = %d", Sprite->pos.x, FirstCheck, SecondCheck);
@@ -42,4 +208,11 @@ void ThwompaDompMoveC(dEn_c *Sprite) {
return;
-} \ No newline at end of file
+}
+#endif
+
+/*
+class daYoshi_c : public dStageActor_c {
+ u32 _1520; // holds actorID of actor eaten
+};
+*/