summaryrefslogtreecommitdiff
path: root/src/mrsun.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mrsun.cpp')
-rwxr-xr-xsrc/mrsun.cpp134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/mrsun.cpp b/src/mrsun.cpp
new file mode 100755
index 0000000..6d3eccb
--- /dev/null
+++ b/src/mrsun.cpp
@@ -0,0 +1,134 @@
+#include <common.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;
+};
+
+struct VEC {
+ float x;
+ float y;
+ float z;
+};
+
+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
+};
+
+
+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) {
+
+ 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;
+
+
+ OSReport("Creating Mr.Sun's Physics Struct");
+
+ APInfo HitMeBaby;
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 0.0;
+ HitMeBaby.xDistToEdge = 8.0;
+ HitMeBaby.yDistToEdge = 8.0;
+ HitMeBaby.category1 = 0x3;
+ HitMeBaby.category2 = 0x0;
+ HitMeBaby.bitfield1 = 0x4F;
+ HitMeBaby.bitfield2 = 0x820C;
+ HitMeBaby.unkShort = 0;
+ HitMeBaby.callback = 0x80095950;
+
+
+ OSReport("Making the Physics Class and adding to the list");
+
+ ActivePhysics_InitWithStruct(self->_148, self, HitMeBaby);
+ ActivePhysics_AddToList(self->_148);
+
+
+ OSReport("Going to Execute Mr.Sun");
+
+ MrSun_Execute(self);
+ return true;
+}
+
+bool MrSun_Execute(MrSun *self) {
+ OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun");
+ return true;
+}
+
+