Subversion Repositories plumbers

Rev

Rev 8 | Rev 11 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 10
Line 1... Line 1...
1
unit Unit1;
1
unit Unit1;
2
 
2
 
3
// BUG: deleting of pictures does not work! the editor becomes very confused, and the changes are not saved at all?
-
 
4
// TODO: when closing the editor: ask if the user wants to save (but only if they changed something)
-
 
5
// TODO: the "folder open" icons look like you can CHOOSE a file, not open it!
3
// TODO: the "folder open" icons look like you can CHOOSE a file, not open it!
6
//       - change the icon to something else
4
//       - change the icon to something else
7
//       - add open-dialogs for choosing the bmp and wav files
5
//       - add open-dialogs for choosing the bmp and wav files
-
 
6
// TODO: Give controls better names
8
// Idea: When actions are deleted, remove the colorful marking on the picture?
7
// Idea: When actions are deleted, remove the colorful marking on the picture?
-
 
8
// Idea: decision bitmap markings: anti moiree?
9
// Idea: unused liste auch bei decision page anzeigen
9
// Idea: unused liste auch bei decision page anzeigen
10
// Idea: hotspots: netz ziehen anstelle linke und rechts maustaste. netz in jede beliebige richtung ziehen und topleft/bottomright automatisch bestimmen
10
// Idea: hotspots: netz ziehen anstelle linke und rechts maustaste. netz in jede beliebige richtung ziehen und topleft/bottomright automatisch bestimmen
-
 
11
// Idea: Automatic correct wrong Game.numScenes/numPics values? (especially since we rely on them when adding a scene)
11
// Idea: decision bitmap markings: anti moiree?
12
// Idea: "defragmentation": shift all pictures to the left if a scene has a higher "numPics" value than actual pictures
12
 
13
 
13
interface
14
interface
14
 
15
 
15
uses
16
uses
16
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
17
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
17
  Dialogs, StdCtrls, Spin, Grids, GameBinStruct, ComCtrls, ExtCtrls, Vcl.MPlayer,
18
  Dialogs, StdCtrls, Spin, Grids, GameBinStruct, ComCtrls, ExtCtrls, MPlayer,
18
  Vcl.Menus;
19
  Menus;
19
 
20
 
20
const
21
const
21
  CUR_VER = '2017-10-03';
22
  CUR_VER = '2017-10-04';
22
 
23
 
23
type
24
type
24
  TForm1 = class(TForm)
25
  TForm1 = class(TForm)
25
    ListBox1: TListBox;
26
    ListBox1: TListBox;
26
    Button1: TButton;
27
    Button1: TButton;
Line 85... Line 86...
85
    Label16: TLabel;
86
    Label16: TLabel;
86
    Button13: TButton;
87
    Button13: TButton;
87
    Button14: TButton;
88
    Button14: TButton;
88
    MediaPlayer1: TMediaPlayer;
89
    MediaPlayer1: TMediaPlayer;
89
    Timer1: TTimer;
90
    Timer1: TTimer;
90
    GroupBox1: TGroupBox;
-
 
91
    Label20: TLabel;
-
 
92
    Label21: TLabel;
-
 
93
    Label22: TLabel;
-
 
94
    Label23: TLabel;
-
 
95
    GroupBox2: TGroupBox;
91
    GroupBox2: TGroupBox;
96
    Button15: TButton;
92
    Button15: TButton;
97
    Button17: TButton;
93
    Button17: TButton;
98
    Button16: TButton;
94
    Button16: TButton;
99
    Label18: TLabel;
95
    Label18: TLabel;
Line 123... Line 119...
123
    Addtoscene1: TMenuItem;
119
    Addtoscene1: TMenuItem;
124
    Panel1: TPanel;
120
    Panel1: TPanel;
125
    Panel2: TPanel;
121
    Panel2: TPanel;
126
    Panel3: TPanel;
122
    Panel3: TPanel;
127
    Image3: TImage;
123
    Image3: TImage;
-
 
124
    Button19: TButton;
