Skip to content

Commit

Permalink
Added Language selection, sound ON/OFF and fixed some memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
nop90 committed May 30, 2016
1 parent ae9bd2b commit bd38ed1
Show file tree
Hide file tree
Showing 22 changed files with 160 additions and 1,795 deletions.
Binary file added data/images/logos/flags.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/3ds/os_3ds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ int getLanguage(void)
{
return language;
}

void setLanguage(int languageID)
{
if (languageID>5) language = 1;
else if (languageID<1) language = 5;
else language = languageID;

}
1 change: 1 addition & 0 deletions src/3ds/os_3ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ int SDL_GetKeyState(void* p);
void SDL_ShowCursor(int s);

int getLanguage(void);
void setLanguage(int languageID);


#define SDLK_ESCAPE KEY_SELECT
Expand Down
8 changes: 4 additions & 4 deletions src/3ds/sound_3ds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ bool soundEnabled;

FSOUND_SAMPLE SFX[NUMSFX];

int SFXMasterVolume = 255;
int MasterVolume = 255;
int SFXMasterVolume = 64;
int MasterVolume = 64;
int frequency=0;
int channel;

Expand Down Expand Up @@ -132,7 +132,7 @@ void FSOUND_SetSFXMasterVolume(u8 previous_volson)

void FSOUND_PlaySound(int chl,FSOUND_SAMPLE* s)
{
if(!s || !s->used || !s->data || !soundEnabled)return;
if(!s || !s->used || !s->data || !soundEnabled || SFXMasterVolume == 0)return;

channel++;
channel%=7;
Expand All @@ -149,7 +149,7 @@ void FMUSIC_StopSong(FMUSIC_MODULE* s)
void FMUSIC_PlaySong(FMUSIC_MODULE* s)
{
int flag;
if(!s || !s->used || !s->data || !soundEnabled)return;
if(!s || !s->used || !s->data || !soundEnabled || SFXMasterVolume == 0)return;
flag = s->format;
if(s->loop) flag |= SOUND_REPEAT;
csndPlaySound(15, flag, 8000, 1.0, 0.0, (u32*)s->data, (u32*)s->data, s->size);
Expand Down
4 changes: 2 additions & 2 deletions src/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Audio::~Audio() {
}
}

void Audio::setVolume(int vol) {volume=vol*4;
void Audio::setVolume(int vol) {volume=vol;
if (previous_volume == -1) previous_volume = FMUSIC_GetMasterVolume(music);
FMUSIC_SetMasterVolume(music, volume);}
void Audio::setVolson(int volson) {FSOUND_SetSFXMasterVolume(volson*4);
void Audio::setVolson(int volson) {FSOUND_SetSFXMasterVolume(volson);
// for (int i = 0; i < 40; i++) Mix_VolumeChunk(sons[i], volson);
}

Expand Down
84 changes: 0 additions & 84 deletions src/Bouclier.cpp

This file was deleted.

14 changes: 12 additions & 2 deletions src/Caisse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//#include <SDL/SDL_image.h>
#include "3ds/os_3ds.h"


#include "Menu.h"
#include "Joueur.h"
#include "Monde.h"
Expand All @@ -29,7 +28,18 @@ pousseX(0), pousseY(0), direction(N) {
sy = ((type-1)/3)*h;
}

Caisse::~Caisse() {}
Caisse::~Caisse() {
freeImages();
}


void Caisse::freeImages()
{
if(suivant) ((Caisse*)suivant)->freeImages();
SDL_FreeSurface(image);
image = 0;
}


void Caisse::draw(SDL_Surface* gpScreen) {
int phg[2];
Expand Down
1 change: 1 addition & 0 deletions src/Caisse.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Caisse : public Personnage {
Caisse* getSuivant();
bool pousse(Direction dir);
private :
void freeImages();
void bouge();

Jeu* gpJeu;
Expand Down
Loading

0 comments on commit bd38ed1

Please sign in to comment.