78 lines
1.9 KiB
C++
78 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include "globals.h"
|
|
|
|
#define TILE_SIZE 32
|
|
#define TILE_X 16
|
|
#define TILE_Y 8
|
|
#define TILE_Z 7
|
|
|
|
#define MAX_HABITACIONS 256
|
|
#define MAX_ACTORS 15
|
|
#define MAX_X 12
|
|
#define MAX_Y 12
|
|
#define MAX_Z 10
|
|
|
|
#define GFX_TILES 0
|
|
#define GFX_SPRITES 1
|
|
#define GFX_FONDO 2
|
|
|
|
#define FLAG_MATA 0x01
|
|
#define FLAG_SOMBRA 0x02
|
|
#define FLAG_ANIMAT 0x04
|
|
#define FLAG_NODEFINIT 0x08
|
|
#define FLAG_MOVILXP 0x10
|
|
#define FLAG_MOVILXN 0x20
|
|
#define FLAG_MOVILYP 0x40
|
|
#define FLAG_MOVILYN 0x80
|
|
|
|
// TMapa = array[0..MAX_X-1,0..MAX_Y-1,0..MAX_Z-1] of byte;
|
|
|
|
struct TActor {
|
|
uint8_t x, y, z;
|
|
uint8_t Tipus;
|
|
};
|
|
|
|
// TActors = array[0..MAX_ACTORS-1] of TActor;
|
|
|
|
struct THabitacio {
|
|
std::string Nom;
|
|
uint8_t Zona;
|
|
uint8_t Mapa[MAX_X][MAX_Y][MAX_Z];
|
|
uint8_t Flags[MAX_X][MAX_Y][MAX_Z];
|
|
std::string BMP;
|
|
uint8_t Portes[6];
|
|
TActor Actors[MAX_ACTORS];
|
|
};
|
|
|
|
// THabitacions = array[0..MAX_HABITACIONS-1] of THabitacio;
|
|
|
|
class THab {
|
|
private:
|
|
//VGA : TDXDraw;
|
|
//Grafx : TDXImageList;
|
|
std::string FitxerMapa;
|
|
THabitacio Habitacions[MAX_HABITACIONS];
|
|
uint8_t HabitacioActual;
|
|
TSpriteInfo Sprites[MAX_ACTORS];
|
|
TSpriteInfo Sombres[MAX_ACTORS];
|
|
uint8_t Animacio;
|
|
|
|
void LoadMap();
|
|
|
|
public:
|
|
bool Jump;
|
|
|
|
THab(std::string p_FitxerMapa);
|
|
~THab();
|
|
|
|
void PintaMapa();
|
|
void BeginUpdate();
|
|
void EndUpdate();
|
|
void EnviaInfoSprite(uint8_t num, TSpriteInfo Info);
|
|
bool PucPasar(uint8_t x, uint8_t y, uint8_t z);
|
|
uint8_t DonamElsFlags(uint8_t x, uint8_t y, uint8_t z);
|
|
uint8_t GetHabitacioActual();
|
|
TActor *GetActorsInfo();
|
|
};
|