summaryrefslogtreecommitdiff
path: root/src/mrsun.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/mrsun.cpp121
1 files changed, 25 insertions, 96 deletions
diff --git a/src/mrsun.cpp b/src/mrsun.cpp
index 6d3eccb..b246131 100755
--- a/src/mrsun.cpp
+++ b/src/mrsun.cpp
@@ -1,107 +1,31 @@
#include <common.h>
+#include <g3dhax.h>
#include <game.h>
-struct MrSun {
- u32 id; // 0x00
- u32 settings; // 0x04
- u16 name; // 0x08
- u8 _0A[6]; // 0x0A
- u8 _10[0x9C]; // 0x10
- float x; // 0xAC
- float y; // 0xB0
- float z; // 0xB4
- float last_x;
- float last_y;
- float last_z;
- float x_delta;
- float y_delta;
- float z_delta;
- float d0;
- float d4;
- float d8;
- float scale_x;
- float scale_y;
- float scale_z;
- float speed_x;
- float speed_y;
- float speed_z;
- float maxspeed_x;
- float maxspeed_y;
- float maxspeed_z;
- u16 rot_x;
- u16 rot_y;
- u16 rot_z;
- u8 _106[0x42]; // 0x106
- u8 _148[0x288];
-
- // Any variables you add to the class go here; starting at offset 0x3D0
- u64 eventFlag;
- u32 location;
- u8 damage;
- u8 respawn;
-};
-
-struct EventTable_t {
- u64 events;
-};
+class dMrSun_c : public dEn_c {
+ int onCreate();
+ int onDelete();
+ int onExecute();
+ int onDraw();
-struct VEC {
- float x;
- float y;
- float z;
-};
+ mHeapAllocator_c allocator;
-struct APInfo {
- float xDistToCenter; // 0
- float yDistToCenter; // 4
- float xDistToEdge; // 8
- float yDistToEdge; // C
- u8 category1; // 10
- u8 category2; // 11
- u16 nulls; // 12
- u32 bitfield1; // 14
- u16 bitfield2; // 18
- u16 unkShort; // 1C
- u32 callback; // 20
+ static dMrSun_c *build();
};
-
-extern EventTable_t *EventTable;
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, VEC pos, char rot, char layer);
-extern "C" dStageActor_c *Actor_SearchByID(u32 actorID);
-
-extern "C" void *BubbleModel(MrSun *self);
-extern "C" void *ActivePhysics_InitWithStruct(u8 *thing, MrSun *self, APInfo physstruct);
-extern "C" void *ActivePhysics_AddToList(u8 *thing);
-
-
-
-bool MrSun_Execute(MrSun *self);
-bool MrSun_Create(MrSun *self);
-
#define ACTIVATE 1
#define DEACTIVATE 0
-
-
-
-bool MrSun_Create(MrSun *self) {
-
+int dMrSun_c::onCreate() {
OSReport("Creating the Mr.Sun Model");
- BubbleModel(self);
-
OSReport("Setting Mr.Sun's Size to 4.0");
-
- self->scale_x = 4.0;
- self->scale_y = 4.0;
- self->scale_z = 4.0;
-
+ this->scale = (Vec){4.0, 4.0, 4.0};
OSReport("Creating Mr.Sun's Physics Struct");
- APInfo HitMeBaby;
+ ActivePhysics::Info HitMeBaby;
HitMeBaby.xDistToCenter = 0.0;
HitMeBaby.yDistToCenter = 0.0;
HitMeBaby.xDistToEdge = 8.0;
@@ -110,25 +34,30 @@ bool MrSun_Create(MrSun *self) {
HitMeBaby.category2 = 0x0;
HitMeBaby.bitfield1 = 0x4F;
HitMeBaby.bitfield2 = 0x820C;
- HitMeBaby.unkShort = 0;
- HitMeBaby.callback = 0x80095950;
+ HitMeBaby.unkShort1C = 0;
+ HitMeBaby.callback = &dEn_c::collisionCallback;
OSReport("Making the Physics Class and adding to the list");
-
- ActivePhysics_InitWithStruct(self->_148, self, HitMeBaby);
- ActivePhysics_AddToList(self->_148);
-
+ this->aPhysics.initWithStruct(this, &HitMeBaby);
+ this->aPhysics.addToList();
OSReport("Going to Execute Mr.Sun");
-
- MrSun_Execute(self);
+ this->onExecute();
return true;
}
-bool MrSun_Execute(MrSun *self) {
+int dMrSun_c::onDelete() {
+ return true;
+}
+
+int dMrSun_c::onExecute() {
OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun");
return true;
}
+int dMrSun_c::onDraw() {
+ return true;
+}
+