Skip to content

Commit

Permalink
support for multiple music files
Browse files Browse the repository at this point in the history
small fixes
  • Loading branch information
infidel- committed Nov 18, 2019
1 parent 0eb80f8 commit c696f14
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 50 deletions.
92 changes: 48 additions & 44 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ release-win:
cp ../_release.windows/* ../_releases/parasite-$(VERSION)-win/
cp ../parasite.cfg.default ../_releases/parasite-$(VERSION)-win/parasite.cfg
echo "PAID Debug build..."
~/haxe-4.0.0-rc2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets.paid.hl/ -debug -D mydebug
~/haxe-4.0.2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets.paid.hl/ -debug -D mydebug
cp ../bin.hl/parasite.hl ../_releases/parasite-$(VERSION)-win/parasite-debug.hl
echo "PAID Normal build..."
~/haxe-4.0.0-rc2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets.paid.hl/
~/haxe-4.0.2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets.paid.hl/
cp ../bin.hl/parasite.hl ../_releases/parasite-$(VERSION)-win/parasite.hl
cd ../_releases && zip -r9 parasite-$(VERSION)-win.zip parasite-$(VERSION)-win/
cp ../_releases/parasite-$(VERSION)-win.zip /mnt/d/1/
Expand All @@ -27,14 +27,58 @@ release-win-free:
cp ../_release.windows/* ../_releases/parasite-$(VERSION)-win-free/
cp ../parasite.cfg.default ../_releases/parasite-$(VERSION)-win-free/parasite.cfg
echo "FREE Debug build..."
~/haxe-4.0.0-rc2/run.sh project_hl.hxml -D resourcesPath=../assets/ -D free -debug -D mydebug
~/haxe-4.0.2/run.sh project_hl.hxml -D resourcesPath=../assets/ -D free -debug -D mydebug
cp ../bin.hl/parasite.hl ../_releases/parasite-$(VERSION)-win-free/parasite-debug.hl
echo "FREE Normal build..."
~/haxe-4.0.0-rc2/run.sh project_hl.hxml
~/haxe-4.0.2/run.sh project_hl.hxml -D resourcesPath=../assets/ -D free
cp ../bin.hl/parasite.hl ../_releases/parasite-$(VERSION)-win-free/parasite.hl
cd ../_releases && zip -r9 parasite-$(VERSION)-win-free.zip parasite-$(VERSION)-win-free/
cp ../_releases/parasite-$(VERSION)-win-free.zip /mnt/d/1/

release-html5-dev-debug: html5-free-mydebug
cp -R ../bin/parasite.js* \
~/git/starinfidel.github.io/parasite-dev-debug/

release-html5-dev: html5-free
cp -R ../bin/parasite.js \
~/git/starinfidel.github.io/parasite-dev/

release-html5-paid: cp-paid
~/haxe-4.0.2/run.sh project_js.hxml -D resourcesPath=../assets.paid.web/
cd ../bin/ && rm -f parasite.js.gz && gzip -k9 parasite.js
cd ../bin/ && zip -r9 parasite-$(VERSION)-js.zip index.html parasite.js parasite.js.gz favicon.png
mv ../bin/parasite-$(VERSION)-js.zip ../_releases
cp ../_releases/parasite-$(VERSION)-js.zip /mnt/d/1/

cp-paid:
cp /mnt/d/1/___Assets/Results.paid/* ../assets.paid.hl/graphics

html5-mydebug:
~/haxe-4.0.2/run.sh project_js.hxml -debug -D resourcesPath=../assets.paid.web/ -D mydebug
# haxe project_js.hxml -debug -D resourcesPath=../assets.paid.web/ -D mydebug --connect 6000

html5:
echo -e "\e[92m\e[40mCompiling HTML5 version...\e[0m"
haxe project_js.hxml -D resourcesPath=../assets.paid.web/ --connect 6000

html5-free-mydebug:
haxe project_js.hxml -debug -D mydebug -D free --connect 6000

html5-free:
haxe project_js.hxml -D free --connect 6000

hl-free-mydebug:
~/haxe-4.0.2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets/ -debug -D mydebug -D free && \
cp ../bin.hl/parasite.hl /mnt/d/1/hl-1.10.0-win/

hl-mydebug:
echo "\e[91m\e[40mCompiling HL version...\e[0m"
~/haxe-4.0.2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets.paid.hl/ -debug -D mydebug && \
cp ../bin.hl/parasite.hl /mnt/d/1/hl-1.10.0-win/

count:
git rev-list HEAD --count > COUNT

#release-linux32:
# echo "Building linux 32-bit release" $(VERSION)
# mkdir -p _releases _releases/parasite-$(VERSION)-linux32
Expand Down Expand Up @@ -71,44 +115,4 @@ release-win-free:
# cd _releases && tar -c parasite-$(VERSION)-linux64/ | gzip - > \
# parasite-$(VERSION)-linux64.tar.gz

release-html5-dev-debug: html5-free-mydebug
cp -R ../bin/parasite.js* \
~/git/starinfidel.github.io/parasite-dev-debug/

release-html5-dev: html5-free
cp -R ../bin/parasite.js \
~/git/starinfidel.github.io/parasite-dev/

release-html5-paid: cp-paid
haxe project_js.hxml -D resourcesPath=../assets.paid.web/ --connect 6000
cd ../bin/ && zip -r9 parasite-$(VERSION)-js.zip index.html parasite.js favicon.png
mv ../bin/parasite-$(VERSION)-js.zip ../_releases
cp ../_releases/parasite-$(VERSION)-js.zip /mnt/d/1/

cp-paid:
cp /mnt/d/1/___Assets/Results.paid/* ../assets.paid.hl/graphics

html5-mydebug:
haxe project_js.hxml -debug -D resourcesPath=../assets.paid.web/ -D mydebug --connect 6000

html5:
haxe project_js.hxml -D resourcesPath=../assets.paid.web/ --connect 6000

html5-free-mydebug:
haxe project_js.hxml -debug -D mydebug -D free --connect 6000

html5-free:
haxe project_js.hxml -D free --connect 6000

hl-free-mydebug:
~/haxe-4.0.0-rc2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets/ -debug -D mydebug -D free && \
cp ../bin.hl/parasite.hl /mnt/d/1/hl-1.10.0-win/

hl-mydebug:
~/haxe-4.0.0-rc2/run.sh project_hl.hxml -D heaps_enable_hl_mp3 -D resourcesPath=../assets.paid.hl/ -debug -D mydebug && \
cp ../bin.hl/parasite.hl /mnt/d/1/hl-1.10.0-win/

count:
git rev-list HEAD --count > COUNT

clean:
24 changes: 22 additions & 2 deletions src/SoundManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SoundManager
{
var scene: GameScene;
var game: Game;
var musicIdx: Int;
var music: Channel;
var ambient: Channel;
var ambientNext: Channel;
Expand Down Expand Up @@ -72,12 +73,30 @@ class SoundManager
}

// start playing music
music = sounds['music1'].play(true,
musicIdx = 1;
music = sounds['music' + musicIdx].play(false,
game.config.musicVolume / 100.0);
music.onEnd = onMusicEnd;
#end
}


// pick new music and queue
function onMusicEnd()
{
var idx = 1;
#if !js
var files = [ 1, 2, 3, 5 ];
files.remove(musicIdx);
idx = files[Std.random(files.length)];
#end
musicIdx = idx;
music = sounds['music' + musicIdx].play(false,
game.config.musicVolume / 100.0);
music.onEnd = onMusicEnd;
}


// change ambience state
public function setAmbient(st: _SoundAmbientState)
{
Expand Down Expand Up @@ -212,7 +231,8 @@ class SoundManager
if (music != null)
{
music.stop();
music = sounds['music1'].play(true, 0.01);
music = sounds['music' + musicIdx].play(false, 0.01);
music.onEnd = onMusicEnd;
music.fadeTo(game.config.musicVolume / 100.0, 1);
}
var old = ambientState;
Expand Down
2 changes: 1 addition & 1 deletion src/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.1
0.6.0
2 changes: 1 addition & 1 deletion src/ai/TeamMemberAI.hx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class TeamMemberAI extends HumanAI
public override function onNotice()
{
game.log('You feel someone watching you.', COLOR_ALERT);
game.scene.hud.blinkingText.show(3);
game.scene.hud.blinkingText.show(2);
game.scene.soundManager.playSound('team_notify', true);
}
}
5 changes: 5 additions & 0 deletions src/const/SoundConst.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class SoundConst
public static var misc = [
'game_win',
'music1',
#if !js
'music2',
'music3',
'music5',
#end
'ambient_city1',
'ambient_region1',
'ambient_wilderness1',
Expand Down
3 changes: 1 addition & 2 deletions src/ui/HUD.hx
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,13 @@ class HUD
if (!_consoleBack.visible && _container.visible &&
e.charCode == 59) // ;
{
e.cancel = true;
showConsole();
return;
}

if (!consoleVisible())
return;

_console.text += String.fromCharCode(e.charCode);
}


Expand Down

0 comments on commit c696f14

Please sign in to comment.