diff options
Diffstat (limited to 'games/transmission/screens/screen_ending.c')
| -rw-r--r-- | games/transmission/screens/screen_ending.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/games/transmission/screens/screen_ending.c b/games/transmission/screens/screen_ending.c index d0cf7d89..bb355b8b 100644 --- a/games/transmission/screens/screen_ending.c +++ b/games/transmission/screens/screen_ending.c @@ -35,13 +35,13 @@ //---------------------------------------------------------------------------------- // Global Variables Definition (local to this module) //---------------------------------------------------------------------------------- -static char *codingWords[MAX_CODING_WORDS] = { - "pollo\0", - "conejo\0", +static char *codingWords[MAX_CODING_WORDS] = { + "pollo\0", + "conejo\0", "huevo\0", - "nido\0", - "aire\0", - "armario\0", + "nido\0", + "aire\0", + "armario\0", "agujero\0", "platano\0", "pastel\0", @@ -82,21 +82,21 @@ void InitEndingScreen(void) { framesCounter = 0; finishScreen = 0; - + rotation = 0.1f; scale = 0.05f; state = 0; - + texBackground = LoadTexture("resources/textures/ending_background.png"); texVignette = LoadTexture("resources/textures/message_vignette.png"); fxNews = LoadSound("resources/audio/fx_batman.ogg"); - + missions = LoadMissions("resources/missions.txt"); int wordsCount = missions[currentMission].wordsCount; strcpy(headline, missions[currentMission].msg); // Base headline int len = strlen(headline); - + // Remove @ from headline // TODO: Also remove additional spaces for (int i = 0; i < len; i++) @@ -110,7 +110,7 @@ void InitEndingScreen(void) { // WARNING: It fails if the last sentence word has a '.' after space char *title = StringReplace(headline, messageWords[i].text, codingWords[messageWords[i].id]); - + if (title != NULL) { strcpy(headline, title); // Base headline updated @@ -118,14 +118,14 @@ void InitEndingScreen(void) } } } - + TraceLog(LOG_WARNING, "Titular: %s", headline); - + // Generate newspaper with title and subtitle Image imNewspaper = LoadImage("resources/textures/ending_newspaper.png"); - fontNews = LoadFontEx("resources/fonts/Lora-Bold.ttf", 32, 250, 0); + fontNews = LoadFontEx("resources/fonts/Lora-Bold.ttf", 32, 0, 250); ImageDrawTextEx(&imNewspaper, (Vector2){ 50, 220 }, fontNews, headline, fontNews.baseSize, 0, DARKGRAY); - + texNewspaper = LoadTextureFromImage(imNewspaper); //UnloadFont(fontNews); UnloadImage(imNewspaper); @@ -135,25 +135,25 @@ void InitEndingScreen(void) void UpdateEndingScreen(void) { framesCounter++; - + if (framesCounter == 10) PlaySound(fxNews); - + if (state == 0) { rotation += 18.0f; scale += 0.0096f; - - if (scale >= 1.0f) + + if (scale >= 1.0f) { scale = 1.0f; state = 1; } } - - if ((state == 1) && (IsKeyPressed(KEY_ENTER) || IsButtonPressed())) + + if ((state == 1) && (IsKeyPressed(KEY_ENTER) || IsButtonPressed())) { currentMission++; - + if (currentMission >= totalMissions) finishScreen = 2; else finishScreen = 1; } @@ -163,16 +163,16 @@ void UpdateEndingScreen(void) void DrawEndingScreen(void) { DrawTexture(texBackground, 0, 0, WHITE); - + DrawTexturePro(texNewspaper, (Rectangle){ 0, 0, texNewspaper.width, texNewspaper.height }, - (Rectangle){ GetScreenWidth()/2, GetScreenHeight()/2, texNewspaper.width*scale, texNewspaper.height*scale }, + (Rectangle){ GetScreenWidth()/2, GetScreenHeight()/2, texNewspaper.width*scale, texNewspaper.height*scale }, (Vector2){ (float)texNewspaper.width*scale/2, (float)texNewspaper.height*scale/2 }, rotation, WHITE); DrawTextureEx(texVignette, (Vector2){ 0, 0 }, 0.0f, 2.0f, WHITE); // Draw debug information DrawTextEx(fontNews, headline, (Vector2){ 10, 10 }, fontNews.baseSize, 0, RAYWHITE); - + for (int i = 0; i < missions[currentMission].wordsCount; i++) { DrawText(codingWords[messageWords[i].id], 10, 60 + 30*i, 20, (messageWords[i].id == missions[currentMission].sols[i]) ? GREEN : RED); @@ -187,9 +187,9 @@ void UnloadEndingScreen(void) UnloadTexture(texBackground); UnloadTexture(texNewspaper); UnloadTexture(texVignette); - + UnloadSound(fxNews); - free(missions); + free(missions); } // Ending Screen should finish? @@ -213,16 +213,16 @@ static char *StringReplace(char *orig, char *rep, char *with) // Sanity checks and initialization if (!orig || !rep) return NULL; - + len_rep = strlen(rep); if (len_rep == 0) return NULL; // Empty rep causes infinite loop during count - + if (!with) with = ""; // Replace with nothing if not provided len_with = strlen(with); // Count the number of replacements needed ins = orig; - for (count = 0; tmp = strstr(ins, rep); ++count) + for (count = 0; tmp = strstr(ins, rep); ++count) { ins = tmp + len_rep; } @@ -235,7 +235,7 @@ static char *StringReplace(char *orig, char *rep, char *with) // tmp points to the end of the result string // ins points to the next occurrence of rep in orig // orig points to the remainder of orig after "end of rep" - while (count--) + while (count--) { ins = strstr(orig, rep); len_front = ins - orig; @@ -243,8 +243,8 @@ static char *StringReplace(char *orig, char *rep, char *with) tmp = strcpy(tmp, with) + len_with; orig += len_front + len_rep; // move to next "end of rep" } - + strcpy(tmp, orig); - + return result; } |
