Subversion Repositories plumbers

Rev

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

Rev 2 Rev 8
Line 1... Line 1...
1
unit Main;
1
unit Main;
2
 
2
 
3
// TODO: When the windows is only resized a little bit (A few pixels), the window should not centered
-
 
4
// Idea: Calc the width and height of ALL pictures, and then size the form to the biggest value?
-
 
5
// BUG: if bitmap is not existing, then the error "ReadBitmapFile(): Unable to open bitmap file" appears. Not good.
-
 
6
// BUG: If you drag the window, the dia show will stop playing, but the sound continues! This makes everything out of sync.
3
// BUG: If you drag the window, the dia show will stop playing, but the sound continues! This makes everything out of sync.
-
 
4
// TODO: When the windows is only resized a little bit (A few pixels), the window should not centered
-
 
5
//       ... Calc the width and height of ALL pictures, and then size the form to the biggest value?
-
 
6
//       ... or hard code the resolution in the INI file?
7
// TODO: Ini Parameter if fullscreen is applied or not
7
// Idea: Ini Parameter if fullscreen is applied or not
-
 
8
// Idea: Savestates, speedup, pause, Use Space bar to go to the next decision point.
-
 
9
 
-
 
10
// -----------------------------------------------------------------------------
-
 
11
 
-
 
12
// HOTSPOT_RELATIVE_ORIGIN is a new behavior which is not compatible with the original engine.
-
 
13
// With HOTSPOT_RELATIVE_ORIGIN enabled, the coordinates will be relative to the picture
8
// TODO: Check out if hotspot coords should have their origin at the picture or the form position.
14
// The original game has the origin at the top left corner of the screen.
-
 
15
// This is a problem because the game as well as the scene editor does not know the
9
// Idea: Savestates. Speedup. Pause.
16
// desired resolution, as it is automatically determined.
-
 
17
// If we would hardcode the desired canvas (640x480) in <ExeName>.ini, then
10
// Idea: Use Space bar to go to the next decision point.
18
// it would work, but then, the scene Editor can not know the desired resolution...
-
 
19
{$DEFINE HOTSPOT_RELATIVE_ORIGIN}
11
 
20
 
12
interface
21
interface
13
 
22
 
14
uses
23
uses
15
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
24
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Line 105... Line 114...
105
    end;
114
    end;
106
 
115
 
107
    // Make form bigger if necessary
116
    // Make form bigger if necessary
108
    if Image1.Width > ClientWidth then
117
    if Image1.Width > ClientWidth then
109
    begin
118
    begin
110
      ClientWidth := Image1.Width;
119
      ClientWidth := Min(Image1.Width, Screen.Width);
111
      if (ClientWidth >= Screen.Width) then FullscreenMode := true;
120
      if (ClientWidth >= Screen.Width) then FullscreenMode := true;
112
      Position := poScreenCenter;
121
      Position := poScreenCenter;
113
    end;
122
    end;
114
    if Image1.Height > ClientHeight then
123
    if Image1.Height > ClientHeight then
115
    begin
124
    begin
116
      ClientHeight := Image1.Height;
125
      ClientHeight := Min(Image1.Height, Screen.Height);
117
      if (ClientHeight >= Screen.Height) then FullscreenMode := true;
126
      if (ClientHeight >= Screen.Height) then FullscreenMode := true;
118
      Position := poScreenCenter;
127
      Position := poScreenCenter;
119
    end;
128
    end;
120
 
129
 
121
    // Center image
130
    // Center image
Line 230... Line 239...
230
 
239
 
231
procedure TMainForm.ClickEvent(X, Y: Integer);
240
procedure TMainForm.ClickEvent(X, Y: Integer);
232
var
241
var
233
  i: integer;
242
  i: integer;
234
begin
243
begin
235
  // TODO: if hotspots are overlaying; which hotspot will be prefered? the top ones? check out the original game.
244
  // If hotspots are overlaying, the lowest action will be chosen (same behavior as original game)
236
  for i := Low(FHotspots) to High(FHotspots) do
245
  for i := Low(FHotspots) to High(FHotspots) do
237
  begin
246
  begin
238
    if Assigned(FHotspots[i].lpAction) and
247
    if Assigned(FHotspots[i].lpAction) and
239
       (X >= FHotspots[i].cHotspotTopLeft.X) and
248
       (X >= FHotspots[i].cHotspotTopLeft.X) and
240
       (Y >= FHotspots[i].cHotspotTopLeft.Y) and
249
       (Y >= FHotspots[i].cHotspotTopLeft.Y) and
Line 247... Line 256...
247
  end;
256
  end;
248
end;
257
end;
249
 
258
 
250
procedure TMainForm.ControlClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
259
procedure TMainForm.ControlClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
251
begin
260
begin
-
 
261
  {$IFDEF HOTSPOT_RELATIVE_ORIGIN}
-
 
262
  ClickEvent(X, Y);
-
 
263
  {$ELSE}
252
  ClickEvent(X+TControl(Sender).Left, Y+TControl(Sender).Top);
264
  ClickEvent(X+TControl(Sender).Left, Y+TControl(Sender).Top);
-
 
265
  {$ENDIF}
253
end;
266
end;
254
 
267
 
255
procedure TMainForm.StartupTimerTimer(Sender: TObject);
268
procedure TMainForm.StartupTimerTimer(Sender: TObject);
256
begin
269
begin
257
  StartupTimer.Enabled := false;
270
  StartupTimer.Enabled := false;