Files
arounders/source/gamestate_play.cpp
JailDoctor c9e1760698 - [FIX] nom de musica incorrecte
- [FIX] Al carregar el mapa nomes contaba fins a x=10 en compte de 20.
- Aplicats els nous draw::draw()
- Fora tots els draw::setTrans(), el color transparent no canvia en tot el joc.
2023-10-18 19:44:48 +02:00

87 lines
2.6 KiB
C++

#include "gamestates.h"
#include "jgame.h"
#include <string>
#include "aux_font.h"
#include "proc_mapa.h"
namespace gamestate
{
namespace play
{
draw::surface *fondo = nullptr;
draw::surface *mapa = nullptr;
draw::surface *cursor = nullptr;
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] = (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
cursor = draw::loadSurface("cursor.gif");
//menu = drawManager->LoadFont("menu.gif");
// [TODO] CREAR AIGUA PROCESSOR
// [TODO] CREAR MARCADOR PROCESSOR
// [TODO] Crear el primer Arounder
mapa::arounders::eixits++;
// arounder_seleccionat = primerArounders
audio::loadMusic((fase+1) % 5 == 0 ? "mus6.ogg" : "mus4.ogg");
audio::playMusic();
play::arounderCount = play::startTicks = game::getTicks();
draw::fadein();
game::setState(gamestate::play::loop);
}
bool loop()
{
play::draw();
return true;
}
void draw()
{
draw::draw(play::fondo);
int accio = 0;
int prevista = 0;
// [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(accio, prevista); // [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);
}
*/
draw::setSource(cursor);
draw::draw(input::mouseX(), input::mouseY());
draw::render();
}
}
}