From f35befab481e013d76631baf6abec5f69ff703a6 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Wed, 28 Sep 2011 02:33:45 -0500 Subject: added fire laser, airship gear retexture, and some minor sun fixes --- src/firelaser.cpp | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/mrsun.cpp | 42 +++++++++------- src/spritetex.S | 7 +++ 3 files changed, 176 insertions(+), 17 deletions(-) create mode 100755 src/firelaser.cpp (limited to 'src') diff --git a/src/firelaser.cpp b/src/firelaser.cpp new file mode 100755 index 0000000..244d659 --- /dev/null +++ b/src/firelaser.cpp @@ -0,0 +1,144 @@ +#include +#include +#include + +class daFireLaser_c : public dEn_c { + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + static daFireLaser_c *build(); + + int timer; + float spitspeed; + char direction; + u64 eventFlag; + + USING_STATES(daFireLaser_c); + DECLARE_STATE(pewpewpew); +}; + +daFireLaser_c *daFireLaser_c::build() { + void *buffer = AllocFromGameHeap1(sizeof(daFireLaser_c)); + return new(buffer) daFireLaser_c; +} + + +extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); + + +CREATE_STATE(daFireLaser_c, pewpewpew); + + +struct EventTable_t { + u64 events; + // ... +}; + +extern EventTable_t *EventTable; + + + +int daFireLaser_c::onCreate() { + OSReport("Creating a fiery laser"); + + this->timer = 0; + this->direction = this->settings & 0xF; + + char eventNum = (this->settings >> 16) & 0xFF; + this->eventFlag = (u64)1 << (eventNum - 1); + + + doStateChange(&StateID_pewpewpew); + this->onExecute(); + return true; +} + +int daFireLaser_c::onDelete() { + return true; +} + +int daFireLaser_c::onExecute() { + acState.execute(); + return true; +} + +int daFireLaser_c::onDraw() { + return true; +} + + + +// Pew Pew State + +void daFireLaser_c::beginState_pewpewpew() { + OSReport("Firin' mah lazer."); + this->timer = 0; +} +void daFireLaser_c::executeState_pewpewpew() { + + + if (EventTable->events & this->eventFlag) { + + this->timer = this->timer + 1; + + if (this->timer < 20) { + OSReport("Pew pew pew!"); + float xlaunch; + float ylaunch; + + if (this->direction == 0) { + xlaunch = spitspeed; + ylaunch = 0.0; } + else if (this->direction == 1) { // SE + xlaunch = spitspeed; + ylaunch = spitspeed; } + else if (this->direction == 2) { // S + xlaunch = 0.0; + ylaunch = spitspeed; } + else if (this->direction == 3) { // SW + xlaunch = -spitspeed; + ylaunch = spitspeed; } + else if (this->direction == 4) { // W + xlaunch = -spitspeed; + ylaunch = 0.0; } + else if (this->direction == 5) { // NW + xlaunch = -spitspeed; + ylaunch = -spitspeed; } + else if (this->direction == 6) { // N + xlaunch = 0.0; + ylaunch = -spitspeed; } + else if (this->direction == 7) { // NE + xlaunch = spitspeed; + ylaunch = -spitspeed; } + + + dStageActor_c *spawner = CreateActor(106, 0, this->pos, 0, 0); + spawner->speed.x = xlaunch; + spawner->speed.y = ylaunch; + } + + if (this->timer > 60) { + this->timer = 0; + } + + } + +} +void daFireLaser_c::endState_pewpewpew() { + +} + + + + + + + + + + + + + diff --git a/src/mrsun.cpp b/src/mrsun.cpp index 01ab485..3036a6b 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -33,6 +33,7 @@ class daMrSun_c : public dEn_c { float spinStateOn; int dying; char sunDying; + char killFlag; u64 eventFlag; @@ -177,7 +178,7 @@ int daMrSun_c::onCreate() { SetupTextures_Map(&bodyModel, 0); glowModel.setup(rf.GetResMdl("SunGlow"), &allocator, 0x224, 1, 0); - SetupTextures_Map(&glowModel, 0); + SetupTextures_Boss(&glowModel, 0); } else { // It's a moon @@ -232,6 +233,7 @@ int daMrSun_c::onCreate() { this->ySpiralOffset = 0.0; this->dying = -5; this->sunDying = 0; + this->killFlag = 0; this->pos.z = 3300.00; @@ -267,8 +269,10 @@ int daMrSun_c::onExecute() { } if (EventTable->events & this->eventFlag) { - this->kill(); - this->pos.y = this->pos.y + 800.0; + if (this->killFlag == 0) { + this->kill(); + this->pos.y = this->pos.y + 800.0; + this->killFlag = 1; } } return true; @@ -620,6 +624,10 @@ void daMrSun_c::executeState_Spin() { this->rot.y = this->rot.y + (18.4 * rotBonus); //} + float spitspeed; + if ((this->settings & 0xF) == 0) { spitspeed = 3.0; } // It's a sun + else { spitspeed = 5.0; } // It's a moon + int randomBall; randomBall = GenerateRandomNumber(6); if (randomBall == 1) { @@ -630,29 +638,29 @@ void daMrSun_c::executeState_Spin() { float ylaunch; if (direction == 0) { - xlaunch = 5.0; + xlaunch = spitspeed; ylaunch = 0.0; } else if (direction == 1) { // SE - xlaunch = 5.0; - ylaunch = 5.0; } + xlaunch = spitspeed; + ylaunch = spitspeed; } else if (direction == 2) { // S xlaunch = 0.0; - ylaunch = 5.0; } + ylaunch = spitspeed; } else if (direction == 3) { // SW - xlaunch = -5.0; - ylaunch = 5.0; } + xlaunch = -spitspeed; + ylaunch = spitspeed; } else if (direction == 4) { // W - xlaunch = -5.0; + xlaunch = -spitspeed; ylaunch = 0.0; } else if (direction == 5) { // NW - xlaunch = -5.0; - ylaunch = -5.0; } + xlaunch = -spitspeed; + ylaunch = -spitspeed; } else if (direction == 6) { // N xlaunch = 0.0; - ylaunch = -5.0; } + ylaunch = -spitspeed; } else if (direction == 7) { // NE - xlaunch = 5.0; - ylaunch = -5.0; } + xlaunch = spitspeed; + ylaunch = -spitspeed; } if ((this->settings & 0xF) == 0) { @@ -708,8 +716,8 @@ void daMrSun_c::executeState_Wait() { int Choice; int TimerMax; - if ((this->settings & 0xF) == 0) { TimerMax = 20; } // It's a sun - else { TimerMax = 15; } // It's a moon + if ((this->settings & 0xF) == 0) { TimerMax = 60; } // It's a sun + else { TimerMax = 30; } // It's a moon if (this->timer > TimerMax) { diff --git a/src/spritetex.S b/src/spritetex.S index 431d29f..c991b0e 100755 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -522,6 +522,13 @@ TEX_Spinner: andi. r5, r5, 0xF b GetTexFilenameForR5 +.global TEX_AirshipGear +TEX_AirshipGear: + lwz r5, 4(r30) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + .global TEX_Platforms TEX_Platforms: -- cgit v1.2.3