-
 
125
    PageControl3: TPageControl;
-
 
126
    TabSheet6: TTabSheet;
-
 
127
    TabSheet7: TTabSheet;
-
 
128
    Label20: TLabel;
-
 
129
    Label21: TLabel;
-
 
130
    Label22: TLabel;
-
 
131
    Label23: TLabel;
-
 
132
    Label34: TLabel;
-
 
133
    Label35: TLabel;
-
 
134
    Label32: TLabel;
-
 
135
    Label33: TLabel;
-
 
136
    Label30: TLabel;
-
 
137
    Label31: TLabel;
-
 
138
    Label36: TLabel;
-
 
139
    Label37: TLabel;
128
    procedure ListBox1Click(Sender: TObject);
140
    procedure ListBox1Click(Sender: TObject);
129
    procedure Edit1Change(Sender: TObject);
141
    procedure Edit1Change(Sender: TObject);
130
    procedure Edit2Change(Sender: TObject);
142
    procedure Edit2Change(Sender: TObject);
131
    procedure SpinEdit1Change(Sender: TObject);
143
    procedure SpinEdit1Change(Sender: TObject);
132
    procedure Button3Click(Sender: TObject);
144
    procedure Button3Click(Sender: TObject);
Line 169... Line 181...
169
    procedure Close1Click(Sender: TObject);
181
    procedure Close1Click(Sender: TObject);
170
    procedure Addtoscene1Click(Sender: TObject);
182
    procedure Addtoscene1Click(Sender: TObject);
171
    procedure ListBox3MouseDown(Sender: TObject; Button: TMouseButton;
183
    procedure ListBox3MouseDown(Sender: TObject; Button: TMouseButton;
172
      Shift: TShiftState; X, Y: Integer);
184
      Shift: TShiftState; X, Y: Integer);
173
    procedure ListBox3Click(Sender: TObject);
185
    procedure ListBox3Click(Sender: TObject);
-
 
186
    procedure Button19Click(Sender: TObject);
-
 
187
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
174
  private
188
  private
175
    Game: TGameBinFile;
189
    Game: TGameBinFile;
-
 
190
    GameBak: TGameBinFile;
176
    PlayStart: Cardinal;
191
    PlayStart: Cardinal;
177
    MediaplayerOpened: boolean;
192
    MediaplayerOpened: boolean;
178
    StopPlayRequest: boolean;
193
    StopPlayRequest: boolean;
179
    FirstTickCount: Cardinal;
194
    FirstTickCount: Cardinal;
180
    procedure ShowSceneBmp;
195
    procedure ShowSceneBmp;
Line 193... Line 208...
193
    procedure NewScene;
208
    procedure NewScene;
194
    procedure SetupGUIAfterLoad;
209
    procedure SetupGUIAfterLoad;
195
    procedure RecalcSlideshowLength;
210
    procedure RecalcSlideshowLength;
196
    procedure RecalcSoundtrackLength;
211
    procedure RecalcSoundtrackLength;
197
    procedure RecalcUnusedFiles;
212
    procedure RecalcUnusedFiles;
-
 
213
    procedure RecalcStats;
198
    procedure HandlePossibleEmptySceneList;
214
    procedure HandlePossibleEmptySceneList;
199
    procedure DisableEnableSceneControls(enable: boolean);
215
    procedure DisableEnableSceneControls(enable: boolean);
200
    procedure DisableEnablePictureControls(enable: boolean);
216
    procedure DisableEnablePictureControls(enable: boolean);
201
    procedure DisableEnableFileControls(enable: boolean);
217
    procedure DisableEnableFileControls(enable: boolean);
202
    class procedure AspectRatio(image: TImage; panel: TControl);
218
    class procedure AspectRatio(image: TImage; panel: TControl);
Line 210... Line 226...
210
{$R *.dfm}
226
{$R *.dfm}
211
 
227
 
212
uses
228
uses
213
  Math, MMSystem, ShellAPI;
229
  Math, MMSystem, ShellAPI;
