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

extern "C" void *BowserExitDemoState(void *, unsigned int);
extern "C" void *ForceMarioExitDemoMode(void *, unsigned int);
extern "C" void *BowserFireballCollision(dEn_c *, ActivePhysics *, ActivePhysics *);
extern "C" void *BowserDamageAnmClr(dEn_c *);
extern "C" void *BowserDamageStepTwo(dEn_c *);
extern "C" void *BowserDamageNormal(dEn_c *);
extern "C" void *BowserDamageKill(dEn_c *);
extern "C" void *BowserDamageEnd(dEn_c *);

int HP = 2;

void BowserDoomSpriteCollision(dEn_c *bowser, ActivePhysics *apThis, ActivePhysics *apOther) {
	// If you collide with something or other, call the fireball collision

	if (apOther->owner->name == 674) {

		// void * bowserClass = (void*)(((u32)bowser) + 0x5F8);
		// int HP = *(int*)(((u32)bowserClass) + 4);

		OSReport("HP: %d", HP);

		if (HP <= 0) {
			HP = 0;

			*(int*)(((u32)bowser) + 0x540) = 0x28;

			BowserDamageAnmClr(bowser);

			BowserDamageStepTwo(bowser);
			BowserDamageKill(bowser);

			// WeirdLevelEndClass->sub_8005CB60(*otherActor->returnPtrToField38D());

			// this->vf300(otherActor);
			BowserDamageEnd(bowser);

			// daBossKoopaDemo_c *BowserDemo = (daBossKoopaDemo_c*)FindActorByType(BOSS_KOOPA_DEMO, 0);
			daBossKoopa_c *BowserDemo = (daBossKoopa_c*)bowser;
			OSReport("Koopa Controller: %x", BowserClass);
			BowserClass->doStateChange(&daBossKoopa_c::StateID_Fall);	
			dFlagMgr_c::instance->set(3, 0, true, false, false);

			HP = 2;

		}
		else {
			*(int*)(((u32)bowser) + 0x540) = 0x28;

			BowserDamageAnmClr(bowser);
			BowserDamageNormal(bowser);

			HP -= 1;
		}

		dEn_c * bomb = (dEn_c*)apOther->owner;
		bomb->kill();
	}

	return;
}

void BowserDoomStart(dStageActor_c *Controller) {
	OSReport("Here we go!");

	dEn_c *Bowser = (dEn_c*)FindActorByType(EN_BOSS_KOOPA, 0);
	Bowser->Delete(1);
}

void BowserDoomExecute(dStageActor_c *Controller) {
	dFlagMgr_c::instance->set(2, 0, true, false, false);
	Controller->Delete(1);
}

void BowserDoomEnd(dStageActor_c *Controller) {
	OSReport("Bai bai everybody");
	Controller->Delete(1);
}

void BowserStartEnd(dStageActor_c *Controller) {
	dFlagMgr_c::instance->set(1, 0, true, false, false);
}