diff --git a/mmbn5m.lpi b/mmbn5m.lpi index 9a369f9..de35cc9 100644 --- a/mmbn5m.lpi +++ b/mmbn5m.lpi @@ -14,6 +14,14 @@ + + + + + + + + diff --git a/mmbn5m.lps b/mmbn5m.lps index 2e5377d..425fa01 100644 --- a/mmbn5m.lps +++ b/mmbn5m.lps @@ -9,7 +9,7 @@ - + @@ -46,9 +46,9 @@ - + - + @@ -59,141 +59,149 @@ - - - + + + - + - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/mmbn5m.res b/mmbn5m.res index 09ecee6..994e6c6 100644 Binary files a/mmbn5m.res and b/mmbn5m.res differ diff --git a/rooms.ini b/rooms.ini index 55cbdc4..d43216c 100644 --- a/rooms.ini +++ b/rooms.ini @@ -78,3 +78,13 @@ 3982=Squirrel Comp 16 1536=Higsby's 1422=Squirrel Comp 6 +397=Crane Comp +141=Elevator Room +1025=Mission Control +3=Dock + +[Spoils] +397=RegUP2,1000z +141=HolyPanl*,RegUP1 +401=Vulcan2 C,HP Memory +145=Quake1 A,Snake M diff --git a/unit1.lfm b/unit1.lfm index a020d58..8c10ea0 100644 --- a/unit1.lfm +++ b/unit1.lfm @@ -1,64 +1,158 @@ object Form1: TForm1 - Left = 802 + Left = 1033 Height = 448 - Top = 496 + Top = 463 Width = 528 - BorderStyle = bsSingle Caption = 'MMBN5M' ClientHeight = 448 ClientWidth = 528 Font.CharSet = ANSI_CHARSET Font.Height = -16 - Font.Pitch = fpVariable + Font.Name = 'Liberation Mono' + Font.Pitch = fpFixed Font.Quality = fqDraft OnCreate = FormCreate OnDestroy = FormDestroy + Position = poScreenCenter LCLVersion = '2.2.6.0' object room_name_label: TLabel - Left = 120 - Height = 21 + AnchorSideLeft.Control = start_stop_button + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + Left = 136 + Height = 18 Top = 8 - Width = 157 - Caption = 'Room #0: Lan''s Room ' + Width = 320 + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + Caption = 'Run the game, then press "Start"' Color = clGradientInactiveCaption - Font.CharSet = ANSI_CHARSET - Font.Height = -16 - Font.Pitch = fpFixed - Font.Quality = fqCleartype ParentColor = False - ParentFont = False Transparent = False end object map_image: TImage - Left = 120 - Height = 400 - Top = 40 - Width = 400 + AnchorSideLeft.Control = room_name_label + AnchorSideTop.Control = room_name_label + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 136 + Height = 406 + Top = 34 + Width = 384 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + BorderSpacing.Bottom = 8 Center = True OnPaint = map_imagePaint Proportional = True Stretch = True end object start_stop_button: TSpeedButton + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner Left = 8 Height = 30 Top = 8 - Width = 100 + Width = 120 AllowAllUp = True + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 Caption = 'Start' GroupIndex = 1 Transparent = False OnClick = start_stop_buttonClick end object edit_room_button: TButton + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = start_stop_button + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = map_image Left = 8 Height = 30 - Top = 40 - Width = 100 + Top = 46 + Width = 120 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 Caption = 'Edit Room' OnClick = edit_room_buttonClick TabOrder = 0 end + object spoils_listbox: TListBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = spoils_label + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = map_image + AnchorSideBottom.Control = plus_spoil + Left = 8 + Height = 250 + Top = 110 + Width = 120 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + BorderSpacing.Bottom = 8 + BorderStyle = bsNone + Color = clGradientInactiveCaption + ItemHeight = 0 + OnDblClick = spoils_listboxDblClick + TabOrder = 1 + end + object spoils_label: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = edit_room_button + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = map_image + Left = 8 + Height = 18 + Top = 84 + Width = 120 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + Caption = 'Spoils:' + ParentColor = False + end + object plus_spoil: TButton + AnchorSideLeft.Control = Owner + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 8 + Height = 40 + Top = 400 + Width = 56 + Anchors = [akLeft, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 8 + Caption = '+' + OnClick = plus_spoilClick + TabOrder = 2 + end + object minus_spoil1: TButton + AnchorSideLeft.Control = plus_spoil + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = map_image + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 72 + Height = 40 + Top = 400 + Width = 56 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Right = 8 + BorderSpacing.Bottom = 8 + Caption = '-' + OnClick = minus_spoil1Click + TabOrder = 3 + end object Timer1: TTimer Enabled = False OnTimer = Timer1Timer diff --git a/unit1.pas b/unit1.pas index ec7e20b..ce4618c 100644 --- a/unit1.pas +++ b/unit1.pas @@ -6,14 +6,18 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, - Buttons, IniFiles; + Buttons, Grids, IniFiles; type { TForm1 } TForm1 = class(TForm) + plus_spoil: TButton; edit_room_button: TButton; + minus_spoil1: TButton; + spoils_label: TLabel; + spoils_listbox: TListBox; map_image: TImage; room_name_label: TLabel; start_stop_button: TSpeedButton; @@ -22,6 +26,9 @@ type procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure map_imagePaint(Sender: TObject); + procedure minus_spoil1Click(Sender: TObject); + procedure plus_spoilClick(Sender: TObject); + procedure spoils_listboxDblClick(Sender: TObject); procedure start_stop_buttonClick(Sender: TObject); procedure Timer1Timer(Sender: TObject); private @@ -104,6 +111,8 @@ var last_room: smallint = -1; room_name: string; new_room: bool; + spoils_list: string; + spoils: TStringArray; {$R *.lfm} @@ -114,6 +123,7 @@ begin // open ini file and create a list to hold processes ROOMS := TIniFile.Create('rooms.ini'); process_list := TStringList.Create(); + spoils_listbox.Height := 0; end; procedure TForm1.FormDestroy(Sender: TObject); @@ -131,8 +141,79 @@ end; procedure TForm1.map_imagePaint(Sender: TObject); begin - map_image.Canvas.Brush.Style := bsClear; - map_image.Canvas.Rectangle(0, 0, 400, 400); + //map_image.Canvas.Brush.Style := bsClear; + //map_image.Canvas.Rectangle(0, 0, 400, 400); +end; + +procedure TForm1.minus_spoil1Click(Sender: TObject); +var + Txt: string; + i: integer; +begin + if (spoils_listbox.ItemIndex > -1) then + begin + spoils_listbox.Items.Delete(spoils_listbox.ItemIndex); + for i := 0 to spoils_listbox.Items.Count - 1 do + begin + if i < spoils_listbox.Items.Count - 1 then + Txt := Txt + spoils_listbox.Items[i] + ',' + else + Txt := Txt + spoils_listbox.Items[i]; + end; + ROOMS.WriteString('Spoils', IntToStr(room), Txt); + end; + spoils_listbox.ClearSelection; +end; + +procedure TForm1.plus_spoilClick(Sender: TObject); +var + new_spoil_name: string; +var + Txt: string; + i: integer; +begin + if InputQuery('Adding item to Room #' + IntToStr(room), 'Enter item''s name', + new_spoil_name) then + begin + spoils_listbox.Items.Add(new_spoil_name); + for i := 0 to spoils_listbox.Items.Count - 1 do + begin + if i < spoils_listbox.Items.Count - 1 then + Txt := Txt + spoils_listbox.Items[i] + ',' + else + Txt := Txt + spoils_listbox.Items[i]; + end; + ROOMS.WriteString('Spoils', IntToStr(room), Txt); + end; + spoils_listbox.ClearSelection; +end; + +procedure TForm1.spoils_listboxDblClick(Sender: TObject); +var + new_spoil_name: string; +var + Txt: string; + i: integer; +begin + if (spoils_listbox.ItemIndex > -1) then + begin + new_spoil_name := spoils_listbox.Items[spoils_listbox.ItemIndex]; + if InputQuery('Editing item in Room #' + IntToStr(room), + 'Enter item''s name', new_spoil_name) then + begin + spoils_listbox.Items[spoils_listbox.ItemIndex] := new_spoil_name; + for i := 0 to spoils_listbox.Items.Count - 1 do + begin + if i < spoils_listbox.Items.Count - 1 then + Txt := Txt + spoils_listbox.Items[i] + ',' + else + Txt := Txt + spoils_listbox.Items[i]; + end; + ROOMS.WriteString('Spoils', IntToStr(room), Txt); + + end; + end; + spoils_listbox.ClearSelection; end; procedure TForm1.start_stop_buttonClick(Sender: TObject); @@ -168,6 +249,8 @@ end; procedure TForm1.Timer1Timer(Sender: TObject); begin + spoils_listbox.Height := spoils_listbox.Items.Count * spoils_listbox.ItemHeight; + if hProcess <> 0 then begin @@ -176,10 +259,18 @@ begin begin if (last_room <> room) or (new_room) then begin - new_room := false; + new_room := False; last_room := room; room_name := ROOMS.ReadString('Rooms', IntToStr(room), 'Unknown'); room_name_label.Caption := 'Room #' + IntToStr(room) + ': ' + room_name; + spoils_list := ROOMS.ReadString('Spoils', IntToStr(room), ''); + spoils_listbox.Items.Clear; + if (spoils_list <> '') then + begin + spoils := spoils_list.Split(','); + spoils_listbox.Items.AddStrings(spoils); + end; + if FileExists('images/' + room_name + '.png') then begin map_image.Picture.LoadFromFile('images/' + room_name + '.png'); @@ -192,11 +283,11 @@ begin end else begin - room_name_label.Caption := 'error'; + room_name_label.Caption := 'Error. Make sure the game is running'; end; except on edit_room_button: Exception do - room_name_label.Caption := 'error'; + room_name_label.Caption := 'Error'; end; end; @@ -211,7 +302,7 @@ begin new_room_name) then begin ROOMS.WriteString('Rooms', IntToStr(room), new_room_name); - new_room := true; + new_room := True; end; end;