-
Notifications
You must be signed in to change notification settings - Fork 8
Lang/rename to english - Full translation of comments and code. #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d6cca8a
3657d3b
0d7ffa4
e9d29b3
adf1beb
88b195f
d7fc753
873e141
16e0e5c
6cd2996
090d75f
3d19581
38eace6
da2e27e
ce45ee8
da9950d
2773cc0
58f5962
fbf85ea
4d66861
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,29 +30,29 @@ | |
| #include "utils.h" | ||
| #include "preference.h" | ||
|
|
||
| /*** Variable globales ***/ | ||
| /*** Global variables ***/ | ||
| /*************************/ | ||
| extern sNewPreference Pref; | ||
| extern int currentTime; | ||
|
|
||
| /*** Constructeur et Destructeur ***/ | ||
| /***********************************/ | ||
| /*** Constructors and destructors ***/ | ||
| /************************************/ | ||
| Audio::~Audio() | ||
| { | ||
| if (N) { | ||
| Mix_HaltChannel(-1); | ||
| for (int i = 0; i < N; i++) { | ||
| if (Son[i]) { | ||
| Mix_FreeChunk(Son[i]); | ||
| if (Sound[i]) { | ||
| Mix_FreeChunk(Sound[i]); | ||
| } | ||
| } | ||
| delete[] Son; | ||
| delete[] Sound; | ||
| } | ||
| Mix_CloseAudio(); | ||
| } | ||
|
|
||
| /*** Initialise l'Audio ***/ | ||
| /**************************/ | ||
| /*** Initializes audio ***/ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one also is useless for me, the method name should be self-explanatory. So either |
||
| /*************************/ | ||
| bool Audio::Init() | ||
| { | ||
| char PathFile[512]; | ||
|
|
@@ -62,46 +62,46 @@ bool Audio::Init() | |
| return false; | ||
| } | ||
|
|
||
| /*** Allocation de la mémoire ***/ | ||
| N = sFin; | ||
| Son = new Mix_Chunk *[sFin]; | ||
| /*** Memory allocation ***/ | ||
| N = sSize; | ||
| Sound = new Mix_Chunk *[sSize]; | ||
|
|
||
| /*** Chargement des sons ***/ | ||
| strcpy(PathFile, "Sounds/clic.wav"); | ||
| /*** Loading sound effects ***/ | ||
| strcpy(PathFile, "Sounds/click.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sClic] = Mix_LoadWAV(PathFile); | ||
| Sound[sClick] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/speed.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sSpeed] = Mix_LoadWAV(PathFile); | ||
| Sound[sSpeed] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/crash.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sCrash] = Mix_LoadWAV(PathFile); | ||
| Sound[sCrash] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/end.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sEnd] = Mix_LoadWAV(PathFile); | ||
| Sound[sEnd] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/lose.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sLose] = Mix_LoadWAV(PathFile); | ||
| Sound[sLose] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/etire.wav"); | ||
| strcpy(PathFile, "Sounds/expand.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sEtire] = Mix_LoadWAV(PathFile); | ||
| Sound[sExpand] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/wagon.wav"); | ||
| strcpy(PathFile, "Sounds/car.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sWagon] = Mix_LoadWAV(PathFile); | ||
| Sound[sCar] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/reduit.wav"); | ||
| strcpy(PathFile, "Sounds/shrink.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sReduit] = Mix_LoadWAV(PathFile); | ||
| Sound[sShrink] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/live.wav"); | ||
| Utils::GetPath(PathFile); | ||
| Son[sLive] = Mix_LoadWAV(PathFile); | ||
| Sound[sLive] = Mix_LoadWAV(PathFile); | ||
|
|
||
| strcpy(PathFile, "Sounds/menu.mod"); | ||
| Utils::GetPath(PathFile); | ||
|
|
@@ -110,8 +110,8 @@ bool Audio::Init() | |
| return true; | ||
| } | ||
|
|
||
| /*** Charge une music 0=menu 1,2,3,4 = game ***/ | ||
| /**********************************************/ | ||
| /*** Loads a music track, 0 = menu music 1,2,3,4=game music tracks ***/ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one is a valid one, the behaviour cannot be explained just with the name, it makes sense to have this comment |
||
| /*********************************************************************/ | ||
| void Audio::LoadMusic(int Num) | ||
| { | ||
| char Provi[512] = "Sounds/jeu1.xm"; | ||
|
|
@@ -124,12 +124,12 @@ void Audio::LoadMusic(int Num) | |
|
|
||
| if (Music) { | ||
| PauseMusic(true); | ||
| Mix_HaltMusic(); // Arrete la music | ||
| Mix_HaltMusic(); // Stops the music | ||
| Mix_FreeMusic(Music); | ||
| Music = nullptr; | ||
| } | ||
|
|
||
| if (Num == 0) { // Si music du menu | ||
| if (Num == 0) { // if menu music | ||
| strcpy(Provi, "Sounds/menu.mod"); | ||
| Utils::GetPath(Provi); | ||
| Music = Mix_LoadMUS(Provi); | ||
|
|
@@ -142,8 +142,8 @@ void Audio::LoadMusic(int Num) | |
| PlayMusic(); | ||
| } | ||
|
|
||
| /*** Passe à la music de jeu suivante ***/ | ||
| /****************************************/ | ||
| /*** Swaps to next game track ***/ | ||
| /********************************/ | ||
| void Audio::NextMusic() | ||
| { | ||
| NMus++; | ||
|
|
@@ -153,26 +153,26 @@ void Audio::NextMusic() | |
| LoadMusic(NMus); | ||
| } | ||
|
|
||
| /*** Fait la lecture d'un son ***/ | ||
| /********************************/ | ||
| void Audio::Play(eSon So) | ||
| /*** Plays a sound effect ***/ | ||
| /****************************/ | ||
| void Audio::Play(eSound index) | ||
| { | ||
| if (!N) { | ||
| return; | ||
| } | ||
|
|
||
| if (So == sClic) { | ||
| if (index == sClick) { | ||
| if (currentTime - MemorizedTime <= 120) { | ||
| return; | ||
| } | ||
| MemorizedTime = currentTime; | ||
| } | ||
|
|
||
| Mix_PlayChannel(-1, Son[So], 0); | ||
| Mix_PlayChannel(-1, Sound[index], 0); | ||
| } | ||
|
|
||
| /*** Joue la music ***/ | ||
| /*********************/ | ||
| /*** Plays the music ***/ | ||
| /***********************/ | ||
| void Audio::PlayMusic() const | ||
| { | ||
| if (Music && N) { | ||
|
|
@@ -181,21 +181,21 @@ void Audio::PlayMusic() const | |
| } | ||
| } | ||
|
|
||
| void Audio::PauseMusic(bool Et) const | ||
| void Audio::PauseMusic(bool IsMusicPlaying) const | ||
| { | ||
| if (!N) { | ||
| return; | ||
| } | ||
|
|
||
| if (Et) { | ||
| if (IsMusicPlaying) { | ||
| Mix_PauseMusic(); | ||
| } | ||
| else { | ||
| Mix_ResumeMusic(); | ||
| } | ||
| } | ||
|
|
||
| /*** Valide les Volumes ***/ | ||
| /*** Handles sound volumes ***/ | ||
| /**************************/ | ||
| void Audio::DoVolume() const | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the kind of comment I think is useless: we know they are global variables, constructors or destructors, no need to tell it, it's obvious for anyone reading the file