]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/cutscene.cpp
Added .gitignore to ignore certain files + fixed access rights on Makefile* as
[quix0rs-blobwars.git] / src / cutscene.cpp
index 86577672d354b4f1132ca9bae2f8fd239716b48a..68672b6b0a3a779f139dbfa3dce9fce8a8d80c8a 100644 (file)
@@ -1,5 +1,6 @@
 /*
-Copyright (C) 2004 Parallel Realities
+Copyright (C) 2004-2011 Parallel Realities
+Copyright (C) 2011-2015 Perpendicular Dimensions
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
@@ -20,9 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "cutscene.h"
 
+List sceneList;
+
 void createSceneList()
 {
-       char sceneLine[1024];
+       char sceneLine[1024] = "";
        char *line = NULL;
        int waitTime = 0;
        Cutscene *scene = NULL;
@@ -51,7 +54,7 @@ void createSceneList()
                        line = strtok(NULL, "\n");
                        if (strcmp(line, "@none@") != 0)
                        {
-                               strncpy(scene->sprite, line, sizeof scene->sprite);
+                               strlcpy(scene->sprite, line, sizeof scene->sprite);
                                debug(("Loading cutscene image %s\n", scene->sprite));
                                graphics.quickSprite(scene->sprite, graphics.loadImage(scene->sprite));
                        }
@@ -61,7 +64,7 @@ void createSceneList()
                        line = strtok(NULL, "\n");
                }
                
-               if (strcmp(line, "@none@") != 0)
+               if (scene && strcmp(line, "@none@") != 0)
                {
                        scene->appendText(line);
                }
@@ -75,7 +78,7 @@ bool setupScene(const char *stagename)
        char sceneLine[1024];
 
        if (!engine.loadData(_("data/ending")))
-               graphics.showErrorAndExit("Couldn't load cutscene data file (%s)", _("data/ending"));
+               return graphics.showErrorAndExit("Couldn't load cutscene data file (%s)", _("data/ending")), false;
 
        char *line = strtok((char*)engine.dataBuffer, "\n");
        int i = 0;
@@ -135,7 +138,7 @@ void showScene(bool allowSkip)
        
        float panelAlpha = 0;
        
-       SDL_SetAlpha(panel, SDL_SRCALPHA|SDL_RLEACCEL, 0);
+       SDL_SetAlpha(panel, 0);
        
        engine.clearInput();
        engine.flushInput();
@@ -164,10 +167,10 @@ void showScene(bool allowSkip)
                if (panelAlpha < 256)
                {
                        panelAlpha += (1 * engine.getTimeDifference());
-                       SDL_SetAlpha(panel, SDL_SRCALPHA|SDL_RLEACCEL, (int)panelAlpha);
+                       SDL_SetAlpha(panel, panelAlpha);
                        if (image != NULL)
                        {
-                               SDL_SetAlpha(image, SDL_SRCALPHA|SDL_RLEACCEL, (int)panelAlpha);
+                               SDL_SetAlpha(image, panelAlpha);
                                graphics.blit(image, 0, 0, graphics.screen, false);
                        }
                        graphics.blit(panel, 0, 390, graphics.screen, false);
@@ -216,13 +219,12 @@ void checkStartCutscene()
                return;
        }
        
-       audio.loadMusic("music/cutscene");
-       
        char sceneName[1024];
        snprintf(sceneName, sizeof sceneName, "%s Start", game.stageName);
        
        if (setupScene(sceneName))
        {
+               audio.loadMusic("music/cutscene");
                showScene(true);
        }
        
@@ -238,15 +240,7 @@ void checkEndCutscene()
                return;
        }
        
-       if (strcmp(game.stageName, "Final Battle") != 0)
-       {
-               audio.loadMusic("music/cutscene");
-       }
-       else
-       {
-               audio.loadMusic("music/end");
-       }
-       
+
        char sceneName[1024];
        snprintf(sceneName, sizeof sceneName, "%s End", game.stageName);
        
@@ -263,6 +257,15 @@ void checkEndCutscene()
        
        if (setupScene(sceneName))
        {
+               if (strcmp(game.stageName, "Final Battle") != 0)
+               {
+                       audio.loadMusic("music/cutscene");
+               }
+               else
+               {
+                       audio.loadMusic("music/end");
+               }
+
                showScene(allowSkip);
        }