diff options
-rw-r--r-- | src/include/data_ini.h | 81 | ||||
-rw-r--r-- | src/include/parser.h | 23 | ||||
-rw-r--r-- | src/sandbox/sprite.c | 2 |
3 files changed, 105 insertions, 1 deletions
diff --git a/src/include/data_ini.h b/src/include/data_ini.h new file mode 100644 index 0000000..1adfcbe --- /dev/null +++ b/src/include/data_ini.h @@ -0,0 +1,81 @@ +#ifndef DATA_INI_H +#define DATA_INI_H + +#include <SDL_stdinc.h> + +// Original game level size is fixed to 1664x160. We want to display all the game with a x2 zoom +#define LEVEL_WIDTH 1664*2 +#define LEVEL_HEIGHT 160*2 + + +//////////////////////// LEVEL INI FILES //////////////////////// +struct skills { + int releaseRate, numLemmings, numToRescue, timeLimit; + int numClimbers, numFloaters, numBlockers, numBombers, numBuilders, numBashers, numMiners, numDiggers; +}; + +// Item should be an object, terrain or steel +struct levelItem { + int id, xpos, ypos; // Common to all types (but no id for steel) + int paintMode, ud; // Specific to objects + int modifier; // Specific to terrains + int width, height; // Specific to steels +}; + +struct levelIni { + struct skills initSkills; + int xPos; + char *style, *name; + int superLemming; + int objectCount, terrainCount, steelCount; + struct levelItem *objects, *terrains, *steels; +}; + + +//////////////////////// LEVELPACK INI FILES //////////////////////// +struct levelPackIni { + int maxFallDistance; + char *codeSeed; +}; + +//////////////////////// STYLE INI FILES //////////////////////// +// frames_, amin_, type_ sound_ quadruplet entries from style ini files +struct styleObjects { + int frames, anim, type, sound; +}; + +// Various keys at the beginning of style ini files +struct styleIni { + char *name; + uint32_t bgColor, debrisColor; + int tiles, particleColorCount, objectCount; + uint32_t *particleColor; + struct styleObjects *objects; +}; + +//////////////////////// MISC/LEMMING.INI FILE //////////////////////// +struct lemmingAnim { + int haveMask, haveImask; + + int lemmFrames, lemmDirs, lemmAnimType; + int maskFrames, maskDirs, maskStartFrame; + int imaskFrames, imaskDirs; + int xPos, yPos, posFlags; +}; + +struct miscIni { + int lemmingAnimCount; + struct lemmingAnim *lemmingAnims; +}; + +//////////////////////// GLOBAL INI FILES //////////////////////// +typedef struct { + struct styleIni style; + struct levelIni level; + struct levelPackIni levelPack; + struct miscIni misc; + int firstPass; +} gameIni_t; + + +#endif /*DATA_INI_H*/ diff --git a/src/include/parser.h b/src/include/parser.h new file mode 100644 index 0000000..5be656d --- /dev/null +++ b/src/include/parser.h @@ -0,0 +1,23 @@ +#ifndef PARSER_H +#define PARSER_H + +#include "data_ini.h" + +#define OUT_OF_BOUNDS "out of bounds" +#define CANNOT_BE_NEGATIVE "cannot be negative" +#define BAD_VALUE "bad value" + +#define MAX_OBJECT_TYPES 32 +#define MAX_OBJECT_FRAMES 64 +#define MAX_OBJECTS_COUNT 256 +#define MAX_TERRAINS_COUNT 1024 +#define MAX_STEELS_COUNT 256 +#define MAX_LEMMTYPES_COUNT 256 +#define MAX_SOUNDS_COUNT 32 +#define MAX_NUMLEMMINGS 100 +#define STEEL_MAX_WIDTH 256 +#define STEEL_MAX_HEIGHT 256 + +int mpl_ini_parse(gameIni_t *gIni); + +#endif /*PARSER_H*/ diff --git a/src/sandbox/sprite.c b/src/sandbox/sprite.c index 0a35cb8..d624e3e 100644 --- a/src/sandbox/sprite.c +++ b/src/sandbox/sprite.c @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) { int mainloop_end=0; SDL_Rect win_pos = { .x=SDL_WINDOWPOS_UNDEFINED, .y=SDL_WINDOWPOS_UNDEFINED, .w=MPL_WINDOW_WIDTH, .h=MPL_WINDOW_HEIGHT }; - Uint32 init_flags = SDL_INIT_TIMER|SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_EVENTS; + Uint32 init_flags = SDL_INIT_TIMER|SDL_INIT_AUDIO|SDL_INIT_VIDEO;//|SDL_INIT_EVENTS; Uint32 win_flags = SDL_WINDOW_SHOWN; //|SDL_WINDOW_OPENGL; //Uint32 rend_flags = SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC; Uint32 rend_flags = SDL_RENDERER_ACCELERATED; |