summaryrefslogtreecommitdiff
path: root/src/effectvideo.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-10-14 18:09:57 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-10-14 18:09:57 -0500
commitaecb0ff2ad22f35dbc392a99de6c3d270e0d0a48 (patch)
tree3099a095357a7a25c8e35a82951cdd86ac64d98c /src/effectvideo.cpp
parentdd010814367f49a742bca1d5ef3b23765240b373 (diff)
downloadkamek-aecb0ff2ad22f35dbc392a99de6c3d270e0d0a48.tar.gz
kamek-aecb0ff2ad22f35dbc392a99de6c3d270e0d0a48.zip
Polished up Fuzzy Bear a bunch, made boss ramboo. Both are waiting on anmChr, kameck intro, and outro wipe. Also turned effectvideo into effect spawner.
Diffstat (limited to 'src/effectvideo.cpp')
-rw-r--r--src/effectvideo.cpp52
1 files changed, 39 insertions, 13 deletions
diff --git a/src/effectvideo.cpp b/src/effectvideo.cpp
index cacc22d..38a7686 100644
--- a/src/effectvideo.cpp
+++ b/src/effectvideo.cpp
@@ -14,13 +14,24 @@ class EffectVideo : public dEn_c {
int onExecute();
int onDelete();
+ u64 eventFlag;
s32 timer;
+ u32 delay;
+
u32 effect;
+ u8 type;
+ float scale;
static EffectVideo *build();
};
+struct EventTable_t {
+ u64 events;
+};
+
+extern EventTable_t *EventTable;
+
EffectVideo *EffectVideo::build() {
void *buffer = AllocFromGameHeap1(sizeof(EffectVideo));
@@ -30,8 +41,19 @@ EffectVideo *EffectVideo::build() {
int EffectVideo::onCreate() {
- this->timer = -60;
- this->effect = 900;
+ this->timer = 0;
+
+ char eventNum = (this->settings >> 24) & 0xFF;
+ OSReport("Event to activate: %d", eventNum);
+
+ this->eventFlag = (u64)1 << (eventNum - 1);
+
+ this->type = (this->settings >> 16) & 0xF;
+ this->effect = this->settings & 0xFFF;
+ this->scale = float((this->settings >> 20) & 0xF) / 4.0;
+ this->delay = (this->settings >> 12) & 0xF * 30;
+
+ if (this->scale == 0.0) { this->scale = 1.0; }
this->onExecute();
return true;
@@ -45,20 +67,24 @@ int EffectVideo::onDelete() {
int EffectVideo::onExecute() {
- if (this->effect >= 1001) { return true; }
-
- if (this->timer > 60) {
-
- CreateEffect(this, this->effect);
- PlaySound(this, this->effect);
- this->pos.x += 16.0;
+ if (EventTable->events & this->eventFlag) {
+
+ if (this->timer == this->delay) {
+
+ if (this->type == 0) { // Plays a sound
+ PlaySound(this, this->effect);
+ }
- this->effect += 1;
+ else { // Plays an Effect
+ CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}, this->effect);
+ }
- this->timer = 0;
+ this->timer = 0;
+ if (this->delay == 0) { this->delay = -1; }
+ }
+
+ this->timer += 1;
}
-
- this->timer += 1;
return true;
}