Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & setlocal enableDelayedExpansion
- call :init
- :main
- cls
- echo. & echo --------------------------------------------------
- set /a "addOne=xPos + 1"
- for /l %%a in (!CAM_minY!,1,!CAM_maxY!) Do (
- set "currline=!line[%%a]!"
- if %%a equ !yPos! set "currline=!currline:~0,%xPos%!%character[1]%!currline:~%addOne%!"
- echo= # !currline:~%CAM_minX%,%CAM_maxX%! #
- )
- echo --------------------------------------------------
- call :controls
- %openLib% & call :calcFPS & %closeLib%
- goto :main
- :init
- if exist orig-main.bat ren orig-main.bak.bat
- set "openLib=( ren "%~nx0" orig-main.bat & ren library.bat "%~nx0""
- set "closeLib=ren "%~nx0" library.bat & ren orig-main.bat "%~nx0" )"
- set "character[1]="
- set "currentMap=L1.txt"
- set /a "PGDP=3", "PGRP=5"
- %openLib% & call :getBuffer "1,1,%PGRP%" " " pushBoxesRight & %closeLib%
- for /f "tokens=*" %%a in (map.txt) do (
- set /a "maxY+=1"
- set "Line[!maxY!]=%pushBoxesRight%%%~a%pushBoxesRight%"
- )
- %openLib% & call :length !Line[%maxY%]! maxX & %closeLib%
- set /a "defCAM_minY=-%PGDP%" , "defCAM_maxY=maxY + PGDP", "defCAM_minX=-%PGRP%" , "defCAM_maxX=maxX / 2"
- set /a "BOX_minX=PGRP + 1", "BOX_maxX=maxX + 3" , "BOX_minY=PGDP - 1", "BOX_maxY=maxY - 1"
- set /a "_e=maxY + 1", "_t=maxY + PGDP", "_r=maxX + PGRP - 1"
- %openLib% & call :getBuffer "-%PGRP%,1,%_r%" " " emptyLineBuffer & %closeLib%
- for /l %%a in (-%PGDP%,1,0) do set "Line[%%a]=!emptyLineBuffer!"
- for /l %%a in (%_e%,1,%_t%) do set "Line[%%a]=!emptyLineBuffer!"
- mode con: cols=%_r% lines=%_e%
- for %%a in (_e _t emptyLineBuffer) do set "%%a="
- ( for %%a in ( "defaultGround=BOX_maxY" "maxJump=(defaultGround - 2)"
- "xPos=BOX_minX + 1" "yPos=BOX_maxY"
- "CAM_minY=7" "CAM_maxY=26"
- "CAM_minX=0" "CAM_maxX=48"
- ) do set /a %%a )
- %openLib% & call :prep_calcFPS 100 & %closeLib%
- goto :eof
- :controls
- for /f "tokens=*" %%a in ('choice /c:wasd /n') do set "move=%%a"
- if /i "!move!" equ "W" (
- set /a "CAM_minY-=1", "CAM_maxY-=1", "yPos-=1"
- if !CAM_minY! lss !defCAM_minY! set /a "CAM_maxY+=1", "CAM_minY=!defCAM_minY!"
- if !yPos! leq %BOX_minY% set "yPos=%BOX_minY%"
- )
- if /i "!move!" equ "S" (
- set /a "CAM_minY+=1", "CAM_maxY+=1", "yPos+=1"
- if !CAM_maxY! gtr !defCAM_maxY! set /a "CAM_minY-=1", "CAM_maxY=!defCAM_maxY!"
- if !yPos! geq %BOX_maxY% set "yPos=%BOX_maxY%"
- )
- if /i "!move!" equ "A" (
- set /a "CAM_minX-=1", "xPos-=1"
- if !CAM_minX! leq 0 set "CAM_minX=0"
- if !xPos! leq %BOX_minX% set "xPos=%BOX_minX%"
- )
- if /i "!move!" equ "D" (
- set /a "CAM_minX+=1", "xPos+=1"
- if !CAM_minX! gtr !defCAM_maxX! set "CAM_minX=!defCAM_maxX!"
- if !xPos! geq %BOX_maxX% set /a "xPos=%BOX_maxX%"
- )
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement