From c8dd06dcdc449e3fc1ff3f4a502780742576f154 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 3 Mar 2016 16:16:12 +0000 Subject: [PATCH] Added AUTO option for music. Reorganised music for easier scanning. --- common.mk | 4 +- data/challenges/01.json | 2 +- data/challenges/02.json | 2 +- data/challenges/03.json | 2 +- data/challenges/04.json | 2 +- data/challenges/05.json | 2 +- data/challenges/06.json | 2 +- data/missions/alba/01 - patrol #1.json | 2 +- data/missions/alba/02 - patrol #2.json | 2 +- .../clarke/01 - clarke defence #1.json | 2 +- .../clarke/02 - clarke defence #2.json | 2 +- .../clarke/03 - clarke defence #3.json | 2 +- .../coyote/01 - coyote assault #1.json | 2 +- .../coyote/02 - coyote assault #2.json | 2 +- .../coyote/03 - coyote assault #3.json | 2 +- .../granada/01 - suspect packages #1.json | 2 +- .../granada/02 - suspect packages #2.json | 2 +- .../granada/03 - suspect packages #3.json | 2 +- data/missions/granada/04 - pirate smash.json | 2 +- .../missions/iliad/01 - iliad defence #1.json | 2 +- .../missions/iliad/02 - iliad defence #2.json | 2 +- .../missions/iliad/03 - iliad defence #3.json | 2 +- .../missions/iliad/04 - iliad defence #4.json | 2 +- .../missions/iliad/05 - iliad defence #5.json | 2 +- data/missions/mace/01 - rebel assault #1.json | 2 +- data/missions/sol/01 - free flight.json | 2 +- data/missions/sol/02 - weapons.json | 2 +- data/missions/sol/03 - moving target.json | 2 +- data/missions/sol/04 - armed target.json | 2 +- data/missions/sol/05 - ecm.json | 2 +- data/missions/sol/06 - mag.json | 2 +- data/missions/sol/07 - wingmates.json | 2 +- data/missions/sol/08 - final.json | 2 +- .../temper/01 - pirate uprising #1.json | 2 +- .../temper/02 - pirate uprising #2.json | 2 +- .../temper/03 - pirate uprising #3.json | 2 +- .../temper/04 - pirate uprising #4.json | 2 +- .../temper/05 - pirate uprising #5.json | 2 +- data/missions/warro/01 - evacuation #1.json | 2 +- data/missions/warro/02 - evacuation #2.json | 2 +- data/missions/warro/03 - evacuation #3.json | 2 +- data/missions/warro/04 - evacuation #4.json | 2 +- data/missions/warro/05 - evacuation #5.json | 2 +- music/{ => battle}/Battle in the winter.mp3 | Bin .../DST-RailJet-LongSeamlessLoop.ogg | Bin music/{ => battle}/InnerCore_Low.ogg | Bin music/{ => battle}/Showdown.mp3 | Bin music/{ => battle}/battleThemeA.mp3 | Bin music/{ => battle}/determination.mp3 | Bin music/{ => battle}/heroism.ogg | Bin music/{ => battle}/track-1.mp3 | Bin music/{ => battle}/track-3.mp3 | Bin music/{ => battle}/track-4.mp3 | Bin music/{ => main}/Pressure.ogg | Bin music/{ => main}/Rise of spirit.ogg | Bin music/{ => main}/covert_operations.mp3 | Bin src/challenges/challengeHome.c | 2 +- src/draw/draw.c | 58 ++++++++++++++ src/galaxy/galacticMap.c | 2 +- src/galaxy/mission.c | 27 ++++++- src/galaxy/mission.h | 1 + src/game/title.c | 2 +- src/system/init.c | 3 +- src/system/init.h | 3 +- src/{draw/background.c => system/resources.c} | 74 ++++++------------ src/{draw/background.h => system/resources.h} | 0 66 files changed, 158 insertions(+), 102 deletions(-) rename music/{ => battle}/Battle in the winter.mp3 (100%) rename music/{ => battle}/DST-RailJet-LongSeamlessLoop.ogg (100%) rename music/{ => battle}/InnerCore_Low.ogg (100%) rename music/{ => battle}/Showdown.mp3 (100%) rename music/{ => battle}/battleThemeA.mp3 (100%) rename music/{ => battle}/determination.mp3 (100%) rename music/{ => battle}/heroism.ogg (100%) rename music/{ => battle}/track-1.mp3 (100%) rename music/{ => battle}/track-3.mp3 (100%) rename music/{ => battle}/track-4.mp3 (100%) rename music/{ => main}/Pressure.ogg (100%) rename music/{ => main}/Rise of spirit.ogg (100%) rename music/{ => main}/covert_operations.mp3 (100%) rename src/{draw/background.c => system/resources.c} (59%) rename src/{draw/background.h => system/resources.h} (100%) diff --git a/common.mk b/common.mk index e875f44..900896b 100644 --- a/common.mk +++ b/common.mk @@ -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 diff --git a/data/challenges/01.json b/data/challenges/01.json index 8840f03..4ec010b 100644 --- a/data/challenges/01.json +++ b/data/challenges/01.json @@ -3,7 +3,7 @@ "description" : "Destroy all Darts", "background" : "AUTO", "planet" : "AUTO", - "music" : "", + "music" : "AUTO", "player" : { "type" : "Nymph", "side" : "SIDE_ALLIES", diff --git a/data/challenges/02.json b/data/challenges/02.json index 2e1f646..f9e2d34 100644 --- a/data/challenges/02.json +++ b/data/challenges/02.json @@ -3,7 +3,7 @@ "description" : "Destroy all Darts", "background" : "AUTO", "planet" : "AUTO", - "music" : "", + "music" : "AUTO", "player" : { "type" : "Nymph", "side" : "SIDE_ALLIES", diff --git a/data/challenges/03.json b/data/challenges/03.json index 4ef6daa..990b632 100644 --- a/data/challenges/03.json +++ b/data/challenges/03.json @@ -3,7 +3,7 @@ "description" : "Destroy all Darts", "background" : "AUTO", "planet" : "AUTO", - "music" : "", + "music" : "AUTO", "player" : { "type" : "Nymph", "side" : "SIDE_ALLIES", diff --git a/data/challenges/04.json b/data/challenges/04.json index 81f74f0..500301c 100644 --- a/data/challenges/04.json +++ b/data/challenges/04.json @@ -3,7 +3,7 @@ "description" : "Destroy all Lynxes", "background" : "AUTO", "planet" : "AUTO", - "music" : "", + "music" : "AUTO", "player" : { "type" : "Ray", "side" : "SIDE_ALLIES", diff --git a/data/challenges/05.json b/data/challenges/05.json index 7eccbef..ae68300 100644 --- a/data/challenges/05.json +++ b/data/challenges/05.json @@ -3,7 +3,7 @@ "description" : "Disable all targets", "background" : "AUTO", "planet" : "AUTO", - "music" : "", + "music" : "AUTO", "player" : { "type" : "Hyena-A", "side" : "SIDE_ALLIES", diff --git a/data/challenges/06.json b/data/challenges/06.json index ef28298..2f97c4a 100644 --- a/data/challenges/06.json +++ b/data/challenges/06.json @@ -3,7 +3,7 @@ "description" : "60 second battle", "background" : "AUTO", "planet" : "AUTO", - "music" : "", + "music" : "AUTO", "player" : { "type" : "Hammerhead", "side" : "SIDE_ALLIES", diff --git a/data/missions/alba/01 - patrol #1.json b/data/missions/alba/01 - patrol #1.json index 6243799..a61fcc0 100644 --- a/data/missions/alba/01 - patrol #1.json +++ b/data/missions/alba/01 - patrol #1.json @@ -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" : [ { diff --git a/data/missions/alba/02 - patrol #2.json b/data/missions/alba/02 - patrol #2.json index 05bba23..5a13794 100644 --- a/data/missions/alba/02 - patrol #2.json +++ b/data/missions/alba/02 - patrol #2.json @@ -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" : [ { diff --git a/data/missions/clarke/01 - clarke defence #1.json b/data/missions/clarke/01 - clarke defence #1.json index ac4c840..6656fe3 100644 --- a/data/missions/clarke/01 - clarke defence #1.json +++ b/data/missions/clarke/01 - clarke defence #1.json @@ -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 }, diff --git a/data/missions/clarke/02 - clarke defence #2.json b/data/missions/clarke/02 - clarke defence #2.json index c7b27ef..391c66c 100644 --- a/data/missions/clarke/02 - clarke defence #2.json +++ b/data/missions/clarke/02 - clarke defence #2.json @@ -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" : [ { diff --git a/data/missions/clarke/03 - clarke defence #3.json b/data/missions/clarke/03 - clarke defence #3.json index 9c5a507..2dd38c7 100644 --- a/data/missions/clarke/03 - clarke defence #3.json +++ b/data/missions/clarke/03 - clarke defence #3.json @@ -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" : [ { diff --git a/data/missions/coyote/01 - coyote assault #1.json b/data/missions/coyote/01 - coyote assault #1.json index 94131ed..77d41b2 100644 --- a/data/missions/coyote/01 - coyote assault #1.json +++ b/data/missions/coyote/01 - coyote assault #1.json @@ -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" : [ { diff --git a/data/missions/coyote/02 - coyote assault #2.json b/data/missions/coyote/02 - coyote assault #2.json index 0be7545..9f09cf0 100644 --- a/data/missions/coyote/02 - coyote assault #2.json +++ b/data/missions/coyote/02 - coyote assault #2.json @@ -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 }, diff --git a/data/missions/coyote/03 - coyote assault #3.json b/data/missions/coyote/03 - coyote assault #3.json index cf9829f..920c2fc 100644 --- a/data/missions/coyote/03 - coyote assault #3.json +++ b/data/missions/coyote/03 - coyote assault #3.json @@ -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 }, diff --git a/data/missions/granada/01 - suspect packages #1.json b/data/missions/granada/01 - suspect packages #1.json index fe31c3d..75bad59 100644 --- a/data/missions/granada/01 - suspect packages #1.json +++ b/data/missions/granada/01 - suspect packages #1.json @@ -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", diff --git a/data/missions/granada/02 - suspect packages #2.json b/data/missions/granada/02 - suspect packages #2.json index 99e3d1b..12aa84f 100644 --- a/data/missions/granada/02 - suspect packages #2.json +++ b/data/missions/granada/02 - suspect packages #2.json @@ -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" : [ { diff --git a/data/missions/granada/03 - suspect packages #3.json b/data/missions/granada/03 - suspect packages #3.json index b0a3039..87663cf 100644 --- a/data/missions/granada/03 - suspect packages #3.json +++ b/data/missions/granada/03 - suspect packages #3.json @@ -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", diff --git a/data/missions/granada/04 - pirate smash.json b/data/missions/granada/04 - pirate smash.json index 8ede394..68b26ec 100644 --- a/data/missions/granada/04 - pirate smash.json +++ b/data/missions/granada/04 - pirate smash.json @@ -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", diff --git a/data/missions/iliad/01 - iliad defence #1.json b/data/missions/iliad/01 - iliad defence #1.json index 33dd04d..eaa8bf8 100644 --- a/data/missions/iliad/01 - iliad defence #1.json +++ b/data/missions/iliad/01 - iliad defence #1.json @@ -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", diff --git a/data/missions/iliad/02 - iliad defence #2.json b/data/missions/iliad/02 - iliad defence #2.json index 716c87c..d5f3098 100644 --- a/data/missions/iliad/02 - iliad defence #2.json +++ b/data/missions/iliad/02 - iliad defence #2.json @@ -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 }, diff --git a/data/missions/iliad/03 - iliad defence #3.json b/data/missions/iliad/03 - iliad defence #3.json index 91dbd80..dfde7ae 100644 --- a/data/missions/iliad/03 - iliad defence #3.json +++ b/data/missions/iliad/03 - iliad defence #3.json @@ -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", diff --git a/data/missions/iliad/04 - iliad defence #4.json b/data/missions/iliad/04 - iliad defence #4.json index 0f709df..7325fe8 100644 --- a/data/missions/iliad/04 - iliad defence #4.json +++ b/data/missions/iliad/04 - iliad defence #4.json @@ -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" : [ { diff --git a/data/missions/iliad/05 - iliad defence #5.json b/data/missions/iliad/05 - iliad defence #5.json index c8c8c06..d3f9789 100644 --- a/data/missions/iliad/05 - iliad defence #5.json +++ b/data/missions/iliad/05 - iliad defence #5.json @@ -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 }, diff --git a/data/missions/mace/01 - rebel assault #1.json b/data/missions/mace/01 - rebel assault #1.json index a3fa3b8..d119150 100644 --- a/data/missions/mace/01 - rebel assault #1.json +++ b/data/missions/mace/01 - rebel assault #1.json @@ -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" : "", diff --git a/data/missions/sol/01 - free flight.json b/data/missions/sol/01 - free flight.json index df8171a..89e6c47 100644 --- a/data/missions/sol/01 - free flight.json +++ b/data/missions/sol/01 - free flight.json @@ -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", diff --git a/data/missions/sol/02 - weapons.json b/data/missions/sol/02 - weapons.json index 62f2a5d..3108605 100644 --- a/data/missions/sol/02 - weapons.json +++ b/data/missions/sol/02 - weapons.json @@ -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", diff --git a/data/missions/sol/03 - moving target.json b/data/missions/sol/03 - moving target.json index 69b96ae..72f0840 100644 --- a/data/missions/sol/03 - moving target.json +++ b/data/missions/sol/03 - moving target.json @@ -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", diff --git a/data/missions/sol/04 - armed target.json b/data/missions/sol/04 - armed target.json index 1d64621..3820629 100644 --- a/data/missions/sol/04 - armed target.json +++ b/data/missions/sol/04 - armed target.json @@ -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", diff --git a/data/missions/sol/05 - ecm.json b/data/missions/sol/05 - ecm.json index fdc21ae..097f6b1 100644 --- a/data/missions/sol/05 - ecm.json +++ b/data/missions/sol/05 - ecm.json @@ -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", diff --git a/data/missions/sol/06 - mag.json b/data/missions/sol/06 - mag.json index 331e4da..73c9128 100644 --- a/data/missions/sol/06 - mag.json +++ b/data/missions/sol/06 - mag.json @@ -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", diff --git a/data/missions/sol/07 - wingmates.json b/data/missions/sol/07 - wingmates.json index cae16da..63a5963 100644 --- a/data/missions/sol/07 - wingmates.json +++ b/data/missions/sol/07 - wingmates.json @@ -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", diff --git a/data/missions/sol/08 - final.json b/data/missions/sol/08 - final.json index 963fb98..b3c0a40 100644 --- a/data/missions/sol/08 - final.json +++ b/data/missions/sol/08 - final.json @@ -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", diff --git a/data/missions/temper/01 - pirate uprising #1.json b/data/missions/temper/01 - pirate uprising #1.json index 4b114ad..8667590 100644 --- a/data/missions/temper/01 - pirate uprising #1.json +++ b/data/missions/temper/01 - pirate uprising #1.json @@ -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", diff --git a/data/missions/temper/02 - pirate uprising #2.json b/data/missions/temper/02 - pirate uprising #2.json index 584c6fc..1c96554 100644 --- a/data/missions/temper/02 - pirate uprising #2.json +++ b/data/missions/temper/02 - pirate uprising #2.json @@ -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", diff --git a/data/missions/temper/03 - pirate uprising #3.json b/data/missions/temper/03 - pirate uprising #3.json index ef0f84c..53accb4 100644 --- a/data/missions/temper/03 - pirate uprising #3.json +++ b/data/missions/temper/03 - pirate uprising #3.json @@ -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" : [ { diff --git a/data/missions/temper/04 - pirate uprising #4.json b/data/missions/temper/04 - pirate uprising #4.json index 71abd58..41efa17 100644 --- a/data/missions/temper/04 - pirate uprising #4.json +++ b/data/missions/temper/04 - pirate uprising #4.json @@ -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", diff --git a/data/missions/temper/05 - pirate uprising #5.json b/data/missions/temper/05 - pirate uprising #5.json index d897ec8..5c1953e 100644 --- a/data/missions/temper/05 - pirate uprising #5.json +++ b/data/missions/temper/05 - pirate uprising #5.json @@ -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" : [ { diff --git a/data/missions/warro/01 - evacuation #1.json b/data/missions/warro/01 - evacuation #1.json index 6432a20..ddebf90 100644 --- a/data/missions/warro/01 - evacuation #1.json +++ b/data/missions/warro/01 - evacuation #1.json @@ -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", diff --git a/data/missions/warro/02 - evacuation #2.json b/data/missions/warro/02 - evacuation #2.json index 027f332..0f4cc9c 100644 --- a/data/missions/warro/02 - evacuation #2.json +++ b/data/missions/warro/02 - evacuation #2.json @@ -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", diff --git a/data/missions/warro/03 - evacuation #3.json b/data/missions/warro/03 - evacuation #3.json index d0c1fe0..f6c06b5 100644 --- a/data/missions/warro/03 - evacuation #3.json +++ b/data/missions/warro/03 - evacuation #3.json @@ -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", diff --git a/data/missions/warro/04 - evacuation #4.json b/data/missions/warro/04 - evacuation #4.json index e3aea1a..edb76da 100644 --- a/data/missions/warro/04 - evacuation #4.json +++ b/data/missions/warro/04 - evacuation #4.json @@ -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" : [ { diff --git a/data/missions/warro/05 - evacuation #5.json b/data/missions/warro/05 - evacuation #5.json index 6814009..479472b 100644 --- a/data/missions/warro/05 - evacuation #5.json +++ b/data/missions/warro/05 - evacuation #5.json @@ -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" : [ { diff --git a/music/Battle in the winter.mp3 b/music/battle/Battle in the winter.mp3 similarity index 100% rename from music/Battle in the winter.mp3 rename to music/battle/Battle in the winter.mp3 diff --git a/music/DST-RailJet-LongSeamlessLoop.ogg b/music/battle/DST-RailJet-LongSeamlessLoop.ogg similarity index 100% rename from music/DST-RailJet-LongSeamlessLoop.ogg rename to music/battle/DST-RailJet-LongSeamlessLoop.ogg diff --git a/music/InnerCore_Low.ogg b/music/battle/InnerCore_Low.ogg similarity index 100% rename from music/InnerCore_Low.ogg rename to music/battle/InnerCore_Low.ogg diff --git a/music/Showdown.mp3 b/music/battle/Showdown.mp3 similarity index 100% rename from music/Showdown.mp3 rename to music/battle/Showdown.mp3 diff --git a/music/battleThemeA.mp3 b/music/battle/battleThemeA.mp3 similarity index 100% rename from music/battleThemeA.mp3 rename to music/battle/battleThemeA.mp3 diff --git a/music/determination.mp3 b/music/battle/determination.mp3 similarity index 100% rename from music/determination.mp3 rename to music/battle/determination.mp3 diff --git a/music/heroism.ogg b/music/battle/heroism.ogg similarity index 100% rename from music/heroism.ogg rename to music/battle/heroism.ogg diff --git a/music/track-1.mp3 b/music/battle/track-1.mp3 similarity index 100% rename from music/track-1.mp3 rename to music/battle/track-1.mp3 diff --git a/music/track-3.mp3 b/music/battle/track-3.mp3 similarity index 100% rename from music/track-3.mp3 rename to music/battle/track-3.mp3 diff --git a/music/track-4.mp3 b/music/battle/track-4.mp3 similarity index 100% rename from music/track-4.mp3 rename to music/battle/track-4.mp3 diff --git a/music/Pressure.ogg b/music/main/Pressure.ogg similarity index 100% rename from music/Pressure.ogg rename to music/main/Pressure.ogg diff --git a/music/Rise of spirit.ogg b/music/main/Rise of spirit.ogg similarity index 100% rename from music/Rise of spirit.ogg rename to music/main/Rise of spirit.ogg diff --git a/music/covert_operations.mp3 b/music/main/covert_operations.mp3 similarity index 100% rename from music/covert_operations.mp3 rename to music/main/covert_operations.mp3 diff --git a/src/challenges/challengeHome.c b/src/challenges/challengeHome.c index 6f8fab1..6bf77c0 100644 --- a/src/challenges/challengeHome.c +++ b/src/challenges/challengeHome.c @@ -99,7 +99,7 @@ void initChallengeHome(void) endSectionTransition(); - playMusic("music/covert_operations.mp3"); + playMusic("music/main/covert_operations.mp3"); } static void unlockChallenges(void) diff --git a/src/draw/draw.c b/src/draw/draw.c index 06c1f89..57248f2 100644 --- a/src/draw/draw.c +++ b/src/draw/draw.c @@ -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; diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 0b37f3d..d80a291 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -113,7 +113,7 @@ void initGalacticMap(void) endSectionTransition(); - playMusic("music/Pressure.ogg"); + playMusic("music/main/Pressure.ogg"); } static void updatePandoranAdvance(void) diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 5e247e1..1a294fb 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -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) diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index c2a62dd..ce381a5 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -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; diff --git a/src/game/title.c b/src/game/title.c index 7dd1c4f..0ac10e4 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -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) diff --git a/src/system/init.c b/src/system/init.c index 2274910..a9e4359 100644 --- a/src/system/init.c +++ b/src/system/init.c @@ -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(); diff --git a/src/system/init.h b/src/system/init.h index f04014d..4ed57d6 100644 --- a/src/system/init.h +++ b/src/system/init.h @@ -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); diff --git a/src/draw/background.c b/src/system/resources.c similarity index 59% rename from src/draw/background.c rename to src/system/resources.c index c331188..055cf87 100644 --- a/src/draw/background.c +++ b/src/system/resources.c @@ -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); } diff --git a/src/draw/background.h b/src/system/resources.h similarity index 100% rename from src/draw/background.h rename to src/system/resources.h