demo.cmd reads:
@echo off
setlocal
set _PANORAMASLICES=0
set _DEMOOPTS=+wx 0 %DEMOOPTIONS%
set _MODE=playback
set _SIZE=default
set _RENDERFPS=30
set _OVERRIDEFOV=
set _SYNCCAMANDDEMO=1
set _TIMEDEMO=0
set _RENDERSTATS=0
set _VTUNE=-1
set _VTUNERENDERING=0
set _VTUNEREPEAT=1
set _DEMOROOT=mods\bf2
set _BF2EXE=bf2.exe
set _USERWIDTH=800
set _USERHEIGHT=600
set _NOSOUND=0
if NOT "%1" == "" goto parse
:help
echo - DEMO.CMD usage:
echo - Author:
jonas.kjellstrom@dice.se,
andreas.fredriksson@dice.se
echo -
echo - Play demo Demos\foo.bf2demo with user camera:
echo -
echo - demo foo
echo -
echo - Play demo Demos\foo.bf2demo with camera Demos\mycam.bf2cam:
echo -
echo - demo foo mycam
echo -
echo - Play demo Demos\foo.bf2demo with and record camera
echo - to Demos\mycam.bf2cam:
echo -
echo - demo +c foo mycam
echo -
echo - Render demo Demos\foo.bf2demo with camera Demos\mycam.bf2cam
echo - to Demos\foo_mycam.avi:
echo -
echo - demo +r foo mycam
echo -
echo - A custom avi-filename can be given as a final argument (saved
echo - as Demos\myavi.avi):
echo -
echo - demo +r foo mycam myavi
echo -
echo - Render sound of demo Demos\foo.bf2demo with camera Demos\mycam.bf2cam:
echo -
echo - demo +s foo mycam
echo -
echo - The format of the window can be changed to E3-wide with +w and to
echo - a mini-window with +m:
echo -
echo - demo +r +w foo mycam
echo -
echo - It can also be set to custom settings with +width and +height
echo -
echo - demo +r +width 640 +height 400 foo mycam
echo -
echo - The render fps can be changed with +fps:
echo -
echo - demo +r +fps 24 foo mycam
echo -
echo - And the default fov can be overridden with +fov:
echo -
echo - demo +r +fov 120 foo mycam
echo -
echo - To render panoramic (360 degree) output to 10 separate AVIs:
echo -
echo - demo +r +p 10 foo mycam
echo - (where 10 is the number of slices in a 360 rotation)
echo -
echo - To render panoramic (360 degree) output to a single AVI:
echo - (Note: Not many codecs support this format.)
echo -
echo - demo +r +p 1 foo mycam
echo -
echo - A camera track that extends beyond the length of a demo is possible by
echo - adding +nosync to the command line.
echo -
echo - demo +nosync +c myShortDemo myLongCameraTrack
echo - demo +nosync myShortDemo myLongCameraTrack
echo -
echo - Running a demo in time demo mode (which reports stats to the log-file)
echo - is done with:
echo -
echo - demo +timedemo myDemo myCam
echo -
echo - Running a demo with no sound is now simple:
echo -
echo - demo +nosound myDemo myCam
echo -
echo - Adding additional render information when running a time demo is done
echo - with: (0-4, 0 - no info, 4 - all info):
echo -
echo - demo +renderstats 3
echo -
echo - You can also enable the VTune profiler for a single frame. The engine
echo - will unpause the profiler around the mainloop for the frame you specify.
echo -
echo - demo +timedemo +vtune {frame number} myDemo myCam
echo -
echo - To VTune only the renderer, add +vrend 1.
echo - To render the profiled frames mutliple times, add +vrepeat {count}.
echo -
goto end

arse
if "%1"=="+w" set _SIZE=wide&&shift /1&&goto parse
if "%1"=="+m" set _SIZE=mini&&shift /1&&goto parse
if "%1"=="+c" set _MODE=camera&&shift /1&&goto parse
if "%1"=="+r" set _MODE=render&&shift /1&&goto parse
if "%1"=="+s" set _MODE=sound&&shift /1&&goto parse
if "%1"=="+timedemo" set _MODE=playback&&set _TIMEDEMO=1&&shift /1&&goto parse
if "%1"=="+renderstats" set _RENDERSTATS=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+vtune" set _VTUNE=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+vrend" set _VTUNERENDERING=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+vrepeat" set _VTUNEREPEAT=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+p" set _PANORAMASLICES=%2&&set _SIZE=panorama&&shift /1&&shift /1&&goto parse
if "%1"=="+fps" set _RENDERFPS=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+fov" set _OVERRIDEFOV=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+nosync" set _SYNCCAMANDDEMO=0&&shift /1&&goto parse
if "%1"=="+debug" set _BF2EXE=bf2_d.exe&&shift /1&&goto parse
if "%1"=="+release" set _BF2EXE=bf2_r.exe&&shift /1&&goto parse
if "%1"=="+modpath" set _DEMOROOT=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+width" set _USERWIDTH=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+height" set _USERHEIGHT=%2&&shift /1&&shift /1&&goto parse
if "%1"=="+nosound" set _NOSOUND=1&&shift /1&&goto parse
goto size_%_SIZE%

arse1
set _DEMOOPTS=%_DEMOOPTS% +szx %_WIDTH% +szy %_HEIGHT%
if not "%_OVERRIDEFOV%"=="" set _FOVX=%_OVERRIDEFOV%
goto parse_filenames

arse1_5
goto mode_%_MODE%

