- First commit
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Patman/*
|
||||
75
compress.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
struct actor_t
|
||||
{
|
||||
uint8_t x, y, z, t;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *f;
|
||||
f = fopen("data/Cuina.map", "rb");
|
||||
for (int i=0; i<256; ++i) {
|
||||
bool ignore = false;
|
||||
char buffer[33]; int size;
|
||||
|
||||
fread(buffer, 33, 1, f); size = buffer[0]; for (int j=0; j<size; ++j) buffer[j] = buffer[j+1]; buffer[size]=0;
|
||||
if (strcmp(buffer, "sense_nom")==0) ignore = true;
|
||||
if (!ignore) printf("Nom: %s", buffer);
|
||||
|
||||
int zona = fgetc(f);
|
||||
|
||||
uint8_t mapa[12][12][10]; fread(mapa, 12*12*10, 1, f);
|
||||
if (!ignore) {
|
||||
int zeros=0; for (int z=0;z<10;++z) for (int y=0;y<12;++y) for (int x=0;x<12;++x) if (mapa[x][y][z]!=0) zeros++;
|
||||
printf(" Size: %i\n", zeros+180);
|
||||
}
|
||||
|
||||
/*bool on_zeros = false;
|
||||
int zero_count = 0;
|
||||
int total_size = 0;
|
||||
if (!ignore) {
|
||||
for (int z=0;z<10;++z) for (int y=0;y<12;++y) for (int x=0;x<12;++x) {
|
||||
if (mapa[x][y][z]==0) {
|
||||
if (on_zeros) {
|
||||
zero_count++;
|
||||
if (zero_count==255) {
|
||||
on_zeros=false;
|
||||
total_size++;
|
||||
}
|
||||
} else {
|
||||
on_zeros=true;
|
||||
zero_count=0;
|
||||
total_size++;
|
||||
}
|
||||
} else {
|
||||
if (on_zeros) {
|
||||
on_zeros=false;
|
||||
total_size+=2;
|
||||
} else {
|
||||
total_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(" Size: %i\n", total_size);
|
||||
}*/
|
||||
|
||||
uint8_t flags[12][12][10]; fread(flags, 12*12*10, 1, f);
|
||||
/*if (!ignore) {
|
||||
int zeros=0; for (int z=0;z<10;++z) for (int y=0;y<12;++y) for (int x=0;x<12;++x) if (flags[x][y][z]!=0) zeros++;
|
||||
printf("Zeros: %i\n", zeros);
|
||||
}*/
|
||||
|
||||
fread(buffer, 33, 1, f); size = buffer[0]; for (int j=0; j<size; ++j) buffer[j] = buffer[j+1]; buffer[size]=0;
|
||||
|
||||
uint8_t portes[6];
|
||||
fread(portes, 6, 1, f);
|
||||
actor_t actors[15];
|
||||
fread(actors, sizeof(actor_t)*15, 1, f);
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
data/Aseos 02.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
data/Aseos.map
Normal file
BIN
data/Catacumbes 01.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
data/Cuina 01.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
data/Cuina 02.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
data/Cuina 03.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
data/Cuina 04.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
data/Cuina 05.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
data/Cuina.map
Normal file
BIN
data/Desvan 01.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
data/Desvan 02.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
data/Dormitori 01.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
data/Dormitori 02.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
data/Dormitori 03.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/Dormitori.map
Normal file
BIN
data/Fondo.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
data/Hall 01.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
data/Hall.map
Normal file
BIN
data/Pati 01.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
data/Pati 011.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
data/Pati 012.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
data/Pati01.map
Normal file
BIN
data/Sotanos 01.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
data/Sotanos-Catacumbes.map
Normal file
BIN
data/Sprites.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
data/Tiles.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
data/Torre 01.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
data/Torre-Desvan.map
Normal file
BIN
data/sprites.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
8
globals.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
static bool EXIT_SIGNAL;
|
||||
static std::string PATH;
|
||||
static std::string NOM_MAPA;
|
||||
static int START_ROOM;
|
||||
static int FRAMES_ACTORS[22];
|
||||
static TSpriteInfo LAST_POS;
|
||||
49
globals.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#define NUM_VERSIO '0257'
|
||||
// Orientacions
|
||||
#define oXB 0 // Baix-Esquerra
|
||||
#define oYB 1 // Baix-Dreta
|
||||
#define oXA 2 // Dalt-Dreta
|
||||
#define oYA 3 // Dalt-Esquerra
|
||||
|
||||
#define START_X 5
|
||||
#define START_Y 5
|
||||
#define START_Z 1
|
||||
/*
|
||||
#define NOM_MAPA 'Hall01.map'
|
||||
#define START_ROOM 8
|
||||
#define START_X 8
|
||||
#define START_Y 5
|
||||
#define START_Z 1
|
||||
*/
|
||||
|
||||
// Tecles
|
||||
#define TECLA_AMUNT 0x01
|
||||
#define TECLA_AVALL 0x02
|
||||
#define TECLA_ESQUERRA 0x04
|
||||
#define TECLA_DRETA 0x08
|
||||
#define TECLA_SALT 0x10
|
||||
|
||||
#define TECLA_WALK 0x0F
|
||||
|
||||
//PSpriteInfo = ^TSpriteInfo;
|
||||
struct TSpriteInfo {
|
||||
uint8_t TileX, TileY, TileZ;
|
||||
uint8_t TPixX, TPixY, TPixZ;
|
||||
int X,Y;
|
||||
int Frame;
|
||||
int tipus;
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern bool EXIT_SIGNAL;
|
||||
extern std::string PATH;
|
||||
extern std::string NOM_MAPA;
|
||||
extern int START_ROOM;
|
||||
extern int FRAMES_ACTORS[22];
|
||||
extern TSpriteInfo LAST_POS;
|
||||
301
habitacions.cpp
Normal file
@@ -0,0 +1,301 @@
|
||||
#include "habitacions.h"
|
||||
|
||||
//uses
|
||||
// uMain;
|
||||
|
||||
// THab
|
||||
|
||||
// THab - Constructor
|
||||
|
||||
THab::THab(std::string p_FitxerMapa)
|
||||
{
|
||||
Jump = false;
|
||||
//VGA = p_VGA;
|
||||
//Grafx = p_Grafx;
|
||||
FitxerMapa = p_FitxerMapa;
|
||||
HabitacioActual = START_ROOM;
|
||||
Animacio = 0;
|
||||
LoadMap;
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
}
|
||||
|
||||
|
||||
// THab - Destructor
|
||||
|
||||
THab::~THab()
|
||||
{
|
||||
// pumba pumba pinyau catacroc!!!
|
||||
};
|
||||
|
||||
|
||||
// { THab - Private }
|
||||
|
||||
void THab::LoadMap()
|
||||
{
|
||||
FILE *f;
|
||||
f = fopen(FitxerMapa.c_str(), "rb");
|
||||
for (int i=0; i<MAX_HABITACIONS; ++i) {
|
||||
char buffer[33];
|
||||
fread(buffer, 33, 1, f);
|
||||
for (int j=0; j<buffer[0]; ++j) Habitacions[i].Nom[j] = buffer[i+1];
|
||||
Habitacions[i].Zona = fgetc(f);
|
||||
fread(Habitacions[i].Mapa, MAX_X*MAX_Y*MAX_Z, 1, f);
|
||||
fread(Habitacions[i].Flags, MAX_X*MAX_Y*MAX_Z, 1, f);
|
||||
fread(buffer, 33, 1, f);
|
||||
for (int j=0; j<buffer[0]; ++j) Habitacions[i].BMP[j] = buffer[i+1];
|
||||
fread(Habitacions[i].Portes, 6, 1, f);
|
||||
fread(Habitacions[i].Actors, sizeof(TActor)*MAX_ACTORS, 1, f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
//{ THab - Public }
|
||||
|
||||
void THab::PintaMapa()
|
||||
{
|
||||
Llums : array[0..10] of TActor;
|
||||
|
||||
uint8_t NumLlums = 0;
|
||||
|
||||
// Pintem el fondo
|
||||
Grafx.Items[GFX_FONDO].Draw(VGA.Surface,0,0,0);
|
||||
|
||||
// Comencem els bucles locos
|
||||
for (int c_i=0; c_i<MAX_X; c_i++)
|
||||
{
|
||||
int c_x = c_i; int c_y = 0;
|
||||
do {
|
||||
for (int c_z=0; c_z<MAX_Z; c_z++)
|
||||
{
|
||||
int x = (144)-(c_x << 4)+(c_y << 4);
|
||||
int y = (42) +(c_x << 3)+(c_y << 3) - (c_z*TILE_Z);
|
||||
int z = (Habitacions[HabitacioActual].Flags[c_x][c_y][c_z] & FLAG_ANIMAT == FLAG_ANIMAT) ? Animacio : 0;
|
||||
if (Habitacions[HabitacioActual].Mapa[c_x][c_y][c_z] > 2)
|
||||
Grafx.Items[GFX_TILES].Draw(VGA.Surface,x,y,Habitacions[HabitacioActual].Mapa[c_x][c_y][c_z]+z);
|
||||
|
||||
for (int ActorPointer=0; ActorPointer<MAX_ACTORS; ActorPointer++)
|
||||
{
|
||||
if ((Sombres[ActorPointer].TileX == c_x) &&
|
||||
(Sombres[ActorPointer].TileY == c_y) &&
|
||||
(Sombres[ActorPointer].TileZ == c_z) )
|
||||
Grafx.Items[GFX_SPRITES].DrawAlpha(VGA.Surface,Rect(Sombres[ActorPointer].X-2,Sombres[ActorPointer].Y-4,Sombres[ActorPointer].X+30,Sombres[ActorPointer].Y+28),Sombres[ActorPointer].Frame,100);
|
||||
|
||||
if (Sprites[ActorPointer].TileX = c_x) and
|
||||
(Sprites[ActorPointer].TileY = c_y) and
|
||||
(Sprites[ActorPointer].TileZ = c_z) then
|
||||
{
|
||||
Grafx.Items[GFX_SPRITES].Draw(VGA.Surface,Sprites[ActorPointer].X,Sprites[ActorPointer].Y-4,Sprites[ActorPointer].Frame+FRAMES_ACTORS[Sprites[ActorPointer].Tipus]);
|
||||
if (Habitacions[HabitacioActual].Flags[c_x,c_y,c_z-1] and FLAG_SOMBRA = FLAG_SOMBRA) then
|
||||
Grafx.Items[GFX_SPRITES].DrawSub(VGA.Surface,Rect(Sprites[ActorPointer].X,Sprites[ActorPointer].Y-4,Sprites[ActorPointer].X+32,Sprites[ActorPointer].Y+28),Sprites[ActorPointer].Frame+FRAMES_ACTORS[Sprites[ActorPointer].Tipus],150);
|
||||
};
|
||||
};
|
||||
{ If (Habitacions[HabitacioActual].Mapa[c_x,c_y,c_z] = 55) then
|
||||
{
|
||||
Llums[NumLlums].x = x; Llums[NumLlums].y = y;
|
||||
inc(NumLlums);
|
||||
};}
|
||||
};
|
||||
dec(c_x); inc(c_y);
|
||||
} while ( (c_x != -1) || (c_y != c_i+1) );
|
||||
};
|
||||
|
||||
// Comencem els bucles locos
|
||||
For c_i = 1 to MAX_Y-1 do
|
||||
{
|
||||
c_x = MAX_X-1; c_y = c_i;
|
||||
repeat
|
||||
For c_z = 0 to MAX_Z-1 do
|
||||
{
|
||||
X = (144)-(c_x shl 4)+(c_y shl 4);
|
||||
Y = (42) +(c_x shl 3)+(c_y shl 3) - (c_z*TILE_Z);
|
||||
if (Habitacions[HabitacioActual].Flags[c_x,c_y,c_z] and FLAG_ANIMAT = FLAG_ANIMAT) then z = Animacio else z = 0;
|
||||
if (Habitacions[HabitacioActual].Mapa[c_x,c_y,c_z] > 2) then
|
||||
Grafx.Items[GFX_TILES].Draw(VGA.Surface,x,y,Habitacions[HabitacioActual].Mapa[c_x,c_y,c_z]+z);
|
||||
|
||||
for ActorPointer = 0 to MAX_ACTORS do
|
||||
{
|
||||
if (Sombres[ActorPointer].TileX = c_x) and
|
||||
(Sombres[ActorPointer].TileY = c_y) and
|
||||
(Sombres[ActorPointer].TileZ = c_z) then
|
||||
Grafx.Items[GFX_SPRITES].DrawAlpha(VGA.Surface,Rect(Sombres[ActorPointer].X-2,Sombres[ActorPointer].Y-4,Sombres[ActorPointer].X+30,Sombres[ActorPointer].Y+28),Sombres[ActorPointer].Frame,100);
|
||||
|
||||
if (Sprites[ActorPointer].TileX = c_x) and
|
||||
(Sprites[ActorPointer].TileY = c_y) and
|
||||
(Sprites[ActorPointer].TileZ = c_z) then
|
||||
{
|
||||
Grafx.Items[GFX_SPRITES].Draw(VGA.Surface,Sprites[ActorPointer].X,Sprites[ActorPointer].Y-4,Sprites[ActorPointer].Frame+FRAMES_ACTORS[Sprites[ActorPointer].Tipus]);
|
||||
if (Habitacions[HabitacioActual].Flags[c_x,c_y,c_z-1] and FLAG_SOMBRA = FLAG_SOMBRA) then
|
||||
Grafx.Items[GFX_SPRITES].DrawSub(VGA.Surface,Rect(Sprites[ActorPointer].X,Sprites[ActorPointer].Y-4,Sprites[ActorPointer].X+32,Sprites[ActorPointer].Y+28),Sprites[ActorPointer].Frame+FRAMES_ACTORS[Sprites[ActorPointer].Tipus],150);
|
||||
};
|
||||
};
|
||||
|
||||
{ If (Habitacions[HabitacioActual].Mapa[c_x,c_y,c_z] = 55) then
|
||||
{
|
||||
Llums[NumLlums].x = x; Llums[NumLlums].y = y;
|
||||
inc(NumLlums);
|
||||
};}
|
||||
};
|
||||
dec(c_x); inc(c_y);
|
||||
until (c_x = c_i-1) and (c_y = MAX_Y);
|
||||
};
|
||||
|
||||
// if NumLlums > 0 then For i = 0 to NumLlums-1 do
|
||||
// Grafx.Items[GFX_SPRITES].DrawAdd(VGA.Surface,Rect(Llums[i].x,Llums[i].y-8,Llums[i].x+32,Llums[i].y+24),17,150);
|
||||
|
||||
try
|
||||
VGA.Surface.Canvas.Brush.Style = bsClear;
|
||||
VGA.Surface.Canvas.Font.Color = $FFFFFF;
|
||||
// VGA.Surface.Canvas.TextOut(20,10,inttostr(Sprites[0].TileX)+','+inttostr(Sprites[0].TileY)+','+inttostr(Sprites[0].TileZ));
|
||||
// VGA.Surface.Canvas.TextOut(20,20,inttostr(Sprites[0].TPixX)+','+inttostr(Sprites[0].TPixY)+','+inttostr(Sprites[0].TPixZ));
|
||||
VGA.Surface.Canvas.TextOut(20,10,inttostr(Form1.PatMan.GetInfo.TileX)+','+inttostr(Form1.PatMan.GetInfo.TileY)+','+inttostr(Form1.PatMan.GetInfo.TileZ));
|
||||
VGA.Surface.Canvas.TextOut(20,20,inttostr(Form1.PatMan.GetInfo.TPixX)+','+inttostr(Form1.PatMan.GetInfo.TPixY)+','+inttostr(Form1.PatMan.GetInfo.TPixZ));
|
||||
VGA.Surface.Canvas.TextOut(20,220,'PatMan v'+NUM_VERSIO);
|
||||
finally
|
||||
VGA.Surface.Canvas.Release;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
void THab::{Update;
|
||||
var
|
||||
i : byte;
|
||||
{
|
||||
if Animacio = 3 then Animacio = 0 else inc(Animacio);
|
||||
for i = 0 to MAX_ACTORS do
|
||||
{
|
||||
Sprites[i].TileX = 20;
|
||||
Sprites[i].TileY = 20;
|
||||
Sprites[i].TileZ = 20;
|
||||
Sprites[i].X = 0;
|
||||
Sprites[i].Y = 0;
|
||||
Sprites[i].Frame = 0;
|
||||
};
|
||||
};
|
||||
|
||||
void THab::}Update;
|
||||
var
|
||||
temp : TSpriteInfo;
|
||||
punter : byte;
|
||||
menor : byte;
|
||||
i,j : byte;
|
||||
{
|
||||
// ordenem en Z
|
||||
for i = 0 to MAX_ACTORS do
|
||||
{
|
||||
punter = i; menor = i;
|
||||
for j = i to MAX_ACTORS do if Sprites[menor].TileZ > Sprites[j].TileZ then menor = j;
|
||||
temp = Sprites[punter]; Sprites[punter] = Sprites[menor]; Sprites[menor] = temp;
|
||||
};
|
||||
|
||||
// ordenem en X
|
||||
for i = 0 to MAX_ACTORS do
|
||||
{
|
||||
punter = i; menor = i;
|
||||
for j = i to MAX_ACTORS do if Sprites[menor].TileX > Sprites[j].TileX then menor = j;
|
||||
temp = Sprites[punter]; Sprites[punter] = Sprites[menor]; Sprites[menor] = temp;
|
||||
};
|
||||
|
||||
// ordenem en Y
|
||||
for i = 0 to MAX_ACTORS do
|
||||
{
|
||||
punter = i; menor = i;
|
||||
for j = i to MAX_ACTORS do if Sprites[menor].TileY > Sprites[j].TileY then menor = j;
|
||||
temp = Sprites[punter]; Sprites[punter] = Sprites[menor]; Sprites[menor] = temp;
|
||||
};
|
||||
Jump = false;
|
||||
|
||||
For i = 0 to MAX_ACTORS do
|
||||
{
|
||||
//i = 0;
|
||||
Sombres[i] = Sprites[i];
|
||||
Sombres[i].Frame = 16;
|
||||
while (Habitacions[HabitacioActual].Mapa[Sombres[i].TileX, Sombres[i].TileY, Sombres[i].TileZ-1] = 0) and not(Sombres[i].TileZ-1 = 0) and ((Form1.Actors.CheckMalos(Sombres[i])<14) or (Form1.Actors.CheckMalos(Sombres[i])>23)) do
|
||||
{
|
||||
dec(Sombres[i].TileZ); inc(Sombres[i].Y,7);
|
||||
};
|
||||
if Sombres[i].TPixZ mod 4 <> 0 then inc(Sombres[i].Y,4);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
void THab::EnviaInfoSprite(num: byte; Info: TSpriteInfo);
|
||||
{
|
||||
Sprites[num] = Info;
|
||||
if num <> 0 then exit;
|
||||
if (Sprites[0].TileX = 0) and (Habitacions[HabitacioActual].Portes[1] <> 0) then
|
||||
{
|
||||
HabitacioActual = Habitacions[HabitacioActual].Portes[1];
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
Jump = true;
|
||||
};
|
||||
if (Sprites[0].TileX = 11) and (Habitacions[HabitacioActual].Portes[4] <> 0) then
|
||||
{
|
||||
HabitacioActual = Habitacions[HabitacioActual].Portes[4];
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
Jump = true;
|
||||
};
|
||||
if (Sprites[0].TileY = 0) and (Habitacions[HabitacioActual].Portes[5] <> 0) then
|
||||
{
|
||||
HabitacioActual = Habitacions[HabitacioActual].Portes[5];
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
Jump = true;
|
||||
};
|
||||
if (Sprites[0].TileY = 11) and (Habitacions[HabitacioActual].Portes[2] <> 0) then
|
||||
{
|
||||
HabitacioActual = Habitacions[HabitacioActual].Portes[2];
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
Jump = true;
|
||||
};
|
||||
if (Sprites[0].TileZ = 0) and (Habitacions[HabitacioActual].Portes[3] <> 0) then
|
||||
{
|
||||
HabitacioActual = Habitacions[HabitacioActual].Portes[3];
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
Jump = true;
|
||||
};
|
||||
if (Sprites[0].TileZ = 9) and (Habitacions[HabitacioActual].Portes[0] <> 0) then
|
||||
{
|
||||
HabitacioActual = Habitacions[HabitacioActual].Portes[0];
|
||||
Grafx.Items[GFX_TILES].Picture.LoadFromFile(PATH+Habitacions[HabitacioActual].BMP);
|
||||
Grafx.Items[GFX_TILES].Restore;
|
||||
Jump = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
function THab::PucPasar(x, y, z: byte): boolean;
|
||||
{
|
||||
Result = true;
|
||||
if (Habitacions[HabitacioActual].Mapa[x,y,z] <> 0) or
|
||||
(Habitacions[HabitacioActual].Mapa[x,y,Min(z+1,9)] <> 0) or
|
||||
(Habitacions[HabitacioActual].Mapa[x,y,Min(z+2,9)] <> 0) or
|
||||
(Habitacions[HabitacioActual].Mapa[x,y,Min(z+3,9)] <> 0) then result = false;
|
||||
};
|
||||
|
||||
|
||||
function THab::DonamElsFlags(x, y, z: byte): byte;
|
||||
{
|
||||
result = Habitacions[HabitacioActual].Flags[x,y,z-1];
|
||||
};
|
||||
|
||||
|
||||
function THab::GetHabitacioActual: byte;
|
||||
{
|
||||
result = HabitacioActual;
|
||||
};
|
||||
|
||||
|
||||
function THab::GetActorsInfo : TActors;
|
||||
{
|
||||
result = Habitacions[HabitacioActual].Actors;
|
||||
};
|
||||
|
||||
|
||||
}.
|
||||
77
habitacions.h
Normal file
@@ -0,0 +1,77 @@
|
||||
#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();
|
||||
};
|
||||