-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleStore.h
85 lines (68 loc) · 2.25 KB
/
ModuleStore.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#ifndef __MODULESTORE_H__
#define __MODULESTORE_H__
#include "Module.h"
#include "Animation.h"
#include "p2Point.h"
struct SDL_Texture;
class ModuleStore : public Module
{
public:
ModuleStore(bool startEnabled);
~ModuleStore();
bool Start();
update_status Update();
update_status PostUpdate();
bool CleanUp();
char moneyText[10] = { "\0" };
// Sound effects indices
uint chooseFx = 0;
uint boughtFx = 0;
uint noMoneyFx = 0;
// Bit field to store all the weapons selected to start the game
// The last 11 bits represent each weapon selectable for the player (from left to right)
// For instance, 00000000 00000000 00000000 00000001 means that WEAPON_11 has been selected
// With that we'll be able to know which weapons have been selected by the player without wasting memory unnecessarily :)
uint weaponSelection = 0; // 00000000 00000000 00000000 00000000
private:
SDL_Texture* tex = nullptr;
SDL_Texture* tex2 = nullptr;
SDL_Texture* tex3 = nullptr;
SDL_Texture* tex4 = nullptr;
SDL_Rect title;
SDL_Rect text;
SDL_Rect selector;
SDL_Rect background;
SDL_Rect alreadySelected;
Animation talkStore;
Animation unicorn_anim;
Animation* current_anim = nullptr;
iPoint selectorPos;
// Id Fonts
int greyFont = -1;
int greenFont = -1;
bool exitPressed = false;
// Countdown to handle selector spacing
int MaxCountdownR = 15;
int CountdownR = 0;
int MaxCountdownL = 15;
int CountdownL = 0;
// A few variables to manage the correct functioning of the store...
// Not necessary for the remaining modules (because of that they are not defined in the .h)
enum weapons {
WEAPON_1, WEAPON_2, FALCON, WEAPON_4, SHELL, WEAPON_6,
BOMB, WEAPON_8, CEILING, WEAPON_10, WEAPON_11, EXIT
};
uint weapons[2][6] = { {WEAPON_1, WEAPON_2, FALCON, WEAPON_4, SHELL, WEAPON_6},
{BOMB, WEAPON_8, CEILING, WEAPON_10, WEAPON_11, EXIT} };
uint rows = 0;
uint columns = 0;
uint weapon = weapons[rows][columns];
///////////////////////////////////////////////////////////////////////////////////////////
enum storeState {
FALCONSELECT, SHELLSELECT, BOMBSELECT, CEILINGSELECT, CANTHANDLE, BOUGHT, ALREADYBOUGHT, NOMONEY, EXITSELECT, BYE, IDLE
};
storeState currentState = CANTHANDLE;
uint storeStateCounter = 0;
};
#endif // __MODULESTORE_H__