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/>.
|
|
|
|
*/
|
2019-05-20 15:37:25 +02:00
|
|
|
#pragma once
|
2017-12-05 15:03:20 +01:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "defines.h"
|
2017-12-06 11:44:17 +01:00
|
|
|
#include "position.h"
|
2017-12-10 19:51:24 +01:00
|
|
|
#include "camera.h"
|
2018-03-15 16:30:41 +01:00
|
|
|
#include "map_room_modifiers.h"
|
2018-05-20 00:02:39 +02:00
|
|
|
#include "input.h"
|
2017-12-05 15:03:20 +01:00
|
|
|
|
2018-07-09 19:26:06 +02:00
|
|
|
typedef struct Sprite Sprite;
|
2017-12-05 15:03:20 +01:00
|
|
|
typedef struct Map_t Map;
|
2018-08-09 15:57:05 +02:00
|
|
|
typedef struct Monster Monster;
|
2018-08-08 00:14:24 +02:00
|
|
|
typedef struct Player Player;
|
2018-01-24 21:14:34 +01:00
|
|
|
typedef struct Item_t Item;
|
2018-01-29 13:48:44 +01:00
|
|
|
typedef struct Node LinkedList;
|
2018-08-06 00:28:23 +02:00
|
|
|
typedef struct Trap Trap;
|
2018-08-13 13:11:32 +02:00
|
|
|
typedef struct Object Object;
|
2018-10-14 22:20:54 +02:00
|
|
|
typedef struct MapTile_t MapTile;
|
2017-12-05 15:03:20 +01:00
|
|
|
|
2018-05-20 00:02:39 +02:00
|
|
|
struct UpdateData;
|
|
|
|
|
2018-08-13 13:11:32 +02:00
|
|
|
typedef struct RoomSpace {
|
2017-12-05 15:03:20 +01:00
|
|
|
bool occupied;
|
2018-03-25 23:30:26 +02:00
|
|
|
bool lethal;
|
2017-12-10 19:51:24 +01:00
|
|
|
bool lightsource;
|
2018-08-13 13:11:32 +02:00
|
|
|
bool damaging;
|
2018-08-03 10:45:54 +02:00
|
|
|
int light;
|
2018-10-14 22:20:54 +02:00
|
|
|
MapTile *tile;
|
2019-03-11 16:21:15 +01:00
|
|
|
MapTile *wall;
|
|
|
|
MapTile *door;
|
2018-10-15 09:35:05 +02:00
|
|
|
MapTile *decoration;
|
2018-01-24 21:14:34 +01:00
|
|
|
Monster *monster;
|
|
|
|
Player *player;
|
2018-08-06 00:28:23 +02:00
|
|
|
Trap *trap;
|
2018-01-29 13:48:44 +01:00
|
|
|
LinkedList *items;
|
2018-08-08 00:14:24 +02:00
|
|
|
LinkedList *artifacts;
|
2018-08-13 13:11:32 +02:00
|
|
|
LinkedList *objects;
|
2017-12-05 15:03:20 +01:00
|
|
|
} RoomSpace;
|
|
|
|
|
2018-03-15 16:30:41 +01:00
|
|
|
typedef struct RoomMatrix_t {
|
2017-12-05 15:03:20 +01:00
|
|
|
RoomSpace spaces[MAP_ROOM_WIDTH][MAP_ROOM_HEIGHT];
|
2017-12-06 11:44:17 +01:00
|
|
|
Position roomPos;
|
2017-12-18 09:59:01 +01:00
|
|
|
Position playerRoomPos;
|
2018-02-06 16:47:45 +01:00
|
|
|
Position mousePos;
|
2018-03-15 16:30:41 +01:00
|
|
|
RoomModifierData *modifier;
|
2017-12-05 15:03:20 +01:00
|
|
|
} RoomMatrix;
|
|
|
|
|
2017-12-19 21:00:02 +01:00
|
|
|
RoomMatrix* roommatrix_create(void);
|
2017-12-05 15:03:20 +01:00
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_update(struct UpdateData*);
|
2018-02-06 16:47:45 +01:00
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_populate_from_map(RoomMatrix*, Map*);
|
2017-12-05 15:03:20 +01:00
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_add_lightsource(RoomMatrix*, Position*);
|
2017-12-10 19:51:24 +01:00
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_build_lightmap(RoomMatrix*);
|
2017-12-10 19:51:24 +01:00
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_render_mouse_square(RoomMatrix*, Camera*);
|
2018-02-06 16:47:45 +01:00
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_render_lightmap(RoomMatrix*, Camera*);
|
|
|
|
|
|
|
|
RoomSpace*
|
|
|
|
roommatrix_get_space_for(RoomMatrix*, const Position *p);
|
2017-12-10 19:51:24 +01:00
|
|
|
|
2019-05-20 15:37:25 +02:00
|
|
|
Player *
|
|
|
|
roommatrix_get_player(RoomMatrix*);
|
|
|
|
|
2018-08-03 10:45:54 +02:00
|
|
|
#ifdef DEBUG
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_render_debug(RoomMatrix*, Camera*);
|
2018-08-03 10:45:54 +02:00
|
|
|
#endif
|
|
|
|
|
2018-09-10 22:27:26 +02:00
|
|
|
void
|
|
|
|
roommatrix_destroy(RoomMatrix*);
|