arse2
goto end
::--------------------------------------------------------------------------------------
:: SIZE
::
:size_default:
set _WIDTH=%_USERWIDTH%
set _HEIGHT=%_USERHEIGHT%
set _FOVX=90
goto parse1
:size_wide:
set _WIDTH=1620
set _HEIGHT=405
set _FOVX=160
goto parse1
:size_mini:
set _WIDTH=400
set _HEIGHT=300
set _FOVX=90
goto parse1
:size_panorama:
set _WIDTH=1024
set _HEIGHT=768
rem set these for super-fast testing
rem set _WIDTH=200
rem set _HEIGHT=150
set _FOVX=36
goto parse1
::--------------------------------------------------------------------------------------
:: FILENAMES
::

arse_filenames
set _DEMOFILE=%_DEMOROOT%\Demos\%1.bf2demo
set _CAMERAFILE=%_DEMOROOT%\Demos\%2.bf2cam
if "%3"=="" (set _AVIBASE=%1_%2) else (set _AVIBASE=%3)
set _AVIFILE=%_DEMOROOT%\Demos\%_AVIBASE%_%_WIDTH%x%_HEIGHT%_fov%_FOVX%_fps%_RENDERFPS%.avi
if not EXIST %_DEMOFILE% (
echo ERROR: %_DEMOFILE% does not exist
goto end
)
goto parse1_5
::--------------------------------------------------------------------------------------
:: MODE
::
:mode_playback
echo demo.demoMode playback > demo.tmp
if "%2"=="" (
echo Playing back demo with user cam...
echo demo.cameraMode user >> demo.tmp
) else (
echo Playing back demo with recorded camera...
if not EXIST %_CAMERAFILE% (
echo ERROR: %_CAMERAFILE% does not exist
goto end
)
echo demo.cameraMode playback >> demo.tmp
echo demo.camerafile %_CAMERAFILE% >> demo.tmp
)
echo demo.demofile %_DEMOFILE% >> demo.tmp
echo demo.renderwidth %_WIDTH% >> demo.tmp
echo demo.renderheight %_HEIGHT% >> demo.tmp
echo demo.renderfieldofview %_FOVX% >> demo.tmp
echo demo.renderfps %_RENDERFPS% >> demo.tmp
echo demo.synccameraanddemo %_SYNCCAMANDDEMO% >> demo.tmp
echo demo.timedemo %_TIMEDEMO% >> demo.tmp
echo demo.renderstats %_RENDERSTATS% >> demo.tmp
echo demo.vtuneFrame %_VTUNE% >> demo.tmp
echo demo.vtuneRendering %_VTUNERENDERING% >> demo.tmp
echo demo.vtuneRepeatCount %_VTUNEREPEAT% >> demo.tmp
set _DEMOOPTS=%_DEMOOPTS%
goto execute
:mode_camera
echo Playing back demo and recording camera...
if EXIST %_CAMERAFILE% (
echo ERROR: %_CAMERAFILE% already exist.
goto end
)
echo demo.demoMode playback > demo.tmp
echo demo.cameraMode record >> demo.tmp
echo demo.demofile %_DEMOFILE% >> demo.tmp
echo demo.camerafile %_CAMERAFILE% >> demo.tmp
echo demo.renderwidth %_WIDTH% >> demo.tmp
echo demo.renderheight %_HEIGHT% >> demo.tmp
echo demo.renderfieldofview %_FOVX% >> demo.tmp
echo demo.synccameraanddemo %_SYNCCAMANDDEMO% >> demo.tmp
set _NOSOUND=1
set _DEMOOPTS=%_DEMOOPTS% +skipMips 10
goto execute
:mode_render
if "%_PANORAMASLICES%"=="0" (
echo Rendering AVI...
set _PANORAMA=0
) else (
echo Rendering AVI in parorama mode...
set _PANORAMA=1
)
if EXIST %_AVIFILE% (
echo ERROR: %_AVIFILE% already exist.
goto parse2
)
if not EXIST %_CAMERAFILE% (
echo ERROR: %_CAMERAFILE% does not exist.
goto end
)
echo demo.demoMode render > demo.tmp
echo demo.cameraMode playback >> demo.tmp
echo demo.demofile %_DEMOFILE% >> demo.tmp
echo demo.camerafile %_CAMERAFILE% >> demo.tmp
echo demo.renderfile %_AVIFILE% >> demo.tmp
echo demo.rendercompressed 1 >> demo.tmp
echo demo.renderpanorama %_PANORAMA% >> demo.tmp
echo demo.numpanoramaslices %_PANORAMASLICES% >> demo.tmp
echo demo.renderfps %_RENDERFPS% >> demo.tmp
echo demo.renderwidth %_WIDTH% >> demo.tmp
echo demo.renderheight %_HEIGHT% >> demo.tmp
echo demo.renderfieldofview %_FOVX% >> demo.tmp
echo demo.synccameraanddemo %_SYNCCAMANDDEMO% >> demo.tmp
set _NOSOUND=1
goto execute
:mode_sound
if not EXIST %_CAMERAFILE% (
echo ERROR: %_CAMERAFILE% does not exist.
goto end
)
echo Rendering sound...
echo demo.demoMode rendersound > demo.tmp
echo demo.cameraMode playback >> demo.tmp
echo demo.demofile %_DEMOFILE% >> demo.tmp
echo demo.camerafile %_CAMERAFILE% >> demo.tmp
echo demo.synccameraanddemo %_SYNCCAMANDDEMO% >> demo.tmp
set _DEMOOPTS=%_DEMOOPTS% +skipMips 10
goto execute
:execute
set _DEMOOPTS=%_DEMOOPTS% +noSound %_NOSOUND%
echo - Executing: %_BF2EXE% %_DEMOOPTS% +demo demo.tmp
%_BF2EXE% %_DEMOOPTS% +demo demo.tmp
goto parse2
:end
::if exist demo.tmp del demo.tmp
echo Done!
endlocal