54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
#include "gamestates.h"
|
|
#include "jgame.h"
|
|
#include <string>
|
|
|
|
namespace gamestate
|
|
{
|
|
namespace play
|
|
{
|
|
draw::surface *fondo = nullptr;
|
|
draw::surface *mapa = nullptr;
|
|
|
|
void carregarMapa();
|
|
|
|
void init()
|
|
{
|
|
// Carregar el fondo que toque i la seua paleta (que nomes usa els colors del 128 al 255)
|
|
char arxiuFondo[10] = "BKG00.GIF";
|
|
arxiuFondo[4] = (game::getConfig("fase") % 10) + 48;
|
|
fondo = draw::loadSurface(arxiuFondo, true);
|
|
|
|
// Carregar la paleta estandar
|
|
uint32_t *pal = draw::loadPalette("tiles.gif");
|
|
draw::setPalette(pal, 128);
|
|
|
|
// [TODO] Carreagar la resta de gifs que facen falta
|
|
//font1 = drawManager->LoadFont("fuente1.gif");
|
|
//cursor = drawManager->LoadFont("cursor.gif");
|
|
//puerta = drawManager->LoadFont("puerta.gif");
|
|
//marca = drawManager->LoadFont("marca.gif");
|
|
//menu = drawManager->LoadFont("menu.gif");
|
|
|
|
// [TODO] CREAR AIGUA PROCESSOR
|
|
// [TODO] CREAR MARCADOR PROCESSOR
|
|
|
|
carregarMapa();
|
|
}
|
|
|
|
void carregarMapa()
|
|
{
|
|
FILE *f = file::getFilePointer("mapes.txt");
|
|
|
|
const int fase = game::getConfig("fase");
|
|
int val;
|
|
do {
|
|
fscanf(f, "LEVEL %i", &val);
|
|
} while (val != fase);
|
|
|
|
int tileset=0;
|
|
fscanf(f, "tileset = %i", &tileset);
|
|
|
|
fclose(f);
|
|
}
|
|
}
|
|
} |