-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.hpp
executable file
·166 lines (137 loc) · 3.91 KB
/
main.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
//The headers
#ifdef __APPLE__
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#else
#include <SDL.h>
#include <SDL_opengl.h>
#endif
//pure function optimisation
#ifdef __GNUC__
#define pure_function __attribute__((pure))
#define const_function __attribute__((const))
#else
#define pure_function
#define const_function
#endif
#include "config.hpp"
#include <vector>
#include "timer.hpp"
#include "levelstructs.hpp"
#include "shapes.hpp"
#include "math.h"
#include "audio.hpp"
enum GameState {gs_intro,gs_title,gs_interlude,gs_level,gs_quit,gs_finishchapter};
enum TitleSubOption {ts_main,ts_newgameselect,ts_newgamechapterselect,ts_newcustomgameselect,ts_newcustomgamechapterselect,
ts_editgameselect, ts_editentername, ts_editchapterselect,ts_nofiles,ts_editnofiles};
class Game
{
public:
void handle_input();
void move();
void show();
Game();
};
//the following are loaded from config files
float MAXDEPTH=500;
float MAXREALDEPTH=30;
const int DEFAULT_SCREEN_WIDTH=640;
const int DEFAULT_SCREEN_HEIGHT=480;
const bool DEFAULT_FULLSCREEN=1;
void deallocOutlineLists();
void allocOutlineLists(int NUM);
inline GLfloat min (GLfloat a, GLfloat b) const_function;
int getscalevisit(GLfloat s) const_function;
int getscaleexplore(GLfloat s) const_function;
void moveEntity(Entity& E, int room);
void drawEntity(Entity E,GLfloat a, bool parity);
bool CanMove(int room,GLfloat x,GLfloat y);
void RenderRoom(int room_t, int room_f, int edge_t, int edge_f, bool parity, bool globparity, GLfloat depth, GLfloat realdepth, GLfloat outers);
void buildOutlines();
void buildLists();
bool init_GL();
bool init();
void initlevel();
void restartlevel();
void finishlevel();
void clean_up();
void levelinput();
void interludeinput();
void levelmove();
void interludemove();
void levelshow();
void printletter(int i);
int chartonum(char c) const_function;
void print_straight_text(const string& s);
void print_straight_letter(int i);
void print_text(const char *s);
void print_text2(const char *s);
void interludeshow();
void print_text(const char *s);
void finishlevel();
void restartlevel();
void saveleveldat(const char *s);
void loadleveldat(const char *s);
void generate_extra_init_stuff();
void writelevel(const char* path,const LevelState& level);
void readlevel(const char* path,LevelState& level);
void ls_initlevel(int l, const LevelState& level, int fps, int oldlevel);
void blankLevel(LevelState& level);
void generateShapeScales();
void buildRoomRatios();
void countPortals();
void deleteDir(string s);
void renameFile(string s,string t);
void getEpisodeData();
void resizethings(int newroomcount, bool forceresize=false);
void clearsizes();
void fadetoblack(bool fade=1);
struct ConnectionInfo {
bool connected;
int indices; //indices of empty slots
};
struct Portal {
int room;
int side;
};
enum PageView {E_FileStuff, E_ColourScheme,E_LevelGoals,E_EntityChooser,E_TextChooser, E_RoomAdder,E_PortalMode,E_Other};
class EditorState {
public:
bool allowmove;
bool prompttodelete;
Portal portalselected;
Portal portaldropped;
void overlay();
int itemcount;
void input (char c);
PageView page;
void setPage(PageView newpage);
int itemselected;
int shapeselected;
int wallselected;
int realwallselected;
int roomcount;//calculate by loking atislands I guess?
bool newportalparity;
bool newportalloc;
vector <ConnectionInfo> component;
private:
void drawColourChart();
void drawColourBox();
void drawLevelObjectives();
void drawFileMenu();
void drawEntityChooser();
void drawTextChooser();
void drawRoomAdder();
void drawPortalMode();
void drawOtherMode();
GLfloat rotamount;
void traceRooms();
void traceRoom(int r);
void indexFreeRooms();
void addPortal(Portal pFrom, Portal pTo, bool par, bool loc);
void removePortal(Portal p);
void addRoom(Portal pFrom, int shape, int shapeside,bool par, bool loc);
Portal portalTo;
};
GLfloat roomNormalizations[SHAPECOUNT];
bool firstframe;