Subversion Repositories plumbers

Rev

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

Rev 21 Rev 23
Line 42... Line 42...
42
    procedure PrevDecisionScene;
42
    procedure PrevDecisionScene;
43
  protected
43
  protected
44
    GameData: TGameBinFile;
44
    GameData: TGameBinFile;
45
    function Wait(AMilliseconds: integer): boolean;
45
    function Wait(AMilliseconds: integer): boolean;
46
    procedure PlayScene(scene: PSceneDef; goToDecision: boolean);
46
    procedure PlayScene(scene: PSceneDef; goToDecision: boolean);
-
 
47
    function WavePrefix: string;
47
  public
48
  public
48
    procedure PerformAction(action: PActionDef);
49
    procedure PerformAction(action: PActionDef);
49
    property PictureShowCallback: TShowPictureCallback read FPictureShowCallback write FPictureShowCallback;
50
    property PictureShowCallback: TShowPictureCallback read FPictureShowCallback write FPictureShowCallback;
50
    property AsyncSoundCallback: TPlaySoundCallback read FAsyncSoundCallback write FAsyncSoundCallback;
51
    property AsyncSoundCallback: TPlaySoundCallback read FAsyncSoundCallback write FAsyncSoundCallback;
51
    property ExitCallback: TSimpleCallback read FExitCallback write FExitCallback;
52
    property ExitCallback: TSimpleCallback read FExitCallback write FExitCallback;
Line 58... Line 59...
58
    procedure Run;
59
    procedure Run;
59
  end;
60
  end;
60
 
61
 
61
implementation
62
implementation
62
 
63
 
-
 
64
uses
-
 
65
  MMSystem, Windows;
-
 
66
 
-
 
67
function Supports16BitWaveout: boolean;
-
 
68
var
-
 
69
  caps: TWaveOutCaps;
-
 
70
begin
-
 
71
  ZeroMemory(@caps, sizeof(caps));
-
 
72
  waveOutGetDevCaps(0, @caps, sizeof(caps));
-
 
73
  result := caps.dwFormats and $CCCCCCCC <> 0; // Note: Original SHOWTIME.EXE only checked $0CCC
-
 
74
end;
-
 
75
 
63
{ TGame }
76
{ TGame }
64
 
77
 
65
constructor TGame.Create(ADirectory: string);
78
constructor TGame.Create(ADirectory: string);
66
var
79
var
67
  fs: TFileStream;
80
  fs: TFileStream;
Line 125... Line 138...
125
    Sleep(AMilliseconds);
138
    Sleep(AMilliseconds);
126
    result := false; // don't cancel
139
    result := false; // don't cancel
127
  end;
140
  end;
128
end;
141
end;
129
 
142
 
-
 
143
function TGame.WavePrefix: string;
-
 
144
begin
-
 
145
  if Supports16BitWaveout then
-
 
146
    result := ''
-
 
147
  else
-
 
148
    result := 'E';
-
 
149
end;
-
 
150
 
130
procedure TGame.PlayScene(scene: PSceneDef; goToDecision: boolean);
151
procedure TGame.PlayScene(scene: PSceneDef; goToDecision: boolean);
131
var
152
var
132
  i: integer;
153
  i: integer;
133
  hotspot: THotspot;
154
  hotspot: THotspot;
134
begin
155
begin
Line 139... Line 160...
139
  if not goToDecision then
160
  if not goToDecision then
140
  begin
161
  begin
141
    if Assigned(AsyncSoundCallback) then
162
    if Assigned(AsyncSoundCallback) then
142
    begin
163
    begin
143
      AsyncSoundCallback(Self, IncludeTrailingPathDelimiter(FDirectory) +
164
      AsyncSoundCallback(Self, IncludeTrailingPathDelimiter(FDirectory) +
144
        scene^.szSceneFolder + PathDelim + scene^.szDialogWav);
165
        scene^.szSceneFolder + PathDelim + WavePrefix + scene^.szDialogWav);
145
    end;
166
    end;
146
    for i := scene^.pictureIndex to scene^.pictureIndex + scene^.numPics - 1 do
167
    for i := scene^.pictureIndex to scene^.pictureIndex + scene^.numPics - 1 do
147
    begin
168
    begin
148
      if Assigned(PictureShowCallback) then
169
      if Assigned(PictureShowCallback) then
149
      begin
170
      begin