- Seguim amb l'implementació del modul de mapa i el gamestate_play

This commit is contained in:
2023-10-18 19:00:56 +02:00
parent 6b8a5213e6
commit c5499bf549
2 changed files with 96 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
#include "proc_mapa.h"
#include "jgame.h"
#include "aux_textfile.h"
#include "aux_font.h"
namespace mapa
{
namespace arounders
@@ -31,8 +31,8 @@ namespace mapa
int velocitat;
draw::surface *mapa = nullptr;
//SDL_Surface *boto;
draw::surface *porta = nullptr;
draw::surface *boto = nullptr;
int contador;
@@ -89,12 +89,60 @@ namespace mapa
draw::draw(0, 165, marcador->w, marcador->h, 0, 0);
draw::freeSurface(marcador);
font::selectFont(font::type::normal);
font::print(188,188, game::getConfig("fase")+1);
font::print(7,188, "XX");
font::print(135,188, "XX");
font::print(151,188, "XX");
font::print(224,171, "ACTIUS");
font::print(224,177, "TOTAL");
font::print(224,183, "NECESSARIS");
font::print(224,189, "ARRIVATS");
draw::setDestination(nullptr);
if (mapa::porta == nullptr) mapa::porta = draw::loadSurface("puerta.gif");
if (mapa::boto == nullptr) mapa::boto = draw::loadSurface("boto.gif");
}
char *formatejar(int numero);
void pintar(int accio, int prevista)
{
draw::draw(mapa);
draw::setSource(porta);
draw::draw(ini_x*16, ini_y*16);
draw::draw(fin_x*16, fin_y*16);
font::print(23,188, mapa::accions::parar);
font::print(39,188, mapa::accions::cavar);
font::print(55,188, mapa::accions::escalar);
font::print(71,188, mapa::accions::perforar);
font::print(87,188, mapa::accions::escalera);
font::print(103,188, mapa::accions::pasarela);
font::print(119,188, mapa::accions::corda);
font::print(301,171, mapa::arounders::eixits-mapa::arounders::arrivats-mapa::arounders::morts);
font::print(301,177, mapa::arounders::totals);
font::print(301,183, mapa::arounders::necessaris);
font::print(301,189, mapa::arounders::arrivats);
if (accio >= 10) accio = 0;
if (prevista >= 10) prevista = 0;
draw::setSource(boto);
draw::draw((accio*16)+5, 171);
if (prevista != accio && prevista != 0) {
if ((game::getTicks()-contador) <= 200) {
draw::draw((prevista*16)+5, 171);
} else {
if ((game::getTicks()-contador) >= 400) contador = game::getTicks();
}
}
if (velocitat < 70) {
draw::draw((9*16)+5, 171); // Pintar el botó de accelerat com pulsat
}
}
void pintar(int accio, int prevista);
int procesar(int mousex, int mousey);
void setAroundersNum(const int orient, const int total, const int necessaris);