forked from jaildesigner-jailgames/coffee_crisis
Basic opendingux support
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
#include "utils.h"
|
||||
#include "gamedirector.h"
|
||||
#include <iostream>
|
||||
#ifdef __MIPSEL __
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
const Uint8 *keystates;
|
||||
float mSin[360]; // Vector con los valores del seno para 360 grados
|
||||
@@ -41,6 +45,14 @@ GameDirector::GameDirector(std::string path)
|
||||
// Inicializa JailAudio
|
||||
initJailAudio();
|
||||
|
||||
#ifdef __MIPSEL__
|
||||
DIR* dir = opendir("/media/data/local/home/.coffee_crisis");
|
||||
if (dir) { closedir(dir); }
|
||||
else if (ENOENT == errno) {
|
||||
int status = mkdir("/media/data/local/home/.coffee_crisis", 755);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Carga recursos
|
||||
loadMediaProg();
|
||||
loadScoreFile();
|
||||
@@ -129,9 +141,15 @@ void GameDirector::initProg()
|
||||
mProg.keyboard.right = SDL_SCANCODE_RIGHT;
|
||||
mProg.keyboard.accept = SDL_SCANCODE_RETURN;
|
||||
mProg.keyboard.cancel = SDL_SCANCODE_ESCAPE;
|
||||
#ifdef __MIPSEL__
|
||||
mProg.keyboard.fire = SDL_SCANCODE_SPACE;
|
||||
mProg.keyboard.fireLeft = SDL_SCANCODE_LSHIFT;
|
||||
mProg.keyboard.fireRight = SDL_SCANCODE_LCTRL;
|
||||
#else
|
||||
mProg.keyboard.fire = SDL_SCANCODE_W;
|
||||
mProg.keyboard.fireLeft = SDL_SCANCODE_Q;
|
||||
mProg.keyboard.fireRight = SDL_SCANCODE_E;
|
||||
#endif
|
||||
mProg.keyboard.pause = SDL_SCANCODE_ESCAPE;
|
||||
mProg.keyboard.escape = SDL_SCANCODE_ESCAPE;
|
||||
|
||||
@@ -1132,9 +1150,11 @@ void GameDirector::quitGame()
|
||||
void GameDirector::setFileList()
|
||||
{
|
||||
// Ficheros binarios
|
||||
mBinFile[BINFILE_SCORE].file = mProg.executablePath + "/" + "../data/score.bin";
|
||||
mBinFile[BINFILE_DEMO].file = mProg.executablePath + "/" + "../data/demo.bin";
|
||||
mBinFile[BINFILE_CONFIG].file = mProg.executablePath + "/" + "../data/config.bin";
|
||||
#ifdef __MIPSEL__
|
||||
mBinFile[BINFILE_SCORE].file = "/media/data/local/home/.coffee_crisis/score.bin";
|
||||
mBinFile[BINFILE_DEMO].file = "/media/data/local/home/.coffee_crisis/demo.bin";
|
||||
mBinFile[BINFILE_CONFIG].file = "/media/data/local/home/.coffee_crisis/config.bin";
|
||||
#endif
|
||||
|
||||
// Musicas
|
||||
mMusic[MUSIC_INTRO].file = mProg.executablePath + "/" + "../media/music/intro.ogg";
|
||||
@@ -4248,7 +4268,7 @@ void GameDirector::runIntro()
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||
{
|
||||
// Reproduce la música
|
||||
JA_PlayMusic(mMusic[MUSIC_INTRO].music, false);
|
||||
JA_PlayMusic(mMusic[MUSIC_INTRO].music, 0);
|
||||
}
|
||||
|
||||
while ((mProg.section == PROG_SECTION_INTRO) && (!exit()))
|
||||
@@ -4543,7 +4563,7 @@ void GameDirector::runTitle(Uint8 subsection)
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||
{
|
||||
// Reproduce la música
|
||||
JA_PlayMusic(mMusic[MUSIC_TITLE].music, true);
|
||||
JA_PlayMusic(mMusic[MUSIC_TITLE].music, -1);
|
||||
}
|
||||
|
||||
// Calcula la lógica de los objetos
|
||||
@@ -4745,7 +4765,7 @@ void GameDirector::runGame()
|
||||
{
|
||||
// Reproduce la música
|
||||
if (mGame.player->isAlive())
|
||||
JA_PlayMusic(mMusic[MUSIC_PLAYING].music, true);
|
||||
JA_PlayMusic(mMusic[MUSIC_PLAYING].music, -1);
|
||||
}
|
||||
|
||||
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
|
||||
|
||||
Reference in New Issue
Block a user