214
 
230
 
-
 
231
const
-
 
232
  DEFAULT_DURATION = 0;
-
 
233
  DEFAULT_FILENAME = 'DUMMY.BMP';
-
 
234
 
215
function GetSceneIDFromName(sceneName: string): Integer;
235
function GetSceneIDFromName(sceneName: string): Integer;
216
var
236
var
217
  sSceneID: string;
237
  sSceneID: string;
218
begin
238
begin
219
  if Copy(sceneName, 1, 2) <> 'SC' then raise Exception.Create('Scene name invalid');
239
  if Copy(sceneName, 1, 2) <> 'SC' then raise Exception.Create('Scene name invalid');
220
  sSceneID := Copy(sceneName, 3, 2);
240
  sSceneID := Copy(sceneName, 3, 2);
221
  if not TryStrToInt(sSceneID, result) then raise Exception.Create('Scene name invalid');
241
  if not TryStrToInt(sSceneID, result) then raise Exception.Create('Scene name invalid');
222
end;
242
end;
223
 
243
 
-
 
244
procedure SelectFilenameBase(Edit: TEdit);
-
 
245
begin
-
 
246
  if Edit.CanFocus then
-
 
247
  begin
-
 
248
    Edit.SetFocus;
-
 
249
    Edit.SelStart := 0;
-
 
250
    Edit.SelLength := Pos('.', Edit.Text)-1;
-
 
251
  end;
-
 
252
end;
-
 
253
 
224
function _DecisecondToTime(ds: integer): string;
254
function _DecisecondToTime(ds: integer): string;
225
begin
255
begin
226
  result := FormatDatetime('hh:nn:ss', ds / 10 / (24*60*60))+','+IntToStr(ds mod 10);
256
  result := FormatDatetime('hh:nn:ss', ds / 10 / (24*60*60))+','+IntToStr(ds mod 10);
227
end;
257
end;
228
 
258
 
Line 321... Line 351...
321
end;
351
end;
322
 
352
 
323
procedure TForm1.Button10Click(Sender: TObject);
353
procedure TForm1.Button10Click(Sender: TObject);
324
begin
354
begin
325
  Save;
355
  Save;
326
  if not FileExists('ShowTime32.exe') then raise Exception.Create('ShowTime32.exe not found.');
356
  if not FileExists('ShowTime32.exe') then raise Exception.Create('GAME.BIN saved; ShowTime32.exe not found.');
327
  ShellExecute(Application.Handle, 'open', 'ShowTime32.exe', '', '', SW_NORMAL);
357
  ShellExecute(Application.Handle, 'open', 'ShowTime32.exe', '', '', SW_NORMAL);
328
end;
358
end;
329
 
359
 
330
procedure TForm1.Button11Click(Sender: TObject);
360
procedure TForm1.Button11Click(Sender: TObject);
331
var
361
var
Line 371... Line 401...
371
end;
401
end;
372
 
402
 
373
procedure TForm1.Button14Click(Sender: TObject);
403
procedure TForm1.Button14Click(Sender: TObject);
374
begin
404
begin
375
  New;
405
  New;
376
  HandlePossibleEmptySceneList;
-
 
377
end;
406
end;
378
 
407
 
379
procedure TForm1.DisableEnableSceneControls(enable: boolean);
408
procedure TForm1.DisableEnableSceneControls(enable: boolean);
380
begin
409
begin
381
  ListBox1.Enabled := enable;
410
  ListBox1.Enabled := enable;
Line 577... Line 606...
577
  fileName := IncludeTrailingPathDelimiter(CurScene^.szSceneFolder) + CurScene^.szDialogWav;
606
  fileName := IncludeTrailingPathDelimiter(CurScene^.szSceneFolder) + CurScene^.szDialogWav;
578
  if not FileExists(fileName) then exit;
607
  if not FileExists(fileName) then exit;
579
  ShellExecute(Application.Handle, 'open', PChar(fileName), '', '', SW_NORMAL);
