summaryrefslogtreecommitdiff
path: root/src/mrsun.cpp
blob: 6d3eccbc21514b79e9397a7a951ff69f948638b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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;
}