Compare commits
6 Commits
aca0f646b3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c833527d60 | |||
| 2b93e224bb | |||
| e1518cf76f | |||
| 19df09dddc | |||
| fe444fc0ec | |||
| 80234e195e |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,12 +1,14 @@
|
|||||||
syntax: glob
|
syntax: glob
|
||||||
|
|
||||||
pepe
|
pepe
|
||||||
|
pepe_debug
|
||||||
recursos/*
|
recursos/*
|
||||||
bin/*
|
bin/*
|
||||||
obj/*
|
obj/*
|
||||||
Debug/*
|
Debug/*
|
||||||
Release/*
|
Release/*
|
||||||
data/*
|
data/*
|
||||||
|
build/*
|
||||||
*.suo
|
*.suo
|
||||||
*.sdf
|
*.sdf
|
||||||
*.opensdf
|
*.opensdf
|
||||||
|
|||||||
2
Makefile
Normal file
2
Makefile
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
build:
|
||||||
|
g++ -g *.cpp -lSDL2 -lSDL2_mixer -o pepe_debug
|
||||||
@@ -434,6 +434,9 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
|
|||||||
// sizeof( screen_descriptor_t ) = 8!
|
// sizeof( screen_descriptor_t ) = 8!
|
||||||
READ(&screen_descriptor, 7);
|
READ(&screen_descriptor, 7);
|
||||||
|
|
||||||
|
if (w) *w = screen_descriptor.width;
|
||||||
|
if (h) *h = screen_descriptor.height;
|
||||||
|
|
||||||
color_resolution_bits = ( ( screen_descriptor.fields & 0x70 ) >> 4 ) + 1;
|
color_resolution_bits = ( ( screen_descriptor.fields & 0x70 ) >> 4 ) + 1;
|
||||||
|
|
||||||
if ( screen_descriptor.fields & 0x80 )
|
if ( screen_descriptor.fields & 0x80 )
|
||||||
10
info.cpp
Normal file
10
info.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "info.h"
|
||||||
|
|
||||||
|
namespace info
|
||||||
|
{
|
||||||
|
int estat_joc;
|
||||||
|
bool rosita_enabled;
|
||||||
|
bool job_enabled;
|
||||||
|
int dificultat;
|
||||||
|
int personatge;
|
||||||
|
}
|
||||||
14
info.h
14
info.h
@@ -21,10 +21,10 @@
|
|||||||
#define PERSONATGE_ROSITA 1
|
#define PERSONATGE_ROSITA 1
|
||||||
#define PERSONATGE_JOB 2
|
#define PERSONATGE_JOB 2
|
||||||
|
|
||||||
struct Info {
|
namespace info{
|
||||||
int estat_joc;
|
extern int estat_joc;
|
||||||
bool rosita_enabled;
|
extern bool rosita_enabled;
|
||||||
bool job_enabled;
|
extern bool job_enabled;
|
||||||
int dificultat;
|
extern int dificultat;
|
||||||
int personatge;
|
extern int personatge;
|
||||||
};
|
}
|
||||||
|
|||||||
36
jdraw8.cpp
36
jdraw8.cpp
@@ -1,7 +1,7 @@
|
|||||||
#include "jdraw8.h"
|
#include "jdraw8.h"
|
||||||
#include "jfile.h"
|
#include "jfile.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "gif.c"
|
#include "gif.h"
|
||||||
|
|
||||||
#ifdef GCWZERO
|
#ifdef GCWZERO
|
||||||
#define SCREEN_WIDTH 320
|
#define SCREEN_WIDTH 320
|
||||||
@@ -27,15 +27,15 @@ SDL_Renderer* sdlRenderer = NULL;
|
|||||||
SDL_Texture* sdlTexture = NULL;
|
SDL_Texture* sdlTexture = NULL;
|
||||||
|
|
||||||
void JD8_Init(const char *title) {
|
void JD8_Init(const char *title) {
|
||||||
screen = (JD8_Surface)calloc( 1, 64000 );
|
screen = (JD8_Surface)calloc( 1, 320 * 200 );
|
||||||
main_palette = (JD8_Palette)calloc( 1, 768 );
|
main_palette = (JD8_Palette)calloc( 1, 256 * sizeof(uint32_t) );
|
||||||
pixel_data = (Uint32*)calloc(1, 320 * 200 * 4); // 1048576 );
|
pixel_data = (Uint32*)calloc(1, 320 * 200 * 4); // 1048576 );
|
||||||
|
|
||||||
sdlWindow = SDL_CreateWindow( title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
|
sdlWindow = SDL_CreateWindow( title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
|
||||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
||||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||||
|
|
||||||
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JD8_Quit() {
|
void JD8_Quit() {
|
||||||
@@ -50,9 +50,9 @@ void JD8_ClearScreen(Uint8 color) {
|
|||||||
memset( screen, color, 64000 );
|
memset( screen, color, 64000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
JD8_Surface JD8_NewSurface() {
|
JD8_Surface JD8_NewSurface(const int w, const int h) {
|
||||||
JD8_Surface surface = (JD8_Surface)malloc( 64000 );
|
JD8_Surface surface = (JD8_Surface)malloc( w * h );
|
||||||
memset( surface, 0, 64000 );
|
memset( surface, 0, w*h );
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +70,8 @@ JD8_Surface JD8_LoadSurface(const char *file) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
JD8_Surface image = JD8_NewSurface();
|
JD8_Surface image = JD8_NewSurface(w, h);
|
||||||
memcpy(image, pixels, 64000);
|
memcpy(image, pixels, w * h);
|
||||||
|
|
||||||
free(pixels);
|
free(pixels);
|
||||||
return image;
|
return image;
|
||||||
@@ -82,8 +82,15 @@ JD8_Palette JD8_LoadPalette(const char *file) {
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
buffer = JF_GetBufferFromResource(file, filesize);
|
buffer = JF_GetBufferFromResource(file, filesize);
|
||||||
|
|
||||||
JD8_Palette palette = (JD8_Palette)LoadPalette((unsigned char*)buffer);
|
uint8_t *pal = LoadPalette((unsigned char*)buffer);
|
||||||
|
|
||||||
|
JD8_Palette palette = (JD8_Palette)malloc(256 * sizeof(uint32_t));
|
||||||
|
for (int i=0; i<256; ++i) {
|
||||||
|
palette[i].r = pal[i*3];
|
||||||
|
palette[i].g = pal[1 + i*3];
|
||||||
|
palette[i].b = pal[2 + i*3];
|
||||||
|
//palette[i].hex = 0xff0000;
|
||||||
|
}
|
||||||
return palette;
|
return palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,12 +180,7 @@ void JD8_BlitCKToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int
|
|||||||
SDL_Rect rect{0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
|
SDL_Rect rect{0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||||
|
|
||||||
void JD8_Flip() {
|
void JD8_Flip() {
|
||||||
for( int x = 0; x < 320; x++ ) {
|
for (int i=0; i<64000; ++i) pixel_data[i] = main_palette[screen[i]].hex;
|
||||||
for( int y = 0; y < 200; y++ ) {
|
|
||||||
Uint32 color = 0xFF000000 + main_palette[screen[x + ( y * 320 )]].r + ( main_palette[screen[x + ( y * 320 )]].g << 8 ) + ( main_palette[screen[x + ( y * 320 )]].b << 16 );
|
|
||||||
pixel_data[x + ( y * 320 )] = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SDL_UpdateTexture(sdlTexture, NULL, pixel_data, 320 * sizeof(Uint32));
|
SDL_UpdateTexture(sdlTexture, NULL, pixel_data, 320 * sizeof(Uint32));
|
||||||
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, &rect);
|
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, &rect);
|
||||||
SDL_RenderPresent(sdlRenderer);
|
SDL_RenderPresent(sdlRenderer);
|
||||||
|
|||||||
11
jdraw8.h
11
jdraw8.h
@@ -1,10 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
struct Color {
|
union Color {
|
||||||
Uint8 r;
|
struct {
|
||||||
Uint8 g;
|
uint8_t b, g, r, a;
|
||||||
Uint8 b;
|
};
|
||||||
|
uint32_t hex;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Uint8* JD8_Surface;
|
typedef Uint8* JD8_Surface;
|
||||||
@@ -16,7 +17,7 @@ void JD8_Quit();
|
|||||||
|
|
||||||
void JD8_ClearScreen(Uint8 color);
|
void JD8_ClearScreen(Uint8 color);
|
||||||
|
|
||||||
JD8_Surface JD8_NewSurface();
|
JD8_Surface JD8_NewSurface(const int w, const int h);
|
||||||
|
|
||||||
JD8_Surface JD8_LoadSurface(const char *file);
|
JD8_Surface JD8_LoadSurface(const char *file);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "jsound.h"
|
#include "jsound.h"
|
||||||
#include "jfile.h"
|
#include "jfile.h"
|
||||||
#include <string>
|
|
||||||
|
|
||||||
Mix_Music *music = NULL;
|
Mix_Music *music = NULL;
|
||||||
char currentMusic[12];
|
char currentMusic[12];
|
||||||
|
|||||||
5
lagueirtofile
Normal file
5
lagueirtofile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
libs = -lSDL2 -lSDL2_mixer
|
||||||
|
cppflags = -D DEBUG -g
|
||||||
|
executable = pepe_debug
|
||||||
|
sourcepath = .
|
||||||
|
buildpath = build
|
||||||
45
main.cpp
45
main.cpp
@@ -3,12 +3,8 @@
|
|||||||
#include "jsound.h"
|
#include "jsound.h"
|
||||||
#include "jfile.h"
|
#include "jfile.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "modulestaticscreen.h"
|
#include "modules.h"
|
||||||
#include "modulemenu.h"
|
|
||||||
#include "moduleselect.h"
|
|
||||||
#include "modulesequence.h"
|
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
@@ -36,48 +32,35 @@ int main( int argc, char* args[] ) {
|
|||||||
JD8_Init("Pepe El Pintor");
|
JD8_Init("Pepe El Pintor");
|
||||||
JS_Init();
|
JS_Init();
|
||||||
|
|
||||||
Info info;
|
info::estat_joc = ESTAT_ICEKAS; // ESTAT_SEQUENCIA; // ESTAT_ICEKAS;
|
||||||
info.estat_joc = ESTAT_ICEKAS; // ESTAT_SEQUENCIA; // ESTAT_ICEKAS;
|
info::rosita_enabled = false;
|
||||||
info.rosita_enabled = false;
|
info::job_enabled = false;
|
||||||
info.job_enabled = false;
|
info::dificultat = MODE_FACIL;
|
||||||
info.dificultat = MODE_FACIL;
|
info::personatge = PERSONATGE_PEPE;
|
||||||
info.personatge = PERSONATGE_PEPE;
|
|
||||||
|
|
||||||
FILE* ini = fopen("trick.ini", "rb");
|
FILE* ini = fopen("trick.ini", "rb");
|
||||||
if (ini != NULL) {
|
if (ini != NULL) {
|
||||||
unsigned char contingut = 0;
|
unsigned char contingut = 0;
|
||||||
fread(&contingut, 1, 1, ini);
|
fread(&contingut, 1, 1, ini);
|
||||||
fclose(ini);
|
fclose(ini);
|
||||||
if (contingut > 0) info.rosita_enabled = true;
|
if (contingut > 0) info::rosita_enabled = true;
|
||||||
if (contingut > 1) info.job_enabled = true;
|
if (contingut > 1) info::job_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (info.estat_joc != ESTAT_EIXIR) {
|
while (info::estat_joc != ESTAT_EIXIR) {
|
||||||
switch (info.estat_joc) {
|
switch (info::estat_joc) {
|
||||||
case ESTAT_ICEKAS:
|
case ESTAT_ICEKAS:
|
||||||
case ESTAT_LOGO:
|
case ESTAT_LOGO:
|
||||||
ModuleStaticScreen * moduleStaticScreen;
|
module::staticScreen::go();
|
||||||
moduleStaticScreen = new ModuleStaticScreen(&info);
|
|
||||||
info.estat_joc = moduleStaticScreen->Go();
|
|
||||||
delete moduleStaticScreen;
|
|
||||||
break;
|
break;
|
||||||
case ESTAT_MENU:
|
case ESTAT_MENU:
|
||||||
ModuleMenu * moduleMenu;
|
module::menu::go();
|
||||||
moduleMenu = new ModuleMenu(&info);
|
|
||||||
info.estat_joc = moduleMenu->Go();
|
|
||||||
delete moduleMenu;
|
|
||||||
break;
|
break;
|
||||||
case ESTAT_SELECT:
|
case ESTAT_SELECT:
|
||||||
ModuleSelect * moduleSelect;
|
module::select::go();
|
||||||
moduleSelect = new ModuleSelect(&info);
|
|
||||||
info.estat_joc = moduleSelect->Go();
|
|
||||||
delete moduleSelect;
|
|
||||||
break;
|
break;
|
||||||
case ESTAT_SEQUENCIA:
|
case ESTAT_SEQUENCIA:
|
||||||
ModuleSequence * moduleSequence;
|
module::sequence::go();
|
||||||
moduleSequence = new ModuleSequence(&info);
|
|
||||||
info.estat_joc = moduleSequence->Go();
|
|
||||||
delete moduleSequence;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
327
modulemenu.cpp
327
modulemenu.cpp
@@ -1,4 +1,4 @@
|
|||||||
#include "modulemenu.h"
|
#include "modules.h"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "jgame.h"
|
||||||
#include "jdraw8.h"
|
#include "jdraw8.h"
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "jsound.h"
|
#include "jsound.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "info.h"
|
||||||
|
|
||||||
#define SENSE_OPCIO -1
|
#define SENSE_OPCIO -1
|
||||||
#define OPCIO_TIMEATTACK 0
|
#define OPCIO_TIMEATTACK 0
|
||||||
@@ -13,163 +14,209 @@
|
|||||||
#define OPCIO_CLASSICMODE 2
|
#define OPCIO_CLASSICMODE 2
|
||||||
#define OPCIO_OPTIONS 3
|
#define OPCIO_OPTIONS 3
|
||||||
|
|
||||||
ModuleMenu::ModuleMenu(Info* info) {
|
namespace module
|
||||||
this->info = info;
|
{
|
||||||
}
|
namespace menu
|
||||||
|
{
|
||||||
|
void go()
|
||||||
|
{
|
||||||
|
// [RZC 31/01/2024] [TODO] Menú del mode nocturn
|
||||||
|
|
||||||
ModuleMenu::~ModuleMenu(void) {
|
// Inicialitzem música i gràfics per al menú
|
||||||
}
|
JS_LoadMusic("mtitle.mid");
|
||||||
|
JS_PlayMusic(-1);
|
||||||
|
|
||||||
int ModuleMenu::Go() {
|
JD8_Surface fondo = JD8_LoadSurface("menu.gif");
|
||||||
|
JD8_Palette pal = JD8_LoadPalette("menu.gif");
|
||||||
|
JD8_Surface opcions = JD8_LoadSurface("menu_s.gif");
|
||||||
|
JD8_Surface gfx = JD8_LoadSurface("sprites.gif");
|
||||||
|
|
||||||
JS_LoadMusic("mtitle.mid");
|
JD8_ClearScreen(0);
|
||||||
JS_PlayMusic(-1);
|
JD8_Flip();
|
||||||
|
|
||||||
JD8_Surface fondo = JD8_LoadSurface("menu.gif");
|
|
||||||
JD8_Palette pal = JD8_LoadPalette("menu.gif");
|
|
||||||
JD8_Surface opcions = JD8_LoadSurface("menu_s.gif");
|
|
||||||
JD8_Surface gfx = JD8_LoadSurface("sprites.gif");
|
|
||||||
|
|
||||||
JD8_ClearScreen(0);
|
// Fade in
|
||||||
JD8_Flip();
|
JD8_Blit(fondo);
|
||||||
|
JG_SetUpdateTicks(1);
|
||||||
|
while (!JD8_FadeToPalAsync(pal) && !JG_Quitting()) {
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
|
}
|
||||||
|
|
||||||
// FADE IN
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JG_SetUpdateTicks(1);
|
|
||||||
while (!JD8_FadeToPalAsync(pal) && !JG_Quitting()) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
int x = 320;
|
// Movem la primera opció del menú al lloc
|
||||||
while (!JG_Quitting() && x > 0) {
|
int x = 320;
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
while (!JG_Quitting() && x > 0) {
|
||||||
JD8_Blit(fondo);
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
JD8_BlitCKCut(x, 50, opcions, 0, 50, 320, 38, 0);
|
JD8_Blit(fondo);
|
||||||
JD8_Flip();
|
JD8_BlitCKCut(x, 50, opcions, 0, 50, 320, 38, 0);
|
||||||
x--;
|
JD8_Flip();
|
||||||
}
|
x--;
|
||||||
JD8_BlitCKToSurface(0, 50, opcions, 0, 50, 320, 38, fondo, 0);
|
}
|
||||||
|
JD8_BlitCKToSurface(0, 50, opcions, 0, 50, 320, 38, fondo, 0);
|
||||||
|
|
||||||
x = 320;
|
|
||||||
while (!JG_Quitting() && x > 25) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_BlitCKCut(x, 88, opcions, 25, 88, 135, 37, 0);
|
|
||||||
JD8_Flip();
|
|
||||||
x--;
|
|
||||||
}
|
|
||||||
JD8_BlitCKToSurface(25, 88, opcions, 25, 88, 135, 37, fondo, 0);
|
|
||||||
|
|
||||||
x = 320;
|
// Movem la segona opció del menú al lloc
|
||||||
while (!JG_Quitting() && x > 0) {
|
x = 320;
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
while (!JG_Quitting() && x > 25) {
|
||||||
JD8_Blit(fondo);
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
JD8_BlitCKCut(x, 125, opcions, 0, 125, 320, 38, 0);
|
JD8_Blit(fondo);
|
||||||
JD8_Flip();
|
JD8_BlitCKCut(x, 88, opcions, 25, 88, 135, 37, 0);
|
||||||
x--;
|
JD8_Flip();
|
||||||
}
|
x--;
|
||||||
JD8_BlitCKToSurface(0, 125, opcions, 0, 125, 320, 38, fondo, 0);
|
}
|
||||||
|
JD8_BlitCKToSurface(25, 88, opcions, 25, 88, 135, 37, fondo, 0);
|
||||||
|
|
||||||
x = 320;
|
|
||||||
while (!JG_Quitting() && x > 0) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_BlitCKCut(x, 163, opcions, 0, 163, 320, 37, 0);
|
|
||||||
JD8_Flip();
|
|
||||||
x--;
|
|
||||||
}
|
|
||||||
JD8_BlitCKToSurface(0, 163, opcions, 0, 163, 320, 37, fondo, 0);
|
|
||||||
|
|
||||||
int y = 50;
|
// Movem la tercera opció del menú al lloc
|
||||||
while (!JG_Quitting() && y > 0) {
|
x = 320;
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
while (!JG_Quitting() && x > 0) {
|
||||||
JD8_Blit(fondo);
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
JD8_BlitCKCut(0, -y, opcions, 0, 0, 320, 50, 0);
|
JD8_Blit(fondo);
|
||||||
JD8_Flip();
|
JD8_BlitCKCut(x, 125, opcions, 0, 125, 320, 38, 0);
|
||||||
y--;
|
JD8_Flip();
|
||||||
}
|
x--;
|
||||||
JD8_BlitCKToSurface(0, 0, opcions, 0, 0, 320, 50, fondo, 0);
|
}
|
||||||
|
JD8_BlitCKToSurface(0, 125, opcions, 0, 125, 320, 38, fondo, 0);
|
||||||
|
|
||||||
int opcio_seleccionada = OPCIO_TIMEATTACK;
|
|
||||||
int opcio_triada = SENSE_OPCIO;
|
|
||||||
bool fletxa_amunt_pulsada = false;
|
|
||||||
bool fletxa_avall_pulsada = false;
|
|
||||||
float x_fletxa = 0;
|
|
||||||
float x_velocitat = 1;
|
|
||||||
|
|
||||||
JG_SetUpdateTicks(20);
|
// Movem la quarta opció del menú al lloc
|
||||||
|
x = 320;
|
||||||
|
while (!JG_Quitting() && x > 0) {
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
|
JD8_Blit(fondo);
|
||||||
|
JD8_BlitCKCut(x, 163, opcions, 0, 163, 320, 37, 0);
|
||||||
|
JD8_Flip();
|
||||||
|
x--;
|
||||||
|
}
|
||||||
|
JD8_BlitCKToSurface(0, 163, opcions, 0, 163, 320, 37, fondo, 0);
|
||||||
|
|
||||||
while (!JG_Quitting() && opcio_triada == SENSE_OPCIO) {
|
|
||||||
while (!JG_ShouldUpdate()) {
|
// Movem el titol del menú al lloc
|
||||||
JI_Update();
|
int y = 50;
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_UP)) {
|
while (!JG_Quitting() && y > 0) {
|
||||||
if (!fletxa_amunt_pulsada) {
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
fletxa_amunt_pulsada = true;
|
JD8_Blit(fondo);
|
||||||
opcio_seleccionada--; if (opcio_seleccionada < 0) opcio_seleccionada = 3;
|
JD8_BlitCKCut(0, -y, opcions, 0, 0, 320, 50, 0);
|
||||||
|
JD8_Flip();
|
||||||
|
y--;
|
||||||
|
}
|
||||||
|
JD8_BlitCKToSurface(0, 0, opcions, 0, 0, 320, 50, fondo, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// Variables necessaries per al menú
|
||||||
|
int opcio_seleccionada = OPCIO_TIMEATTACK;
|
||||||
|
int opcio_triada = SENSE_OPCIO;
|
||||||
|
bool fletxa_amunt_pulsada = false;
|
||||||
|
bool fletxa_avall_pulsada = false;
|
||||||
|
float x_fletxa = 0;
|
||||||
|
float x_velocitat = 1;
|
||||||
|
|
||||||
|
JG_SetUpdateTicks(20);
|
||||||
|
|
||||||
|
|
||||||
|
// Gestió del menú en sí (triar opció)
|
||||||
|
// [RZC 31/01/2024] [TODO] Al temps que se fiquen els marcadors
|
||||||
|
while (!JG_Quitting() && opcio_triada == SENSE_OPCIO)
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate())
|
||||||
|
{
|
||||||
|
JI_Update();
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_UP))
|
||||||
|
{
|
||||||
|
if (!fletxa_amunt_pulsada)
|
||||||
|
{
|
||||||
|
fletxa_amunt_pulsada = true;
|
||||||
|
opcio_seleccionada--; if (opcio_seleccionada < 0) opcio_seleccionada = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fletxa_amunt_pulsada = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_DOWN))
|
||||||
|
{
|
||||||
|
if (!fletxa_avall_pulsada)
|
||||||
|
{
|
||||||
|
fletxa_avall_pulsada = true;
|
||||||
|
opcio_seleccionada++; if (opcio_seleccionada > 3) opcio_seleccionada = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fletxa_avall_pulsada = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_SPACE))
|
||||||
|
{
|
||||||
|
opcio_triada = opcio_seleccionada;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_ESCAPE))
|
||||||
|
{
|
||||||
|
JG_QuitSignal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fletxa_amunt_pulsada = false;
|
x_fletxa += x_velocitat;
|
||||||
}
|
x_velocitat -= 0.1;
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_DOWN)) {
|
|
||||||
if (!fletxa_avall_pulsada) {
|
if (x_fletxa < 0)
|
||||||
fletxa_avall_pulsada = true;
|
{
|
||||||
opcio_seleccionada++; if (opcio_seleccionada > 3) opcio_seleccionada = 0;
|
x_fletxa = 0;
|
||||||
|
x_velocitat = 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fletxa_avall_pulsada = false;
|
JD8_Blit(fondo);
|
||||||
|
JD8_BlitCK(10+x_fletxa, 60+opcio_seleccionada*37, gfx, 18, 5, 9, 10, 255);
|
||||||
|
JD8_Flip();
|
||||||
}
|
}
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_SPACE)) {
|
JD8_BlitCKToSurface(10 + x_fletxa, 60 + opcio_seleccionada * 37, gfx, 18, 5, 9, 10, fondo, 255);
|
||||||
opcio_triada = opcio_seleccionada;
|
|
||||||
|
|
||||||
|
// Blinds out
|
||||||
|
JG_SetUpdateTicks(8);
|
||||||
|
x = 0;
|
||||||
|
while (x < 32 && !JG_Quitting())
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
|
|
||||||
|
for (y = 0; y < 200; y++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
JD8_PutPixel(fondo, i * 32 + x, y, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
JD8_Blit(fondo);
|
||||||
|
JD8_Flip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Alliberar memòria
|
||||||
|
JD8_FreeSurface(fondo);
|
||||||
|
JD8_FreeSurface(opcions);
|
||||||
|
JD8_FreeSurface(gfx);
|
||||||
|
free(pal);
|
||||||
|
|
||||||
|
|
||||||
|
// Canviar el estat al que toque
|
||||||
|
if (JG_Quitting())
|
||||||
|
{
|
||||||
|
info::estat_joc = ESTAT_EIXIR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (opcio_triada)
|
||||||
|
{
|
||||||
|
case OPCIO_TIMEATTACK: info::estat_joc = ESTAT_LOGO; break;
|
||||||
|
case OPCIO_WORLDTOUR: info::estat_joc = ESTAT_SELECT; break;
|
||||||
|
case OPCIO_CLASSICMODE: info::estat_joc = ESTAT_MENU; break;
|
||||||
|
case OPCIO_OPTIONS: info::estat_joc = ESTAT_MENU; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x_fletxa += x_velocitat;
|
|
||||||
x_velocitat -= 0.1;
|
|
||||||
|
|
||||||
if (x_fletxa < 0) {
|
|
||||||
x_fletxa = 0;
|
|
||||||
x_velocitat = 1;
|
|
||||||
}
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_BlitCK(10+x_fletxa, 60+opcio_seleccionada*37, gfx, 18, 5, 9, 10, 255);
|
|
||||||
JD8_Flip();
|
|
||||||
}
|
}
|
||||||
JD8_BlitCKToSurface(10 + x_fletxa, 60 + opcio_seleccionada * 37, gfx, 18, 5, 9, 10, fondo, 255);
|
|
||||||
|
|
||||||
// BLINDS OUT
|
|
||||||
JG_SetUpdateTicks(8);
|
|
||||||
x = 0;
|
|
||||||
while (x < 32 && !JG_Quitting()) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
|
|
||||||
for (y = 0; y < 200; y++) {
|
|
||||||
for (int i = 0; i < 10; i++) {
|
|
||||||
JD8_PutPixel(fondo, i * 32 + x, y, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_Flip();
|
|
||||||
}
|
|
||||||
|
|
||||||
// FREE EVERYTHING
|
|
||||||
JD8_FreeSurface(fondo);
|
|
||||||
JD8_FreeSurface(opcions);
|
|
||||||
JD8_FreeSurface(gfx);
|
|
||||||
free(pal);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (JG_Quitting()) {
|
|
||||||
return ESTAT_EIXIR;
|
|
||||||
} else {
|
|
||||||
switch (opcio_triada) {
|
|
||||||
case OPCIO_TIMEATTACK: return ESTAT_LOGO; break;
|
|
||||||
case OPCIO_WORLDTOUR: return ESTAT_SELECT; break;
|
|
||||||
case OPCIO_CLASSICMODE: return ESTAT_MENU; break;
|
|
||||||
case OPCIO_OPTIONS: return ESTAT_MENU; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ESTAT_EIXIR;
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
modulemenu.h
20
modulemenu.h
@@ -1,20 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "info.h"
|
|
||||||
|
|
||||||
class ModuleMenu {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ModuleMenu(Info* info);
|
|
||||||
~ModuleMenu(void);
|
|
||||||
|
|
||||||
int Go();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//void showMenu();
|
|
||||||
|
|
||||||
Info* info;
|
|
||||||
int contador;
|
|
||||||
};
|
|
||||||
9
modules.h
Normal file
9
modules.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace module
|
||||||
|
{
|
||||||
|
namespace staticScreen { void go(); }
|
||||||
|
namespace menu { void go(); }
|
||||||
|
namespace select { void go(); }
|
||||||
|
namespace sequence { void go(); }
|
||||||
|
}
|
||||||
333
moduleselect.cpp
333
moduleselect.cpp
@@ -1,4 +1,4 @@
|
|||||||
#include "moduleselect.h"
|
#include "modules.h"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "jgame.h"
|
||||||
#include "jdraw8.h"
|
#include "jdraw8.h"
|
||||||
@@ -6,167 +6,202 @@
|
|||||||
#include "jsound.h"
|
#include "jsound.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "info.h"
|
||||||
|
|
||||||
ModuleSelect::ModuleSelect(Info* info) {
|
namespace module
|
||||||
this->info = info;
|
{
|
||||||
}
|
namespace select
|
||||||
|
{
|
||||||
|
void go()
|
||||||
|
{
|
||||||
|
// Inicialitzem gràfics
|
||||||
|
JD8_Surface fondo = JD8_LoadSurface("select.gif");
|
||||||
|
JD8_Palette pal = JD8_LoadPalette("select.gif");
|
||||||
|
JD8_Surface gfx = JD8_LoadSurface("sprites.gif");
|
||||||
|
|
||||||
ModuleSelect::~ModuleSelect(void) {
|
int num_personatges = 3;
|
||||||
}
|
|
||||||
|
|
||||||
void pintaMarc(int posicio) {
|
// Llevem els persoantges que encara no estàn desbloquejats
|
||||||
for (int i = posicio; i <= posicio + 75; i++) {
|
if (!info::rosita_enabled)
|
||||||
JD8_PutPixel(i, 11, 15);
|
{
|
||||||
JD8_PutPixel(i, 12, 15);
|
num_personatges--;
|
||||||
JD8_PutPixel(i, 90, 15);
|
for (int i = 137; i <= 212; i++) for (int j = 11; j <= 91; j++) JD8_PutPixel(fondo, i, j, 0);
|
||||||
JD8_PutPixel(i, 91, 15);
|
JD8_PutPixel(fondo, 145, 19, 14);
|
||||||
}
|
JD8_PutPixel(fondo, 197, 44, 14);
|
||||||
for (int i = 11; i <= 91; i++) {
|
JD8_PutPixel(fondo, 149, 78, 14);
|
||||||
JD8_PutPixel(posicio, i, 15);
|
JD8_PutPixel(fondo, 194, 77, 14);
|
||||||
JD8_PutPixel(posicio + 1, i, 15);
|
JD8_PutPixel(fondo, 172, 54, 14);
|
||||||
JD8_PutPixel(posicio + 74, i, 15);
|
JD8_PutPixel(fondo, 198, 65, 14);
|
||||||
JD8_PutPixel(posicio + 75, i, 15);
|
JD8_PutPixel(fondo, 177, 38, 9);
|
||||||
}
|
JD8_PutPixel(fondo, 169, 82, 9);
|
||||||
}
|
JD8_PutPixel(fondo, 183, 12, 9);
|
||||||
|
JD8_PutPixel(fondo, 139, 37, 9);
|
||||||
int ModuleSelect::Go() {
|
JD8_PutPixel(fondo, 211, 81, 9);
|
||||||
|
}
|
||||||
JD8_Surface fondo = JD8_LoadSurface("select.gif");
|
if (!info::job_enabled)
|
||||||
JD8_Palette pal = JD8_LoadPalette("select.gif");
|
{
|
||||||
JD8_Surface gfx = JD8_LoadSurface("sprites.gif");
|
num_personatges--;
|
||||||
|
for (int i = 219; i <= 294; i++) for (int j = 11; j <= 91; j++) JD8_PutPixel(fondo, i, j, 0);
|
||||||
int num_personatges = 3;
|
JD8_PutPixel(fondo, 228, 65, 14);
|
||||||
|
JD8_PutPixel(fondo, 290, 26, 14);
|
||||||
if (!this->info->rosita_enabled) {
|
JD8_PutPixel(fondo, 264, 63, 14);
|
||||||
num_personatges--;
|
JD8_PutPixel(fondo, 284, 85, 14);
|
||||||
for (int i = 137; i <= 212; i++) for (int j = 11; j <= 91; j++) JD8_PutPixel(fondo, i, j, 0);
|
JD8_PutPixel(fondo, 262, 13, 14);
|
||||||
JD8_PutPixel(fondo, 145, 19, 14);
|
JD8_PutPixel(fondo, 239, 46, 14);
|
||||||
JD8_PutPixel(fondo, 197, 44, 14);
|
JD8_PutPixel(fondo, 266, 74, 9);
|
||||||
JD8_PutPixel(fondo, 149, 78, 14);
|
JD8_PutPixel(fondo, 264, 21, 9);
|
||||||
JD8_PutPixel(fondo, 194, 77, 14);
|
JD8_PutPixel(fondo, 248, 84, 9);
|
||||||
JD8_PutPixel(fondo, 172, 54, 14);
|
JD8_PutPixel(fondo, 279, 87, 9);
|
||||||
JD8_PutPixel(fondo, 198, 65, 14);
|
JD8_PutPixel(fondo, 254, 39, 9);
|
||||||
JD8_PutPixel(fondo, 177, 38, 9);
|
|
||||||
JD8_PutPixel(fondo, 169, 82, 9);
|
|
||||||
JD8_PutPixel(fondo, 183, 12, 9);
|
|
||||||
JD8_PutPixel(fondo, 139, 37, 9);
|
|
||||||
JD8_PutPixel(fondo, 211, 81, 9);
|
|
||||||
}
|
|
||||||
if (!this->info->job_enabled) {
|
|
||||||
num_personatges--;
|
|
||||||
for (int i = 219; i <= 294; i++) for (int j = 11; j <= 91; j++) JD8_PutPixel(fondo, i, j, 0);
|
|
||||||
JD8_PutPixel(fondo, 228, 65, 14);
|
|
||||||
JD8_PutPixel(fondo, 290, 26, 14);
|
|
||||||
JD8_PutPixel(fondo, 264, 63, 14);
|
|
||||||
JD8_PutPixel(fondo, 284, 85, 14);
|
|
||||||
JD8_PutPixel(fondo, 262, 13, 14);
|
|
||||||
JD8_PutPixel(fondo, 239, 46, 14);
|
|
||||||
JD8_PutPixel(fondo, 266, 74, 9);
|
|
||||||
JD8_PutPixel(fondo, 264, 21, 9);
|
|
||||||
JD8_PutPixel(fondo, 248, 84, 9);
|
|
||||||
JD8_PutPixel(fondo, 279, 87, 9);
|
|
||||||
JD8_PutPixel(fondo, 254, 39, 9);
|
|
||||||
}
|
|
||||||
|
|
||||||
JD8_ClearScreen(0);
|
|
||||||
JD8_Flip();
|
|
||||||
|
|
||||||
// FADE IN
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JG_SetUpdateTicks(1);
|
|
||||||
while (!JD8_FadeToPalAsync(pal) && !JG_Quitting()) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
int opcio_seleccionada = this->info->dificultat;
|
|
||||||
int opcio_triada = SENSE_OPCIO;
|
|
||||||
int personatge_seleccionat = this->info->personatge;
|
|
||||||
bool fletxa_amunt_pulsada = false;
|
|
||||||
bool fletxa_avall_pulsada = false;
|
|
||||||
bool fletxa_esquerra_pulsada = false;
|
|
||||||
bool fletxa_dreta_pulsada = false;
|
|
||||||
|
|
||||||
JG_SetUpdateTicks(20);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int G = 0;
|
|
||||||
int B = 0;
|
|
||||||
|
|
||||||
while (!JG_Quitting() && opcio_triada == SENSE_OPCIO) {
|
|
||||||
while (!JG_ShouldUpdate()) {
|
|
||||||
JI_Update();
|
|
||||||
|
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_UP)) {
|
|
||||||
if (!fletxa_amunt_pulsada) {
|
|
||||||
fletxa_amunt_pulsada = true;
|
|
||||||
opcio_seleccionada--; if (opcio_seleccionada < 0) opcio_seleccionada = 2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fletxa_amunt_pulsada = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_DOWN)) {
|
JD8_ClearScreen(0);
|
||||||
if (!fletxa_avall_pulsada) {
|
JD8_Flip();
|
||||||
fletxa_avall_pulsada = true;
|
|
||||||
opcio_seleccionada++; if (opcio_seleccionada > 2) opcio_seleccionada = 0;
|
|
||||||
}
|
// Fade in
|
||||||
} else {
|
JD8_Blit(fondo);
|
||||||
fletxa_avall_pulsada = false;
|
JG_SetUpdateTicks(1);
|
||||||
|
while (!JD8_FadeToPalAsync(pal) && !JG_Quitting())
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_LEFT)) {
|
// Variables necessaries per a triar personatge i dificultat
|
||||||
if (!fletxa_esquerra_pulsada) {
|
int opcio_seleccionada = info::dificultat;
|
||||||
fletxa_esquerra_pulsada = true;
|
int opcio_triada = SENSE_OPCIO;
|
||||||
personatge_seleccionat--; if (personatge_seleccionat < 0) personatge_seleccionat = num_personatges-1;
|
int personatge_seleccionat = info::personatge;
|
||||||
|
bool fletxa_amunt_pulsada = false;
|
||||||
|
bool fletxa_avall_pulsada = false;
|
||||||
|
bool fletxa_esquerra_pulsada = false;
|
||||||
|
bool fletxa_dreta_pulsada = false;
|
||||||
|
|
||||||
|
JG_SetUpdateTicks(20);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
int G = 0;
|
||||||
|
int B = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Ací se controla la tria de opcions en sí
|
||||||
|
while (!JG_Quitting() && opcio_triada == SENSE_OPCIO)
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate())
|
||||||
|
{
|
||||||
|
JI_Update();
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_UP))
|
||||||
|
{
|
||||||
|
if (!fletxa_amunt_pulsada)
|
||||||
|
{
|
||||||
|
fletxa_amunt_pulsada = true;
|
||||||
|
opcio_seleccionada--; if (opcio_seleccionada < 0) opcio_seleccionada = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fletxa_amunt_pulsada = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_DOWN))
|
||||||
|
{
|
||||||
|
if (!fletxa_avall_pulsada)
|
||||||
|
{
|
||||||
|
fletxa_avall_pulsada = true;
|
||||||
|
opcio_seleccionada++; if (opcio_seleccionada > 2) opcio_seleccionada = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fletxa_avall_pulsada = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_LEFT))
|
||||||
|
{
|
||||||
|
if (!fletxa_esquerra_pulsada)
|
||||||
|
{
|
||||||
|
fletxa_esquerra_pulsada = true;
|
||||||
|
personatge_seleccionat--; if (personatge_seleccionat < 0) personatge_seleccionat = num_personatges-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fletxa_esquerra_pulsada = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_RIGHT))
|
||||||
|
{
|
||||||
|
if (!fletxa_dreta_pulsada)
|
||||||
|
{
|
||||||
|
fletxa_dreta_pulsada = true;
|
||||||
|
personatge_seleccionat++; if (personatge_seleccionat > num_personatges-1) personatge_seleccionat = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fletxa_dreta_pulsada = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JI_KeyPressed(SDL_SCANCODE_SPACE))
|
||||||
|
{
|
||||||
|
opcio_triada = opcio_seleccionada;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fletxa_esquerra_pulsada = false;
|
// Fer cicle dels colorets de la vora del personatge
|
||||||
|
i = (i + 1) % 127;
|
||||||
|
G = B = abs(63-i);
|
||||||
|
JD8_SetPaletteColor(15, 252, G, B);
|
||||||
|
|
||||||
|
|
||||||
|
// Pintar-ho tot
|
||||||
|
JD8_Blit(fondo);
|
||||||
|
|
||||||
|
const int posicio = 55 + personatge_seleccionat * 82;
|
||||||
|
for (int i = posicio; i <= posicio + 75; i++) {
|
||||||
|
JD8_PutPixel(i, 11, 15);
|
||||||
|
JD8_PutPixel(i, 12, 15);
|
||||||
|
JD8_PutPixel(i, 90, 15);
|
||||||
|
JD8_PutPixel(i, 91, 15);
|
||||||
|
}
|
||||||
|
for (int i = 11; i <= 91; i++) {
|
||||||
|
JD8_PutPixel(posicio, i, 15);
|
||||||
|
JD8_PutPixel(posicio + 1, i, 15);
|
||||||
|
JD8_PutPixel(posicio + 74, i, 15);
|
||||||
|
JD8_PutPixel(posicio + 75, i, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
JD8_BlitCK(100, 120 + opcio_seleccionada * 25, gfx, 9, 5, 9, 10, 255);
|
||||||
|
JD8_Flip();
|
||||||
|
}
|
||||||
|
JD8_BlitCKToSurface(100, 120 + opcio_seleccionada * 25, gfx, 9, 5, 9, 10, fondo, 255);
|
||||||
|
|
||||||
|
|
||||||
|
// Fade out
|
||||||
|
JG_SetUpdateTicks(2);
|
||||||
|
while (!JD8_FadeOutAsync() && !JG_Quitting())
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_RIGHT)) {
|
// Alliberem memòria
|
||||||
if (!fletxa_dreta_pulsada) {
|
JD8_FreeSurface(fondo);
|
||||||
fletxa_dreta_pulsada = true;
|
JD8_FreeSurface(gfx);
|
||||||
personatge_seleccionat++; if (personatge_seleccionat > num_personatges-1) personatge_seleccionat = 0;
|
free(pal);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fletxa_dreta_pulsada = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JI_KeyPressed(SDL_SCANCODE_SPACE)) {
|
|
||||||
opcio_triada = opcio_seleccionada;
|
// Canviar el estat al que toque
|
||||||
|
if (JG_Quitting())
|
||||||
|
{
|
||||||
|
info::estat_joc = ESTAT_EIXIR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info::dificultat = opcio_triada;
|
||||||
|
info::personatge = personatge_seleccionat;
|
||||||
|
info::estat_joc = ESTAT_SEQUENCIA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = (i + 1) % 127;
|
|
||||||
G = B = abs(63-i);
|
|
||||||
JD8_SetPaletteColor(15, 252, G, B);
|
|
||||||
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
pintaMarc(55 + personatge_seleccionat * 82);
|
|
||||||
JD8_BlitCK(100, 120 + opcio_seleccionada * 25, gfx, 9, 5, 9, 10, 255);
|
|
||||||
JD8_Flip();
|
|
||||||
}
|
|
||||||
JD8_BlitCKToSurface(100, 120 + opcio_seleccionada * 25, gfx, 9, 5, 9, 10, fondo, 255);
|
|
||||||
|
|
||||||
// FADE OUT
|
|
||||||
JG_SetUpdateTicks(2);
|
|
||||||
while (!JD8_FadeOutAsync() && !JG_Quitting()) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// FREE EVERYTHING
|
|
||||||
JD8_FreeSurface(fondo);
|
|
||||||
JD8_FreeSurface(gfx);
|
|
||||||
free(pal);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (JG_Quitting()) {
|
|
||||||
return ESTAT_EIXIR;
|
|
||||||
} else {
|
|
||||||
this->info->dificultat = opcio_triada;
|
|
||||||
this->info->personatge = personatge_seleccionat;
|
|
||||||
return ESTAT_SEQUENCIA;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "info.h"
|
|
||||||
|
|
||||||
class ModuleSelect {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ModuleSelect(Info* info);
|
|
||||||
~ModuleSelect(void);
|
|
||||||
|
|
||||||
int Go();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Info* info;
|
|
||||||
};
|
|
||||||
@@ -1,229 +1,199 @@
|
|||||||
#include "modulesequence.h"
|
#include "modules.h"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "jgame.h"
|
||||||
#include "jdraw8.h"
|
#include "jdraw8.h"
|
||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
#include "jsound.h"
|
#include "jsound.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include "info.h"
|
||||||
|
|
||||||
JD8_Surface gfx = nullptr;
|
namespace module
|
||||||
JD8_Surface fondo = nullptr;
|
{
|
||||||
JD8_Palette pal = nullptr;
|
namespace sequence
|
||||||
|
{
|
||||||
|
JD8_Surface gfx = nullptr;
|
||||||
|
JD8_Surface fondo = nullptr;
|
||||||
|
JD8_Surface fondo_temp = nullptr;
|
||||||
|
JD8_Palette pal = nullptr;
|
||||||
|
|
||||||
ModuleSequence::ModuleSequence(Info* info) {
|
void fadeIn()
|
||||||
this->info = info;
|
{
|
||||||
gfx = nullptr;
|
|
||||||
fondo = nullptr;
|
|
||||||
pal = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleSequence::~ModuleSequence(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
int ModuleSequence::Go() {
|
|
||||||
|
|
||||||
JS_LoadMusic("mhist.mid");
|
|
||||||
JS_PlayMusic(-1);
|
|
||||||
|
|
||||||
gfx = JD8_LoadSurface("sprites.gif");
|
|
||||||
|
|
||||||
JD8_ClearScreen(0);
|
|
||||||
JD8_Flip();
|
|
||||||
|
|
||||||
fondo = JD8_LoadSurface("hist01.gif");
|
|
||||||
pal = JD8_LoadPalette("hist01.gif");
|
|
||||||
this->FadeIn();
|
|
||||||
this->ShowText(40, 90, 2, 10, "QUE BON DIA FA NO CREUS PEPE");
|
|
||||||
this->ShowText(50, 80, 10, 10, "EEEE..SS..SSIII.SI");
|
|
||||||
this->ShowText(140, 140, 2, 10, "[SEMPRE QUE M^ACOSTE", "A PEPE ES POSA RARO\\");
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_Flip();
|
|
||||||
this->Wait(200);
|
|
||||||
this->FadeOut();
|
|
||||||
JD8_FreeSurface(fondo);
|
|
||||||
free(pal);
|
|
||||||
|
|
||||||
if (!JG_Quitting()) {
|
|
||||||
fondo = JD8_LoadSurface("hist02.gif");
|
|
||||||
pal = JD8_LoadPalette("hist02.gif");
|
|
||||||
this->FadeIn();
|
|
||||||
this->ShowText(100, 140, 10, 10, "AAAAY a");
|
|
||||||
this->ShowText(100, 55, 3, 10, "JA T^HE PILLAT PEPE");
|
|
||||||
this->ShowText(145, 125, 2, 1, "AUXILIa");
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_Flip();
|
|
||||||
this->Wait(200);
|
|
||||||
this->FadeOut();
|
|
||||||
JD8_FreeSurface(fondo);
|
|
||||||
free(pal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!JG_Quitting()) {
|
|
||||||
fondo = JD8_LoadSurface("hist03.gif");
|
|
||||||
pal = JD8_LoadPalette("hist03.gif");
|
|
||||||
this->FadeIn();
|
|
||||||
this->ShowText(50, 80, 5, 10, "ARA ROSITA ES MEUA");
|
|
||||||
this->ShowText(50, 80, 5, 10, "SI VOLS ACONSEGUIR_LA", "HAURAS DE SEGUIR_ME", "PER TOT EL MONb");
|
|
||||||
this->ShowText(60, 80, 5, 1, "JA JA JA JA JA aa");
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JD8_Flip();
|
|
||||||
this->Wait(200);
|
|
||||||
this->FadeOut();
|
|
||||||
JD8_FreeSurface(fondo);
|
|
||||||
free(pal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!JG_Quitting()) {
|
|
||||||
fondo = JD8_LoadSurface("hist04.gif");
|
|
||||||
pal = JD8_LoadPalette("hist04.gif");
|
|
||||||
this->FadeIn();
|
|
||||||
this->ShowText(120, 60, 2, 5, "AJUDA^M PEPEa");
|
|
||||||
this->ShowText(50, 50, 7, 50, "MALEIT SIGUES", "ET TROBAREbbb");
|
|
||||||
this->FadeOut();
|
|
||||||
JD8_FreeSurface(fondo);
|
|
||||||
free(pal);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FREE EVERYTHING
|
|
||||||
JD8_FreeSurface(gfx);
|
|
||||||
|
|
||||||
if (JG_Quitting()) {
|
|
||||||
return ESTAT_EIXIR;
|
|
||||||
} else {
|
|
||||||
return ESTAT_JOC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModuleSequence::FadeIn() {
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
JG_SetUpdateTicks(1);
|
|
||||||
while (!JD8_FadeToPalAsync(pal) && !JG_Quitting()) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModuleSequence::FadeOut() {
|
|
||||||
JG_SetUpdateTicks(2);
|
|
||||||
while (!JD8_FadeOutAsync() && !JG_Quitting()) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModuleSequence::ShowText(int x, int y, int color, int speed, const char * text1, const char * text2, const char * text3) {
|
|
||||||
bool eixir = false;
|
|
||||||
|
|
||||||
JG_SetUpdateTicks(10);
|
|
||||||
JD8_SetPaletteColor(254, color);
|
|
||||||
|
|
||||||
// mod 35
|
|
||||||
// A (65) = 23 -> char - 42
|
|
||||||
// Special chars: ( ) <20> ' - : ! .
|
|
||||||
// [ \ ] ^ _ ` a b
|
|
||||||
|
|
||||||
int tamany_text1 = strlen(text1);
|
|
||||||
int temps_total = tamany_text1 * speed;
|
|
||||||
int temps_inicial = JG_GetCycleCounter();
|
|
||||||
|
|
||||||
while ((JG_GetCycleCounter() - temps_inicial < temps_total) && !eixir && !JG_Quitting()) {
|
|
||||||
JD8_Blit(fondo);
|
|
||||||
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
|
||||||
|
|
||||||
for (int i = 0; i <= num_chars_actual; i++) {
|
|
||||||
int char_actual = text1[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text1[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i+1) * 8, y, gfx, (char_actual % 35) * 9, 6+floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey()) { eixir = true; } }
|
|
||||||
JD8_Flip();
|
|
||||||
}
|
|
||||||
if (eixir) {
|
|
||||||
for (int i = 0; i <= tamany_text1; i++) {
|
|
||||||
int char_actual = text1[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text1[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text2 != NULL) {
|
|
||||||
int tamany_text2 = strlen(text2);
|
|
||||||
temps_total = tamany_text2 * speed;
|
|
||||||
temps_inicial = JG_GetCycleCounter();
|
|
||||||
|
|
||||||
while ((JG_GetCycleCounter() - temps_inicial < temps_total) && !eixir && !JG_Quitting()) {
|
|
||||||
JD8_Blit(fondo);
|
JD8_Blit(fondo);
|
||||||
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
JG_SetUpdateTicks(1);
|
||||||
|
while (!JD8_FadeToPalAsync(pal) && !JG_Quitting())
|
||||||
for (int i = 0; i <= tamany_text1; i++) {
|
{
|
||||||
int char_actual = text1[i] - 42; if (char_actual < 0) char_actual = 57;
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
if (text1[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i <= num_chars_actual; i++) {
|
|
||||||
int char_actual = text2[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text2[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y+10, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey()) { eixir = true; } }
|
|
||||||
JD8_Flip();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eixir) {
|
|
||||||
for (int i = 0; i <= tamany_text2; i++) {
|
|
||||||
int char_actual = text2[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text2[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y + 10, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text3 != NULL) {
|
void fadeOut()
|
||||||
int tamany_text3 = strlen(text3);
|
{
|
||||||
temps_total = tamany_text3 * speed;
|
JG_SetUpdateTicks(2);
|
||||||
temps_inicial = JG_GetCycleCounter();
|
while (!JD8_FadeOutAsync() && !JG_Quitting())
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while ((JG_GetCycleCounter() - temps_inicial < temps_total) && !eixir && !JG_Quitting()) {
|
void drawChar(int x, int y, char char_actual)
|
||||||
JD8_Blit(fondo);
|
{
|
||||||
|
char_actual -= 42; if (char_actual < 0) char_actual = 57;
|
||||||
|
if (char_actual == 4) char_actual = 56;
|
||||||
|
JD8_BlitCKToSurface(x, y, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, fondo_temp, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wait(int time)
|
||||||
|
{
|
||||||
|
bool eixir = false;
|
||||||
|
int temps_inicial = JG_GetCycleCounter();
|
||||||
|
while ((JG_GetCycleCounter() - temps_inicial < time) && !eixir)
|
||||||
|
{
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showText(int x, int y, int color, int speed, const char * text1, const char * text2 = NULL, const char * text3 = NULL)
|
||||||
|
{
|
||||||
|
bool eixir = false;
|
||||||
|
|
||||||
|
fondo_temp = JD8_NewSurface(320, 200);
|
||||||
|
JD8_BlitToSurface(0, 0, fondo, 0, 0, 320, 200, fondo_temp);
|
||||||
|
JD8_Blit(fondo_temp);
|
||||||
|
|
||||||
|
JG_SetUpdateTicks(10);
|
||||||
|
JD8_SetPaletteColor(254, color);
|
||||||
|
|
||||||
|
// mod 35
|
||||||
|
// A (65) = 23 -> char - 42
|
||||||
|
// Special chars: ( ) <20> ' - : ! .
|
||||||
|
// [ \ ] ^ _ ` a b
|
||||||
|
|
||||||
|
int tamany_text = strlen(text1);
|
||||||
|
int temps_total = tamany_text * speed;
|
||||||
|
int temps_inicial = JG_GetCycleCounter();
|
||||||
|
|
||||||
|
while ((JG_GetCycleCounter() - temps_inicial < temps_total) && !eixir && !JG_Quitting())
|
||||||
|
{
|
||||||
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
||||||
|
drawChar(x + (num_chars_actual + 1) * 8, y, text1[num_chars_actual]);
|
||||||
|
|
||||||
for (int i = 0; i <= tamany_text1; i++) {
|
|
||||||
int char_actual = text1[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text1[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i <= tamany_text2; i++) {
|
|
||||||
int char_actual = text2[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text2[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y+10, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i <= num_chars_actual; i++) {
|
|
||||||
int char_actual = text3[i] - 42; if (char_actual < 0) char_actual = 57;
|
|
||||||
if (text3[i] == '.') char_actual = 56;
|
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y + 20, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
|
||||||
}
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey()) { eixir = true; } }
|
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey()) { eixir = true; } }
|
||||||
|
JD8_Blit(fondo_temp);
|
||||||
JD8_Flip();
|
JD8_Flip();
|
||||||
}
|
}
|
||||||
|
if (eixir) for (int i = 0; i <= tamany_text; i++) drawChar(x + (i + 1) * 8, y, text1[i]);
|
||||||
|
|
||||||
for (int i = 0; i <= tamany_text3; i++) {
|
|
||||||
int char_actual = text3[i] - 42; if (char_actual < 0) char_actual = 57;
|
if (text2 != NULL)
|
||||||
if (text3[i] == '.') char_actual = 56;
|
{
|
||||||
JD8_BlitCK(x + (i + 1) * 8, y + 20, gfx, (char_actual % 35) * 9, 6 + floorf(char_actual / 35) * 9, 9, 9, 255);
|
tamany_text = strlen(text2);
|
||||||
|
temps_total = tamany_text * speed;
|
||||||
|
temps_inicial = JG_GetCycleCounter();
|
||||||
|
|
||||||
|
while ((JG_GetCycleCounter() - temps_inicial < temps_total) && !eixir && !JG_Quitting())
|
||||||
|
{
|
||||||
|
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
||||||
|
drawChar(x + (num_chars_actual + 1) * 8, y+10, text2[num_chars_actual]);
|
||||||
|
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey()) { eixir = true; } }
|
||||||
|
JD8_Blit(fondo_temp);
|
||||||
|
JD8_Flip();
|
||||||
|
}
|
||||||
|
if (eixir) for (int i = 0; i <= tamany_text; i++) drawChar(x + (i + 1) * 8, y+10, text2[i]);
|
||||||
|
|
||||||
|
if (text3 != NULL)
|
||||||
|
{
|
||||||
|
tamany_text = strlen(text3);
|
||||||
|
temps_total = tamany_text * speed;
|
||||||
|
temps_inicial = JG_GetCycleCounter();
|
||||||
|
|
||||||
|
while ((JG_GetCycleCounter() - temps_inicial < temps_total) && !eixir && !JG_Quitting())
|
||||||
|
{
|
||||||
|
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
||||||
|
drawChar(x + (num_chars_actual + 1) * 8, y+20, text3[num_chars_actual]);
|
||||||
|
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey()) { eixir = true; } }
|
||||||
|
JD8_Blit(fondo_temp);
|
||||||
|
JD8_Flip();
|
||||||
|
}
|
||||||
|
if (eixir) for (int i = 0; i <= tamany_text; i++) drawChar(x + (i + 1) * 8, y+10, text3[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JD8_Blit(fondo_temp);
|
||||||
JD8_Flip();
|
JD8_Flip();
|
||||||
|
wait(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
void go()
|
||||||
|
{
|
||||||
|
JS_LoadMusic("mhist.mid");
|
||||||
|
JS_PlayMusic(-1);
|
||||||
|
|
||||||
|
gfx = JD8_LoadSurface("sprites.gif");
|
||||||
|
|
||||||
|
JD8_ClearScreen(0);
|
||||||
|
JD8_Flip();
|
||||||
|
|
||||||
|
fondo = JD8_LoadSurface("hist01.gif");
|
||||||
|
pal = JD8_LoadPalette("hist01.gif");
|
||||||
|
fadeIn();
|
||||||
|
showText(40, 90, 2, 10, "QUE BON DIA FA NO CREUS PEPE");
|
||||||
|
showText(50, 80, 10, 10, "EEEE..SS..SSIII.SI");
|
||||||
|
showText(140, 140, 2, 10, "[SEMPRE QUE M^ACOSTE", "A PEPE ES POSA RARO\\");
|
||||||
|
wait(200);
|
||||||
|
fadeOut();
|
||||||
|
JD8_FreeSurface(fondo);
|
||||||
|
free(pal);
|
||||||
|
|
||||||
|
if (!JG_Quitting())
|
||||||
|
{
|
||||||
|
fondo = JD8_LoadSurface("hist02.gif");
|
||||||
|
pal = JD8_LoadPalette("hist02.gif");
|
||||||
|
fadeIn();
|
||||||
|
showText(100, 140, 10, 10, "AAAAY a");
|
||||||
|
showText(100, 55, 3, 10, "JA T^HE PILLAT PEPE");
|
||||||
|
showText(145, 125, 2, 1, "AUXILIa");
|
||||||
|
wait(200);
|
||||||
|
fadeOut();
|
||||||
|
JD8_FreeSurface(fondo);
|
||||||
|
free(pal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JG_Quitting())
|
||||||
|
{
|
||||||
|
fondo = JD8_LoadSurface("hist03.gif");
|
||||||
|
pal = JD8_LoadPalette("hist03.gif");
|
||||||
|
fadeIn();
|
||||||
|
showText(50, 80, 5, 10, "ARA ROSITA ES MEUA");
|
||||||
|
showText(50, 80, 5, 10, "SI VOLS ACONSEGUIR_LA", "HAURAS DE SEGUIR_ME", "PER TOT EL MONb");
|
||||||
|
showText(60, 80, 5, 1, "JA JA JA JA JA aa");
|
||||||
|
wait(200);
|
||||||
|
fadeOut();
|
||||||
|
JD8_FreeSurface(fondo);
|
||||||
|
free(pal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JG_Quitting())
|
||||||
|
{
|
||||||
|
fondo = JD8_LoadSurface("hist04.gif");
|
||||||
|
pal = JD8_LoadPalette("hist04.gif");
|
||||||
|
fadeIn();
|
||||||
|
showText(120, 60, 2, 5, "AJUDA^M PEPEa");
|
||||||
|
showText(50, 50, 7, 50, "MALEIT SIGUES", "ET TROBAREbbb");
|
||||||
|
fadeOut();
|
||||||
|
JD8_FreeSurface(fondo);
|
||||||
|
free(pal);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FREE EVERYTHING
|
||||||
|
JD8_FreeSurface(gfx);
|
||||||
|
|
||||||
|
if (JG_Quitting()) {
|
||||||
|
info::estat_joc = ESTAT_EIXIR;
|
||||||
|
} else {
|
||||||
|
info::estat_joc = ESTAT_MENU;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JD8_Flip();
|
|
||||||
Wait(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModuleSequence::Wait(int time) {
|
|
||||||
bool eixir = false;
|
|
||||||
int temps_inicial = JG_GetCycleCounter();
|
|
||||||
while ((JG_GetCycleCounter() - temps_inicial < time) && !eixir) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "info.h"
|
|
||||||
|
|
||||||
class ModuleSequence {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ModuleSequence(Info* info);
|
|
||||||
~ModuleSequence(void);
|
|
||||||
|
|
||||||
int Go();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Info * info;
|
|
||||||
|
|
||||||
void FadeIn();
|
|
||||||
void FadeOut();
|
|
||||||
void ShowText(int x, int y, int color, int speed, const char* text1, const char* text2 = nullptr, const char* text3 = nullptr);
|
|
||||||
void Wait(int time);
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "modulestaticscreen.h"
|
#include "modules.h"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "jgame.h"
|
||||||
#include "jdraw8.h"
|
#include "jdraw8.h"
|
||||||
@@ -6,111 +6,84 @@
|
|||||||
#include "jsound.h"
|
#include "jsound.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "info.h"
|
||||||
|
|
||||||
ModuleStaticScreen::ModuleStaticScreen( Info* info ) {
|
|
||||||
this->info = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleStaticScreen::~ModuleStaticScreen(void) {
|
namespace module
|
||||||
}
|
{
|
||||||
|
namespace staticScreen
|
||||||
|
{
|
||||||
|
void go()
|
||||||
|
{
|
||||||
|
bool eixir = false;
|
||||||
|
JD8_Surface gfx = nullptr;
|
||||||
|
JD8_Palette pal = nullptr;
|
||||||
|
|
||||||
int ModuleStaticScreen::Go() {
|
// Carrega grafics i música
|
||||||
|
switch( info::estat_joc ) {
|
||||||
|
case ESTAT_ICEKAS:
|
||||||
|
JS_LoadMusic("mlogo.mid");
|
||||||
|
JS_PlayMusic(1);
|
||||||
|
|
||||||
switch( this->info->estat_joc ) {
|
gfx = JD8_LoadSurface( "logo.gif" );
|
||||||
case ESTAT_ICEKAS:
|
pal = JD8_LoadPalette( "logo.gif" );
|
||||||
doIcekas();
|
break;
|
||||||
break;
|
|
||||||
case ESTAT_LOGO:
|
|
||||||
doLogo();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
JD8_FadeOut();
|
case ESTAT_LOGO:
|
||||||
|
gfx = JD8_LoadSurface("titol.gif");
|
||||||
|
pal = JD8_LoadPalette("titol.gif");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if( JG_Quitting() ) {
|
// Fade in
|
||||||
return ESTAT_EIXIR;
|
JD8_Blit(gfx);
|
||||||
} else {
|
JG_SetUpdateTicks(8);
|
||||||
switch (this->info->estat_joc) {
|
while (!JD8_FadeToPalAsync(pal))
|
||||||
case ESTAT_ICEKAS: return ESTAT_LOGO; break;
|
{
|
||||||
case ESTAT_LOGO: return ESTAT_MENU; break;
|
while (!JG_ShouldUpdate())
|
||||||
|
{
|
||||||
|
JI_Update();
|
||||||
|
if (JI_AnyKey() || JG_Quitting())
|
||||||
|
{
|
||||||
|
eixir = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELAY
|
||||||
|
JG_SetUpdateTicks(100);
|
||||||
|
int contador = 20;
|
||||||
|
while (contador > 0 && !eixir) {
|
||||||
|
contador--;
|
||||||
|
while (!JG_ShouldUpdate())
|
||||||
|
{
|
||||||
|
JI_Update();
|
||||||
|
if (JI_AnyKey() || JG_Quitting())
|
||||||
|
{
|
||||||
|
eixir = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FADE OUT
|
||||||
|
JG_SetUpdateTicks(2);
|
||||||
|
while (!JD8_FadeOutAsync()) {
|
||||||
|
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
JD8_FreeSurface( gfx );
|
||||||
|
free(pal);
|
||||||
|
|
||||||
|
//JD8_FadeOut();
|
||||||
|
|
||||||
|
if( JG_Quitting() ) {
|
||||||
|
info::estat_joc = ESTAT_EIXIR;
|
||||||
|
} else {
|
||||||
|
switch (info::estat_joc) {
|
||||||
|
case ESTAT_ICEKAS: info::estat_joc = ESTAT_LOGO; break;
|
||||||
|
case ESTAT_LOGO: info::estat_joc = ESTAT_MENU; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int minim( const int a, const int b ) {
|
|
||||||
if( b < a ) { return b; } else { return a; }
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModuleStaticScreen::doIcekas() {
|
|
||||||
|
|
||||||
bool eixir = false;
|
|
||||||
|
|
||||||
JS_LoadMusic("mlogo.mid");
|
|
||||||
JS_PlayMusic(1);
|
|
||||||
|
|
||||||
JD8_Surface gfx = JD8_LoadSurface( "logo.gif" );
|
|
||||||
JD8_Palette pal = JD8_LoadPalette( "logo.gif" );
|
|
||||||
|
|
||||||
JD8_ClearScreen( 0 );
|
|
||||||
JD8_Flip();
|
|
||||||
|
|
||||||
// FADE IN
|
|
||||||
JD8_Blit(gfx);
|
|
||||||
JG_SetUpdateTicks(8);
|
|
||||||
while (!JD8_FadeToPalAsync(pal) && !eixir) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELAY
|
|
||||||
JG_SetUpdateTicks(100);
|
|
||||||
int contador = 20;
|
|
||||||
while (contador > 0 && !eixir) {
|
|
||||||
contador--;
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
// FADE OUT
|
|
||||||
JG_SetUpdateTicks(2);
|
|
||||||
while (!JD8_FadeOutAsync() && !eixir) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
JD8_FreeSurface( gfx );
|
|
||||||
free(pal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModuleStaticScreen::doLogo() {
|
|
||||||
|
|
||||||
bool eixir = false;
|
|
||||||
|
|
||||||
JD8_Surface gfx = JD8_LoadSurface("titol.gif");
|
|
||||||
JD8_Palette pal = JD8_LoadPalette("titol.gif");
|
|
||||||
|
|
||||||
JD8_ClearScreen(0);
|
|
||||||
JD8_Flip();
|
|
||||||
|
|
||||||
// FADE IN
|
|
||||||
JD8_Blit(gfx);
|
|
||||||
JG_SetUpdateTicks(8);
|
|
||||||
while (!JD8_FadeToPalAsync(pal) && !eixir) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELAY
|
|
||||||
JG_SetUpdateTicks(100);
|
|
||||||
int contador = 20;
|
|
||||||
while (contador > 0 && !eixir) {
|
|
||||||
contador--;
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
// FADE OUT
|
|
||||||
JG_SetUpdateTicks(2);
|
|
||||||
while (!JD8_FadeOutAsync() && !eixir) {
|
|
||||||
while (!JG_ShouldUpdate()) { JI_Update(); if (JI_AnyKey() || JG_Quitting()) { eixir = true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
JD8_FreeSurface(gfx);
|
|
||||||
free(pal);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "info.h"
|
|
||||||
|
|
||||||
class ModuleStaticScreen {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ModuleStaticScreen( Info* info );
|
|
||||||
~ModuleStaticScreen(void);
|
|
||||||
|
|
||||||
int Go();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void doIcekas();
|
|
||||||
void doLogo();
|
|
||||||
|
|
||||||
Info* info;
|
|
||||||
int contador;
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user