From a9d2e864020e5b499656881305f910709df4443d Mon Sep 17 00:00:00 2001 From: cholleme <> Date: Thu, 26 Sep 2002 15:44:25 +0000 Subject: [PATCH] no message --- Tenebrae_launch.dpr | 15 ++ Tenebrae_launch.res | Bin 0 -> 1220 bytes cred.dfm | Bin 0 -> 542 bytes cred.pas | 32 ++++ credits.rtf | 48 ++++++ mainu.dfm | Bin 0 -> 3169 bytes mainu.pas | 393 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 488 insertions(+) create mode 100644 Tenebrae_launch.dpr create mode 100644 Tenebrae_launch.res create mode 100644 cred.dfm create mode 100644 cred.pas create mode 100644 credits.rtf create mode 100644 mainu.dfm create mode 100644 mainu.pas diff --git a/Tenebrae_launch.dpr b/Tenebrae_launch.dpr new file mode 100644 index 0000000..c9fb701 --- /dev/null +++ b/Tenebrae_launch.dpr @@ -0,0 +1,15 @@ +program Tenebrae_launch; + +uses + Forms, + mainu in 'mainu.pas' {Form1}, + cred in 'cred.pas' {Form2}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.Run; +end. diff --git a/Tenebrae_launch.res b/Tenebrae_launch.res new file mode 100644 index 0000000000000000000000000000000000000000..905242e804aa244d883e9f2a2fb81f820865d7ae GIT binary patch literal 1220 zcmb_cJ5Iwu5Pchvpg^z@4H88xXef~=kuZpg0yqH2NQp#zgB*dY_y)cLq5ujY>4=rc z!H5&P-bYs_F_Wv{PlUfxhY#E&4ri2>CjOgyy0d#}e zG~1SH5A_;$Dh!8&pmyS5w9v00INjA;mhX8%#Js}>^KbBtDj;2K>0ox3 zZq2H|W6E(^rA7IET$E2oMftd2ln*P#Ok}(exmT`6l1j=|(PYkZMGjb2!m32{9oT?> ze+SwIjfw9dr`}B&-vB+F`5?Gb{qsApb_2i2dY*LLcm_u-7}#~MH^A@sk^~Ok`yh1| z>-M)~I3=FM?;kDmVgSsxfax0WJOn1nx4_#C@VZNVZv63~y#w}G(IHu66PGx{1+K{F cxTcKM?yDBmLz4KRc2)n4Lcxh5y%W8OPk{-$!~g&Q literal 0 HcmV?d00001 diff --git a/cred.dfm b/cred.dfm new file mode 100644 index 0000000000000000000000000000000000000000..53447047113933992b277a3a32f387b1590c3437 GIT binary patch literal 542 zcmY+By;9>a5XWUZv79f+4ApfmsTiQ7OH4d42}v&24dtCbHduorWmaPND0mKDgSVjK zZKx9xV9-RB8!$De}_& z)2+wu1`bGvt$1EejKI#n$4Rp+H>h{z25l>lJN{1jtK&y^sEiPr;|NjS|F=y)Q*$Yx z9W`1zc{SD|PIDN{xBzvOXyoEXIsU<1h6cUfY`B(pq6p6pNx;%f&a7?vel@@Ly&2+;O2?$UKY5jagZ6axm#apEP5(|lM(fn63#reh*B>5@w`O9ednQ*lpMSgZ+g4k)1b+q)a(>vWqOq)bsLvp7(wD{@e88!SUJAme+lB+V;Ho zWY7)c0pqi+n!Z+tXd;8TAH-}Pd{b%dFg`~7AZ1jv+6f-r2#ID#h-S?MA7P4T_($Z~ zRU>&rP*hLE2-6F7*N1b784c?(qA1}Iwfh7kD)$k-n9AU%O3OUI!(%xOeyOwvjLOaa z6mo%N^l*1?(0e$?=T&+s~BC&mj1(l`u{Za(;GNLVdrQB zMvw|HLL5)b_j->luYSS=&Nml5n6pvJ5u$yyGsNr1w9gTgC{pYB%-nZQ@HHahL=i#L zsej(g!`gryFN}vUK_t}IZB3y6DCf^_)pTk;2#dvzlM~J+n4m8_FN$}t+>tagKU)T& zt`#`1Sct;{;>iM{_H6GO%X$ox<6I-(i`3o;PA{XjMbb~zL&cO*<+2ZHipWa5mnPo% za=e4pc+s;V%vAm^V&!(km!*i+@8A^ zjxgtpi&|gH-bjh!X#i8yI)Pm2rC-woCUms1fF|W%c_a%MV=0 zT`XWikOTF+yHPE92DN)PYV954WE}OUD7{4Eh6AreO23h0^Ts_6YM6*OjG`4Q>y+W6$gEBK;{3G4k(>V;lv9| zwx@_`Fk2Vvnm056hMPr~^HD$9|u5#`lyGbM1n+Yr}5%OKl)^+q|XPSd!mKR5xDGC~ECxK4DHF zy+F~!#XIvtr>O^*$jmRM9D~2jDOyaETLs_ls1DwsD;Kg+N>RgY=@eJsO-8{3&EjHM W-Cl(ccM(yA;UY9|M=*n*66!ylamBX) literal 0 HcmV?d00001 diff --git a/mainu.pas b/mainu.pas new file mode 100644 index 0000000..b0b1963 --- /dev/null +++ b/mainu.pas @@ -0,0 +1,393 @@ +unit mainu; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, Buttons, IniFiles; + +type + TForm1 = class(TForm) + BitBtn1: TBitBtn; + BitBtn2: TBitBtn; + GroupBox1: TGroupBox; + GroupBox2: TGroupBox; + RadioButton1: TRadioButton; + RadioButton2: TRadioButton; + RadioButton3: TRadioButton; + CheckBox1: TCheckBox; + RadioButton4: TRadioButton; + RadioButton5: TRadioButton; + RadioButton6: TRadioButton; + GroupBox3: TGroupBox; + Edit1: TEdit; + Label1: TLabel; + Memo1: TMemo; + Resolution: TGroupBox; + ComboBox1: TComboBox; + CheckBox2: TCheckBox; + GroupBox4: TGroupBox; + Edit2: TEdit; + CheckBox3: TCheckBox; + CheckBox4: TCheckBox; + Label2: TLabel; + BitBtn3: TBitBtn; + ComboBox2: TComboBox; + Label3: TLabel; + Button1: TButton; + Button2: TButton; + procedure FormCreate(Sender: TObject); + procedure BitBtn2Click(Sender: TObject); + procedure BitBtn1Click(Sender: TObject); + procedure BitBtn3Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure ComboBox2Change(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + CurrentConfig : String; + + Procedure CreateModeList; + Function AssembleParamString : string; + Function GetMirIndex : integer; + Function GetTexIndex : integer; + Function GetFilter : string; + Function GetAnisoIndex : integer; + Function GetForceWaterIndex : integer; + Procedure LoadConfig(Ident : String); + Procedure SaveConfig(Ident : String); + Function FindConfigs : integer; + end; + +var + Form1: TForm1; + +implementation + +uses cred; + +{$R *.DFM} + +var + modes : array[0..255] of tdevMode; + +function DisplayModeInfo(index : integer) : string; +var + amode : ^tdevMode; + succes : boolean; + i : integer; +begin + if index >= 255 then + begin + Result := 'STOP'; + exit; + end; + + if not EnumDisplaySettings(nil,index,modes[index]) then + begin + Result := 'STOP'; + exit; + end; + + amode := @modes[index]; + //force 16 or 32 bit modes + if amode.dmBitsPerPel <> 32 then + begin + result := ''; + end else + begin + //search if you already have the specified resolution in the list... + + for i := 0 to index-1 do + begin + if (modes[index].dmPelsWidth = modes[i].dmPelsWidth) + and (modes[index].dmPelsHeight = modes[i].dmPelsHeight) + and (modes[i].dmBitsPerPel = 32) then + begin + //yes? then just skip it + result := ''; + exit; + end; + end; + + result := inttostr(amode.dmPelsWidth)+' x '+ + inttostr(amode.dmPelsHeight)+' x '+ + inttostr(amode.dmBitsPerPel); + end; +end; + +procedure TForm1.CreateModeList; +var + s : string; + i : integer; +begin + i := 0; + s := DisplayModeInfo(i); + while s <> 'STOP' do + begin + if s <> '' then ComboBox1.Items.AddObject(s,Pointer(i)); + inc(i); + s := DisplayModeInfo(i); + end; + if ComboBox1.Items.Count = 0 then + begin + ComboBox1.Items.Add('No 32 bit modes found'); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Application.Title := 'Tenebrae Config'; + CreateModeList; + ComboBox1.ItemIndex := 0; + + if FindConfigs = 0 then + begin + SaveConfig('Standard'); + FindConfigs; + end; + ComboBox2.ItemIndex := 0; + CurrentConfig := ComboBox2.Items.Strings[ComboBox2.ItemIndex]; + LoadConfig(CurrentConfig); +end; + +function TForm1.GetMirIndex : integer; +begin + if RadioButton1.Checked then + begin + result := 0; + exit; + end; + if RadioButton2.Checked then + begin + result := 1; + exit; + end; + if RadioButton3.Checked then + begin + result := 2; + exit; + end; +end; + +function TForm1.GetTexIndex : integer; +begin + if RadioButton4.Checked then + begin + result := 0; + exit; + end; + if RadioButton5.Checked then + begin + result := 1; + exit; + end; + if RadioButton6.Checked then + begin + result := 2; + exit; + end; +end; + +function TForm1.GetForceWaterIndex : integer; +begin + if CheckBox1.Checked then + begin + result := 1; + exit; + end; + result := 0; + exit; +end; + +function TForm1.GetFilter : string; +begin + if CheckBox3.Checked then + result := 'GL_LINEAR_MIPMAP_LINEAR' + else + result := 'GL_LINEAR_MIPMAP_NEAREST'; +end; + +function TForm1.GetAnisoIndex : integer; +begin + if CheckBox4.Checked then + result := 1 + else + result := 0; +end; + +function TForm1.AssembleParamString : string; +var + s : string; + amode : ^tdevMode; +begin + amode := @modes[integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex])]; + + //screen res + s := ' -width '+IntToStr(amode.dmPelsWidth)+' -height '+IntToStr(amode.dmPelsHeight)+' -bpp 32 '; + //mirrors + s := s + '+mir_detail ' + IntToStr(getMirIndex) + ' +mir_forcewater ' + IntToStr(GetForceWaterIndex) + ' '; + //textures + s := s + '+gl_picmip ' + IntToStr(getTexIndex) + ' '; + //lightgen + s := s + '+sh_radiusscale '+ Edit1.Text; + //windowed + if CheckBox2.Checked then + s := s+' -window'; + //texture filtering + s := s+' +gl_texturemode '+GetFilter+' '; + + if CheckBox4.Checked then + s := s+' -anisotropic '; + //aditional params + s := s+' '+edit2.text; + + result := s; +end; + +procedure TForm1.LoadConfig(Ident : String); +var + IniFile : TIniFile; +begin + IniFile := TIniFile.Create(ExtractFileDir(ParamStr(0))+'\'+ident+'.tcfg'); + RadioButton1.Checked := IniFile.ReadBool('MIRROR','Disabled',false); + RadioButton2.Checked := IniFile.ReadBool('MIRROR','World',true); + RadioButton3.Checked := IniFile.ReadBool('MIRROR','Full',false); + CheckBox1.Checked := IniFile.ReadBool('MIRROR','ForceWater',false); + + RadioButton4.Checked := IniFile.ReadBool('TEXTURE','Full',true); + RadioButton5.Checked := IniFile.ReadBool('TEXTURE','HalfSize',false); + RadioButton6.Checked := IniFile.ReadBool('TEXTURE','QuadSize',true); + CheckBox3.Checked := IniFile.ReadBool('TEXTURE','TriLinear',false); + CheckBox4.Checked := IniFile.ReadBool('TEXTURE','Anisotropic',false); + + ComboBox1.ItemIndex := IniFile.ReadInteger('RESOLUTION','Mode',0); + CheckBox2.Checked := IniFile.ReadBool('RESOLUTION','Windowed',false); + + Edit1.Text := IniFile.ReadString('LIGHTS','Radiusscale','0.5'); + + Edit2.Text := IniFile.ReadString('MISC','Extra',''); + + IniFile.Free; +end; + +procedure TForm1.SaveConfig(Ident : String); +var + IniFile : TIniFile; +begin + IniFile := TIniFile.Create(ExtractFileDir(ParamStr(0))+'\'+ident+'.tcfg'); + IniFile.WriteBool('MIRROR','Disabled',RadioButton1.Checked); + IniFile.WriteBool('MIRROR','World',RadioButton2.Checked); + IniFile.WriteBool('MIRROR','Full',RadioButton3.Checked); + IniFile.WriteBool('MIRROR','ForceWater',CheckBox1.Checked); + + IniFile.WriteBool('TEXTURE','Full',RadioButton4.Checked); + IniFile.WriteBool('TEXTURE','HalfSize',RadioButton5.Checked); + IniFile.WriteBool('TEXTURE','QuadSize',RadioButton6.Checked); + IniFile.WriteBool('TEXTURE','TriLinear',CheckBox3.Checked); + IniFile.WriteBool('TEXTURE','Anisotropic',CheckBox4.Checked); + + IniFile.WriteInteger('RESOLUTION','Mode',ComboBox1.ItemIndex); + IniFile.WriteBool('RESOLUTION','Windowed',CheckBox2.Checked); + + IniFile.WriteString('LIGHTS','Radiusscale',Edit1.Text); + + IniFile.WriteString('MISC','Extra',Edit2.Text); + + Inifile.Free; +end; + +Function ExtractFileBase(v : String) : String; +begin + //hack assume extension is 5 chars (.tcfg) + result := Copy(v,0,length(v)-5); +end; + +Function TForm1.FindConfigs : integer; +var + F : TSearchRec; + Res, Count : Integer; +begin + Res := FindFirst(ExtractFileDir(ParamStr(0))+'\*.tcfg',0,F); + Count := 0; + ComboBox2.Items.Clear; + while (Res = 0) do + begin + ComboBox2.Items.Add(ExtractFileBase(F.Name)); + Inc(Count); + Res := FindNext(F); + end; + FindClose(F); + + result := Count; +end; + +procedure TForm1.BitBtn2Click(Sender: TObject); +var +winbestand : array [0..1024] of char; +toexec : String; +begin + toexec := 'tenebrae.exe' + AssembleParamString; + if winexec(StrPCopy(winbestand, toexec),sw_show) < 31 then messagedlg('Windows'+ + ' could not launch Tenebrae'+chr(13)+ToExec,mterror,[mbok],0); + SaveConfig(CurrentConfig); + application.terminate; +end; + +procedure TForm1.BitBtn1Click(Sender: TObject); +begin + SaveConfig(CurrentConfig); + Application.Terminate; +end; + +procedure TForm1.BitBtn3Click(Sender: TObject); +begin + Form2.ShowModal; +end; + +procedure TForm1.Button1Click(Sender: TObject); +var + newname : string; +begin + NewName := 'NewProfile'+IntToStr(ComboBox2.Items.Count); + if not InputQuery('Enter profile name','Enter a name for the new profile',newname) then + exit; + SaveConfig(CurrentConfig); + if newname = '' then + begin + newname := 'Necrophilia!'; + //Edit2.Text := 'The pale skin, memory''s off the...'; + //Edit1.Text := '... moonlight'; + end; + SaveConfig(newname); + CurrentConfig := newname; + //FindConfigs; + ComboBox2.Items.Add(newname); + ComboBox2.ItemIndex := ComboBox2.Items.Count-1; +end; + +procedure TForm1.ComboBox2Change(Sender: TObject); +begin + SaveConfig(CurrentConfig); + CurrentConfig := ComboBox2.Items.Strings[ComboBox2.ItemIndex]; + LoadConfig(CurrentConfig); +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + If ComboBox2.Items.Count < 2 then + begin + messagedlg('You need at least one profile',mterror,[mbok],0); + exit; + end; + CurrentConfig := ComboBox2.Items.Strings[ComboBox2.ItemIndex]; + DeleteFile(ExtractFileDir(ParamStr(0))+'\'+CurrentConfig+'.tcfg'); + FindConfigs; + ComboBox2.ItemIndex := 0; + CurrentConfig := ComboBox2.Items.Strings[ComboBox2.ItemIndex]; + LoadConfig(CurrentConfig); +end; + +end.