Rev 10 | Rev 12 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 11 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | 2 | ||
3 | // 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! |
4 | // - change the icon to something else |
4 | // - change the icon to something else |
5 | // - 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 |
6 | // TODO: Give controls better names |
7 | // Idea: When actions are deleted, remove the colorful marking on the picture? |
7 | // TODO: When loading the file, check if dependencies are broken and output a warning |
8 | // Idea: decision bitmap markings: anti moiree? |
8 | // Idea: About the hotspot / action markings: |
- | 9 | // - anti moiree? |
|
- | 10 | // - allow user to draw a rectangle with drag'n'drop instead of left and right mouse button. |
|
- | 11 | // also, automatically determine the left/top and right/bottom border, so the user can draw the rectange in every direction |
|
9 | // Idea: unused liste auch bei decision page anzeigen |
12 | // 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 |
- | |
11 | // Idea: Automatic correct wrong Game.numScenes/numPics values? (especially since we rely on them when adding a scene) |
- | |
12 | // Idea: "defragmentation": shift all pictures to the left if a scene has a higher "numPics" value than actual pictures |
13 | // Idea: Function to re-order stuff? |
13 | 14 | ||
14 | interface |
15 | interface |
15 | 16 | ||
16 | uses |
17 | uses |
17 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
18 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
Line 135... | Line 136... | ||
135 | Label33: TLabel; |
136 | Label33: TLabel; |
136 | Label30: TLabel; |
137 | Label30: TLabel; |
137 | Label31: TLabel; |
138 | Label31: TLabel; |
138 | Label36: TLabel; |
139 | Label36: TLabel; |
139 | Label37: TLabel; |
140 | Label37: TLabel; |
- | 141 | CheckBox1: TCheckBox; |
|
- | 142 | TabSheet8: TTabSheet; |
|
- | 143 | Button20: TButton; |
|
140 | procedure ListBox1Click(Sender: TObject); |
144 | procedure ListBox1Click(Sender: TObject); |
141 | procedure Edit1Change(Sender: TObject); |
145 | procedure Edit1Change(Sender: TObject); |
142 | procedure Edit2Change(Sender: TObject); |
146 | procedure Edit2Change(Sender: TObject); |
143 | procedure SpinEdit1Change(Sender: TObject); |
147 | procedure SpinEdit1Change(Sender: TObject); |
144 | procedure Button3Click(Sender: TObject); |
148 | procedure Button3Click(Sender: TObject); |
Line 183... | Line 187... | ||
183 | procedure ListBox3MouseDown(Sender: TObject; Button: TMouseButton; |
187 | procedure ListBox3MouseDown(Sender: TObject; Button: TMouseButton; |
184 | Shift: TShiftState; X, Y: Integer); |
188 | Shift: TShiftState; X, Y: Integer); |
185 | procedure ListBox3Click(Sender: TObject); |
189 | procedure ListBox3Click(Sender: TObject); |
186 | procedure Button19Click(Sender: TObject); |
190 | procedure Button19Click(Sender: TObject); |
187 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
191 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
- | 192 | procedure Button20Click(Sender: TObject); |
|
- | 193 | procedure CheckBox1Click(Sender: TObject); |
|
188 | private |
194 | private |
189 | Game: TGameBinFile; |
195 | Game: TGameBinFile; |
190 | GameBak: TGameBinFile; |
196 | GameBak: TGameBinFile; |
191 | PlayStart: Cardinal; |
197 | PlayStart: Cardinal; |
192 | MediaplayerOpened: boolean; |
198 | MediaplayerOpened: boolean; |
Line 608... | Line 614... | ||
608 | ShellExecute(Application.Handle, 'open', PChar(fileName), '', '', SW_NORMAL); |
614 | ShellExecute(Application.Handle, 'open', PChar(fileName), '', '', SW_NORMAL); |
609 | end; |
615 | end; |
610 | 616 | ||
611 | procedure TForm1.Button19Click(Sender: TObject); |
617 | procedure TForm1.Button19Click(Sender: TObject); |
612 | begin |
618 | begin |
- | 619 | if MessageDlg('Are you sure you want to discard all changes?', mtConfirmation, mbYesNoCancel, 0) = mrYes then |
|
- | 620 | begin |
|
613 | CopyMemory(@Game, @GameBak, SizeOf(Game)); |
621 | CopyMemory(@Game, @GameBak, SizeOf(Game)); |
614 | SetupGUIAfterLoad; |
622 | SetupGUIAfterLoad; |
615 | end; |
623 | end; |
- | 624 | end; |
|
616 | 625 | ||
617 | procedure TForm1.NewScene; |
626 | procedure TForm1.NewScene; |
618 | var |
627 | var |
619 | sceneID: integer; |
628 | sceneID: integer; |
620 | newScene: PSceneDef; |
629 | newScene: PSceneDef; |
Line 640... | Line 649... | ||
640 | procedure TForm1.Button1Click(Sender: TObject); |
649 | procedure TForm1.Button1Click(Sender: TObject); |
641 | begin |
650 | begin |
642 | NewScene; |
651 | NewScene; |
643 | end; |
652 | end; |
644 | 653 | ||
- | 654 | procedure TForm1.Button20Click(Sender: TObject); |
|
- | 655 | begin |
|
- | 656 | Game.Defrag; |
|
- | 657 | RecalcStats; |
|
- | 658 | end; |
|
- | 659 | ||
645 | procedure TForm1.Button2Click(Sender: TObject); |
660 | procedure TForm1.Button2Click(Sender: TObject); |
646 | var |
661 | var |
647 | iScene, iAction, sceneID: integer; |
662 | iScene, iAction, sceneID: integer; |
648 | conflicts: TStringList; |
663 | conflicts: TStringList; |
649 | sWarning: string; |
664 | sWarning: string; |
Line 858... | Line 873... | ||
858 | procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
873 | procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
859 | begin |
874 | begin |
860 | if not CompareMem(@Game, @GameBak, SizeOf(Game)) then |
875 | if not CompareMem(@Game, @GameBak, SizeOf(Game)) then |
861 | begin |
876 | begin |
862 | case MessageDlg('Do you want to save the changes?', mtConfirmation, mbYesNoCancel, 0) of |
877 | case MessageDlg('Do you want to save the changes?', mtConfirmation, mbYesNoCancel, 0) of |
863 | ID_YES: |
878 | mrYes: |
864 | begin |
879 | begin |
865 | Save; |
880 | Save; |
866 | CanClose := true; |
881 | CanClose := true; |
867 | end; |
882 | end; |
868 | ID_NO: |
883 | mrNo: |
869 | begin |
884 | begin |
870 | CanClose := true; |
885 | CanClose := true; |
871 | end; |
886 | end; |
872 | ID_CANCEL: |
887 | mrCancel: |
873 | begin |
888 | begin |
874 | CanClose := false; |
889 | CanClose := false; |
875 | end; |
890 | end; |
876 | end; |
891 | end; |
877 | end; |
892 | end; |
Line 910... | Line 925... | ||
910 | procedure TForm1.ListBox1DblClick(Sender: TObject); |
925 | procedure TForm1.ListBox1DblClick(Sender: TObject); |
911 | begin |
926 | begin |
912 | Button16Click(Button16); |
927 | Button16Click(Button16); |
913 | end; |
928 | end; |
914 | 929 | ||
- | 930 | procedure TForm1.CheckBox1Click(Sender: TObject); |
|
- | 931 | begin |
|
- | 932 | RedrawDecisionBitmap; |
|
- | 933 | end; |
|
- | 934 | ||
915 | procedure TForm1.Close1Click(Sender: TObject); |
935 | procedure TForm1.Close1Click(Sender: TObject); |
916 | begin |
936 | begin |
917 | Close; |
937 | Close; |
918 | end; |
938 | end; |
919 | 939 | ||
Line 1067... | Line 1087... | ||
1067 | end; |
1087 | end; |
1068 | end; |
1088 | end; |
1069 | 1089 | ||
1070 | procedure TForm1.New; |
1090 | procedure TForm1.New; |
1071 | begin |
1091 | begin |
- | 1092 | PageControl1.ActivePageIndex := 0; |
|
- | 1093 | PageControl2.ActivePageIndex := 0; |
|
- | 1094 | PageControl3.ActivePageIndex := 0; |
|
- | 1095 | Label10.Caption := ''; |
|
- | 1096 | Label21.Caption := ''; |
|
- | 1097 | Label23.Caption := ''; |
|
- | 1098 | ||
1072 | ZeroMemory(@Game, SizeOf(Game)); |
1099 | ZeroMemory(@Game, SizeOf(Game)); |
1073 | ZeroMemory(@GameBak, SizeOf(Game)); |
1100 | ZeroMemory(@GameBak, SizeOf(Game)); |
1074 | 1101 | ||
1075 | SetupGUIAfterLoad; |
1102 | SetupGUIAfterLoad; |
1076 | end; |
1103 | end; |
Line 1084... | Line 1111... | ||
1084 | fs.ReadBuffer(Game, SizeOf(Game)); |
1111 | fs.ReadBuffer(Game, SizeOf(Game)); |
1085 | finally |
1112 | finally |
1086 | FreeAndNil(fs); |
1113 | FreeAndNil(fs); |
1087 | end; |
1114 | end; |
1088 | 1115 | ||
- | 1116 | CopyMemory(@GameBak, @Game, SizeOf(Game)); |
|
- | 1117 | ||
1089 | if Game.RealPictureCount <> Game.numPics then |
1118 | if Game.RealPictureCount <> Game.numPics then |
1090 | begin |
1119 | begin |
1091 | MessageDlg('Picture count was wrong. Value was corrected.', mtInformation, [mbOk], 0); |
1120 | MessageDlg('Picture count was wrong. Value was corrected.', mtInformation, [mbOk], 0); |
1092 | Game.numPics := Game.RealPictureCount; |
1121 | Game.numPics := Game.RealPictureCount; |
1093 | end; |
1122 | end; |
1094 | 1123 | ||
1095 | CopyMemory(@GameBak, @Game, SizeOf(Game)); |
- | |
1096 | - | ||
1097 | SetupGUIAfterLoad; |
1124 | SetupGUIAfterLoad; |
1098 | end; |
1125 | end; |
1099 | 1126 | ||
1100 | function TForm1.FindSceneIndex(sceneID: integer): integer; |
1127 | function TForm1.FindSceneIndex(sceneID: integer): integer; |
1101 | var |
1128 | var |
Line 1335... | Line 1362... | ||
1335 | CurScene^.numActions := SpinEdit12.Value; |
1362 | CurScene^.numActions := SpinEdit12.Value; |
1336 | 1363 | ||
1337 | // QUE: zero data of actions which are inactive (numActions<action)? |
1364 | // QUE: zero data of actions which are inactive (numActions<action)? |
1338 | 1365 | ||
1339 | RecalcStats; |
1366 | RecalcStats; |
- | 1367 | RedrawDecisionBitmap; |
|
1340 | end; |
1368 | end; |
1341 | 1369 | ||
1342 | procedure TForm1.SpinEdit13Change(Sender: TObject); |
1370 | procedure TForm1.SpinEdit13Change(Sender: TObject); |
1343 | begin |
1371 | begin |
1344 | if SpinEdit13.Text = '' then exit; |
1372 | if SpinEdit13.Text = '' then exit; |
Line 1426... | Line 1454... | ||
1426 | 1454 | ||
1427 | Image1.Picture.Bitmap.PixelFormat := pf24bit; // Extend the palette, so we have red, green and blue guaranteed. |
1455 | Image1.Picture.Bitmap.PixelFormat := pf24bit; // Extend the palette, so we have red, green and blue guaranteed. |
1428 | 1456 | ||
1429 | Image1.Canvas.Brush.Style := bsDiagCross; |
1457 | Image1.Canvas.Brush.Style := bsDiagCross; |
1430 | 1458 | ||
- | 1459 | if (CheckBox1.Checked or (CurScene^.numActions >= 1)) and |
|
1431 | if (SpinEdit3.Value < SpinEdit4.Value) and (SpinEdit2.Value < SpinEdit5.Value) then |
1460 | (SpinEdit3.Value < SpinEdit4.Value) and (SpinEdit2.Value < SpinEdit5.Value) then |
1432 | begin |
1461 | begin |
1433 | Image1.Canvas.Pen.Color := clRed; |
1462 | Image1.Canvas.Pen.Color := clRed; |
1434 | Image1.Canvas.Brush.Color := clRed; |
1463 | Image1.Canvas.Brush.Color := clRed; |
1435 | Image1.Canvas.Rectangle(SpinEdit3.Value, SpinEdit2.Value, SpinEdit4.Value, SpinEdit5.Value); |
1464 | Image1.Canvas.Rectangle(SpinEdit3.Value, SpinEdit2.Value, SpinEdit4.Value, SpinEdit5.Value); |
1436 | end; |
1465 | end; |
1437 | 1466 | ||
- | 1467 | if (CheckBox1.Checked or (CurScene^.numActions >= 2)) and |
|
1438 | if (SpinEdit17.Value < SpinEdit19.Value) and (SpinEdit18.Value < SpinEdit20.Value) then |
1468 | (SpinEdit17.Value < SpinEdit19.Value) and (SpinEdit18.Value < SpinEdit20.Value) then |
1439 | begin |
1469 | begin |
1440 | Image1.Canvas.Pen.Color := clLime; |
1470 | Image1.Canvas.Pen.Color := clLime; |
1441 | Image1.Canvas.Brush.Color := clLime; |
1471 | Image1.Canvas.Brush.Color := clLime; |
1442 | Image1.Canvas.Rectangle(SpinEdit17.Value, SpinEdit18.Value, SpinEdit19.Value, SpinEdit20.Value); |
1472 | Image1.Canvas.Rectangle(SpinEdit17.Value, SpinEdit18.Value, SpinEdit19.Value, SpinEdit20.Value); |
1443 | end; |
1473 | end; |
1444 | 1474 | ||
- | 1475 | if (CheckBox1.Checked or (CurScene^.numActions >= 3)) and |
|
1445 | if (SpinEdit7.Value < SpinEdit10.Value) and (SpinEdit8.Value < SpinEdit9.Value) then |
1476 | (SpinEdit7.Value < SpinEdit10.Value) and (SpinEdit8.Value < SpinEdit9.Value) then |
1446 | begin |
1477 | begin |
1447 | Image1.Canvas.Pen.Color := clBlue; |
1478 | Image1.Canvas.Pen.Color := clBlue; |
1448 | Image1.Canvas.Brush.Color := clBlue; |
1479 | Image1.Canvas.Brush.Color := clBlue; |
1449 | Image1.Canvas.Rectangle(SpinEdit7.Value, SpinEdit8.Value, SpinEdit10.Value, SpinEdit9.Value); |
1480 | Image1.Canvas.Rectangle(SpinEdit7.Value, SpinEdit8.Value, SpinEdit10.Value, SpinEdit9.Value); |
1450 | end; |
1481 | end; |