23 #include <graphics/graphics.h>
24 #include <graphics/window.h>
26 #include <common_features/pge_texture.h>
27 #include <common_features/episode_state.h>
28 #include <common_features/event_queue.h>
29 #include <common_features/point.h>
31 #include <common_features/RTree/RTree.h>
33 #include <gui/pge_menubox.h>
35 #include "level/lvl_player.h"
36 #include "level/lvl_player_def.h"
38 #include "level/lvl_block.h"
39 #include "level/lvl_bgo.h"
40 #include "level/lvl_npc.h"
42 #include "level/lvl_physenv.h"
44 #include "level/lvl_warp.h"
45 #include "level/lvl_section.h"
46 #include "level/lvl_backgrnd.h"
48 #include "level/lvl_layer_engine.h"
49 #include "level/lvl_event_engine.h"
51 #include <controls/controller.h>
53 #include <data_configs/custom_data.h>
55 #include <script/lua_level_engine.h>
62 #include <SDL2/SDL_opengl.h>
63 #include <SDL2/SDL_timer.h>
82 static int init_thread(
void *
self);
83 SDL_Thread * initializer_thread;
91 bool loadFile(QString filePath);
95 bool setEntrance(
int entr);
99 bool cameraStartDirected;
100 int cameraStartDirection;
108 QHash<int, LVL_PlayerDef > player_defs;
113 void onMousePressed(SDL_MouseButtonEvent &mbevent);
114 void onMouseMoved(SDL_MouseMotionEvent &mvevent);
115 void onMouseReleased(SDL_MouseButtonEvent &mvevent);
120 void processEvents();
124 void tickAnimations(
float ticks);
126 QString getLastError();
129 int findNearestSection(
long x,
long y);
142 bool isLevelContinues;
144 void setExiting(
int delay,
int reason);
146 QString toAnotherLevel();
147 QString warpToLevelFile;
150 int toAnotherEntrance();
157 float exitLevelDelay;
167 void collectGarbageNPCs();
168 void collectGarbagePlayers();
171 static double zCounter;
173 static const double Z_backImage;
176 static const double Z_BGOBack2;
178 static const double Z_blockSizable;
181 static const double Z_BGOBack1;
183 static const double Z_npcBack;
184 static const double Z_Block;
185 static const double Z_npcStd;
186 static const double Z_Player;
189 static const double Z_BGOFore1;
190 static const double Z_BlockFore;
191 static const double Z_npcFore;
193 static const double Z_BGOFore2;
195 static const double Z_sys_PhysEnv;
196 static const double Z_sys_door;
197 static const double Z_sys_interspace1;
198 static const double Z_sys_sctBorder;
206 void setLoaderAnimation(
int speed);
207 void stopLoaderAnimation();
208 void destroyLoaderTexture();
209 static unsigned int nextLoadAniFrame(
unsigned int x,
void *p);
213 SDL_TimerID loader_timer_id;
218 QQueue<transformTask_block > block_transforms;
220 QHash<int, QList<LVL_Block* > > switch_blocks;
221 void toggleSwitch(
int switch_id);
223 QVector<LVL_Npc* > active_npcs;
224 QVector<LVL_Npc* > dead_npcs;
225 QVector<LVL_Player* > dead_players;
227 QVector<LVL_Block* > fading_blocks;
234 void addPlayer(
PlayerPoint playerData,
bool byWarp=
false,
int warpType=0,
int warpDirect=0);
244 enum NpcSpawnDirection
253 LVL_Npc *spawnNPC(
LevelNPC npcData, NpcSpawnType sp_type, NpcSpawnDirection sp_dir,
bool reSpawnable=
false);
258 int placingMode_item_type;
266 bool placingMode_sizableBlock;
267 bool placingMode_rect_draw;
272 bool placingMode_animated;
273 int placingMode_animatorID;
277 void process_InterprocessCommands();
279 void drawPlacingItem();
280 void placeItemByMouse(
int x,
int y);
293 bool isVizibleOnScreen(
double x,
double y,
double w,
double h);
303 typedef QList<PGE_LevelCamera> LVL_CameraList;
304 typedef QList<LVL_Section> LVL_SectionsList;
306 LVL_CameraList cameras;
307 LVL_SectionsList sections;
310 typedef QVector<LVL_Player* > LVL_PlayersArray;
311 typedef QVector<LVL_Block* > LVL_BlocksArray;
312 typedef QVector<LVL_Bgo* > LVL_BgosArray;
313 typedef QVector<LVL_Npc* > LVL_NpcsArray;
314 typedef QVector<LVL_Warp* > LVL_WarpsArray;
315 typedef QVector<LVL_PhysEnv* > LVL_PhysEnvsArray;
320 LVL_PlayersArray players;
321 LVL_BlocksArray blocks;
324 LVL_WarpsArray warps;
325 LVL_PhysEnvsArray physenvs;
329 enum PauseMenuItems_Menu1
336 enum PauseMenuItems_Menu2
344 bool _pauseMenu_opened;
345 void initPauseMenu1();
346 void initPauseMenu2();
347 void processPauseMenu();
350 bool debug_player_jumping;
351 bool debug_player_onground;
352 int debug_player_foots;
353 int debug_render_delay;
354 int debug_phys_delay;
355 int debug_event_delay;
359 void processPhysics(
float ticks);
364 typedef double RPoint[2];
365 void queryItems(
PGE_RectF &zone, QVector<PGE_Phys_Object* > *resultList);
366 void queryItems(
double x,
double y, QVector<PGE_Phys_Object* > *resultList);
368 LVL_PlayersArray& getPlayers();
369 LVL_NpcsArray& getNpcs();
370 LVL_NpcsArray& getActiveNpcs();
376 QList<PGE_Texture > textures_bank;
382 #endif // SCENE_LEVEL_H
Definition: scene_level.h:73
Definition: pge_texture.h:32
bool loadConfigs()
Definition: lvl_scene_init.cpp:190
Definition: lua_level_engine.h:10
Level specific NPC entry structure. Defines preferences of each NPC.
Definition: lvl_filedata.h:195
Level specific Warp entry structure. Defines preferences of each Warp entry.
Definition: lvl_filedata.h:231
bool loadFileIP()
Load data via interprocessing.
Definition: lvl_scene_files_io.cpp:46
bool init_items()
Definition: lvl_scene_init.cpp:236
The Controller class provides proxy interface between controllable objects array and physical control...
Definition: controller.h:32
Level specific Background object entry structure. Defines preferences of each Background object...
Definition: lvl_filedata.h:138
void onKeyboardPressedSDL(SDL_Keycode sdl_key, Uint16 modifier)
Triggering when pressed any key on keyboard.
Definition: scene_level.cpp:534
This class should have basic functions for interacting with lua To run the lua engine you have to con...
Definition: lua_engine.h:27
Definition: lvl_section.h:34
Level data structure. Contains all available settings and element lists on the level.
Definition: lvl_filedata.h:396
Definition: lvl_block.h:31
Definition: episode_state.h:47
Definition: lvl_layer_engine.h:25
Level specific Block entry structure. Defines preferences of each block.
Definition: lvl_filedata.h:95
Definition: lvl_event_engine.h:39
The PGE_Phys_Object class.
Definition: lvl_base_object.h:51
Level specific Player spawn point entry definition structure.
Definition: lvl_filedata.h:76