2018-02-16 18:11:26 +01:00
|
|
|
/*
|
|
|
|
* BreakHack - A dungeone crawler RPG
|
|
|
|
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-12-05 15:03:20 +01:00
|
|
|
#ifndef DEFINES_H_
|
|
|
|
#define DEFINES_H_
|
|
|
|
|
2018-08-13 13:11:32 +02:00
|
|
|
#include <stdint.h>
|
2017-12-19 21:00:02 +01:00
|
|
|
#include "config.h"
|
2017-12-19 19:42:05 +01:00
|
|
|
|
2017-12-05 15:03:20 +01:00
|
|
|
/* Room/Map dimensions */
|
|
|
|
#define MAP_ROOM_WIDTH 16
|
2017-12-10 23:49:15 +01:00
|
|
|
#define MAP_ROOM_HEIGHT 12
|
2017-12-05 15:03:20 +01:00
|
|
|
|
|
|
|
#define MAP_V_ROOM_COUNT 10
|
|
|
|
#define MAP_H_ROOM_COUNT 10
|
|
|
|
|
2017-12-10 23:49:15 +01:00
|
|
|
#define TILE_DIMENSION 32
|
2018-01-23 12:14:44 +01:00
|
|
|
#define SPRITE_DIMENSION 16
|
2017-12-10 23:49:15 +01:00
|
|
|
|
|
|
|
/* Display stuff */
|
2018-08-21 15:44:12 +02:00
|
|
|
#define GAME_VIEW_WIDTH (MAP_ROOM_WIDTH * TILE_DIMENSION) // 16 * 32
|
|
|
|
#define GAME_VIEW_HEIGHT (MAP_ROOM_HEIGHT * TILE_DIMENSION) // 12 * 32
|
2018-01-23 12:14:44 +01:00
|
|
|
|
2018-02-22 15:42:43 +01:00
|
|
|
#define SKILL_BAR_WIDTH GAME_VIEW_WIDTH
|
|
|
|
#define SKILL_BAR_HEIGHT 32
|
|
|
|
|
2018-08-21 15:44:12 +02:00
|
|
|
#define RIGHT_GUI_WIDTH (10 * SPRITE_DIMENSION) // 10 * 16
|
|
|
|
#define MINIMAP_GUI_HEIGHT 128
|
|
|
|
#define STATS_GUI_HEIGHT (GAME_VIEW_HEIGHT + SKILL_BAR_HEIGHT - MINIMAP_GUI_HEIGHT)
|
2018-01-23 12:14:44 +01:00
|
|
|
|
2018-01-24 08:52:50 +01:00
|
|
|
#define BOTTOM_GUI_HEIGHT (10 * SPRITE_DIMENSION)
|
|
|
|
#define BOTTOM_GUI_WIDTH (GAME_VIEW_WIDTH + RIGHT_GUI_WIDTH)
|
2018-01-23 12:14:44 +01:00
|
|
|
|
2018-01-24 08:52:50 +01:00
|
|
|
#define SCREEN_WIDTH (GAME_VIEW_WIDTH + RIGHT_GUI_WIDTH)
|
2018-08-21 15:44:12 +02:00
|
|
|
#define SCREEN_HEIGHT (GAME_VIEW_HEIGHT + SKILL_BAR_HEIGHT + BOTTOM_GUI_HEIGHT)
|
2017-12-05 15:03:20 +01:00
|
|
|
|
2018-02-24 07:13:28 +01:00
|
|
|
/* Quality of life stuff */
|
2018-02-23 23:53:52 +01:00
|
|
|
#define DEFAULT_DIMENSION (Dimension) { 16, 16 }
|
|
|
|
#define GAME_DIMENSION (Dimension) { TILE_DIMENSION, TILE_DIMENSION }
|
2018-03-10 22:04:03 +01:00
|
|
|
#define CLIP16(x, y) (SDL_Rect) { x, y, 16, 16 }
|
|
|
|
#define CLIP32(x, y) (SDL_Rect) { x, y, 32, 32 }
|
2018-02-23 23:53:52 +01:00
|
|
|
|
2017-12-19 21:00:02 +01:00
|
|
|
/* Windows and compile crap */
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define strdup _strdup
|
|
|
|
#endif // _WIN32
|
|
|
|
|
|
|
|
#define UNUSED(x) (void)(x)
|
|
|
|
|
2018-03-23 22:03:34 +01:00
|
|
|
#define UNPACK_COLOR(color) color.r, color.g, color.b, color.a
|
2018-05-15 23:21:28 +02:00
|
|
|
#define C_WHITE (SDL_Color) { 255, 255, 255, 255 }
|
|
|
|
#define C_RED (SDL_Color) { 255, 0, 0, 255 }
|
|
|
|
#define C_GREEN (SDL_Color) { 0, 255, 0, 255 }
|
2018-08-16 14:09:54 +02:00
|
|
|
#define C_BLUE (SDL_Color) { 60, 134, 252, 255 }
|
2018-05-15 23:21:28 +02:00
|
|
|
#define C_YELLOW (SDL_Color) { 255, 255, 0, 255 }
|
|
|
|
#define C_BLACK (SDL_Color) { 0, 0, 0, 255 }
|
2018-08-08 14:46:59 +02:00
|
|
|
#define C_PURPLE (SDL_Color) { 137, 16, 229, 255 }
|
2018-03-23 22:03:34 +01:00
|
|
|
|
2018-08-05 14:38:58 +02:00
|
|
|
// MSVC seems to have min/max defined.
|
|
|
|
// Haven't looked into it further.
|
|
|
|
#ifndef _MSC_VER
|
2018-08-04 23:52:52 +02:00
|
|
|
#define max(a, b) (a > b ? a : b)
|
|
|
|
#define min(a, b) (a < b ? a : b)
|
2018-08-05 14:38:58 +02:00
|
|
|
#endif // _MSC_VER
|
2018-08-04 23:52:52 +02:00
|
|
|
|
2018-08-13 13:11:32 +02:00
|
|
|
typedef int8_t Sint8;
|
|
|
|
typedef uint8_t Uint8;
|
|
|
|
typedef int16_t Sint16;
|
|
|
|
typedef uint16_t Uint16;
|
|
|
|
typedef int32_t Sint32;
|
|
|
|
typedef uint32_t Uint32;
|
2018-08-29 14:03:18 +02:00
|
|
|
typedef int64_t Sint64;
|
|
|
|
typedef uint64_t Uint64;
|
2018-08-13 13:11:32 +02:00
|
|
|
|
2018-03-03 12:56:53 +01:00
|
|
|
typedef enum Direction_t {
|
|
|
|
UP, DOWN, LEFT, RIGHT
|
|
|
|
} Direction;
|
|
|
|
|
2018-10-26 18:37:50 +02:00
|
|
|
typedef enum GameMode {
|
|
|
|
REGULAR,
|
|
|
|
QUICK,
|
|
|
|
ARCADE
|
|
|
|
} GameMode;
|
|
|
|
|
2018-10-11 20:12:11 +02:00
|
|
|
#define CONTROLLER_BTN(xindex, mode) CLIP16(xindex, mode == 1 ? 0 : 16)
|
|
|
|
#define CONTROLLER_TRIGGER(xindex, mode) CLIP16(xindex + (mode == 1 ? 16 : 0), 32)
|
|
|
|
#define CONTROLLER_BUMPER(xindex, mode) CLIP16(xindex + (mode == 1 ? 16 : 0), 48)
|
|
|
|
#define CONTROLLER_OPT(xindex, mode) CLIP16(xindex + (mode == 2 ? 16 : 0), 64)
|
|
|
|
|
2017-12-05 15:03:20 +01:00
|
|
|
#endif // DEFINES_H_
|