summaryrefslogtreecommitdiff
path: root/src/testblock.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-07-10 05:07:53 +0200
committerTreeki <treeki@gmail.com>2011-07-10 05:07:53 +0200
commit54cbbfb69c8a9562d89f05967ae38011327e8da0 (patch)
tree22c55c184b14845d3ca74cae4d17866e6cf3b299 /src/testblock.cpp
parent42af9e06e59747bd133559fd25b0582c6984ad44 (diff)
downloadkamek-54cbbfb69c8a9562d89f05967ae38011327e8da0.tar.gz
kamek-54cbbfb69c8a9562d89f05967ae38011327e8da0.zip
initial not completely finished version of daEnTestBlock_c
Diffstat (limited to 'src/testblock.cpp')
-rw-r--r--src/testblock.cpp83
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;
+}
+