diff --git a/source/gamestate_sequence.cpp b/source/gamestate_sequence.cpp index f895407..b01f6c1 100644 --- a/source/gamestate_sequence.cpp +++ b/source/gamestate_sequence.cpp @@ -3,6 +3,7 @@ #include "jfile.h" #include "jinput.h" #include "jdraw.h" +#include "jaudio.h" #include #include @@ -22,6 +23,38 @@ namespace gamestate const char *sequence_file = nullptr; uint32_t wait_until = 0; + uint8_t getByte() + { + return *(sequence_file++); + } + + uint16_t getWord() + { + return (getByte() << 8) + getByte(); + } + + std::string getString() + { + uint8_t tamanyCadena = getByte(); + char filename[256]; + for (int i=0; i0 && SDL_GetTicks() < wait_until) @@ -40,23 +73,31 @@ namespace gamestate switch ( tipo_diapositiva ) { case DIAPO_ESPERAR: - const uint32_t wait_time = (uint16_t)((uint8_t(*(sequence_file++)) << 8) + uint8_t(*(sequence_file++))); - wait_until = SDL_GetTicks() + wait_time; + wait_until = SDL_GetTicks() + getWord(); break; case DIAPO_FADEIN: - { - uint8_t tamanyCadena = *(sequence_file++); - char *filename = (char *)malloc(tamanyCadena + 1); - for (int i=0; i