]> git.mxchange.org Git - quix0rs-blobwars.git/blob - src/CEngine.h
Don't link pak tool with SDL.
[quix0rs-blobwars.git] / src / CEngine.h
1 /*
2 Copyright (C) 2004-2011 Parallel Realities
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 class Engine {
22
23         private:
24
25                 SDL_Event event;
26                 signed char frameLoop;
27                 int mouseX, mouseY;
28
29                 // Time Difference
30                 unsigned int time1;
31                 unsigned int time2;
32                 float timeDifference;
33                 
34                 // used for cheating!
35                 char lastKeyPressed[25];
36                 char lastKeyEvents[25];
37                 
38                 // Joystick config stuff
39                 int lastButtonPressed;
40                 
41                 Pak pak;
42
43         public:
44                 
45                 int extremeAvailable;
46
47                 char keyState[350];
48                 char mouseLeft, mouseRight;
49                 
50                 int joyX, joyY;
51                 int joystickState[32]; // hopefully no one has a joystick with this many buttons(!)
52                 bool waitForButton;
53                 bool waitForKey;
54                 bool allowJoypad;
55
56                 bool paused;
57                 bool saveConfig;
58                 bool allowQuit;
59
60                 char userHomeDirectory[PATH_MAX];
61
62                 int useAudio;
63                 int fullScreen;
64                 int skill;
65                 bool practice;
66
67                 // Development stuff
68                 bool devNoMonsters;
69
70                 SDL_RWops *sdlrw;
71
72                 unsigned char *binaryBuffer; // used for unzipping
73                 unsigned char *dataBuffer; // used for unzipping
74
75                 int messageTime;
76                 int messagePriority;
77                 int messageType;
78                 char message[100];
79
80                 char saveSlot[10][80];
81                 int continueSaveSlot;
82
83                 int playerPosX, playerPosY;
84
85                 List widgetList;
86
87                 Widget *highlightedWidget;
88
89                 Entity world;
90
91                 List defineList;
92
93                 bool cheats;
94                 int cheatHealth, cheatExtras, cheatFuel, cheatLevels, cheatBlood, cheatInvulnerable;
95                 int cheatReload, cheatSpeed, cheatSkipLevel;
96
97         Engine();
98         void destroy();
99         void getInput();
100         int getMouseX() const;
101         int getMouseY() const;
102
103         void setMouse(int x, int y);
104         bool userAccepts();
105         
106         void clearCheatVars();
107         bool compareLastKeyInputs();
108         void addKeyEvent();
109         void flushInput();
110         void clearInput();
111         void setUserHome(const char *path);
112         Pak *getPak();
113         bool unpack(const char *filename, int fileType);
114         bool loadData(const char *filename);
115         void reportFontFailure();
116         void setPlayerPosition(int x, int y, int limitLeft, int limitRight, int limitUp, int limitDown);
117         int getFrameLoop() const;
118         void doFrameLoop();
119         void doTimeDifference();
120         float getTimeDifference() const;
121         void resetTimeDifference();
122         void setInfoMessage(const char *message, int priority, int type);
123         void deleteWidgets();
124         void addWidget(Widget *widget);
125         bool loadWidgets(const char *filename);
126         Widget *getWidgetByName(const char *name);
127         void showWidgetGroup(const char *groupName, bool show);
128         void enableWidgetGroup(const char *groupName, bool show);
129         void showWidget(const char *name, bool show);
130         void enableWidget(const char *name, bool enable);
131         void setWidgetVariable(const char *name, int *variable);
132         bool widgetChanged(const char *name);
133         void highlightWidget(int dir);
134         void highlightWidget(const char *name);
135         int processWidgets();
136         bool loadDefines();
137         int getValueOfDefine(const char *word);
138         char *getDefineOfValue(const char *prefix, int value);
139         int getValueOfFlagTokens(const char *line);
140         void delay(unsigned int frameLimit);
141 };