home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
D!Zone (Collector's Edition)
/
D_ZONE_CD.ISO
/
programs
/
editors
/
dhtk100
/
dfe.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-12-06
|
30KB
|
1,026 lines
{****************************************************************************
* The DOOM Hacker's Tool Kit *
*****************************************************************************
* Program: DFE v1.31 *
* Purpose: DOOM 1.2 Front End *
* Date: 4/28/94 *
* Author: Joshua Jackson Internet: joshjackson@delphi.com *
****************************************************************************}
{As of this point in time, I have not found a way to allow execution of
the Watcom DOS extender while running under DPMI... however I am looking
into a way to switch the system back to real mode before launching DOOM}
{$IFNDEF DPMI}
uses app,objects,menus,drivers,views,memory,dialogs,strings,windos,Dos,crt,
WadDecl,Wad,mapread,StdDlg,Swap,MsgBox;
{$ELSE} {You CAN NOT use the SWAP unit under DPMI!!!}
uses app,objects,menus,drivers,views,memory,dialogs,strings,windos,Dos,crt,
WadDecl,Wad,mapread,StdDlg,MsgBox;
{$ENDIF}
const cmOnePlayerMenu = 100;
cmSerialMenu = 101;
cmIPXMenu = 102;
cmModemMenu = 103;
cmViewMaps = 105;
cmNull = 255;
gtNormal = 00;
gtIPXNet = 01;
gtModem = 02;
gtDirLinkModem = 03;
gtSerial = 04;
gtSetMode = 05;
gtViewSprites = 06;
gtViewMaps = 07;
type PMyApp=^TMyApp;
TMyApp=Object(Tapplication)
Constructor Init;
Procedure InitMenuBar; virtual;
Procedure Idle; virtual;
Procedure HandleEvent(Var Event:TEvent); virtual;
Function GetPalette:PPalette; virtual;
Procedure RunDoom(GameType:integer;Params:string);
Procedure OnePlayerMenu;
Procedure SerialMenu;
Procedure IPXMenu;
Procedure ModemMenu;
Procedure ViewMaps;
end;
SelLevelArray=array[1..4] of PCluster;
LevelNameArray=array[1..9] of String;
var MyApp:TMyApp;
Debug:boolean;
Procedure SetLevelData(R:TRect;var SelLevel:PRadioButtons;Level:word);
begin
case Level of
1:SelLevel:=New(PRadioButtons, Init(R,
NewSItem('~1~ Hanger',
NewSItem('~2~ Nuclear Plant',
NewSItem('~3~ Toxin Refinery',
NewSItem('~4~ Command Control',
NewSItem('~5~ Phobos Lab',
NewSItem('~6~ Central Processing',
NewSItem('~7~ Computer Station',
NewSItem('~8~ Phobos Anomaly',
NewSItem('~9~ Military Base',
nil)))))))))));
2:SelLevel:=New(PRadioButtons, Init(R,
NewSItem('~1~ Deimos Anomaly',
NewSItem('~2~ Containment Area',
NewSItem('~3~ Refinery',
NewSItem('~4~ Deimos Lab',
NewSItem('~5~ Command Center',
NewSItem('~6~ Halls of the Damned',
NewSItem('~7~ Spawning Vats',
NewSItem('~8~ Towel of Babel',
NewSItem('~9~ Fortress of Mystery',
nil)))))))))));
3:SelLevel:=New(PRadioButtons, Init(R,
NewSItem('~1~ Hell Keep',
NewSItem('~2~ Slough of Despair',
NewSItem('~3~ Pandemonium',
NewSItem('~4~ House of Pain',
NewSItem('~5~ Unholy Cathedrial',
NewSItem('~6~ Mount Erebus',
NewSItem('~7~ Limbo',
NewSItem('~8~ DIS',
NewSItem('~9~ Warrens',
nil)))))))))));
end;
end;
Procedure FindLevelNames(FileSpec:PathStr;var Levels:LevelNameArray;R:TRect; var SelLevel:PRadioButtons);
var PDir:PWadDirectory;
t,i1,i2,CurLevel:integer;
tmpstr:string;
Code:integer;
TmpArray:PSItem;
CurItem,ItemList:PSitem;
begin
TmpStr:=FileSpec;
PDir:=new(PWadDirectory, Init(FileSpec));
if WadResult<>wrOk then begin
MessageBox(WadResultMsg(WadResult),Nil,mfError+ mfOkButton);
exit;
end;
CurLevel:=1;
CurItem:=Nil;
ItemList:=Nil;
Levels[1]:='';
for t:=1 to PDir^.DirEntries do begin
if (PDir^.DirEntry^[t].ObjName[1]='E') and (PDir^.DirEntry^[t].ObjName[3]='M') then begin
tmpstr:=PDir^.DirEntry^[t].ObjName[2];
val(TmpStr,i1,Code);
if Code<>0 then
continue;
tmpstr:=PDir^.DirEntry^[t].ObjName[4];
val(TmpStr,i2,Code);
if Code<>0 then
continue;
Levels[CurLevel]:=PDir^.DirEntry^[t].ObjName;
if ItemList=Nil then begin
ItemList:=New(PSItem);
ItemList^.Value:=NewStr(Levels[CurLevel]);
ItemList^.Next:=Nil;
CurItem:=ItemList;
end
else begin
CurItem^.Next:=New(PSItem);
CurItem:=CurItem^.Next;
CurItem^.Value:=NewStr(Levels[CurLevel]);
CurItem^.Next:=Nil;
end;
inc(CurLevel);
if CurLevel=10 then begin
PDir^.Done;
Dispose(PDir);
SelLevel:=New(PRadioButtons, Init(R,ItemList));
exit;
end;
end;
end;
PDir^.Done;
Dispose(PDir);
SelLevel:=New(PRadioButtons, Init(R,ItemList));
end;
Procedure SetMenuData(MenuNum:byte;var Param1,Param2:string);
var R:Trect;
SelModem,SelGame,Monsters,SelSkill,Players:PCluster;
DialNum:PInputLine;
SelLevel:PRadioButtons;
Dialog1,Dialog2:PDialog;
Dialog3:PFileDialog;
ComPort:PCluster;
Control,Episode:word;
TmpStr,DmParam,ModeParam:string;
ExtFile:PathStr;
ExtLevelPos:byte;
jb:byte;
FileName: FNameStr;
LevelNames:LevelNameArray;
begin
Case MenuNum of
1:begin
R.Assign(2,1,30,5);
SelGame:=New(PRadioButtons, Init(R,
NewSItem('~K~nee-Deep In The Dead',
NewSItem('~S~hores Of Hell',
NewSItem('~I~nferno!',
NewSItem('~L~oad External Wad File',
nil))))));
R.Assign(20,6,60,15);
Dialog1:=New(PDialog,Init(r,'Episodes'));
with Dialog1^ do begin
R.Assign(5,6,15,8);
Insert(New(PButton,Init(R,'~O~k',cmOk,bfDefault)));
R.Assign(25,6,35,8);
Insert(New(PButton,Init(R,'~C~ancel',cmCancel,bfNormal)));
Insert(SelGame);
end;
Control:=Desktop^.ExecView(Dialog1);
Episode:=SelGame^.Value + 1;
Param1:='';
DmParam:='';
if Episode=4 then begin
FileName := '*.WAD';
Dialog3:=New(PFileDialog, Init('*.WAD', 'Select Wad File','~N~ame',fdOkButton,100));
Dialog3^.SetData(FileName);
Control:=Desktop^.ExecView(Dialog3);
if Control=cmFileOpen then
Control:=cmOk;
if Control=cmOK then begin
ExtFile:=Dialog3^.Directory^+(Dialog3^.FileName^.Data^);
R.Assign(2, 1, 28, 10);
FindLevelNames(ExtFile,LevelNames,R,SelLevel);
if WadResult<>wrOk then
exit;
if LevelNames[1]='' then begin
Param1:='';
MessageBox('No valid level entries found.',Nil,mfError+mfOkButton);
control:=cmCancel;
end
else begin
Episode:=4;
Param1:='-file '+ExtFile+' ';
end;
end;
Dialog3^.Done;
Dispose(Dialog3);
end;
if Control=cmOK then begin
R.Assign(30, 3, 55, 8);
SelSkill:=New(PRadioButtons, Init(R,
NewSItem('~I~''m too young to die',
NewSItem('~H~ey Not too Rough',
NewSItem('H~u~rt Me Plenty',
NewSItem('U~l~tra Violence',
NewSItem('~N~ightmare!',
nil)))))));
R.Assign(30, 1, 50, 2);
Monsters:=New(PCheckBoxes, Init(R,
NewSItem('No ~M~onsters',
nil)));
R.Assign(2, 1, 28, 10);
if Episode < 4 then
SetLevelData(R,SelLevel,1);
R.Assign(11,4,69,18);
Dialog2:=New(PDialog,Init(r,'Game Options'));
with Dialog2^ do begin
Insert(Monsters);
Insert(SelSkill);
R.Assign(15,11,25,13);
Insert(New(PButton,Init(R,'~C~ancel',cmCancel,bfNormal)));
R.Assign(2,11,12,13);
Insert(New(PButton,Init(R,'~O~k',cmOk,bfDefault)));
Insert(SelLevel);
end;
Control:=Desktop^.ExecView(Dialog2);
if Control=cmOk then begin
if Episode < 4 then begin
Str(Episode,TmpStr);
DmParam:='-devparm -warp '+TmpStr+' ';
Str(SelLevel^.Value + 1,TmpStr);
DmParam:=DmParam+TmpStr
end
else begin
DmParam:='-devparm -warp ';
DmParam:=DmParam+LevelNames[SelLevel^.Value+1][2]+' ';
DmParam:=DmParam+LevelNames[SelLevel^.Value+1][4];
end;