- Seguim amb l'implementació del modul de mapa i el gamestate_play
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "gamestates.h"
|
||||
#include "jgame.h"
|
||||
#include <string>
|
||||
#include "aux_font.h"
|
||||
#include "proc_mapa.h"
|
||||
|
||||
namespace gamestate
|
||||
{
|
||||
@@ -9,13 +11,18 @@ namespace gamestate
|
||||
draw::surface *fondo = nullptr;
|
||||
draw::surface *mapa = nullptr;
|
||||
|
||||
void carregarMapa();
|
||||
uint32_t arounderCount;
|
||||
uint32_t startTicks;
|
||||
|
||||
bool loop();
|
||||
void draw();
|
||||
|
||||
void init()
|
||||
{
|
||||
const int fase = game::getConfig("fase");
|
||||
// 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;
|
||||
arxiuFondo[4] = (fase % 10) + 48;
|
||||
fondo = draw::loadSurface(arxiuFondo, true);
|
||||
|
||||
// Carregar la paleta estandar
|
||||
@@ -23,32 +30,51 @@ namespace gamestate
|
||||
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();
|
||||
// [TODO] Crear el primer Arounder
|
||||
mapa::arounders::eixits++;
|
||||
// arounder_seleccionat = primerArounders
|
||||
|
||||
audio::loadMusic((fase+1) % 5 == 0 ? "mus6.ogg" : "mus4.mp3");
|
||||
audio::playMusic();
|
||||
|
||||
play::arounderCount = play::startTicks = game::getTicks();
|
||||
|
||||
draw::fadein();
|
||||
game::setState(gamestate::play::loop);
|
||||
}
|
||||
|
||||
void carregarMapa()
|
||||
bool loop()
|
||||
{
|
||||
FILE *f = file::getFilePointer("mapes.txt");
|
||||
play::draw();
|
||||
}
|
||||
|
||||
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);
|
||||
void draw()
|
||||
{
|
||||
draw::setSource(play::fondo);
|
||||
draw::draw();
|
||||
|
||||
fclose(f);
|
||||
int accio = -1;
|
||||
int prevista = -1;
|
||||
// [TODO] if (arounders::seleccionat) { accio = arounders::seleccionat->accio; prevista = arounders::seleccionat->prevista; }
|
||||
// [QUESTION] Potser lo del seleccionat se deuria mirar dins de "mapa"?
|
||||
mapa::pintar(0, 0); // [TODO] if (arounders::seleccionat) existeix, pillar la accio i la prevista de ell
|
||||
|
||||
// [TODO] aigua::pintar();
|
||||
// [TODO] arounders::pintar();
|
||||
|
||||
// [TODO] de fet, pintar la marca en el modul "arounders"
|
||||
/*
|
||||
if (arounders::seleccionat) {
|
||||
draw::setSource(marca);
|
||||
draw::draw(arounderSeleccionat->X-3, arounderSeleccionat->Y-3);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user