From c9e176069851376cccf67a488fd0168b98de57f2 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Wed, 18 Oct 2023 19:44:48 +0200 Subject: [PATCH] - [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. --- source/aux_font.cpp | 3 --- source/gamestate_menu.cpp | 7 ++----- source/gamestate_play.cpp | 21 ++++++++++++++------- source/gamestate_prefase.cpp | 7 ++----- source/gamestate_sequence.cpp | 4 +--- source/main.cpp | 2 ++ source/proc_mapa.cpp | 2 +- 7 files changed, 22 insertions(+), 24 deletions(-) diff --git a/source/aux_font.cpp b/source/aux_font.cpp index fd36bec..30db07c 100644 --- a/source/aux_font.cpp +++ b/source/aux_font.cpp @@ -32,7 +32,6 @@ namespace font void print(const int x, const int y, const std::string text) { draw::setSource(font::mode == font::type::colored ? font::font2 : font::font1); - draw::setTrans(0); if (font::mode == font::type::fade) for (int i=64;i<=67;++i) draw::swapcol(i, i+4); @@ -47,8 +46,6 @@ namespace font } for (int i=64;i<=67;++i) draw::restorecol(i); - - draw::setTrans(255); } void print(const int x, const int y, const int num) diff --git a/source/gamestate_menu.cpp b/source/gamestate_menu.cpp index 858218e..0683429 100644 --- a/source/gamestate_menu.cpp +++ b/source/gamestate_menu.cpp @@ -41,13 +41,10 @@ namespace gamestate const int x = input::mouseX(); const int y = input::mouseY(); - draw::setTrans(255); - draw::setSource(fondo); - draw::draw(0, 0, 320, 200, 0, 0); + draw::draw(fondo); - draw::setTrans(0); draw::setSource(cursor); - draw::draw(x, y, cursor->w, cursor->h, 0, 0); + draw::draw(x, y); draw::render(); diff --git a/source/gamestate_play.cpp b/source/gamestate_play.cpp index 67355de..ba226d3 100644 --- a/source/gamestate_play.cpp +++ b/source/gamestate_play.cpp @@ -10,6 +10,7 @@ namespace gamestate { draw::surface *fondo = nullptr; draw::surface *mapa = nullptr; + draw::surface *cursor = nullptr; uint32_t arounderCount; uint32_t startTicks; @@ -30,7 +31,7 @@ namespace gamestate draw::setPalette(pal, 128); // [TODO] Carreagar la resta de gifs que facen falta - //cursor = drawManager->LoadFont("cursor.gif"); + cursor = draw::loadSurface("cursor.gif"); //menu = drawManager->LoadFont("menu.gif"); // [TODO] CREAR AIGUA PROCESSOR @@ -40,7 +41,7 @@ namespace gamestate mapa::arounders::eixits++; // arounder_seleccionat = primerArounders - audio::loadMusic((fase+1) % 5 == 0 ? "mus6.ogg" : "mus4.mp3"); + audio::loadMusic((fase+1) % 5 == 0 ? "mus6.ogg" : "mus4.ogg"); audio::playMusic(); play::arounderCount = play::startTicks = game::getTicks(); @@ -52,18 +53,19 @@ namespace gamestate bool loop() { play::draw(); + + return true; } void draw() { - draw::setSource(play::fondo); - draw::draw(); + draw::draw(play::fondo); - int accio = -1; - int prevista = -1; + 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(0, 0); // [TODO] if (arounders::seleccionat) existeix, pillar la accio i la prevista de ell + mapa::pintar(accio, prevista); // [TODO] if (arounders::seleccionat) existeix, pillar la accio i la prevista de ell // [TODO] aigua::pintar(); // [TODO] arounders::pintar(); @@ -75,6 +77,11 @@ namespace gamestate draw::draw(arounderSeleccionat->X-3, arounderSeleccionat->Y-3); } */ + + draw::setSource(cursor); + draw::draw(input::mouseX(), input::mouseY()); + + draw::render(); } } } \ No newline at end of file diff --git a/source/gamestate_prefase.cpp b/source/gamestate_prefase.cpp index 8b68be1..3dd6984 100644 --- a/source/gamestate_prefase.cpp +++ b/source/gamestate_prefase.cpp @@ -48,13 +48,10 @@ namespace gamestate { static bool salir = false; - draw::setTrans(255); - draw::setSource(fondo); - draw::draw(0, 0, 320, 200, 0, 0); + draw::draw(fondo); - draw::setTrans(0); draw::setSource(cursor); - draw::draw(input::mouseX(), input::mouseY(), cursor->w, cursor->h, 0, 0); + draw::draw(input::mouseX(), input::mouseY()); draw::render(); diff --git a/source/gamestate_sequence.cpp b/source/gamestate_sequence.cpp index 4f2d223..4a9e362 100644 --- a/source/gamestate_sequence.cpp +++ b/source/gamestate_sequence.cpp @@ -16,7 +16,6 @@ namespace gamestate void init() { - draw::setTrans(255); font::selectFont(font::type::colored); std::string filename; @@ -118,8 +117,7 @@ namespace gamestate void drawPic(std::string filename) { draw::surface *pic = draw::loadSurface(filename, true); - draw::setSource(pic); - draw::draw(0, 0, 320, 200, 0, 0); + draw::draw(pic); draw::freeSurface(pic); } diff --git a/source/main.cpp b/source/main.cpp index 267de25..d9ba175 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -5,6 +5,8 @@ void game::init() { draw::init("Arounders", 320, 200, 3); + draw::setTrans(0); + input::init(3); audio::init(); diff --git a/source/proc_mapa.cpp b/source/proc_mapa.cpp index fe462ba..806ed52 100644 --- a/source/proc_mapa.cpp +++ b/source/proc_mapa.cpp @@ -74,7 +74,7 @@ namespace mapa draw::setDestination(mapa); for (int y=0; y<10; ++y) - for (int x=0; x<10; ++x) + for (int x=0; x<20; ++x) { int tile = textfile::toInt(textfile::getNextToken()); if (tile > 0) draw::draw(x*16, y*16, 16, 16, (tile-1)*16, tileset*16);