summaryrefslogtreecommitdiff
path: root/src/bossPlayerClown.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bossPlayerClown.cpp59
1 files changed, 52 insertions, 7 deletions
diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp
index 3bf1119..0095b6b 100644
--- a/src/bossPlayerClown.cpp
+++ b/src/bossPlayerClown.cpp
@@ -53,9 +53,24 @@ int CConDraw(dEn_c *clown) {
return PClownCarDraw(clown);
// run normal clown function
}
+extern dStateBase_c JrClownEndDemoState;
+extern dStateBase_c JrClownDemoWaitState;
+extern dStateBase_c ClownDemoWaitState;
int CConExecute(dEn_c *clown) {
- return PClownCarExecute(clown);
+ // A REALLY TERRIBLE HACK.
+ float saveX = clown->pos.x;
+ float saveY = clown->pos.y;
+
+ int ret = PClownCarExecute(clown);
+
+ dStateBase_c *state = clown->acState.getCurrentState();
+ if (state == &JrClownEndDemoState || state == &JrClownDemoWaitState || state == &ClownDemoWaitState) {
+ clown->pos.x = saveX;
+ clown->pos.y = saveY;
+ clown->speed.x = 0.0f;
+ clown->speed.y = 0.0f;
+ }
}
void CCafterCreate(dEn_c *clown, u32 param) {
@@ -78,6 +93,17 @@ void CCafterCreate(dEn_c *clown, u32 param) {
// Original AfterCreate
PClownCarAfterCreate(clown, param);
+
+ int playerCount = 0;
+ for (int i = 0; i < 4; i++)
+ if (Player_Active[i])
+ playerCount++;
+
+ if ((clown->settings & 0xF) != 0) {
+ int playerID = (clown->settings & 0xF) - 1;
+ if (playerID >= playerCount)
+ clown->Delete(1);
+ }
}
void CConExecuteMove(dEn_c *clown) {
@@ -104,7 +130,8 @@ void CConExecuteMove(dEn_c *clown) {
}
SpawnEffect("Wm_en_killervanish", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){0.1, 0.1, 0.1});
- PlaySoundAsync(clown, SE_OBJ_HOUDAI_S_SHOT);
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_HOUDAI_S_SHOT, 1);
cTimer = 0;
}
@@ -112,9 +139,13 @@ void CConExecuteMove(dEn_c *clown) {
cTimer++;
- float leftBound = ClassWithCameraInfo::instance->screenLeft + 12.0f;
+ ClassWithCameraInfo *cwci = ClassWithCameraInfo::instance;
+ float leftBound = cwci->screenLeft + 12.0f;
+ float rightBound = (cwci->screenLeft + cwci->screenWidth) - 12.0f;
if (clown->pos.x < leftBound)
clown->pos.x = leftBound;
+ if (clown->pos.x > rightBound)
+ clown->pos.x = rightBound;
// run normal move
PClownCarMove(clown);
@@ -151,6 +182,10 @@ void newClownDtor(dEn_c *clown, u32 willDelete) {
__dt__20daJrClownForPlayer_cFv(clown, willDelete);
}
+extern "C" void JrClownForPlayer_playAccelSound() {
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_PLY_CROWN_ACC, 1);
+}
@@ -214,10 +249,10 @@ int daClownShot::onCreate() {
_320 = 0.0f;
_324 = 0.0f;
- // These structs tell stupid collider what to collide with - these are from koopa troopa
- static const lineSensor_s below(SENSOR_BREAK_BRICK | SENSOR_BREAK_BLOCK, 12<<12, 4<<12, 0<<12);
- static const pointSensor_s above(SENSOR_BREAK_BRICK | SENSOR_BREAK_BLOCK, 0<<12, 12<<12);
- static const lineSensor_s adjacent(SENSOR_BREAK_BRICK | SENSOR_BREAK_BLOCK, 6<<12, 9<<12, 6<<12);
+ u32 flags = SENSOR_BREAK_BRICK | SENSOR_BREAK_BLOCK | SENSOR_80000000;
+ static const lineSensor_s below(flags, 12<<12, 4<<12, 0<<12);
+ static const pointSensor_s above(flags, 0<<12, 12<<12);
+ static const lineSensor_s adjacent(flags, 6<<12, 9<<12, 6<<12);
collMgr.init(this, &below, &above, &adjacent);
collMgr.calculateBelowCollisionWithSmokeEffect();
@@ -248,7 +283,17 @@ int daClownShot::onExecute() {
HandleXSpeed();
HandleYSpeed();
doSpriteMovement();
+
collMgr.calculateBelowCollisionWithSmokeEffect();
+ collMgr.calculateAboveCollision(0);
+ collMgr.calculateAdjacentCollision();
+ if (collMgr.outputMaybe) {
+ SpawnEffect("Wm_en_burst_m", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_TARU_BREAK, 1);
+ Delete(1);
+ return true;
+ }
effect.spawn("Wm_en_killersmoke", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){0.7, 0.7, 0.7});