- [NEW] Afegit xicotet detall al logo

- [NEW] Sequencia de introducció (ongoing)
This commit is contained in:
2024-10-04 14:00:27 +02:00
parent c3d1b672c2
commit f84eb3e238
12 changed files with 253 additions and 31 deletions

BIN
data/25anys.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

View File

@@ -1,3 +1,4 @@
25anys.gif
abad.gif abad.gif
altres.gif altres.gif
batman.gif batman.gif
@@ -8,6 +9,11 @@ font.gif
font2.gif font2.gif
gat.gif gat.gif
gat2.gif gat2.gif
intro1.gif
intro2.gif
intro3.gif
intro4.gif
intro5.gif
jailgames.gif jailgames.gif
lordabad.gif lordabad.gif
mapa.gif mapa.gif

BIN
data/intro1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/intro2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/intro3.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
data/intro4.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
data/intro5.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -47,19 +47,6 @@ category{
movement: CW 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{ actor{
name: FINESTRA name: FINESTRA
bmp: altres.gif bmp: altres.gif
@@ -400,11 +387,11 @@ category{
bmp: objectes.gif bmp: objectes.gif
bmp-rect: 96 0 24 32 bmp-rect: 96 0 24 32
bmp-offset: -4 34 bmp-offset: -4 34
pos: 8 40 8 pos: 16 0 8
size: 4 4 4 size: 4 4 4
anim-cycle: SEQ anim-cycle: SEQ
anim-wait: 2 anim-wait: 2
flags: SPECIAL flags: PUSHABLE GRAVITY SPECIAL
movement: CW 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
}
}

145
source/m_intro.cpp Normal file
View File

@@ -0,0 +1,145 @@
#include "m_intro.h"
#include "jdraw.h"
#include "jinput.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#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;
}
}
}

10
source/m_intro.h Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
namespace modules
{
namespace intro
{
void init();
bool loop();
}
}

View File

@@ -23,6 +23,7 @@ namespace modules
int num_pixels = 0; int num_pixels = 0;
float d = 1; float d = 1;
float a = 0; float a = 0;
draw::surface *anys = nullptr;
void get_dist_angle_from_xy(int pixel); void get_dist_angle_from_xy(int pixel);
void calculate_coords_from_dist_angle(int pixel); void calculate_coords_from_dist_angle(int pixel);
@@ -30,7 +31,7 @@ namespace modules
void init() void init()
{ {
srand(SDL_GetTicks()); srand(SDL_GetTicks());
anys = draw::getSurface("25anys.gif");
num_pixels = 0; num_pixels = 0;
draw::surface *surf = draw::getSurface("jailgames.gif"); draw::surface *surf = draw::getSurface("jailgames.gif");
for (int y=0; y<surf->h; ++y) for (int y=0; y<surf->h; ++y)
@@ -78,7 +79,15 @@ 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)
{
pixels[i].di = 1;
pixels[i].ai = 0;
calculate_coords_from_dist_angle(i);
draw::fillrect(60+pixels[i].x*4, 106+pixels[i].y*4, 4*pixels[i].di, 4*pixels[i].di);
}
} else if (steps<100) {
for (int i=0; i<num_pixels; ++i) for (int i=0; i<num_pixels; ++i)
{ {
pixels[i].di = 1; pixels[i].di = 1;
@@ -93,12 +102,15 @@ namespace modules
{ {
draw::fillrect(60+pixels[i].x*4, 106+pixels[i].y*4, 4*pixels[i].di, 4*pixels[i].di); draw::fillrect(60+pixels[i].x*4, 106+pixels[i].y*4, 4*pixels[i].di, 4*pixels[i].di);
} }
draw::setSource(anys);
draw::draw(212, 136, 40,7, 0, 0);
} else if (steps<216) { } else if (steps<216) {
draw::swapcol(1, 19-(steps-200)/2); draw::swapcol(1, 19-(steps-200)/2);
for (int i=0; i<num_pixels; ++i) for (int i=0; i<num_pixels; ++i)
{ {
draw::fillrect(60+pixels[i].x*4, 106+pixels[i].y*4, 4*pixels[i].di, 4*pixels[i].di); draw::fillrect(60+pixels[i].x*4, 106+pixels[i].y*4, 4*pixels[i].di, 4*pixels[i].di);
} }
draw::draw(212, 136, 40,7, 0, 0);
} else if (steps>280) { } else if (steps>280) {
return false; return false;
} }

View File

@@ -15,6 +15,7 @@
#include "m_game.h" #include "m_game.h"
#include "m_menu.h" #include "m_menu.h"
#include "m_logo.h" #include "m_logo.h"
#include "m_intro.h"
#include "m_ingame.h" #include "m_ingame.h"
#include "m_gameover.h" #include "m_gameover.h"
#include "m_catslife.h" #include "m_catslife.h"
@@ -28,19 +29,20 @@
#include "m_editor_bitmap.h" #include "m_editor_bitmap.h"
#define M_LOGO 0 #define M_LOGO 0
#define M_MENU 1 #define M_INTRO 1
#define M_GAME 2 #define M_MENU 2
#define M_INGAME 3 #define M_GAME 3
#define M_GAMEOVER 4 #define M_INGAME 4
#define M_CATSLIFE 5 #define M_GAMEOVER 5
#define M_MENU_TECLES 6 #define M_CATSLIFE 6
#define M_MENU_GAMEPAD 7 #define M_MENU_TECLES 7
#define M_MENU_AUDIO 8 #define M_MENU_GAMEPAD 8
#define M_EDITOR_MAP 9 #define M_MENU_AUDIO 9
#define M_EDITOR_TEMPLATES 10 #define M_EDITOR_MAP 10
#define M_EDITOR_COLORS 11 #define M_EDITOR_TEMPLATES 11
#define M_EDITOR_BITMAP_FILE 12 #define M_EDITOR_COLORS 12
#define M_EDITOR_BITMAP 13 #define M_EDITOR_BITMAP_FILE 13
#define M_EDITOR_BITMAP 14
int current_module = M_LOGO; int current_module = M_LOGO;
@@ -138,7 +140,10 @@ bool game::loop()
switch(current_module) switch(current_module)
{ {
case M_LOGO: 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; break;
case M_MENU: case M_MENU:
option = modules::menu::loop(); option = modules::menu::loop();