Compare commits
3 Commits
c3bfc83689
...
13ba26fb0e
| Author | SHA1 | Date | |
|---|---|---|---|
| 13ba26fb0e | |||
| f9103548cf | |||
| c905e5be1f |
BIN
data/seq00.seq
BIN
data/seq00.seq
Binary file not shown.
36
data/seq00.txt
Normal file
36
data/seq00.txt
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
PLAYMUSIC 'mus3.mp3'
|
||||||
|
FADEIN 'SEQ11.GIF'
|
||||||
|
PRINT 139 19 2 'AU A LA JAIL!'
|
||||||
|
ESPERAR 1000
|
||||||
|
SHOW 'SEQ11.GIF'
|
||||||
|
PRINT 49 9 1 'ESPEREU! NO SABEU ELS'
|
||||||
|
PRINT 49 19 1 'PERILLS QUE HI HAN!'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ12.GIF'
|
||||||
|
PRINT 9 0 1 'TINDREU QUE ENFRONTARVOS...'
|
||||||
|
ESPERAR 1000
|
||||||
|
PRINT 9 9 1 'ALS 4 PSICOPATES DE LA EUI!'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ13.GIF'
|
||||||
|
PRINT 69 9 2 'BAH! PSICOPATES A MI...'
|
||||||
|
PRINT 69 19 2 'XAVAL JO TREBALLE A TELEFONICA'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ14.GIF'
|
||||||
|
PRINT 9 0 0 'PERO NOMES EIXIR...'
|
||||||
|
ESPERAR 1000
|
||||||
|
SHOW 'SEQ14.GIF'
|
||||||
|
PRINT 39 19 2 'I ESTE KAPOLL'
|
||||||
|
PRINT 39 29 2 'DE QUE SE RIU...'
|
||||||
|
ESPERAR 2000
|
||||||
|
SHOW 'SEQ14.GIF'
|
||||||
|
PRINT 99 29 3 'SOC EL JOCKER'
|
||||||
|
PRINT 99 39 3 'I SI NO SUPEREU...'
|
||||||
|
ESPERAR 2000
|
||||||
|
SHOW 'SEQ14.GIF'
|
||||||
|
PRINT 79 29 3 'ELS MEUS MAPES US ADORMIRE'
|
||||||
|
PRINT 79 39 3 'AMB UNA PRACTICA DE TAL!!'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seq05.seq
BIN
data/seq05.seq
Binary file not shown.
13
data/seq05.txt
Normal file
13
data/seq05.txt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FADEIN 'SEQ21.GIF'
|
||||||
|
PRINT 159 19 2 'VENIU! CREC QUE HE'
|
||||||
|
PRINT 159 29 2 'TROBAT LA JAIL!'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ22.GIF'
|
||||||
|
PRINT 9 19 1 'QUE ALGORISMES FEU ACI...'
|
||||||
|
ESPERAR 1000
|
||||||
|
SHOW 'SEQ22.GIF'
|
||||||
|
PRINT 9 19 1 'ARA TINDREU QUE SUPERAR'
|
||||||
|
PRINT 9 29 1 '5 MAPES AMB COST EXPONENCIAL!'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seq10.seq
BIN
data/seq10.seq
Binary file not shown.
16
data/seq10.txt
Normal file
16
data/seq10.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
FADEIN 'SEQ31.GIF'
|
||||||
|
PRINT 159 69 1 'ENANOS DE MERDA!'
|
||||||
|
PRINT 159 79 1 'MAI APROVAREU TCO!'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ32.GIF'
|
||||||
|
PRINT 9 19 2 'MALEIT SIGUA! ET VAIG'
|
||||||
|
PRINT 9 29 2 'A FER UN SALVAPANTALLES!'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ31.GIF'
|
||||||
|
PRINT 159 69 1 'QUE POR QUE EM DONA!'
|
||||||
|
ESPERAR 1000
|
||||||
|
PRINT 159 79 1 'SUPEREU ELS MEUS MAPES!'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seq15.seq
BIN
data/seq15.seq
Binary file not shown.
17
data/seq15.txt
Normal file
17
data/seq15.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FADEIN 'SEQ41.GIF'
|
||||||
|
PRINT 159 139 2 'MMMM... CADA VEGADA'
|
||||||
|
PRINT 159 149 2 'EN QUEDEM MENOS...'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ42.GIF'
|
||||||
|
PRINT 29 29 1 'VEIG DOBLE! VEIG TRIPLE!'
|
||||||
|
ESPERAR 1000
|
||||||
|
SHOW 'SEQ42.GIF'
|
||||||
|
PRINT 29 29 1 'ES EL MOMENT DELS MEUS'
|
||||||
|
PRINT 29 39 1 'MAPES "BALOO"...'
|
||||||
|
ESPERAR 3000
|
||||||
|
SHOW 'SEQ42.GIF'
|
||||||
|
PRINT 29 29 1 'QUE NO ELS SUPERA'
|
||||||
|
PRINT 29 39 1 'QUASI QUASI NINGU'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seq20.seq
BIN
data/seq20.seq
Binary file not shown.
17
data/seq20.txt
Normal file
17
data/seq20.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FADEIN 'SEQ51.GIF'
|
||||||
|
PRINT 59 39 2 '"JA EM ARRIVAT'
|
||||||
|
PRINT 59 49 2 'A LA JAIL!!!"'
|
||||||
|
ESPERAR 2000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ52.GIF'
|
||||||
|
PRINT 29 29 1 'ASI QUE TODOS USAIS'
|
||||||
|
PRINT 29 39 1 'EL MISMO LOGIN...'
|
||||||
|
ESPERAR 3000
|
||||||
|
SHOW 'SEQ52.GIF'
|
||||||
|
PRINT 29 29 1 'OS VOY A DAR YO MP3!'
|
||||||
|
ESPERAR 1000
|
||||||
|
SHOW 'SEQ52.GIF'
|
||||||
|
PRINT 29 29 1 'O ME COMPRAIS UNA PRECIOSA'
|
||||||
|
PRINT 29 39 1 'CHAQUETA DE CUERO O NADA DE NADA'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seq25.seq
BIN
data/seq25.seq
Binary file not shown.
5
data/seq25.txt
Normal file
5
data/seq25.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
FADEIN 'SEQ61.GIF'
|
||||||
|
PRINT 159 19 0 'HI HA ALGU MES A QUI'
|
||||||
|
PRINT 159 29 0 'ET TENS QUE ENFRONTAR!'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seq30.seq
BIN
data/seq30.seq
Binary file not shown.
60
data/seq30.txt
Normal file
60
data/seq30.txt
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
FADEIN 'SEQ71.GIF'
|
||||||
|
PRINT 9 9 2 'QUI DIMONIS ERES!!!'
|
||||||
|
ESPERAR 2000
|
||||||
|
SHOW 'SEQ72.GIF'
|
||||||
|
ESPERAR 1000
|
||||||
|
PRINT 9 9 2 'DOCTOR BACTERIOL!!'
|
||||||
|
ESPERAR 1000
|
||||||
|
SHOW 'SEQ72.GIF'
|
||||||
|
PRINT 9 9 2 'PERO JO PENSAVA QUE TU'
|
||||||
|
PRINT 9 19 2 'ME AJUDARIES...'
|
||||||
|
ESPERAR 3000
|
||||||
|
SHOW 'SEQ72.GIF'
|
||||||
|
PRINT 149 9 1 'I TE HE AJUDAT.'
|
||||||
|
PRINT 149 19 1 'ARA JA NOMES QUEDES TU'
|
||||||
|
ESPERAR 3000
|
||||||
|
SHOW 'SEQ72.GIF'
|
||||||
|
PRINT 149 9 1 'EL ORIGINAL. AIXI HE'
|
||||||
|
PRINT 149 19 1 'ARREGLAT EL QUE VAIG FER'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ73.GIF'
|
||||||
|
PRINT 39 19 0 'PERO POTSER NO ESTA'
|
||||||
|
PRINT 39 29 0 'SOLUCIONAT DEL TOT...'
|
||||||
|
ESPERAR 4000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'SEQ74.GIF'
|
||||||
|
PRINT 169 119 0 'UN JOC DE'
|
||||||
|
PRINT 169 129 0 'JAILGAMES'
|
||||||
|
ESPERAR 4000
|
||||||
|
SHOW 'SEQ74.GIF'
|
||||||
|
PRINT 169 99 0 'PROGRAMADOR'
|
||||||
|
PRINT 169 109 0 'GRAFICS'
|
||||||
|
PRINT 169 119 0 'MUSICA'
|
||||||
|
PRINT 169 129 0 'GUIO'
|
||||||
|
PRINT 176 149 0 'RAIMON ZAMORA'
|
||||||
|
PRINT 176 159 0 '"THE JAILDOCTOR"'
|
||||||
|
ESPERAR 4000
|
||||||
|
SHOW 'SEQ74.GIF'
|
||||||
|
PRINT 169 99 0 'GRACIES A'
|
||||||
|
PRINT 176 109 0 'JAILDESIGNER'
|
||||||
|
PRINT 176 119 0 'JAILBROTHER'
|
||||||
|
PRINT 176 129 0 'JAILGAMER'
|
||||||
|
PRINT 176 139 0 'MASTERJAIL'
|
||||||
|
PRINT 183 149 0 'I EL SEU GERMA'
|
||||||
|
PRINT 176 159 0 'JAILWEBMASTER'
|
||||||
|
PRINT 176 169 0 'I A TOTS ELS JAILERS'
|
||||||
|
ESPERAR 4000
|
||||||
|
SHOW 'SEQ74.GIF'
|
||||||
|
PRINT 169 99 0 'GRACIES ESPECIALMENT'
|
||||||
|
PRINT 176 109 0 'AL JAILAROUNDER PER'
|
||||||
|
PRINT 176 119 0 'CEDIR LA SEUA IMATGE'
|
||||||
|
ESPERAR 4000
|
||||||
|
SHOW 'SEQ74.GIF'
|
||||||
|
PRINT 169 119 0 'DEDICAT A'
|
||||||
|
PRINT 169 129 0 'MARIOLA I GUILLEM'
|
||||||
|
ESPERAR 4000
|
||||||
|
SHOW 'SEQ74.GIF'
|
||||||
|
PRINT 169 129 0 'FINS LA PROXIMA.'
|
||||||
|
ESPERAR 5000
|
||||||
|
FADEOUT
|
||||||
BIN
data/seqIN.seq
BIN
data/seqIN.seq
Binary file not shown.
47
data/seqIN.txt
Normal file
47
data/seqIN.txt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
PLAYMUSIC 'mus1.mp3'
|
||||||
|
FADEIN 'jailgames.gif'
|
||||||
|
ESPERAR 4000
|
||||||
|
FADEOUTMUSIC
|
||||||
|
PLAYMUSIC 'mus2.mp3'
|
||||||
|
FADEIN 'THX.GIF'
|
||||||
|
ESPERAR 4000
|
||||||
|
FADEOUTMUSIC
|
||||||
|
PLAYMUSIC 'mus3.mp3'
|
||||||
|
FADEIN 'intro01.GIF'
|
||||||
|
PRINT 39 149 0 '8 DEL MATI'
|
||||||
|
ESPERAR 1000
|
||||||
|
PRINT 39 156 0 'LABORATORI DE FFI'
|
||||||
|
ESPERAR 4000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'intro02.GIF'
|
||||||
|
PRINT 39 172 0 'EL PROFESOR BACTERIOL ESTA'
|
||||||
|
PRINT 39 179 0 'PREPARANT EL SEU NOU INVENT...'
|
||||||
|
ESPERAR 4000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'intro03.GIF'
|
||||||
|
PRINT 119 19 1 '"COGEMOL EL INDIVIDUOL'
|
||||||
|
PRINT 119 26 1 'Y PULSANDOL EL BOTOL....'
|
||||||
|
SHOW 'intro03.GIF'
|
||||||
|
PRINT 120 19 1 '...CONSEGUIMOL VARIOL'
|
||||||
|
PRINT 120 26 1 'INDIVIDUOL..."'
|
||||||
|
ESPERAR 4000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'intro04.GIF'
|
||||||
|
PRINT 79 179 0 'PERO ALGUN DESAPRENSIU...'
|
||||||
|
ESPERAR 2000
|
||||||
|
SHOW 'intro04.GIF'
|
||||||
|
PRINT 109 39 2 '"EY! ME ANE A FERME'
|
||||||
|
PRINT 109 46 2 'UN CORTAET..."'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'intro05.GIF'
|
||||||
|
PRINT 124 154 0 'ERA BALOO!!!'
|
||||||
|
ESPERAR 1000
|
||||||
|
PRINT 124 161 0 'I HA ENXUFAT LA MAQUINA!'
|
||||||
|
ESPERAR 3000
|
||||||
|
FADEOUT
|
||||||
|
FADEIN 'intro06.GIF'
|
||||||
|
PRINT 109 9 1 '"LA CAGAMOL!!!'
|
||||||
|
PRINT 109 16 1 'AHORAL QUE HAGOL!"'
|
||||||
|
ESPERAR 5000
|
||||||
|
FADEOUT
|
||||||
BIN
resources/menu_palette.aseprite
Normal file
BIN
resources/menu_palette.aseprite
Normal file
Binary file not shown.
@@ -19,30 +19,9 @@ namespace gamestate
|
|||||||
{
|
{
|
||||||
namespace sequence
|
namespace sequence
|
||||||
{
|
{
|
||||||
int num_diapositives = 0;
|
FILE *sequence_file = nullptr;
|
||||||
char *sequence_file = nullptr;
|
|
||||||
char *sfpointer = nullptr;
|
|
||||||
uint32_t wait_until = 0;
|
uint32_t wait_until = 0;
|
||||||
|
|
||||||
uint8_t getByte()
|
|
||||||
{
|
|
||||||
return *(sequence_file++);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t getWord()
|
|
||||||
{
|
|
||||||
return getByte() + (getByte() << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getString()
|
|
||||||
{
|
|
||||||
uint8_t tamanyCadena = getByte();
|
|
||||||
char filename[256];
|
|
||||||
for (int i=0; i<tamanyCadena; i++) filename[i] = getByte();
|
|
||||||
filename[tamanyCadena] = '\0';
|
|
||||||
return std::string(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawPic(std::string filename)
|
void drawPic(std::string filename)
|
||||||
{
|
{
|
||||||
draw::surface *pic = draw::loadSurface(filename, true);
|
draw::surface *pic = draw::loadSurface(filename, true);
|
||||||
@@ -82,13 +61,15 @@ namespace gamestate
|
|||||||
{
|
{
|
||||||
if (!draw::isfading() && (input::anyKeyPressed() || input::mouseBtn(1))) {
|
if (!draw::isfading() && (input::anyKeyPressed() || input::mouseBtn(1))) {
|
||||||
wait_until=0;
|
wait_until=0;
|
||||||
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) num_diapositives=0;
|
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) fseek(sequence_file, 0, SEEK_END);
|
||||||
} else {
|
} else {
|
||||||
draw::render();
|
draw::render();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (num_diapositives==0) {
|
if (feof(sequence_file))
|
||||||
|
{
|
||||||
|
fclose(sequence_file);
|
||||||
const int fase = game::getConfig("fase");
|
const int fase = game::getConfig("fase");
|
||||||
if ( fase == -1 || fase == 30) {
|
if ( fase == -1 || fase == 30) {
|
||||||
gamestate::menu::init();
|
gamestate::menu::init();
|
||||||
@@ -96,70 +77,52 @@ namespace gamestate
|
|||||||
gamestate::prefase::init();
|
gamestate::prefase::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
free(sfpointer);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
const char tipo_diapositiva = *(sequence_file++);
|
} else {
|
||||||
switch ( tipo_diapositiva )
|
|
||||||
{
|
char text[100];
|
||||||
case DIAPO_ESPERAR:
|
int x, y, val;
|
||||||
|
int res = fscanf(sequence_file, "%s", text);
|
||||||
|
if (res==1)
|
||||||
{
|
{
|
||||||
const uint16_t time = getWord();
|
std::string command(text);
|
||||||
wait_until = SDL_GetTicks() + time;
|
|
||||||
printf("- Esperar(%i)\n", time);
|
if (command=="ESPERAR") {
|
||||||
break;
|
int res = fscanf(sequence_file, "%i", &val);
|
||||||
|
wait_until = SDL_GetTicks() + val;
|
||||||
|
|
||||||
|
} else if (command=="FADEIN") {
|
||||||
|
int res = fscanf(sequence_file, " '%[^']'", text);
|
||||||
|
drawPic(text);
|
||||||
|
draw::fadein();
|
||||||
|
draw::render();
|
||||||
|
wait_until = SDL_GetTicks() + 500;
|
||||||
|
|
||||||
|
} else if (command=="SHOW") {
|
||||||
|
int res = fscanf(sequence_file, " '%[^']'", text);
|
||||||
|
drawPic(text);
|
||||||
|
draw::render();
|
||||||
|
|
||||||
|
} else if (command=="PRINT") {
|
||||||
|
int res = fscanf(sequence_file, " %i %i %i '%[^']'", &x, &y, &val, text);
|
||||||
|
drawText(x, y, val, text);
|
||||||
|
|
||||||
|
} else if (command=="PLAYMUSIC") {
|
||||||
|
int res = fscanf(sequence_file, " '%[^']'", text);
|
||||||
|
audio::playMusic(audio::loadMusic(text));
|
||||||
|
|
||||||
|
} else if (command=="FADEOUT") {
|
||||||
|
draw::fadeout();
|
||||||
|
wait_until = SDL_GetTicks() + 500;
|
||||||
|
|
||||||
|
} else if (command=="FADEOUTMUSIC") {
|
||||||
|
draw::fadeout();
|
||||||
|
audio::fadeoutMusic();
|
||||||
|
wait_until = SDL_GetTicks() + 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case DIAPO_FADEIN:
|
|
||||||
{
|
|
||||||
std::string filename = getString();
|
|
||||||
drawPic(filename);
|
|
||||||
draw::fadein();
|
|
||||||
draw::render();
|
|
||||||
wait_until = SDL_GetTicks() + 500;
|
|
||||||
printf("- FadeIn('%s')\n", filename.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DIAPO_SHOW:
|
|
||||||
{
|
|
||||||
std::string filename = getString();
|
|
||||||
drawPic(filename);
|
|
||||||
draw::render();
|
|
||||||
printf("- Show('%s')\n", filename.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DIAPO_PRINT:
|
|
||||||
{
|
|
||||||
const uint16_t x = getWord();
|
|
||||||
const uint16_t y = getWord();
|
|
||||||
const uint8_t col = getByte();
|
|
||||||
std::string text = getString();
|
|
||||||
drawText(x, y, col, text);
|
|
||||||
printf("- Print(%i, %i, %i, '%s')\n", x, y, col, text.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DIAPO_MUSICA:
|
|
||||||
{
|
|
||||||
std::string filename = getString();
|
|
||||||
audio::playMusic(audio::loadMusic(filename));
|
|
||||||
printf("- PlayMusic('%s')\n", filename.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DIAPO_FADEOUT:
|
|
||||||
{
|
|
||||||
draw::fadeout();
|
|
||||||
wait_until = SDL_GetTicks() + 500;
|
|
||||||
printf("- FadeOut()\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DIAPO_FADEMUSIC:
|
|
||||||
draw::fadeout();
|
|
||||||
audio::fadeoutMusic();
|
|
||||||
wait_until = SDL_GetTicks() + 500;
|
|
||||||
printf("- FadeOutMusic()\n");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
num_diapositives--;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,20 +134,18 @@ namespace gamestate
|
|||||||
|
|
||||||
switch (fase)
|
switch (fase)
|
||||||
{
|
{
|
||||||
case -1: filename = "seqIN.seq"; break;
|
case -1: filename = "seqIN.txt"; break;
|
||||||
case 0: filename = "seq00.seq"; break;
|
case 0: filename = "seq00.txt"; break;
|
||||||
case 5: filename = "seq05.seq"; break;
|
case 5: filename = "seq05.txt"; break;
|
||||||
case 10: filename = "seq10.seq"; break;
|
case 10: filename = "seq10.txt"; break;
|
||||||
case 15: filename = "seq15.seq"; break;
|
case 15: filename = "seq15.txt"; break;
|
||||||
case 20: filename = "seq20.seq"; break;
|
case 20: filename = "seq20.txt"; break;
|
||||||
case 25: filename = "seq25.seq"; break;
|
case 25: filename = "seq25.txt"; break;
|
||||||
case 30: filename = "seq30.seq"; break;
|
case 30: filename = "seq30.txt"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int filesize;
|
int filesize;
|
||||||
sequence_file = file::getFileBuffer(filename, filesize);
|
sequence_file = file::getFilePointer(filename, filesize);
|
||||||
sfpointer = sequence_file;
|
|
||||||
num_diapositives = *(sequence_file++);
|
|
||||||
|
|
||||||
game::setState(&gamestate::sequence::loop);
|
game::setState(&gamestate::sequence::loop);
|
||||||
}
|
}
|
||||||
|
|||||||
120
tools/sequencer.cpp
Normal file
120
tools/sequencer.cpp
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
// ATENCIÓ! Este programa no fa ninguna gestió de errors. Si no troba els arxius on els espera, peta i au. Es una xicoteta ferramenta
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#define NUM_RESOURCES 8
|
||||||
|
|
||||||
|
#define DIAPO_ESPERAR 0
|
||||||
|
#define DIAPO_FADEIN 1
|
||||||
|
#define DIAPO_SHOW 2
|
||||||
|
#define DIAPO_PRINT 3
|
||||||
|
#define DIAPO_MUSICA 4
|
||||||
|
#define DIAPO_FADEOUT 5
|
||||||
|
#define DIAPO_FADEMUSIC 6
|
||||||
|
|
||||||
|
const char *resources[NUM_RESOURCES] = {
|
||||||
|
"../data/seqIN.seq",
|
||||||
|
"../data/seq00.seq",
|
||||||
|
"../data/seq05.seq",
|
||||||
|
"../data/seq10.seq",
|
||||||
|
"../data/seq15.seq",
|
||||||
|
"../data/seq20.seq",
|
||||||
|
"../data/seq25.seq",
|
||||||
|
"../data/seq30.seq"
|
||||||
|
};
|
||||||
|
|
||||||
|
char *p = nullptr;
|
||||||
|
|
||||||
|
uint8_t getByte() { return *(p++); }
|
||||||
|
|
||||||
|
uint16_t getWord() { return getByte() + (getByte() << 8); }
|
||||||
|
|
||||||
|
std::string getString()
|
||||||
|
{
|
||||||
|
uint8_t tamanyCadena = getByte();
|
||||||
|
char filename[256];
|
||||||
|
for (int i=0; i<tamanyCadena; i++) filename[i] = getByte();
|
||||||
|
filename[tamanyCadena] = '\0';
|
||||||
|
return std::string(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
for (int i = 0; i<NUM_RESOURCES; ++i)
|
||||||
|
{
|
||||||
|
const char *resourcename = resources[i];
|
||||||
|
FILE *f = fopen(resourcename, "rb");
|
||||||
|
fseek(f, 0, SEEK_END);
|
||||||
|
int filesize = ftell(f);
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
char *buffer = (char *)malloc(filesize);
|
||||||
|
fread(buffer, filesize, 1, f);
|
||||||
|
fclose(f);
|
||||||
|
p = buffer;
|
||||||
|
|
||||||
|
std::string filename(resourcename);
|
||||||
|
size_t index = 0;
|
||||||
|
index = filename.find(".seq", index);
|
||||||
|
std::string new_filename(filename);
|
||||||
|
new_filename.replace(index, 4, ".txt");
|
||||||
|
FILE *fp = fopen(new_filename.c_str(), "w");
|
||||||
|
|
||||||
|
int num_diapositives = getByte();
|
||||||
|
//fprintf(fp, "%i\n", num_diapositives);
|
||||||
|
|
||||||
|
while (num_diapositives>0)
|
||||||
|
{
|
||||||
|
const char tipo_diapositiva = getByte();
|
||||||
|
switch ( tipo_diapositiva )
|
||||||
|
{
|
||||||
|
case DIAPO_ESPERAR:
|
||||||
|
{
|
||||||
|
const uint16_t time = getWord();
|
||||||
|
fprintf(fp, "ESPERAR %i\n", time);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIAPO_FADEIN:
|
||||||
|
{
|
||||||
|
std::string filename = getString();
|
||||||
|
fprintf(fp, "FADEIN '%s'\n", filename.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIAPO_SHOW:
|
||||||
|
{
|
||||||
|
std::string filename = getString();
|
||||||
|
fprintf(fp, "SHOW '%s'\n", filename.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIAPO_PRINT:
|
||||||
|
{
|
||||||
|
const uint16_t x = getWord();
|
||||||
|
const uint16_t y = getWord();
|
||||||
|
const uint8_t col = getByte();
|
||||||
|
std::string text = getString();
|
||||||
|
fprintf(fp, "PRINT %i %i %i '%s'\n", x, y, col, text.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIAPO_MUSICA:
|
||||||
|
{
|
||||||
|
std::string filename = getString();
|
||||||
|
fprintf(fp, "PLAYMUSIC '%s'\n", filename.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIAPO_FADEOUT:
|
||||||
|
{
|
||||||
|
fprintf(fp, "FADEOUT\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIAPO_FADEMUSIC:
|
||||||
|
fprintf(fp, "FADEOUTMUSIC\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num_diapositives--;
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user