#include #include #include #include extern "C" void *PlaySoundAsync(dEn_c *, int soundID); extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); class EffectVideo : public dEn_c { int onCreate(); 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)); return new(buffer) EffectVideo; } int EffectVideo::onCreate() { this->timer = 0; char eventNum = (this->settings >> 24) & 0xFF; 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; } int EffectVideo::onDelete() { return true; } int EffectVideo::onExecute() { if (EventTable->events & this->eventFlag) { if (this->timer == this->delay) { if (this->type == 0) { // Plays a sound PlaySoundAsync(this, this->effect); } else { // Plays an Effect switch (this->effect) { case 43: SpawnEffect("Wm_ob_cmnspark", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 177: SpawnEffect("Wm_ob_greencoinkira_b", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 193: SpawnEffect("Wm_mr_electricshock_biri01_s", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 365: SpawnEffect("Wm_en_kuribobigsplit", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 514: SpawnEffect("Wm_ob_fireworks_y", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 517: SpawnEffect("Wm_ob_fireworks_b", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 520: SpawnEffect("Wm_ob_fireworks_g", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 523: SpawnEffect("Wm_ob_fireworks_p", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 526: SpawnEffect("Wm_ob_fireworks_k", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 533: SpawnEffect("Wm_ob_fireworks_1up", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; case 540: SpawnEffect("Wm_ob_fireworks_star", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; default: break; } } this->timer = 0; if (this->delay == 0) { this->delay = -1; } } this->timer += 1; } return true; }