Added AUTO option for music. Reorganised music for easier scanning.
This commit is contained in:
parent
92a9cd7ce6
commit
c8dd06dcdc
|
@ -9,7 +9,7 @@ vpath %.h $(SEARCHPATH)
|
|||
DEPS += defs.h structs.h
|
||||
|
||||
OBJS += ai.o
|
||||
OBJS += background.o battle.o bullets.o
|
||||
OBJS += battle.o bullets.o
|
||||
OBJS += capitalShips.o challengeHome.o challenges.o cJSON.o
|
||||
OBJS += debris.o dev.o draw.o
|
||||
OBJS += effects.o entities.o extractionPoint.o
|
||||
|
@ -22,7 +22,7 @@ OBJS += main.o messageBox.o mission.o missionInfo.o modalDialog.o
|
|||
OBJS += objectives.o options.o
|
||||
OBJS += player.o
|
||||
OBJS += quadtree.o
|
||||
OBJS += radar.o rope.o
|
||||
OBJS += radar.o resources.o rope.o
|
||||
OBJS += save.o script.o sound.o starfield.o starSystems.o stats.o
|
||||
OBJS += testMission.o textures.o text.o title.o transition.o
|
||||
OBJS += util.o
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Destroy all Darts",
|
||||
"background" : "AUTO",
|
||||
"planet" : "AUTO",
|
||||
"music" : "",
|
||||
"music" : "AUTO",
|
||||
"player" : {
|
||||
"type" : "Nymph",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Destroy all Darts",
|
||||
"background" : "AUTO",
|
||||
"planet" : "AUTO",
|
||||
"music" : "",
|
||||
"music" : "AUTO",
|
||||
"player" : {
|
||||
"type" : "Nymph",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Destroy all Darts",
|
||||
"background" : "AUTO",
|
||||
"planet" : "AUTO",
|
||||
"music" : "",
|
||||
"music" : "AUTO",
|
||||
"player" : {
|
||||
"type" : "Nymph",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Destroy all Lynxes",
|
||||
"background" : "AUTO",
|
||||
"planet" : "AUTO",
|
||||
"music" : "",
|
||||
"music" : "AUTO",
|
||||
"player" : {
|
||||
"type" : "Ray",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Disable all targets",
|
||||
"background" : "AUTO",
|
||||
"planet" : "AUTO",
|
||||
"music" : "",
|
||||
"music" : "AUTO",
|
||||
"player" : {
|
||||
"type" : "Hyena-A",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "60 second battle",
|
||||
"background" : "AUTO",
|
||||
"planet" : "AUTO",
|
||||
"music" : "",
|
||||
"music" : "AUTO",
|
||||
"player" : {
|
||||
"type" : "Hammerhead",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 8,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/torelli.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 13,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/torelli.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 4,
|
||||
"background" : "gfx/backgrounds/background04.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"epic" : {
|
||||
"fighterLimit" : 12
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 12,
|
||||
"background" : "gfx/backgrounds/background04.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 18,
|
||||
"background" : "gfx/backgrounds/background04.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 2,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/mythos.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 4,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/mythos.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"epic" : {
|
||||
"fighterLimit" : 12
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 8,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/mythos.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"epic" : {
|
||||
"fighterLimit" : 12
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 3,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Retrieve all packages",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"requires" : 4,
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 12,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"manualComplete" : 1,
|
||||
"player" : {
|
||||
"pilot" : "Lt. Cdr. Daniel Carr",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 17,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/track-4.mp3",
|
||||
"music" : "music/battle/track-4.mp3",
|
||||
"manualComplete" : 1,
|
||||
"player" : {
|
||||
"pilot" : "Lt. Cdr. Daniel Carr",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 13,
|
||||
"background" : "gfx/backgrounds/background01.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/track-3.mp3",
|
||||
"music" : "music/battle/track-3.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Destroy incoming bombers",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 18,
|
||||
"background" : "gfx/backgrounds/background01.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"epic" : {
|
||||
"fighterLimit" : 12
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 19,
|
||||
"background" : "gfx/backgrounds/background01.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Destroy munitions transports",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 21,
|
||||
"background" : "gfx/backgrounds/background01.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/heroism.ogg",
|
||||
"music" : "music/battle/heroism.ogg",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 26,
|
||||
"background" : "gfx/backgrounds/background01.jpg",
|
||||
"planet" : "gfx/planets/bluePlanet.png",
|
||||
"music" : "music/DST-RailJet-LongSeamlessLoop.ogg",
|
||||
"music" : "music/battle/DST-RailJet-LongSeamlessLoop.ogg",
|
||||
"epic" : {
|
||||
"fighterLimit" : 12
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 28,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/spirit.png",
|
||||
"music" : "music/InnerCore_Low.ogg",
|
||||
"music" : "music/battle/InnerCore_Low.ogg",
|
||||
"player" : {
|
||||
"type" : "TAF",
|
||||
"pilot" : "",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "A simple test flight. Get used to piloting your fighter, without threat of attack or any other dangers to face. There are no objectives to complete in this mission, so you may quit it at any time and move on to the next one.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"player" : {
|
||||
"type" : "TAF",
|
||||
"side" : "SIDE_ALLIES",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Practice using your fighter's weapons against a stationary target.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Destroy Dart",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Most targets you face in the field will be moving. This course gives you the chance to practice taking down an enemy that moves around.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Dart",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Face off against an opponent that is armed. The enemy in this course is a Dart, kitted out with twin particle cannons. It shouldn't prove too difficult a challenge.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Dart",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Practice using your ECM in the next encounter. The Dart here is equipped with missiles, which will home in on you. You can thwart these attacks by careful use of your ECM. Once you are done practicing, you can destroy the Dart and move on.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Dart",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Use your mag cannons to disable the enemy Dart. Disabling enemy craft and bringing the target in alive is sometimes an important step in securing lasting victory.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Disable Dart",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Battle along side two team mates to take on 3 enemy fighters.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Darts",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "Take on three enemy targets single handedly. Once again, these are Darts equipped with simple particle cannons. A single TAF should not find itself outclassed here, so long as the enemy are not allowed to gain the upper hand.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/earth.png",
|
||||
"music" : "music/Battle in the winter.mp3",
|
||||
"music" : "music/battle/Battle in the winter.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Darts",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description" : "The Pandoran's push in to Independent space has led to a surge in pirate activity along the Confederation border. The threat needs to be dealt with immediately, starting with cutting back on the enemy presense at Temper.",
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/spirit.png",
|
||||
"music" : "music/battleThemeA.mp3",
|
||||
"music" : "music/battle/battleThemeA.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Darts",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 1,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/spirit.png",
|
||||
"music" : "music/battleThemeA.mp3",
|
||||
"music" : "music/battle/battleThemeA.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate Darts",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 3,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/spirit.png",
|
||||
"music" : "music/battleThemeA.mp3",
|
||||
"music" : "music/battle/battleThemeA.mp3",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 5,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/spirit.png",
|
||||
"music" : "music/battleThemeA.mp3",
|
||||
"music" : "music/battle/battleThemeA.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Eliminate pirate leaders",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 8,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/spirit.png",
|
||||
"music" : "music/battleThemeA.mp3",
|
||||
"music" : "music/battle/battleThemeA.mp3",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 3,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/oracleIX.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Rescue all civilians",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 8,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/oracleIX.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Rescue all civilians",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 8,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/oracleIX.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"objectives" : [
|
||||
{
|
||||
"description" : "Rescue all civilians",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 13,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/oracleIX.png",
|
||||
"music" : "music/determination.mp3",
|
||||
"music" : "music/battle/determination.mp3",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"requires" : 22,
|
||||
"background" : "gfx/backgrounds/background03.jpg",
|
||||
"planet" : "gfx/planets/oracleIX.png",
|
||||
"music" : "music/track-4.mp3",
|
||||
"music" : "music/battle/track-4.mp3",
|
||||
"manualComplete" : 1,
|
||||
"objectives" : [
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ void initChallengeHome(void)
|
|||
|
||||
endSectionTransition();
|
||||
|
||||
playMusic("music/covert_operations.mp3");
|
||||
playMusic("music/main/covert_operations.mp3");
|
||||
}
|
||||
|
||||
static void unlockChallenges(void)
|
||||
|
|
|
@ -20,6 +20,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "draw.h"
|
||||
|
||||
static PointF backgroundPoint[4];
|
||||
|
||||
void initBackground(void)
|
||||
{
|
||||
backgroundPoint[0].x = -SCREEN_WIDTH / 2;
|
||||
backgroundPoint[0].y = -SCREEN_HEIGHT / 2;
|
||||
|
||||
backgroundPoint[1].x = SCREEN_WIDTH / 2;
|
||||
backgroundPoint[1].y = -SCREEN_HEIGHT / 2;
|
||||
|
||||
backgroundPoint[2].x = -SCREEN_WIDTH / 2;
|
||||
backgroundPoint[2].y = SCREEN_HEIGHT / 2;
|
||||
|
||||
backgroundPoint[3].x = SCREEN_WIDTH / 2;
|
||||
backgroundPoint[3].y = SCREEN_HEIGHT / 2;
|
||||
}
|
||||
|
||||
void prepareScene(void)
|
||||
{
|
||||
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||
|
@ -125,6 +142,47 @@ void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a)
|
|||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
|
||||
void scrollBackground(float x, float y)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
backgroundPoint[i].x += x;
|
||||
backgroundPoint[i].y += y;
|
||||
|
||||
if (backgroundPoint[i].x < 0)
|
||||
{
|
||||
backgroundPoint[i].x += (SCREEN_WIDTH * 2);
|
||||
}
|
||||
|
||||
if (backgroundPoint[i].x >= SCREEN_WIDTH)
|
||||
{
|
||||
backgroundPoint[i].x -= (SCREEN_WIDTH * 2);
|
||||
}
|
||||
|
||||
if (backgroundPoint[i].y < 0)
|
||||
{
|
||||
backgroundPoint[i].y += (SCREEN_HEIGHT * 2);
|
||||
}
|
||||
|
||||
if (backgroundPoint[i].y >= SCREEN_HEIGHT)
|
||||
{
|
||||
backgroundPoint[i].y -= (SCREEN_HEIGHT * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawBackground(SDL_Texture *texture)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
blitScaled(texture, backgroundPoint[i].x, backgroundPoint[i].y, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void saveScreenshot(void)
|
||||
{
|
||||
static int i = 0;
|
||||
|
|
|
@ -113,7 +113,7 @@ void initGalacticMap(void)
|
|||
|
||||
endSectionTransition();
|
||||
|
||||
playMusic("music/Pressure.ogg");
|
||||
playMusic("music/main/Pressure.ogg");
|
||||
}
|
||||
|
||||
static void updatePandoranAdvance(void)
|
||||
|
|
|
@ -32,6 +32,7 @@ static char **toTypeArray(char *types, int *numTypes);
|
|||
static void loadEpicData(cJSON *node);
|
||||
static char *getAutoBackground(char *filename);
|
||||
static char *getAutoPlanet(char *filename);
|
||||
static char *getAutoMusic(char *filename);
|
||||
|
||||
Mission *loadMissionMeta(char *filename)
|
||||
{
|
||||
|
@ -146,8 +147,6 @@ void loadMission(char *filename)
|
|||
|
||||
loadLocations(cJSON_GetObjectItem(root, "locations"));
|
||||
|
||||
STRNCPY(music, cJSON_GetObjectItem(root, "music")->valuestring, MAX_DESCRIPTION_LENGTH);
|
||||
|
||||
if (cJSON_GetObjectItem(root, "epic"))
|
||||
{
|
||||
loadEpicData(cJSON_GetObjectItem(root, "epic"));
|
||||
|
@ -165,7 +164,13 @@ void loadMission(char *filename)
|
|||
|
||||
initScript(cJSON_GetObjectItem(root, "script"));
|
||||
|
||||
/* planet and background loading must come last, so AUTO works properly */
|
||||
/* music, planet, and background loading must come last, so AUTO works properly */
|
||||
|
||||
STRNCPY(music, cJSON_GetObjectItem(root, "music")->valuestring, MAX_DESCRIPTION_LENGTH);
|
||||
if (strcmp(music, "AUTO") == 0)
|
||||
{
|
||||
STRNCPY(music, getAutoMusic(filename), MAX_DESCRIPTION_LENGTH);
|
||||
}
|
||||
|
||||
background = cJSON_GetObjectItem(root, "background")->valuestring;
|
||||
if (strcmp(background, "AUTO") == 0)
|
||||
|
@ -251,6 +256,22 @@ static char *getAutoPlanet(char *filename)
|
|||
return getPlanetTextureName(hash);
|
||||
}
|
||||
|
||||
static char *getAutoMusic(char *filename)
|
||||
{
|
||||
int hash;
|
||||
|
||||
if (!game.currentMission->challengeData.isChallenge)
|
||||
{
|
||||
hash = hashcode(game.selectedStarSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
hash = hashcode(filename);
|
||||
}
|
||||
|
||||
return getMusicFilename(hash);
|
||||
}
|
||||
|
||||
void completeMission(void)
|
||||
{
|
||||
if (battle.status == MS_IN_PROGRESS)
|
||||
|
|
|
@ -53,6 +53,7 @@ extern void updateStarSystemMissions(void);
|
|||
extern void updateChallengeMissions(void);
|
||||
extern char *getBackgroundTextureName(int n);
|
||||
extern char *getPlanetTextureName(int n);
|
||||
extern char *getMusicFilename(int n);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
|
|
|
@ -88,7 +88,7 @@ void initTitle(void)
|
|||
|
||||
endSectionTransition();
|
||||
|
||||
playMusic("music/Rise of spirit.ogg");
|
||||
playMusic("music/main/Rise of spirit.ogg");
|
||||
}
|
||||
|
||||
static void initFighters(void)
|
||||
|
|
|
@ -121,6 +121,7 @@ void initGameSystem(void)
|
|||
initFonts,
|
||||
initInput,
|
||||
initLookups,
|
||||
initResources,
|
||||
initSounds,
|
||||
initWidgets,
|
||||
initGame,
|
||||
|
@ -292,7 +293,7 @@ void cleanup(void)
|
|||
|
||||
destroyWidgets();
|
||||
|
||||
destroyBackground();
|
||||
destroyResources();
|
||||
|
||||
TTF_Quit();
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ extern void initStarSystems(void);
|
|||
extern void initChallenges(void);
|
||||
extern void initWidgets(void);
|
||||
extern void initBackground(void);
|
||||
extern void initResources(void);
|
||||
extern void destroyLookups(void);
|
||||
extern void destroyFonts(void);
|
||||
extern void destroySounds(void);
|
||||
|
@ -61,7 +62,7 @@ extern void destroyBattle(void);
|
|||
extern void destroyTextures(void);
|
||||
extern void destroyGalacticMap(void);
|
||||
extern void destroyWidgets(void);
|
||||
extern void destroyBackground(void);
|
||||
extern void destroyResources(void);
|
||||
extern void expireTexts(int all);
|
||||
extern void initInput(void);
|
||||
extern void initModalDialog(void);
|
||||
|
|
|
@ -18,20 +18,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "background.h"
|
||||
#include "resources.h"
|
||||
|
||||
static PointF backgroundPoint[4];
|
||||
char **backgrounds;
|
||||
char **planets;
|
||||
char **musicFiles;
|
||||
int numBackgrounds;
|
||||
int numPlanets;
|
||||
int numMusicFiles;
|
||||
|
||||
void initBackground(void)
|
||||
void initResources(void)
|
||||
{
|
||||
char **filenames;
|
||||
int i;
|
||||
|
||||
numBackgrounds = numPlanets = 0;
|
||||
numBackgrounds = numPlanets = numMusicFiles = 0;
|
||||
|
||||
filenames = getFileList(getFileLocation("gfx/backgrounds"), &numBackgrounds);
|
||||
backgrounds = malloc(sizeof(char*) * numBackgrounds);
|
||||
|
@ -41,6 +42,8 @@ void initBackground(void)
|
|||
backgrounds[i] = malloc(sizeof(char) * MAX_FILENAME_LENGTH);
|
||||
sprintf(backgrounds[i], "gfx/backgrounds/%s", filenames[i]);
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "'%s' added to AUTO resources list", filenames[i]);
|
||||
|
||||
free(filenames[i]);
|
||||
}
|
||||
|
||||
|
@ -54,63 +57,28 @@ void initBackground(void)
|
|||
planets[i] = malloc(sizeof(char) * MAX_FILENAME_LENGTH);
|
||||
sprintf(planets[i], "gfx/planets/%s", filenames[i]);
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "'%s' added to AUTO resources list", filenames[i]);
|
||||
|
||||
free(filenames[i]);
|
||||
}
|
||||
|
||||
free(filenames);
|
||||
|
||||
backgroundPoint[0].x = -SCREEN_WIDTH / 2;
|
||||
backgroundPoint[0].y = -SCREEN_HEIGHT / 2;
|
||||
filenames = getFileList(getFileLocation("music/battle/"), &numMusicFiles);
|
||||
|
||||
backgroundPoint[1].x = SCREEN_WIDTH / 2;
|
||||
backgroundPoint[1].y = -SCREEN_HEIGHT / 2;
|
||||
musicFiles = malloc(sizeof(char*) * numMusicFiles);
|
||||
|
||||
backgroundPoint[2].x = -SCREEN_WIDTH / 2;
|
||||
backgroundPoint[2].y = SCREEN_HEIGHT / 2;
|
||||
|
||||
backgroundPoint[3].x = SCREEN_WIDTH / 2;
|
||||
backgroundPoint[3].y = SCREEN_HEIGHT / 2;
|
||||
}
|
||||
|
||||
void scrollBackground(float x, float y)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
for (i = 0 ; i < numMusicFiles ; i++)
|
||||
{
|
||||
backgroundPoint[i].x += x;
|
||||
backgroundPoint[i].y += y;
|
||||
musicFiles[i] = malloc(sizeof(char) * MAX_FILENAME_LENGTH);
|
||||
sprintf(musicFiles[i], "music/battle/%s", filenames[i]);
|
||||
|
||||
if (backgroundPoint[i].x < 0)
|
||||
{
|
||||
backgroundPoint[i].x += (SCREEN_WIDTH * 2);
|
||||
}
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "'%s' added to AUTO resources list", filenames[i]);
|
||||
|
||||
if (backgroundPoint[i].x >= SCREEN_WIDTH)
|
||||
{
|
||||
backgroundPoint[i].x -= (SCREEN_WIDTH * 2);
|
||||
}
|
||||
|
||||
if (backgroundPoint[i].y < 0)
|
||||
{
|
||||
backgroundPoint[i].y += (SCREEN_HEIGHT * 2);
|
||||
}
|
||||
|
||||
if (backgroundPoint[i].y >= SCREEN_HEIGHT)
|
||||
{
|
||||
backgroundPoint[i].y -= (SCREEN_HEIGHT * 2);
|
||||
}
|
||||
free(filenames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void drawBackground(SDL_Texture *texture)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
{
|
||||
blitScaled(texture, backgroundPoint[i].x, backgroundPoint[i].y, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
free(filenames);
|
||||
}
|
||||
|
||||
char *getBackgroundTextureName(int i)
|
||||
|
@ -123,8 +91,14 @@ char *getPlanetTextureName(int i)
|
|||
return planets[i % numPlanets];
|
||||
}
|
||||
|
||||
void destroyBackground(void)
|
||||
char *getMusicFilename(int i)
|
||||
{
|
||||
return musicFiles[i % numMusicFiles];
|
||||
}
|
||||
|
||||
void destroyResources(void)
|
||||
{
|
||||
free(backgrounds);
|
||||
free(planets);
|
||||
free(musicFiles);
|
||||
}
|
Loading…
Reference in New Issue