608
  ShellExecute(Application.Handle, 'open', PChar(fileName), '', '', SW_NORMAL);
580
end;
609
end;
581
 
610
 
-
 
611
procedure TForm1.Button19Click(Sender: TObject);
-
 
612
begin
-
 
613
  CopyMemory(@Game, @GameBak, SizeOf(Game));
-
 
614
  SetupGUIAfterLoad;
-
 
615
end;
-
 
616
 
582
procedure TForm1.NewScene;
617
procedure TForm1.NewScene;
583
var
618
var
584
  sceneID: integer;
619
  sceneID: integer;
585
  newScene: PSceneDef;
620
  newScene: PSceneDef;
586
begin
621
begin
Line 592... Line 627...
592
  sceneID := GetGreatestSceneID+1;
627
  sceneID := GetGreatestSceneID+1;
593
  if sceneID >= Length(Game.scenes) then sceneID := SearchSceneIDGapFromTop;
628
  if sceneID >= Length(Game.scenes) then sceneID := SearchSceneIDGapFromTop;
594
 
629
 
595
  newScene := Game.AddSceneAtEnd(sceneID);
630
  newScene := Game.AddSceneAtEnd(sceneID);
596
  newScene.actions[0].nextSceneID := SCENEID_ENDGAME;
631
  newScene.actions[0].nextSceneID := SCENEID_ENDGAME;
-
 
632
  newScene.pictureIndex := Game.numPics;
597
  ListBox1.Items.Add(newScene.szSceneFolder);
633
  ListBox1.Items.Add(newScene.szSceneFolder);
598
  ReloadActionSceneLists;
634
  ReloadActionSceneLists;
599
  HandlePossibleEmptySceneList;
635
  HandlePossibleEmptySceneList;
600
  ListBox1.ItemIndex := ListBox1.Items.Count - 1;
636
  ListBox1.ItemIndex := ListBox1.Items.Count - 1;
601
  ListBox1Click(ListBox1);
637
  ListBox1Click(ListBox1);
Line 650... Line 686...
650
  begin
686
  begin
651
    Exit;
687
    Exit;
652
  end;
688
  end;
653
 
689
 
654
  Game.DeleteScene(ListBox1.ItemIndex);
690
  Game.DeleteScene(ListBox1.ItemIndex);
655
  Dec(Game.numScenes);
-
 
656
 
691
 
657
  bakItemindex := ListBox1.ItemIndex;
692
  bakItemindex := ListBox1.ItemIndex;
658
  ListBox1.Items.Delete(bakItemindex);
693
  ListBox1.Items.Delete(bakItemindex);
659
  ReloadActionSceneLists;
694
  ReloadActionSceneLists;
660
  HandlePossibleEmptySceneList;
695
  HandlePossibleEmptySceneList;
Line 689... Line 724...
689
 
724
 
690
procedure TForm1.Button6Click(Sender: TObject);
725
procedure TForm1.Button6Click(Sender: TObject);
691
var
726
var
692
  pic: PPictureDef;
727
  pic: PPictureDef;
693
begin
728
begin
-
 
729
  if ListBox2.Items.Count > 0 then
-
 
730
    pic := Game.AddPictureBetween(CurScene^.pictureIndex + Max(ListBox2.ItemIndex+1,0), false)
-
 
731
  else
694
  pic := Game.AddPictureBetween(CurScene^.pictureIndex + Max(ListBox2.ItemIndex,0));
732
    pic := Game.AddPictureBetween(CurScene^.pictureIndex + Max(ListBox2.ItemIndex,0), true);
695
  pic.duration := 0;
733
  pic.duration     := DEFAULT_DURATION;
696
  pic.szBitmapFile := 'DUMMY.BMP';
734
  pic.szBitmapFile := DEFAULT_FILENAME;
697
  ListBox2.Items.Insert(ListBox2.ItemIndex, '(0) DUMMY.BMP');
-
 
698
  if ListBox2.ItemIndex = -1 then
735
  if ListBox2.ItemIndex = -1 then
699
  begin
736
  begin
-
 
737
    ListBox2.Items.Insert(ListBox2.Count, Format('(%d) %s', [DEFAULT_DURATION, DEFAULT_FILENAME]));
700
    ListBox2.ItemIndex := ListBox2.Count - 1;
738
    ListBox2.ItemIndex := ListBox2.Count - 1;
701
  end
739
  end
702
  else
740
  else
703
  begin
741
  begin
-
 
742
    ListBox2.Items.Insert(ListBox2.ItemIndex+1, Format('(%d) %s', [DEFAULT_DURATION, DEFAULT_FILENAME]));
704
    ListBox2.ItemIndex := ListBox2.ItemIndex - 1;
743
    ListBox2.ItemIndex := ListBox2.ItemIndex + 1;
705
  end;
744
  end;
706
  ListBox2Click(Listbox2);
745
  ListBox2Click(Listbox2);
-
 
746
  SelectFilenameBase(Edit3);
-
 
747
  RecalcStats;
707
end;
748
end;
708
 
749
 
709
procedure TForm1.Button7Click(Sender: TObject);
750
procedure TForm1.Button7Click(Sender: TObject);
710
var
751
var
711
  bakIdx: integer;
752
  bakIdx: integer;
712
begin
753
begin
713
  if Listbox2.Count > 0 then
754
  if Listbox2.Count > 0 then
714
  begin
755
  begin
715
    bakIdx := ListBox2.ItemIndex;
756
    bakIdx := ListBox2.ItemIndex;
716
    Game.DeletePicture(bakIdx);
757
    Game.DeletePicture(CurScene^.pictureIndex + bakIdx);
717
    ListBox2.Items.Delete(bakIdx);
758
    ListBox2.Items.Delete(bakIdx);
718
    if ListBox2.Count > 0 then
759
    if ListBox2.Count > 0 then
719
    begin
760
    begin
720
      if bakIdx = ListBox2.Count then Dec(bakIdx);
761
      if bakIdx = ListBox2.Count then Dec(bakIdx);
721
      ListBox2.ItemIndex := bakIdx;
762
      ListBox2.ItemIndex := bakIdx;
722
      ListBox2Click(Listbox2);
763
      ListBox2Click(Listbox2);
723
    end;
764
    end;
724
    RecalcUnusedFiles;
765
    RecalcUnusedFiles;
725
  end;
766
  end;
-
 
767
  RecalcStats;
726
end;
768
end;
727
 
769
 
728
procedure TForm1.Button8Click(Sender: TObject);
770
procedure TForm1.Button8Click(Sender: TObject);
729
begin
771
begin
730
  if ListBox2.ItemIndex <= 0 then exit;
772
  if ListBox2.ItemIndex <= 0 then exit;
Line 741... Line 783...
741
 
783
 
742
procedure TForm1.Save;
784
procedure TForm1.Save;
743
var
785
var
744
  fs: TFileStream;
786
  fs: TFileStream;
745
begin
787
begin
-
 
788
  CopyMemory(@GameBak, @Game, SizeOf(Game));
-
 
789
 
746
  fs := TFileStream.Create('GAME.BIN', fmOpenWrite or fmCreate);
790
  fs := TFileStream.Create('GAME.BIN', fmOpenWrite or fmCreate);
747
  try
791
  try
748
    fs.WriteBuffer(Game, SizeOf(Game));
792
    fs.WriteBuffer(Game, SizeOf(Game));
749
  finally
793
  finally
750
    FreeAndNil(fs);
794
    FreeAndNil(fs);
Line 809... Line 853...
809
  ShowSceneBmp;
853
  ShowSceneBmp;
810
  Label26.Visible := not FileExists(IncludeTrailingPathDelimiter(CurScene^.szSceneFolder) + Edit3.Text);
854
  Label26.Visible := not FileExists(IncludeTrailingPathDelimiter(CurScene^.szSceneFolder) + Edit3.Text);
811
  Button12.Visible := CurPicture^.szBitmapFile <> '';
