-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.hpp
182 lines (146 loc) · 3.48 KB
/
game.hpp
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef LIERO_GAME_HPP
#define LIERO_GAME_HPP
#include <vector>
#include "level.hpp"
#include "settings.hpp"
#include "weapon.hpp"
#include "sobject.hpp"
#include "nobject.hpp"
#include "bobject.hpp"
#include "rand.hpp"
#include "bonus.hpp"
#include <string>
struct Viewport;
struct Worm;
extern int stoneTab[3][4];
struct Material
{
enum
{
Dirt = 1<<0,
Dirt2 = 1<<1,
Rock = 1<<2,
Background = 1<<3,
SeeShadow = 1<<4,
WormM = 1<<5
};
bool dirt() { return (flags & Dirt) != 0; }
bool dirt2() { return (flags & Dirt2) != 0; }
bool rock() { return (flags & Rock) != 0; }
bool background() { return (flags & Background) != 0; }
bool seeShadow() { return (flags & SeeShadow) != 0; }
// Constructed
bool dirtRock() { return (flags & (Dirt | Dirt2 | Rock)) != 0; }
bool anyDirt() { return (flags & (Dirt | Dirt2)) != 0; }
bool dirtBack() { return (flags & (Dirt | Dirt2 | Background)) != 0; }
bool worm() { return (flags & WormM) != 0; }
int flags;
};
struct Texture
{
bool nDrawBack; // 1C208
int mFrame; // 1C1EA
int sFrame; // 1C1F4
int rFrame; // 1C1FE
};
struct Texts
{
void loadFromEXE();
std::string copyright1;
std::string copyright2;
std::string loadoptions;
std::string saveoptions;
std::string curOptNoFile;
std::string curOpt;
std::string gameModes[4];
std::string gameModeSpec[3];
std::string onoff[2];
std::string controllers[2];
std::string keyNames[177];
std::string random;
std::string random2;
std::string reloadLevel;
std::string regenLevel;
std::string selWeap;
std::string levelRandom;
std::string levelIs1;
std::string levelIs2;
std::string randomize;
std::string done;
std::string kills;
std::string lives;
std::string suicide;
std::string reloading;
std::string pressFire;
std::string selLevel;
std::string noWeaps;
std::string weapon;
std::string availability;
std::string weapStates[3];
int copyrightBarFormat;
};
struct AIParams
{
int k[2][7]; // 0x1AEEE, contiguous words
};
struct Game
{
~Game();
void clearViewports();
void addViewport(Viewport*);
void processViewports();
void drawViewports();
void clearWorms();
void addWorm(Worm*);
void resetWorms();
void initGame();
void draw();
void startGame(bool isStartingGame);
bool isGameOver();
void loadMaterials();
void loadWeapons();
void loadTextures();
void loadOthers();
void generateLevel();
void saveSettings();
bool loadSettings();
Material pixelMat(int x, int y)
{
return materials[level.pixel(x, y)];
}
Material materials[256];
Level level;
Settings settings;
Texts texts;
Texture textures[9];
Weapon weapons[40];
SObjectType sobjectTypes[14];
NObjectType nobjectTypes[24];
int weapOrder[41]; // 1-based!
int bonusRandTimer[2][2];
int bonusSObjects[2];
AIParams aiParams;
bool oldRandomLevel;
std::string oldLevelFile;
bool loadPowerlevelPalette;
int cycles;
Worm* lastKilled; // Last killed worm
bool gotChanged;
Rand rand;
std::string settingsFile; // Currently loaded settings file
std::vector<Viewport*> viewports;
std::vector<Worm*> worms;
typedef ObjectList<Bonus, 99> BonusList;
typedef ObjectList<WObject, 600> WObjectList;
typedef ObjectList<SObject, 700> SObjectList;
typedef ObjectList<NObject, 600> NObjectList;
typedef ObjectList<BObject, 700> BObjectList;
BonusList bonuses;
WObjectList wobjects;
SObjectList sobjects;
NObjectList nobjects;
BObjectList bobjects;
};
bool checkRespawnPosition(int x2, int y2, int oldX, int oldY, int x, int y);
extern Game game;
#endif // LIERO_GAME_HPP