diff options
Diffstat (limited to '')
-rw-r--r-- | src/testblock.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/testblock.cpp b/src/testblock.cpp new file mode 100644 index 0000000..45d2ef7 --- /dev/null +++ b/src/testblock.cpp @@ -0,0 +1,83 @@ +#include <common.h> +#include <game.h> + +// Patches KAWANAGARE (sprite 250) + +class daEnTestBlock_c : public daEnBlockMain_c { +public: + TileRenderer tile; + Physics::Info physicsInfo; + + int onCreate(); + int onDelete(); + int onExecute(); + + static daEnTestBlock_c *build(); +}; + + +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; + + 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() { + physics.update(); + blockUpdate(); + + tile.setPosition(pos.x-8, -(16+pos.y), pos.z); + tile.setVars(scale.x); + + // now check zone bounds based on state + // todo + + 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; +} + |