--- a/hedgewars/CMakeLists.txt Fri Jul 25 19:06:46 2008 +0000
+++ b/hedgewars/CMakeLists.txt Fri Jul 25 19:26:44 2008 +0000
@@ -41,7 +41,6 @@
HHHandlers.inc
SinTable.inc
options.inc
- ${CMAKE_CURRENT_BINARY_DIR}/playlist.inc
${CMAKE_CURRENT_BINARY_DIR}/proto.inc
tunsetborder.inc
)
--- a/hedgewars/hwengine.dpr Fri Jul 25 19:06:46 2008 +0000
+++ b/hedgewars/hwengine.dpr Fri Jul 25 19:26:44 2008 +0000
@@ -66,25 +66,16 @@
////////////////////////////////
procedure DoTimer(Lag: LongInt);
-const MusicTimerTicks: Longword = 0;
var s: string;
begin
inc(RealTicks, Lag);
-inc(MusicTimerTicks, Lag);
-if (MusicTimerTicks > 3000) and (GameState > gsStart) then
- begin
- PlayMusic;
- MusicTimerTicks:= 0
- end;
-
case GameState of
gsLandGen: begin
GenMap;
GameState:= gsStart;
end;
gsStart: begin
- InitPlaylistChunk(GetRandom(High(LongWord)));
AddClouds;
AssignHHCoords;
AddMiscGears;
@@ -97,6 +88,7 @@
isSoundEnabled:= false
end;
FinishProgress;
+ PlayMusic;
GameState:= gsGame
end;
gsConfirm,
--- a/hedgewars/uLandObjects.pas Fri Jul 25 19:06:46 2008 +0000
+++ b/hedgewars/uLandObjects.pas Fri Jul 25 19:26:44 2008 +0000
@@ -26,7 +26,7 @@
procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface);
implementation
-uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, GL;
+uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, GL, uSound;
const MaxRects = 256;
MAXOBJECTRECTS = 16;
MAXTHEMEOBJECTS = 32;
@@ -373,6 +373,9 @@
glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99); // sky color
cExplosionBorderColor:= c2.value or $FF000000;
+ReadLn(f, s);
+if MusicFN = '' then MusicFN:= s;
+
Readln(f, ThemeObjects.Count);
for i:= 0 to Pred(ThemeObjects.Count) do
begin
--- a/hedgewars/uSound.pas Fri Jul 25 19:06:46 2008 +0000
+++ b/hedgewars/uSound.pas Fri Jul 25 19:26:44 2008 +0000
@@ -30,17 +30,14 @@
function ChangeVolume(voldelta: LongInt): LongInt;
procedure InitPlaylistChunk(seed: LongWord);
+var MusicFN: shortstring = '';
+
implementation
uses uMisc, uConsole;
-{$INCLUDE playlist.inc}
-
const chanTPU = 12;
var Mus: PMixMusic = nil;
Volume: LongInt;
-{$IFDEF HAVE_MUSIC}
- CurrMusic: Longword = 0;
-{$ENDIF}
procedure InitSound;
begin
@@ -52,7 +49,7 @@
if isSoundEnabled then WriteLnToConsole(msgOK)
else WriteLnToConsole(msgFailed);
Mix_AllocateChannels(Succ(chanTPU));
-Mix_VolumeMusic(48);
+Mix_VolumeMusic(64);
Volume:= cInitVolume;
if Volume < 0 then Volume:= 0;
@@ -99,27 +96,19 @@
end;
procedure PlayMusic;
-{$IFDEF HAVE_MUSIC}
var s: string;
-{$ENDIF}
begin
-{$IFDEF HAVE_MUSIC}
-if not isSoundEnabled then exit;
-if Mix_PlayingMusic() <> 0 then exit;
+if (not isSoundEnabled)
+ or (MusicFN = '') then exit;
-Mix_FreeMusic(Mus);
-
-CurrMusic:= playlistchain[CurrMusic];
-
-s:= PathPrefix + '/Music/' + playlist[CurrMusic];
+s:= PathPrefix + '/Music/' + MusicFN;
WriteToConsole(msgLoading + s + ' ');
Mus:= Mix_LoadMUS(Str2PChar(s));
TryDo(Mus <> nil, msgFailed, false);
WriteLnToConsole(msgOK);
-Mix_PlayMusic(Mus, 1)
-{$ENDIF}
+Mix_PlayMusic(Mus, -1)
end;
function ChangeVolume(voldelta: LongInt): LongInt;
--- a/share/hedgewars/Data/Music/CMakeLists.txt Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Music/CMakeLists.txt Fri Jul 25 19:26:44 2008 +0000
@@ -1,33 +1,5 @@
file(GLOB BaseMusic *.ogg)
-list(LENGTH BaseMusic PlayListLength)
-
-set(PlayListINCFile ${CMAKE_BINARY_DIR}/hedgewars/playlist.inc)
-
-file(WRITE ${PlayListINCFile} "const cPlayListLength = " ${PlayListLength} ";")
-
-if(PlayListLength GREATER 0)
- file(APPEND ${PlayListINCFile} "{$DEFINE HAVE_MUSIC}")
- file(APPEND ${PlayListINCFile} "playlist: array[0..Pred(cPlayListLength)] of string = (")
-
- set(i ${PlayListLength})
- foreach(musicfile ${BaseMusic})
- math(EXPR i "${i} - 1")
-
- get_filename_component(relfilename ${musicfile} NAME)
-
- file(APPEND ${PlayListINCFile} '${relfilename}')
-
- if(i GREATER 0)
- file(APPEND ${PlayListINCFile} ",")
- endif(i GREATER 0)
- endforeach(musicfile)
-
- file(APPEND ${PlayListINCFile} ");")
-
- file(APPEND ${PlayListINCFile} "var playlistchain: array[0..Pred(cPlayListLength)] of LongWord;")
-endif(PlayListLength GREATER 0)
-
install(FILES
${BaseMusic}
DESTINATION ${SHAREPATH}Data/Music)
--- a/share/hedgewars/Data/Themes/Bamboo/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/Bamboo/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
117 141 186
0 0 0
+
0
0
100
--- a/share/hedgewars/Data/Themes/Bath/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/Bath/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
255 255 237
28 52 9
+
0
0
0
--- a/share/hedgewars/Data/Themes/City/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/City/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
21 20 38
128 0 0
+city.ogg
4
plant1
200 344 54 2 1 0 0 160 215
--- a/share/hedgewars/Data/Themes/EarthRise/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/EarthRise/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
0 0 0
42 42 42
+
0
0
0
--- a/share/hedgewars/Data/Themes/Island/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/Island/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
21 20 38
128 0 0
+pirate.ogg
4
plant1
10 192 60 2 1 33 0 150 152
--- a/share/hedgewars/Data/Themes/Planes/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/Planes/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
21 20 38
177 175 49
+
0
0
0
--- a/share/hedgewars/Data/Themes/Snow/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/Snow/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
21 20 38
128 0 0
+
4
plant1
65 258 80 2 1 0 0 240 215
--- a/share/hedgewars/Data/Themes/Volcano/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/Volcano/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
231 125 239
78 70 25
+
2
tree
0 253 23 1 1 0 0 138 190
--- a/share/hedgewars/Data/Themes/cheese/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/cheese/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
222 223 132
177 175 49
+
0
0
0
--- a/share/hedgewars/Data/Themes/nature/theme.cfg Fri Jul 25 19:06:46 2008 +0000
+++ b/share/hedgewars/Data/Themes/nature/theme.cfg Fri Jul 25 19:26:44 2008 +0000
@@ -1,5 +1,6 @@
26 12 101
128 0 0
+Nature.ogg
4
plant1
65 258 80 2 1 0 0 240 215