Canvis varios

This commit is contained in:
2019-12-12 19:00:56 +01:00
parent 875d2894df
commit 60af56270f
7 changed files with 73 additions and 30 deletions

View File

@@ -7,6 +7,12 @@
#include <stdlib.h>
#include <string>
#define SENSE_OPCIO -1
#define OPCIO_TIMEATTACK 0
#define OPCIO_WORLDTOUR 1
#define OPCIO_CLASSICMODE 2
#define OPCIO_OPTIONS 3
ModuleMenu::ModuleMenu(Info* info) {
this->info = info;
}
@@ -42,51 +48,50 @@ int ModuleMenu::Go() {
JD8_Flip();
x--;
}
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_BlitCK(0, 50, opcions, 0, 50, 320, 38, 0);
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;
while (!JG_Quitting() && x > 0) {
while (!JG_ShouldUpdate()) { JI_Update(); }
JD8_Blit(fondo);
JD8_BlitCK(0, 50, opcions, 0, 50, 320, 38, 0);
JD8_BlitCK(25, 88, opcions, 25, 88, 135, 37, 0);
JD8_BlitCKCut(x, 125, opcions, 0, 125, 320, 38, 0);
JD8_Flip();
x--;
}
JD8_BlitCKToSurface(0, 125, opcions, 0, 125, 320, 38, fondo, 0);
x = 320;
while (!JG_Quitting() && x > 0) {
while (!JG_ShouldUpdate()) { JI_Update(); }
JD8_Blit(fondo);
JD8_BlitCK(0, 50, opcions, 0, 50, 320, 38, 0);
JD8_BlitCK(25, 88, opcions, 25, 88, 135, 37, 0);
JD8_BlitCK(0, 125, opcions, 0, 125, 320, 38, 0);
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;
while (!JG_Quitting() && y > 0) {
while (!JG_ShouldUpdate()) { JI_Update(); }
JD8_Blit(fondo);
JD8_BlitCK(0, 50, opcions, 0, 50, 320, 38, 0);
JD8_BlitCK(25, 88, opcions, 25, 88, 135, 37, 0);
JD8_BlitCK(0, 125, opcions, 0, 125, 320, 38, 0);
JD8_BlitCK(0, 163, opcions, 0, 163, 320, 37, 0);
JD8_BlitCKCut(0, -y, opcions, 0, 0, 320, 50, 0);
JD8_Flip();
y--;
}
JD8_BlitCKToSurface(0, 0, opcions, 0, 0, 320, 50, fondo, 0);
int opcio_seleccionada = 0;
int opcio_triada = -1;
int opcio_seleccionada = OPCIO_TIMEATTACK;
int opcio_triada = SENSE_OPCIO;
bool fletxa_amunt_pulsada = false;
bool fletxa_avall_pulsada = false;
float x_fletxa = 0;
@@ -94,7 +99,7 @@ int ModuleMenu::Go() {
JG_SetUpdateTicks(20);
while (!JG_Quitting() && opcio_triada == -1) {
while (!JG_Quitting() && opcio_triada == SENSE_OPCIO) {
while (!JG_ShouldUpdate()) {
JI_Update();
if (JI_KeyPressed(SDL_SCANCODE_UP)) {
@@ -113,6 +118,9 @@ int ModuleMenu::Go() {
} else {
fletxa_avall_pulsada = false;
}
if (JI_KeyPressed(SDL_SCANCODE_SPACE)) {
opcio_triada = opcio_seleccionada;
}
}
x_fletxa += x_velocitat;
@@ -123,21 +131,28 @@ int ModuleMenu::Go() {
x_velocitat = 1;
}
JD8_Blit(fondo);
JD8_BlitCK(0, 50, opcions, 0, 50, 320, 38, 0);
JD8_BlitCK(25, 88, opcions, 25, 88, 135, 37, 0);
JD8_BlitCK(0, 125, opcions, 0, 125, 320, 38, 0);
JD8_BlitCK(0, 163, opcions, 0, 163, 320, 37, 0);
JD8_BlitCK(0, 0, opcions, 0, 0, 320, 50, 0);
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);
// FADE OUT
JG_SetUpdateTicks(2);
while (!JD8_FadeOutAsync() && !JG_Quitting()) {
// 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);
@@ -148,11 +163,12 @@ int ModuleMenu::Go() {
if (JG_Quitting()) {
return ESTAT_EIXIR;
}
else {
switch (this->info->estat_joc) {
case ESTAT_ICEKAS: return ESTAT_LOGO; break;
case ESTAT_LOGO: return ESTAT_MENU; break;
} 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;