breakhack/src/roommatrix.h

83 lines
2.1 KiB
C
Raw Normal View History

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/>.
*/
#ifndef ROOMMATRIX_H_
#define ROOMMATRIX_H_
#include <stdbool.h>
#include "defines.h"
#include "position.h"
2017-12-10 19:51:24 +01:00
#include "camera.h"
#include "map_room_modifiers.h"
#include "input.h"
typedef struct Sprite Sprite;
typedef struct Map_t Map;
typedef struct Monster Monster;
typedef struct Player Player;
typedef struct Item_t Item;
typedef struct Node LinkedList;
typedef struct Trap Trap;
2018-08-13 13:11:32 +02:00
typedef struct Object Object;
struct UpdateData;
2018-08-13 13:11:32 +02:00
typedef struct RoomSpace {
bool occupied;
bool lethal;
2017-12-10 19:51:24 +01:00
bool lightsource;
2018-08-13 13:11:32 +02:00
bool damaging;
int light;
Monster *monster;
Player *player;
Trap *trap;
LinkedList *items;
LinkedList *artifacts;
2018-08-13 13:11:32 +02:00
LinkedList *objects;
} RoomSpace;
typedef struct RoomMatrix_t {
RoomSpace spaces[MAP_ROOM_WIDTH][MAP_ROOM_HEIGHT];
Position roomPos;
Position playerRoomPos;
Position mousePos;
RoomModifierData *modifier;
} RoomMatrix;
RoomMatrix* roommatrix_create(void);
void roommatrix_update(struct UpdateData*);
void roommatrix_populate_from_map(RoomMatrix*, Map*);
2017-12-10 19:51:24 +01:00
void roommatrix_add_lightsource(RoomMatrix*, Position*);
void roommatrix_build_lightmap(RoomMatrix*);
void roommatrix_render_mouse_square(RoomMatrix*, Camera*);
2017-12-10 19:51:24 +01:00
void roommatrix_render_lightmap(RoomMatrix*, Camera*);
#ifdef DEBUG
void roommatrix_render_debug(RoomMatrix*, Camera*);
#endif
void roommatrix_destroy(RoomMatrix*);
#endif // ROOMMATRIX_H_