From 54cbbfb69c8a9562d89f05967ae38011327e8da0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 10 Jul 2011 05:07:53 +0200 Subject: initial not completely finished version of daEnTestBlock_c --- src/testblock.cpp | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/testblock.cpp (limited to 'src') 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 +#include + +// 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; +} + -- cgit v1.2.3