@echo off


if [%1]==[help] goto :help

set game=shovel_adventure

rem For mode 1 change this and replace 'gfx' with 'gfx1' below
set cpc_gfx_mode=0

if [%1]==[justcompile] goto :compile
if [%1]==[clean] goto :clean

cd ..\script
if not exist %game%.spt goto :noscript
echo Compilando script
..\utils\msc3_mk1.exe %game%.spt 30 > nul
copy msc.h ..\dev\my > nul
copy msc-config.h ..\dev\my > nul
copy scripts.bin ..\dev\ > nul
:noscript
cd ..\dev

if [%1]==[justscripts] goto :compile

echo Convirtiendo mapa
REM ..\utils\mapcnvbin.exe ..\map\screen0.map ..\bin\screen0.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen0.bin ..\bin\screen0c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen1.map ..\bin\screen1.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen1.bin ..\bin\screen1c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen1a.map ..\bin\screen1a.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen1a.bin ..\bin\screen1ac.bin
REM ..\utils\mapcnvbin.exe ..\map\screen2.map ..\bin\screen2.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen2.bin ..\bin\screen2c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen2a.map ..\bin\screen2a.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen2a.bin ..\bin\screen2ac.bin
REM ..\utils\mapcnvbin.exe ..\map\screen3.map ..\bin\screen3.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen3.bin ..\bin\screen3c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen4.map ..\bin\screen4.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen4.bin ..\bin\screen4c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen5.map ..\bin\screen5.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen5.bin ..\bin\screen5c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen5b.map ..\bin\screen5b.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen5b.bin ..\bin\screen5bc.bin
REM ..\utils\mapcnvbin.exe ..\map\screen6.map ..\bin\screen6.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen6.bin ..\bin\screen6c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen7.map ..\bin\screen7.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen7.bin ..\bin\screen7c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen8.map ..\bin\screen8.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen8.bin ..\bin\screen8c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen9.map ..\bin\screen9.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen9.bin ..\bin\screen9c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen10.map ..\bin\screen10.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen10.bin ..\bin\screen10c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen10b.map ..\bin\screen10b.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen10b.bin ..\bin\screen10bc.bin
REM ..\utils\mapcnvbin.exe ..\map\screen11.map ..\bin\screen11.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen11.bin ..\bin\screen11c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen12.map ..\bin\screen12.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen12.bin ..\bin\screen12c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen13.map ..\bin\screen13.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen13.bin ..\bin\screen13c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen14.map ..\bin\screen14.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen14.bin ..\bin\screen14c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen15.map ..\bin\screen15.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen15.bin ..\bin\screen15c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen16.map ..\bin\screen16.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen16.bin ..\bin\screen16c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen17.map ..\bin\screen17.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen17.bin ..\bin\screen17c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen18.map ..\bin\screen18.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen18.bin ..\bin\screen18c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen19.map ..\bin\screen19.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen19.bin ..\bin\screen19c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen20.map ..\bin\screen20.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen20.bin ..\bin\screen20c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen20b.map ..\bin\screen20b.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen20b.bin ..\bin\screen20bc.bin
REM ..\utils\mapcnvbin.exe ..\map\screen21.map ..\bin\screen21.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen21.bin ..\bin\screen21c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen22.map ..\bin\screen22.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen22.bin ..\bin\screen22c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen23.map ..\bin\screen23.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen23.bin ..\bin\screen23c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen24.map ..\bin\screen24.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen24.bin ..\bin\screen24c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen25.map ..\bin\screen25.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen25.bin ..\bin\screen25c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen26.map ..\bin\screen26.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen26.bin ..\bin\screen26c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen27.map ..\bin\screen27.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen27.bin ..\bin\screen27c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen28.map ..\bin\screen28.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen28.bin ..\bin\screen28c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen29.map ..\bin\screen29.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen29.bin ..\bin\screen29c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen30.map ..\bin\screen30.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen30.bin ..\bin\screen30c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen30b.map ..\bin\screen30b.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen30b.bin ..\bin\screen30bc.bin
REM ..\utils\mapcnvbin.exe ..\map\screen31.map ..\bin\screen31.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen31.bin ..\bin\screen31c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen32.map ..\bin\screen32.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen32.bin ..\bin\screen32c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen33.map ..\bin\screen33.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen33.bin ..\bin\screen33c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen34.map ..\bin\screen34.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen34.bin ..\bin\screen34c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen35.map ..\bin\screen35.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen35.bin ..\bin\screen35c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen36.map ..\bin\screen36.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen36.bin ..\bin\screen36c.bin
REM ..\utils\mapcnvbin.exe ..\map\screen37.map ..\bin\screen37.bin 1 1 15 10 48 > nul
REM ..\utils\apultra.exe ..\bin\screen37.bin ..\bin\screen37c.bin