855
  Button12.Visible := CurPicture^.szBitmapFile <> '';
812
end;
856
end;
813
 
857
 
-
 
858
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
-
 
859
begin
-
 
860
  if not CompareMem(@Game, @GameBak, SizeOf(Game)) then
-
 
861
  begin
-
 
862
    case MessageDlg('Do you want to save the changes?', mtConfirmation, mbYesNoCancel, 0) of
-
 
863
      ID_YES:
-
 
864
      begin
-
 
865
        Save;
-
 
866
        CanClose := true;
-
 
867
      end;
-
 
868
      ID_NO:
-
 
869
      begin
-
 
870
        CanClose := true;
-
 
871
      end;
-
 
872
      ID_CANCEL:
-
 
873
      begin
-
 
874
        CanClose := false;
-
 
875
      end;
-
 
876
    end;
-
 
877
  end;
-
 
878
end;
-
 
879
 
814
procedure TForm1.FormCreate(Sender: TObject);
880
procedure TForm1.FormCreate(Sender: TObject);
815
begin
881
begin
816
  PageControl1.ActivePageIndex := 0;
882
  PageControl1.ActivePageIndex := 0;
817
  PageControl2.ActivePageIndex := 0;
883
  PageControl2.ActivePageIndex := 0;
-
 
884
  PageControl3.ActivePageIndex := 0;
818
  Label10.Caption := '';
885
  Label10.Caption := '';
819
  Label21.Caption := '';
886
  Label21.Caption := '';
820
  Label23.Caption := '';
887
  Label23.Caption := '';
821
end;
888
end;
822
 
889
 
Line 895... Line 962...
895
  image.Left := Round(panel.Width  / 2 - image.Width  / 2);
962
  image.Left := Round(panel.Width  / 2 - image.Width  / 2);
896
  image.Top  := Round(panel.Height / 2 - image.Height / 2);
963
  image.Top  := Round(panel.Height / 2 - image.Height / 2);
897
end;
964
end;
898
 
965
 
899
procedure TForm1.ListBox2Click(Sender: TObject);
966
procedure TForm1.ListBox2Click(Sender: TObject);
-
 
967
var
-
 
968
  bakEvent: TNotifyEvent;
-
 
969
begin
-
 
970
  if CurScene^.numPics = 0 then
900
begin
971
  begin
-
 
972
    SpinEdit13.Value := 0;
-
 
973
 
-
 
974
    bakEvent := Edit3.OnChange;
-
 
975
    try
-
 
976
      Edit3.OnChange := nil;
-
 
977
      Edit3.Text := '';
-
 
978
    finally
-
 
979
      Edit3.OnChange := bakEvent;
-
 
980
    end;
-
 
981
 
-
 
982
    Label18.Caption := '';
-
 
983
    Image2.Picture := nil;
-
 
984
    exit;
-
 
985
  end;
-
 
986
 
901
  SpinEdit13.Value := CurPicture^.duration;
987
  SpinEdit13.Value := CurPicture^.duration;
902
  Edit3.Text := string(CurPicture^.szBitmapFile);
988
  Edit3.Text := string(CurPicture^.szBitmapFile);
903
 
989
 
904
  ShowSceneBmp;
990
  ShowSceneBmp;
905
 
991
 
Line 907... Line 993...
907
 
993
 
908
  if PlayStart <> 0 then
994
  if PlayStart <> 0 then
909
  begin
995
  begin
910
    Button15Click(Button15);
996
    Button15Click(Button15);
911
  end;
997
  end;
-
 
998
 
-
 
999
  RecalcStats;
912
end;
1000
end;
913
 
1001
 
914
procedure TForm1.ListBox2DblClick(Sender: TObject);
1002
procedure TForm1.ListBox2DblClick(Sender: TObject);
915
begin
1003
begin
916
  Button15Click(Button15);
1004
  Button15Click(Button15);
Line 980... Line 1068...
980
end;
1068
end;
981
 
1069
 
