Rev 16 | Rev 19 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16 | Rev 17 | ||
---|---|---|---|
Line 221... | Line 221... | ||
221 | end; |
221 | end; |
222 | end; |
222 | end; |
223 | 223 | ||
224 | procedure TMainForm.FormDestroy(Sender: TObject); |
224 | procedure TMainForm.FormDestroy(Sender: TObject); |
225 | begin |
225 | begin |
- | 226 | FreeAndNil(Game); |
|
- | 227 | ||
226 | // Without this, some audio drivers could crash if you press ESC to end the game. |
228 | // Without this, some audio drivers could crash if you press ESC to end the game. |
227 | // (VPC 2007 with Win95; cpsman.dll crashes sometimes) |
229 | // (VPC 2007 with Win95; cpsman.dll crashes sometimes) |
228 | PlaySound(nil, hinstance, 0); |
230 | PlaySound(nil, hinstance, 0); |
229 | end; |
231 | end; |
230 | 232 | ||
Line 312... | Line 314... | ||
312 | Screen.Cursor := 0; |
314 | Screen.Cursor := 0; |
313 | end; |
315 | end; |
314 | 316 | ||
315 | try |
317 | try |
316 | Game := TGame.Create('.'); |
318 | Game := TGame.Create('.'); |
317 | try |
- | |
318 | Game.PictureShowCallback := cbPictureShow; |
319 | Game.PictureShowCallback := cbPictureShow; |
319 | Game.AsyncSoundCallback := cbAsyncSound; |
320 | Game.AsyncSoundCallback := cbAsyncSound; |
320 | Game.ExitCallback := cbExit; |
321 | Game.ExitCallback := cbExit; |
321 | Game.WaitCallback := cbWait; |
322 | Game.WaitCallback := cbWait; |
322 | Game.SetHotspotCallback := cbSetHotspot; |
323 | Game.SetHotspotCallback := cbSetHotspot; |
323 | Game.ClearHotspotsCallback := cbClearHotspots; |
324 | Game.ClearHotspotsCallback := cbClearHotspots; |
324 | Game.Run; |
325 | Game.Run; |
325 | finally |
- | |
326 | FreeAndNil(Game); |
- | |
327 | end; |
- | |
328 | except |
326 | except |
329 | on E: Exception do |
327 | on E: Exception do |
330 | begin |
328 | begin |
331 | MessageDlg(E.Message, mtError, [mbOK], 0); |
329 | MessageDlg(E.Message, mtError, [mbOK], 0); |
332 | Close; |
330 | Close; |