diff --git a/src/CGame.cpp b/src/CGame.cpp index 454c2c0..6218ab7 100644 --- a/src/CGame.cpp +++ b/src/CGame.cpp @@ -494,10 +494,13 @@ void CGame::LoadSettings() if (SettingsFile) { int VolumeMusic, VolumeSound, aMotionBlur; - fscanf(SettingsFile, "VolumeMusic=%d\nVolumeSound=%d\nCrt=%d\nSpriteGhosting=%d\n", &VolumeMusic, &VolumeSound, &Crt, &aMotionBlur); + int ret = fscanf(SettingsFile, "VolumeMusic=%d\nVolumeSound=%d\nCrt=%d\nSpriteGhosting=%d\nColorModR=%d\nColorModG=%d\nColorModB=%d\n", + &VolumeMusic, &VolumeSound, &Crt, &aMotionBlur, &ColorModR, &ColorModG, &ColorModB); MotionBlur = (aMotionBlur == 1); - Audio->SetVolumeSound(VolumeSound); - Audio->SetVolumeMusic(VolumeMusic); + if(ret > 0) + Audio->SetVolumeMusic(VolumeMusic); + if(ret > 1) + Audio->SetVolumeSound(VolumeSound); fclose(SettingsFile); } else @@ -529,7 +532,8 @@ void CGame::SaveSettings() { int VolumeMusic = Audio->GetVolumeMusic(); int VolumeSound = Audio->GetVolumeSound(); - fprintf(SettingsFile, "VolumeMusic=%d\nVolumeSound=%d\nCrt=%d\nSpriteGhosting=%d\n", VolumeMusic, VolumeSound, Crt, MotionBlur?1:0); + fprintf(SettingsFile, "VolumeMusic=%d\nVolumeSound=%d\nCrt=%d\nSpriteGhosting=%d\nColorModR=%d\nColorModG=%d\nColorModB=%d\n", + VolumeMusic, VolumeSound, Crt, MotionBlur?1:0, ColorModR, ColorModG, ColorModB); fclose(SettingsFile); } } @@ -759,6 +763,8 @@ void CGame::MainLoop() SDL_SetRenderDrawColor(Renderer, 0, 0, 0, 255); SDL_RenderClear(Renderer); + SDL_SetTextureColorMod(TexScreen, ColorModR, ColorModG, ColorModB); + int w, h, w2, h2, x, y; SDL_GetWindowSize(SdlWindow, &w , &h); float ScaleX = (float)w / (float)ScreenWidth; diff --git a/src/CGame.h b/src/CGame.h index 5987de1..e2338a5 100644 --- a/src/CGame.h +++ b/src/CGame.h @@ -68,6 +68,7 @@ class CGame { bool MotionBlur; int GFXFrameID, GFXMedal; int CurrentGameMusicID; + int ColorModR=255, ColorModG=255, ColorModB=255; CGame(); ~CGame(); diff --git a/src/Common.cpp b/src/Common.cpp index edcd9d4..fac34cf 100644 --- a/src/Common.cpp +++ b/src/Common.cpp @@ -139,19 +139,22 @@ PauseMenuDesc PMPauseMenus[PauseMenus] = {PMSoundVol, "Sound Volume: "}, {PMMotionBlur, "Sprite Ghosting Effect: "}, {PMGameHelp, "Game Help"}, + {PMColorModR, "Color Mod Red: "}, + {PMColorModG, "Color Mod Green: "}, + {PMColorModB, "Color Mod Blue: "}, {PMCrt, "Crt Effect: "} }; //GamePauseMenus GPGamePauseMenusDesc GPGamePauseMenus[Games] = { - {GSSpaceInvaders, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSBreakout, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSFrog, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSSnake, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSPang, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSTetris, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSRamIt, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}}, - {GSEddy, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMQuit}} + {GSSpaceInvaders, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSBreakout, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSFrog, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSSnake, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSPang, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSTetris, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSRamIt, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}}, + {GSEddy, {PMContinue, PMGameHelp, PMMotionBlur, PMCrt, PMMusicVol, PMSoundVol, PMColorModR, PMColorModG, PMColorModB, PMQuit}} }; //MainMenus @@ -172,8 +175,11 @@ OptionMenusDesc OMOptionMenus[OptionMenus] = {OMSoundVol, "Sound Volume: "}, {OMMotionBlur, "Sprite Ghosting Effect: "}, {OMCrt, "Crt Effect: "}, + {OMColorModR, "Color Mod Red: "}, + {OMColorModG, "Color Mod Green: "}, + {OMColorModB, "Color Mod Blue: "}, {OMResetHighScores, "Reset Highscores"}, - {OMBack, "Back"} + {OMBack, "Back"}, }; //CrtOptions diff --git a/src/Common.h b/src/Common.h index b7998fb..f94198a 100644 --- a/src/Common.h +++ b/src/Common.h @@ -82,9 +82,13 @@ constexpr int PMMusicVol = 2; constexpr int PMSoundVol = 3; constexpr int PMMotionBlur = 4; constexpr int PMGameHelp = 5; -constexpr int PMCrt = 6; +constexpr int PMColorModR = 6; +constexpr int PMColorModG = 7; +constexpr int PMColorModB = 8; +constexpr int PMCrt = 9; -constexpr int PauseMenus = 7; + +constexpr int PauseMenus = 10; //main menus constexpr int MMStart = 0; @@ -104,9 +108,12 @@ constexpr int OMMusicVol = 0; constexpr int OMSoundVol = 1; constexpr int OMMotionBlur = 2; constexpr int OMCrt = 3; -constexpr int OMResetHighScores = 4; -constexpr int OMBack = 5; -constexpr int OptionMenus = 6; +constexpr int OMColorModR = 4; +constexpr int OMColorModG = 5; +constexpr int OMColorModB = 6; +constexpr int OMResetHighScores = 7; +constexpr int OMBack = 8; +constexpr int OptionMenus = 9; //CRTS constexpr int Crts = 6; @@ -131,7 +138,7 @@ struct PauseMenuDesc { struct GPGamePauseMenusDesc { int game; - int menus[7]; + int menus[10]; }; struct MainMenusDesc { diff --git a/src/TitleScreen.cpp b/src/TitleScreen.cpp index bfde21e..eac53a8 100644 --- a/src/TitleScreen.cpp +++ b/src/TitleScreen.cpp @@ -42,8 +42,8 @@ void TitleScreen(CGame *Game) case MMOptions: { int selectedmenu = 0; - int menutextsize = 50; - int menuspacing = 65; + int menutextsize = 35; + int menuspacing = 45; selectedmenu = OMOptionMenus[SelOptions].menu; Text = "Options"; @@ -85,6 +85,18 @@ void TitleScreen(CGame *Game) Text = OMOptionMenus[menu].name + CrtOptions[Game->Crt].name; Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 400, 185 + i * menuspacing, 0, color); break; + case OMColorModR: + Text = OMOptionMenus[menu].name + " " + to_string((int)Game->ColorModR * 100 / 255) + "%"; + Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 400, 185 + i * menuspacing, 0, color); + break; + case OMColorModG: + Text = OMOptionMenus[menu].name + " " + to_string((int)Game->ColorModG * 100 / 255) + "%"; + Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 400, 185 + i * menuspacing, 0, color); + break; + case OMColorModB: + Text = OMOptionMenus[menu].name + " " + to_string((int)Game->ColorModB * 100 / 255) + "%"; + Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 400, 185 + i * menuspacing, 0, color); + break; default: Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, OMOptionMenus[menu].name, OMOptionMenus[menu].name.length(), 400, 185 + i * menuspacing, 0, color); @@ -144,6 +156,24 @@ void TitleScreen(CGame *Game) Game->Crt = Crts -1; Game->ReCreateCrt(); break; + + case OMColorModR: + Game->ColorModR -= 5; + if(Game->ColorModR < 15) + Game->ColorModR = 15; + break; + + case OMColorModG: + Game->ColorModG -= 5; + if(Game->ColorModG < 15) + Game->ColorModG = 15; + break; + + case OMColorModB: + Game->ColorModB -= 5; + if(Game->ColorModB < 15) + Game->ColorModB = 15; + break; } //createcrt(global.crt) //savehighscoresoptions() @@ -176,6 +206,24 @@ void TitleScreen(CGame *Game) Game->Crt = 0; Game->ReCreateCrt(); break; + + case OMColorModR: + Game->ColorModR += 5; + if(Game->ColorModR > 255) + Game->ColorModR = 255; + break; + + case OMColorModG: + Game->ColorModG += 5; + if(Game->ColorModG > 255) + Game->ColorModG = 255; + break; + + case OMColorModB: + Game->ColorModB += 5; + if(Game->ColorModB > 255) + Game->ColorModB = 255; + break; } //createcrt(global.crt) //savehighscoresoptions() @@ -222,6 +270,24 @@ void TitleScreen(CGame *Game) Game->Crt = 0; Game->ReCreateCrt(); break; + + case OMColorModR: + Game->ColorModR += 5; + if(Game->ColorModR > 255) + Game->ColorModR = 15; + break; + + case OMColorModG: + Game->ColorModG += 5; + if(Game->ColorModG > 255) + Game->ColorModG = 15; + break; + + case OMColorModB: + Game->ColorModB += 5; + if(Game->ColorModB > 255) + Game->ColorModB = 15; + break; } //createcrt(global.crt) //savehighscoresoptions() diff --git a/src/games/CGameBase.cpp b/src/games/CGameBase.cpp index 30bc40b..95c3898 100644 --- a/src/games/CGameBase.cpp +++ b/src/games/CGameBase.cpp @@ -62,9 +62,9 @@ void CGameBase::PauseMenu() //global.substatecounter = 10.6 int selected = 0; int selectedmenu = 0; - int maxmenus = 7; - int menutextsize = 45; - int menuspacing = 55; + int maxmenus = 10; + int menutextsize = 34; + int menuspacing = 44; Game->Input->ResetButtons(); Uint64 TotalFrames = 0; @@ -131,6 +131,19 @@ void CGameBase::PauseMenu() Text = PMPauseMenus[menu].name + CrtOptions[Game->Crt].name; Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 300, 180 + i * menuspacing, 0, color); break; + case PMColorModR: + Text = PMPauseMenus[menu].name + " " + to_string((int)Game->ColorModR * 100 / 255) + "%"; + Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 300, 180 + i * menuspacing, 0, color); + break; + case PMColorModG: + Text = PMPauseMenus[menu].name + " " + to_string((int)Game->ColorModG * 100 / 255) + "%"; + Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 300, 180 + i * menuspacing, 0, color); + break; + case PMColorModB: + Text = PMPauseMenus[menu].name + " " + to_string((int)Game->ColorModB * 100 / 255) + "%"; + Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, Text, Text.length(), 300, 180 + i * menuspacing, 0, color); + break; + default: Game->Font->WriteText(Game->Renderer, "Roboto-Regular", menutextsize, PMPauseMenus[menu].name, PMPauseMenus[menu].name.length(), 300, 180 + i * menuspacing, 0, color); break; @@ -237,6 +250,30 @@ void CGameBase::PauseMenu() Game->ReCreateCrt(); break; } + + case PMColorModR: + { + Game->ColorModR -= 5; + if(Game->ColorModR < 15) + Game->ColorModR = 15; + break; + } + + case PMColorModG: + { + Game->ColorModG -= 5; + if(Game->ColorModG < 15) + Game->ColorModG = 15; + break; + } + + case PMColorModB: + { + Game->ColorModB -= 5; + if(Game->ColorModB < 15) + Game->ColorModB = 15; + break; + } } } @@ -276,6 +313,30 @@ void CGameBase::PauseMenu() Game->ReCreateCrt(); break; } + + case PMColorModR: + { + Game->ColorModR += 5; + if(Game->ColorModR > 255) + Game->ColorModR = 255; + break; + } + + case PMColorModG: + { + Game->ColorModG += 5; + if(Game->ColorModG > 255) + Game->ColorModG = 255; + break; + } + + case PMColorModB: + { + Game->ColorModB += 5; + if(Game->ColorModB > 255) + Game->ColorModB = 255; + break; + } } } @@ -370,6 +431,30 @@ void CGameBase::PauseMenu() Game->Input->ResetButtons(); break; } + + case PMColorModR: + { + Game->ColorModR += 5; + if(Game->ColorModR > 255) + Game->ColorModR = 15; + break; + } + + case PMColorModG: + { + Game->ColorModG += 5; + if(Game->ColorModG > 255) + Game->ColorModG = 15; + break; + } + + case PMColorModB: + { + Game->ColorModB += 5; + if(Game->ColorModB > 255) + Game->ColorModB = 15; + break; + } } } } @@ -392,6 +477,8 @@ void CGameBase::PauseMenu() SDL_SetRenderTarget(Game->Renderer, Game->TexScreen); SDL_RenderCopy(Game->Renderer, Game->TexOffScreen, NULL, NULL); + SDL_SetTextureColorMod(Game->TexScreen, Game->ColorModR, Game->ColorModG, Game->ColorModB); + SDL_SetRenderTarget(Game->Renderer, NULL); SDL_SetRenderDrawColor(Game->Renderer, 0, 0, 0, 255); SDL_RenderClear(Game->Renderer); diff --git a/src/games/CGameBlockStacker.cpp b/src/games/CGameBlockStacker.cpp index 1f075d6..32aa7bb 100644 --- a/src/games/CGameBlockStacker.cpp +++ b/src/games/CGameBlockStacker.cpp @@ -252,31 +252,31 @@ void CGameBlockStacker::drawplayfieldcell(int x, int y, int piece) if (piece != -1) { if(piece == 0) - color = {0, 0, 255, 255}; + color = {0x65, 0x65, 0xFF, 0xFF}; if (piece == 1) - color = {255, 255, 0, 255}; + color = {0xFF, 0xFF, 0x65, 0xFF}; if (piece == 2) - color = {0, 255, 0, 255}; + color = {0x30, 0xFF, 0x65, 0xFF}; if (piece == 3) - color = {255, 0, 0, 255}; + color = {0xFF, 0x65, 0x65, 0xFF}; if (piece == 4) - color = {0xA0, 0x20, 0xF0, 255}; + color = {0xA0, 0x40, 0xF0, 0xFF}; if (piece == 5) - color = {0xA5, 0x2A, 0x2A, 255}; + color = {0xA5, 0x3A, 0x3A, 0xFF}; if (piece == 6) - color = {255, 0, 255, 255}; + color = {0xFF, 0x65, 0xFF, 0xFF}; if (piece == -2) - color = {128, 128, 128, 255}; + color = {0x80, 0x80, 0x80, 0xFF}; if (piece == -3) - color = {255, 255, 255, 255}; + color = {0xFF, 0xFF, 0xFF, 0xFF}; SDL_Rect r = {screenleft + x * blocksize, screentop + y * blocksize, blocksize, blocksize}; SDL_SetRenderDrawColor(Game->Renderer, 0, 0, 0, 255); diff --git a/src/games/CGameInvaders.cpp b/src/games/CGameInvaders.cpp index 2e2bea8..7d84316 100644 --- a/src/games/CGameInvaders.cpp +++ b/src/games/CGameInvaders.cpp @@ -103,7 +103,7 @@ void CGameInvaders::createnemybullet(Vec2F pos) { enemybullets[i].spr = Game->Sprites->CreateSprite(); Game->Sprites->SetSpriteImage(enemybullets[i].spr, &spritesheetBullet, 2, 1); - Game->Sprites->SetSpriteColour(enemybullets[i].spr, 1,0,0,1); + Game->Sprites->SetSpriteColour(enemybullets[i].spr, 0.75,0.65,0.65,1); Game->Sprites->SetSpriteAnimation(enemybullets[i].spr, 1, 1, 0); Game->Sprites->SetSpriteScale(enemybullets[i].spr, enemyscale); Game->Sprites->SetSpriteDepth(enemybullets[i].spr, -1); diff --git a/src/games/CGameRamIt.cpp b/src/games/CGameRamIt.cpp index f69188b..06656b4 100644 --- a/src/games/CGameRamIt.cpp +++ b/src/games/CGameRamIt.cpp @@ -140,15 +140,15 @@ void CGameRamIt::drawplayer() { SDL_Rect r; - SDL_SetRenderDrawColor(Game->Renderer, 128, 128, 128, 255); + SDL_SetRenderDrawColor(Game->Renderer, 0x80, 0x80, 0x80, 0xFF); r = {screenleft + (screenright - screenleft -playerrailwidth) / 2, screentop, playerrailwidth, screenbottom - screentop }; SDL_RenderFillRect(Game->Renderer, &r); - SDL_SetRenderDrawColor(Game->Renderer, 255, 255, 255, 255); + SDL_SetRenderDrawColor(Game->Renderer, 0xFF, 0xFF, 0xFF, 0xFF); r = {playerpos.x - riblocksize / 2, playerpos.y - riblocksize / 2, riblocksize, riblocksize}; SDL_RenderFillRect(Game->Renderer, &r); - SDL_SetRenderDrawColor(Game->Renderer, 255, 0, 0, 255); + SDL_SetRenderDrawColor(Game->Renderer, 0xFF, 0x40, 0x40, 0xFF); if (playerdx == 1) r ={playerpos.x + riblocksize / 2, playerpos.y - riblocksize / 4, riblocksize / 2, riblocksize / 2}; else @@ -217,16 +217,16 @@ void CGameRamIt::createplayfield() prevpiece = piece; if (piece == 0) - color = {0x00, 0x00, 0xFF, 0xFF}; + color = {0x65, 0x65, 0xFF, 0xFF}; if (piece == 1) - color = {0xFF, 0xFF, 0x00, 0xFF}; + color = {0xFF, 0xFF, 0x65, 0xFF}; if (piece == 2) - color = {0x00, 0xFF, 0x00, 0xFF}; + color = {0x65, 0xFF, 0x65, 0xFF}; if (piece == 3) - color = {0x00, 0x00, 0xFF, 0xFF}; + color = {0x65, 0x65, 0xFF, 0xFF}; if (piece == 4) color = {0xA0, 0x20, 0xF0, 0xFF}; @@ -235,7 +235,7 @@ void CGameRamIt::createplayfield() color = {0xA5, 0x2A, 0x2A, 0xFF}; if (piece == 6) - color = {0xFF, 0x00, 0xFF, 0xFF}; + color = {0xFF, 0x65, 0xFF, 0xFF}; if (piece == 7) color = {0xFF, 0xFF, 0xFF, 0xFF}; @@ -244,28 +244,28 @@ void CGameRamIt::createplayfield() color = {0x9B, 0x9B, 0x9B, 0xFF}; if (piece == 9) - color = {0xFF, 0xE4, 0xC4, 0xFF}; + color = {0xDD, 0xE4, 0xC4, 0xFF}; if (piece == 10) - color = {0xED, 0x70, 0x14, 0xFF}; + color = {0xED, 0x70, 0x24, 0xFF}; if (piece == 11) color = {0xCC, 0xCC, 0xFF, 0xFF}; if (piece == 12) - color = {0xBF, 0xFF, 0x00, 0xFF}; + color = {0xBF, 0xDD, 0x65, 0xFF}; if (piece == 13) - color = {0x00, 0x80, 0x80, 0xFF}; + color = {0x65, 0x80, 0x80, 0xFF}; if (piece == 14) - color = {0x00, 0xFF, 0xFF, 0xFF}; + color = {0x65, 0xFF, 0xFF, 0xFF}; if (piece == 15) color = {0x8A, 0x9A, 0x5B, 0xFF}; if (piece == 16) - color = {0xE9, 0x96, 0x7A, 0xFF}; + color = {0xD9, 0x96, 0x7A, 0xFF}; playfield[side][block].color = color; playfield[side][block].segments = 2; diff --git a/src/games/CGameSnake.cpp b/src/games/CGameSnake.cpp index c8bfa09..b702322 100644 --- a/src/games/CGameSnake.cpp +++ b/src/games/CGameSnake.cpp @@ -161,7 +161,7 @@ void CGameSnake::updatesnake() void CGameSnake::DrawBackground(bool motionblur) { - SDL_SetRenderDrawColor(Game->Renderer, 0, 0, 255, 255); + SDL_SetRenderDrawColor(Game->Renderer, 0x65, 0x65, 0xFF, 0xFF); SDL_RenderClear(Game->Renderer); SDL_SetRenderDrawColor(Game->Renderer, 0, 0, 0, 255); SDL_Rect r = {screenleft, screentop, playfieldwidth, playfieldheight}; diff --git a/src/games/CGameSnake.h b/src/games/CGameSnake.h index 05735a4..4d2f532 100644 --- a/src/games/CGameSnake.h +++ b/src/games/CGameSnake.h @@ -18,9 +18,9 @@ class CGameSnake: public CGameBase { static const int cols = int(ScreenWidth / snakesize) -1; static const int updateticks = 8; - const SDL_Color snakeheadcolor = {255, 0, 0, 255}; - const SDL_Color snakebodycolor = {255, 255, 255, 255}; - const SDL_Color snakefoodcolor = {0, 255 ,0, 255}; + const SDL_Color snakeheadcolor = {0xFF, 0x65, 0x65, 0xFF}; + const SDL_Color snakebodycolor = {0xFF, 0xFF, 0xFF, 0xFF}; + const SDL_Color snakefoodcolor = {0x65, 0xFF, 0x65, 0xFF}; bool movedone = true; int snakelength;