|
3#
楼主 |
发表于 2005-4-21 16:53:12
|
只看该作者
第一次用WBAT写的自制综合光盘游戏主菜单:,与大家共勉(感谢gmy!)
[这个贴子最后由gotomsdos在 2005/04/21 06:27pm 第 1 次编辑]
又加了一些功能: 比如,进入之前加了以登记入园形式的暗藏进入游戏的秘密通道选项,如果选的不对就进不了了...
保存游戏,(其中包括自己做的简易浏览器,供查看目录,,创建多层带间隔的长名目录),正在增加图形修改游戏进度...修改SKYROADS已成功...
下面帖出,供大家参考:
.主程序:
@ECHO OFF
PROMPT $P$G
path a:\
tw32 /np >nul
ctmouse /u >nul
ctmouse /n >nul
lh doslfn
cls
rem :drv
rem get z "%cdrom1%" /w1
rem set takecd=%get%
rem get #e "C:,D:,E:,F:,G:,H:,I:,J:,K:,L:,M:,N:,,P:,Q:,R:,S:,T:,U:,V:,W:,X:,Y:" ';';';';%takecd%';';';';
rem set takedrv=%get%
set barpos=0
set saveyn=0
set name=
set year=
set book=
set stat=
set core=
set score=
set salary=
set gamedir=0
wbat box @%0:sound
cls
if errorlevel 2 goto test
set blaster=a220 i5 d1 h5 p330
set sbpci=z:\sound
xcopy %romcd%\sound z:\sound\ /e /s /y
z:\sound\sbinit
cls
if errorlevel 1 wbat box 加载失败!
goto test
:sound "您要加载声卡驱动吗?" [x]
本光盘配有通用的 Sound Blaster (创新) 声卡驱动文件
如果您电脑的声卡兼容创新,一般会成功加载驱动,但如果
不兼容并强制加载驱动,很可能不成功甚至出现死机或噪音
等现象。如不清楚,建议查看一下您的声卡说明书。
[加 载] [不加载]
:
:studio
~木鸢工作室~ 羊城苑
2003-2005 Copyright TM reserved
:
:reg "寻趣园面试台" [x]
江湖绰号?[$ name 20,! ] (必填)
闯荡几个春秋了?[$ year 2,!] (必填)
著作有几本了?[$ book 2] 统计员论文有几篇了?[$ stat 2]
~核心~期刊论文有几篇了?[$ core 2]
平均学生评分多少?[$ score 2]
有~房~吗?[!]
薪俸多高啊?[$ salary 8]
有~车~吗?[!]
平时喜欢干啥?
看闲书 [!]
看电视 [!]
上网闲逛 [!]
~电脑游戏~玩疯了 [!]
逛街 [!]
到哥们儿那坐坐 [!] ~佳人~伺候?[.]
[面试结束] 孑然一身?[.]
:
:ls " 想玩哪一个? " [x]
[a 太空之路 ]
[b 赛车追捕 ]
[c 刺杀希特勒 ]
[d 毁灭战士 ]
[e 轩辕剑枫之舞]
[f 仙剑奇侠传 ]
[g 金庸群侠传 ]
[h 三国群英传 ]
[i 中国传统象棋]
[j 四国大战 ]
[k 手谈围棋 ]
[l 华容道 ]
[m 知识测验 ]
[n 最差的小游戏]
:
:query "您知道内存容量吗?" [x]
要玩这个游戏,程序需要知道您的
电脑的内存容量来调整到适合游戏
运行的限度,否则可能无法运行。
[我知道] [试一下] [返回吧]
:
:mem "内存多大?" [x]
32
64
96
128
160
192
224
256
288
320
352
384
416
448
480
512
:
:fore "您将要在内存盘中玩" [x]
现在已把该游戏从光盘复制到了内存盘,运行游戏期间您可以保存游戏进度
但重启电脑后就被清空,所以,如果在重启后要从保存的进度继续玩,就要
在结束该游戏后把它保存到硬盘(或其他介质),以后再运行本光盘选择从硬
盘运行该游戏(当然,您也可用其他方式运行保存的游戏)。
在您退出游戏后会出现询问您是否保存游戏的对话框。
[开始玩吧]
:
:cheat "自欺欺人对话框" [x]
track1 [$t1 1] track16 [$t16 1]
track2 [$t2 1] track17 [$t17 1]
track3 [$t3 1] track18 [$t18 1]
track4 [$t4 1] track19 [$t19 1]
track5 [$t5 1] track20 [$t20 1]
track6 [$t6 1] track21 [$t21 1]
track7 [$t7 1] track22 [$t22 1]
track8 [$t8 1] track23 [$t23 1]
track9 [$t9 1] track24 [$t24 1]
track10 [$t10 1] track25 [$t25 1]
track11 [$t11 1] track26 [$t26 1]
track12 [$t12 1] track27 [$t27 1]
track13 [$t13 1] track28 [$t28 1]
track14 [$t14 1] track29 [$t29 1]
track15 [$t15 1] track30 [$t30 1]
[全部设为最大值] [全部设为最小值] [确定] [返回]
:
:_save "保存游戏" [x]
您可以改变下面的默认保存路径 [扫描驱动器]
我要保存到: [$ savedir 96,! ][★]
保存后我要试运行保存的游戏 [!]
[确定] [返回]
:
:last
[DOS] [重启] [关机]
[?返回]
:
:test
call w.bat box 2,30 @%0:reg
if errorlevel 100 goto flee
if not "%name%"=="" if not "%year%"=="" if "%wrb%"=="2" goto start
wbat box 对不起,您面试没通过!再试试?
goto test
:flee
wbat box "想逃跑?" 逃吧,重来
if errorlevel 2 goto test
:_flee
wbat box DOS,重启,关机
if errorlevel 100 goto _flee
if errorlevel 3 off
if errorlevel 2 reboot
goto final
:start
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "寻趣园等您好久了!" 继续...
if errorlevel 100 goto nogame
:ask
wbat box 游戏选单,不想玩了
if errorlevel 100 goto nogame
if errorlevel 2 goto nogame
rem if errorlevel 1 go on
:game
call w.bat box 4,12 @%0:ls #%barpos%+1
set barpos=%?%
set oldgame=%gamedir%
if %wbat%==a set gamedir=skyroads
if %wbat%==b set gamedir=speedcar
if %wbat%==c set gamedir=wolf3d
if %wbat%==d set gamedir=doom
if %wbat%==e set gamedir=swda
if %wbat%==f set gamedir=pal
if %wbat%==g set gamedir=legend
if %wbat%==h set gamedir=sanguo
if %wbat%==i set gamedir=xiangqi
if %wbat%==j set gamedir=siguo
if %wbat%==k set gamedir=shoutan
if %wbat%==l set gamedir=huarong
if %wbat%==m set gamedir=test
if %wbat%==n set gamedir=car
if errorlevel 100 goto ask
if "%wbat%"=="f" goto pal
if "%wbat%"=="g" goto playcd
if "%wbat%"=="i" goto playcd
:play
wbat cls
if exist z:\%oldgame%\play.bat deltree /y z:\%oldgame% >nul
xcopy %romcd%\%gamedir% z:\%gamedir%\ /e /s /y
wbat box @%0:fore
:seecheat
cd\%gamedir%
call play.bat
if "%run%"=="fail" wbat box 运行失败!
set run=
if not "%gamedir%"=="skyroads" goto played
cd\wbat
wbat box "要不劳而获吗?" 要,不要
if errorlevel 2 goto played
:zero
call prevar
:allmod
call w.bat box @%0:cheat
if errorlevel 4 goto played
if errorlevel 3 goto modgame
if errorlevel 2 goto zero
call allcheat
goto allmod
:modgame
call crackarg
wbat box "要重新运行游戏,看一下不劳而获的结果吗?" 看一下,不想看
if errorlevel 2 goto played
goto seecheat
:played
cd\wbat
if %saveyn%==%gamedir% goto start
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "保存该游戏吗?" 不保存,保 存
if errorlevel 100 goto start
if errorlevel 2 goto asksave
goto start
:asksave
rem set savedrv=c
set savedir=d:\%gamedir%
:savebox
wbat cls ! text 24,2 (red on blue) @%0:studio
call w.bat fix box @%0:_save
if errorlevel 100 goto start
if errorlevel 4 goto start
if errorlevel 3 goto chkput
if errorlevel 2 goto explore
wbat cls
if exist drive.txt del drive.txt
call finddisk.bat C: D: E: F: G: H: I: J: K: L: M: N: P: Q: R: S: T: U: V: W: X:
goto savebox
:explore
call miniexpl.bat
goto savebox
:chkput
rem wbat cls ! text 24,2 (red on blue) @%0:studio
get z "%savedir%" 1 >nul
if "%get%"=="" goto two
if "%get%"==":" goto two
if "%get%"==":\" goto two
get z "%savedir%" 1 /w2 >nul
if "%get%"==":\" goto copygame
wbat cls ! text 24,2 (red on blue) @%0:studio ! box 输入非法!
goto savebox
:two
get z "%savedir%" /w1
set savedir=%get%:
:copygame
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "要显示待创建的文件夹吗?" yes,no
if errorlevel 2 goto chkdir
wbat box %savedir%
:chkdir
echo %savedir%|find "%gamedir%">nul
if errorlevel 1 goto gamename
set enddir=%savedir%
goto dirmake
:gamename
set enddir=%savedir%\%gamedir%
:dirmake
call multidir.bat
:tocopy
wbat cls
copy z:\%gamedir% "%enddir%" /y
if not exist %enddir%\play.bat goto savefail
echo %enddir%|find "swda" >nul
if errorlevel 1 goto saveok
for %%a in (ba rx save vc) do md "%enddir%\%%a"
for %%a in (ba rx save vc) do copy z:\%gamedir%\%%a "%enddir%\%%a" /y
for %%a in (ba\ba49.rsk rx\ri079.rix save\save.zaq vc\sp135.voc) do if not exist %enddir%\%%a goto savefail
goto saveok
wbat cls ! text 24,2 (red on blue) @%0:studio
:savefail
wbat box 保存失败!
goto savebox
:saveok
set saveyn=%gamedir%
if "%wcb1%"=="0" goto start
get z "%enddir%" /w1 >nul
%get%:
cd "%enddir%"
call play.bat
if "%run%"=="fail" wbat box 试运行失败!
set run=
z:
cd\wbat
goto start
:playcd
%romcd%
cd\%wbat%
call play.bat
z:
cd\wbat
goto start
:pal
wbat box 5,10 (cyan on brown) @%0:query
if errorlevel 100 goto game
if errorlevel 3 goto game
if errorlevel 2 goto play
call w.bat list 20,65 @%0:mem
if errorlevel 100 goto pal
if "%wbat%"=="32" goto 32
set memmb=%wbat%
goto term
:32
wbat cls
xcopy %romcd%\f z:\f\ /e /s /y
cd\f
call play.bat
cd\wbat
goto start
:nogame
wbat box (black on brown) @%0:last
if errorlevel 100 goto ask
if errorlevel 3 off
if errorlevel 2 reboot
goto final
:term
againram.bat
:final
wbat cls
被调用的:MINIEXPL.BAT (自制小浏览器)
FINDDISK.BAT 扫描驱动器
.......
....
@echo off
:loop
if "%1"=="" goto end
dir %1\ /w/ad | find "%1" >nul
if not errorlevel 1 echo %1>>drive.txt
shift
goto loop
:end
MULTIDIR.BAT 创建多层长名目录
@echo off
set lfn=%enddir%
get z "%lfn%" 1
dir "%lfn%" /w/ad|find /i "%get%"
if not errorlevel 1 goto final
md "%lfn%"
get z "%lfn%" 1
dir "%lfn%" /w/ad|find /i "%get%"
if not errorlevel 1 goto final
:start
set pos=
set fore=%lfn%
set ahead=
:toleft
get # "%fore%" ';';';';\';';';'; /x
set pos=%get%
get z "%lfn%" %pos%
set ahead=%get%
get r "-" %pos% /w1
get z "%fore%" /w%get%
set fore=%get%
get z "%fore%" 1
dir "%fore%" /w/ad|find /i "%get%"
if not errorlevel 1 goto toright
goto toleft
:toright
if "%ahead%"=="" goto end
get # "%ahead%" ';';';';\';';';';
if "%get%"=="0" goto last
get r "+" %pos% /w%get%
set pos=%get%
get r "-" %pos% /w1
get z "%lfn%" /w%get%
set fore=%get%
get z "%lfn%" %pos%
set ahead=%get%
get z "%fore%" 1
dir "%fore%" /w/ad|find /i "%get%"
if not errorlevel 1 goto toright
md "%fore%"
goto toright
:last
md "%lfn%"
:end
get z "%lfn%" 1
dir "%lfn%" /w/ad|find /i "%get%"
if not errorlevel 1 goto ok
wbat box "folder creation FAIL !" retry,back
if errorlevel 2 goto final
goto start
:ok
wbat box "folder creation SUCCEEDED !" continue...
:final
修改小游戏进度:
@echo off
if exist crack del crack
echo n z:\skyroads\skyroads.cfg>>crack
echo l0>>crack
if "%1"=="" goto end
echo e 6 %1 00>>crack
set get=6
shift
:crack
if "%1"=="" goto end
get r "+" $%get% /w2 /h
echo e %get% %1 00>>crack
shift
goto crack
:end
echo rcx>>crack
echo 42>>crack
echo w0>>crack
echo q>>crack
debug<crack
del crack
@echo off
crack %t1% %t2% %t3% %t4% %t5% %t6% %t7% %t8% %t9% %t10% %t11% %t12% %t13% %t14% %t15% %t16% %t17% %t18% %t19% %t20% %t21% %t22% %t23% %t24% %t25% %t26% %t27% %t28% %t29% %t30%
@echo off
for %%a in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) do set t%%a=7
|
|