diff --git a/Makefile b/Makefile
index 427d97f..c75d53b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
CXXFLAGS ?= -O2 -Wall -g
CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
-OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o engine.o event.o explosion.o game.o gfx.o intermission.o loadSave.o messages.o misc.o missions.o player.o renderer.o resources.o screen.o script.o ship.o shop.o Starfighter.o title.o weapons.o window.o
+OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o cutscene.o engine.o event.o explosion.o game.o gfx.o intermission.o loadSave.o messages.o misc.o missions.o player.o renderer.o resources.o screen.o ship.o shop.o Starfighter.o title.o weapons.o window.o
VERSION = 1.4.1-dev
PROG = starfighter
diff --git a/data/cutscene0.dat b/data/cutscene0.dat
deleted file mode 100644
index 98fc271..0000000
--- a/data/cutscene0.dat
+++ /dev/null
@@ -1,27 +0,0 @@
-gfx/spirit.jpg
--3 0
-
-0 0 480 300 3.1
-1 2 -100 -550 3
-2 2 -100 -550 3
-3 2 -100 -550 3
-4 2 -100 -550 3
-5 2 -100 -550 3
-6 2 -100 -550 3
-7 2 -100 -550 3
-8 2 -100 -550 3
-9 2 -100 -550 3
-10 2 -100 -550 3
-11 2 -100 -550 3
-12 2 -100 -550 3
-13 2 -100 -550 3
-14 2 -100 -550 3
-
-FACE_NONE
-While escaping with his newly acquired Firefly, Chris Bainfield is intercepted by a WEAPCO patrol...
-FACE_CHRIS
-These things just won't give up, will they?
-FACE_CHRIS
-What a dilemma! I'm not all that familiar with this ship's controls, but I can't let this patrol reach my rendezvous point...
-FACE_CHRIS
-I guess I'll have to fight them, then. Let's see what this ship can do!
diff --git a/data/cutscene1.dat b/data/cutscene1.dat
deleted file mode 100644
index 79c9d57..0000000
--- a/data/cutscene1.dat
+++ /dev/null
@@ -1,29 +0,0 @@
-gfx/sol.jpg
--0.5 0
-
-0 18 400 300 0.5
-1 2 -800 -550 -3
-2 2 -800 -550 -3
-3 2 -800 -550 -3
-4 2 -800 -550 -3
-5 2 -800 -550 -3
-6 2 -800 -550 -3
-7 2 -800 -550 -3
-8 2 -800 -550 -3
-9 2 -800 -550 -3
-10 2 -800 -550 -3
-11 2 -800 -550 -3
-12 2 -800 -550 -3
-13 2 -800 -550 -3
-14 2 -800 -550 -3
-
-FACE_NONE
-A few hours later, in the Sol system, news has already spread of Chris Bainfield's heroic actions. The commander of WEAPCO's navy considers his options.
-FACE_KLINE
-The Emperor will not be pleased. Spirit is now a free star system thanks to that interfering rebel pilot.
-FACE_KLINE
-It was reported that he was able to take down one of our most powerful frigates in under 3 minutes!
-FACE_KLINE
-Talent like that does not appear every day. He would be a perfect candidate for our new AI training program!
-FACE_KLINE
-What a pity I must kill him...
diff --git a/data/cutscene2.dat b/data/cutscene2.dat
deleted file mode 100644
index 29b75e9..0000000
--- a/data/cutscene2.dat
+++ /dev/null
@@ -1,33 +0,0 @@
-gfx/spirit.jpg
--1.4 0
-
-0 0 200 300 1.5
-1 24 150 260 1.5
-2 -1 0 0 0
-3 -1 0 0 0
-4 -1 0 0 0
-5 -1 0 0 0
-6 -1 0 0 0
-7 -1 0 0 0
-8 -1 0 0 0
-9 -1 0 0 0
-10 -1 0 0 0
-11 -1 0 0 0
-12 -1 0 0 0
-13 -1 0 0 0
-14 -1 0 0 0
-
-FACE_SID
-We're nearly ready to make the jump to Eyananth.
-FACE_CHRIS
-Aren't there a lot of WEAPCO slaves in this system?
-FACE_SID
-Correct. It's got one of the highest mortality rates in the galaxy.
-FACE_CHRIS
-You think we can use that to our advantage?
-FACE_SID
-I think so. I'll come up with a plan of action.
-FACE_SID
-Just remember that we won't be in Spirit anymore and you may run into WEAPCO patrols while travelling.
-FACE_CHRIS
-Sounds like fun!
diff --git a/data/cutscene3.dat b/data/cutscene3.dat
deleted file mode 100644
index 6e7b78d..0000000
--- a/data/cutscene3.dat
+++ /dev/null
@@ -1,35 +0,0 @@
-gfx/eyananth.jpg
--0.5 0
-
-0 0 300 300 0.5
-1 24 250 260 0.5
-2 20 250 360 0.5
-3 -1 0 0 0
-4 -1 0 0 0
-5 -1 0 0 0
-6 -1 0 0 0
-7 -1 0 0 0
-8 -1 0 0 0
-9 -1 0 0 0
-10 -1 0 0 0
-11 -1 0 0 0
-12 -1 0 0 0
-13 -1 0 0 0
-14 -1 0 0 0
-
-FACE_PHOEBE
-Nice head gear! You shop at the same place as me, huh?
-FACE_CHRIS
-More importantly, what were you doing out there? You're lucky I was around!
-FACE_PHOEBE
-I'm looking for my sister. She vanished about a week ago.
-FACE_PHOEBE
-Hey! Wait a moment! You're that rebel from Spirit! I think you're so cool! Can I come with you?
-FACE_CHRIS
-Extra firepower? I wouldn't mind one bit! What do you think, Sid?
-FACE_SID
-I agree. I'm also interested in studying her homing missile launcher; it could come in handy.
-FACE_CHRIS
-In that case, welcome aboard!
-FACE_NONE
-Phoebe Lexx will now join you as a Wingmate. However, she will not be available on certain missions.
diff --git a/data/cutscene4.dat b/data/cutscene4.dat
deleted file mode 100644
index 97785b4..0000000
--- a/data/cutscene4.dat
+++ /dev/null
@@ -1,37 +0,0 @@
-gfx/eyananth.jpg
--1.4 0
-
-0 0 200 300 1.5
-1 24 150 260 1.5
-2 20 110 300 1.5
-3 -1 0 0 0
-4 -1 0 0 0
-5 -1 0 0 0
-6 -1 0 0 0
-7 -1 0 0 0
-8 -1 0 0 0
-9 -1 0 0 0
-10 -1 0 0 0
-11 -1 0 0 0
-12 -1 0 0 0
-13 -1 0 0 0
-14 -1 0 0 0
-
-FACE_SID
-What happened back there, Chris? The video feed was jammed.
-FACE_CHRIS
-We took down the WEAPCO mining vessel and then I was jumped by a man claiming to be Kline Kethlan.
-FACE_SID
-I've heard of him. He's the Commander of WEAPCO's naval forces. One of the best pilots they ever had.
-FACE_CHRIS
-He did put up one hell of a fight! He didn't stick around for long, though. I guess he was just testing me.
-FACE_CHRIS
-Anyway, what's the scoop on Mordor, Sid?
-FACE_SID
-I've learned from the scientist we captured that WEAPCO is testing a new fighter craft there.
-FACE_CHRIS
-We should probably destroy that craft, then. We might be able to thwart its development somewhat.
-FACE_SID
-Agreed.
-FACE_PHOEBE
-I wonder if my sister will be here...
diff --git a/data/cutscene5.dat b/data/cutscene5.dat
deleted file mode 100644
index 41ba588..0000000
--- a/data/cutscene5.dat
+++ /dev/null
@@ -1,31 +0,0 @@
-gfx/mordor.jpg
--0.5 0
-
-0 0 300 300 0.5
-1 24 250 260 0.5
-2 20 250 360 0.5
-3 -1 0 0 0
-4 -1 0 0 0
-5 -1 0 0 0
-6 -1 0 0 0
-7 -1 0 0 0
-8 -1 0 0 0
-9 -1 0 0 0
-10 -1 0 0 0
-11 -1 0 0 0
-12 -1 0 0 0
-13 -1 0 0 0
-14 -1 0 0 0
-
-FACE_PHOEBE
-Will she be okay?
-FACE_SID
-I've had a look at the implants and they should be easy to remove. She'll just have a headache for a while.
-FACE_CHRIS
-Will she be able to tell us anything useful?
-FACE_SID
-We'll have to wait for her memory to come back. She might not be able to remember anything she did while the implants were in.
-FACE_SID
-She'll still be able to pilot a ship though.
-FACE_NONE
-Ursula Lexx will now join you as a Wingmate. However, like Phoebe, she will not be available on certain missions.
diff --git a/data/cutscene6.dat b/data/cutscene6.dat
deleted file mode 100644
index 6fb950e..0000000
--- a/data/cutscene6.dat
+++ /dev/null
@@ -1,29 +0,0 @@
-gfx/mordor.jpg
--1.4 0
-
-0 0 200 300 1.5
-1 24 150 260 1.5
-2 20 110 300 1.5
-3 20 150 360 1.5
-4 -1 0 0 0
-5 -1 0 0 0
-6 -1 0 0 0
-7 -1 0 0 0
-8 -1 0 0 0
-9 -1 0 0 0
-10 -1 0 0 0
-11 -1 0 0 0
-12 -1 0 0 0
-13 -1 0 0 0
-14 -1 0 0 0
-
-FACE_CHRIS
-Sorry folks, we just lost our bargaining chip.
-FACE_SID
-Knowing how cut throat WEAPCO is I doubt it would have made a difference anyway.
-FACE_SID
-Sol is going to be difficult. I've heard they have a lot of heavy defenses on the outer planets.
-FACE_PHOEBE
-We'll have to start there then.
-FACE_SID
-The forces here will be unlike anything we've met so far. Just be careful, everyone.
diff --git a/src/Starfighter.cpp b/src/Starfighter.cpp
index 6e2c586..e579fcb 100644
--- a/src/Starfighter.cpp
+++ b/src/Starfighter.cpp
@@ -135,7 +135,7 @@ int main(int argc, char **argv)
case 2:
if (game.stationedPlanet == -1)
- doCutscene(0);
+ cutscene_init(0);
section = game_mainLoop();
break;
}
diff --git a/src/Starfighter.h b/src/Starfighter.h
index 7ce1d8b..9bdbc83 100644
--- a/src/Starfighter.h
+++ b/src/Starfighter.h
@@ -41,6 +41,7 @@ along with this program. If not, see .
#include "cargo.h"
#include "collectable.h"
#include "colors.h"
+#include "cutscene.h"
#include "engine.h"
#include "event.h"
#include "explosion.h"
@@ -55,7 +56,6 @@ along with this program. If not, see .
#include "renderer.h"
#include "resources.h"
#include "screen.h"
-#include "script.h"
#include "ship.h"
#include "shop.h"
#include "title.h"
diff --git a/src/alien.cpp b/src/alien.cpp
index d3d5dcd..0f599bc 100644
--- a/src/alien.cpp
+++ b/src/alien.cpp
@@ -913,7 +913,6 @@ void aliens_init()
if ((game.area == MISN_POSWIC) &&
(aliens[i].classDef == CD_BOSS))
{
- aliens[i].imageIndex[1] = 29;
aliens[i].flags |= FL_IMMORTAL;
}
@@ -975,15 +974,6 @@ void aliens_init()
if (game.area == MISN_FELLON)
{
aliens[ALIEN_BOSS].AIType = AI_EVASIVE;
-
- for (int i = 10 ; i < 15 ; i++)
- {
- aliens[i].imageIndex[0] += 15;
- aliens[i].imageIndex[1] += 15;
-
- aliens[i].image[0] = gfx_shipSprites[aliens[i].imageIndex[0]];
- aliens[i].image[1] = gfx_shipSprites[aliens[i].imageIndex[1]];
- }
}
}
else if (game.area == MISN_URANUS)
@@ -1212,7 +1202,8 @@ void alien_addSmallAsteroid(object *hostAlien)
if ((rand() % 10) > 3)
{
aliens[index] = alien_defs[CD_ASTEROID2];
- aliens[index].imageIndex[0] = aliens[index].imageIndex[1] = 39 + rand() % 2;
+ aliens[index].imageIndex[0] = RANDRANGE(SS_ASTEROID_SMALL, SS_ASTEROID_SMALL_L);
+ aliens[index].imageIndex[1] = aliens[index].imageIndex[0];
aliens[index].image[0] = gfx_shipSprites[aliens[index].imageIndex[0]];
aliens[index].image[1] = gfx_shipSprites[aliens[index].imageIndex[1]];
}
diff --git a/src/cutscene.cpp b/src/cutscene.cpp
new file mode 100644
index 0000000..8215667
--- /dev/null
+++ b/src/cutscene.cpp
@@ -0,0 +1,466 @@
+/*
+Copyright (C) 2003 Parallel Realities
+Copyright (C) 2011, 2012, 2013 Guus Sliepen
+Copyright (C) 2012, 2015, 2016 onpon4
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 3
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#include "Starfighter.h"
+
+typedef struct Message_ {
+
+ int face;
+ char message[255];
+
+} Message;
+
+
+static Message messages[MAX_EVENTS];
+
+void cutscene_init(int scene)
+{
+ screen_clear(black);
+ renderer_update();
+ screen_clear(black);
+
+ engine.keyState[KEY_FIRE] = 0;
+ engine.keyState[KEY_ALTFIRE] = 0;
+
+ engine.ssx = -0.5;
+ engine.ssy = 0;
+ engine.smx = 0;
+ engine.smy = 0;
+
+ screen_flushBuffer();
+ gfx_free();
+ resetLists();
+ loadGameGraphics();
+
+ for (int i = 0 ; i < ALIEN_MAX ; i++)
+ {
+ // 0 is the dualfighter, but there doesn't seem to be any
+ // particular reason for choosing this alien def.
+ aliens[i] = alien_defs[0];
+ aliens[i].face = 0;
+ aliens[i].active = false;
+ }
+
+ for (int i = 0 ; i < MAX_EVENTS ; i++)
+ {
+ strcpy(messages[i].message, "");
+ messages[i].face = -1;
+ }
+
+ switch (scene)
+ {
+ case 0:
+ loadBackground("gfx/spirit.jpg");
+ engine.ssx = -3;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
+ aliens[0].x = screen->w * 3 / 5;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 3.1;
+ aliens[0].active = true;
+
+ for (int i = 1 ; i < 7 ; i++)
+ {
+ aliens[i].image[0] = gfx_shipSprites[SS_DUALFIGHTER];
+ aliens[i].x = RANDRANGE(0, screen->w / 8);
+ aliens[i].y = RANDRANGE(50, screen->h - 50);
+ aliens[i].dx = 3;
+ aliens[i].active = true;
+ }
+
+ messages[0].face = -1;
+ strcpy(messages[0].message, "While escaping with his newly acquired Firefly, Chris Bainfield is intercepted by a WEAPCO patrol...");
+
+ messages[1].face = FS_CHRIS;
+ strcpy(messages[1].message, "These things just won't give up, will they?");
+
+ messages[2].face = FS_CHRIS;
+ strcpy(messages[2].message, "What a dilemma! I'm not all that familiar with this ship's controls, but I can't let this patrol reach my rendezvous point...");
+
+ messages[3].face = FS_CHRIS;
+ strcpy(messages[3].message, "I guess I'll have to fight them, then. Let's see what this ship can do!");
+
+ break;
+
+ case 1:
+ loadBackground("gfx/sol.jpg");
+ engine.ssx = -0.5;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_KLINE];
+ aliens[0].x = screen->w / 2;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 0.5;
+ aliens[0].active = true;
+
+ for (int i = 1 ; i < 15 ; i++)
+ {
+ aliens[i].image[0] = gfx_shipSprites[SS_DUALFIGHTER];
+ aliens[i].x = RANDRANGE(0, screen->w);
+ aliens[i].y = RANDRANGE(50, screen->h - 50);
+ aliens[i].dx = RANDRANGE(1, 3);
+ aliens[i].active = true;
+ }
+
+ messages[0].face = -1;
+ strcpy(messages[0].message, "A few hours later, in the Sol system, news has already spread of Chris Bainfield's heroic actions. The commander of WEAPCO's navy considers his options.");
+
+ messages[1].face = FS_KLINE;
+ strcpy(messages[1].message, "The Emperor will not be pleased. Spirit is now a free star system thanks to that interfering rebel pilot.");
+
+ messages[2].face = FS_KLINE;
+ strcpy(messages[2].message, "It was reported that he was able to take down one of our most powerful frigates in under 3 minutes!");
+
+ messages[3].face = FS_KLINE;
+ strcpy(messages[3].message, "Talent like that does not appear every day. He would be a perfect candidate for our new AI training program!");
+
+ messages[4].face = FS_KLINE;
+ strcpy(messages[4].message, "What a pity I must kill him...");
+
+ break;
+
+ case 2:
+ loadBackground("gfx/spirit.jpg");
+ engine.ssx = -1.4;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
+ aliens[0].x = screen->w / 4;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 1.5;
+ aliens[0].active = true;
+
+ aliens[1].image[0] = gfx_shipSprites[SS_SID];
+ aliens[1].x = screen->w / 4 - 50;
+ aliens[1].y = screen->h / 2 - 40;
+ aliens[1].dx = 1.5;
+ aliens[1].active = true;
+
+ messages[0].face = FS_SID;
+ strcpy(messages[0].message, "We're nearly ready to make the jump to Eyananth.");
+
+ messages[1].face = FS_CHRIS;
+ strcpy(messages[1].message, "Aren't there a lot of WEAPCO slaves in this system?");
+
+ messages[2].face = FS_SID;
+ strcpy(messages[2].message, "Yes. It's got one of the highest mortality rates in the galaxy.");
+
+ messages[3].face = FS_CHRIS;
+ strcpy(messages[3].message, "You think we can use that to our advantage?");
+
+ messages[4].face = FS_SID;
+ strcpy(messages[4].message, "I think so. I'll come up with a plan of action.");
+
+ messages[5].face = FS_SID;
+ strcpy(messages[5].message, "Just remember that we won't be in Spirit anymore and you may run into WEAPCO patrols while travelling.");
+
+ messages[6].face = FS_CHRIS;
+ strcpy(messages[6].message, "Sounds like fun!");
+
+ break;
+
+ case 3:
+ loadBackground("gfx/eyananth.jpg");
+ engine.ssx = -0.5;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
+ aliens[0].x = screen->w * 3 / 8;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 0.5;
+ aliens[0].active = true;
+
+ aliens[1].image[0] = gfx_shipSprites[SS_SID];
+ aliens[1].x = screen->w * 3 / 8 - 50;
+ aliens[1].y = screen->h / 2 - 40;
+ aliens[1].dx = 0.5;
+ aliens[1].active = true;
+
+ aliens[2].image[0] = gfx_shipSprites[SS_FRIEND];
+ aliens[2].x = screen->w * 3 / 8 - 50;
+ aliens[2].y = screen->h / 2 + 40;
+ aliens[2].dx = 0.5;
+ aliens[2].active = true;
+
+ messages[0].face = FS_PHOEBE;
+ strcpy(messages[0].message, "Nice head gear! You shop at the same place as me, huh?");
+
+ messages[1].face = FS_CHRIS;
+ strcpy(messages[1].message, "More importantly, what were you doing out there? You're lucky I was around!");
+
+ messages[2].face = FS_PHOEBE;
+ strcpy(messages[2].message, "I'm looking for my sister. She vanished about a week ago.");
+
+ messages[3].face = FS_PHOEBE;
+ strcpy(messages[3].message, "Hey! Wait a moment! You're that rebel from Spirit! I think you're so cool! Can I come with you?");
+
+ messages[4].face = FS_CHRIS;
+ strcpy(messages[4].message, "Extra firepower? I wouldn't mind one bit! What do you think, Sid?");
+
+ messages[5].face = FS_SID;
+ strcpy(messages[5].message, "I agree. I'm also interested in studying her homing missile launcher; it could come in handy.");
+
+ messages[6].face = FS_CHRIS;
+ strcpy(messages[6].message, "In that case, welcome aboard!");
+
+ messages[7].face = -1;
+ strcpy(messages[7].message, "Phoebe Lexx will now join you as a Wingmate. However, she will be unavailable on certain missions.");
+
+ break;
+
+ case 4:
+ loadBackground("gfx/eyananth.jpg");
+ engine.ssx = -1.4;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
+ aliens[0].x = screen->w / 4;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 1.5;
+ aliens[0].active = true;
+
+ aliens[1].image[0] = gfx_shipSprites[SS_SID];
+ aliens[1].x = screen->w / 4 - 50;
+ aliens[1].y = screen->h / 2 - 40;
+ aliens[1].dx = 1.5;
+ aliens[1].active = true;
+
+ aliens[2].image[0] = gfx_shipSprites[SS_FRIEND];
+ aliens[2].x = screen->w / 4 - 50;
+ aliens[2].y = screen->h / 2 + 40;
+ aliens[2].dx = 1.5;
+ aliens[2].active = true;
+
+ messages[0].face = FS_SID;
+ strcpy(messages[0].message, "What happened back there, Chris? The video feed was jammed.");
+
+ messages[1].face = FS_CHRIS;
+ strcpy(messages[1].message, "We took down the WEAPCO mining vessel and then I was jumped by a man claiming to be Kline Kethlan.");
+
+ messages[2].face = FS_SID;
+ strcpy(messages[2].message, "I've heard of him. He's the Commander of WEAPCO's naval forces. One of the best pilots they ever had.");
+
+ messages[3].face = FS_CHRIS;
+ strcpy(messages[3].message, "He did put up one hell of a fight! He didn't stick around for long, though. I guess he was just testing me.");
+
+ messages[4].face = FS_CHRIS;
+ strcpy(messages[4].message, "Anyway, what's the scoop on Mordor, Sid?");
+
+ messages[5].face = FS_SID;
+ strcpy(messages[5].message, "I've learned from the scientist we captured that WEAPCO is testing a new fighter craft there.");
+
+ messages[6].face = FS_CHRIS;
+ strcpy(messages[6].message, "We should probably destroy that craft, then. We might be able to thwart its development somewhat.");
+
+ messages[7].face = FS_SID;
+ strcpy(messages[7].message, "Agreed.");
+
+ messages[8].face = FS_PHOEBE;
+ strcpy(messages[8].message, "I wonder if my sister will be here...");
+
+ break;
+
+ case 5:
+ loadBackground("gfx/mordor.jpg");
+ engine.ssx = -0.5;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
+ aliens[0].x = screen->w * 3 / 8;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 0.5;
+ aliens[0].active = true;
+
+ aliens[1].image[0] = gfx_shipSprites[SS_SID];
+ aliens[1].x = screen->w * 3 / 8 - 50;
+ aliens[1].y = screen->h / 2 - 40;
+ aliens[1].dx = 0.5;
+ aliens[1].active = true;
+
+ aliens[2].image[0] = gfx_shipSprites[SS_FRIEND];
+ aliens[2].x = screen->w * 3 / 8 - 50;
+ aliens[2].y = screen->h / 2 + 40;
+ aliens[2].dx = 0.5;
+ aliens[2].active = true;
+
+ messages[0].face = FS_PHOEBE;
+ strcpy(messages[0].message, "Will she be okay?");
+
+ messages[1].face = FS_SID;
+ strcpy(messages[1].message, "I've had a look at the implants and they should be easy to remove. She'll just have a headache for a while.");
+
+ messages[2].face = FS_CHRIS;
+ strcpy(messages[2].message, "Will she be able to tell us anything useful?");
+
+ messages[3].face = FS_SID;
+ strcpy(messages[3].message, "We'll have to wait for her memory to come back. She might not be able to remember anything she did while the implants were in.");
+
+ messages[4].face = FS_SID;
+ strcpy(messages[4].message, "She'll still be able to pilot a ship though.");
+
+ messages[5].face = -1;
+ strcpy(messages[5].message, "Ursula Lexx will now join you as a Wingmate. However, like Phoebe, she will be unavailable on certain missions.");
+
+ break;
+
+ case 6:
+ loadBackground("gfx/mordor.jpg");
+ engine.ssx = -1.4;
+ engine.ssy = 0;
+
+ aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
+ aliens[0].x = screen->w / 4;
+ aliens[0].y = screen->h / 2;
+ aliens[0].dx = 1.5;
+ aliens[0].active = true;
+
+ aliens[1].image[0] = gfx_shipSprites[SS_SID];
+ aliens[1].x = screen->w / 4 - 50;
+ aliens[1].y = screen->h / 2 - 40;
+ aliens[1].dx = 1.5;
+ aliens[1].active = true;
+
+ aliens[2].image[0] = gfx_shipSprites[SS_FRIEND];
+ aliens[2].x = screen->w / 4 - 50;
+ aliens[2].y = screen->h / 2 + 40;
+ aliens[2].dx = 1.5;
+ aliens[2].active = true;
+
+ aliens[3].image[0] = gfx_shipSprites[SS_FRIEND];
+ aliens[3].x = screen->w / 4 - 90;
+ aliens[3].y = screen->h / 2;
+ aliens[3].dx = 1.5;
+ aliens[3].active = true;
+
+ messages[0].face = FS_CHRIS;
+ strcpy(messages[0].message, "Sorry folks, we just lost our bargaining chip.");
+
+ messages[1].face = FS_SID;
+ strcpy(messages[1].message, "Knowing how cut throat WEAPCO is I doubt it would have made a difference anyway.");
+
+ messages[2].face = FS_SID;
+ strcpy(messages[2].message, "Sol is going to be difficult. I've heard they have a lot of heavy defenses on the outer planets.");
+
+ messages[3].face = FS_PHOEBE;
+ strcpy(messages[3].message, "We'll have to start there then.");
+
+ messages[4].face = FS_SID;
+ strcpy(messages[4].message, "The forces here will be unlike anything we've met so far. Just be careful, everyone.");
+
+ break;
+ }
+
+ /*
+ Because we can fiddle with the images, we need to set the engines to
+ the correct places on the craft. Otherwise it will look wrong
+ */
+ for (int i = 0 ; i < 15 ; i++)
+ {
+ aliens[i].engineX = aliens[i].image[0]->w;
+ aliens[i].engineY = (aliens[i].image[0]->h / 2);
+ }
+
+ bool showMessage = false;
+ signed char currentMessage = -1;
+ int timer = 60 * 4;
+
+ screen_drawBackground();
+
+ SDL_Surface *face;
+
+ flushInput();
+
+ while (true)
+ {
+ renderer_update();
+ screen_unBuffer();
+ getPlayerInput();
+ game_doStars();
+ game_doExplosions();
+
+ for (int i = 0 ; i < 15 ; i++)
+ {
+ if (aliens[i].active)
+ {
+ explosion_addEngine(&aliens[i]);
+ if (scene == 0 && i > 0 && (timer % 15) == i) {
+ aliens[i].dx += (drand48() - 0.5) * 0.1;
+ aliens[i].dy += (drand48() - 0.5) * 0.1;
+ if (aliens[i].x > 500 - timer)
+ aliens[i].dx -= 0.2;
+ if (aliens[i].x < 0)
+ aliens[i].dx += 0.2;
+ }
+ aliens[i].x += aliens[i].dx;
+ aliens[i].y += aliens[i].dy;
+ aliens[i].x += engine.ssx + engine.smx;
+ screen_blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
+ if (aliens[i].x > (screen->w + 50))
+ {
+ aliens[i].x = -50;
+ aliens[i].y = rand() % (screen->h - 40);
+ }
+ if (aliens[i].y < -50)
+ aliens[i].y = (screen->h + 50);
+ if (aliens[i].y > (screen->h + 50))
+ aliens[i].y = -50;
+ }
+ }
+
+ timer--;
+ if (timer == 0)
+ {
+ showMessage = !showMessage;
+ timer = 120;
+ if (showMessage)
+ {
+ timer = 60 * 7;
+ currentMessage++;
+
+ if (currentMessage == 10)
+ break;
+
+ if (strcmp(messages[currentMessage].message, "") == 0)
+ break;
+
+ face = NULL;
+ if (messages[currentMessage].face != -1)
+ face = gfx_faceSprites[messages[currentMessage].face];
+ gfx_createMessageBox(face, messages[currentMessage].message, 0);
+ }
+ }
+
+ if ((showMessage) && (gfx_messageBox != NULL))
+ screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, screen->h - 100);
+
+ screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE);
+
+ game_delayFrame();
+
+ if ((engine.keyState[KEY_ESCAPE]) || (engine.keyState[KEY_FIRE]) ||
+ (engine.keyState[KEY_ALTFIRE]))
+ break;
+ }
+
+ screen_flushBuffer();
+ gfx_free();
+ screen_clear(black);
+ renderer_update();
+}
diff --git a/src/script.h b/src/cutscene.h
similarity index 85%
rename from src/script.h
rename to src/cutscene.h
index a883e5a..18f807c 100644
--- a/src/script.h
+++ b/src/cutscene.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 2003 Parallel Realities
Copyright (C) 2011 Guus Sliepen
-Copyright (C) 2015 onpon4
+Copyright (C) 2015, 2016 onpon4
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef SCRIPT_H
-#define SCRIPT_H
+#ifndef CUTSCENE_H
+#define CUTSCENE_H
-extern void doCutscene(int scene);
+void cutscene_init(int scene);
#endif
diff --git a/src/defs.h b/src/defs.h
index a0f81a1..5fa8951 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -149,7 +149,7 @@ enum {
ALIEN_SID,
ALIEN_FRIEND1,
ALIEN_FRIEND2,
- ALIEN_MAX = 25
+ ALIEN_MAX
};
// Droppables
diff --git a/src/game.cpp b/src/game.cpp
index 7b85591..e845cb4 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -2323,20 +2323,20 @@ int game_mainLoop()
switch (game.area)
{
case MISN_MOEBO:
- doCutscene(1);
- doCutscene(2);
+ cutscene_init(1);
+ cutscene_init(2);
break;
case MISN_NEROD:
- doCutscene(3);
+ cutscene_init(3);
break;
case MISN_ELAMALE:
- doCutscene(4);
+ cutscene_init(4);
break;
case MISN_ODEON:
- doCutscene(5);
+ cutscene_init(5);
break;
case MISN_ELLESH:
- doCutscene(6);
+ cutscene_init(6);
break;
case MISN_VENUS:
doCredits();
diff --git a/src/intermission.cpp b/src/intermission.cpp
index 0f59c15..91ea945 100644
--- a/src/intermission.cpp
+++ b/src/intermission.cpp
@@ -602,6 +602,7 @@ int intermission()
gfx_faceSprites[FS_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
gfx_faceSprites[FS_URSULA] = gfx_loadImage("gfx/face_ursula.png");
gfx_faceSprites[FS_KLINE] = gfx_loadImage("gfx/face_kline.png");
+ gfx_faceSprites[FS_CREW] = gfx_loadImage("gfx/face_crew.png");
engine.done = 0;
engine.keyState[KEY_FIRE] = 0;
diff --git a/src/resources.cpp b/src/resources.cpp
index 1e9df34..152fc88 100644
--- a/src/resources.cpp
+++ b/src/resources.cpp
@@ -51,6 +51,7 @@ void loadGameGraphics()
gfx_faceSprites[FS_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
gfx_faceSprites[FS_URSULA] = gfx_loadImage("gfx/face_ursula.png");
gfx_faceSprites[FS_KLINE] = gfx_loadImage("gfx/face_kline.png");
+ gfx_faceSprites[FS_CREW] = gfx_loadImage("gfx/face_crew.png");
// Ships
gfx_shipSprites[SS_FIREFLY] = gfx_loadImage("gfx/firefly1.png");
diff --git a/src/script.cpp b/src/script.cpp
deleted file mode 100644
index 311b4a6..0000000
--- a/src/script.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
-Copyright (C) 2003 Parallel Realities
-Copyright (C) 2011, 2012, 2013 Guus Sliepen
-Copyright (C) 2012, 2015, 2016 onpon4
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 3
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-#include "Starfighter.h"
-
-static cutMsg cutMessage[10];
-
-static void setScene(int scene)
-{
- FILE *fp;
- char string[255], face[255];
- float sx;
- float sy;
- float x;
- float y;
- float speed;
- int index;
- int img;
-
- sprintf(string, "data/cutscene%d.dat", scene);
-
- fp = fopen(string, "rb");
-
- // Load in the specified background
- if (fscanf(fp, "%s", string) < 1)
- {
- printf("Warning: didn't find a background definition for \"%s\"\n", string);
- strcpy(string, "gfx/spirit.jpg");
- }
- loadBackground(string);
-
- // Set the star speed
- if (fscanf(fp, "%f %f", &sx, &sy) < 2)
- printf("Warning: failed to read star speed data for cutscene");
- engine.ssx = sx;
- engine.ssy = sy;
-
- // Read in the specs for each ship
- while (fscanf(fp, "%d %d %f %f %f", &index, &img, &x, &y, &speed) == 5)
- {
- if (x < 0) x = (rand() % abs((int)x));
- if (y < 0) y = (rand() % abs((int)y));
- if (speed <= -1) speed = 1 + (rand() % abs((int)speed));
-
- if (img > -1)
- {
- aliens[index].image[0] = gfx_shipSprites[img];
- aliens[index].x = x;
- aliens[index].y = y;
- aliens[index].dx = speed;
- aliens[index].active = true;
- }
- }
-
- // And finally read in the messages
- index = 0;
- while (fscanf(fp, "%s%*c %[^\n]", face, string) == 2)
- {
- if (strcmp(string, "@none@") == 0)
- break;
-
- cutMessage[index].face = getFace(face);
- strcpy(cutMessage[index].message, string);
-
- index++;
- }
-
- fclose(fp);
-}
-
-void doCutscene(int scene)
-{
- screen_clear(black);
- renderer_update();
- screen_clear(black);
-
- engine.keyState[KEY_FIRE] = 0;
- engine.keyState[KEY_ALTFIRE] = 0;
-
- engine.ssx = -0.5;
- engine.ssy = 0;
- engine.smx = 0;
- engine.smy = 0;
-
- screen_flushBuffer();
- gfx_free();
- resetLists();
- loadGameGraphics();
-
- for (int i = 0 ; i < 15 ; i++)
- {
- aliens[i] = alien_defs[0];
- aliens[i].face = 0;
- aliens[i].active = false;
- }
-
- for (int i = 0 ; i < 10 ; i++)
- {
- strcpy(cutMessage[i].message, "");
- cutMessage[i].face = -1;
- }
-
- setScene(scene);
-
- /*
- Because we can fiddle with the images, we need to set the engines to
- the correct places on the craft. Otherwise it will look wrong
- */
- for (int i = 0 ; i < 15 ; i++)
- {
- aliens[i].engineX = aliens[i].image[0]->w;
- aliens[i].engineY = (aliens[i].image[0]->h / 2);
- }
-
- bool showMessage = false;
- signed char currentMessage = -1;
- int timer = 60 * 4;
-
- screen_drawBackground();
-
- SDL_Surface *face;
-
- flushInput();
-
- while (true)
- {
- renderer_update();
- screen_unBuffer();
- getPlayerInput();
- game_doStars();
- game_doExplosions();
-
- for (int i = 0 ; i < 15 ; i++)
- {
- if (aliens[i].active)
- {
- explosion_addEngine(&aliens[i]);
- if (scene == 0 && i > 0 && (timer % 15) == i) {
- aliens[i].dx += (drand48() - 0.5) * 0.1;
- aliens[i].dy += (drand48() - 0.5) * 0.1;
- if (aliens[i].x > 500 - timer)
- aliens[i].dx -= 0.2;
- if (aliens[i].x < 0)
- aliens[i].dx += 0.2;
- }
- aliens[i].x += aliens[i].dx;
- aliens[i].y += aliens[i].dy;
- aliens[i].x += engine.ssx + engine.smx;
- screen_blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
- if (aliens[i].x > (screen->w + 50))
- {
- aliens[i].x = -50;
- aliens[i].y = rand() % (screen->h - 40);
- }
- if (aliens[i].y < -50)
- aliens[i].y = (screen->h + 50);
- if (aliens[i].y > (screen->h + 50))
- aliens[i].y = -50;
- }
- }
-
- timer--;
- if (timer == 0)
- {
- showMessage = !showMessage;
- timer = 120;
- if (showMessage)
- {
- timer = 60 * 7;
- currentMessage++;
-
- if (currentMessage == 10)
- break;
-
- if (strcmp(cutMessage[currentMessage].message, "") == 0)
- break;
-
- face = NULL;
- if (cutMessage[currentMessage].face != -1)
- face = gfx_faceSprites[cutMessage[currentMessage].face];
- gfx_createMessageBox(face, cutMessage[currentMessage].message, 0);
- }
- }
-
- if ((showMessage) && (gfx_messageBox != NULL))
- screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, screen->h - 100);
-
- screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE);
-
- game_delayFrame();
-
- if ((engine.keyState[KEY_ESCAPE]) || (engine.keyState[KEY_FIRE]) ||
- (engine.keyState[KEY_ALTFIRE]))
- break;
- }
-
- screen_flushBuffer();
- gfx_free();
- screen_clear(black);
- renderer_update();
-}
diff --git a/src/structs.h b/src/structs.h
index f2071e3..a5a9346 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -227,11 +227,4 @@ typedef struct Planet_ {
} Planet;
-typedef struct cutMsg_ {
-
- int face;
- char message[255];
-
-} cutMsg;
-
#endif