echo Convirtiendo enemigos/hotspots
REM ..\utils\ene2bin_mk1.exe ..\enems\ene_bonus.ene ..\bin\ene_bonus.bin 3
REM ..\utils\apultra.exe ..\bin\ene_bonus.bin ..\bin\ene_bonusc.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene0.ene ..\bin\ene0.bin 3
REM ..\utils\apultra.exe ..\bin\ene0.bin ..\bin\ene0c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene1.ene ..\bin\ene1.bin 3
REM ..\utils\apultra.exe ..\bin\ene1.bin ..\bin\ene1c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene1a.ene ..\bin\ene1a.bin 3
REM ..\utils\apultra.exe ..\bin\ene1a.bin ..\bin\ene1ac.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene2.ene ..\bin\ene2.bin 3
REM ..\utils\apultra.exe ..\bin\ene2.bin ..\bin\ene2c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene2a.ene ..\bin\ene2a.bin 3
REM ..\utils\apultra.exe ..\bin\ene2a.bin ..\bin\ene2ac.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene3.ene ..\bin\ene3.bin 3
REM ..\utils\apultra.exe ..\bin\ene3.bin ..\bin\ene3c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene4.ene ..\bin\ene4.bin 3
REM ..\utils\apultra.exe ..\bin\ene4.bin ..\bin\ene4c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene5.ene ..\bin\ene5.bin 3
REM ..\utils\apultra.exe ..\bin\ene5.bin ..\bin\ene5c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene6.ene ..\bin\ene6.bin 3
REM ..\utils\apultra.exe ..\bin\ene6.bin ..\bin\ene6c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene7.ene ..\bin\ene7.bin 3
REM ..\utils\apultra.exe ..\bin\ene7.bin ..\bin\ene7c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene8.ene ..\bin\ene8.bin 3
REM ..\utils\apultra.exe ..\bin\ene8.bin ..\bin\ene8c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene9.ene ..\bin\ene9.bin 3
REM ..\utils\apultra.exe ..\bin\ene9.bin ..\bin\ene9c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene10.ene ..\bin\ene10.bin 3
REM ..\utils\apultra.exe ..\bin\ene10.bin ..\bin\ene10c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene11.ene ..\bin\ene11.bin 3
REM ..\utils\apultra.exe ..\bin\ene11.bin ..\bin\ene11c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene12.ene ..\bin\ene12.bin 3
REM ..\utils\apultra.exe ..\bin\ene12.bin ..\bin\ene12c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene13.ene ..\bin\ene13.bin 3
REM ..\utils\apultra.exe ..\bin\ene13.bin ..\bin\ene13c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene14.ene ..\bin\ene14.bin 3
REM ..\utils\apultra.exe ..\bin\ene14.bin ..\bin\ene14c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene15.ene ..\bin\ene15.bin 3
REM ..\utils\apultra.exe ..\bin\ene15.bin ..\bin\ene15c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene16.ene ..\bin\ene16.bin 3
REM ..\utils\apultra.exe ..\bin\ene16.bin ..\bin\ene16c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene17.ene ..\bin\ene17.bin 3
REM ..\utils\apultra.exe ..\bin\ene17.bin ..\bin\ene17c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene18.ene ..\bin\ene18.bin 3
REM ..\utils\apultra.exe ..\bin\ene18.bin ..\bin\ene18c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene19.ene ..\bin\ene19.bin 3
REM ..\utils\apultra.exe ..\bin\ene19.bin ..\bin\ene19c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene20.ene ..\bin\ene20.bin 3
REM ..\utils\apultra.exe ..\bin\ene20.bin ..\bin\ene20c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene21.ene ..\bin\ene21.bin 3
REM ..\utils\apultra.exe ..\bin\ene21.bin ..\bin\ene21c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene22.ene ..\bin\ene22.bin 3
REM ..\utils\apultra.exe ..\bin\ene22.bin ..\bin\ene22c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene23.ene ..\bin\ene23.bin 3
REM ..\utils\apultra.exe ..\bin\ene23.bin ..\bin\ene23c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene24.ene ..\bin\ene24.bin 3
REM ..\utils\apultra.exe ..\bin\ene24.bin ..\bin\ene24c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene25.ene ..\bin\ene25.bin 3
REM ..\utils\apultra.exe ..\bin\ene25.bin ..\bin\ene25c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene26.ene ..\bin\ene26.bin 3
REM ..\utils\apultra.exe ..\bin\ene26.bin ..\bin\ene26c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene27.ene ..\bin\ene27.bin 3
REM ..\utils\apultra.exe ..\bin\ene27.bin ..\bin\ene27c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene28.ene ..\bin\ene28.bin 3
REM ..\utils\apultra.exe ..\bin\ene28.bin ..\bin\ene28c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene29.ene ..\bin\ene29.bin 3
REM ..\utils\apultra.exe ..\bin\ene29.bin ..\bin\ene29c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene30.ene ..\bin\ene30.bin 3
REM ..\utils\apultra.exe ..\bin\ene30.bin ..\bin\ene30c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene30b.ene ..\bin\ene30b.bin 3
REM ..\utils\apultra.exe ..\bin\ene30b.bin ..\bin\ene30bc.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene31.ene ..\bin\ene31.bin 3
REM ..\utils\apultra.exe ..\bin\ene31.bin ..\bin\ene31c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene32.ene ..\bin\ene32.bin 3
REM ..\utils\apultra.exe ..\bin\ene32.bin ..\bin\ene32c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene33.ene ..\bin\ene33.bin 3
REM ..\utils\apultra.exe ..\bin\ene33.bin ..\bin\ene33c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene34.ene ..\bin\ene34.bin 3
REM ..\utils\apultra.exe ..\bin\ene34.bin ..\bin\ene34c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene35.ene ..\bin\ene35.bin 3
REM ..\utils\apultra.exe ..\bin\ene35.bin ..\bin\ene35c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene36.ene ..\bin\ene36.bin 3
REM ..\utils\apultra.exe ..\bin\ene36.bin ..\bin\ene36c.bin
REM ..\utils\ene2bin_mk1.exe ..\enems\ene37.ene ..\bin\ene37.bin 3
REM ..\utils\apultra.exe ..\bin\ene37.bin ..\bin\ene37c.bin

