- [NEW] Intro acabada

This commit is contained in:
2024-10-04 17:53:27 +02:00
parent f84eb3e238
commit d17ac3a2ed
4 changed files with 53 additions and 29 deletions

View File

@@ -5,7 +5,6 @@ namespace config
#define SOUND_ALL 0 #define SOUND_ALL 0
#define SOUND_BASIC 1 #define SOUND_BASIC 1
#define SOUND_NONE 2 #define SOUND_NONE 2
#define SOUND_MUSIC 2
#define KEY_UP 0 #define KEY_UP 0
#define KEY_DOWN 1 #define KEY_DOWN 1

View File

@@ -17,7 +17,7 @@ namespace modules
void init() void init()
{ {
audio::playMusic("mus_gameover.ogg"); if (audio::getCurrentMusic() != "mus_gameover.ogg") audio::playMusic("mus_gameover.ogg");
if (heroi == nullptr) heroi = actor::create("HERO", {16,32,8}, {6,6,12}, "test.gif", {0,32,20,32}, {-6,38}); if (heroi == nullptr) heroi = actor::create("HERO", {16,32,8}, {6,6,12}, "test.gif", {0,32,20,32}, {-6,38});
heroi->flags = FLAG_ANIMATED; heroi->flags = FLAG_ANIMATED;

View File

@@ -1,6 +1,7 @@
#include "m_intro.h" #include "m_intro.h"
#include "jdraw.h" #include "jdraw.h"
#include "jinput.h" #include "jinput.h"
#include "jaudio.h"
#include "controller.h" #include "controller.h"
#include "config.h" #include "config.h"
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
@@ -10,7 +11,7 @@ namespace modules
{ {
namespace intro namespace intro
{ {
int stage = 7; int stage = 0;
uint32_t time = 0; uint32_t time = 0;
void init() void init()
@@ -25,15 +26,23 @@ namespace modules
draw::print2("QUE BON DIA FA!", 13, 19, WHITE, FONT_ZOOM_NONE); draw::print2("QUE BON DIA FA!", 13, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); draw::render();
if (audio::getCurrentMusic() != "mus_menu.ogg") audio::playMusic("mus_menu.ogg");
} }
const bool shouldGoToNext() const bool shouldGoToNext()
{ {
return //(SDL_GetTicks()-time > 5000) || return (SDL_GetTicks()-time > (stage==8?10000:5000)) ||
(controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) ||
(input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN)); (input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN));
} }
void drawActorAt(const char* name, const int x, const int y)
{
draw::swapcol(1,PURPLE);
actor::actor_t *act = actor::createFromTemplate(name); act->flags &= ~FLAG_SPECIAL;
actor::drawAt(act, x, y); actor::remove(act);
}
bool loop() bool loop()
{ {
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) return false; if (input::keyPressed(SDL_SCANCODE_ESCAPE)) return false;
@@ -53,7 +62,7 @@ namespace modules
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("ME ANE A ESCABUSSARME", 10, 17, WHITE, FONT_ZOOM_NONE); draw::print2("ME ANE A ESCABUSSARME", 10, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("EN LA NOVA PISCINA!", 11, 19, WHITE, FONT_ZOOM_NONE); draw::print2("EN LA NOVA PISCINA!", 11, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 2: case 2:
draw::cls(2); draw::cls(2);
@@ -61,7 +70,7 @@ namespace modules
draw::setSource(draw::getSurface("intro3.gif")); draw::setSource(draw::getSurface("intro3.gif"));
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("PERO QUE...??", 14, 17, WHITE, FONT_ZOOM_NONE); draw::print2("PERO QUE...??", 14, 17, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 3: case 3:
draw::cls(2); draw::cls(2);
@@ -70,7 +79,7 @@ namespace modules
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("ESTOS PAIASOS ENCARA", 10, 17, WHITE, FONT_ZOOM_NONE); draw::print2("ESTOS PAIASOS ENCARA", 10, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("NO L'HAN ACABAT!", 12, 19, WHITE, FONT_ZOOM_NONE); draw::print2("NO L'HAN ACABAT!", 12, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 4: case 4:
draw::cls(2); draw::cls(2);
@@ -79,7 +88,7 @@ namespace modules
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("TINDRE QUE TROBAR JO LES", 8, 17, WHITE, FONT_ZOOM_NONE); draw::print2("TINDRE QUE TROBAR JO LES", 8, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("PECES DE LA DEPURADORA", 9, 19, WHITE, FONT_ZOOM_NONE); draw::print2("PECES DE LA DEPURADORA", 9, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 5: case 5:
draw::cls(2); draw::cls(2);
@@ -88,7 +97,7 @@ namespace modules
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("I ARA ON ESTAN LES ", 11, 17, WHITE, FONT_ZOOM_NONE); draw::print2("I ARA ON ESTAN LES ", 11, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("MEUES COSES...?", 12, 19, WHITE, FONT_ZOOM_NONE); draw::print2("MEUES COSES...?", 12, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 6: case 6:
draw::cls(2); draw::cls(2);
@@ -97,7 +106,7 @@ namespace modules
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("ELS GATS ME LES HAN", 11, 17, WHITE, FONT_ZOOM_NONE); draw::print2("ELS GATS ME LES HAN", 11, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("REPARTIT PER TOTA LA CASA", 8, 19, WHITE, FONT_ZOOM_NONE); draw::print2("REPARTIT PER TOTA LA CASA", 8, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 7: case 7:
draw::cls(2); draw::cls(2);
@@ -106,39 +115,55 @@ namespace modules
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("ESPERE TROBARME ALGUN", 9, 17, WHITE, FONT_ZOOM_NONE); draw::print2("ESPERE TROBARME ALGUN", 9, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("CAFE PEL CAMI...", 12, 19, WHITE, FONT_ZOOM_NONE); draw::print2("CAFE PEL CAMI...", 12, 19, WHITE, FONT_ZOOM_NONE);
draw::render(); //draw::render();
break; break;
case 8: case 8:
actor::templates::load(); actor::templates::load();
draw::cls(2); draw::cls(2);
actor::actor_t *act = actor::createFromTemplate("S-SHOES"); act->flags &= ~FLAG_SPECIAL;
actor::drawAt(act, 20, 22); actor::remove(act);
draw::print2("SABATES", 7, 3, WHITE, FONT_ZOOM_NONE);
draw::print2("GUANTS", 7, 7, WHITE, FONT_ZOOM_NONE);
draw::print2("PANTALONS", 7, 11, WHITE, FONT_ZOOM_NONE);
draw::print2("MOTXILA", 7, 15, WHITE, FONT_ZOOM_NONE);
draw::print("PER A PODER BOTAR", 57, 35, TEAL, PAPER);
draw::restorecol(1);
act = actor::createFromTemplate("S-GLOVES"); act->flags &= ~FLAG_SPECIAL;
actor::drawAt(act, 20, 60); actor::remove(act);
act = actor::createFromTemplate("S-PANTS"); act->flags &= ~FLAG_SPECIAL; draw::print2("HABILITATS:", 4, 3, YELLOW, FONT_ZOOM_VERTICAL);
actor::drawAt(act, 20, 90); actor::remove(act);
act = actor::createFromTemplate("S-BAG"); act->flags &= ~FLAG_SPECIAL; draw::print2("PARTS DE LA", 24, 3, YELLOW, FONT_ZOOM_VERTICAL);
actor::drawAt(act, 20, 120); actor::remove(act); draw::print2("DEPURADORA:", 24, 6, YELLOW, FONT_ZOOM_VERTICAL);
draw::print2("CAFE:", 6, 24, YELLOW, FONT_ZOOM_VERTICAL);
draw::print2("SABATES", 7, 7, WHITE, FONT_ZOOM_NONE);
draw::print2("GUANTS", 7, 11, WHITE, FONT_ZOOM_NONE);
draw::print2("PANTALONS", 7, 15, WHITE, FONT_ZOOM_NONE);
draw::print2("MOTXILA", 7, 19, WHITE, FONT_ZOOM_NONE);
draw::print("PER A PODER BOTAR", 57, 51+16, TEAL, PAPER);
draw::print("PER A ESPENTAR OBJECTES", 57, 83+16, TEAL, PAPER);
draw::print("PER A AGAFAR UN OBJECTE", 57, 115+16, TEAL, PAPER);
draw::print("PER A ARREPLEGAR LES PARTS", 57, 147+16, TEAL, PAPER);
draw::print("BOT LLARG, SUPERVELOCITAT,", 47, 211, TEAL, PAPER);
draw::print("IMMUNITAT, VIDA EXTRA", 47, 218, TEAL, PAPER);
drawActorAt("S-SHOES", 18, 38+16);
drawActorAt("S-GLOVES", 20, 71+16);
drawActorAt("S-PANTS", 20, 101+16);
drawActorAt("S-BAG", 20, 131+16);
drawActorAt("P-FILTER", 200, 80);
drawActorAt("P-PIPE", 250, 80);
drawActorAt("P-ELBOW", 200, 120);
drawActorAt("P-SALT", 250, 120);
drawActorAt("P-TIMER", 200, 160);
drawActorAt("P-PUMP", 250, 160);
drawActorAt("BOOSTER", 20, 190);
/*draw::swapcol(1, 10); /*draw::swapcol(1, 10);
draw::setSource(draw::getSurface("intro5.gif")); draw::setSource(draw::getSurface("intro5.gif"));
draw::draw(96, 28, 128, 96, 0, 0); draw::draw(96, 28, 128, 96, 0, 0);
draw::print2("ESPERE TROBARME ALGUN", 9, 17, WHITE, FONT_ZOOM_NONE); draw::print2("ESPERE TROBARME ALGUN", 9, 17, WHITE, FONT_ZOOM_NONE);
draw::print2("CAFE PEL CAMI...", 12, 19, WHITE, FONT_ZOOM_NONE);*/ draw::print2("CAFE PEL CAMI...", 12, 19, WHITE, FONT_ZOOM_NONE);*/
draw::render();
break; break;
} }
} }
draw::render();
return true; return true;
} }
} }

View File

@@ -79,7 +79,7 @@ namespace modules
} }
} else if (steps<56) { } else if (steps<56) {
draw::swapcol(1, 12+(steps-40)/2); draw::swapcol(1, 12+(steps-40)/2);
//draw::swapcol(2, 19-(steps-40)/2); draw::swapcol(2, 19-(steps-40)/2);
for (int i=0; i<num_pixels; ++i) for (int i=0; i<num_pixels; ++i)
{ {
pixels[i].di = 1; pixels[i].di = 1;