diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-09-28 02:33:45 -0500 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-09-28 02:33:45 -0500 |
commit | f35befab481e013d76631baf6abec5f69ff703a6 (patch) | |
tree | f9d17f5e9db68dfa7547a590134959c8b4b0a65f /src/firelaser.cpp | |
parent | 463bf1cb5059e14b3af73adf0037a9ae8a5dcd2c (diff) | |
download | kamek-f35befab481e013d76631baf6abec5f69ff703a6.tar.gz kamek-f35befab481e013d76631baf6abec5f69ff703a6.zip |
added fire laser, airship gear retexture, and some minor sun fixes
Diffstat (limited to 'src/firelaser.cpp')
-rwxr-xr-x | src/firelaser.cpp | 144 |
1 files changed, 144 insertions, 0 deletions
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 <common.h> +#include <game.h> +#include <g3dhax.h> + +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() { + +} + + + + + + + + + + + + + |