summaryrefslogtreecommitdiff
path: root/src/mrsun.cpp
blob: 668a789626083ecfc79c02b39911dec9b4638a1f (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
#include <common.h>
#include <game.h>
#include <g3dhax.h>

class daMrSun_c : public dEn_c {
	int onCreate();
	int onDelete();
	int onExecute();
	int onDraw();

	mHeapAllocator_c allocator;
	m3d::mdl_c model;

	static daMrSun_c *build();
};

daMrSun_c *daMrSun_c::build() {
	void *buffer = AllocFromGameHeap1(sizeof(daMrSun_c));
	return new(buffer) daMrSun_c;
}

#define ACTIVATE	1
#define DEACTIVATE	0

int daMrSun_c::onCreate() {
	OSReport("Creating the Mr.Sun Model");
	allocator.link(-1, GameHeaps[0], 0, 0x20);

	nw4r::g3d::ResFile rf(getResource("g3d/bubble.brres", "bubble"));
	model.setup(rf.GetResMdl("bubble"), &allocator, 0x224, 1, 0);
	SetupTextures_Enemy(&model, 0);

	allocator.unlink();

	OSReport("Setting Mr.Sun's Size to 4.0");
	this->scale = (Vec){4.0, 4.0, 4.0};

	OSReport("Creating Mr.Sun's Physics Struct");

	ActivePhysics::Info 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.unkShort1C = 0;
	HitMeBaby.callback = &dEn_c::collisionCallback;


	OSReport("Making the Physics Class and adding to the list");
	this->aPhysics.initWithStruct(this, &HitMeBaby);
	this->aPhysics.addToList();

	OSReport("Going to Execute Mr.Sun");
	this->onExecute();
	return true;
}

int daMrSun_c::onDelete() {
	return true;
}

int daMrSun_c::onExecute() {
	OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun");
	return true;
}

int daMrSun_c::onDraw() {
	model.scheduleForDrawing();
	return true;
}