summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-03-22 18:43:21 -0500
committerColin Noga <Tempus@chronometry.ca>2012-03-22 18:43:21 -0500
commit0ae957fcb9d1cb69602bf937c5111a184c3fbc79 (patch)
treeecac5435b445fd3ce7fa8f45b90920a85eb9ae95
parentc6becbea298ed12b34f8ad6365e1db0a2870e3e7 (diff)
downloadkamek-0ae957fcb9d1cb69602bf937c5111a184c3fbc79.tar.gz
kamek-0ae957fcb9d1cb69602bf937c5111a184c3fbc79.zip
simple updates to challenge collectible and the clown car
-rw-r--r--bossCaptainBowser.yaml18
-rw-r--r--src/bossCaptainBowser.cpp7
-rw-r--r--src/bossPlayerClown.cpp171
-rw-r--r--src/challengeStar.cpp17
4 files changed, 162 insertions, 51 deletions
diff --git a/bossCaptainBowser.yaml b/bossCaptainBowser.yaml
index 2bd930d..b227ff4 100644
--- a/bossCaptainBowser.yaml
+++ b/bossCaptainBowser.yaml
@@ -14,9 +14,9 @@ hooks:
- name: UpdateaptainBoswerSpriteInfo
type: patch
- addr_pal: 0x8030C4AC
+ addr_pal: 0x8030C48C
# [010] ( 16, 16) ( 0, 0 32: 32) 64? 64? 0? 0? | [0:No Flags]
- data: '0002 0000'
+ data: '00000010 00000010 00000000 00000000 00000200 00000200 0000 0000 0200 0200 0002 0000'
# 0x8030A340 + sprite num * 0x28 == offset (+24 in this case)
@@ -96,3 +96,17 @@ hooks:
type: add_func_pointer
src_addr_pal: 0x8095FF14
target_func: 'CConDraw(dEn_c *)'
+
+
+
+
+
+
+
+ # Clown Shot - Replaces WM_PAKKUN
+ - name: ClownShotBuild
+ type: add_func_pointer
+ src_addr_pal: 0x80988934
+ target_func: 'daClownShot::build(void)'
+
+
diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp
index 729c1cf..ba78977 100644
--- a/src/bossCaptainBowser.cpp
+++ b/src/bossCaptainBowser.cpp
@@ -86,7 +86,7 @@ daCaptainBowser *daCaptainBowser::build() {
}
void ShipPhysicsCallback(daCaptainBowser *self, dStageActor_c *other) {
- if (other->name == EN_CANNON_BULLET) {
+ if (other->name == 657) {
OSReport("CANNON COLLISION");
if (self->isInvulnerable) {
return;
@@ -122,7 +122,7 @@ void ShipPhysicsCallback(daCaptainBowser *self, dStageActor_c *other) {
void daCaptainBowser::addScoreWhenHit(void *other) { };
void daCaptainBowser::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
- if (apOther->owner->name == EN_CANNON_BULLET) { //time to get hurt
+ if (apOther->owner->name == 657) { //time to get hurt
if (this->isInvulnerable) {
return;
}
@@ -319,9 +319,6 @@ int daCaptainBowser::onDraw() {
if (num == 0) {
doStateChange(&StateID_Fire);
}
- else if (num == 1) {
- doStateChange(&StateID_Roar);
- }
else{
doStateChange(&StateID_Throw);
}
diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp
index 15aa2dd..2db1d90 100644
--- a/src/bossPlayerClown.cpp
+++ b/src/bossPlayerClown.cpp
@@ -5,10 +5,10 @@
#include "boss.h"
-#define cPlayerOccupying (*(dStageActor_c**)(((u32)(clown)) + 0x738 ))
+// #define cPlayerOccupying (*(dStageActor_c**)(((u32)(clown)) + 0x738 ))
#define cAllocator ((mHeapAllocator_c*)(((u32)(clown)) + 0xFD0 ))
#define cModel ((m3d::mdl_c*)( ((u32)(clown)) + 0xFEC ))
-
+#define cTimer (**(u32**)((u32)(clown) + sizeof(m3d::mdl_c) + 0xFEC ))
extern "C" int PClownCarExecute(dEn_c *clown);
extern "C" void PClownCarAfterCreate(dEn_c *clown, u32);
@@ -18,12 +18,21 @@ extern "C" void PClownCarMove(dEn_c *clown);
int CConDraw(dEn_c *clown) {
// setup cannon model
- clown->matrix.translation(clown->pos.x, clown->pos.y, clown->pos.z);
- short newrot = 0x4000;
- clown->matrix.applyRotationYXZ(&clown->rot.x, &newrot, &clown->rot.z);
+ clown->matrix.translation(clown->pos.x, clown->pos.y + 8.0, clown->pos.z-100.0);
+ short newrotz = -0x2000;
+ short newroty = ((clown->rot.y * 0x4000) / 0x800) - 0x4000;
+ short newrotx;
+ if (clown->rot.x < 0x8000) {
+ newrotx = -clown->rot.x;
+ }
+ else {
+ newrotx = clown->rot.x;
+ }
+ // OSReport("Angle?: %x, %x", clown->rot.y, newroty);
+ clown->matrix.applyRotationYXZ(&clown->rot.x, &newroty, &newrotz);
cModel->setDrawMatrix(clown->matrix);
- cModel->setScale(&clown->scale);
+ cModel->setScale(&(Vec){0.25, 0.5, 0.25});
cModel->calcWorld(false);
cModel->scheduleForDrawing();
@@ -43,26 +52,17 @@ void CCafterCreate(dEn_c *clown, u32 param) {
clown->scale.y *= 1.25;
clown->scale.z *= 1.25;
- OSReport("AfterCreate");
// setup the model
nw4r::g3d::ResFile resFile;
- OSReport("defined");
-
cAllocator->link(-1, GameHeaps[0], 0, 0x20);
- OSReport("allocated");
resFile.data = getResource("koopaJr_clown_ply", "g3d/cannon.brres");
- OSReport("resource");
nw4r::g3d::ResMdl mdl = resFile.GetResMdl("Cannon");
- OSReport("model");
cModel->setup(mdl, cAllocator, 0x224, 1, 0);
- OSReport("setup");
SetupTextures_MapObj(cModel, 0);
- OSReport("lightmaps");
cAllocator->unlink();
- OSReport("unlinked");
// Original AfterCreate
PClownCarAfterCreate(clown, param);
@@ -70,39 +70,38 @@ void CCafterCreate(dEn_c *clown, u32 param) {
void CConExecuteMove(dEn_c *clown) {
- u8 player = cPlayerOccupying->which_player;
+ // u8 player = cPlayerOccupying->which_player;
// OSReport("Angle = %x, %x, %x", (GetSpecificPlayerActor(player))->rot.y, (GetSpecificPlayerActor(player))->rot.x, (GetSpecificPlayerActor(player))->rot.z);
// OSReport("Clown = %x, %x, %x", (clown)->rot.y, (clown)->rot.x, (clown)->rot.z);
- RemoconMngClass* Remo = GetRemoconMng();
-
Vec tempPos;
- u32 buttonPushed = Remocon_GetPressed(Remo->controllers[player]);
+ u32 buttonPushed = Remocon_GetPressed(GetRemoconMng()->controllers[0]);
if (buttonPushed & 0x0100) {
- if (clown->direction == 0) { // Going right
- tempPos = (Vec){clown->pos.x + 32.0, clown->pos.y + 32.0, 3564.0};
- dStageActor_c *spawned = CreateActor(347, clown->direction, tempPos, 0, 0);
- spawned->speed.x = 5.0;
- }
- else {
- tempPos = (Vec){clown->pos.x - 32.0, clown->pos.y + 32.0, 3564.0};
- dStageActor_c *spawned = CreateActor(347, clown->direction, tempPos, 0, 0);
- spawned->speed.x = -5.0;
- }
-
- SpawnEffect("Wm_en_killervanish", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){0.25, 0.25, 0.25});
- PlaySoundAsync(clown, SE_OBJ_HOUDAI_S_SHOT);
-
+ // if (cTimer > 90) {
+ if (clown->direction == 0) { // Going right
+ tempPos = (Vec){clown->pos.x + 32.0, clown->pos.y + 32.0, 3564.0};
+ dStageActor_c *spawned = CreateActor(657, 0, tempPos, 0, 0);
+ spawned->speed.x = 5.0;
+ }
+ else {
+ tempPos = (Vec){clown->pos.x - 32.0, clown->pos.y + 32.0, 3564.0};
+ dStageActor_c *spawned = CreateActor(657, 0, tempPos, 0, 0);
+ spawned->speed.x = -5.0;
+ }
+
+ SpawnEffect("Wm_en_killervanish", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){0.1, 0.1, 0.1});
+ PlaySoundAsync(clown, SE_OBJ_HOUDAI_S_SHOT);
+
+ // cTimer = 0;
+ // }
}
+ // cTimer++;
+
// run normal move
PClownCarMove(clown);
-
- // check for wiimote button presses
-
- // spawn effect and attack if there are any
}
@@ -111,7 +110,6 @@ extern "C" mHeapAllocator_c *__ct__16mHeapAllocator_cFv(mHeapAllocator_c *al);
extern "C" dEn_c *__ct__20daJrClownForPlayer_cFv(dEn_c *clown);
dEn_c *newClownCtor(dEn_c *clown) {
- OSReport("ctor");
__ct__20daJrClownForPlayer_cFv(clown);
__ct__16mHeapAllocator_cFv(cAllocator);
__ct__Q23m3d5mdl_cFv(cModel);
@@ -128,3 +126,100 @@ void newClownDtor(dEn_c *clown, u32 willDelete) {
__dt__16mHeapAllocator_cFv(cAllocator, 0xFFFFFFFF);
__dt__20daJrClownForPlayer_cFv(clown, willDelete);
}
+
+
+
+
+
+
+
+
+// Below is the projectile used byt eh clown car - Replaces WM_PAKKUN
+
+class daClownShot : public dEn_c {
+ int onCreate();
+ int onExecute();
+ int onDraw();
+
+ mHeapAllocator_c allocator;
+ nw4r::g3d::ResFile resFile;
+ m3d::mdl_c bodyModel;
+
+ mEf::es2 effect;
+ static daClownShot *build();
+
+ void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+};
+
+void daClownShot::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { }
+
+daClownShot *daClownShot::build() {
+ void *buffer = AllocFromGameHeap1(sizeof(daClownShot));
+ return new(buffer) daClownShot;
+}
+
+
+int daClownShot::onCreate() {
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
+ this->resFile.data = getResource("koopaJr_clown_ply", "g3d/houdai_ball.brres");
+ nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("houdai_ball");
+ bodyModel.setup(mdl, &allocator, 0x224, 1, 0);
+ allocator.unlink();
+
+ ActivePhysics::Info GreatBalls;
+
+ GreatBalls.xDistToCenter = 0.0;
+ GreatBalls.yDistToCenter = 0.0;
+ GreatBalls.xDistToEdge = 8.0;
+ GreatBalls.yDistToEdge = 7.0;
+
+ GreatBalls.category1 = 0x3;
+ GreatBalls.category2 = 0x0;
+ GreatBalls.bitfield1 = 0x6F;
+ GreatBalls.bitfield2 = 0xffbafffe;
+ GreatBalls.unkShort1C = 0;
+ GreatBalls.callback = &dEn_c::collisionCallback;
+
+ this->aPhysics.initWithStruct(this, &GreatBalls);
+ this->aPhysics.addToList();
+
+ this->speed.y = 4.0;
+ this->y_speed_inc = -0.1875;
+
+ this->onExecute();
+ return true;
+}
+
+int daClownShot::onDraw() {
+ matrix.translation(this->pos.x, this->pos.y, this->pos.z);
+
+ matrix.applyRotationYXZ(&this->rot.x, &this->rot.y, &this->rot.z);
+
+ bodyModel.setDrawMatrix(matrix);
+ bodyModel.setScale(&scale);
+ bodyModel.calcWorld(true);
+
+ bodyModel.scheduleForDrawing();
+ return true;
+}
+
+
+int daClownShot::onExecute() {
+ HandleXSpeed();
+ HandleYSpeed();
+ doSpriteMovement();
+
+ effect.spawn("Wm_en_killersmoke", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){0.7, 0.7, 0.7});
+
+ float rect[] = {0.0, 0.0, 8.0, 8.0};
+ int ret = this->outOfZone(this->pos, (float*)&rect, this->currentZoneID);
+ if(ret) {
+ this->Delete(1);
+ }
+
+ return true;
+}
+
+
+
+
diff --git a/src/challengeStar.cpp b/src/challengeStar.cpp
index 1f9c91a..dda35cc 100644
--- a/src/challengeStar.cpp
+++ b/src/challengeStar.cpp
@@ -8,6 +8,7 @@ extern "C" void *PlaySound(dEn_c *, int soundID);
extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
+extern "C" dStageActor_c* GetSpecificPlayerActor(int number);
extern int GlobalStarsCollected;
@@ -47,11 +48,10 @@ void dChallengeStar::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
PlaySoundAsync(this, SE_OBJ_BROOM_KEY_SHOW);
SpawnEffect("Wm_ob_greencoinkira_a", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8});
- GlobalStarsCollected++;
- if (GlobalStarsCollected == 50) {
- GlobalStarsCollected = 0;
+ GlobalStarsCollected--;
+ if (GlobalStarsCollected == 0) {
EventTable->events |= this->eventFlag;
- OSReport("50 collected, triggered Event!\n");
+ OSReport("All stars spawned collected, triggered Event!\n");
}
OSReport("%d Stars Collected\n", GlobalStarsCollected);
@@ -73,9 +73,14 @@ dChallengeStar *dChallengeStar::build() {
int dChallengeStar::onCreate() {
+ char die = this->settings & 0xF;
+ if (GetSpecificPlayerActor(die) == 0) { this->Delete(1); }
+
+ GlobalStarsCollected++;
+
allocator.link(-1, GameHeaps[0], 0, 0x20);
- nw4r::g3d::ResFile rf(getResource("I_star", "g3d/I_star.brres"));
+ nw4r::g3d::ResFile rf(getResource("I_star", "g3d/silver_star.brres"));
bodyModel.setup(rf.GetResMdl("I_star"), &allocator, 0x224, 1, 0);
SetupTextures_Map(&bodyModel, 0);
@@ -134,7 +139,7 @@ void dChallengeStar::updateModelMatrices() {
int dChallengeStar::onExecute() {
updateModelMatrices();
- effect.spawn("Wm_ob_keyget02_kira", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
+ effect.spawn("Wm_ob_keyget02_kira", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8});
this->rot.y += 0x200;
return true;
}