Throw coffe with rotation and time stop with clock sound

This commit is contained in:
2021-04-04 12:31:48 +02:00
parent 4980c0f712
commit d84137daa7
10 changed files with 172 additions and 41 deletions
+25 -4
View File
@@ -46,9 +46,13 @@ GameDirector::GameDirector(std::string path)
initJailAudio();
#ifdef __MIPSEL__
DIR* dir = opendir("/media/data/local/home/.coffee_crisis");
if (dir) { closedir(dir); }
else if (ENOENT == errno) {
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
@@ -1041,6 +1045,7 @@ bool GameDirector::loadMediaGame()
mSound[SOUND_BUBBLE2].sound = JA_LoadSound(mSound[SOUND_BUBBLE2].file.c_str());
mSound[SOUND_BUBBLE3].sound = JA_LoadSound(mSound[SOUND_BUBBLE3].file.c_str());
mSound[SOUND_BUBBLE4].sound = JA_LoadSound(mSound[SOUND_BUBBLE4].file.c_str());
mSound[SOUND_CLOCK].sound = JA_LoadSound(mSound[SOUND_CLOCK].file.c_str());
// Musicas
mMusic[MUSIC_PLAYING].music = JA_LoadMusic(mMusic[MUSIC_PLAYING].file.c_str());
@@ -1075,6 +1080,7 @@ void GameDirector::quitGame()
JA_DeleteSound(mSound[SOUND_BUBBLE2].sound);
JA_DeleteSound(mSound[SOUND_BUBBLE3].sound);
JA_DeleteSound(mSound[SOUND_BUBBLE4].sound);
JA_DeleteSound(mSound[SOUND_CLOCK].sound);
// Musicas
JA_DeleteMusic(mMusic[MUSIC_PLAYING].music);
@@ -1182,6 +1188,7 @@ void GameDirector::setFileList()
mSound[SOUND_PLAYER_COLLISION].file = mProg.executablePath + "/" + "../media/sound/player_collision.wav";
mSound[SOUND_STAGE_CHANGE].file = mProg.executablePath + "/" + "../media/sound/stage_change.wav";
mSound[SOUND_TITLE].file = mProg.executablePath + "/" + "../media/sound/title.wav";
mSound[SOUND_CLOCK].file = mProg.executablePath + "/" + "../media/sound/clock.wav";
// Texturas
mTexture[TEXTURE_BALLOON].file = mProg.executablePath + "/" + "../media/gfx/balloon.png";
@@ -3043,7 +3050,7 @@ void GameDirector::resetItems()
// Devuelve un item en función del azar
Uint8 GameDirector::dropItem()
{
//return ITEM_COFFEE;
return ITEM_COFFEE;
Uint8 luckyNumber = rand() % 99;
Uint8 item = rand() % 7;
@@ -3151,6 +3158,9 @@ void GameDirector::throwCoffee(int x, int y)
mGame.smartSprite[index]->setEnabled(true);
mGame.smartSprite[index]->setEnabledTimer(1);
mGame.smartSprite[index]->setSpriteClip(80, 16, 16, 16);
mGame.smartSprite[index]->setRotate(true);
mGame.smartSprite[index]->setRotateSpeed(1);
mGame.smartSprite[index]->setRotateAmount(5.0);
}
// Crea un SmartSprite para arrojar el item café al recibir un impacto
@@ -4010,6 +4020,17 @@ void GameDirector::renderMessages()
mText.black->writeCentered(PLAY_AREA_CENTER_X + 1, PLAY_AREA_FIRST_QUARTER_Y + 1, "Time Stopped: " + std::to_string(mGame.timeStoppedCounter / 10));
mText.white->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, "Time Stopped: " + std::to_string(mGame.timeStoppedCounter / 10));
}
if (mGame.timeStoppedCounter > 100)
{
if (mGame.timeStoppedCounter % 30 == 0)
JA_PlaySound(mSound[SOUND_CLOCK].sound, false);
}
else
{
if (mGame.timeStoppedCounter % 15 == 0)
JA_PlaySound(mSound[SOUND_CLOCK].sound, false);
}
}
// D E M O