summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/prolog.S65
-rw-r--r--src/testblock.cpp83
2 files changed, 147 insertions, 1 deletions
diff --git a/src/prolog.S b/src/prolog.S
new file mode 100644
index 0000000..1a988ec
--- /dev/null
+++ b/src/prolog.S
@@ -0,0 +1,65 @@
+.text
+.align 4
+.set sp, 1
+
+.extern __ctor_loc
+.extern OSReport
+
+.global Prolog
+Prolog:
+ stwu sp, -0x10(sp)
+ mflr r0
+ stw r0, 0x14(sp)
+ stw r31, 0xC(sp)
+ stw r30, 0x8(sp)
+ # -- Go!
+
+ li r30, 0
+
+ lis r31, __ctor_loc@h
+ ori r31, r31, __ctor_loc@l
+
+ lis r3, PMsg@h
+ ori r3, r3, PMsg@l
+ mr r4, r31
+ crclr 4*cr1+eq
+ bl OSReport
+
+ b startLoop
+
+loop:
+ mtctr r12
+ bctrl
+ addi r31, r31, 4
+ addi r30, r30, 1
+startLoop:
+ lwz r12, 0(r31)
+ cmpwi r12, 0
+ bne loop
+
+ lis r3, PMsg2@h
+ ori r3, r3, PMsg2@l
+ mr r4, r30
+ crclr 4*cr1+eq
+ bl OSReport
+
+ # -- Done
+ li r3, 1
+ lwz r31, 0xC(sp)
+ lwz r30, 0x8(sp)
+ lwz r0, 0x14(sp)
+ mtlr r0
+ addi sp, sp, 0x10
+ blr
+
+
+.data
+PMsg:
+ .string "Newer Super Mario Bros. Wii - Hacks by Treeki 2009-2011\n.ctors: %p\n"
+
+PMsg2:
+ .string "%d inits called\n"
+
+.align 4
+
+
diff --git a/src/testblock.cpp b/src/testblock.cpp
index 45d2ef7..93ba8ea 100644
--- a/src/testblock.cpp
+++ b/src/testblock.cpp
@@ -5,6 +5,8 @@
class daEnTestBlock_c : public daEnBlockMain_c {
public:
+ typedef State<daEnTestBlock_c> State;
+
TileRenderer tile;
Physics::Info physicsInfo;
@@ -12,9 +14,25 @@ public:
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);
@@ -42,6 +60,12 @@ int daEnTestBlock_c::onCreate() {
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;
}
@@ -57,6 +81,7 @@ int daEnTestBlock_c::onDelete() {
int daEnTestBlock_c::onExecute() {
+ acState.execute();
physics.update();
blockUpdate();
@@ -64,7 +89,9 @@ int daEnTestBlock_c::onExecute() {
tile.setVars(scale.x);
// now check zone bounds based on state
- // todo
+ if (acState.getCurrentState()->isEqual(&StateID_Wait)) {
+ checkZoneBoundaries(0);
+ }
return true;
}
@@ -81,3 +108,57 @@ daEnTestBlock_c *daEnTestBlock_c::build() {
return c;
}
+
+void daEnTestBlock_c::blockWasHit(bool isDown) {
+ OSReport("I'm a block, and I was hit.\n");
+
+ //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;
+ }
+}
+
+