if [%1]==[nogfx] goto :compile

echo Importando GFX
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=chars in=..\gfx\font.png out=..\bin\font.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=strait2x2 in=..\gfx\work_arcoiris.png out=..\bin\work.bin silent > nul

REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=sprites in=..\gfx\sprites.png out=..\bin\sprites.bin metasize=2,3 silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=sprites in=..\gfx\cobra2.png out=..\bin\cobra.bin metasize=2,2 silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=sprites in=..\gfx\scarabajo.png out=..\bin\scarabajo.bin metasize=2,2 silent > nul

REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=sprites in=..\gfx\sprites_extra.png out=..\bin\sprites_extra.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=sprites in=..\gfx\sprites_bullet.png out=..\bin\sprites_bullet.bin metasize=1,1 silent > nul

REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\marco.png out=..\bin\marco.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\ending.png out=..\bin\ending.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\emosido.png out=..\bin\ending2.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\title3.png out=..\bin\title.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\ini.png out=..\bin\ini1.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\ini1.png out=..\bin\ini2.bin silent > nul
REM ..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=superbuffer in=..\gfx\black.png out=..\bin\black.bin silent > nul
REM ..\utils\apultra.exe ..\bin\title.bin ..\bin\titlec.bin
REM ..\utils\apultra.exe ..\bin\marco.bin ..\bin\marcoc.bin 
REM ..\utils\apultra.exe ..\bin\ending.bin ..\bin\endingc.bin > nul
REM ..\utils\apultra.exe ..\bin\ending2.bin ..\bin\ending2c.bin > nul
REM ..\utils\apultra.exe ..\bin\ini1.bin ..\bin\ini1c.bin > nul
REM ..\utils\apultra.exe ..\bin\ini2.bin ..\bin\ini2c.bin > nul
REM ..\utils\apultra.exe ..\bin\black.bin ..\bin\blackc.bin > nul

REM ..\utils\mkts_om.exe platform=cpc mode=pals in=..\gfx\pal.png prefix=my_inks out=assets\pal.h  > nul

if [%1]==[justassets] goto :end

:compile
echo Generating LUTs
..\utils\pasmo.exe assets\cpc_TrPixLutM%cpc_gfx_mode%.asm assets\trpixlut.bin
..\utils\apultra.exe assets\trpixlut.bin assets\trpixlutc.bin
REM ..\utils\wyzTrackerParser.exe ..\mus\instrumentos.asm assets\instrumentos.h

