diff --git a/assets.h b/assets.h index ed417b8..8380ab5 100644 --- a/assets.h +++ b/assets.h @@ -2,6 +2,8 @@ #define _LCR_ASSETS_H /** + Assets embedded in source code. + NOTES: - All images are 64x64, stored in an indexed mode (8bits pery pixel), the image starts with a 256 color palette in RGB565 format (i.e. the palette @@ -13,7 +15,7 @@ the sky. */ -#include +#include "general.h" #include "map.h" static const char *LCR_texts[] = diff --git a/debug.h b/debug.h deleted file mode 100644 index 783143b..0000000 --- a/debug.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _LCR_DEBUG_H -#define _LCR_DEBUG_H - -#include "map.h" -#include - -void LCR_debugPrintCurrentMap() -{ - puts("current map:"); - - for (int i = 0; i < LCR_currentMap.blockCount; ++i) - { - uint8_t x, y, z; - - LCR_mapBlockGetCoords(LCR_currentMap.blocks + i * 4,&x,&y,&z); - - printf(" block %d: type %x, coord %d (%d %d %d)\n",i, - LCR_currentMap.blocks[i * 4],LCR_mapBlockGetCoordNumber( - LCR_currentMap.blocks + i * 4),x,y,z); - } -} - -#endif diff --git a/frontend_sdl.c b/frontend_sdl.c index 8fa4129..a536601 100644 --- a/frontend_sdl.c +++ b/frontend_sdl.c @@ -4,7 +4,6 @@ #define LCR_SETTING_LOG_LEVEL 2 #include "game.h" -#include "debug.h" SDL_Window *window; SDL_Renderer *renderer; diff --git a/game.h b/game.h index 5da8d1f..2a42d54 100644 --- a/game.h +++ b/game.h @@ -1,3 +1,6 @@ +#ifndef _LCR_GAME_H +#define _LCR_GAME_H + /** game: this file implements the backend of a complete, actually playable game, and is meant to be included and used by specific frontends (which @@ -42,9 +45,6 @@ the map module) etc. */ -#ifndef _LCR_GAME_H -#define _LCR_GAME_H - #define LCR_KEY_UP 0x00 #define LCR_KEY_RIGHT 0x01 #define LCR_KEY_DOWN 0x02 @@ -195,9 +195,8 @@ void LCR_drawPixelXYUnsafe(unsigned int x, unsigned int y, uint16_t color); static inline void LCR_drawPixelXYSafe(unsigned int x, unsigned int y, uint_fast16_t color); -#include "constants.h" +#include "general.h" #include "racing.h" -#include "settings.h" #include "audio.h" #include "assets.h" #include "renderer.h" diff --git a/constants.h b/general.h similarity index 80% rename from constants.h rename to general.h index 0cdd2ca..8cce340 100644 --- a/constants.h +++ b/general.h @@ -1,8 +1,15 @@ -#ifndef _LCR_CONSTANTS_H -#define _LCR_CONSTANTS_H +#ifndef _LCR_GENERAL_H +#define _LCR_GENERAL_H +/** + General resources for all modules. +*/ + +#include #include "settings.h" +// constants (not supposed to be changed, doing so may break stuff): + #define LCR_EFFECTIVE_RESOLUTION_X \ (LCR_SETTING_RESOLUTION_X / LCR_SETTING_RESOLUTION_SUBDIVIDE) @@ -41,4 +48,9 @@ #define LCR_MENU_TABS 4 #define LCR_MENU_STRING_SIZE 16 -#endif +char _LCR_hexDigit(int i) +{ + return i < 10 ? '0' + i : ('a' - 10 + i); +} + +#endif // guard diff --git a/map.h b/map.h index f656ce3..7387150 100644 --- a/map.h +++ b/map.h @@ -1,10 +1,6 @@ #ifndef _LCR_MAP #define _LCR_MAP -#include -#include "constants.h" -#include "settings.h" - /** The map (track) module for Licar. @@ -56,6 +52,8 @@ - last if C7 is set, the block is flipped vertically */ +#include "general.h" + #define LCR_MAP_NAME_MAX_LEN 15 /**< Maximum map name length (without terminating zero. */ #define LCR_BLOCK_START_CHAR ':' diff --git a/racing.h b/racing.h index 7bbc479..4ee468b 100644 --- a/racing.h +++ b/racing.h @@ -1,3 +1,6 @@ +#ifndef _LCR_RACING_H +#define _LCR_RACING_H + /** Racing module: implements the racing physics and logic as well as replays and other related things. @@ -19,9 +22,6 @@ string will be ignored. */ -#ifndef _LCR_RACING_H -#define _LCR_RACING_H - typedef int32_t LCR_GameUnit; ///< abstract game unit #define LCR_GAME_UNIT 1024 ///< length of map square in LCR_GameUnits @@ -41,6 +41,7 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit #define TPE_RESHAPE_TENSION_LIMIT 3 #define TPE_RESHAPE_ITERATIONS 8 +#include "general.h" #include "map.h" #include "tinyphysicsengine.h" @@ -145,11 +146,6 @@ void LCR_replayInitPlaying(void) LCR_replay.currentFrame = 0; } -char _LCR_hexDigit(int i) -{ - return i < 10 ? '0' + i : ('a' - 10 + i); -} - /** Outputs current replay using provided character printing function. The string will be zero terminated. diff --git a/renderer.h b/renderer.h index a945356..311f830 100644 --- a/renderer.h +++ b/renderer.h @@ -1,3 +1,6 @@ +#ifndef _LCR_RENDERER_H +#define _LCR_RENDERER_H + /** Renderer: implements 3D and 2D rendering. @@ -12,9 +15,6 @@ for far away areas with "something" we just draw some 2D rectangles. */ -#ifndef _LCR_RENDERER_H -#define _LCR_RENDERER_H - #define S3L_RESOLUTION_X LCR_SETTING_RESOLUTION_X #define S3L_RESOLUTION_Y LCR_SETTING_RESOLUTION_Y #define S3L_PIXEL_FUNCTION _LCR_pixelFunc3D diff --git a/settings.h b/settings.h index d14b282..6f1c42f 100644 --- a/settings.h +++ b/settings.h @@ -1,6 +1,11 @@ #ifndef _LCR_SETTINGS_H #define _LCR_SETTINGS_H +/** + Settings file, values here may be changed by the user or overriden by frontend + before compilation. +*/ + #ifndef LCR_SETTING_RESOLUTION_X #define LCR_SETTING_RESOLUTION_X 1024 #endif