- Afegit modul de sequencia (història).
- Reemplaçades músiques per MIDIs
This commit is contained in:
19
info.h
19
info.h
@@ -6,12 +6,25 @@
|
||||
#define ESTAT_MENU 2
|
||||
#define ESTAT_OPCIONS 3
|
||||
#define ESTAT_SELECT 4
|
||||
#define ESTAT_JOC 5
|
||||
#define ESTAT_LEVELCOMPLETE 6
|
||||
#define ESTAT_MORT 7
|
||||
#define ESTAT_SEQUENCIA 5
|
||||
#define ESTAT_JOC 6
|
||||
#define ESTAT_LEVELCOMPLETE 7
|
||||
#define ESTAT_MORT 8
|
||||
|
||||
#define SENSE_OPCIO -1
|
||||
|
||||
#define MODE_FACIL 0
|
||||
#define MODE_NORMAL 1
|
||||
#define MODE_DIFICIL 2
|
||||
|
||||
#define PERSONATGE_PEPE 0
|
||||
#define PERSONATGE_ROSITA 1
|
||||
#define PERSONATGE_JOB 2
|
||||
|
||||
struct Info {
|
||||
int estat_joc;
|
||||
bool rosita_enabled;
|
||||
bool job_enabled;
|
||||
int dificultat;
|
||||
int personatge;
|
||||
};
|
||||
|
||||
@@ -206,6 +206,12 @@ void JD8_SetPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b) {
|
||||
main_palette[index].b = b << 2;
|
||||
}
|
||||
|
||||
void JD8_SetPaletteColor(Uint8 index, Uint8 other) {
|
||||
main_palette[index].r = main_palette[other].r;
|
||||
main_palette[index].g = main_palette[other].g;
|
||||
main_palette[index].b = main_palette[other].b;
|
||||
}
|
||||
|
||||
void JD8_FadeOut() {
|
||||
for( int j = 0; j < 32; j++ ) {
|
||||
for( int i = 0; i < 256; i++ ) {
|
||||
|
||||
1
jdraw8.h
1
jdraw8.h
@@ -50,6 +50,7 @@ void JD8_PutPixel( JD8_Surface surface, int x, int y, Uint8 pixel );
|
||||
void JD8_PutPixel(int x, int y, Uint8 pixel);
|
||||
|
||||
void JD8_SetPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b);
|
||||
void JD8_SetPaletteColor(Uint8 index, Uint8 other);
|
||||
|
||||
void JD8_FadeOut();
|
||||
bool JD8_FadeOutAsync();
|
||||
|
||||
11
main.cpp
11
main.cpp
@@ -6,6 +6,7 @@
|
||||
#include "modulestaticscreen.h"
|
||||
#include "modulemenu.h"
|
||||
#include "moduleselect.h"
|
||||
#include "modulesequence.h"
|
||||
#include "time.h"
|
||||
#include <string>
|
||||
|
||||
@@ -36,9 +37,11 @@ int main( int argc, char* args[] ) {
|
||||
JS_Init();
|
||||
|
||||
Info info;
|
||||
info.estat_joc = ESTAT_ICEKAS;
|
||||
info.estat_joc = ESTAT_ICEKAS; // ESTAT_SEQUENCIA; // ESTAT_ICEKAS;
|
||||
info.rosita_enabled = false;
|
||||
info.job_enabled = false;
|
||||
info.dificultat = MODE_FACIL;
|
||||
info.personatge = PERSONATGE_PEPE;
|
||||
|
||||
FILE* ini = fopen("trick.ini", "rb");
|
||||
if (ini != NULL) {
|
||||
@@ -70,6 +73,12 @@ int main( int argc, char* args[] ) {
|
||||
info.estat_joc = moduleSelect->Go();
|
||||
delete moduleSelect;
|
||||
break;
|
||||
case ESTAT_SEQUENCIA:
|
||||
ModuleSequence * moduleSequence;
|
||||
moduleSequence = new ModuleSequence(&info);
|
||||
info.estat_joc = moduleSequence->Go();
|
||||
delete moduleSequence;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ ModuleMenu::~ModuleMenu(void) {
|
||||
|
||||
int ModuleMenu::Go() {
|
||||
|
||||
JS_LoadMusic("mtitle.xm");
|
||||
JS_LoadMusic("mtitle.mid");
|
||||
JS_PlayMusic(-1);
|
||||
|
||||
JD8_Surface fondo = JD8_LoadSurface("menu.gif");
|
||||
|
||||
@@ -7,14 +7,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
#define SENSE_OPCIO -1
|
||||
#define OPCIO_FACIL 0
|
||||
#define OPCIO_NORMAL 1
|
||||
#define OPCIO_DIFICIL 2
|
||||
#define OPCIO_PEPE 0
|
||||
#define OPCIO_ROSITA 1
|
||||
#define OPCIO_JOB 2
|
||||
|
||||
ModuleSelect::ModuleSelect(Info* info) {
|
||||
this->info = info;
|
||||
}
|
||||
@@ -86,9 +78,9 @@ int ModuleSelect::Go() {
|
||||
while (!JG_ShouldUpdate()) { JI_Update(); }
|
||||
}
|
||||
|
||||
int opcio_seleccionada = OPCIO_FACIL;
|
||||
int opcio_seleccionada = this->info->dificultat;
|
||||
int opcio_triada = SENSE_OPCIO;
|
||||
int personatge_seleccionat = OPCIO_PEPE;
|
||||
int personatge_seleccionat = this->info->personatge;
|
||||
bool fletxa_amunt_pulsada = false;
|
||||
bool fletxa_avall_pulsada = false;
|
||||
bool fletxa_esquerra_pulsada = false;
|
||||
@@ -172,14 +164,9 @@ int ModuleSelect::Go() {
|
||||
|
||||
if (JG_Quitting()) {
|
||||
return ESTAT_EIXIR;
|
||||
}
|
||||
else {
|
||||
/* switch (opcio_triada) {
|
||||
case OPCIO_TIMEATTACK: return ESTAT_LOGO; break;
|
||||
case OPCIO_WORLDTOUR: return ESTAT_MENU; break;
|
||||
case OPCIO_CLASSICMODE: return ESTAT_MENU; break;
|
||||
case OPCIO_OPTIONS: return ESTAT_MENU; break;
|
||||
}*/
|
||||
return ESTAT_JOC;
|
||||
} else {
|
||||
this->info->dificultat = opcio_triada;
|
||||
this->info->personatge = personatge_seleccionat;
|
||||
return ESTAT_SEQUENCIA;
|
||||
}
|
||||
}
|
||||
|
||||
229
modulesequence.cpp
Normal file
229
modulesequence.cpp
Normal file
@@ -0,0 +1,229 @@
|
||||
#include "modulesequence.h"
|
||||
|
||||
#include "jgame.h"
|
||||
#include "jdraw8.h"
|
||||
#include "jinput.h"
|
||||
#include "jsound.h"
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
JD8_Surface gfx = nullptr;
|
||||
JD8_Surface fondo = nullptr;
|
||||
JD8_Palette pal = nullptr;
|
||||
|
||||
ModuleSequence::ModuleSequence(Info* info) {
|
||||
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, char * text1, char * text2, 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);
|
||||
int num_chars_actual = (JG_GetCycleCounter() - temps_inicial) / speed;
|
||||
|
||||
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 <= 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) {
|
||||
int tamany_text3 = strlen(text3);
|
||||
temps_total = tamany_text3 * speed;
|
||||
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 <= 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; } }
|
||||
JD8_Flip();
|
||||
}
|
||||
|
||||
for (int i = 0; i <= tamany_text3; 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);
|
||||
}
|
||||
JD8_Flip();
|
||||
}
|
||||
}
|
||||
|
||||
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; } }
|
||||
}
|
||||
}
|
||||
22
modulesequence.h
Normal file
22
modulesequence.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#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, char* text1, char* text2 = nullptr, char* text3 = nullptr);
|
||||
void Wait(int time);
|
||||
};
|
||||
@@ -46,7 +46,7 @@ void ModuleStaticScreen::doIcekas() {
|
||||
|
||||
bool eixir = false;
|
||||
|
||||
JS_LoadMusic("mlogo.xm");
|
||||
JS_LoadMusic("mlogo.mid");
|
||||
JS_PlayMusic(1);
|
||||
|
||||
JD8_Surface gfx = JD8_LoadSurface( "logo.gif" );
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="modulemenu.cpp" />
|
||||
<ClCompile Include="moduleselect.cpp" />
|
||||
<ClCompile Include="modulesequence.cpp" />
|
||||
<ClCompile Include="modulestaticscreen.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -100,6 +101,7 @@
|
||||
<ClInclude Include="jsound.h" />
|
||||
<ClInclude Include="modulemenu.h" />
|
||||
<ClInclude Include="moduleselect.h" />
|
||||
<ClInclude Include="modulesequence.h" />
|
||||
<ClInclude Include="modulestaticscreen.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
<ClCompile Include="moduleselect.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modulesequence.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="info.h">
|
||||
@@ -74,5 +77,8 @@
|
||||
<ClInclude Include="moduleselect.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modulesequence.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user