echo.
echo ARKOS tracker player stuff
echo --------------------------
cd ..\mus\arkos\
echo Assembling player
..\..\utils\pasmo.exe ArkosTrackerPlayer_CPC_MSX.asm ..\..\bin\arkos\arkos.bin arkos.lst
echo Compiling assets
REM cd ..\..\bin\arkos\
REM ..\..\utils\AKSToBIN.exe -a 34117 ingame.aks ..\..\bin\arkos\m0.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 intro.aks ..\..\bin\arkos\m1.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 menu.aks ..\..\bin\arkos\m2.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 ingame-2.aks ..\..\bin\arkos\m3.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 gameover.aks ..\..\bin\arkos\m4.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 levelstart.aks ..\..\bin\arkos\m5.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 level_complete.aks ..\..\bin\arkos\m6.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 bonus.aks ..\..\bin\arkos\m7.bin
REM ..\..\utils\AKSToBIN.exe -a 34117 ending.aks ..\..\bin\arkos\m8.bin
REM ..\..\utils\AKSToBIN.exe -s -a 60928 sfx.aks ..\..\bin\arkos\sfx.bin
cd ..\..\dev\
..\utils\apultra.exe ..\bin\arkos\arkos.bin ..\bin\arkos\arkos.c.bin >nul
..\utils\apultra.exe ..\bin\arkos\sfx.bin ..\bin\arkos\sfx.c.bin >nul
copy /b ..\bin\arkos\arkos.c.bin + ..\bin\arkos\sfx.c.bin ..\bin\arkos\arkos_sfx.c.bin >nul
..\utils\apultra.exe ..\bin\arkos\m0.bin ..\bin\arkos\m0.c.bin
..\utils\printsize.exe ..\bin\arkos\m0.c.bin
..\utils\apultra.exe ..\bin\arkos\m1.bin ..\bin\arkos\m1.c.bin
..\utils\printsize.exe ..\bin\arkos\m1.c.bin
..\utils\apultra.exe ..\bin\arkos\m2.bin ..\bin\arkos\m2.c.bin
..\utils\printsize.exe ..\bin\arkos\m2.c.bin
..\utils\apultra.exe ..\bin\arkos\m3.bin ..\bin\arkos\m3.c.bin
..\utils\printsize.exe ..\bin\arkos\m3.c.bin
..\utils\apultra.exe ..\bin\arkos\m4.bin ..\bin\arkos\m4.c.bin
..\utils\printsize.exe ..\bin\arkos\m4.c.bin
..\utils\apultra.exe ..\bin\arkos\m5.bin ..\bin\arkos\m5.c.bin
..\utils\printsize.exe ..\bin\arkos\m5.c.bin
..\utils\apultra.exe ..\bin\arkos\m6.bin ..\bin\arkos\m6.c.bin
..\utils\printsize.exe ..\bin\arkos\m6.c.bin
..\utils\apultra.exe ..\bin\arkos\m7.bin ..\bin\arkos\m7.c.bin
..\utils\printsize.exe ..\bin\arkos\m7.c.bin
..\utils\apultra.exe ..\bin\arkos\m8.bin ..\bin\arkos\m8.c.bin
..\utils\printsize.exe ..\bin\arkos\m8.c.bin

echo Compilando guego
REM zcc +cpc -m -O3 -unsigned -zorg=1024 -lcpcrslib -DCPC_GFX_MODE=%cpc_gfx_mode% -o %game%.bin tilemap_conf.asm mk1.c > nul
zcc +cpc -m -vn -O3 -unsigned -crt0=crt.asm -zorg=1024 -lcpcrslib -DCPC_GFX_MODE=%cpc_gfx_mode% -o %game%.bin tilemap_conf.asm mk1.c > nul
..\utils\printsize.exe %game%.bin
echo Maximo 33093 bytes
..\utils\printsize.exe scripts.bin

echo Construyendo Snapshot %game%.sna
del %game%.sna > nul
copy %game%.bin game.bin > nul 
copy ..\bin\arkos\arkos_sfx.c.bin arkos.bin > nul 
REM ..\utils\cpctbin2sna.exe %game%.bin 0x400 -pc 0x400 -o %game%.sna
..\utils\cpct_bin2sna.exe game.bin 0x400 arkos.bin 0x82b2 -pc 0x400 > %game%.sna


if [%2]==[andtape] goto :tape
if [%1]==[justcompile] goto :end

