summaryrefslogtreecommitdiff
path: root/src/bossFlameThrower.cpp
blob: 3a77621c82e75bbe8c63e83ab5b494e24cfdc316 (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
#include <common.h>
#include <game.h>
#include <g3dhax.h>
#include <sfx.h>
#include "boss.h"

class daKoopaBreath : public dEn_c {
	int onCreate();
	int onExecute();

	mEf::es2 effect;
	static daKoopaBreath *build();

	void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
	void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);

};

void daKoopaBreath::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
void daKoopaBreath::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) {}


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


int daKoopaBreath::onCreate() {
	
	OSReport("Made a fireball");
	ActivePhysics::Info GreatBalls;
	
	GreatBalls.xDistToCenter = 0.0;
	GreatBalls.yDistToCenter = 18.0;
	GreatBalls.xDistToEdge = 38.0;
	GreatBalls.yDistToEdge = 38.0;
	
	GreatBalls.category1 = 0x3;
	GreatBalls.category2 = 0x0;
	GreatBalls.bitfield1 = 0x47;
	GreatBalls.bitfield2 = 0xFFFFFFFF;
	GreatBalls.unkShort1C = 0;
	GreatBalls.callback = &dEn_c::collisionCallback;

	this->aPhysics.initWithStruct(this, &GreatBalls);
	this->aPhysics.addToList();
	speed.x = -2.0; 
	
	this->onExecute();
	return true;
}


int daKoopaBreath::onExecute() {
	HandleXSpeed();
	doSpriteMovement();

	PlaySound(this, SE_BOSS_JR_FIRE_BURNING);

	effect.spawn("Wm_ko_fireattack", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0});

	float rect[] = {0.0, 0.0, 38.0, 38.0};
	int ret = this->outOfZone(this->pos, (float*)&rect, this->currentZoneID);
	if(ret) {
		this->Delete(1);
	}

	return true;
}