PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
lvl_filedata.h
Go to the documentation of this file.
1 /*
2  * Platformer Game Engine by Wohlstand, a free platform for game making
3  * Copyright (c) 2014-2015 Vitaly Novichkov <admin@wohlnet.ru>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * 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, see <http://www.gnu.org/licenses/>.
17  */
18 
23 #ifndef LVL_FILEDATA_H
24 #define LVL_FILEDATA_H
25 
26 #include "pge_file_lib_globs.h"
27 #include "meta_filedata.h"
28 
30 
34 {
36  int id;
38  long size_top;
42  long size_left;
44  long size_right;
46  unsigned int music_id;
48  long bgcolor;
50  bool wrap_h;
52  bool wrap_v;
56  unsigned int background;
60  bool underwater;
63 
64 /*
65  * Editor-only parameters which are not saving into file
66  */
68  long PositionX;
70  long PositionY;
71 };
72 
77 {
79  unsigned int id;
81  long x;
83  long y;
85  long h;
87  long w;
89  int direction;
90 };
91 
95 struct LevelBlock
96 {
98  long x;
100  long y;
103  long h;
106  long w;
108  unsigned long id;
110  long npc_id;
112  bool invisible;
114  bool slippery;
123 
124 /*
125  * Editor-only parameters which are not saving into file
126  */
129  unsigned int array_id;
131  unsigned int index;
132 };
133 
134 
138 struct LevelBGO
139 {
140 /*
141  * SMBX64
142  */
144  long x;
146  long y;
148  unsigned long id;
151 
152 /*
153  * Extended
154  */
158  enum zmodes{
169  };
170 
172  int z_mode;
174  double z_offset;
175 
178  long smbx64_sp;
179 /*
180  * Editor-only parameters which are not saving into file
181  */
185  unsigned int array_id;
187  unsigned int index;
188 
189 };
190 
191 
195 struct LevelNPC
196 {
197  long x;
198  long y;
199  int direct;
200  unsigned long id;
203  bool generator;
208  bool friendly;
209  bool nomove;
210  bool is_boss;
217 
218 /*
219  * Editor-only parameters which are not saving into file
220  */
221  unsigned int array_id;
222  unsigned int index;
224  bool is_star;
225 };
227 
231 struct LevelDoor
232 {
233  long ix;
234  long iy;
235  bool isSetIn;
236 
237  long ox;
238  long oy;
239  bool isSetOut;
240 
241  int idirect;
242  int odirect;
243  int type;
245  long warpto;
246  bool lvl_i;
247  bool lvl_o;
248  long world_x;
249  long world_y;
250  int stars;
252  bool unknown;
253  bool novehicles;
254  bool allownpc;
256  bool locked;
257 
258 /*
259  * Editor-only parameters which are not saving into file
260  */
262  unsigned int array_id;
263  unsigned int index;
264 };
265 
270 {
271  long x;
272  long y;
273  long h;
274  long w;
275  long unknown;
276  bool quicksand;
278 
279 /*
280  * Editor-only parameters which are not saving into file
281  */
283  unsigned int array_id;
285  unsigned int index;
286 };
287 
292 {
294  bool hidden;
295  bool locked;
296 
297 /*
298  * Editor-only parameters which are not saving into file
299  */
300  unsigned int array_id;
301 };
303 
308 {
309  long music_id;
312  long position_top;
316 };
317 
322 {
328  long sound_id;
330  long end_game;
331 
333  bool nosmoke;
340 
342  PGELIST<LevelEvent_Sets > sets;
347 
349  bool ctrl_up;
351  bool ctrl_down;
353  bool ctrl_left;
357  bool ctrl_jump;
361  bool ctrl_run;
364 
368  bool ctrl_drop;
369 
371  bool autostart;
372 
385 
386  /*
387  * Editor-only parameters which are not saving into file
388  */
390  unsigned int array_id;
391 };
392 
396 struct LevelData
397 {
398  /*
399  * Level header
400  */
402  int stars;
411 
414 
415  /*
416  * Level data
417  */
418  PGELIST<LevelSection > sections;
419  PGELIST<PlayerPoint > players;
420  PGELIST<LevelBlock > blocks;
421  unsigned int blocks_array_id;
422  PGELIST<LevelBGO > bgo;
423  unsigned int bgo_array_id;
424  PGELIST<LevelNPC > npc;
425  unsigned int npc_array_id;
426  PGELIST<LevelDoor > doors;
427  unsigned int doors_array_id;
428  PGELIST<LevelPhysEnv > physez;
429  unsigned int physenv_array_id;
430  PGELIST<LevelLayer > layers;
431  unsigned int layers_array_id;
432  PGELIST<LevelSMBX64Event > events;
433  unsigned int events_array_id;
434 
437 
438  /*
439  * Editor-only parameters which are not saving into file
440  */
444  bool playmusic;
446  bool modified;
448  bool untitled;
456 
457  /*
458  * Helpful functions
459  */
465  bool eventIsExist(PGESTRING title);
471  bool layerIsExist(PGESTRING title);
472 };
473 
474 
475 
476 #endif // LVL_FILEDATA_H
long smbx64_sp_apply
Automatically calculated value of SMBX64 Order priority.
Definition: lvl_filedata.h:183
int ERROR_linenum
Number of line where error was occouped.
Definition: lvl_filedata.h:410
unsigned int index
Recent array index where block was saved (used to speed-up settings synchronization) ...
Definition: lvl_filedata.h:187
long background_id
Set new Background ID in this section (-1 - do nothing, -2 - reset to defaint, >=0 - set background I...
Definition: lvl_filedata.h:310
PGESTRINGList layers_hide
List of layers to hide.
Definition: lvl_filedata.h:335
bool OffScreenEn
Level will be exited when playable character will exit out of screen.
Definition: lvl_filedata.h:54
unsigned int index
Recent array index where block was saved (used to speed-up settings synchronization) ...
Definition: lvl_filedata.h:263
long special_data2
User-data integer #2 used for configuring some NPC-AI's (kept for SMBX64)
Definition: lvl_filedata.h:202
bool ctrl_right
Hold "Right" key controllers.
Definition: lvl_filedata.h:355
long world_y
Target World map Н coordinate.
Definition: lvl_filedata.h:249
bool hidden
Is this layer hidden?
Definition: lvl_filedata.h:294
bool eventIsExist(PGESTRING title)
Checks is event with specified title exist in this level.
Definition: lvl_filedata.cpp:545
float move_camera_x
Setup autoscrool X speed in pixels per 1/65.
Definition: lvl_filedata.h:380
bool nomove
NPC will stay idle and will always keep look to the playable character.
Definition: lvl_filedata.h:209
bool smbx64strict
Definition: lvl_filedata.h:451
long w
Wodth of player spawn point (used to calculate position of bottom to place playable character correct...
Definition: lvl_filedata.h:87
long x
X position of block.
Definition: lvl_filedata.h:98
#define PGESTRING
A macro which equal to std::string if PGE File Library built in the STL mode and equal to QString if ...
Definition: pge_file_lib_globs.h:97
int odirect
Direction of exit point: [1] down [3] up [4] left [2] right (not same as entrance!) ...
Definition: lvl_filedata.h:242
PGESTRINGList layers_toggle
List of layers to toggle (hide visible and show invisible)
Definition: lvl_filedata.h:339
unsigned int array_id
Definition: lvl_filedata.h:221
bool modified
Is level was modified since open?
Definition: lvl_filedata.h:446
long y
Y position of block.
Definition: lvl_filedata.h:100
PGESTRING music_file
Custom music file which will be playd if music ID defined to "Custom" music id.
Definition: lvl_filedata.h:62
bool isSetOut
[Editing only, is not saving into file] is exit point placed to the level
Definition: lvl_filedata.h:239
bool ctrl_altjump
Hold "Alt-jump" key controllers.
Definition: lvl_filedata.h:359
bool autostart
Trigger event automatically on level startup.
Definition: lvl_filedata.h:371
long y
Y position of physical environment zone.
Definition: lvl_filedata.h:272
bool ctrl_drop
Hold "Drop" key controllers.
Definition: lvl_filedata.h:368
long oy
Y position of Exit point.
Definition: lvl_filedata.h:238
int stars
Stars required to be allowed for enter into this warp.
Definition: lvl_filedata.h:250
long position_bottom
Change Y position of bottom section boundary.
Definition: lvl_filedata.h:314
PGESTRING event_destroy
Trigger event on destroying of this block.
Definition: lvl_filedata.h:118
float move_camera_y
Setup autoscrool Y speed in pixels per 1/65.
Definition: lvl_filedata.h:382
Background-1 (over sizable blocks, under regular blocks)
Definition: lvl_filedata.h:162
PGESTRING event_activate
Trigger event on actiovation of this NPC (on appearence on screen)
Definition: lvl_filedata.h:212
long position_right
Change X position of right section boundary.
Definition: lvl_filedata.h:315
bool lvl_i
Level entrance (this point can be used only as entrance point where player will enter into level) ...
Definition: lvl_filedata.h:246
bool quicksand
Enable quicksand physical environment, overwise water physical environment.
Definition: lvl_filedata.h:276
PGESTRING path
Recent file path where file was located since it was opened.
Definition: lvl_filedata.h:455
bool is_boss
Enables some boss-specific NPC-AI features (Used by NPC-AI)
Definition: lvl_filedata.h:210
Level specific Section entry structure. Defines prererences of one section.
Definition: lvl_filedata.h:33
PGELIST< PlayerPoint > players
Player spawn points array.
Definition: lvl_filedata.h:419
PGELIST< LevelBlock > blocks
Array of all presented Blocks in this level.
Definition: lvl_filedata.h:420
unsigned int blocks_array_id
Last used block's array ID.
Definition: lvl_filedata.h:421
bool is_star
Definition: lvl_filedata.h:224
int z_mode
Z-Mode of displaying of BGO.
Definition: lvl_filedata.h:172
Background-2 (under sizable blocks)
Definition: lvl_filedata.h:160
PGELIST< LevelDoor > doors
Array of all presented Warp Entries in this level.
Definition: lvl_filedata.h:426
float layer_speed_y
Set layer Y motion in pixels per 1/65.
Definition: lvl_filedata.h:378
long y
Y position of NPC.
Definition: lvl_filedata.h:198
bool ctrl_start
Hold "Start" key controllers.
Definition: lvl_filedata.h:366
bool novehicles
Definition: lvl_filedata.h:253
PGESTRING layer
Name of a parent layer. Default value is "Default".
Definition: lvl_filedata.h:277
PGESTRING movelayer
Install layer motion settings for layer if is not empt.
Definition: lvl_filedata.h:374
unsigned int array_id
Array-ID is an unique key value identificates each unique block object. Re-counts on each file reload...
Definition: lvl_filedata.h:390
Level specific Layer entry structure.
Definition: lvl_filedata.h:291
long iy
Y position of Entrance point.
Definition: lvl_filedata.h:234
long ox
X position of Exit point.
Definition: lvl_filedata.h:237
Level specific NPC entry structure. Defines preferences of each NPC.
Definition: lvl_filedata.h:195
long unknown
[Unused] reserved long integer value, always 0
Definition: lvl_filedata.h:275
Level specific Warp entry structure. Defines preferences of each Warp entry.
Definition: lvl_filedata.h:231
int generator_type
Generator type 0 - instant appearence, 1 - warp, 2 - projectile shoot.
Definition: lvl_filedata.h:205
PGELIST< LevelNPC > npc
Array of all presented NPCs in this level.
Definition: lvl_filedata.h:424
long world_x
Target World map X coordinate.
Definition: lvl_filedata.h:248
PGESTRING event_die
Trigger event on death of this NPC.
Definition: lvl_filedata.h:213
bool unknown
[Unused] resrved boolean flag, always false
Definition: lvl_filedata.h:252
unsigned int array_id
Definition: lvl_filedata.h:300
int CurSection
ID of currently editing section.
Definition: lvl_filedata.h:442
unsigned int index
Recent array index where block was saved (used to speed-up settings synchronization) ...
Definition: lvl_filedata.h:285
long h
Height of player spawn point (used to calculate position of bottom to place playable character correc...
Definition: lvl_filedata.h:85
PGESTRING event_hit
Trigger event on hiting of this block.
Definition: lvl_filedata.h:120
unsigned int bgo_array_id
Last used Background object array ID.
Definition: lvl_filedata.h:423
long position_left
Definition: lvl_filedata.h:311
long size_top
Y-Position of top side of section.
Definition: lvl_filedata.h:38
unsigned int events_array_id
Last used Event's array ID.
Definition: lvl_filedata.h:433
long x
X position of NPC.
Definition: lvl_filedata.h:197
long size_bottom
Y-Position of bottom side of section.
Definition: lvl_filedata.h:40
PGESTRING layer
Name of a parent layer. Default value is "Default".
Definition: lvl_filedata.h:116
long h
Height of physical environment zone.
Definition: lvl_filedata.h:273
unsigned int array_id
Definition: lvl_filedata.h:129
PGESTRING event_emptylayer
Trigger event on destroying of this block and at sametime parent layer has no more other objects...
Definition: lvl_filedata.h:122
bool lock_left_scroll
Enable lock of walking to left direction.
Definition: lvl_filedata.h:58
bool ctrl_up
Hold "Up" key controllers.
Definition: lvl_filedata.h:349
PGELIST< LevelSection > sections
Sections settings array.
Definition: lvl_filedata.h:418
zmodes
Z order Modes of background objects.
Definition: lvl_filedata.h:158
bool wrap_v
Enables vertical wrap.
Definition: lvl_filedata.h:52
long special_data
User-data integer #1 used for configuring some NPC-AI's (kept for SMBX64)
Definition: lvl_filedata.h:201
unsigned int physenv_array_id
Last used Physical Environment Zone's array ID.
Definition: lvl_filedata.h:429
unsigned int index
Recent array index where block was saved (used to speed-up settings synchronization) ...
Definition: lvl_filedata.h:223
PGELIST< LevelSMBX64Event > events
Array of all presented events in this level.
Definition: lvl_filedata.h:432
long bgcolor
[UNUSED] RGBA defines color of background if image is not defined.
Definition: lvl_filedata.h:48
bool untitled
Is this level made from scratch and was not saved into file?
Definition: lvl_filedata.h:448
unsigned int background
ID of background image of this section.
Definition: lvl_filedata.h:56
PGESTRING layer
Name of a parent layer. Default value is "Default".
Definition: lvl_filedata.h:251
Level specific Background object entry structure. Defines preferences of each Background object...
Definition: lvl_filedata.h:138
PGESTRING ERROR_linedata
Line data where error was occouped.
Definition: lvl_filedata.h:408
bool isSetIn
[Editing only, is not saving into file] is entrance point placed to the level
Definition: lvl_filedata.h:235
bool layerIsExist(PGESTRING title)
Checks is layer with specified title exist in this level.
Definition: lvl_filedata.cpp:555
bool generator
Makes a generator of this NPC.
Definition: lvl_filedata.h:203
bool lvl_o
Level exit (entering into this warp will trigger exiting of level)
Definition: lvl_filedata.h:247
long smbx64_sp
Definition: lvl_filedata.h:178
Foreground-1 (over regular blocks, but under lava blocks and foreground NPC's)
Definition: lvl_filedata.h:166
PGESTRING layer
Name of a parent layer. Default value is "Default".
Definition: lvl_filedata.h:150
unsigned int music_id
ID of default music in this section (starts from 1, 0 is silence)
Definition: lvl_filedata.h:46
int idirect
Direction of entrance point: [3] down, [1] up, [2] left, [4] right (not same as exit!) ...
Definition: lvl_filedata.h:241
Use config default Z-Mode (which defined in the lvl_bgo.ini)
Definition: lvl_filedata.h:164
long h
Definition: lvl_filedata.h:103
Level data structure. Contains all available settings and element lists on the level.
Definition: lvl_filedata.h:396
bool locked
Are all members of this layer are locked for modifying?
Definition: lvl_filedata.h:295
bool ctrl_jump
Hold "Jump" key controllers.
Definition: lvl_filedata.h:357
int id
ID of section (starts from 0)
Definition: lvl_filedata.h:36
int direct
Initial direction of NPC (-1 left, 1 right, 0 left or right randomly)
Definition: lvl_filedata.h:199
bool ctrl_left
Hold "Left" key controllers.
Definition: lvl_filedata.h:353
bool ctrl_down
Hold "Down" key controllers.
Definition: lvl_filedata.h:351
PGESTRING msg
Talking message. If not empty, NPC will be talkable.
Definition: lvl_filedata.h:207
bool underwater
Sets default physical environment of this section is - water.
Definition: lvl_filedata.h:60
PGESTRINGList layers_show
List of layers to show.
Definition: lvl_filedata.h:337
unsigned long id
ID of block type defined in the lvl_blocks.ini.
Definition: lvl_filedata.h:108
long y
Y position of Background Object.
Definition: lvl_filedata.h:146
bool nosmoke
Don't show smoke effect on show/hide/toggle layer visibility.
Definition: lvl_filedata.h:333
Contains additional helpful meda-data used by PGE Applications.
Definition: meta_filedata.h:81
long x
X position of physical environment zone.
Definition: lvl_filedata.h:271
long size_left
X-Position of left side of section.
Definition: lvl_filedata.h:42
long y
Y-position of player spawn point.
Definition: lvl_filedata.h:83
unsigned long id
ID of background object type defined in the lvl_bgo.ini.
Definition: lvl_filedata.h:148
double z_offset
Z-Offset relative to current of Z-value.
Definition: lvl_filedata.h:174
int stars
Total number of stars on the level.
Definition: lvl_filedata.h:402
Level specific Block entry structure. Defines preferences of each block.
Definition: lvl_filedata.h:95
bool playmusic
is music playing button pressed?
Definition: lvl_filedata.h:444
long x
X-position of player spawn point.
Definition: lvl_filedata.h:81
Level events specific settings set per each section.
Definition: lvl_filedata.h:307
unsigned int array_id
Array-ID is an unique key value identificates each unique block object. Re-counts on each file reload...
Definition: lvl_filedata.h:185
bool allownpc
Allows player to move through this warp carried NPC's.
Definition: lvl_filedata.h:255
bool wrap_h
Enables horisontal wrap.
Definition: lvl_filedata.h:50
long w
Width of physical environment zone.
Definition: lvl_filedata.h:274
unsigned int npc_array_id
Last used NPC's array ID.
Definition: lvl_filedata.h:425
long trigger_timer
Trigger another event after time in deci-seconds.
Definition: lvl_filedata.h:346
int generator_direct
Generator direction [1] up, [2] left, [3] down, [4] right.
Definition: lvl_filedata.h:204
long size_right
X-Position of right side of section.
Definition: lvl_filedata.h:44
unsigned int array_id
Array-ID is an unique key value identificates each unique block object. Re-counts on each file reload...
Definition: lvl_filedata.h:262
long npc_id
ID of the included NPC (0 - empty, <0 - number of coins, >0 - NPC-ID of included NPC) ...
Definition: lvl_filedata.h:110
PGELIST< LevelEvent_Sets > sets
List of section settings per each section to apply.
Definition: lvl_filedata.h:342
long music_id
Set new Music ID in this section (-1 - do nothing, -2 - reset to defaint, >=0 - set music ID) ...
Definition: lvl_filedata.h:309
PGESTRING lname
Target level filename (Exit from this leven and enter to target level)
Definition: lvl_filedata.h:244
unsigned int id
Defined ID of player.
Definition: lvl_filedata.h:79
Level specific Physical Environment entry structure. Defines preferences of each Physical Environment...
Definition: lvl_filedata.h:269
long PositionY
Recent camera Y position.
Definition: lvl_filedata.h:70
unsigned int doors_array_id
Last used warp's array ID.
Definition: lvl_filedata.h:427
bool invisible
Block is invizible until player will impacted to it at bottom side.
Definition: lvl_filedata.h:112
bool friendly
NPC will not communicate and will not collide with playable characters.
Definition: lvl_filedata.h:208
PGESTRING LevelName
Understandable name of the level.
Definition: lvl_filedata.h:413
bool slippery
Block has a splippery surface.
Definition: lvl_filedata.h:114
long warpto
Warp Array-ID in the target level (if 0 - enter into target level at spawn point) ...
Definition: lvl_filedata.h:245
unsigned long id
ID of NPC type defined in the lvl_npc.ini.
Definition: lvl_filedata.h:200
long position_top
Change Y position of top section boundary.
Definition: lvl_filedata.h:313
PGESTRING name
Name of event.
Definition: lvl_filedata.h:324
PGELIST< LevelBGO > bgo
Array of all presented Background objects in this level.
Definition: lvl_filedata.h:422
PGESTRING event_emptylayer
Trigger event on destroying of this block and at sametime parent layer has no more other objects...
Definition: lvl_filedata.h:215
Level specific Classic Event Entry structure.
Definition: lvl_filedata.h:321
long w
Definition: lvl_filedata.h:106
float layer_speed_x
Set layer X motion in pixels per 1/65.
Definition: lvl_filedata.h:376
unsigned int index
Recent array index where block was saved (used to speed-up settings synchronization) ...
Definition: lvl_filedata.h:131
int direction
Initial direction of playable character (-1 is left, 1 is right, 0 is right by default) ...
Definition: lvl_filedata.h:89
PGESTRING filename
Recent file name since file was opened.
Definition: lvl_filedata.h:453
int type
Warp type: [1] pipe, [2] door, [0] instant.
Definition: lvl_filedata.h:243
PGESTRING layer
Name of a parent layer. Default value is "Default".
Definition: lvl_filedata.h:211
bool ctrl_altrun
Hold "Alt-run" key controllers.
Definition: lvl_filedata.h:363
bool ReadFileValid
Is file parsed correctly, false if some error is occouped.
Definition: lvl_filedata.h:404
Level specific Player spawn point entry definition structure.
Definition: lvl_filedata.h:76
long scroll_section
Setup autoscrool for section ID (starts from 0)
Definition: lvl_filedata.h:384
bool locked
Player need to carry a key to be allowed to enter into this warp.
Definition: lvl_filedata.h:256
unsigned int array_id
Array-ID is an unique key value identificates each unique block object. Re-counts on each file reload...
Definition: lvl_filedata.h:283
MetaData metaData
Meta-data: Position bookmarks, Auto-Script configuration, etc., Crash meta-data, etc.
Definition: lvl_filedata.h:436
long ix
X position of Entrance point.
Definition: lvl_filedata.h:233
PGESTRING ERROR_info
Error messsage.
Definition: lvl_filedata.h:406
long x
X position of Background Object.
Definition: lvl_filedata.h:144
PGESTRING event_talk
Trigger event on player's attempt to talk with this NPC.
Definition: lvl_filedata.h:214
long end_game
Trigger end of game and go to credits screen if not zero.
Definition: lvl_filedata.h:330
PGELIST< LevelLayer > layers
Array of all presented layers in this level.
Definition: lvl_filedata.h:430
Foreground-2 (over everything)
Definition: lvl_filedata.h:168
unsigned int layers_array_id
Last used Layer's array ID.
Definition: lvl_filedata.h:431
long sound_id
Sound ID to play if not zero.
Definition: lvl_filedata.h:328
PGESTRING msg
Message box to spawn if not empty.
Definition: lvl_filedata.h:326
long PositionX
Recent camera X position.
Definition: lvl_filedata.h:68
bool ctrl_run
Hold "Run" key controllers.
Definition: lvl_filedata.h:361
PGESTRING name
Name of layer.
Definition: lvl_filedata.h:293
Contains internal settings and references for PGE File Library.
PGESTRING attach_layer
Attach layer to this NPC. All memberes of this layer are will follow to motion of this NPC...
Definition: lvl_filedata.h:216
PGESTRING trigger
Trigger another event if not empty.
Definition: lvl_filedata.h:344
int generator_period
Generator's delay between each shoot in deci-seconds.
Definition: lvl_filedata.h:206
PGELIST< LevelPhysEnv > physez
Array of all presented Physical Environment Zones in this level.
Definition: lvl_filedata.h:428
#define PGESTRINGList
A macro which equal to std::vector if PGE File Library built in the STL mode and equal t...
Definition: pge_file_lib_globs.h:104