summaryrefslogtreecommitdiff
path: root/src/game/decos.cpp
blob: 4b92c8ed82cd6c7cc53d61ed271ddf35459f7f09 (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
#include "game.hpp"

namespace game {

static const struct {
	render::animated_texture_t *texture;
	v2f_t mins, maxs;
	world::cflags_t cflags;
	v2f_t render_mins, render_maxs;
	double fps;
} decos[ ] = {
	{
		&assets::deco.stone,
		{-0.4f, +0.1f}, {+0.4f, +0.4f}, CF_SOLID,
		{-0.4f, -0.4f}, {+0.4f, +0.4f}, 0.0
	},
	{
		&assets::deco.stone,
		{-0.2f, +0.1f}, {+0.2f, +0.2f}, 0,
		{-0.2f, -0.2f}, {+0.2f, +0.2f}, 0.0
	},
	{
		&assets::deco.eyething,
		{-0.4f, -0.4f}, {+0.4f, +0.4f}, CF_SOLID,
		{-0.4f, -1.2f}, {+0.4f, +0.4f}, 0.3
	},
	{
		&assets::deco.spike,
		{-0.4f, -0.4f}, {+0.4f, +0.4f}, CF_SOLID,
		{-0.4f, -1.2f}, {+0.4f, +0.4f}, 0.0
	},
	{
		&assets::deco.spike_small,
		{-0.2f, +0.1f}, {+0.2f, +0.2f}, 0,
		{-0.2f, -0.6f}, {+0.2f, +0.2f}, 0.0
	},
	{
		&assets::deco.wart,
		{-0.2f, +0.1f}, {+0.2f, +0.2f}, 0,
		{-0.2f, -0.2f}, {+0.2f, +0.2f}, 0.0
	}
};

deco_t::deco_t(game::state_t *game_, deco_type_t type_) : game::entity_t(game_, ET_DECO)
{
	type = type_;

	size[0] = decos[type].mins;
	size[1] = decos[type].maxs;
	render_size[0] = decos[type].render_mins;
	render_size[1] = decos[type].render_maxs;
	cmodel.cflags = decos[type].cflags;
}

void deco_t::render_to(render::state_t *render)
{
	render->render(game->now * decos[type].fps + phase_shift,
	               decos[type].texture, render_bounds, sf::Color::White);
}

} // namespace game