#include #include // Patches KAWANAGARE (sprite 250) class daEnTestBlock_c : public daEnBlockMain_c { public: typedef State State; TileRenderer tile; Physics::Info physicsInfo; int onCreate(); int onDelete(); int onExecute(); void calledWhenUpMoveExecutes(); void calledWhenDownMoveExecutes(); void wait_Begin(); void wait_Execute(); void wait_End(); void blockWasHit(bool isDown); static State StateID_Wait; static daEnTestBlock_c *build(); }; daEnTestBlock_c::State daEnTestBlock_c::StateID_Wait( "daEnTestBlock_c::StateID_Wait", &daEnTestBlock_c::wait_Begin, &daEnTestBlock_c::wait_Execute, &daEnTestBlock_c::wait_End); int daEnTestBlock_c::onCreate() { blockInit(pos.y); physicsInfo.x1 = -8; physicsInfo.y1 = 16; physicsInfo.x2 = 8; physicsInfo.y2 = 0; physicsInfo.otherCallback1 = &daEnBlockMain_c::OPhysicsCallback1; physicsInfo.otherCallback2 = &daEnBlockMain_c::OPhysicsCallback2; physicsInfo.otherCallback3 = &daEnBlockMain_c::OPhysicsCallback3; physics.setup(this, &physicsInfo, 3, currentLayerID); physics.flagsMaybe = 0x260; physics.callback1 = &daEnBlockMain_c::PhysicsCallback1; physics.callback2 = &daEnBlockMain_c::PhysicsCallback2; physics.callback3 = &daEnBlockMain_c::PhysicsCallback3; physics.addToList(); TileRenderer::List *list = dBgGm_c::instance->getTileRendererList(0); list->add(&tile); tile.x = pos.x - 8; tile.y = -(16 + pos.y); tile.tileNumber = 0x30; //OSReport("Sanity Checks... _414=%x\n", offsetof(dEn_c,_414)); //OSReport("acState=%x\n", offsetof(dActorMultiState_c,acState)); //OSReport("_530=%x\n", offsetof(dEn_c,_530)); doStateChange(&daEnTestBlock_c::StateID_Wait); return true; } int daEnTestBlock_c::onDelete() { TileRenderer::List *list = dBgGm_c::instance->getTileRendererList(0); list->remove(&tile); physics.removeFromList(); return true; } int daEnTestBlock_c::onExecute() { acState.execute(); physics.update(); blockUpdate(); tile.setPosition(pos.x-8, -(16+pos.y), pos.z); tile.setVars(scale.x); // now check zone bounds based on state if (acState.getCurrentState()->isEqual(&StateID_Wait)) { checkZoneBoundaries(0); } return true; } daEnTestBlock_c *daEnTestBlock_c::build() { OSReport("Creating TestBlock\n"); void *buffer = AllocFromGameHeap1(sizeof(daEnTestBlock_c)); daEnTestBlock_c *c = new(buffer) daEnTestBlock_c; OSReport("Created TestBlock @ %p\n", c); return c; } void daEnTestBlock_c::blockWasHit(bool isDown) { OSReport("I'm a block, and I was hit.\n"); pos.y = initialY; //This code makes the block unhittable //physicsInfo.otherCallback1 = 0; //physicsInfo.otherCallback2 = 0; //physicsInfo.otherCallback3 = 0; physics.setup(this, &physicsInfo, 3, currentLayerID); //physics.flagsMaybe &= ~0x200; physics.addToList(); doStateChange(&StateID_Wait); } void daEnTestBlock_c::calledWhenUpMoveExecutes() { if (initialY >= pos.y) blockWasHit(false); } void daEnTestBlock_c::calledWhenDownMoveExecutes() { if (initialY <= pos.y) blockWasHit(true); } void daEnTestBlock_c::wait_Begin() { } void daEnTestBlock_c::wait_End() { } void daEnTestBlock_c::wait_Execute() { int result = blockResult(); if (result == 0) return; if (result == 1) { doStateChange(&daEnBlockMain_c::StateID_UpMove); anotherFlag = 2; isGroundPound = false; } else { doStateChange(&daEnBlockMain_c::StateID_DownMove); anotherFlag = 1; isGroundPound = true; } }