982
procedure TForm1.New;
1070
procedure TForm1.New;
983
begin
1071
begin
984
  ZeroMemory(@Game, SizeOf(Game));
1072
  ZeroMemory(@Game, SizeOf(Game));
-
 
1073
  ZeroMemory(@GameBak, SizeOf(Game));
985
 
1074
 
986
  SetupGUIAfterLoad;
1075
  SetupGUIAfterLoad;
987
end;
1076
end;
988
 
1077
 
989
procedure TForm1.Load;
1078
procedure TForm1.Load;
Line 995... Line 1084...
995
    fs.ReadBuffer(Game, SizeOf(Game));
1084
    fs.ReadBuffer(Game, SizeOf(Game));
996
  finally
1085
  finally
997
    FreeAndNil(fs);
1086
    FreeAndNil(fs);
998
  end;
1087
  end;
999
 
1088
 
-
 
1089
  if Game.RealPictureCount <> Game.numPics then
-
 
1090
  begin
-
 
1091
    MessageDlg('Picture count was wrong. Value was corrected.', mtInformation, [mbOk], 0);
-
 
1092
    Game.numPics := Game.RealPictureCount;
-
 
1093
  end;
-
 
1094
 
-
 
1095
  CopyMemory(@GameBak, @Game, SizeOf(Game));
-
 
1096
 
1000
  SetupGUIAfterLoad;
1097
  SetupGUIAfterLoad;
1001
end;
1098
end;
1002
 
1099
 
1003
function TForm1.FindSceneIndex(sceneID: integer): integer;
1100
function TForm1.FindSceneIndex(sceneID: integer): integer;
1004
var
1101
var
Line 1116... Line 1213...
1116
  end;
1213
  end;
1117
 
1214
 
1118
  procedure _PreparePictureList;
1215
  procedure _PreparePictureList;
1119
  var
1216
  var
1120
    i: integer;
1217
    i: integer;
1121
    pic: PPictureDef;
1218
    //pic: PPictureDef;
1122
  begin
1219
  begin
1123
    ListBox2.Clear;
1220
    ListBox2.Clear;
1124
 
1221
 
1125
    if CurScene^.numPics = 0 then
1222
    if CurScene^.numPics = 0 then
1126
    begin
1223
    begin
-
 
1224
      (*
1127
      pic := Game.AddPictureBetween(CurScene^.pictureIndex + Max(ListBox2.ItemIndex,0));
1225
      pic := Game.AddPictureBetween(CurScene^.pictureIndex + Max(ListBox2.ItemIndex,0));
1128
      pic.duration := 0;
1226
      pic.duration := DEFAULT_DURATION;
1129
      pic.szBitmapFile := 'DUMMY.BMP';
1227
      pic.szBitmapFile := DEFAULT_FILENAME;
-
 
1228
      *)
1130
    end;
1229
    end;
1131
 
1230
 
1132
    for i := CurScene^.pictureIndex to CurScene^.pictureIndex + CurScene^.numPics - 1 do
1231
    for i := CurScene^.pictureIndex to CurScene^.pictureIndex + CurScene^.numPics - 1 do
1133
    begin
1232
    begin
1134
      Listbox2.Items.Add(Format('(%d) %s', [Game.pictures[i].duration, Game.pictures[i].szBitmapFile]));
1233
      Listbox2.Items.Add(Format('(%d) %s', [Game.pictures[i].duration, Game.pictures[i].szBitmapFile]));
Line 1172... Line 1271...
1172
 
1271
 
1173
  RecalcSlideshowLength;
1272
  RecalcSlideshowLength;
1174
  RecalcSoundtrackLength;
1273
  RecalcSoundtrackLength;
1175
 
1274
 
1176
  RecalcUnusedFiles;
1275
  RecalcUnusedFiles;
-
 
1276
 
-
 
1277
  RecalcStats;
-
 
1278
end;
-
 
1279
 
-
 
1280
procedure TForm1.RecalcStats;
-
 
1281
begin
-
 
