diff --git a/data/25anys.gif b/data/25anys.gif new file mode 100644 index 0000000..1f15389 Binary files /dev/null and b/data/25anys.gif differ diff --git a/data/gifs.txt b/data/gifs.txt index f9f8bb9..8c77567 100644 --- a/data/gifs.txt +++ b/data/gifs.txt @@ -1,3 +1,4 @@ +25anys.gif abad.gif altres.gif batman.gif @@ -8,6 +9,11 @@ font.gif font2.gif gat.gif gat2.gif +intro1.gif +intro2.gif +intro3.gif +intro4.gif +intro5.gif jailgames.gif lordabad.gif mapa.gif diff --git a/data/intro1.gif b/data/intro1.gif new file mode 100644 index 0000000..8e24bc1 Binary files /dev/null and b/data/intro1.gif differ diff --git a/data/intro2.gif b/data/intro2.gif new file mode 100644 index 0000000..8191615 Binary files /dev/null and b/data/intro2.gif differ diff --git a/data/intro3.gif b/data/intro3.gif new file mode 100644 index 0000000..b901521 Binary files /dev/null and b/data/intro3.gif differ diff --git a/data/intro4.gif b/data/intro4.gif new file mode 100644 index 0000000..ae3521b Binary files /dev/null and b/data/intro4.gif differ diff --git a/data/intro5.gif b/data/intro5.gif new file mode 100644 index 0000000..62e1de4 Binary files /dev/null and b/data/intro5.gif differ diff --git a/data/templates.txt b/data/templates.txt index b448a85..b982a95 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -47,19 +47,6 @@ category{ movement: CW } - actor{ - name: S-SHOES - bmp: objectes.gif - bmp-rect: 162 0 28 22 - bmp-offset: -3 24 - pos: 48 8 0 - size: 4 4 4 - anim-cycle: SEQ - anim-wait: 2 - flags: SPECIAL - movement: CW - } - actor{ name: FINESTRA bmp: altres.gif @@ -400,11 +387,11 @@ category{ bmp: objectes.gif bmp-rect: 96 0 24 32 bmp-offset: -4 34 - pos: 8 40 8 + pos: 16 0 8 size: 4 4 4 anim-cycle: SEQ anim-wait: 2 - flags: SPECIAL + flags: PUSHABLE GRAVITY SPECIAL movement: CW } @@ -657,3 +644,60 @@ category{ } } + +category{ + name: SKILLS + + actor{ + name: S-SHOES + bmp: objectes.gif + bmp-rect: 162 0 28 22 + bmp-offset: -3 24 + pos: 40 0 4 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: SPECIAL + movement: CW + } + + actor{ + name: S-BAG + bmp: objectes.gif + bmp-rect: 145 41 20 25 + bmp-offset: -5 27 + pos: 0 56 20 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: SPECIAL + movement: CW + } + + actor{ + name: S-PANTS + bmp: objectes.gif + bmp-rect: 167 22 18 23 + bmp-offset: -7 27 + pos: 0 16 0 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: SPECIAL + movement: CW + } + + actor{ + name: S-GLOVES + bmp: objectes.gif + bmp-rect: 165 45 21 22 + bmp-offset: -2 26 + pos: 8 22 0 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: SPECIAL + movement: CW + } + +} diff --git a/source/m_intro.cpp b/source/m_intro.cpp new file mode 100644 index 0000000..3220361 --- /dev/null +++ b/source/m_intro.cpp @@ -0,0 +1,145 @@ +#include "m_intro.h" +#include "jdraw.h" +#include "jinput.h" +#include "controller.h" +#include "config.h" +#include +#include "actor.h" + +namespace modules +{ + namespace intro + { + int stage = 7; + uint32_t time = 0; + + void init() + { + time = SDL_GetTicks(); + draw::cls(2); + + draw::swapcol(1, 9); + draw::setSource(draw::getSurface("intro1.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("AH!", 19, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("QUE BON DIA FA!", 13, 19, WHITE, FONT_ZOOM_NONE); + draw::render(); + + } + + const bool shouldGoToNext() + { + return //(SDL_GetTicks()-time > 5000) || + (controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) || + (input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN)); + } + + bool loop() + { + if (input::keyPressed(SDL_SCANCODE_ESCAPE)) return false; + + if (shouldGoToNext()) + { + time = SDL_GetTicks(); + stage++; + if (stage == 9) return false; + + switch (stage) + { + case 1: + draw::cls(2); + draw::swapcol(1, 9); + draw::setSource(draw::getSurface("intro2.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + 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::render(); + break; + case 2: + draw::cls(2); + draw::swapcol(1, 8); + draw::setSource(draw::getSurface("intro3.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("PERO QUE...??", 14, 17, WHITE, FONT_ZOOM_NONE); + draw::render(); + break; + case 3: + draw::cls(2); + draw::swapcol(1, 8); + draw::setSource(draw::getSurface("intro3.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("ESTOS PAIASOS ENCARA", 10, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("NO L'HAN ACABAT!", 12, 19, WHITE, FONT_ZOOM_NONE); + draw::render(); + break; + case 4: + draw::cls(2); + draw::swapcol(1, 7); + draw::setSource(draw::getSurface("intro4.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + 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::render(); + break; + case 5: + draw::cls(2); + draw::swapcol(1, 9); + draw::setSource(draw::getSurface("intro1.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("I ARA ON ESTAN LES ", 11, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("MEUES COSES...?", 12, 19, WHITE, FONT_ZOOM_NONE); + draw::render(); + break; + case 6: + draw::cls(2); + draw::swapcol(1, 10); + draw::setSource(draw::getSurface("intro5.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + 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::render(); + break; + case 7: + draw::cls(2); + draw::swapcol(1, 10); + draw::setSource(draw::getSurface("intro5.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("ESPERE TROBARME ALGUN", 9, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("CAFE PEL CAMI...", 12, 19, WHITE, FONT_ZOOM_NONE); + draw::render(); + break; + case 8: + actor::templates::load(); + 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; + actor::drawAt(act, 20, 90); actor::remove(act); + + act = actor::createFromTemplate("S-BAG"); act->flags &= ~FLAG_SPECIAL; + actor::drawAt(act, 20, 120); actor::remove(act); + + /*draw::swapcol(1, 10); + draw::setSource(draw::getSurface("intro5.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("ESPERE TROBARME ALGUN", 9, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("CAFE PEL CAMI...", 12, 19, WHITE, FONT_ZOOM_NONE);*/ + draw::render(); + break; + } + } + + return true; + } + } +} \ No newline at end of file diff --git a/source/m_intro.h b/source/m_intro.h new file mode 100644 index 0000000..0a0d755 --- /dev/null +++ b/source/m_intro.h @@ -0,0 +1,10 @@ +#pragma once + +namespace modules +{ + namespace intro + { + void init(); + bool loop(); + } +} diff --git a/source/m_logo.cpp b/source/m_logo.cpp index 2bb098e..766a98f 100644 --- a/source/m_logo.cpp +++ b/source/m_logo.cpp @@ -23,6 +23,7 @@ namespace modules int num_pixels = 0; float d = 1; float a = 0; + draw::surface *anys = nullptr; void get_dist_angle_from_xy(int pixel); void calculate_coords_from_dist_angle(int pixel); @@ -30,7 +31,7 @@ namespace modules void init() { srand(SDL_GetTicks()); - + anys = draw::getSurface("25anys.gif"); num_pixels = 0; draw::surface *surf = draw::getSurface("jailgames.gif"); for (int y=0; yh; ++y) @@ -78,7 +79,15 @@ namespace modules } } else if (steps<56) { 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; i280) { return false; } diff --git a/source/main.cpp b/source/main.cpp index b8aea0f..09ddb34 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -15,6 +15,7 @@ #include "m_game.h" #include "m_menu.h" #include "m_logo.h" +#include "m_intro.h" #include "m_ingame.h" #include "m_gameover.h" #include "m_catslife.h" @@ -28,19 +29,20 @@ #include "m_editor_bitmap.h" #define M_LOGO 0 -#define M_MENU 1 -#define M_GAME 2 -#define M_INGAME 3 -#define M_GAMEOVER 4 -#define M_CATSLIFE 5 -#define M_MENU_TECLES 6 -#define M_MENU_GAMEPAD 7 -#define M_MENU_AUDIO 8 -#define M_EDITOR_MAP 9 -#define M_EDITOR_TEMPLATES 10 -#define M_EDITOR_COLORS 11 -#define M_EDITOR_BITMAP_FILE 12 -#define M_EDITOR_BITMAP 13 +#define M_INTRO 1 +#define M_MENU 2 +#define M_GAME 3 +#define M_INGAME 4 +#define M_GAMEOVER 5 +#define M_CATSLIFE 6 +#define M_MENU_TECLES 7 +#define M_MENU_GAMEPAD 8 +#define M_MENU_AUDIO 9 +#define M_EDITOR_MAP 10 +#define M_EDITOR_TEMPLATES 11 +#define M_EDITOR_COLORS 12 +#define M_EDITOR_BITMAP_FILE 13 +#define M_EDITOR_BITMAP 14 int current_module = M_LOGO; @@ -138,7 +140,10 @@ bool game::loop() switch(current_module) { case M_LOGO: - if (!modules::logo::loop()) { modules::menu::init(); current_module = M_MENU; } + if (!modules::logo::loop()) { modules::intro::init(); current_module = M_INTRO; } + break; + case M_INTRO: + if (!modules::intro::loop()) { modules::menu::init(); current_module = M_MENU; } break; case M_MENU: option = modules::menu::loop();