--- a/data/ending +++ b/data/ending @@ -148,7 +148,7 @@ NEW @none@ 30 -To see the true ending of Blob Wars: Metal Blob Solid you will need to play again on +To see the true ending of Blob Wars you will need to play again on Normal or Hard, where you will discover all the answers to your questions and also experience a much more indepth and challenging gaming experience. Bob's destiny is much more complex than just rescuing MIAs... --- a/data/license +++ b/data/license @@ -1,4 +1,4 @@ -50 Blob Wars : Metal Blob Solid +50 Blob Wars 70 Copyright (C) 2004-2011 Parallel Realities 90 Copyright (C) 2011-2015 Perpendicular Dimensions --- a/src/CGraphics.cpp +++ b/src/CGraphics.cpp @@ -19,7 +19,11 @@ */ -#include "headers.h" +#include "headers.h" + +#ifdef __EMSCRIPTEN__ +#include +#endif void SDL_SetAlpha(SDL_Surface *surface, uint8_t value) { SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND); @@ -197,6 +201,16 @@ SDL_RenderPresent(renderer); SDL_RenderClear(renderer); +#ifdef __EMSCRIPTEN__ + /* Every shown frame hands the turn back to the browser (the build uses Asyncify): some loops, like + Graphics::delay, never sleep */ + emscripten_sleep(0); + /* No screenshots (nowhere to write them) and no fullscreen keys (the page has its own button) */ + engine->keyState[SDL_SCANCODE_F12] = engine->keyState[SDL_SCANCODE_F10] = 0; + if (engine->keyState[SDL_SCANCODE_LALT]) + engine->keyState[SDL_SCANCODE_RETURN] = 0; +#endif + if (takeRandomScreenShots) { if ((Math::prand() % 500) == 0) @@ -1108,9 +1122,9 @@ drawString("The GNU General Public License was not found.", 320, 180, true, screen); drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen); - drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen); + drawString("Blob Wars will not run with the license missing.", 320, 260, true, screen); - drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen); + drawString("Blob Wars will now exit", 320, 420, true, screen); drawString("Press Escape to continue", 320, 450, true, screen); engine->flushInput(); @@ -1157,7 +1171,7 @@ drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen); drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen); - drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen); + drawString("Blob Wars will now exit", 320, 420, true, screen); drawString("Press Escape to continue", 320, 450, true, screen); engine->flushInput(); --- a/src/cutscene.cpp +++ b/src/cutscene.cpp @@ -263,7 +263,8 @@ } else { - audio.loadMusic("music/end"); + /* FredyGames: "end" (a 1992 module by another composer, remixed) is left out; the cutscene theme plays */ + audio.loadMusic("music/cutscene"); } showScene(allowSkip); --- a/src/init.cpp +++ b/src/init.cpp @@ -305,7 +305,7 @@ h *= 2; } - graphics.window = SDL_CreateWindow("Blobwars: Metal Blob Solid", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_RESIZABLE); + graphics.window = SDL_CreateWindow("Blob Wars", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_RESIZABLE); if (graphics.window == NULL) { @@ -330,6 +330,10 @@ exit(1); } +#ifdef __EMSCRIPTEN__ + /* The page has its own fullscreen button */ + engine.fullScreen = false; +#endif SDL_SetWindowFullscreen(graphics.window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); // This (attempts to) set the gamma correction. We attempt to catch an error here @@ -401,7 +405,8 @@ debug(("Font sizes all loaded!!\n")); - audio.loadSound(SND_CHEAT, "sound/Lock And Load!!!"); + /* FredyGames: the original cheat sound was a clip from a TV show (fair use only); use the game's own cheer */ + audio.loadSound(SND_CHEAT, "sound/cheer"); audio.loadSound(SND_HIGHLIGHT, "sound/menu"); audio.loadSound(SND_SELECT, "sound/select"); --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,7 @@ { printf(_( "\n" - "Blob Wars, Episode I - Metal Blob Solid (Version %.2f, Release %d)\n" + "Blob Wars, Episode I (Version %.2f, Release %d)\n" "Copyright (C) 2004-2011 Parallel Realities\n" "Copyright (C) 2011-2015 Perpendicular Dimensions\n" "Licensed under the GNU General Public License (GPL)\n" @@ -56,7 +56,7 @@ showVersion(); printf(_( - "The Metal Blob Solid gameplay manual can be found in,\n" + "The Blob Wars gameplay manual can be found in,\n" "\t%s\n" "\n" "Replay Commands\n" @@ -117,6 +117,18 @@ exit(0); } +#ifdef __EMSCRIPTEN__ +#include + +void saveConfig(); /* init.cpp */ + +/* Called by the page when the tab is hidden or closed: the options are only written when the game exits */ +extern "C" EMSCRIPTEN_KEEPALIVE void fredygames_save(void) +{ + saveConfig(); +} +#endif + int main(int argc, char *argv[]) { #if !USEPAK --- a/src/options.cpp +++ b/src/options.cpp @@ -365,6 +365,9 @@ if (engine.widgetChanged("musicvol")) audio.setMusicVolume(game.musicVol); +#ifdef __EMSCRIPTEN__ + engine.fullScreen = false; +#endif if (engine.widgetChanged("fullscreen")) SDL_SetWindowFullscreen(graphics.window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); --- a/src/player.cpp +++ b/src/player.cpp @@ -64,6 +64,11 @@ void presentPlayerMedal(const char *tname) { +#ifdef __EMSCRIPTEN__ + /* The medals live on the author's online server, which the browser build never contacts */ + (void)tname; + return; +#endif // Copy the input, so that threading // doesn't trip us up! char *data = new char[128]; --- a/src/title.cpp +++ b/src/title.cpp @@ -178,10 +178,15 @@ graphics.quickSprite("optionsBackground", graphics.loadImage("gfx/main/optionsBackground.png")); SDL_Surface *prlogo = graphics.quickSprite("PRLogo", graphics.loadImage("gfx/main/prlogo.gif")); - SDL_Surface *title = graphics.quickSprite("Title", graphics.loadImage("gfx/main/title.png")); - graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00); + /* FredyGames: the title is the game's name drawn with the game's font, in place of gfx/main/title.png + (a logo that imitates another game's) */ + graphics.loadFont(4, "data/vera.ttf", 84); + graphics.setFontSize(4); + SDL_Surface *title = graphics.quickSprite("Title", graphics.getString("BLOB WARS", true)); + graphics.loadFont(4, "data/vera.ttf", 24); + graphics.setFontSize(3); SDL_Surface *presents = graphics.quickSprite("Presents", graphics.getString(_("Presents"), true)); SDL_Surface *sdl = graphics.quickSprite("SDL", graphics.getString(_("An SDL2 Game"), true)); @@ -590,17 +595,9 @@ void doQuit() { SDL_FillRect(graphics.screen, NULL, graphics.black); - SDL_Surface *sequel = graphics.loadImage("gfx/main/sequel.png"); - SDL_Surface *book = graphics.loadImage("gfx/main/book.png"); + /* FredyGames: without the pictures and links of the author's other works (a sequel and a book) */ graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00); - graphics.setFontSize(1); - graphics.drawString(_("If you like Blob Wars: Metal Blob Solid, you might also like:"), 320, 20, true, graphics.screen); - graphics.blit(sequel, 160, 200, graphics.screen, true); - graphics.blit(book, 480, 200, graphics.screen, true); - graphics.setFontSize(0); - graphics.drawString("http://blobandconquer.sf.net", 160, 380, true, graphics.screen); - graphics.drawString("http://www.battleforthesolarsystem.com", 480, 380, true, graphics.screen); graphics.setFontSize(3); graphics.drawString(_("Thank you for playing Blob Wars!"), 320, 430, true, graphics.screen); graphics.setFontSize(0);