1282
  Label35.Caption := IntToStr(ListBox1.ItemIndex) + ' / ' + IntToStr(Game.numScenes);
-
 
1283
 
-
 
1284
  if ListBox2.ItemIndex >= 0 then
-
 
1285
    Label31.Caption := IntToStr(CurScene^.pictureIndex) + ' + ' + IntToStr(ListBox2.ItemIndex) + ' = ' + IntToStr(CurScene^.pictureIndex+ListBox2.ItemIndex)
-
 
1286
  else
-
 
1287
    Label31.Caption := IntToStr(CurScene^.pictureIndex);
-
 
1288
 
-
 
1289
  Label33.Caption := IntToStr(CurScene^.numPics) + ' / ' + IntToStr(Game.numPics);
-
 
1290
 
-
 
1291
  Label37.Caption := IntToStr(CurScene^.numActions) + ' / ' + IntToStr(Game.RealActionCount);
1177
end;
1292
end;
1178
 
1293
 
1179
procedure TForm1.ReloadActionSceneLists;
1294
procedure TForm1.ReloadActionSceneLists;
1180
 
1295
 
1181
  procedure _ReloadActionSceneLists(ComboBox: TComboBox);
1296
  procedure _ReloadActionSceneLists(ComboBox: TComboBox);
Line 1218... Line 1333...
1218
  // TabSheet1.TabVisible := SpinEdit12.Value >= 1;
1333
  // TabSheet1.TabVisible := SpinEdit12.Value >= 1;
1219
 
1334
 
1220
  CurScene^.numActions := SpinEdit12.Value;
1335
  CurScene^.numActions := SpinEdit12.Value;
1221
 
1336
 
1222
  // QUE: zero data of actions which are inactive (numActions<action)?
1337
  // QUE: zero data of actions which are inactive (numActions<action)?
-
 
1338
 
-
 
1339
  RecalcStats;
1223
end;
1340
end;
1224
 
1341
 
1225
procedure TForm1.SpinEdit13Change(Sender: TObject);
1342
procedure TForm1.SpinEdit13Change(Sender: TObject);
1226
begin
1343
begin
1227
  if SpinEdit13.Text = '' then exit;
1344
  if SpinEdit13.Text = '' then exit;
Line 1265... Line 1382...
1265
  Label18.Caption := FormatDatetime('hh:nn:ss', ms / 1000 / (24*60*60)) + ',' + IntToStr(ms mod 1000 div 100);
1382
  Label18.Caption := FormatDatetime('hh:nn:ss', ms / 1000 / (24*60*60)) + ',' + IntToStr(ms mod 1000 div 100);
1266
end;
1383
end;
1267
 
1384
 
1268
procedure TForm1.About1Click(Sender: TObject);
1385
procedure TForm1.About1Click(Sender: TObject);
1269
begin
1386
begin
1270
  ShowMessage('Plumbers Dont''t Wear Ties - GAME.BIN editor (can be also used to create new games based on the "ShowTime" engine!)'+#13#10#13#10+'Written by Daniel Marschall (www.daniel-marschall.de)'+#13#10#13#10+'Published by ViaThinkSoft (www.viathinksoft.com)'+#13#10#13#10+'Current version: ' + CUR_VER);
1387
  ShowMessage('Plumbers Don''t Wear Ties - GAME.BIN editor (can be also used to create new games based on the "ShowTime" engine!)'+#13#10#13#10+'Written by Daniel Marschall (www.daniel-marschall.de)'+#13#10#13#10+'Published by ViaThinkSoft (www.viathinksoft.com)'+#13#10#13#10+'Current version: ' + CUR_VER);
1271
end;
1388
end;
1272
 
1389
 
1273
procedure TForm1.ActionSpinEditsChange(Sender: TObject);
1390
procedure TForm1.ActionSpinEditsChange(Sender: TObject);
1274
begin
1391
begin
1275
  if TSpinEdit(Sender).Text = '' then exit; // user is about to enter a negative value
1392
  if TSpinEdit(Sender).Text = '' then exit; // user is about to enter a negative value