summaryrefslogtreecommitdiff
path: root/src/alarm.c
blob: 35b91b06eac68ef17dffa9a75fb0be45c36dfd54 (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
#include "entityimpl.h"
#include "lzr.h"
#include "entityimpl.h"

extern int destructibles, des_x, des_y;

IMPL(update) {
	this->pos[0] = -100;
	this->pos[1] = -100;
	if (destructibles == 0) {
		this->pos[0] = des_x;
		this->pos[1] = des_y;
	}
}

IMPL(draw) {
	const LZR_ImageDrawSettings stg =
		{0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false};
	LZR_DrawSetColor(1, 1, 1, 1);
	LZR_DrawImageEx(LZR_IMAGE(this->broken ? "res/clockdestroyed.bmp" : "res/clock.bmp"),
	                this->pos[0], this->pos[1], stg);
}

IMPL(smash) {
	LZR_PlaySound(4);
	LZR_StopMusic();
	this->smash = NULL;
	this->broken = 1;
}

IMPL_INIT(alarm) {
	LZR_PlayMusic("res/alarm.wav", -1);
	this->width = this->height = 32;
}