:clean
:tape
echo Construyendo cinta
..\utils\mkts_om.exe platform=cpc cpcmode=%cpc_gfx_mode% pal=..\gfx\pal.png mode=scr in=..\gfx\loading.png out=..\bin\loading.bin silent > nul
del ..\bin\loading.c.bin 
..\utils\zx7.exe ..\bin\loading.bin ..\bin\loading.c.bin > nul
del ..\bin\%game%.c.bin
..\utils\zx7.exe %game%.bin ..\bin\%game%.c.bin > nul

del ..\bin\arkos\arkos.c.bin >nul
del ..\bin\arkos\sfx.c.bin >nul
del ..\bin\arkos\arkos_sfx.c.bin >nul
..\utils\zx7.exe ..\bin\arkos\arkos.bin ..\bin\arkos\arkos.c.bin >nul
..\utils\zx7.exe ..\bin\arkos\sfx.bin ..\bin\arkos\sfx.c.bin >nul
copy /b ..\bin\arkos\arkos.c.bin + ..\bin\arkos\sfx.c.bin ..\bin\arkos\arkos_sfx.c.bin >nul


set loader_org=$aa00
rem $aa00 = 43520

..\utils\imanol.exe in=loader\loadercpc.asm-orig out=loader\loadercpc.asm ^
	binsize=?..\bin\%game%.c.bin ^
	scrc_size=?..\bin\loading.c.bin ^
	mainbin_addr=?43520-..\bin\%game%.c.bin ^
	mainbin_size=?..\bin\%game%.c.bin ^
	arkos_sfx_c_size=?..\bin\arkos\arkos_sfx.c.bin ^
	arkos_c_size=?..\bin\arkos\arkos.c.bin ^
	m1_c_size=?..\bin\arkos\m1.c.bin ^
	m3_c_size=?..\bin\arkos\m3.c.bin ^
	loader_org=%loader_org% ^
	loader_mode=%cpc_gfx_mode% > nul
..\utils\pasmo.exe loader\loadercpc.asm ..\bin\loader.bin  > nul

..\utils\2cdt.exe -n -r %game% -s 1 -X %loader_org% -L %loader_org% ..\bin\loader.bin %game%.cdt  > nul
..\utils\2cdt.exe -r scr -s 1 -m 2 ..\bin\loading.c.bin %game%.cdt  > nul
..\utils\2cdt.exe -r game -s 1 -m 2 ..\bin\%game%.c.bin %game%.cdt  > nul
..\utils\2cdt.exe -r arkos -s 1 -m 2 ..\bin\arkos\arkos_sfx.c.bin %game%.cdt  > nul
..\utils\2cdt.exe -r music -s 1 -m 2 ..\bin\arkos\m1.c.bin %game%.cdt  > nul
..\utils\2cdt.exe -r music -s 1 -m 2 ..\bin\arkos\m3.c.bin %game%.cdt  > nul


echo ### MAKING DSK ###
copy %game%.bin game.bin > nul 
REM copy base.dsk %game%.dsk > nul 
copy ..\bin\arkos\arkos.bin arkos.bin > nul 
copy ..\bin\arkos\sfx.bin sfx.bin > nul 
copy ..\bin\arkos\m1.c.bin m1.bin > nul 
copy ..\bin\arkos\m2.c.bin m2.bin > nul 
copy ..\bin\loading.bin loading.bin > nul
..\utils\CPCDiskXP\CPCDiskXP.exe -File shovel.bas -AddToNewDsk %game%.dsk
..\utils\CPCDiskXP\CPCDiskXP.exe -File loading.bin -AddAmsDosHeader C000 -AddToExistingDsk %game%.dsk
..\utils\CPCDiskXP\CPCDiskXP.exe -File game.bin -AddAmsDosHeader 400 -AddToExistingDsk %game%.dsk
..\utils\CPCDiskXP\CPCDiskXP.exe -File arkos.bin -AddAmsDosHeader 8834 -AddToExistingDsk %game%.dsk
..\utils\CPCDiskXP\CPCDiskXP.exe -File sfx.bin -AddAmsDosHeader EE00 -AddToExistingDsk %game%.dsk
..\utils\CPCDiskXP\CPCDiskXP.exe -File m1.bin -AddAmsDosHeader C000 -AddToExistingDsk %game%.dsk
..\utils\CPCDiskXP\CPCDiskXP.exe -File m2.bin -AddAmsDosHeader C000 -AddToExistingDsk %game%.dsk



goto :end 

:help
echo "compile.bat help|justcompile|clean|justscripts|justassets|nogfx"

:end
echo Hecho!
