summaryrefslogtreecommitdiff
path: root/src/effectvideo.cpp
blob: cacc22d4d27b5ac697df593c00fc9c117c6f575a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <common.h>
#include <game.h>
#include <g3dhax.h>
#include "player.h"
#include "effects.h"
#include <sfx.h>


extern "C" void *PlaySound(dEn_c *, int soundID);


class EffectVideo : public dEn_c {
	int onCreate();
	int onExecute();
	int onDelete();

	s32 timer;
	u32 effect;

	static EffectVideo *build();

};


EffectVideo *EffectVideo::build() {
	void *buffer = AllocFromGameHeap1(sizeof(EffectVideo));
	return new(buffer) EffectVideo;
}


int EffectVideo::onCreate() {
	
	this->timer = -60;
	this->effect = 900;

	this->onExecute();
	return true;
}


int EffectVideo::onDelete() {
	return true;
}


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;
	
		this->effect += 1;
	
		this->timer = 0;
	}
	
	this->timer += 1;
	return true;
}