diff options
author | Kamil Zbróg | 2014-01-07 00:13:05 +0000 |
---|---|---|
committer | Kamil Zbróg | 2014-01-07 00:13:05 +0000 |
commit | e94fabc37407a7d300af04493b0f5cbced42a092 (patch) | |
tree | 998bfaa03109a49d2bb9ec5b17e817ef7cc32a4c | |
parent | 165b8be77f4621ff5de8a483c6cd9ac497492a0a (diff) | |
parent | 4f6c3efa15c68dfa49bf5e6fe75dec034abe903b (diff) | |
download | scummvm-rg350-e94fabc37407a7d300af04493b0f5cbced42a092.tar.gz scummvm-rg350-e94fabc37407a7d300af04493b0f5cbced42a092.tar.bz2 scummvm-rg350-e94fabc37407a7d300af04493b0f5cbced42a092.zip |
Merge remote-tracking branch 'sync/master' into prince-malik
191 files changed, 9302 insertions, 1146 deletions
@@ -1,5 +1,5 @@ ScummVM -Copyright (C) 2001-2013 by the following: +Copyright (C) 2001-2014 by the following: If you have contributed to this project then you deserve to be on this list. Contact us (see: AUTHORS) and we'll add you. @@ -7,28 +7,28 @@ For a more comprehensive changelog of the latest experimental code, see: General: - Updated MT-32 emulation code to version 1.3.0. - - Switched from our custom JPEG decoder to libjpeg-turbo, which - is faster and can handle all kinds of exotic JPEG images :) - - Switched from our custom PNG decoder to libpng, which - is faster and can handle all kinds of exotic PNG images :) - (NOTE: The change to libpng was done in version 1.6.0, but - it was not added to the NEWS file). + - Switched from our custom JPEG decoder to libjpeg-turbo, which is faster + and can handle all kinds of exotic JPEG images :) + - Switched from our custom PNG decoder to libpng, which is faster and can + handle all kinds of exotic PNG images :) + (NOTE: The change to libpng was done in version 1.6.0, but it was not + added to the NEWS file). Gob: - Improved video quality in Urban Runner. SCI: - - Added support for the more detailed RAVE lip syncing data in the - Windows version of King's Quest 6. Portraits should now be much - more expressive when talking. - - Added support for simultaneous speech and subtitles in the CD - versions of Laura Bow 2 and King's Quest 6 (toggled via the - ScummVM audio options). + - Added support for the more detailed RAVE lip syncing data in the Windows + version of King's Quest 6. Portraits should now be much more expressive + when talking. + - Added support for simultaneous speech and subtitles in the CD versions + of Laura Bow 2 and King's Quest 6 (toggled either in-game with the new + "Dual" audio state, or via the ScummVM audio options). - Fixed music fading. - - Fixed several script bugs in Camelot, Crazy Nick's, Hoyle 3, - QFG1VGA, KQ5, KQ6, LB2, LSL2, LSL5, Pharkas, PQ1VGA, SQ4, SQ5. - - Improved the MIDI parser so that music event processing is done - more properly. + - Fixed several script bugs in Camelot, Crazy Nick's, Hoyle 3, QFG1VGA, KQ5, + KQ6, LB2, LSL2, LSL5, Pharkas, PQ1VGA, SQ4, SQ5. + - Improved the MIDI parser so that music event processing is done more + properly. Broken Sword 1: - Added back support for MPEG-2 videos. @@ -2213,6 +2213,16 @@ keywords: helium_mode bool If true, people sound like they've inhaled Helium +The Neverhood adds the following non-standard keywords: + + originalsaveload bool If true, the original save/load screens are + used instead of the enhanced ScummVM ones + skiphallofrecordsscenes bool + If true, allows the player to skip + past the Hall of Records storyboard scenes + scalemakingofvideos bool If true, the making of videos are scaled, so that + they use the whole screen + The 7th Guest adds the following non-standard keyword: fast_movie_speed bool If true, movies are played at an increased diff --git a/backends/platform/dc/ip.txt.in b/backends/platform/dc/ip.txt.in index 23424e0950..539d29dd1e 100644 --- a/backends/platform/dc/ip.txt.in +++ b/backends/platform/dc/ip.txt.in @@ -7,5 +7,5 @@ Product No : T0000 Version : @VERSION@ Release Date : @DATE@ Boot Filename : SCUMMVM.BIN -SW Maker Name : The ScummVM team +SW Maker Name : The ScummVM Team Game Title : ScummVM diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README index f2bca8c109..8a44e9399d 100644 --- a/backends/platform/symbian/README +++ b/backends/platform/symbian/README @@ -1,7 +1,7 @@ ScummVM - ScummVM ported to EPOC/SymbianOS - Copyright (C) 2008-2013 ScummVM Team + Copyright (C) 2008-2014 ScummVM Team Copyright (C) 2013-2013 Fedor Strizhniou aka zanac Copyright (C) 2003-2013 Lars 'AnotherGuest' Persson Copyright (C) 2002-2008 Jurgen 'SumthinWicked' Braam diff --git a/backends/platform/symbian/S60/ScummVM_S60.mmp.in b/backends/platform/symbian/S60/ScummVM_S60.mmp.in index 28bd11dec6..ca2ec7f930 100644 --- a/backends/platform/symbian/S60/ScummVM_S60.mmp.in +++ b/backends/platform/symbian/S60/ScummVM_S60.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S60/ScummVM_S60_App.mmp b/backends/platform/symbian/S60/ScummVM_S60_App.mmp index 38d6f19590..2fc39c6838 100644 --- a/backends/platform/symbian/S60/ScummVM_S60_App.mmp +++ b/backends/platform/symbian/S60/ScummVM_S60_App.mmp @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in index 99b89efba8..7b9273f2dd 100644 --- a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in index 1e0f282bc4..09ff968706 100644 --- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S80/ScummVM_S80.mmp.in b/backends/platform/symbian/S80/ScummVM_S80.mmp.in index d9b9a5c948..34d1979fe5 100644 --- a/backends/platform/symbian/S80/ScummVM_S80.mmp.in +++ b/backends/platform/symbian/S80/ScummVM_S80.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S80/ScummVM_S80_App.mmp b/backends/platform/symbian/S80/ScummVM_S80_App.mmp index 30b1c3f58b..de96963d80 100644 --- a/backends/platform/symbian/S80/ScummVM_S80_App.mmp +++ b/backends/platform/symbian/S80/ScummVM_S80_App.mmp @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S90/Scummvm_S90.mmp.in b/backends/platform/symbian/S90/Scummvm_S90.mmp.in index 790dca14f0..e65397b145 100644 --- a/backends/platform/symbian/S90/Scummvm_S90.mmp.in +++ b/backends/platform/symbian/S90/Scummvm_S90.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S90/Scummvm_S90_App.mmp b/backends/platform/symbian/S90/Scummvm_S90_App.mmp index cf17f103ef..88a3e4d221 100644 --- a/backends/platform/symbian/S90/Scummvm_S90_App.mmp +++ b/backends/platform/symbian/S90/Scummvm_S90_App.mmp @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ2/ScummVM.rss b/backends/platform/symbian/UIQ2/ScummVM.rss index bfdd07e898..2e02f1da1d 100644 --- a/backends/platform/symbian/UIQ2/ScummVM.rss +++ b/backends/platform/symbian/UIQ2/ScummVM.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in b/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in index 80ba37d694..68f5bd0cab 100644 --- a/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in +++ b/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2006 The ScummVM project + * Copyright (C) 2005-2006 The ScummVM Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/backends/platform/symbian/UIQ3/ScummVM.rss b/backends/platform/symbian/UIQ3/ScummVM.rss index b7f0a17113..11cc767671 100644 --- a/backends/platform/symbian/UIQ3/ScummVM.rss +++ b/backends/platform/symbian/UIQ3/ScummVM.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss b/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss index b7f0a17113..11cc767671 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss +++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in index fac178ad15..c68e780f11 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2009 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2009 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in index 0f1ec7f60f..f554bb3afd 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss b/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss index 47e7c44642..f54bcc24d3 100644 --- a/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss +++ b/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_agi.mmp.in b/backends/platform/symbian/mmp/scummvm_agi.mmp.in index 892ed57732..a3eaa71065 100644 --- a/backends/platform/symbian/mmp/scummvm_agi.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_agi.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_agos.mmp.in b/backends/platform/symbian/mmp/scummvm_agos.mmp.in index d3bc84ed51..92b8862794 100644 --- a/backends/platform/symbian/mmp/scummvm_agos.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_agos.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in index 12f157f1e7..1093181a4e 100644 --- a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in index bf12bffb41..358a2ec961 100644 --- a/backends/platform/symbian/mmp/scummvm_base.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_cge.mmp.in b/backends/platform/symbian/mmp/scummvm_cge.mmp.in index 66a689efd8..2d93671938 100644 --- a/backends/platform/symbian/mmp/scummvm_cge.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cge.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_cine.mmp.in b/backends/platform/symbian/mmp/scummvm_cine.mmp.in index cb7143b837..a308f92813 100644 --- a/backends/platform/symbian/mmp/scummvm_cine.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cine.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_composer.mmp.in b/backends/platform/symbian/mmp/scummvm_composer.mmp.in index 19215f65a6..cfe43b59a2 100644 --- a/backends/platform/symbian/mmp/scummvm_composer.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_composer.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in index c26e93dedc..58aed70f81 100644 --- a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_draci.mmp.in b/backends/platform/symbian/mmp/scummvm_draci.mmp.in index 52f862bc6f..ba1759c00b 100644 --- a/backends/platform/symbian/mmp/scummvm_draci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_draci.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in index 9ea02fefe8..c4419dd71e 100644 --- a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in index b6369b7d2b..a5cc758ff6 100644 --- a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in index 4a8f69f709..59666b7b74 100644 --- a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_gob.mmp.in b/backends/platform/symbian/mmp/scummvm_gob.mmp.in index 906d54b487..c2c36626ff 100644 --- a/backends/platform/symbian/mmp/scummvm_gob.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_gob.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in index e7f70bc110..639a794260 100644 --- a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in b/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in index 4509026b6c..cfe47d09ba 100644 --- a/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_hugo.mmp.in b/backends/platform/symbian/mmp/scummvm_hugo.mmp.in index 13dd7efa1e..fceeb5e5d1 100644 --- a/backends/platform/symbian/mmp/scummvm_hugo.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_hugo.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in index 124f7c0dc3..2f8d22595e 100644 --- a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in b/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in index b8db95ea0c..fe2ebdfa1b 100644 --- a/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_lure.mmp.in b/backends/platform/symbian/mmp/scummvm_lure.mmp.in index 84c3eecd5e..f8b42bf337 100644 --- a/backends/platform/symbian/mmp/scummvm_lure.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_lure.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_m4.mmp.in b/backends/platform/symbian/mmp/scummvm_m4.mmp.in index e69b40ceb0..05395c1816 100644 --- a/backends/platform/symbian/mmp/scummvm_m4.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_m4.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_made.mmp.in b/backends/platform/symbian/mmp/scummvm_made.mmp.in index b52d9cc6cb..b0a0e7d34c 100644 --- a/backends/platform/symbian/mmp/scummvm_made.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_made.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in index 3fe9af68f6..005b5f873e 100644 --- a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in index 3969a3af9c..90af4cb835 100644 --- a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in index 3a49093c43..b65f0f6ab6 100644 --- a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in index f8ee389577..92d916224e 100644 --- a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in b/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in index fefc63e936..66863f2d74 100644 --- a/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_queen.mmp.in b/backends/platform/symbian/mmp/scummvm_queen.mmp.in index f507f482f9..3d8cfc1949 100644 --- a/backends/platform/symbian/mmp/scummvm_queen.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_queen.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_saga.mmp.in b/backends/platform/symbian/mmp/scummvm_saga.mmp.in index cd158556dc..9ca633972b 100644 --- a/backends/platform/symbian/mmp/scummvm_saga.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_saga.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sci.mmp.in b/backends/platform/symbian/mmp/scummvm_sci.mmp.in index 333a6d43c2..109b277667 100644 --- a/backends/platform/symbian/mmp/scummvm_sci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sci.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in index c07725e002..cc008766a8 100644 --- a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sky.mmp.in b/backends/platform/symbian/mmp/scummvm_sky.mmp.in index b5048106dc..0ab35dffd7 100644 --- a/backends/platform/symbian/mmp/scummvm_sky.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sky.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in index 578839e8c4..3b709fe1de 100644 --- a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in index 23a055c99c..ec5ccaefc9 100644 --- a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in index e14501e42d..62907f9245 100644 --- a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in b/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in index 58bfa4c337..73a86b9913 100644 --- a/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in index ce6a18508d..07d1df625d 100644 --- a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in b/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in index 4cdd0bd774..6436aaaa9b 100644 --- a/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in b/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in index 9f9d1c1dda..8685f80f71 100644 --- a/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_tony.mmp.in b/backends/platform/symbian/mmp/scummvm_tony.mmp.in index d80d82a9c5..01d4712cbb 100644 --- a/backends/platform/symbian/mmp/scummvm_tony.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tony.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_toon.mmp.in b/backends/platform/symbian/mmp/scummvm_toon.mmp.in index 00f84d2bec..2cddddd777 100644 --- a/backends/platform/symbian/mmp/scummvm_toon.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_toon.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_touche.mmp.in b/backends/platform/symbian/mmp/scummvm_touche.mmp.in index e59dd0cd00..24ca777c70 100644 --- a/backends/platform/symbian/mmp/scummvm_touche.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_touche.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in index cd4aa158dc..d017be593b 100644 --- a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in index 0ff8eb9920..f30bbfc469 100644 --- a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in b/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in index ebe762fe36..5d26f36df5 100644 --- a/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in index 3687b10fec..a007f45f5b 100644 --- a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/res/ScummVmAif.rss b/backends/platform/symbian/res/ScummVmAif.rss index fab2cadbb8..2dbf436a8f 100644 --- a/backends/platform/symbian/res/ScummVmAif.rss +++ b/backends/platform/symbian/res/ScummVmAif.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/res/scummvm.rss b/backends/platform/symbian/res/scummvm.rss index 7e667f1cf3..6a0ab24ff0 100644 --- a/backends/platform/symbian/res/scummvm.rss +++ b/backends/platform/symbian/res/scummvm.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/res/scummvm_A0000658.rss b/backends/platform/symbian/res/scummvm_A0000658.rss index 3325d72249..562fef54c6 100644 --- a/backends/platform/symbian/res/scummvm_A0000658.rss +++ b/backends/platform/symbian/res/scummvm_A0000658.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/src/ScummVm.hrh b/backends/platform/symbian/src/ScummVm.hrh index c43a9da118..316e4d08f6 100644 --- a/backends/platform/symbian/src/ScummVm.hrh +++ b/backends/platform/symbian/src/ScummVm.hrh @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -3667,6 +3667,25 @@ fi if test "$_readline" = yes ; then LIBS="$LIBS $READLINE_LIBS $_READLINE_LIBS" INCLUDES="$INCLUDES $READLINE_CFLAGS" + + # + # Check the type of rl_completion_entry_function. + # It can be int(*)(const char *, int) or char *(*)(const char *, int). + # + cat > $TMPC << EOF +#include <stdio.h> +#include <readline/readline.h> +#include <readline/history.h> + +int readline_completionFunction(const char *, int); + +int main(void) { + char *x = readline(""); + rl_completion_entry_function = &readline_completionFunction; +} +EOF + cc_check -c && add_line_to_config_h '#define USE_READLINE_INT_COMPLETION' + fi define_in_config_h_if_yes "$_readline" 'USE_READLINE' diff --git a/dists/debian/copyright b/dists/debian/copyright index 1cccd01a07..1317fc6cee 100644 --- a/dists/debian/copyright +++ b/dists/debian/copyright @@ -7,7 +7,7 @@ It was downloaded from <http://www.scummvm.org/>. Upstream Authors: see `/usr/share/doc/scummvm/AUTHORS'. -Scummvm is Copyright © 2002-2013 The ScummVM Project +ScummVM is Copyright © 2002-2014 The ScummVM Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist index b9a4eff1b8..63813c06de 100644 --- a/dists/macosx/Info.plist +++ b/dists/macosx/Info.plist @@ -28,7 +28,7 @@ <key>CFBundleExecutable</key> <string>scummvm</string> <key>CFBundleGetInfoString</key> - <string>1.7.0git, Copyright 2001-2013 The ScummVM team</string> + <string>1.7.0git, Copyright 2001-2014 The ScummVM Team</string> <key>CFBundleIconFile</key> <string>scummvm.icns</string> <key>CFBundleIdentifier</key> @@ -46,7 +46,7 @@ <key>NSPrincipalClass</key> <string>NSApplication</string> <key>NSHumanReadableCopyright</key> - <string>Copyright 2001-2013 The ScummVM team</string> + <string>Copyright 2001-2014 The ScummVM Team</string> <key>SUFeedURL</key> <string>http://www.scummvm.org/appcasts/macosx/release.xml</string> <key>SUPublicDSAKeyFile</key> diff --git a/dists/macosx/Info.plist.in b/dists/macosx/Info.plist.in index b810b7ea5a..9ef1584440 100644 --- a/dists/macosx/Info.plist.in +++ b/dists/macosx/Info.plist.in @@ -28,7 +28,7 @@ <key>CFBundleExecutable</key> <string>scummvm</string> <key>CFBundleGetInfoString</key> - <string>@VERSION@, Copyright 2001-2013 The ScummVM team</string> + <string>@VERSION@, Copyright 2001-2014 The ScummVM Team</string> <key>CFBundleIconFile</key> <string>scummvm.icns</string> <key>CFBundleIdentifier</key> @@ -46,7 +46,7 @@ <key>NSPrincipalClass</key> <string>NSApplication</string> <key>NSHumanReadableCopyright</key> - <string>Copyright 2001-2013 The ScummVM team</string> + <string>Copyright 2001-2014 The ScummVM Team</string> <key>SUFeedURL</key> <string>http://www.scummvm.org/appcasts/macosx/release.xml</string> <key>SUPublicDSAKeyFile</key> diff --git a/dists/scummvm.rc b/dists/scummvm.rc index 037db3ef62..f0609c1a79 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -81,7 +81,7 @@ BEGIN VALUE "FileDescription", "http://www.scummvm.org/\0" VALUE "FileVersion", "1.7.0git\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright 2001-2013 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright 2001-2014 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in index c18c18ef63..401c0abb0d 100644 --- a/dists/scummvm.rc.in +++ b/dists/scummvm.rc.in @@ -81,7 +81,7 @@ BEGIN VALUE "FileDescription", "http://www.scummvm.org/\0" VALUE "FileVersion", "@VERSION@\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright 2001-2013 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright 2001-2014 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" diff --git a/dists/win32/ScummVM.iss b/dists/win32/ScummVM.iss index fa0f760f59..5afb407177 100644 --- a/dists/win32/ScummVM.iss +++ b/dists/win32/ScummVM.iss @@ -1,5 +1,5 @@ [Setup] -AppCopyright=2013 +AppCopyright=2014 AppName=ScummVM AppVerName=ScummVM Git AppPublisher=The ScummVM Team diff --git a/dists/win32/migration.bat b/dists/win32/migration.bat index b4b00c02cc..e1b27a1fb3 100644 --- a/dists/win32/migration.bat +++ b/dists/win32/migration.bat @@ -4,7 +4,7 @@ :: This script will copy any saved games located in the :: old default location, to the new default location. :: -:: (c) 2012-2013 ScummVM Team +:: (c) 2012-2014 ScummVM Team :: @echo off diff --git a/dists/win32/scummvm.nsi b/dists/win32/scummvm.nsi index 5357be9fe4..602b9fd6c3 100644 --- a/dists/win32/scummvm.nsi +++ b/dists/win32/scummvm.nsi @@ -76,7 +76,7 @@ Name ScummVM !define COMPANY "ScummVM Team" !define URL "http://scummvm.org/" !define DESCRIPTION "ScummVM Installer. Look! A three headed monkey (TM)!" -!define COPYRIGHT "Copyright 2001-2013 The ScummVM Team" +!define COPYRIGHT "Copyright 2001-2014 The ScummVM Team" ######################################################################################### # Installer configuration diff --git a/dists/win32/scummvm.nsi.in b/dists/win32/scummvm.nsi.in index 9f8bd1dad2..b8ddc74a86 100644 --- a/dists/win32/scummvm.nsi.in +++ b/dists/win32/scummvm.nsi.in @@ -76,7 +76,7 @@ Name ScummVM !define COMPANY "ScummVM Team" !define URL "http://scummvm.org/" !define DESCRIPTION "ScummVM Installer. Look! A three headed monkey (TM)!" -!define COPYRIGHT "Copyright 2001-2013 The ScummVM Team" +!define COPYRIGHT "Copyright 2001-2014 The ScummVM Team" ######################################################################################### # Installer configuration diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index cef4088722..66097b2812 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1433,6 +1433,7 @@ int Animation::getAvvyClothes() { } void Animation::resetVariables() { + setDirection(kDirUp); _geidaSpin = 0; _geidaTime = 0; _arrowTriggered = false; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2bb927646e..dbe434cde3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -144,30 +144,7 @@ void AvalancheEngine::initVariables() { _currentMouse = 177; _holdLeftMouse = false; - _jumpStatus = 0; - _mushroomGrowing = false; - _crapulusWillTell = false; - _enterCatacombsFromLustiesRoom = false; - _teetotal = false; - _malagauche = 0; - _drinking = '\0'; - _enteredLustiesRoomAsMonk = false; - _catacombX = 0; - _catacombY = 0; - _avvysInTheCupboard = false; - _geidaFollows = false; - _givenPotionToGeida = false; - _lustieIsAsleep = false; - _beenTiedUp = false; - _sittingInPub = false; - _spurgeTalkCount = 0; - _metAvaroid = false; - _takenMushroom = false; - _givenPenToAyles = false; - _askedDogfoodAboutNim = false; - _spludwickAtHome = false; - _passedCwytalotInHerts = false; - _lastRoom = _lastRoomNotMap = kRoomDummy; + resetVariables(); } Common::ErrorCode AvalancheEngine::initialize() { @@ -444,7 +421,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { t.tm_mon = f->readSint16LE(); t.tm_year = f->readSint16LE(); - resetVariables(); + resetAllVariables(); Common::Serializer sz(f, NULL); synchronize(sz); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 87eb3c2158..7392bf3fae 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -340,6 +340,7 @@ private: void checkClick(); void fixFlashers(); void loadAlso(byte num); + void resetAllVariables(); void resetVariables(); }; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ec3f81e55d..9555bb4505 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1410,7 +1410,6 @@ Common::String AvalancheEngine::intToStr(int32 num) { } void AvalancheEngine::resetVariables() { - _animation->setDirection(kDirUp); _carryNum = 0; for (int i = 0; i < kObjectNum; i++) _objects[i] = false; @@ -1479,7 +1478,10 @@ void AvalancheEngine::resetVariables() { _givenPenToAyles = false; _askedDogfoodAboutNim = false; _startTime = getTimeInSeconds(); +} +void AvalancheEngine::resetAllVariables() { + resetVariables(); _parser->resetVariables(); _nim->resetVariables(); _animation->resetVariables(); @@ -1501,7 +1503,7 @@ void AvalancheEngine::newGame() { avvy->init(0, true); _alive = true; - resetVariables(); + resetAllVariables(); _dialogs->setBubbleStateNatural(); diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp index abea906d9b..75cb027d7a 100644 --- a/engines/fullpipe/behavior.cpp +++ b/engines/fullpipe/behavior.cpp @@ -180,7 +180,15 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B } bool BehaviorManager::setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag) { - warning("STUB: BehaviorManager::setBehaviorEnabled()"); + BehaviorEntryInfo *entry = getBehaviorEntryInfoByMessageQueueDataId(obj, aniId, quId); + + if (entry) { + if (flag) + entry->_flags &= 0xFFFFFFFE; + else + entry->_flags |= 1; + } else + return false; return true; } @@ -199,7 +207,18 @@ void BehaviorManager::setFlagByStaticAniObject(StaticANIObject *ani, int flag) { } BehaviorEntryInfo *BehaviorManager::getBehaviorEntryInfoByMessageQueueDataId(StaticANIObject *ani, int id1, int id2) { - warning("STUB: getBehaviorEntryInfoByMessageQueueDataId()"); + for (uint i = 0; i < _behaviors.size(); i++) { + if (_behaviors[i]->_ani == ani) { + for (uint j = 0; j < _behaviors[i]->_bheItems.size(); j++) { + if (_behaviors[i]->_bheItems[j]->_staticsId == id1) { + for (int k = 0; k < _behaviors[i]->_bheItems[j]->_itemsCount; k++) { + if (_behaviors[i]->_bheItems[j]->_items[k]->_messageQueue->_dataId == id2) + return _behaviors[i]->_bheItems[j]->_items[k]; + } + } + } + } + } return 0; } diff --git a/engines/fullpipe/console.cpp b/engines/fullpipe/console.cpp index 06235d3eab..2d27fc2ddd 100644 --- a/engines/fullpipe/console.cpp +++ b/engines/fullpipe/console.cpp @@ -39,8 +39,12 @@ bool Console::Cmd_Scene(int argc, const char **argv) { return true; } else { int scene = _vm->convertScene(atoi(argv[1])); - _vm->_gameLoader->loadScene(scene); - _vm->_gameLoader->gotoScene(scene, TrubaLeft); + _vm->_gameLoader->loadScene(726); + _vm->_gameLoader->gotoScene(726, TrubaLeft); + + if (scene != 726) + _vm->_gameLoader->preloadScene(726, _vm->getSceneEntrance(scene)); + return false; } } diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index e2dff762ea..5edeeb1ec8 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -25,224 +25,30 @@ namespace Fullpipe { -#define ANI_BALLDROP 2685 -#define ANI_BATUTA 737 -#define ANI_BIGBALL 4923 -#define ANI_BIGLUK 909 -#define ANI_BOOT_1 4231 -#define ANI_BUTTON 598 -#define ANI_BUTTON_6 2988 -#define ANI_CLOCK 588 -#define ANI_CLOCK_8 2989 -#define ANI_CORNERSITTER 71 -#define ANI_DOMINO_3 2732 -#define ANI_DADAYASHIK 306 -#define ANI_EGGEATER 334 -#define ANI_EGGIE 4929 -#define ANI_GUM 978 -#define ANI_HAND 601 -#define ANI_HANDLE 622 -#define ANI_HOOLIGAN 808 -#define ANI_IN1MAN 5110 -#define ANI_INV_COIN 875 -#define ANI_INV_EGGAPL 1564 -#define ANI_INV_EGGBOOT 1570 -#define ANI_INV_EGGCOIN 1567 -#define ANI_INV_EGGDOM 1561 -#define ANI_INV_EGGGLS 1573 -#define ANI_INV_HANDLE 893 +// Common +#define ANI_FLY 4916 #define ANI_INV_MAP 5321 -#define ANI_KOZAWKA 495 #define ANI_LIFTBUTTON 2751 -#define ANI_LUKE 803 -#define ANI_MAMASHA 656 -#define ANI_MAMASHA_4 660 #define ANI_MAN 322 -#define ANI_NADUVATEL 944 -#define ANI_NEWBALL 1073 -#define ANI_OTMOROZ 419 -#define ANI_PACHKA 975 -#define ANI_PACHKA2 3008 -#define ANI_PLANK 501 -#define ANI_PLUSMINUS 2938 -#define ANI_SC2_BOX 1020 -#define ANI_SC4_BOOT 1035 -#define ANI_SC4_COIN 690 -#define ANI_SC7_BOX 791 -#define ANI_SPEAKER_4 3275 -#define ANI_SPRING 542 -#define ANI_VMYATS 764 -#define MSG_CLICKBOTTLE 569 -#define MSG_CLICKBUTTON 609 -#define MSG_CLICKPLANK 549 #define MSG_CMN_WINARCADE 4778 #define MSG_DISABLESAVES 5201 #define MSG_ENABLESAVES 5202 #define MSG_HMRKICK_METAL 4764 #define MSG_HMRKICK_STUCCO 4765 -#define MSG_INTR_ENDINTRO 5139 -#define MSG_INTR_GETUPMAN 5135 -#define MSG_INTR_SWITCHTO1 5145 -#define MSG_INTR_SWITCHTO2 5134 -#define MSG_KOZAWRESTART 546 -#define MSG_LIFT_CLICKBUTTON 2780 -#define MSG_LIFT_CLOSEDOOR 5194 -#define MSG_LIFT_EXITLIFT 5187 -#define MSG_LIFT_GO 1065 -#define MSG_LIFT_STARTEXITQUEUE 5186 -#define MSG_LOWERPLANK 540 #define MSG_MANSHADOWSOFF 5196 #define MSG_MANSHADOWSON 5197 -#define MSG_RAISEPLANK 547 -#define MSG_RESTARTGAME 4767 -#define MSG_SC1_SHOWOSK 1019 -#define MSG_SC1_SHOWOSK2 468 -#define MSG_SC1_UTRUBACLICK 1100 -#define MSG_SC2_HIDELADDER 1023 -#define MSG_SC2_LADDERCLICK 1101 -#define MSG_SC2_PUTMANUP 1026 -#define MSG_SC2_SHOWLADDER 1027 -#define MSG_SC3_HIDEDOMINO 3177 -#define MSG_SC3_ONTAKECOIN 5338 -#define MSG_SC3_RELEASEEGG 2681 -#define MSG_SC3_TAKEEGG 1583 -#define MSG_SC3_TESTFAT 1582 -#define MSG_SC3_UTRUBACLICK 1103 -#define MSG_SC4_COINOUT 2895 -#define MSG_SC4_COINPUT 1032 -#define MSG_SC4_CLICKLADDER 1439 -#define MSG_SC4_DROPBOTTLE 2896 -#define MSG_SC4_HANDOVER 2960 -#define MSG_SC4_HIDEBOOT 4563 -#define MSG_SC4_KOZAWFALL 2858 -#define MSG_SC4_MANFROMBOTTLE 2854 -#define MSG_SC4_MANTOBOTTLE 2852 -#define MSG_SC5_BGRSOUNDOFF 5315 -#define MSG_SC5_BGRSOUNDON 5314 -#define MSG_SC5_HANDLEDOWN 916 -#define MSG_SC5_HANDLEUP 915 -#define MSG_SC5_HIDEHANDLE 917 -#define MSG_SC5_MAKEMANFLIGHT 1136 -#define MSG_SC5_MAKEOTMFEEDBACK 1169 -#define MSG_SC5_SHOWHANDLE 918 -#define MSG_SC5_TESTLUK 914 -#define MSG_SC6_BTNPUSH 1017 -#define MSG_SC6_ENABLEDROPS 687 -#define MSG_SC6_INSTHANDLE 1012 -#define MSG_SC6_JUMPBK 2900 -#define MSG_SC6_JUMPFW 2901 -#define MSG_SC6_RESTORESCROLL 2906 -#define MSG_SC6_SHOWNEXTBALL 790 -#define MSG_SC6_STARTDROPS 2897 -#define MSG_SC6_TAKEBALL 682 -#define MSG_SC6_TESTNUMBALLS 2904 -#define MSG_SC6_UTRUBACLICK 1105 -#define MSG_SC7_CLOSELUKE 822 -#define MSG_SC7_HIDEBOX 817 -#define MSG_SC7_HIDELUKE 821 -#define MSG_SC7_OPENLUKE 823 -#define MSG_SC7_PULL 2943 -#define MSG_SC7_SHOWBOX 816 -#define MSG_SC8_ARCADENOW 1044 -#define MSG_SC8_ENTERUP 3037 -#define MSG_SC8_GETHIMUP 789 -#define MSG_SC8_HIDELADDER_D 1107 -#define MSG_SC8_RESUMEFLIGHT 784 -#define MSG_SC8_STANDUP 2976 -#define MSG_SC10_CLICKGUM 992 -#define MSG_SC10_HIDEGUM 993 -#define MSG_SC10_LADDERTOBACK 3002 -#define MSG_SC10_LADDERTOFORE 3004 -#define MSG_SC10_SHOWGUM 994 -#define MSG_GOTOLADDER 618 -#define MSG_SHAKEBOTTLE 584 -#define MSG_SHOOTKOZAW 557 -#define MSG_SHOWCOIN 1033 -#define MSG_SPINHANDLE 2398 -#define MSG_STARTARCADE 781 -#define MSG_STARTHAND 612 -#define MSG_TAKEBOTTLE 614 -#define MSG_TAKEKOZAW 611 -#define MSG_TESTPLANK 538 -#define MSG_UPDATEBOTTLE 613 -#define MV_BLK_CLOSE 911 -#define MV_BLK_OPEN 910 -#define MV_CLK8_GO 2990 -#define MV_CST_CLOSELUKE 807 -#define MV_EGTR_FATASK 5332 -#define MV_IN1MAN_SLEEP 5111 -#define MV_BDG_OPEN 1379 -#define MV_BTN_CLICK 599 -#define MV_CLK_GO 589 -#define MV_HND_POINT 602 -#define MV_KZW_GOR 564 -#define MV_KZW_JUMP 558 -#define MV_KZW_JUMPROTATE 561 -#define MV_KZW_TOHOLERV 537 -#define MV_KZW_WALKPLANK 500 -#define MV_KZW_JUMPHIT 2857 -#define MV_KZW_JUMPOUT 586 -#define MV_KZW_RAISEHEAD 577 -#define MV_KZW_STANDUP 563 -#define MV_KZW_TURN 562 -#define MV_MAN_FROMLADDER 493 -#define MV_MAN_FROMLADDERUP 1522 -#define MV_MAN_GOD 481 +#define MV_FLY_FLY 4917 #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 -#define MV_MAN_GOU 460 -#define MV_MAN_JUMPONPLANK 551 -#define MV_MAN_LOOKLADDER 520 -#define MV_MAN_LOOKLADDERRV 556 #define MV_MAN_LOOKUP 4773 -#define MV_MAN_PLANKTOLADDER 553 +#define rMV_MAN_LOOKUP 4775 +#define MV_MAN_TOLADDER 448 +#define MV_MAN_TOLADDER2 2841 #define MV_MAN_STARTLADDER 452 #define MV_MAN_STARTLADDER2 2842 -#define MV_MAN_STARTLADDERD 457 #define MV_MAN_STOPLADDER 454 #define MV_MAN_STOPLADDER2 2845 -#define MV_MAN_TOLADDER 448 -#define MV_MAN_TOLADDERD 1524 -#define MV_MAN_TOLADDER2 2841 #define MV_MAN_TURN_LU 486 -#define MV_MAN_TURN_SUD 1089 -#define MV_MAN6_TAKEBALL 2691 -#define MV_MAN6_THROWBALL 2692 -#define MV_MAN8_BADLUCK 783 -#define MV_MAN8_DRYGDOWN 770 -#define MV_MAN8_DRYGUP 768 -#define MV_MAN8_HANDSDOWN 772 -#define MV_MAN8_HANDSUP 777 -#define MV_MAN8_JUMP 775 -#define MV_MAN8_JUMPOFF 2969 -#define MV_MAN8_SITDOWN 2968 -#define MV_MANHDL_HANDLEDOWN 630 -#define MV_MANHDL_HANDLEUP 631 -#define MV_MOM_CYCLEBK 3012 -#define MV_MOM_JUMPBK 662 -#define MV_MOM_JUMPFW 661 -#define MV_MOM_STARTBK 3010 -#define MV_MOM_STOPBK 3013 -#define MV_MOM_TAKE1 2885 -#define MV_MOM_TAKE2 2886 -#define MV_MOM_TAKE3 2887 -#define MV_MOM_TAKE4 2888 -#define MV_MOM_TAKE5 2889 -#define MV_NDV_BLOW2 2855 -#define MV_NDV_DENIES 952 -#define MV_NDV_DENY_NOGUM 3022 -#define MV_OTM_BOXHANDLEDOWN 626 -#define MV_OTM_BOXHANDLEUP 627 -#define MV_OTM_HANDLEDOWN 620 -#define MV_OTM_HANDLEUP 621 -#define MV_PNK_WEIGHTLEFT 541 -#define MV_PNK_WEIGHTRIGHT 502 -#define MV_SC4_COIN_default 1029 -#define MV_SC7_BOX_default 792 -#define MV_SPK4_PLAY 3276 -#define MV_SPR_LOWER 543 -#define MV_VMT_DEF 765 -#define PIC_CMN_EVAL 3468 #define PIC_CSR_DEFAULT 4891 #define PIC_CSR_DEFAULT_INV 4892 #define PIC_CSR_ITN 4893 @@ -279,76 +85,17 @@ namespace Fullpipe { #define PIC_IN1_PIPETITLE 5167 #define PIC_INV_MENU 991 #define PIC_MAP_A13 5275 -#define PIC_MAP_P03 5279 #define PIC_MAP_S01 5223 -#define PIC_SC1_KUCHKA 1321 -#define PIC_SC1_LADDER 1091 -#define PIC_SC1_OSK 1018 -#define PIC_SC1_OSK2 2932 -#define PIC_SC2_DTRUBA 841 -#define PIC_SC2_LADDER 412 -#define PIC_SC3_DOMIN 5182 -#define PIC_SC3_LADDER 1102 -#define PIC_SC4_BOTTLE 568 -#define PIC_SC4_BOTTLE2 2936 -#define PIC_SC4_DOWNTRUBA 619 -#define PIC_SC4_LADDER 1438 -#define PIC_SC4_LRTRUBA 616 -#define PIC_SC4_MASK 585 -#define PIC_SC4_PLANK 5183 -#define PIC_SC6_LADDER 1104 -#define PIC_SC8_ARCADENOW 1043 -#define PIC_SC8_LADDER 754 -#define PIC_SC8_LADDER_D 755 -#define PIC_SC8_LADDERD 1106 -#define PIC_SC10_DTRUBA 974 -#define PIC_SC10_LADDER 995 -#define PIC_SCD_SEL 734 -#define QU_BALL_WALKL 4920 -#define QU_BALL_WALKR 4919 -#define QU_CST_CLOSELUKE 820 -#define QU_EGG6_GOL 4936 -#define QU_EGG6_GOR 4935 -#define QU_EGTR_MD2_SHOW 4698 -#define QU_EGTR_MD1_SHOW 4697 -#define QU_EGTR_SLIMSHOW 4883 -#define QU_HND_TAKE0 1440 -#define QU_HND_TAKE1 1441 -#define QU_HND_TAKE2 1442 -#define QU_HND_TAKEBOTTLE 1443 -#define QU_IN2_DO 5144 -#define QU_INTR_FINISH 5138 -#define QU_INTR_GETUPMAN 5136 #define QU_INTR_STARTINTRO 5133 -#define QU_KOZAW_WALK 505 -#define QU_MOM_JUMPBK 671 -#define QU_MOM_JUMPFW 670 -#define QU_MOM_PUTBALL 2903 -#define QU_MOM_SITDOWN 685 -#define QU_MOM_STANDUP 2899 -#define QU_MOM_TOLIFT 2902 -#define QU_PNK_CLICK 550 -#define QU_SC3_ENTERLIFT 2779 -#define QU_SC3_EXITLIFT 2808 -#define QU_SC6_FALLHANDLE 2995 -#define QU_SC4_GOCLOCK 595 -#define QU_SC4_MANFROMBOTTLE 2851 -#define QU_SC4_MANTOBOTTLE 2850 -#define QU_SC5_MANBUMP 1167 -#define QU_SC5_MANFLY 1168 -#define QU_SC6_DROPS 2898 -#define QU_SC6_DROPS3 2955 -#define QU_SC6_ENTERLIFT 1054 -#define QU_SC6_EXITLIFT 1055 -#define QU_SC6_FALLBALL 2690 -#define QU_SC6_SHOWHANDLE 1689 -#define QU_SC6_SHOWNEXTBALL 2689 -#define QU_SC8_FINISH 788 -#define QU_SC8_STANDUP 2975 -#define QU_SC10_ENTERLIFT 1067 -#define QU_SC10_EXITLIFT 2809 -#define QU_SC10_TAKEGUM 3026 #define SC_1 301 +#define SC_2 302 +#define SC_3 303 +#define SC_4 304 +#define SC_5 305 +#define SC_6 649 +#define SC_7 650 +#define SC_8 651 +#define SC_9 652 #define SC_10 653 #define SC_11 654 #define SC_12 655 @@ -359,7 +106,6 @@ namespace Fullpipe { #define SC_17 1141 #define SC_18 1142 #define SC_19 1143 -#define SC_2 302 #define SC_20 1144 #define SC_21 1546 #define SC_22 1547 @@ -370,7 +116,6 @@ namespace Fullpipe { #define SC_27 1552 #define SC_28 2062 #define SC_29 2063 -#define SC_3 303 #define SC_30 2064 #define SC_31 2065 #define SC_32 2066 @@ -380,12 +125,6 @@ namespace Fullpipe { #define SC_36 2070 #define SC_37 2071 #define SC_38 2072 -#define SC_4 304 -#define SC_5 305 -#define SC_6 649 -#define SC_7 650 -#define SC_8 651 -#define SC_9 652 #define SC_COMMON 321 #define SC_DBGMENU 726 #define SC_FINAL1 4999 @@ -395,43 +134,12 @@ namespace Fullpipe { #define SC_INTRO1 3896 #define SC_INTRO2 3907 #define SC_INV 858 -#define SC_LDR 635 -#define SC_MAINMENU 4620 -#define SC_MAP 5222 -#define SC_TEST 903 -#define SC_TITLES 5166 -#define SND_4_010 3125 -#define SND_4_012 3127 -#define SND_4_033 4990 -#define SND_5_026 5316 -#define SND_8_014 3624 #define SND_CMN_031 3516 +#define SND_CMN_060 4921 +#define SND_CMN_061 4922 #define SND_CMN_070 5199 #define SND_INTR_019 5220 -#define ST_BLK_CLOSED 912 -#define ST_BLK_OPEN 913 -#define ST_BTT_CHESHET 746 -#define ST_BTT_NOSPOON 739 -#define ST_BTT_SLEEPS 748 -#define ST_BTT_SPOON 741 -#define ST_CLK_CLOSED 590 -#define ST_CST_HANDLELESS 794 -#define ST_DYAS_LIES 318 -#define ST_EGTR_MID1 2863 -#define ST_EGTR_MID2 2869 -#define ST_EGTR_SLIM 336 -#define ST_HGN_LOOK 811 -#define ST_HGN_LUKE 810 -#define ST_HDL_BROKEN 3342 -#define ST_HDL_DOWN 625 -#define ST_HDL_PLUGGED 2397 -#define ST_HDL_UP 624 -#define ST_HND_EMPTY 603 -#define ST_IN1MAN_SLEEP 5112 -#define ST_KZW_EMPTY 498 -#define ST_KZW_JUMPOUT 587 -#define ST_KZW_RIGHT 559 -#define ST_KZW_SIT 560 +#define ST_FLY_FLY 4918 #define ST_LBN_0N 2832 #define ST_LBN_0P 2833 #define ST_LBN_1N 2753 @@ -452,61 +160,492 @@ namespace Fullpipe { #define ST_LBN_8P 2775 #define ST_LBN_9N 2777 #define ST_LBN_9P 2778 -#define ST_LUK_CLOSED 805 -#define ST_LUK_OPEN 806 +#define ST_MAN_EMPTY 476 +#define ST_MAN_RIGHT 325 +#define TrubaDown 697 +#define TrubaLeft 474 +#define TrubaUp 680 + +// Intro +#define ANI_IN1MAN 5110 +#define MSG_INTR_ENDINTRO 5139 +#define MSG_INTR_GETUPMAN 5135 +#define MSG_INTR_SWITCHTO1 5145 +#define MSG_INTR_SWITCHTO2 5134 +#define MV_IN1MAN_SLEEP 5111 +#define QU_IN2_DO 5144 +#define QU_INTR_FINISH 5138 +#define QU_INTR_GETUPMAN 5136 +#define ST_IN1MAN_SLEEP 5112 + +// Scene 1 +#define ANI_BOOT_1 4231 +#define MSG_SC1_SHOWOSK 1019 +#define MSG_SC1_SHOWOSK2 468 +#define MSG_SC1_UTRUBACLICK 1100 +#define PIC_SC1_KUCHKA 1321 +#define PIC_SC1_LADDER 1091 +#define PIC_SC1_OSK 1018 +#define PIC_SC1_OSK2 2932 +#define TrubaRight 696 + +// Scene 2 +#define ANI_SC2_BOX 1020 +#define ANI_DADAYASHIK 306 +#define MSG_SC2_HIDELADDER 1023 +#define MSG_SC2_LADDERCLICK 1101 +#define MSG_SC2_PUTMANUP 1026 +#define MSG_SC2_SHOWLADDER 1027 +#define PIC_SC2_DTRUBA 841 +#define PIC_SC2_LADDER 412 +#define ST_DYAS_LIES 318 + +// Scene 3 +#define ANI_DOMINO_3 2732 +#define ANI_EGGEATER 334 +#define ANI_INV_COIN 875 +#define ANI_INV_EGGAPL 1564 +#define ANI_INV_EGGBOOT 1570 +#define ANI_INV_EGGCOIN 1567 +#define ANI_INV_EGGDOM 1561 +#define ANI_INV_EGGGLS 1573 +#define MSG_LIFT_CLICKBUTTON 2780 +#define MSG_LIFT_CLOSEDOOR 5194 +#define MSG_LIFT_EXITLIFT 5187 +#define MSG_LIFT_GO 1065 +#define MSG_LIFT_STARTEXITQUEUE 5186 +#define MSG_SC3_HIDEDOMINO 3177 +#define MSG_SC3_ONTAKECOIN 5338 +#define MSG_SC3_RELEASEEGG 2681 +#define MSG_SC3_TAKEEGG 1583 +#define MSG_SC3_TESTFAT 1582 +#define MSG_SC3_UTRUBACLICK 1103 +#define MV_EGTR_FATASK 5332 +#define PIC_SC3_DOMIN 5182 +#define PIC_SC3_LADDER 1102 +#define ST_EGTR_MID1 2863 +#define ST_EGTR_MID2 2869 +#define ST_EGTR_SLIM 336 +#define QU_EGTR_MD2_SHOW 4698 +#define QU_EGTR_MD1_SHOW 4697 +#define QU_EGTR_SLIMSHOW 4883 +#define QU_SC3_ENTERLIFT 2779 +#define QU_SC3_EXITLIFT 2808 + +// Scene 4 +#define ANI_BIGBALL 4923 +#define ANI_BUTTON 598 +#define ANI_CLOCK 588 +#define ANI_HAND 601 +#define ANI_KOZAWKA 495 +#define ANI_MAMASHA_4 660 +#define ANI_PLANK 501 +#define ANI_SC4_BOOT 1035 +#define ANI_SC4_COIN 690 +#define ANI_SPEAKER_4 3275 +#define ANI_SPRING 542 +#define MSG_GOTOLADDER 618 +#define MSG_KOZAWRESTART 546 +#define MSG_SC4_COINOUT 2895 +#define MSG_SC4_COINPUT 1032 +#define MSG_SC4_CLICKLADDER 1439 +#define MSG_SC4_DROPBOTTLE 2896 +#define MSG_SC4_HANDOVER 2960 +#define MSG_SC4_HIDEBOOT 4563 +#define MSG_SC4_KOZAWFALL 2858 +#define MSG_SC4_MANFROMBOTTLE 2854 +#define MSG_SC4_MANTOBOTTLE 2852 +#define MSG_SHAKEBOTTLE 584 +#define MSG_SHOOTKOZAW 557 +#define MSG_STARTHAND 612 +#define MSG_CLICKBOTTLE 569 +#define MSG_CLICKBUTTON 609 +#define MSG_CLICKPLANK 549 +#define MSG_LOWERPLANK 540 +#define MSG_RAISEPLANK 547 +#define MSG_SHOWCOIN 1033 +#define MSG_TAKEBOTTLE 614 +#define MSG_TAKEKOZAW 611 +#define MSG_TESTPLANK 538 +#define MSG_UPDATEBOTTLE 613 +#define MV_BTN_CLICK 599 +#define MV_CLK_GO 589 +#define MV_HND_POINT 602 +#define MV_KZW_GOR 564 +#define rMV_KZW_GOR 566 +#define MV_KZW_JUMP 558 +#define MV_KZW_JUMPROTATE 561 +#define MV_KZW_TOHOLERV 537 +#define MV_KZW_WALKPLANK 500 +#define MV_KZW_JUMPHIT 2857 +#define MV_KZW_JUMPOUT 586 +#define MV_KZW_RAISEHEAD 577 +#define MV_KZW_STANDUP 563 +#define MV_KZW_TURN 562 +#define MV_MAN_FROMLADDER 493 +#define MV_MAN_GOD 481 +#define MV_MAN_GOU 460 +#define MV_MAN_JUMPONPLANK 551 +#define MV_MAN_LOOKLADDER 520 +#define MV_MAN_PLANKTOLADDER 553 +#define MV_MAN_STARTLADDERD 457 +#define MV_PNK_WEIGHTLEFT 541 +#define MV_PNK_WEIGHTRIGHT 502 +#define MV_SC4_COIN_default 1029 +#define MV_SPK4_PLAY 3276 +#define MV_SPR_LOWER 543 +#define PIC_MAP_P03 5279 +#define PIC_SC4_BOTTLE 568 +#define PIC_SC4_BOTTLE2 2936 +#define PIC_SC4_DOWNTRUBA 619 +#define PIC_SC4_LADDER 1438 +#define PIC_SC4_LRTRUBA 616 +#define PIC_SC4_MASK 585 +#define PIC_SC4_PLANK 5183 +#define QU_BALL_WALKL 4920 +#define QU_BALL_WALKR 4919 +#define QU_HND_TAKE0 1440 +#define QU_HND_TAKE1 1441 +#define QU_HND_TAKE2 1442 +#define QU_HND_TAKEBOTTLE 1443 +#define QU_KOZAW_WALK 505 +#define QU_PNK_CLICK 550 +#define QU_SC4_GOCLOCK 595 +#define QU_SC4_MANFROMBOTTLE 2851 +#define QU_SC4_MANTOBOTTLE 2850 +#define SND_4_010 3125 +#define SND_4_012 3127 +#define SND_4_033 4990 +#define ST_CLK_CLOSED 590 +#define ST_HND_EMPTY 603 +#define ST_KZW_EMPTY 498 +#define ST_KZW_JUMPOUT 587 +#define ST_KZW_RIGHT 559 +#define ST_KZW_SIT 560 #define ST_MAN_GOLADDER 450 #define ST_MAN_GOLADDER2 2843 -#define ST_MAN_EMPTY 476 +#define MV_MAN_LOOKLADDERRV 556 #define ST_MAN_LADDERDOWN 521 #define ST_MAN_LOOKPLANK 555 #define ST_MAN_ONPLANK 552 -#define ST_MAN_RIGHT 325 #define ST_MAN_SIT 1164 #define ST_MAN_STANDLADDER 453 #define ST_MAN_UP 449 +#define ST_PNK_WEIGHTLEFT 503 +#define ST_PNK_WEIGHTRIGHT 504 +#define ST_SPR_UP 544 + +// Scene 5 +#define ANI_BIGLUK 909 +#define ANI_HANDLE 622 +#define ANI_OTMOROZ 419 +#define MSG_SC5_BGRSOUNDOFF 5315 +#define MSG_SC5_BGRSOUNDON 5314 +#define MSG_SC5_HANDLEDOWN 916 +#define MSG_SC5_HANDLEUP 915 +#define MSG_SC5_HIDEHANDLE 917 +#define MSG_SC5_MAKEMANFLIGHT 1136 +#define MSG_SC5_MAKEOTMFEEDBACK 1169 +#define MSG_SC5_SHOWHANDLE 918 +#define MSG_SC5_TESTLUK 914 +#define MV_BLK_CLOSE 911 +#define MV_BLK_OPEN 910 +#define MV_MANHDL_HANDLEDOWN 630 +#define MV_MANHDL_HANDLEUP 631 +#define MV_OTM_BOXHANDLEDOWN 626 +#define MV_OTM_BOXHANDLEUP 627 +#define MV_OTM_HANDLEDOWN 620 +#define MV_OTM_HANDLEUP 621 +#define QU_SC5_MANBUMP 1167 +#define QU_SC5_MANFLY 1168 +#define SND_5_026 5316 +#define ST_BLK_CLOSED 912 +#define ST_BLK_OPEN 913 +#define ST_HDL_BROKEN 3342 +#define ST_HDL_DOWN 625 +#define ST_HDL_UP 624 +#define ST_OTM_BOX_LEFT 429 +#define ST_OTM_GLS_LEFT 421 +#define ST_OTM_VNT_LEFT 434 + +// Scene 6 +#define ANI_BALLDROP 2685 +#define ANI_BUTTON_6 2988 +#define ANI_EGGIE 4929 +#define ANI_INV_HANDLE 893 +#define ANI_MAMASHA 656 +#define ANI_NEWBALL 1073 +#define MSG_SC6_BTNPUSH 1017 +#define MSG_SC6_ENABLEDROPS 687 +#define MSG_SC6_INSTHANDLE 1012 +#define MSG_SC6_JUMPBK 2900 +#define MSG_SC6_JUMPFW 2901 +#define MSG_SC6_RESTORESCROLL 2906 +#define MSG_SC6_SHOWNEXTBALL 790 +#define MSG_SC6_STARTDROPS 2897 +#define MSG_SC6_TAKEBALL 682 +#define MSG_SC6_TESTNUMBALLS 2904 +#define MSG_SC6_UTRUBACLICK 1105 +#define MSG_SPINHANDLE 2398 +#define MV_MAN6_TAKEBALL 2691 +#define MV_MAN6_THROWBALL 2692 +#define MV_MOM_CYCLEBK 3012 +#define MV_MOM_JUMPBK 662 +#define MV_MOM_JUMPFW 661 +#define MV_MOM_STARTBK 3010 +#define MV_MOM_STOPBK 3013 +#define MV_MOM_TAKE1 2885 +#define MV_MOM_TAKE2 2886 +#define MV_MOM_TAKE3 2887 +#define MV_MOM_TAKE4 2888 +#define MV_MOM_TAKE5 2889 +#define PIC_SC6_LADDER 1104 +#define QU_EGG6_GOL 4936 +#define QU_EGG6_GOR 4935 +#define QU_MOM_JUMPBK 671 +#define QU_MOM_JUMPFW 670 +#define QU_MOM_PUTBALL 2903 +#define QU_MOM_SITDOWN 685 +#define QU_MOM_STANDUP 2899 +#define QU_MOM_TOLIFT 2902 +#define QU_SC6_DROPS 2898 +#define QU_SC6_DROPS3 2955 +#define QU_SC6_ENTERLIFT 1054 +#define QU_SC6_EXITLIFT 1055 +#define QU_SC6_FALLBALL 2690 +#define QU_SC6_FALLHANDLE 2995 +#define QU_SC6_SHOWHANDLE 1689 +#define QU_SC6_SHOWNEXTBALL 2689 +#define ST_HDL_PLUGGED 2397 #define ST_MAN6_BALL 2688 -#define ST_MAN8_FLYDOWN 771 -#define ST_MAN8_FLYUP 769 -#define ST_MAN8_HANDSUP 773 -#define ST_MAN8_STAND 774 #define ST_MOM_SITS 659 #define ST_MOM_STANDS 658 #define ST_NBL_NORM 1076 -#define ST_NDV_SIT 946 -#define ST_OTM_BOX_LEFT 429 -#define ST_OTM_GLS_LEFT 421 -#define ST_OTM_VNT_LEFT 434 + +// Scene 7 +#define ANI_CORNERSITTER 71 +#define ANI_HOOLIGAN 808 +#define ANI_LUKE 803 +#define ANI_PLUSMINUS 2938 +#define ANI_SC7_BOX 791 +#define MSG_SC7_CLOSELUKE 822 +#define MSG_SC7_HIDEBOX 817 +#define MSG_SC7_HIDELUKE 821 +#define MSG_SC7_OPENLUKE 823 +#define MSG_SC7_PULL 2943 +#define MSG_SC7_SHOWBOX 816 +#define MV_CST_CLOSELUKE 807 +#define MV_SC7_BOX_default 792 +#define QU_CST_CLOSELUKE 820 +#define ST_CST_HANDLELESS 794 +#define ST_HGN_LOOK 811 +#define ST_HGN_LUKE 810 +#define ST_LUK_CLOSED 805 +#define ST_LUK_OPEN 806 #define ST_PMS_MINUS 2942 #define ST_PMS_PLUS 2941 -#define ST_PNK_WEIGHTLEFT 503 -#define ST_PNK_WEIGHTRIGHT 504 -#define ST_SPR_UP 544 + +// Scene 8 +#define ANI_BATUTA 737 +#define ANI_CLOCK_8 2989 +#define ANI_VMYATS 764 +#define MSG_SC8_ARCADENOW 1044 +#define MSG_SC8_ENTERUP 3037 +#define MSG_SC8_GETHIMUP 789 +#define MSG_SC8_HIDELADDER_D 1107 +#define MSG_SC8_RESUMEFLIGHT 784 +#define MSG_SC8_STANDUP 2976 +#define MSG_STARTARCADE 781 +#define MV_CLK8_GO 2990 +#define MV_MAN_FROMLADDERUP 1522 +#define MV_MAN_TOLADDERD 1524 +#define MV_MAN8_BADLUCK 783 +#define MV_MAN8_DRYGDOWN 770 +#define MV_MAN8_DRYGUP 768 +#define MV_MAN8_HANDSDOWN 772 +#define MV_MAN8_HANDSUP 777 +#define MV_MAN8_JUMP 775 +#define MV_MAN8_JUMPOFF 2969 +#define MV_MAN8_SITDOWN 2968 +#define MV_VMT_DEF 765 +#define PIC_SC8_ARCADENOW 1043 +#define PIC_SC8_LADDER 754 +#define PIC_SC8_LADDER_D 755 +#define PIC_SC8_LADDERD 1106 +#define QU_SC8_FINISH 788 +#define QU_SC8_STANDUP 2975 +#define SND_8_014 3624 +#define ST_BTT_CHESHET 746 +#define ST_BTT_NOSPOON 739 +#define ST_BTT_SLEEPS 748 +#define ST_BTT_SPOON 741 +#define ST_MAN8_FLYDOWN 771 +#define ST_MAN8_FLYUP 769 +#define ST_MAN8_HANDSUP 773 +#define ST_MAN8_STAND 774 #define ST_VMT_MIN 766 -#define TrubaDown 697 -#define TrubaLeft 474 -#define TrubaRight 696 -#define TrubaUp 680 -#define rMV_MAN_LOOKUP 4775 -#define rMV_KZW_GOR 566 + +// Scene 10 +#define ANI_GUM 978 +#define ANI_NADUVATEL 944 +#define ANI_PACHKA 975 +#define ANI_PACHKA2 3008 +#define MSG_SC10_CLICKGUM 992 +#define MSG_SC10_HIDEGUM 993 +#define MSG_SC10_LADDERTOBACK 3002 +#define MSG_SC10_LADDERTOFORE 3004 +#define MSG_SC10_SHOWGUM 994 +#define MV_NDV_BLOW2 2855 +#define MV_NDV_DENIES 952 +#define MV_NDV_DENY_NOGUM 3022 +#define PIC_SC10_DTRUBA 974 +#define PIC_SC10_LADDER 995 +#define QU_SC10_ENTERLIFT 1067 +#define QU_SC10_EXITLIFT 2809 +#define QU_SC10_TAKEGUM 3026 +#define ST_NDV_SIT 946 // Scene 11 #define ANI_BOOTS_11 2704 #define ANI_KACHELI 1094 #define ANI_MAN11 1108 #define ANI_SWINGER 1113 +#define MSG_SC11_HITMAN 3019 +#define MSG_SC11_MANCRY 4691 +#define MSG_SC11_MANTOSWING 1128 +#define MSG_SC11_PUTBOOT 1117 +#define MSG_SC11_RESTARTMAN 1133 +#define MSG_SC11_SHOWSWING 1124 +#define MSG_SC11_SITSWINGER 5198 +#define MV_KCH_MOVE2 1099 +#define MV_KCH_START 1121 +#define MV_MAN11_JUMPHIT 1129 +#define MV_MAN11_JUMPFROMSWING 5209 +#define MV_MAN11_JUMPOVER 1131 +#define MV_MAN11_SWING_0 1109 +#define MV_MAN11_SWING_1 1111 +#define MV_MAN11_SWING_2 1112 #define PIC_SC11_HINT 5170 +#define QU_SC11_MANFALL 3017 +#define QU_SC11_PUTBOOT1 2709 +#define QU_SC11_PUTBOOT2 2710 +#define QU_SC11_RESTARTMAN 1134 +#define QU_SWR_JUMPDOWN 1123 +#define SND_11_020 3704 +#define SND_11_022 3706 +#define SND_11_024 3708 +#define SND_11_031 5171 +#define ST_BTS11_2 2707 +#define ST_BTS11_ONE 2706 +#define ST_KCH_0 1096 +#define ST_KCH_EMPTY 1132 #define ST_KCH_STATIC 1122 +#define ST_MAN_1PIX 518 +#define ST_MAN11_EMPTY 1110 +#define ST_MAN11_SWING 1127 #define ST_SWR_SIT 1147 #define ST_SWR_SITBALD 1153 #define ST_SWR_STAND3 3014 +// Scene 13 +#define ANI_BRIDGE 1378 +#define ANI_HANDLE_L 1209 +#define ANI_HANDLE_R 1196 +#define ANI_STOROZH 1172 +#define ANI_WHIRLGIG_13 1383 +#define MSG_SC13_CHEW 1220 +#define MSG_SC13_CLOSEBRIDGE 3046 +#define MSG_SC13_CLOSEFAST 1267 +#define MSG_SC13_EATGUM 1219 +#define MSG_SC13_OPENBRIDGE 3064 +#define MSG_SC13_OPENFAST 1266 +#define MSG_SC13_SHOWGUM 1215 +#define MSG_SC13_STARTWHIRLGIG 1388 +#define MSG_SC13_STOPWHIRLGIG 1387 +#define MSG_SC13_TESTCLOSE 3065 +#define MSG_SC13_TESTOPEN 3048 +#define MSG_SC13_UNEATGUM 1218 +#define MSG_SC13_UPDATEBRIDGE 1217 +#define MV_BDG_CLOSE 1382 +#define MV_BDG_OPEN 1379 +#define MV_WHR13_SPIN 1384 +#define QU_SC13_CLOSEFAIL 3063 +#define QU_SC13_CLOSESUCCESS 3062 +#define QU_SC13_OPENFAIL 3042 +#define QU_SC13_OPENSUCCESS 3047 +#define QU_SC13_SHOWGUM 1216 +#define QU_STR_CHEW 1190 +#define QU_STR_LTOR 3054 +#define QU_STR_PLUU 1189 +#define QU_STR_RTOL 3053 +#define QU_STR_TURNR 1186 +#define QU_STR_TURNR_L 3059 +#define SND_13_018 3763 +#define SND_13_033 4685 +#define SND_13_034 4686 +#define SND_13_037 5335 +#define ST_BDG_CLOSED 1380 +#define ST_BDG_OPEN2 1381 +#define ST_HDLL_FIRECAN 1310 +#define ST_HDLL_HAMMER 3205 +#define ST_HDLL_UP 1211 +#define ST_HDLR_DOWN 1199 +#define ST_HDLR_DOWN_GUM 3044 +#define ST_HDLR_GUM 1201 +#define ST_STR_LEFT 1175 +#define ST_STR_RIGHT 1174 + +// Scene 14 +#define ANI_BALL14 1246 +#define ANI_GRANDMA 1227 +#define MSG_SC14_ENDARCADE 3250 +#define MSG_SC14_GMAJUMP 1250 +#define MSG_SC14_GMATOTRUBA 3249 +#define MSG_SC14_HIDEBALLLAST 3251 +#define MSG_SC14_HIDEPINK 3248 +#define MSG_SC14_MANKICKBALL 1257 +#define MSG_SC14_RESTORESCROLL 4769 +#define MSG_SC14_SCROLLLEFT 4768 +#define MSG_SC14_SHOWBALLFLY 1253 +#define MSG_SC14_SHOWBALLGMADIVE 1260 +#define MSG_SC14_SHOWBALLGMAHIT 1259 +#define MSG_SC14_SHOWBALLGMAHIT2 3245 +#define MSG_SC14_SHOWBALLLAST 3246 +#define MSG_SC14_SHOWBALLMAN 1254 +#define MSG_SC14_STARTARCADE 3252 +#define MV_BAL14_FALL 1258 +#define MV_BAL14_SPIN 1247 +#define MV_BAL14_TOGMA 3214 +#define MV_GMA_BACKOFF 1233 +#define MV_GMA_BACKOFF2 3217 +#define MV_GMA_JUMPFW 1230 +#define MV_GMA_THROW 1232 +#define MV_MAN14_DECLINE 1239 +#define MV_MAN14_FALL 1236 +#define MV_MAN14_KICK 1237 +#define MV_MAN14_KICKAIR 1256 +#define MV_MAN14_STEPFW 1240 +#define PIC_SC14_RTRUBA 1221 +#define ST_GMA_SIT 1229 +#define QU_GMA_BLINK 1252 +#define QU_GMA_JUMPBK 1251 +#define QU_GMA_JUMPFW 1249 +#define QU_GMA_THROW 1255 +#define QU_SC14_ENDARCADE 1391 +#define QU_SC14_ENTERLIFT 1225 +#define QU_SC14_EXITLIFT 1226 +#define QU_SC14_STARTARCADE 1390 +#define QU_SC14_WINARCADE 3247 + // Scene 15 #define ANI_BOOT_15 4779 +#define ANI_INV_BOOT 881 #define ANI_GRANDMA_ASS 1265 #define MSG_SC15_ASSDRYG 4755 #define MSG_SC15_LADDERTOBACK 3259 #define MSG_SC15_PULL 2940 #define MSG_SC15_STOPCHANTING 4753 +#define MV_SWR_SWING 1114 #define PIC_SC15_DTRUBA 1263 #define PIC_SC15_LADDER 3253 #define PIC_SC15_LTRUBA 1261 @@ -518,6 +657,437 @@ namespace Fullpipe { #define ST_GMS_BOOT 1270 #define ST_GMS_BOOTLESS2 3316 +// Scene 16 +#define ANI_BEARDED_CMN 3420 +#define ANI_BOOT_16 3285 +#define ANI_BOY 1327 +#define ANI_GIRL 1328 +#define ANI_JETTIE 1392 +#define ANI_MUG 1296 +#define ANI_WIRE16 1344 +#define MSG_SC16_FILLMUG 1363 +#define MSG_SC16_HIDEMAN 1357 +#define MSG_SC16_HIDEMUG 1351 +#define MSG_SC16_HIDEWIRE 1349 +#define MSG_SC16_LAUGHSOUND 4993 +#define MSG_SC16_MUGCLICK 1366 +#define MSG_SC16_SHOWBEARDED 4956 +#define MSG_SC16_SHOWMAN 1358 +#define MSG_SC16_SHOWMUG 1352 +#define MSG_SC16_SHOWMUGFULL 1396 +#define MSG_SC16_SHOWWIRE 1350 +#define MSG_SC16_STARTLAUGH 1374 +#define MV_BOY_DRINK 1333 +#define MV_BT16_FILL 3286 +#define MV_GRL_DRINK 1339 +#define MV_GRL_FALL 3115 +#define MV_GRL_LAUGH_POPA 3278 +#define MV_JTI_FLOWBY 1393 +#define MV_JTI_FLOWIN 1394 +#define MV_MAN16_TAKEMUG 1362 +#define PIC_SC16_TUMBA 1368 +#define QU_BRD16_STARTBEARDED 4948 +#define QU_SC16_BOYKICK 1367 +#define QU_SC16_BOYOUT 1364 +#define QU_SC16_GIRLLAUGH 1375 +#define QU_SC16_GIRLOUT 1365 +#define QU_SC16_GOBOY 1347 +#define QU_SC16_GOGIRL 1348 +#define QU_SC16_MANDRINK 5200 +#define QU_SC16_SHOWMUG 1361 +#define QU_SC16_TAKEMUG 1435 +#define SND_16_034 3854 +#define SND_16_035 3855 +#define SND_16_037 3857 +#define ST_BOY_STAND 1331 +#define ST_GRL_LAUGH 1342 +#define ST_GRL_STAND 1337 +#define ST_MUG_EMPTY 1298 +#define ST_MUG_FULL 1360 + +// Scene 17 +#define ANI_BOOT_17 4220 +#define ANI_HAND17 1446 +#define ANI_INV_BOTTLE 1418 +#define ANI_INV_SUGAR 1410 +#define ANI_JET_17 2746 +#define ANI_MUG_17 2737 +#define ANI_SAMOGONSHCHIK 1397 +#define MSG_SC17_DROP 3414 +#define MSG_SC17_FILLBOTTLE 1436 +#define MSG_SC17_HIDESUGAR 1417 +#define MSG_SC17_SHOWBOTTLE 1432 +#define MSG_SC17_SHOWSUGAR 1416 +#define MSG_SC17_TESTTRUBA 1458 +#define MSG_SC17_UPDATEHAND 1560 +#define MV_HND17_FIGA 1449 +#define PIC_SC17_RTRUBA 1323 +#define PIC_SC17_RTRUBA2 5297 +#define QU_HND17_ASK 1456 +#define QU_HND17_ATTRACT 1455 +#define QU_HND17_TOCYCLE 1454 +#define QU_JET17_DROP 3295 +#define QU_JET17_FLOW 3294 +#define QU_SC17_FILLBOOT 4237 +#define QU_SC17_FILLBOTTLE 1437 +#define QU_SC17_FILLMUG 2750 +#define QU_SC17_FILLMUG_DROP 3415 +#define QU_SC17_SHOWBOTTLE 1429 +#define QU_SC17_SHOWSUGAR 1415 +#define QU_SMG_FILLBOTTLE 1433 +#define ST_HND17_ATTRACT 1451 +#define ST_HND17_EMPTY 1448 +#define ST_MUG17_EMPTY 2739 +#define ST_SMG_SIT 1399 + +// Scene 20 +#define ANI_GRANDMA_20 2427 +#define MSG_SC20_UPDATELOCKABLE 5217 +#define ST_GMA20_FLOOR 2429 +#define ST_GMA20_STAND 2436 +#define ST_GMA20_STOOL 2432 + +// Scene 21 +#define ANI_GIRAFFE_BOTTOM 1633 +#define ANI_INV_BOX 890 +#define ANI_INV_STOOL 1780 +#define MSG_SC21_UPDATEASS 4211 +#define PIC_SC21_DTRUBA 1823 +#define ST_GRFB_SIT 1687 +#define ST_GRFB_HANG 1638 + +// Scene 22 +#define ANI_GIRAFFE_MIDDLE 1981 +#define ANI_MESHOK 1754 +#define ANI_TABURETTE 1745 +#define MSG_SC22_CHECKGMABOOT 4782 +#define MSG_SC22_CRANEOUT_GMA 5218 +#define MSG_SC22_FROMSTOOL 1799 +#define MSG_SC22_HANDLEDOWN 1796 +#define MSG_SC22_HIDESTOOL 2503 +#define MSG_SC22_ONSTOOL 1798 +#define MSG_SC22_SHOWSTOOL 2495 +#define QU_MSH_CRANEOUT 1811 +#define QU_MSH_CRANEOUT_GMA 5219 +#define QU_SC22_FALLBROOM 1786 +#define QU_SC22_FALLSACK 1791 +#define QU_SC22_FALLSACK_GMA 2613 +#define QU_SC22_FROMSTOOL 1800 +#define QU_SC22_HANDLEDOWN 1804 +#define QU_SC22_PUTSTOOL 1803 +#define QU_SC22_SHOWSTOOL 1793 +#define QU_SC22_TOSTOOL 1801 +#define QU_SC22_TOSTOOL_R 3332 +#define QU_SC22_TRYBOX 5311 +#define QU_SC22_TRYHANDLE 1802 +#define QU_MSH_MOVE 1812 +#define rMV_MAN_TURN_SRL 1090 +#define ST_GRFM_AFTER 3472 +#define ST_GRFM_NORM 1983 +#define ST_MSH_SIT 1756 + +// Scene 23 +#define ANI_CALENDWHEEL 1702 +#define ANI_GIRAFFE_TOP 1645 +#define ANI_GIRAFFEE 1672 +#define ANI_HANDLE23 1978 +#define ANI_INV_LEVERHANDLE 1777 +#define ANI_LUK23_D 1813 +#define ANI_LUK23_U 1817 +#define MSG_SC23_CLICKBTN1 1736 +#define MSG_SC23_CLICKBTN2 1737 +#define MSG_SC23_CLICKBTN3 1738 +#define MSG_SC23_CLICKBTN4 1739 +#define MSG_SC23_FROMSTOOL 3339 +#define MSG_SC23_HIDEGIRAFFEE 4650 +#define MSG_SC23_ONSTOOL 3334 +#define MSG_SC23_SPINWHEEL1 1740 +#define MSG_SC23_SPINWHEEL2 1741 +#define MSG_SC23_SPINWHEEL3 1742 +#define MSG_SC23_SPINWHEEL4 1743 +#define MV_CND_0_1 1703 +#define MV_CND_1_2 1706 +#define MV_CND_2_3 1708 +#define MV_CND_3_4 1710 +#define MV_CND_4_5 1712 +#define MV_CND_5_6 1714 +#define MV_CND_6_7 1716 +#define MV_CND_7_8 1718 +#define MV_CND_8_9 1720 +#define MV_CND_9_0 1722 +#define MV_MAN23_PUSH1 1724 +#define MV_MAN23_PUSH2 1725 +#define MV_MAN23_PUSH3 1726 +#define MV_MAN23_PUSH4 1727 +#define PIC_SC23_BOXCLOSED 1728 +#define PIC_SC23_BOXOPEN 1723 +#define PIC_SC23_BTN1 1729 +#define PIC_SC23_BTN2 1730 +#define PIC_SC23_BTN3 1731 +#define PIC_SC23_BTN4 1732 +#define PIC_SC23_LADDER 1628 +#define PIC_SC23_LADDERU 3411 +#define QU_GRFU_TURN_UD 1664 +#define QU_GRFU_TURN_UL 1662 +#define QU_SC23_FROMCALENDAR 1734 +#define QU_SC23_FROMCALENDAREXIT 1735 +#define QU_SC23_FROMSTOOL 3338 +#define QU_SC23_SHOWSTOOL 3335 +#define QU_SC23_STARTKISS 1822 +#define QU_SC23_TOCALENDAR 1733 +#define ST_CND_0 1704 +#define ST_CND_1 1705 +#define ST_CND_2 1707 +#define ST_CND_3 1709 +#define ST_CND_4 1711 +#define ST_CND_5 1713 +#define ST_CND_6 1715 +#define ST_CND_7 1717 +#define ST_CND_8 1719 +#define ST_CND_9 1721 +#define ST_GRFG_BALD 1675 +#define ST_GRFG_EMPTY 1674 +#define ST_GRFU_KISS 1681 +#define ST_GRFU_UP 1648 +#define ST_LUK23_OPEN 1816 +#define ST_LUK23_WHANDLE2 1977 +#define ST_LUK23U_CLOSED 1819 +#define ST_LUK23U_OPEN 1820 + +// Scene 24 +#define ANI_DROP_24 3505 +#define ANI_INV_HAMMER 884 +#define ANI_JET24 1837 +#define ANI_WATER24 1834 +#define MV_MAN_TURN_RL 332 +#define MV_WTR24_FLOW 1835 +#define MV_WTR24_FLOWLOWER 1844 +#define MV_JET24_FLOW 1838 +#define QU_DRP24_TOFLOOR 3510 +#define QU_DRP24_TOWATER 3509 +#define QU_DRP24_TOWATER2 4046 +#define SND_24_006 4041 +#define SND_24_007 4042 +#define ST_DRP24_EMPTY 3507 +#define ST_WTR24_FLOWLOWER 1843 + +// Scene 25 +#define ANI_BEARDED_CMN 3420 +#define ANI_BOARD25 1898 +#define ANI_DROP_25 3499 +#define ANI_INV_BOARD 1872 +#define ANI_INV_BROOM 1774 +#define ANI_INV_LOPAT 1920 +#define ANI_INV_SWAB 1917 +#define ANI_WATER25 1856 +#define MSG_BRD_TURN 4877 +#define MSG_SC25_ENTERMAN 1861 +#define MSG_SC25_ENTERTRUBA 4214 +#define MSG_SC25_STARTBEARDEDS 3423 +#define MSG_SC25_STOPBEARDEDS 3424 +#define MSG_SC25_TOLADDER 4215 +#define MV_MAN_GOLADDERDOWN 455 +#define MV_MAN25_CHIH 1886 +#define rMV_MAN25_CHIH 3343 +#define MV_BRD25_RIGHT 1899 +#define rMV_BRD25_RIGHT 1903 +#define MV_MAN25_ONBOARD 1885 +#define rMV_MAN25_ONBOARD 1966 +#define MV_WTR25_FLOW 1857 +#define PIC_SC25_LADDERDOWN 1855 +#define PIC_SC25_LADDERUP 1854 +#define PIC_SC25_RTRUBA 1853 +#define QU_DRP25_TOFLOOR 3502 +#define QU_DRP25_TOWATER 3504 +#define QU_SC25_BACKTOLADDER 1955 +#define QU_SC25_BACKTOTRUBA 2061 +#define QU_SC25_BEARDED 3425 +#define QU_SC25_BEARDED2 3426 +#define QU_SC25_BEARDED3 3427 +#define QU_SC25_BOARDTOLADDER 1911 +#define QU_SC25_ENTERUP_FLOOR 1904 +#define QU_SC25_ENTERUP_WATER 1895 +#define QU_SC25_LADDERUP 1925 +#define QU_SC25_MANTOTRUBA 1905 +#define QU_SC25_MANTOTRUBA_R 4218 +#define QU_SC25_PUTBOARD 1896 +#define QU_SC25_ROWTOLADDER 1910 +#define QU_SC25_ROWTOTRUBA 1897 +#define QU_SC25_TRUBATOBOARD 1909 +#define QU_SC25_TRYBROOM 1912 +#define QU_SC25_TRYHAND 4219 +#define QU_SC25_TRYROWHAND 3493 +#define QU_SC25_TRYROWHAND_R 3494 +#define QU_SC25_TRYSPADE 3498 +#define QU_SC25_TRYSWAB 1913 +#define QU_SC25_TRYWATER 1906 +#define SND_25_006 4059 +#define SND_25_025 4874 +#define SND_25_026 4875 +#define SND_25_027 4876 +#define SND_25_028 5173 +#define SND_25_029 5174 +#define SND_25_030 5175 +#define ST_BRD25_RIGHT2 1902 +#define ST_BRDCMN_EMPTY 3422 +#define ST_DRP25_EMPTY 3501 +#define ST_MAN_GOLADDERD 456 +#define ST_MAN_LADDERDOWN_R 3419 +#define ST_MAN25_ONBOARD 1879 + +// Scene 26 +#define ANI_CHHI 1957 +#define ANI_DROP_26 3345 +#define ANI_INV_SOCK 1698 +#define ANI_INV_VENT 1968 +#define ANI_LUK26 1867 +#define ANI_SOCK_26 4553 +#define ANI_VENT 1927 +#define MSG_SC26_CLICKVENT 1947 +#define MSG_SC26_HIDECHI 1967 +#define MSG_SC26_HIDEVENT 1945 +#define MSG_SC26_SHOWCHI 3495 +#define MSG_SC26_SHOWVENT 1946 +#define MSG_SC26_TESTVENT 1952 +#define MSG_SC26_UPDATEDROP 3496 +#define MSG_SC26_UPDATEPOOL 1956 +#define PIC_SC26_LTRUBA 1864 +#define PIC_SC26_SOCK 5312 +#define QU_CHI_HIDE 1965 +#define QU_CHI_SHOW 1964 +#define QU_SC26_AUTOCLOSE1 1949 +#define QU_SC26_AUTOCLOSE2 1950 +#define QU_SC26_AUTOCLOSE3 1951 +#define QU_SC26_CLOSE1 1936 +#define QU_SC26_CLOSE2 1938 +#define QU_SC26_CLOSE3 1940 +#define QU_SC26_CLOSE4 1942 +#define QU_SC26_CLOSE5 1944 +#define QU_SC26_OPEN1 1935 +#define QU_SC26_OPEN2 1937 +#define QU_SC26_OPEN3 1939 +#define QU_SC26_OPEN4 1941 +#define QU_SC26_OPEN5 1943 +#define SND_26_003 4079 +#define SND_26_018 5340 +#define SND_26_019 5341 +#define SND_26_020 5342 +#define ST_CHI_EMPTY 1959 +#define ST_CHI_NORM 1960 +#define ST_VNT26_RIGHT2 3348 +#define ST_VNT26_UP2 1948 + +// Scene 28 +#define ANI_LIFT 982 +#define ANI_LIFT_28 4238 +#define MSG_SC28_CLICKLIFT 4258 +#define MSG_SC28_ENDCABIN 3456 +#define MSG_SC28_ENDLIFT1 4259 +#define MSG_SC28_ENDLIFT6 4244 +#define MSG_SC28_LIFT1_SHOWAFTER 4261 +#define MSG_SC28_LIFT6INSIDE 5354 +#define MSG_SC28_LIFT6MUSIC 5355 +#define MSG_SC28_MAKEFACES 4684 +#define MSG_SC28_STARTWORK1 4255 +#define MSG_SC28_TRYVTORPERS 4961 +#define MSG_SC28_TURNOFF_0 4678 +#define MSG_SC28_TURNOFF_1 4279 +#define MSG_SC28_TURNOFF_2 4277 +#define MSG_SC28_TURNOFF_3 4275 +#define MSG_SC28_TURNOFF_4 4282 +#define MSG_SC28_TURNOFF_6 4273 +#define MSG_SC28_TURNON4 4280 +#define MSG_SC28_TURNON_0 4677 +#define MSG_SC28_TURNON_1 4278 +#define MSG_SC28_TURNON_2 4276 +#define MSG_SC28_TURNON_3 4274 +#define MSG_SC28_TURNON_4 4281 +#define MSG_SC28_TURNON_6 4272 +#define PIC_SC28_DARK0 4675 +#define PIC_SC28_DARK1 4266 +#define PIC_SC28_DARK2 4267 +#define PIC_SC28_DARK3 4268 +#define PIC_SC28_DARK4 4269 +#define PIC_SC28_DARK5 4270 +#define PIC_SC28_DARK6 4271 +#define QU_SC28_LIFT0_START 4676 +#define QU_SC28_LIFT1_START 4254 +#define QU_SC28_LIFT2_START 4246 +#define QU_SC28_LIFT3_START 4245 +#define QU_SC28_LIFT5_START 4674 +#define QU_SC28_LIFT6_END 3563 +#define QU_SC28_LIFT6_START 4243 + +// Scene 30 +#define ANI_LEG 2322 +#define MSG_SC30_UPDATEPATH 2358 +#define PIC_SC30_LTRUBA 2354 +#define QU_SC30_ENTERLIFT 2823 +#define QU_SC30_EXITLIFT 2824 +#define ST_LEG_DOWN 2325 +#define ST_LEG_DOWN1 2330 +#define ST_LEG_DOWN2 2334 +#define ST_LEG_EMPTY 2338 +#define ST_LEG_UP 2324 + +// Scene 31 +#define LiftDown 1058 +#define LiftUp 1057 +#define ANI_CACTUS_31 2456 +#define MSG_SC31_PULL 2944 +#define MSG_SC31_TESTCACTUS 5095 +#define SND_31_001 4377 +#define ST_CTS31_GROWN2 2472 + +// Scene 36 +#define ANI_SCISSORS_36 2647 +#define ANI_ROTOHRUST 2360 +#define PIC_SC36_MASK 5221 +#define ST_RHT_OPEN 2362 + +// Debug scene +#define MSG_RESTARTGAME 4767 +#define PIC_SCD_1 727 +#define PIC_SCD_2 728 +#define PIC_SCD_3 729 +#define PIC_SCD_4 730 +#define PIC_SCD_5 731 +#define PIC_SCD_6 732 +#define PIC_SCD_7 733 +#define PIC_SCD_8 756 +#define PIC_SCD_9 907 +#define PIC_SCD_10 981 +#define PIC_SCD_11 1098 +#define PIC_SCD_12 857 +#define PIC_SCD_13 1195 +#define PIC_SCD_14 1224 +#define PIC_SCD_15 1278 +#define PIC_SCD_16 1299 +#define PIC_SCD_17 1305 +#define PIC_SCD_18 1306 +#define PIC_SCD_19 1319 +#define PIC_SCD_20 1622 +#define PIC_SCD_21 1623 +#define PIC_SCD_22 1624 +#define PIC_SCD_23 1625 +#define PIC_SCD_24 1845 +#define PIC_SCD_25 1846 +#define PIC_SCD_26 1847 +#define PIC_SCD_27 1916 +#define PIC_SCD_28 2098 +#define PIC_SCD_29 2099 +#define PIC_SCD_30 2359 +#define PIC_SCD_31 2566 +#define PIC_SCD_32 2312 +#define PIC_SCD_33 2636 +#define PIC_SCD_34 2389 +#define PIC_SCD_35 2412 +#define PIC_SCD_36 2567 +#define PIC_SCD_37 2568 +#define PIC_SCD_38 2228 +#define PIC_SCD_FIN 5026 +#define PIC_SCD_SEL 734 + } // End of namespace Fullpipe #endif /* FULLPIPE_CONSTANTS_H */ diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp index 384bfa2150..9e5ca7b3f1 100644 --- a/engines/fullpipe/floaters.cpp +++ b/engines/fullpipe/floaters.cpp @@ -22,23 +22,233 @@ #include "fullpipe/fullpipe.h" #include "fullpipe/floaters.h" +#include "fullpipe/utils.h" +#include "fullpipe/objects.h" +#include "fullpipe/motion.h" +#include "fullpipe/statics.h" +#include "fullpipe/scene.h" +#include "fullpipe/constants.h" +#include "fullpipe/objectnames.h" namespace Fullpipe { +Floaters::~Floaters() { + delete _hRgn; +} + void Floaters::init(GameVar *var) { - warning("STUB: Floaters::init()"); + _array1.clear(); + _array2.clear(); + + GameVar *varFliers = var->getSubVarByName(sO_Fliers); + + if (!varFliers) + return; + + GameVar *sub = varFliers->getSubVarByName("flyIdleRegion"); + + if (sub) { + _hRgn = new ReactPolygonal(); + + _hRgn->_pointCount = sub->getSubVarsCount(); + _hRgn->_points = (Common::Point **)malloc(sizeof(Common::Point *) * _hRgn->_pointCount); + + sub = sub->_subVars; + + int idx = 0; + + while (sub) { + _hRgn->_points[idx] = new Common::Point; + _hRgn->_points[idx]->x = sub->_subVars->_value.intValue; + _hRgn->_points[idx]->y = sub->_subVars->_nextVarObj->_value.intValue; + + idx++; + sub = sub->_nextVarObj; + } + } + + sub = varFliers->getSubVarByName("flyIdlePath"); + + if (sub) { + _array1.reserve(sub->getSubVarsCount()); + + sub = sub->_subVars; + + int idx = 0; + + while (sub) { + FloaterArray1 *f = new FloaterArray1; + + f->val1 = sub->_subVars->_value.intValue; + f->val2 = sub->_subVars->_nextVarObj->_value.intValue; + + _array1.push_back(f); + + idx++; + sub = sub->_nextVarObj; + } + + } } -void Floaters::genFlies(Scene *sc, int x, int y, int a5, int a6) { - warning("STUB: Floaters::genFlies()"); +void Floaters::genFlies(Scene *sc, int x, int y, int priority, int flags) { + StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_FLY, -1)); + + ani->_statics = ani->getStaticsById(ST_FLY_FLY); + ani->_movement = 0; + ani->setOXY(x, y); + ani->_flags |= 4; + ani->_priority = priority; + + sc->addStaticANIObject(ani, 1); + + ani->startAnim(MV_FLY_FLY, 0, -1); + + int nummoves; + + if (ani->_movement->_currMovement) + nummoves = ani->_movement->_currMovement->_dynamicPhases.size(); + else + nummoves = ani->_movement->_dynamicPhases.size(); + + ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(nummoves - 1)); + + FloaterArray2 *arr2 = new FloaterArray2; + + arr2->ani = ani; + arr2->val11 = 15.0; + arr2->val3 = y; + arr2->val5 = y; + arr2->val2 = x; + arr2->val4 = x; + arr2->fflags = flags; + + _array2.push_back(arr2); } void Floaters::update() { - warning("STUB: Floaters::update()"); + for (uint i = 0; i < _array2.size(); ++i) { + if (_array2[i]->val13 <= 0) { + if (_array2[i]->val4 != _array2[i]->val2 || _array2[i]->val5 != _array2[i]->val3) { + if (_array2[i]->val9 < 2.0) + _array2[i]->val9 = 2.0; + + int dy = _array2[i]->val3 - _array2[i]->val5; + int dx = _array2[i]->val2 - _array2[i]->val4; + double dst = sqrt((double)(dy * dy + dx * dx)); + double at = atan2((double)dx, (double)dy); + int newX = (int)(cos(at) * _array2[i]->val9); + int newY = (int)(sin(at) * _array2[i]->val9); + + if (dst < _array2[i]->val9) { + newX = _array2[i]->val2 - _array2[i]->val4; + newY = _array2[i]->val3 - _array2[i]->val5; + } + if (dst <= 30.0) { + if (dst < 30.0) { + _array2[i]->val9 = _array2[i]->val9 - _array2[i]->val9 * 0.5; + + if (_array2[i]->val9 < 2.0) + _array2[i]->val9 = 2.0; + } + } else { + _array2[i]->val9 = _array2[i]->val9 * 0.5 + _array2[i]->val9; + + if (_array2[i]->val9 > _array2[i]->val11) + _array2[i]->val9 = _array2[i]->val11; + } + + _array2[i]->val4 += newX; + _array2[i]->val5 += newY; + _array2[i]->ani->setOXY(newX + _array2[i]->ani->_ox, newY + _array2[i]->ani->_oy); + + if (_array2[i]->val4 == _array2[i]->val2 && _array2[i]->val5 == _array2[i]->val3) { + _array2[i]->val9 = 0.0; + + _array2[i]->val13 = g_fp->_rnd->getRandomNumber(200) + 20; + + if (_array2[i]->fflags & 1) { + g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani); + + if (_array2[i]->ani) + delete _array2[i]->ani; + + _array2.remove_at(i); + + i--; + + if (!_array2.size()) + g_fp->stopAllSoundInstances(SND_CMN_060); + + continue; + } + } + } else { + if ((_array2[i]->fflags & 4) && _array2[i]->countdown < 1) { + _array2[i]->fflags |= 1; + _array2[i]->val2 = _array2[i]->val6; + _array2[i]->val3 = _array2[i]->val7; + } else { + if (_array2[i]->fflags & 2) { + int idx1 = g_fp->_rnd->getRandomNumber(_array1.size() - 1); + + _array2[i]->val2 = _array1[idx1]->val1; + _array2[i]->val3 = _array1[idx1]->val2; + } else { + Common::Rect rect; + + if (!_hRgn) + error("Floaters::update(): empty fliers region"); + + _hRgn->getBBox(&rect); + + int x2 = rect.left + g_fp->_rnd->getRandomNumber(rect.right - rect.left); + int y2 = rect.top + g_fp->_rnd->getRandomNumber(rect.bottom - rect.top); + + if (_hRgn->pointInRegion(x2, y2)) { + int dx = _array2[i]->val2 - x2; + int dy = _array2[i]->val3 - y2; + double dst = sqrt((double)(dy * dy + dx * dx)); + + if (dst < 300.0 || !_hRgn->pointInRegion(_array2[i]->val4, _array2[i]->val5)) { + _array2[i]->val2 = x2; + _array2[i]->val3 = y2; + } + } + } + + g_fp->playSound(SND_CMN_061, 0); + + if (_array2[i]->fflags & 4) + _array2[i]->countdown--; + } + } + } else { + _array2[i]->val13--; + } + + if (!_array2[i]->ani->_movement && _array2[i]->ani->_statics->_staticsId == ST_FLY_FLY) { + if (!_array2[i]->val15) { + g_fp->playSound(SND_CMN_060, 1); + + _array2[i]->val15 = 1; + } + + _array2[i]->ani->startAnim(MV_FLY_FLY, 0, -1); + } + } } void Floaters::stopAll() { - warning("STUB: Floaters::stopAll()"); + for (uint i = 0; i < _array2.size(); i++) { + g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani); + + delete _array2[i]->ani; + } + + _array2.clear(); + + g_fp->stopAllSoundInstances(SND_CMN_060); } diff --git a/engines/fullpipe/floaters.h b/engines/fullpipe/floaters.h index a4d64dd79d..3ecbbeea9c 100644 --- a/engines/fullpipe/floaters.h +++ b/engines/fullpipe/floaters.h @@ -27,10 +27,13 @@ namespace Fullpipe { class StaticANIObject; class Scene; +class ReactPolygonal; struct FloaterArray1 { int val1; int val2; + + FloaterArray1() { val1 = 0; val2 = 0; } }; struct FloaterArray2 { @@ -48,16 +51,21 @@ struct FloaterArray2 { int countdown; int val15; int fflags; + + FloaterArray2() : ani(0), val2(0), val3(0), val4(0), val5(0), val6(0), val7(0), val8(0), + val9(0.0), val11(0.0), val13(0), countdown(0), val15(0), fflags(0) {} }; class Floaters { public: - //HRGN hRgn; + ReactPolygonal *_hRgn; Common::Array<FloaterArray1 *> _array1; Common::Array<FloaterArray2 *> _array2; + Floaters() { _hRgn = 0; } + ~Floaters(); void init(GameVar *var); - void genFlies(Scene *sc, int x, int y, int a5, int a6); + void genFlies(Scene *sc, int x, int y, int priority, int flags); void update(); void stopAll(); }; diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index a0348a9407..674dada0b9 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -94,6 +94,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _isProcessingMessages = false; _musicAllowed = -1; + _musicGameVar = 0; _aniMan = 0; _aniMan2 = 0; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 5e4389af7b..7c7ac0525e 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -238,6 +238,7 @@ public: Scene *accessScene(int sceneId); void setSceneMusicParameters(GameVar *var); int convertScene(int scene); + int getSceneEntrance(int scene); int getSceneFromTag(int tag); NGIArchive *_currArchive; @@ -272,6 +273,8 @@ public: void lift_startExitQueue(); void lift_sub05(ExCommand *ex); + GameVar *_musicGameVar; + Audio::SoundHandle _sceneTrackHandle; public: bool _isSaveAllowed; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 57c1b23f66..64e6b93fb2 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -510,7 +510,7 @@ InputController *FullpipeEngine::getGameLoaderInputController() { return 0; } -MotionController *getCurrSceneSc2MotionController() { +MctlCompound *getCurrSceneSc2MotionController() { return getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId); } diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 074537500c..4cfb803d8e 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -111,7 +111,7 @@ class GameLoader : public CObject { Inventory2 *getGameLoaderInventory(); InteractionController *getGameLoaderInteractionController(); MctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId); -MotionController *getCurrSceneSc2MotionController(); +MctlCompound *getCurrSceneSc2MotionController(); } // End of namespace Fullpipe diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 8b2aca4bdb..435a06d63b 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -129,8 +129,8 @@ void Background::addPictureObject(PictureObject *pct) { pct->renumPictures(&_picObjList); bool inserted = false; - for (uint i = 0; i < _picObjList.size(); i++) { - if (((PictureObject *)_picObjList[i])->_priority == pct->_priority) { + for (uint i = 1; i < _picObjList.size(); i++) { + if (((PictureObject *)_picObjList[i])->_priority <= pct->_priority) { _picObjList.insert_at(i, pct); inserted = true; break; @@ -329,8 +329,8 @@ void GameObject::renumPictures(PtrList *lst) { int *buf = (int *)calloc(lst->size() + 2, sizeof(int)); for (uint i = 0; i < lst->size(); i++) { - if (_id == ((PictureObject *)((*lst)[i]))->_id) - buf[((PictureObject *)((*lst)[i]))->_okeyCode] = 1; + if (_id == ((GameObject *)((*lst)[i]))->_id) + buf[((GameObject *)((*lst)[i]))->_okeyCode] = 1; } if (buf[_okeyCode]) { diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp index 4cf5fbef61..f661340665 100644 --- a/engines/fullpipe/init.cpp +++ b/engines/fullpipe/init.cpp @@ -84,7 +84,7 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_Lever_23, getObjectEnumState(sO_Lever_23, sO_NotTaken)); setObjectState(sO_LeverHandle_23, getObjectEnumState(sO_LeverHandle_23, sO_WithoutStool)); setObjectState(sO_LowerPipe_21, getObjectEnumState(sO_LowerPipe_21, sO_IsClosed)); - setObjectState(sO_StarsDown_24, getObjectEnumState(sO_StarsDown_24, sO_IsOpened)); + setObjectState(sO_StairsDown_24, getObjectEnumState(sO_StairsDown_24, sO_IsOpened)); setObjectState(sO_Hatch_26, getObjectEnumState(sO_Hatch_26, sO_Closed)); setObjectState(sO_Sock_26, getObjectEnumState(sO_Sock_26, sO_NotHanging)); setObjectState(sO_LeftPipe_26, getObjectEnumState(sO_LeftPipe_26, sO_IsClosed)); @@ -94,7 +94,7 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_Valve4_26, getObjectEnumState(sO_Valve4_26, sO_Closed)); setObjectState(sO_Valve5_26, getObjectEnumState(sO_Valve5_26, sO_Opened)); setObjectState(sO_Pool, getObjectEnumState(sO_Pool, sO_Overfull)); - setObjectState(sO_Plank_25, getObjectEnumState(sO_Plank_25, sO_NearDudesStairs)); + setObjectState(sO_Board_25, getObjectEnumState(sO_Board_25, sO_NearDudesStairs)); setObjectState(sO_Driver, getObjectEnumState(sO_Driver, sO_WithSteering)); setObjectState(sO_Janitress, getObjectEnumState(sO_Janitress, sO_WithMop)); setObjectState(sO_LeftPipe_29, getObjectEnumState(sO_LeftPipe_29, sO_IsClosed)); diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index a9872a5a23..44a3e4cb60 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -42,7 +42,7 @@ void global_messageHandler_KickMetal() { } int global_messageHandler1(ExCommand *cmd) { - debug(0, "global_messageHandler1: %d %d", cmd->_messageKind, cmd->_messageNum); + debug(5, "global_messageHandler1: %d %d", cmd->_messageKind, cmd->_messageNum); if (cmd->_excFlags & 0x10000) { if (cmd->_messageNum == MV_MAN_TOLADDER) @@ -306,6 +306,7 @@ int global_messageHandler3(ExCommand *cmd) { case 17: switch (cmd->_messageNum) { case 61: + debug(0, "preload: { %d, %d },", cmd->_parentId, cmd->_keyCode); return g_fp->_gameLoader->preloadScene(cmd->_parentId, cmd->_keyCode); case 62: return g_fp->_gameLoader->gotoScene(cmd->_parentId, cmd->_keyCode); @@ -647,7 +648,7 @@ int global_messageHandler4(ExCommand *cmd) { g_fp->_currentScene->_messageQueueId = cmd->_parId; } } else { - g_fp->_sceneRect.moveTo(offX, offY); + g_fp->_sceneRect.translate(offX - g_fp->_sceneRect.left, offY - g_fp->_sceneRect.top); g_fp->_currentScene->_x = 0; g_fp->_currentScene->_y = 0; diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 8ca416bb9e..4665712ca0 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -41,7 +41,10 @@ ExCommand::ExCommand(ExCommand *src) : Message(src) { _messageNum = src->_messageNum; _excFlags = src->_excFlags; _parId = src->_parId; +} +ExCommand *ExCommand::createClone() { + return new ExCommand(this); } ExCommand::ExCommand(int16 parentId, int messageKind, int messageNum, int x, int y, int a7, int a8, int sceneClickX, int sceneClickY, int a11) : @@ -78,6 +81,8 @@ bool ExCommand::load(MfcArchive &file) { _parId = file.readUint32LE(); } + _objtype = kObjTypeExCommand; + return true; } @@ -120,6 +125,61 @@ void ExCommand::handle() { } } +void ExCommand::setf3c(int val) { + if (val != -1) + _field_3C = val; + + _field_34 = 1; +} + +void ExCommand::firef34() { + if (_field_34) { + if (_field_3C >= _keyCode) { + _field_34 = 0; + + sendMessage(); + + if (!_field_30 ) + setf3c(_field_2C); + } + } +} + +ExCommand2::ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) { + _objtype = kObjTypeExCommand2; + + _pointsSize = pointsSize; + _points = (Common::Point **)malloc(sizeof(Common::Point *) * pointsSize); + + for (int i = 0; i < pointsSize; i++) { + _points[i] = new Common::Point; + + *_points[i] = *points[i]; + } +} + +ExCommand2::ExCommand2(ExCommand2 *src) : ExCommand(src) { + _pointsSize = src->_pointsSize; + _points = (Common::Point **)malloc(sizeof(Common::Point *) * _pointsSize); + + for (int i = 0; i < _pointsSize; i++) { + _points[i] = new Common::Point; + + *_points[i] = *src->_points[i]; + } +} + +ExCommand2::~ExCommand2() { + for (int i = 0; i < _pointsSize; i++) + delete _points[i]; + + free(_points); +} + +ExCommand2 *ExCommand2::createClone() { + return new ExCommand2(this); +} + Message::Message() { _messageKind = 0; _parentId = 0; @@ -219,7 +279,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) { _field_38 = (field_38 == 0); for (Common::List<ExCommand *>::iterator it = src->_exCommands.begin(); it != src->_exCommands.end(); ++it) { - ExCommand *ex = new ExCommand(*it); + ExCommand *ex = (*it)->createClone(); ex->_excFlags |= 2; _exCommands.push_back(ex); @@ -234,6 +294,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) { _id = g_fp->_globalMessageQueueList->compact(); _dataId = src->_dataId; _flags = src->_flags; + _queueName = 0; g_fp->_globalMessageQueueList->addMessageQueue(this); @@ -330,6 +391,10 @@ void MessageQueue::addExCommandToEnd(ExCommand *ex) { _exCommands.push_back(ex); } +void MessageQueue::insertExCommandAt(int pos, ExCommand *ex) { + warning("STUB: MessageQueue::insertExCommandAt()"); +} + ExCommand *MessageQueue::getExCommandByIndex(uint idx) { if (idx >= getCount()) return 0; diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 44245bcf19..7f708383e3 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -57,7 +57,6 @@ class Message : public CObject { class ExCommand : public Message { public: - int _messageNum; int _field_3C; int _excFlags; @@ -70,16 +69,27 @@ class ExCommand : public Message { virtual bool load(MfcArchive &file); + virtual ExCommand *createClone(); + bool handleMessage(); void sendMessage(); void postMessage(); void handle(); + + void firef34(); + void setf3c(int val); }; class ExCommand2 : public ExCommand { public: Common::Point **_points; int _pointsSize; + + ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize); + ExCommand2(ExCommand2 *src); + virtual ~ExCommand2(); + + virtual ExCommand2 *createClone(); }; class ObjstateCommand : public CObject { @@ -124,6 +134,7 @@ class MessageQueue : public CObject { void addExCommand(ExCommand *ex); void addExCommandToEnd(ExCommand *ex); + void insertExCommandAt(int pos, ExCommand *ex); ExCommand *getExCommandByIndex(uint idx); void deleteExCommandByIndex(uint idx, bool doFree); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 516d761aa2..6db916ae4f 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -28,6 +28,9 @@ #include "fullpipe/scenes.h" #include "fullpipe/gameloader.h" +#include "graphics/palette.h" +#include "video/avi_decoder.h" + namespace Fullpipe { ModalIntro::ModalIntro() { @@ -224,8 +227,41 @@ void ModalIntro::finish() { g_fp->_gameLoader->updateSystems(42); } -void ModalVideoPlayer::play(const char *fname) { - warning("STUB: ModalVideoPlayer::play(%s)", fname); +void ModalVideoPlayer::play(const char *filename) { + // TODO: Videos are encoded using Intel Indeo 5 (IV50), which isn't supported yet + + Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(); + + if (!aviDecoder->loadFile(filename)) + return; + + uint16 x = (g_system->getWidth() - aviDecoder->getWidth()) / 2; + uint16 y = (g_system->getHeight() - aviDecoder->getHeight()) / 2; + bool skipVideo = false; + + aviDecoder->start(); + + while (!g_fp->shouldQuit() && !aviDecoder->endOfVideo() && !skipVideo) { + if (aviDecoder->needsUpdate()) { + const Graphics::Surface *frame = aviDecoder->decodeNextFrame(); + if (frame) { + g_fp->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); + + if (aviDecoder->hasDirtyPalette()) + g_fp->_system->getPaletteManager()->setPalette(aviDecoder->getPalette(), 0, 256); + + g_fp->_system->updateScreen(); + } + } + + Common::Event event; + while (g_fp->_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + g_fp->_system->delayMillis(aviDecoder->getTimeToNextFrame()); + } } void FullpipeEngine::openMap() { diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index 6f8fbe2c71..55be5a7a34 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -24,6 +24,7 @@ MODULE_OBJS = \ stateloader.o \ statics.o \ utils.o \ + scenes/sceneIntro.o \ scenes/scene01.o \ scenes/scene02.o \ scenes/scene03.o \ @@ -35,9 +36,23 @@ MODULE_OBJS = \ scenes/scene10.o \ scenes/scene11.o \ scenes/scene12.o \ + scenes/scene13.o \ + scenes/scene14.o \ scenes/scene15.o \ - scenes/sceneDbg.o \ - scenes/sceneIntro.o + scenes/scene16.o \ + scenes/scene17.o \ + scenes/scene20.o \ + scenes/scene21.o \ + scenes/scene22.o \ + scenes/scene23.o \ + scenes/scene24.o \ + scenes/scene25.o \ + scenes/scene26.o \ + scenes/scene28.o \ + scenes/scene30.o \ + scenes/scene31.o \ + scenes/scene36.o \ + scenes/sceneDbg.o # This module can be built as a plugin ifeq ($(ENABLE_FULLPIPE), DYNAMIC_PLUGIN) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 45ff4ae5f0..42dd60a3aa 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -47,7 +47,39 @@ void MotionController::enableLinks(const char *linkName, bool enable) { } MovGraphLink *MotionController::getLinkByName(const char *name) { - warning("STUB: MotionController::getLinkByName()"); + if (_objtype == kObjTypeMctlCompound) { + MctlCompound *obj = (MctlCompound *)this; + + for (uint i = 0; i < obj->getMotionControllerCount(); i++) { + MotionController *con = obj->getMotionController(i); + + if (con->_objtype == kObjTypeMovGraph) { + MovGraph *gr = (MovGraph *)con; + + for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) { + assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*l; + + if (!strcmp(lnk->_name, name)) + return lnk; + } + } + } + } + + if (_objtype == kObjTypeMovGraph) { + MovGraph *gr = (MovGraph *)this; + + for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) { + assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*l; + + if (!strcmp(lnk->_name, name)) + return lnk; + } + } return 0; } @@ -178,7 +210,7 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos, if (mq) { for (uint i = 0; i < closestP->_messageQueueObj->getCount(); i++) { - ex = new ExCommand(closestP->_messageQueueObj->getExCommandByIndex(i)); + ex = closestP->_messageQueueObj->getExCommandByIndex(i)->createClone(); ex->_excFlags |= 2; mq->addExCommandToEnd(ex); } @@ -359,7 +391,7 @@ MctlConnectionPoint::~MctlConnectionPoint() { } MovInfo1::MovInfo1(MovInfo1 *src) { - field_0 = src->field_0; + index = src->index; pt1 = src->pt1; pt2 = src->pt2; distance1 = src->distance1; @@ -372,7 +404,7 @@ MovInfo1::MovInfo1(MovInfo1 *src) { } void MovInfo1::clear() { - field_0 = 0; + index = 0; pt1.x = pt1.y = 0; pt2.x = pt2.y = 0; distance1 = 0; @@ -864,10 +896,10 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { if (i >= movInfo->itemsCount - 2 || movInfo->items[i + 2]->subIndex != 10) { movinfo.flags = 0; - mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex]; + mg2i = &_items2[movInfo->index]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex]; } else { movinfo.flags = 2; - mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex]; + mg2i = &_items2[movInfo->index]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex]; } if (i < movInfo->itemsCount - 2 || (movInfo->items[i]->x == movInfo->items[i + 1]->x @@ -877,10 +909,10 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { || movInfo->items[i + 1]->x == -1 || movInfo->items[i + 1]->y == -1) { - ExCommand *ex = new ExCommand(_items2[movInfo->field_0]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0); + ExCommand *ex = new ExCommand(_items2[movInfo->index]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0); ex->_excFlags |= 2; - ex->_keyCode = _items2[movInfo->field_0]->_obj->_okeyCode; + ex->_keyCode = _items2[movInfo->index]->_obj->_okeyCode; ex->_field_24 = 1; ex->_field_14 = -1; mq->addExCommandToEnd(ex); @@ -892,7 +924,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { memset(&mgminfo, 0, sizeof(mgminfo)); - mgminfo.ani = _items2[movInfo->field_0]->_obj; + mgminfo.ani = _items2[movInfo->index]->_obj; mgminfo.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId; mgminfo.x1 = movInfo->items[i + 1]->x; mgminfo.y1 = movInfo->items[i + 1]->y; @@ -935,13 +967,13 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { || movInfo->items[i + 2]->subIndex == movInfo->items[i + 3]->subIndex) { movinfo.flags &= 3; } else { - MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex]; + MG2I *m = &_items2[movInfo->index]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex]; movinfo.pt2.x -= m->_mx; movinfo.pt2.y -= m->_my; movinfo.flags &= 3; } } else { - MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex]; + MG2I *m = &_items2[movInfo->index]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex]; if (movinfo.item1Index && movinfo.item1Index != 1) { movinfo.pt2.y -= m->_my; @@ -1347,10 +1379,205 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common return node3->_x >= node2->_x; } -MessageQueue *MovGraph2::genMovement(MovInfo1 *movinfo) { - warning("STUB: MovGraph2::genMovement()"); +MessageQueue *MovGraph2::genMovement(MovInfo1 *info) { + int mx1 = 0; + int my1 = 0; - return 0; + if (!(info->flags & 2)) { + mx1 = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mx; + my1 = _items2[info->index]->_subItems[info->subIndex]._walk[0]._my; + } + + int mx2 = 0; + int my2 = 0; + + if (!(info->flags & 4)) { + mx2 = _items2[info->index]->_subItems[info->subIndex]._walk[2]._mx; + my2 = _items2[info->index]->_subItems[info->subIndex]._walk[2]._my; + } + + Common::Point point; + + int y = info->pt2.y - info->pt1.y - my2 - my1; + int x = info->pt2.x - info->pt1.x - mx2 - mx1; + int a2; + int mgmLen; + + _mgm.calcLength(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1); + + int x1 = point.x; + int y1 = point.y; + + if (!(info->flags & 1)) { + if (info->subIndex == 1 || info->subIndex == 0) { + a2 = -1; + x1 = mgmLen * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mx; + x = x1; + info->pt2.x = x1 + info->pt1.x + mx1 + mx2; + } + } + + if (!(info->flags & 1)) { + if (info->subIndex == 2 || info->subIndex == 3) { + a2 = -1; + y1 = mgmLen * _items2[info->index]->_subItems[info->subIndex]._walk[1]._my; + y = y1; + info->pt2.y = y1 + info->pt1.y + my1 + my2; + } + } + + int cntX = 0; + int cntY = 0; + + if (!(info->flags & 2)) { + cntX = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov->countPhasesWithFlag(-1, 1); + cntY = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov->countPhasesWithFlag(-1, 2); + } + + if (mgmLen > 1) { + cntX += (mgmLen - 1) * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(-1, 1); + cntY += (mgmLen - 1) * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(-1, 2); + } + + if (mgmLen > 0) { + cntX += _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(a2, 1); + cntY += _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(a2, 2); + } + + if (!(info->flags & 4)) { + cntX += _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov->countPhasesWithFlag(-1, 1); + cntY += _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov->countPhasesWithFlag(-1, 2); + } + + int dx1 = x - x1; + int dy1 = y - y1; + + if (cntX) + x1 = (int)((double)dx1 / (double)cntX); + else + x1 = 0; + + if (cntY) + y1 = (int)((double)dy1 / (double)cntY); + else + y1 = 0; + + int v34 = dx1 - cntX * x1; + int v35 = dy1 - cntY * y1; + Common::Point x2; + Common::Point y2(v34, v35); + + if (v34) + x2.x = v34 / abs(v34); + else + x2.x = 0; + + if (v35) + x2.y = v35 / abs(v35); + else + x2.y = 0; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex; + + if (info->flags & 2) { + ex = new ExCommand( + _items2[info->index]->_objectId, + 5, + _items2[info->index]->_subItems[info->subIndex]._walk[1]._movementId, + info->pt1.x, + info->pt1.y, + 0, + 1, + 0, + 0, + 0); + + ex->_field_14 = info->distance1; + + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + ex->_field_24 = 1; + ex->_excFlags |= 2; + } else { + ex = new ExCommand( + _items2[info->index]->_objectId, + 5, + _items2[info->index]->_subItems[info->subIndex]._walk[0]._movementId, + info->pt1.x, + info->pt1.y, + 0, + 1, + 0, + 0, + 0); + + ex->_field_14 = info->distance1; + + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + ex->_field_24 = 1; + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = _mgm.buildExCommand2( + _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov, + _items2[info->index]->_objectId, + x1, + y1, + &x2, + &y2, + -1); + ex->_parId = mq->_id; + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + } + + mq->addExCommandToEnd(ex); + + for (int i = 0; i < mgmLen; ++i) { + int par; + + if (i == mgmLen - 1) + par = a2; + else + par = -1; + + ex = _mgm.buildExCommand2( + _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, + _items2[info->index]->_objectId, + x1, + y1, + &x2, + &y2, + par); + ex->_parId = mq->_id; + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + mq->addExCommandToEnd(ex); + } + + if (!(info->flags & 4)) { + ex = _mgm.buildExCommand2( + _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov, + _items2[info->index]->_objectId, + x1, + y1, + &x2, + &y2, + -1); + ex->_parId = mq->_id; + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + + mq->addExCommandToEnd(ex); + } + + ex = new ExCommand(_items2[info->index]->_objectId, 5, -1, info->pt2.x, info->pt2.y, 0, 1, 0, 0, 0); + ex->_field_14 = info->distance2; + + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + ex->_field_24 = 0; + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + + return mq; } MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { @@ -1673,6 +1900,64 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { return 0; } +Common::Point *MGM::calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag) { + warning("STUB: MGM::calcLength()"); + + return point; +} + +ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) { + uint cnt; + + if (mov->_currMovement) + cnt = mov->_currMovement->_dynamicPhases.size(); + else + cnt = mov->_dynamicPhases.size(); + + if (len > 0 && cnt > (uint)len) + cnt = len; + + Common::Point **points = (Common::Point **)malloc(sizeof(Common::Point *) * cnt); + + for (uint i = 0; i < cnt; i++) { + int flags = mov->getDynamicPhaseByIndex(i)->getDynFlags(); + + points[i] = new Common::Point; + + if (flags & 1) { + points[i]->x = x1 + x2->x; + + y2->x -= x2->x; + + if (!y2->x) + x2->x = 0; + } + + if (flags & 2) { + points[i]->y = y1 + x2->y; + + y2->y -= x2->y; + + if ( !y2->y ) + x2->y = 0; + } + } + + ExCommand2 *ex = new ExCommand2(20, objId, points, cnt); + ex->_excFlags = 2; + ex->_messageNum = mov->_id; + ex->_field_14 = len; + ex->_field_24 = 1; + ex->_keyCode = -1; + + for (uint i = 0; i < cnt; i++) + delete points[i]; + + free(points); + + return ex; +} + MovGraphLink::MovGraphLink() { _distance = 0; _angle = 0; @@ -1762,7 +2047,7 @@ void ReactParallel::createRegion() { for (int i = 0; i < 4; i++) _points[i] = new Common::Point; - double at = atan2((double)(_x1 - _x2), (double)(_y1 - _y2)) + 1.570796; + double at = atan2((double)(_x1 - _x2), (double)(_y1 - _y2)) + 1.570796; // pi/2 double sn = sin(at); double cs = cos(at); @@ -1782,20 +2067,28 @@ void ReactParallel::createRegion() { // GdiObject::Attach(_rgn, CreatePolygonRgn(_points, 4, 2); } -void ReactParallel::method14() { - warning("STUB: ReactParallel::method14()"); +void ReactParallel::setCenter(int x1, int y1, int x2, int y2) { + _x1 = x1; + _y1 = y1; + _x2 = x2; + _y2 = y2; } ReactPolygonal::ReactPolygonal() { - _field_C = 0; - _field_10 = 0; + _centerX = 0; + _centerY = 0; + _bbox = 0; +} + +ReactPolygonal::~ReactPolygonal() { + delete _bbox; } bool ReactPolygonal::load(MfcArchive &file) { debug(5, "ReactPolygonal::load()"); - _field_C = file.readUint32LE(); - _field_10 = file.readUint32LE(); + _centerX = file.readUint32LE(); + _centerY = file.readUint32LE(); _pointCount = file.readUint32LE(); if (_pointCount > 0) { @@ -1822,10 +2115,54 @@ void ReactPolygonal::createRegion() { } } -void ReactPolygonal::method14() { - warning("STUB: ReactPolygonal::method14()"); +void ReactPolygonal::setCenter(int x1, int y1, int x2, int y2) { + int cX = (x2 + x1) / 2; + int cY = (y2 + y1) / 2; + + if (_points) { + for (int i = 0; i < _pointCount; i++) { + _points[i]->x += cX - _centerX; + _points[i]->y += cY - _centerY; + } + } + + _centerX = cX; + _centerY = cY; } +void ReactPolygonal::getBBox(Common::Rect *rect) { + if (!_pointCount) + return; + + if (_bbox) { + *rect = *_bbox; + return; + } + + rect->left = _points[0]->x; + rect->top = _points[0]->y; + rect->right = _points[0]->x; + rect->bottom = _points[0]->y; + + for (int i = 1; i < _pointCount; i++) { + if (rect->left > _points[i]->x) + rect->left = _points[i]->x; + + if (rect->top < _points[i]->y) + rect->top = _points[i]->y; + + if (rect->right < _points[i]->x) + rect->right = _points[i]->x; + + if (rect->bottom > _points[i]->y) + rect->bottom = _points[i]->y; + } + + _bbox = new Common::Rect; + *_bbox = *rect; +} + + bool MovGraphReact::pointInRegion(int x, int y) { if (_pointCount < 3) { return false; @@ -1877,7 +2214,11 @@ int startWalkTo(int objId, int objKey, int x, int y, int a5) { } int doSomeAnimation(int objId, int objKey, int a3) { - warning("STUB: doSomeAnimation(%d, %d, %d)", objId, objKey, a3); + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(objId, objKey); + MctlCompound *cmp = getCurrSceneSc2MotionController(); + + if (ani && cmp) + return cmp->method3C(ani, a3); return 0; } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 24f047d76b..cecde70775 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -29,6 +29,8 @@ class Statics; class Movement; class MctlConnectionPoint; class MovGraphLink; +class MessageQueue; +class ExCommand2; int startWalkTo(int objId, int objKey, int x, int y, int a5); int doSomeAnimation(int objId, int objKey, int a3); @@ -74,7 +76,7 @@ public: MovGraphReact() : _pointCount(0), _points(0) {} ~MovGraphReact() { free(_points); } - virtual void method14() {} + virtual void setCenter(int x1, int y1, int x2, int y2) {} virtual void createRegion() {} virtual bool pointInRegion(int x, int y); }; @@ -115,6 +117,9 @@ public: void initMovGraph2(); MctlConnectionPoint *findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr); void replaceNodeX(int from, int to); + + uint getMotionControllerCount() { return _motionControllers.size(); } + MotionController *getMotionController(int num) { return _motionControllers[num]->_motionControllerObj; } }; struct MGMSubItem { @@ -170,6 +175,8 @@ public: int getStaticsIndexById(int idx, int16 id); void clearMovements2(int idx); int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); + Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag); + ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); }; struct MctlLadderMovementVars { @@ -240,25 +247,29 @@ class ReactParallel : public MovGraphReact { int _dx; int _dy; - public: +public: ReactParallel(); virtual bool load(MfcArchive &file); - virtual void method14(); + virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); }; class ReactPolygonal : public MovGraphReact { - //CRgn _rgn; - int _field_C; - int _field_10; + Common::Rect *_bbox; + int _centerX; + int _centerY; - public: +public: ReactPolygonal(); + ~ReactPolygonal(); + virtual bool load(MfcArchive &file); - virtual void method14(); + virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); + + void getBBox(Common::Rect *rect); }; class MovGraphLink : public CObject { @@ -363,7 +374,7 @@ struct MovInfo1Sub { }; struct MovInfo1 { - int field_0; + int index; Common::Point pt1; Common::Point pt2; int distance1; diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h index 87442d990a..c33750ff6b 100644 --- a/engines/fullpipe/objectnames.h +++ b/engines/fullpipe/objectnames.h @@ -32,13 +32,14 @@ namespace Fullpipe { #define sO_Pool "\xc1\xe0\xf1\xf1\xe5\xe9\xed" // "Бассейн" #define sO_TummyTrampie "\xc1\xe0\xf2\xf3\xf2\xe0" // "Батута" #define sO_WithoutBoot "\xc1\xe5\xe7 \xe1\xee\xf2\xe8\xed\xea\xe0" // "Без ботинка" -#define sO_WithoutJug "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Без горшков" +#define sO_WithoutJugs "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Без горшков" #define sO_WithoutCarpet "\xc1\xe5\xe7 \xea\xee\xe2\xf0\xe8\xea\xe0" // "Без коврика" #define sO_WithoutCoin "\xc1\xe5\xe7 \xec\xee\xed\xe5\xf2\xfb" // "Без монеты" #define sO_WithNothing "\xc1\xe5\xe7 \xed\xe8\xf7\xe5\xe3\xee" // "Без ничего" #define sO_WithoutHandle "\xc1\xe5\xe7 \xf0\xf3\xf7\xea\xe8" // "Без ручки" #define sO_WithoutStool "\xc1\xe5\xe7 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xe8" // "Без табуретки" #define sO_WithoutDrawer "\xc1\xe5\xe7 \xff\xf9\xe8\xea\xe0" // "Без ящика" +#define sO_Nearby "\xc1\xeb\xe8\xe7\xea\xee" // "Близко" #define sO_Blocked "\xc1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed" // "Блокирован" #define sO_BlockedShe "\xc1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed\xe0" // "Блокирована" #define sO_Awaken "\xc1\xee\xe4\xf0\xf1\xf2\xe2\xf3\xe5\xf2" // "Бодрствует" @@ -52,6 +53,7 @@ namespace Fullpipe { #define sO_In_15_1 "\xc2_15_1" // "В_15_1" #define sO_In_15_2 "\xc2_15_2" // "В_15_2" #define sO_In_15_3 "\xc2_15_3" // "В_15_3" +#define sO_In_16 "\xc2_16" // "В_16" #define sO_In_32_Lies "\xc2_32 \xeb\xe5\xe6\xe8\xf2" // "В_32 лежит" #define sO_In_32_Stands "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "В_32 торчит" #define sO_In_33 "\xc2_33" // "В_33" @@ -77,10 +79,11 @@ namespace Fullpipe { #define sO_Jug "\xc3\xee\xf0\xf8\xee\xea" // "Горшок" #define sO_Strolling "\xc3\xf3\xeb\xff\xe5\xf2" // "Гуляет" #define sO_Yes "\xc4\xe0" // "Да" +#define sO_FarAway "\xc4\xe0\xeb\xe5\xea\xee" // "Далеко" #define sO_Girl "\xc4\xe5\xe2\xee\xf7\xea\xe0" // "Девочка" #define sO_Elephantine "\xc4\xe5\xe2\xee\xf7\xea\xe0-\xf1\xeb\xee\xed\xe8\xea" // "Девочка-слоник" #define sO_Grandpa "\xc4\xe5\xe4\xf3\xf8\xea\xe0" // "Дедушка" -#define sO_Plank_25 "\xc4\xee\xf1\xea\xe0_25" // "Доска_25" +#define sO_Board_25 "\xc4\xee\xf1\xea\xe0_25" // "Доска_25" #define sO_Plank_34 "\xc4\xee\xf1\xea\xe0_34" // "Доска_34" #define sO_DudeHasJumped "\xc4\xff\xe4\xff \xef\xf0\xfb\xe3\xe0\xeb" // "Дядя прыгал" #define sO_Dude "\xc4\xff\xe4\xff" // "Дядя" @@ -114,7 +117,7 @@ namespace Fullpipe { #define sO_LeftPipe_29 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_29" // "Левая труба_29" #define sO_LeftPipe_30 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_30" // "Левая труба_30" #define sO_LeftPipe_37 "\xcb\xe5\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_37" // "Левая труба_37" -#define sO_StarsDown_24 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xe2\xed\xe8\xe7_24" // "Лестница вниз_24" +#define sO_StairsDown_24 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xe2\xed\xe8\xe7_24" // "Лестница вниз_24" #define sO_StairsUp_8 "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0 \xf1\xe2\xe5\xf0\xf5\xf3_8" // "Лестница сверху_8" #define sO_Stairway "\xcb\xe5\xf1\xf2\xed\xe8\xf6\xe0" // "Лестница" #define sO_Fliers "\xcb\xe5\xf2\xf3\xed\xfb" // "Летуны" @@ -165,7 +168,7 @@ namespace Fullpipe { #define sO_FullPipe "\xcf\xee\xeb\xed\xe0\xff \xd2\xf0\xf3\xe1\xe0" // "Полная Труба" #define sO_RightStairs_9 "\xcf\xf0\xe0\xe2\xe0\xff \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe0_9" // "Правая лестница_9" #define sO_RightPipe_17 "\xcf\xf0\xe0\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_17" // "Правая труба_17" -#define sO_Available "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Присутствует" +#define sO_IsPresent "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "Присутствует" #define sO_GulpedEgg "\xcf\xf0\xee\xe3\xeb\xee\xf7\xe5\xed\xed\xee\xe5 \xff\xe9\xf6\xee" // "Проглоченное яйцо" #define sO_GulpedEggs "\xcf\xf0\xee\xe3\xeb\xee\xf7\xe5\xed\xed\xfb\xe5 \xff\xe9\xf6\xe0" // "Проглоченные яйца" #define sO_BellyInflater "\xcf\xf3\xe7\xee\xe4\xf3\xe2" // "Пузодув" @@ -175,7 +178,7 @@ namespace Fullpipe { #define sO_IsDrinking "\xcf\xfc\xe5\xf2" // "Пьет" #define sO_Broken "\xd0\xe0\xe7\xe1\xe8\xf2\xe0" // "Разбита" #define sO_Unblocked "\xd0\xe0\xe7\xe1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed" // "Разблокирован" -#define sO_Unfolded "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2" // "Развернут" +#define sO_Unconvoluted "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2" // "Развернут" #define sO_Jawcrucnher "\xd0\xee\xf2\xee\xf5\xf0\xf3\xf1" // "Ротохрус" #define sO_UsherHand "\xd0\xf3\xea\xe0 \xc1\xe8\xeb\xe5\xf2\xe5\xf0\xf8\xe8" // "Рука Билетерши" #define sO_LeverHandle_23 "\xd0\xf3\xea\xee\xff\xf2\xea\xe0 \xf0\xfb\xf7\xe0\xe3\xe0_23" // "Рукоятка рычага_23" @@ -189,7 +192,7 @@ namespace Fullpipe { #define sO_WithJug "\xd1 \xe3\xee\xf0\xf8\xea\xee\xec" // "С горшком" #define sO_WithGum "\xd1 \xe6\xe2\xe0\xf7\xea\xee\xe9" // "С жвачкой" #define sO_WithShovel "\xd1 \xeb\xee\xef\xe0\xf2\xee\xe9" // "С лопатой" -#define sO_WithTiny "\xd1 \xec\xe0\xeb\xfb\xec" // "С малым" +#define sO_WithSmall "\xd1 \xec\xe0\xeb\xfb\xec" // "С малым" #define sO_WithHammer "\xd1 \xec\xee\xeb\xee\xf2\xea\xee\xec" // "С молотком" #define sO_WithCoin "\xd1 \xec\xee\xed\xe5\xf2\xee\xe9" // "С монетой" #define sO_WithSock "\xd1 \xed\xee\xf1\xea\xee\xec" // "С носком" @@ -202,8 +205,8 @@ namespace Fullpipe { #define sO_Convoluted "\xd1\xe2\xe5\xf0\xed\xf3\xf2" // "Свернут" #define sO_IsFree "\xd1\xe2\xee\xe1\xee\xe4\xed\xe0" // "Свободна" #define sO_IsSitting "\xd1\xe8\xe4\xe8\xf2" // "Сидит" -#define sO_Laughing "\xd1\xec\xe5\xe5\xf2\xf1\xff" // "Смеется" -#define sO_WithEveryone "\xd1\xee \xe2\xf1\xe5\xec\xe8" // "Со всеми" +#define sO_IsLaughing "\xd1\xec\xe5\xe5\xf2\xf1\xff" // "Смеется" +#define sO_WithAll "\xd1\xee \xe2\xf1\xe5\xec\xe8" // "Со всеми" #define sO_WithMop "\xd1\xee \xf8\xe2\xe0\xe1\xf0\xee\xe9" // "Со шваброй" #define sO_WithHose "\xd1\xee \xf8\xeb\xe0\xed\xe3\xee\xec" // "Со шлангом" #define sO_WithBrush "\xd1\xee \xf9\xe5\xf2\xea\xee\xe9" // "Со щеткой" @@ -221,14 +224,15 @@ namespace Fullpipe { #define sO_Pedestal_17 "\xd2\xf3\xec\xe1\xe0_17" // "Тумба_17" #define sO_Pedestal_33 "\xd2\xf3\xec\xe1\xe0_33" // "Тумба_33" #define sO_NearDudesStairs "\xd3 \xc4\xff\xe4\xe8 \xed\xe0 \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe5" // "У Дяди на лестнице" -#define sO_NearDude "\xd3 \xc4\xff\xe4\xe8" // "У Дяди" +#define sO_DudeHas "\xd3 \xc4\xff\xe4\xe8" // "У Дяди" #define sO_NearPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9" // "У трубы с табуреткой" #define sO_NearPipe "\xd3 \xf2\xf0\xf3\xe1\xfb" // "У трубы" #define sO_Janitors "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8" // "Уборщики" #define sO_Janitress "\xd3\xe1\xee\xf0\xf9\xe8\xf6\xe0" // "Уборщица" #define sO_IsGone "\xd3\xe5\xf5\xe0\xeb\xe0" // "Уехала" +#define sO_FallenTwice "\xd3\xef\xe0\xeb \xe4\xe2\xe0" // "Упал два" #define sO_FallenOnce "\xd3\xef\xe0\xeb \xf0\xe0\xe7" // "Упал раз" -#define sO_FallenBrush "\xd3\xef\xe0\xeb\xe0 \xf9\xe5\xf2\xea\xe0" // "Упала щетка" +#define sO_BrushHasFallen "\xd3\xef\xe0\xeb\xe0 \xf9\xe5\xf2\xea\xe0" // "Упала щетка" #define sO_NotBroken "\xd6\xe5\xeb\xe0" // "Цела" #define sO_IsScratchingBelly "\xd7\xe5\xf8\xe5\xf2 \xef\xf3\xe7\xee" // "Чешет пузо" #define sO_Level0 "\xdd\xf2\xe0\xe6 0" // "Этаж 0" diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 558a90978a..928bd5cf2e 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -442,8 +442,16 @@ bool Scene::compareObjPriority(const void *p1, const void *p2) { return false; } -void Scene::objectList_sortByPriority(PtrList &list) { - Common::sort(list.begin(), list.end(), Scene::compareObjPriority); +void Scene::objectList_sortByPriority(PtrList &list, bool skipFirst) { + if (skipFirst) { + PtrList::iterator s = list.begin(); + + ++s; + + Common::sort(s, list.end(), Scene::compareObjPriority); + } else { + Common::sort(list.begin(), list.end(), Scene::compareObjPriority); + } } void Scene::draw() { @@ -608,7 +616,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { debug(8, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); if (_picObjList.size() > 2) { // We need to z-sort them - objectList_sortByPriority(_picObjList); + objectList_sortByPriority(_picObjList, true); } if (minPri == -1 && _picObjList.size()) diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index db0da5db31..b8defe2d06 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -79,7 +79,7 @@ class Scene : public Background { private: static bool compareObjPriority(const void *p1, const void *p2); - void objectList_sortByPriority(PtrList &list); + void objectList_sortByPriority(PtrList &list, bool skipFirst = false); }; class SceneTag : public CObject { diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 96d9cba54f..4482225c2a 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -166,34 +166,160 @@ Vars::Vars() { scene11_boots = 0; scene11_dudeOnSwing = 0; scene11_hint = 0; - scene11_var02 = 0; - scene11_var03 = 0; - scene11_var04 = 0; - scene11_var05 = 0; - scene11_var06 = 0; - scene11_var07 = 0; - scene11_var08 = 1.0; - scene11_var09 = 1.0; - scene11_var10 = 1.0; - scene11_var11 = 1.0; - scene11_var12 = 0.0; - scene11_var13 = 0; - scene11_var14 = 0; - scene11_var15 = 0; - scene11_var16 = 0; - scene11_var17 = 0; - scene11_var18 = 0; - scene11_var19 = 0; - scene11_var20 = 0; + scene11_arcadeIsOn = false; + scene11_scrollIsEnabled = false; + scene11_scrollIsMaximized = false; + scene11_hintCounter = 0; + scene11_swingieScreenEdge = 0; + scene11_crySound = 0; + scene11_swingAngle = 1.0; + scene11_swingOldAngle = 1.0; + scene11_swingSpeed = 1.0; + scene11_swingAngleDiff = 1.0; + scene11_swingInertia = 0.0; + scene11_swingCounter = 0; + scene11_swingCounterPrevTurn = 0; + scene11_swingDirection = 0; + scene11_swingDirectionPrevTurn = 0; + scene11_swingIsSwinging = false; + scene11_swingieStands = false; + scene11_dudeX = 0; + scene11_dudeY = 0; + scene11_swingMaxAngle = 45; scene12_fly = 0; scene12_flyCountdown = 0; + scene13_whirlgig = 0; + scene13_guard = 0; + scene13_handleR = 0; + scene13_handleL = 0; + scene13_bridge = 0; + scene13_guardDirection = false; + scene13_dudeX = 0; + + scene14_grandma = 0; + scene14_sceneDeltaX = 0; + scene14_sceneDeltaY = 0; + scene14_arcadeIsOn = false; + scene14_dudeIsKicking = false; + scene14_ballIsFlying = false; + scene14_dudeCanKick = false; + scene14_sceneDiffX = 0; + scene14_sceneDiffY = 0; + scene14_pink = 0; + scene14_flyingBall = 0; + scene14_balls.clear(); + scene14_grandmaIsHere = false; + scene14_dudeX = 0; + scene14_dudeY = 0; + scene14_grandmaX = 0; + scene14_grandmaY = 0; + scene14_dude2X = 0; + scene14_ballDeltaX = 0; + scene14_ballDeltaY = 0; + scene14_ballX = 0; + scene14_ballY = 0; + scene14_hitsLeft = 0; + scene15_chantingCountdown = 0; scene15_plusminus = 0; scene15_ladder = 0; scene15_boot = 0; + scene16_figures.clear(); + scene16_walkingBoy = 0; + scene16_walkingGirl = 0; + scene16_walkingCount = 0; + scene16_wire = 0; + scene16_mug = 0; + scene16_jettie = 0; + scene16_boot = 0; + scene16_girlIsLaughing = false; + scene16_sound = 0; + scene16_placeIsOccupied = false; + + scene17_flyState = 0; + scene17_sugarIsShown = false; + scene17_sceneOldEdgeX = 0; + scene17_flyCountdown = 0; + scene17_hand = 0; + scene17_handPhase = false; + scene17_sceneEdgeX = 0; + + scene20_fliesCountdown = 0; + scene20_grandma = 0; + + scene21_giraffeBottom = 0; + scene21_giraffeBottomX = 0; + scene21_giraffeBottomY = 0; + scene21_pipeIsOpen = false; + scene21_wigglePos = 0.0; + scene21_wiggleTrigger = 0; + + scene22_bag = 0; + scene22_giraffeMiddle = 0; + scene22_dudeIsOnStool = false; + scene22_interactionIsDisabled = false; + scene22_craneIsOut = true; + scene22_numBagFalls = 1; + + scene23_calend0 = 0; + scene23_calend1 = 0; + scene23_calend2 = 0; + scene23_calend3 = 0; + scene23_topReached = false; + scene23_isOnStool = false; + scene23_someVar = 0; + scene23_giraffeTop = 0; + scene23_giraffee = 0; + + scene24_jetIsOn = false; + scene24_flowIsLow = false; + scene24_waterIsOn = false; + scene24_water = 0; + scene24_jet = 0; + scene24_drop = 0; + + scene25_water = 0; + scene25_board = 0; + scene25_drop = 0; + scene25_dudeIsOnBoard = false; + scene25_waterIsPresent = false; + scene25_boardIsSelectable = false; + scene25_beardersAreThere = false; + scene25_beardersCounter = 0; + scene25_bearders.clear(); + scene25_sneezeFlipper = false; + + scene26_chhi = 0; + scene26_drop = 0; + scene26_sockPic = 0; + scene26_sock = 0; + scene26_activeVent = 0; + + scene28_var01 = 0; + scene28_var02 = 0; + scene28_var03 = 0; + scene28_var04 = 0; + scene28_var05 = 1; + scene28_var06 = 1; + scene28_var07 = 0; + scene28_var08 = 0; + scene28_var09 = 0; + scene28_var10 = 0; + scene28_var11 = 0; + + scene30_leg = 0; + scene30_liftFlag = 1; + + scene31_chantingCountdown = 0; + scene31_cactus = 0; + scene31_plusMinus = 0; + + scene36_rotohrust = 0; + scene36_scissors = 0; + selector = 0; } @@ -201,19 +327,34 @@ static int scenes[] = { SC_1, SC_2, SC_3, SC_4, SC_5, SC_6, SC_7, SC_8, SC_9, SC_10, SC_11, SC_12, SC_13, SC_14, SC_15, SC_16, SC_17, SC_18, SC_19, SC_20, SC_21, SC_22, SC_23, SC_24, SC_25, SC_26, SC_27, SC_28, SC_29, SC_30, - SC_31, SC_32, SC_33, SC_34, SC_35, SC_36, SC_37, SC_38, SC_DBGMENU + SC_31, SC_32, SC_33, SC_34, SC_35, SC_36, SC_37, SC_38, SC_FINAL1, SC_DBGMENU +}; + +static int scenesD[] = { + PIC_SCD_1, PIC_SCD_2, PIC_SCD_3, PIC_SCD_4, PIC_SCD_5, PIC_SCD_6, PIC_SCD_7, PIC_SCD_8, PIC_SCD_9, PIC_SCD_10, + PIC_SCD_11, PIC_SCD_12, PIC_SCD_13, PIC_SCD_14, PIC_SCD_15, PIC_SCD_16, PIC_SCD_17, PIC_SCD_18, PIC_SCD_19, PIC_SCD_20, + PIC_SCD_21, PIC_SCD_22, PIC_SCD_23, PIC_SCD_24, PIC_SCD_25, PIC_SCD_26, PIC_SCD_27, PIC_SCD_28, PIC_SCD_29, PIC_SCD_30, + PIC_SCD_31, PIC_SCD_32, PIC_SCD_33, PIC_SCD_34, PIC_SCD_35, PIC_SCD_36, PIC_SCD_37, PIC_SCD_38, PIC_SCD_FIN, 0 }; int FullpipeEngine::convertScene(int scene) { if (!scene || scene >= SC_1) return scene; - if (scene < 1 || scene > 39) + if (scene < 1 || scene > 40) return SC_1; return scenes[scene - 1]; } +int FullpipeEngine::getSceneEntrance(int scene) { + for (int i = 0; i < 40; i++) + if (scenes[i] == scene) + return scenesD[i]; + + return 0; +} + int FullpipeEngine::getSceneFromTag(int tag) { for (int i = 0; i < ARRAYSIZE(scenes); i++) { if (scenes[i] == tag) @@ -435,7 +576,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene10_updateCursor; break; -#if 0 case SC_11: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_11"); scene->preloadMovements(sceneVar); @@ -447,7 +587,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene11_setupMusic(); _updateCursorCallback = scene11_updateCursor; break; -#endif case SC_12: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_12"); @@ -460,7 +599,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = defaultUpdateCursor; break; -#if 0 case SC_13: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_13"); scene->preloadMovements(sceneVar); @@ -480,10 +618,9 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_14"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler14, 2, 2); - scene14_sub_41D2B0(); + scene14_setupMusic(); _updateCursorCallback = scene14_updateCursor; break; -#endif case SC_15: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_15"); @@ -496,7 +633,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene15_updateCursor; break; -#if 0 case SC_16: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_16"); scene->preloadMovements(sceneVar); @@ -516,10 +652,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_17"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler17, 2); - scene17_sub_41F060(); + scene17_restoreState(); _updateCursorCallback = scene17_updateCursor; break; +#if 0 case SC_18: sub_40E1B0(); sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_18"); @@ -560,6 +697,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene19_sub_4211D0(scene); _updateCursorCallback = scene19_updateCursor; break; +#endif case SC_20: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_20"); @@ -590,7 +728,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_22"); setSceneMusicParameters(sceneVar); - scene22_sub_4228A0(); + scene22_setBagState(); insertMessageHandler(sceneHandler22, 2, 2); _updateCursorCallback = scene22_updateCursor; break; @@ -603,7 +741,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_23"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler23, 2, 2); - scene23_sub_423B00(); + scene23_setGiraffeState(); _updateCursorCallback = scene23_updateCursor; break; @@ -615,19 +753,19 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_24"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler24, 2); - scene24_sub_423DD0(); + scene24_setPoolState(); _updateCursorCallback = defaultUpdateCursor; break; case SC_25: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_25"); scene->preloadMovements(sceneVar); - scene25_initScene(scene, entrance->field_4); + scene25_initScene(scene, entrance->_field_4); _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_25"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler25, 2); - scene25_sub_4253B0(scene, entrance->field_4); + scene25_setupWater(scene, entrance->_field_4); _updateCursorCallback = scene25_updateCursor; break; @@ -639,10 +777,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_26"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler26, 2, 2); - scene26_sub_426140(scene); + scene26_setupDrop(scene); _updateCursorCallback = scene26_updateCursor; break; +#if 0 case SC_27: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_27"); scene->preloadMovements(sceneVar); @@ -653,6 +792,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler27, 2); _updateCursorCallback = scene27_updateCursor; break; +#endif case SC_28: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_28"); @@ -665,6 +805,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene28_updateCursor; break; +#if 0 case SC_29: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_29"); scene->preloadMovements(sceneVar); @@ -675,11 +816,12 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler29, 2); _updateCursorCallback = scene29_updateCursor; break; +#endif case SC_30: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30"); scene->preloadMovements(sceneVar); - scene30_initScene(scene, entrance->field_4); + scene30_initScene(scene, entrance->_field_4); _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_30"); setSceneMusicParameters(sceneVar); @@ -698,6 +840,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = defaultUpdateCursor; break; +#if 0 case SC_32: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_32"); scene->preloadMovements(sceneVar); @@ -744,6 +887,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { insertMessageHandler(sceneHandler35, 2, 2); _updateCursorCallback = defaultUpdateCursor; break; +#endif case SC_36: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_36"); @@ -756,6 +900,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene36_updateCursor; break; +#if 0 case SC_37: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_37"); scene->preloadMovements(sceneVar); @@ -800,8 +945,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { break; default: - _behaviorManager->initBehavior(0, 0); - error("Unknown scene %d", entrance->_sceneId); break; } diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 270c2038b0..ab5e18654f 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -72,13 +72,81 @@ void scene10_initScene(Scene *sc); int sceneHandler10(ExCommand *cmd); int scene10_updateCursor(); +void scene11_initScene(Scene *sc); +void scene11_setupMusic(); +int sceneHandler11(ExCommand *cmd); +int scene11_updateCursor(); + void scene12_initScene(Scene *sc); int sceneHandler12(ExCommand *ex); +void scene13_initScene(Scene *sc); +int sceneHandler13(ExCommand *ex); + +void scene14_initScene(Scene *sc); +void scene14_setupMusic(); +int sceneHandler14(ExCommand *cmd); +int scene14_updateCursor(); + int scene15_updateCursor(); void scene15_initScene(Scene *sc); int sceneHandler15(ExCommand *cmd); +void scene16_initScene(Scene *sc); +int sceneHandler16(ExCommand *cmd); +int scene16_updateCursor(); + +void scene17_initScene(Scene *sc); +void scene17_restoreState(); +int sceneHandler17(ExCommand *cmd); +int scene17_updateCursor(); + +void scene20_initScene(Scene *sc); +int sceneHandler20(ExCommand *ex); + +int scene21_updateCursor(); +void scene21_initScene(Scene *sc); +int sceneHandler21(ExCommand *cmd); + +void scene22_initScene(Scene *sc); +void scene22_setBagState(); +int sceneHandler22(ExCommand *cmd); +int scene22_updateCursor(); + +void scene23_initScene(Scene *sc); +void scene23_setGiraffeState(); +int sceneHandler23(ExCommand *cmd); +int scene23_updateCursor(); + +void scene24_initScene(Scene *sc); +void scene24_setPoolState(); +int sceneHandler24(ExCommand *cmd); + +void scene25_initScene(Scene *sc, int entrance); +void scene25_setupWater(Scene *sc, int entrance); +int sceneHandler25(ExCommand *cmd); +int scene25_updateCursor(); + +void scene26_initScene(Scene *sc); +void scene26_setupDrop(Scene *sc); +int sceneHandler26(ExCommand *cmd); +int scene26_updateCursor(); + +void scene28_initScene(Scene *sc); + int sceneHandler28(ExCommand *ex); +int scene28_updateCursor(); + +int scene30_updateCursor(); +void scene30_initScene(Scene *sc, int flag); +int sceneHandler30(ExCommand *cmd); + +void scene31_initScene(Scene *sc); +int sceneHandler31(ExCommand *ex); + +int scene36_updateCursor(); +void scene36_initScene(Scene *sc); +int sceneHandler36(ExCommand *cmd); + void sceneDbgMenu_initScene(Scene *sc); int sceneHandlerDbgMenu(ExCommand *cmd); @@ -224,35 +292,162 @@ public: StaticANIObject *scene11_boots; StaticANIObject *scene11_dudeOnSwing; PictureObject *scene11_hint; - MGM scene11_var01; - int scene11_var02; - int scene11_var03; - int scene11_var04; - int scene11_var05; - int scene11_var06; - int scene11_var07; - double scene11_var08; - double scene11_var09; - double scene11_var10; - double scene11_var11; - double scene11_var12; - int scene11_var13; - int scene11_var14; - int scene11_var15; - int scene11_var16; - int scene11_var17; - int scene11_var18; - int scene11_var19; - int scene11_var20; + MGM scene11_mgm; + bool scene11_arcadeIsOn; + bool scene11_scrollIsEnabled; + bool scene11_scrollIsMaximized; + int scene11_hintCounter; + int scene11_swingieScreenEdge; + int scene11_crySound; + double scene11_swingAngle; + double scene11_swingOldAngle; + double scene11_swingSpeed; + double scene11_swingAngleDiff; + double scene11_swingInertia; + int scene11_swingCounter; + int scene11_swingCounterPrevTurn; + int scene11_swingDirection; + int scene11_swingDirectionPrevTurn; + bool scene11_swingIsSwinging; + bool scene11_swingieStands; + int scene11_dudeX; + int scene11_dudeY; + int scene11_swingMaxAngle; int scene12_fly; int scene12_flyCountdown; + StaticANIObject *scene13_whirlgig; + StaticANIObject *scene13_guard; + StaticANIObject *scene13_handleR; + StaticANIObject *scene13_handleL; + StaticANIObject *scene13_bridge; + bool scene13_guardDirection; + int scene13_dudeX; + + StaticANIObject *scene14_grandma; + int scene14_sceneDeltaX; + int scene14_sceneDeltaY; + bool scene14_arcadeIsOn; + bool scene14_dudeIsKicking; + bool scene14_ballIsFlying; + bool scene14_dudeCanKick; + int scene14_sceneDiffX; + int scene14_sceneDiffY; + StaticANIObject *scene14_pink; + StaticANIObject *scene14_flyingBall; + Common::List<StaticANIObject *> scene14_balls; + bool scene14_grandmaIsHere; + int scene14_dudeX; + int scene14_dudeY; + int scene14_grandmaX; + int scene14_grandmaY; + int scene14_dude2X; + int scene14_ballDeltaX; + int scene14_ballDeltaY; + int scene14_ballX; + int scene14_ballY; + int scene14_hitsLeft; + Common::Point scene14_mouseCursorPos; + int scene15_chantingCountdown; StaticANIObject *scene15_plusminus; PictureObject *scene15_ladder; StaticANIObject *scene15_boot; + Common::List<StaticANIObject *> scene16_figures; + StaticANIObject *scene16_walkingBoy; + StaticANIObject *scene16_walkingGirl; + int scene16_walkingCount; + StaticANIObject *scene16_wire; + StaticANIObject *scene16_mug; + StaticANIObject *scene16_jettie; + StaticANIObject *scene16_boot; + bool scene16_girlIsLaughing; + int scene16_sound; + bool scene16_placeIsOccupied; + + int scene17_flyState; + bool scene17_sugarIsShown; + int scene17_sceneOldEdgeX; + int scene17_flyCountdown; + StaticANIObject *scene17_hand; + bool scene17_handPhase; + int scene17_sceneEdgeX; + + int scene20_fliesCountdown; + StaticANIObject *scene20_grandma; + + StaticANIObject *scene21_giraffeBottom; + int scene21_giraffeBottomX; + int scene21_giraffeBottomY; + int scene21_pipeIsOpen; + double scene21_wigglePos; + bool scene21_wiggleTrigger; + + StaticANIObject *scene22_bag; + StaticANIObject *scene22_giraffeMiddle; + bool scene22_dudeIsOnStool; + bool scene22_interactionIsDisabled; + bool scene22_craneIsOut; + int scene22_numBagFalls; + + StaticANIObject *scene23_calend0; + StaticANIObject *scene23_calend1; + StaticANIObject *scene23_calend2; + StaticANIObject *scene23_calend3; + bool scene23_topReached; + bool scene23_isOnStool; + int scene23_someVar; + StaticANIObject *scene23_giraffeTop; + StaticANIObject *scene23_giraffee; + + bool scene24_jetIsOn; + bool scene24_flowIsLow; + bool scene24_waterIsOn; + StaticANIObject *scene24_water; + StaticANIObject *scene24_jet; + StaticANIObject *scene24_drop; + + StaticANIObject *scene25_water; + StaticANIObject *scene25_board; + StaticANIObject *scene25_drop; + bool scene25_dudeIsOnBoard; + bool scene25_waterIsPresent; + bool scene25_boardIsSelectable; + bool scene25_beardersAreThere; + int scene25_beardersCounter; + Common::Array<StaticANIObject *> scene25_bearders; + bool scene25_sneezeFlipper; + + StaticANIObject *scene26_chhi; + StaticANIObject *scene26_drop; + PictureObject *scene26_sockPic; + StaticANIObject *scene26_sock; + StaticANIObject *scene26_activeVent; + + int scene28_var01; + int scene28_var02; + int scene28_var03; + int scene28_var04; + int scene28_var05; + int scene28_var06; + PictureObject *scene28_var07; + PictureObject *scene28_var08; + int scene28_var09; + int scene28_var10; + int scene28_var11; + + StaticANIObject *scene30_leg; + int scene30_liftFlag; + + int scene31_chantingCountdown; + StaticANIObject *scene31_cactus; + StaticANIObject *scene31_plusMinus; + + StaticANIObject *scene36_rotohrust; + StaticANIObject *scene36_scissors; + PictureObject *selector; }; diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index fa9f4ceef0..332935072c 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -298,7 +298,7 @@ void sceneHandler04_walkClimbLadder(ExCommand *ex) { ExCommand *ex3; if (ex) { - ex3 = new ExCommand(ex); + ex3 = ex->createClone(); } else { ex3 = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0); ex3->_excFlags |= 3; @@ -498,7 +498,7 @@ void sceneHandler04_gotoLadder(ExCommand *ex) { mq->addExCommandToEnd(ex3); if (ex) { - ExCommand *ex4 = new ExCommand(ex); + ExCommand *ex4 = ex->createClone(); mq->addExCommandToEnd(ex4); } @@ -630,7 +630,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) { MessageQueue *mq2 = mgm.genMovement(&mgminfo); if (mq1 && mq2) { - mq1->addExCommandToEnd(new ExCommand(mq2->getExCommandByIndex(0))); + mq1->addExCommandToEnd(mq2->getExCommandByIndex(0)->createClone()); delete mq2; @@ -890,7 +890,7 @@ void sceneHandler04_animOutOfBottle(ExCommand *ex) { MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC4_MANFROMBOTTLE), 0, 0); if (ex) { - ExCommand *newex = new ExCommand(ex); + ExCommand *newex = ex->createClone(); mq->addExCommandToEnd(newex); } @@ -1066,7 +1066,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) { MessageQueue *mq = g_vars->scene04_ladder->controllerWalkTo(g_fp->_aniMan, 0); if (mq) { - mq->addExCommandToEnd(new ExCommand(ex)); + mq->addExCommandToEnd(ex->createClone()); if (mq->chain(g_fp->_aniMan) ) ex->_messageKind = 0; @@ -1099,7 +1099,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) { ex1->_excFlags |= 2; mq->addExCommandToEnd(ex1); - ex1 = new ExCommand(ex); + ex1 = ex->createClone(); mq->addExCommandToEnd(ex1); mq->setFlags(mq->getFlags() | 1); diff --git a/engines/fullpipe/scenes/scene08.cpp b/engines/fullpipe/scenes/scene08.cpp index ada63ef22d..716ca1f593 100644 --- a/engines/fullpipe/scenes/scene08.cpp +++ b/engines/fullpipe/scenes/scene08.cpp @@ -282,7 +282,7 @@ void sceneHandler08_finishArcade() { void sceneHandler08_jumpOff(ExCommand *cmd) { MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); - mq->addExCommandToEnd(new ExCommand(cmd)); + mq->addExCommandToEnd(cmd->createClone()); mq->setFlags(mq->getFlags() | 1); g_fp->_globalMessageQueueList->addMessageQueue(mq); diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp index 240eccf61b..e7ed947a00 100644 --- a/engines/fullpipe/scenes/scene11.cpp +++ b/engines/fullpipe/scenes/scene11.cpp @@ -37,7 +37,55 @@ namespace Fullpipe { void scene11_dudeSwingCallback(int *arg) { - warning("STUB: scene11_dudeSwingCallback()"); + int oldarg = *arg; + + *arg = 45 - (int)(g_vars->scene11_swingAngle * -29.66666666666666); + + if (*arg < 1) + *arg = 1; + + if (*arg > 90) + *arg = 90; + + g_vars->scene11_swingAngleDiff = (g_vars->scene11_swingAngle - g_vars->scene11_swingOldAngle) * -490.0000000000001; + g_vars->scene11_swingSpeed = g_vars->scene11_swingAngleDiff * 0.0042 + g_vars->scene11_swingSpeed - g_vars->scene11_swingInertia * (g_vars->scene11_swingAngleDiff * 0.0042 + g_vars->scene11_swingSpeed); + g_vars->scene11_swingAngle = g_vars->scene11_swingSpeed * 0.0042 + g_vars->scene11_swingAngle; + + if (g_vars->scene11_swingAngle < -1.5) { + g_vars->scene11_swingAngle = -1.5; //1.0004882812500000; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + } + + if (g_vars->scene11_swingAngle > 1.5) { + g_vars->scene11_swingAngle = 1.5; //1.9990234375; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + } + + if (g_vars->scene11_swingMaxAngle == *arg && 0.0 != g_vars->scene11_swingSpeed && fabs(g_vars->scene11_swingSpeed) < 2.5) { + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + g_vars->scene11_swingAngle = g_vars->scene11_swingOldAngle; + } + + g_vars->scene11_swingCounter++; + + if (g_vars->scene11_arcadeIsOn) { + if (g_vars->scene11_hintCounter <= 720) { + g_vars->scene11_hintCounter++; + + if (g_vars->scene11_hintCounter == 720) + g_vars->scene11_hint->_flags |= 4; + } + } + + if ((oldarg >= 45) != (*arg >= 45) && g_vars->scene11_arcadeIsOn) { + if (oldarg >= *arg) + g_fp->playSound(SND_11_031, 0); + else + g_fp->playSound(SND_11_020, 0); + } } void scene11_setupMusic() { @@ -48,7 +96,7 @@ void scene11_setupMusic() { void scene11_initScene(Scene *sc) { g_vars->scene11_swingie = sc->getStaticANIObject1ById(ANI_SWINGER, -1); g_vars->scene11_boots = sc->getStaticANIObject1ById(ANI_BOOTS_11, -1); - g_vars->scene11_var01.clear(); + g_vars->scene11_mgm.clear(); g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_MAN11, -1); g_vars->scene11_dudeOnSwing->_callback2 = scene11_dudeSwingCallback; g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_KACHELI, -1); @@ -56,23 +104,21 @@ void scene11_initScene(Scene *sc) { g_vars->scene11_hint = sc->getPictureObjectById(PIC_SC11_HINT, 0); g_vars->scene11_hint->_flags &= 0xFFFB; - g_vars->scene11_var02 = 0; - g_vars->scene11_var03 = 0; - g_vars->scene11_var04 = 0; - g_vars->scene11_var05 = 0; - g_vars->scene11_var06 = 0; - g_vars->scene11_var07 = 0; - g_vars->scene11_var08 = 1.0; - g_vars->scene11_var09 = 1.0; - g_vars->scene11_var10 = 1.0; - g_vars->scene11_var11 = 1.0; - g_vars->scene11_var12 = 1.9849218750000000; - g_vars->scene11_var13 = 0; - g_vars->scene11_var14 = 0; - g_vars->scene11_var15 = 0; - g_vars->scene11_var16 = 0; - g_vars->scene11_var17 = 0; - g_vars->scene11_var18 = 0; + g_vars->scene11_arcadeIsOn = false; + g_vars->scene11_scrollIsEnabled = false; + g_vars->scene11_scrollIsMaximized = false; + g_vars->scene11_hintCounter = 0; + g_vars->scene11_swingieScreenEdge = 0; + g_vars->scene11_crySound = 0; + g_vars->scene11_swingAngle = 0.0; + g_vars->scene11_swingOldAngle = 0.0; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + g_vars->scene11_swingInertia = 1.28; //1.9849218750000000; + g_vars->scene11_swingCounter = 0; + g_vars->scene11_swingCounterPrevTurn = 0; + g_vars->scene11_swingDirection = 0; + g_vars->scene11_swingDirectionPrevTurn = 0; Scene *oldsc = g_fp->_currentScene; @@ -82,8 +128,8 @@ void scene11_initScene(Scene *sc) { if (swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsSwinging) || swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsSwingingWithBoot)) { - g_vars->scene11_var19 = 1; - g_vars->scene11_var20 = 0; + g_vars->scene11_swingIsSwinging = true; + g_vars->scene11_swingieStands = false; getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 1); getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 1); @@ -94,8 +140,8 @@ void scene11_initScene(Scene *sc) { getSc2MctlCompoundBySceneId(sc->_sceneId)->replaceNodeX(303, 353); } else if (swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInBoots) || swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInCorner)) { - g_vars->scene11_var19 = 0; - g_vars->scene11_var20 = 1; + g_vars->scene11_swingIsSwinging = false; + g_vars->scene11_swingieStands = true; g_vars->scene11_swingie->changeStatics2(ST_SWR_STAND3); @@ -105,8 +151,8 @@ void scene11_initScene(Scene *sc) { ((MctlCompound *)getCurrSceneSc2MotionController())->replaceNodeX(905, 805); } else { - g_vars->scene11_var19 = 0; - g_vars->scene11_var20 = 0; + g_vars->scene11_swingIsSwinging = false; + g_vars->scene11_swingieStands = false; if (swingie == g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting)) { g_vars->scene11_swingie->_movement = 0; @@ -127,7 +173,7 @@ void scene11_initScene(Scene *sc) { } } - if (!g_vars->scene11_var19) { + if (!g_vars->scene11_swingIsSwinging) { g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC); g_vars->scene11_dudeOnSwing->setOXY(691, 371); g_vars->scene11_dudeOnSwing->_priority = 20; @@ -141,8 +187,399 @@ void scene11_initScene(Scene *sc) { g_fp->setArcadeOverlay(PIC_CSR_ARCADE5); } +void sceneHandler11_restartMan() { + chainObjQueue(0, QU_SC11_RESTARTMAN, 1); + + getGameLoaderInteractionController()->enableFlag24(); + getCurrSceneSc2MotionController()->setEnabled(); + + g_vars->scene11_scrollIsEnabled = false; +} + +void sceneHandler11_hitMan() { + if (g_fp->_aniMan->_ox > 345 && g_fp->_aniMan->_ox < 355) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC11_MANFALL), 0, 0); + + mq->setFlags(mq->getFlags() | 1); + if (!mq->chain(g_fp->_aniMan)) + delete mq; + + getCurrSceneSc2MotionController()->replaceNodeX(353, 303); + } +} + +int scene11_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene11_arcadeIsOn) { + if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV) + g_fp->_cursorId = -1; + } else if (g_vars->scene11_swingie == g_fp->_objectAtCursor && g_fp->_inventory->getSelectedItemId() == ANI_INV_BOOT) + g_fp->_cursorId = PIC_CSR_ITN_INV; + + return g_fp->_cursorId; +} + +int sceneHandler11_updateScreenCallback() { + int res = g_fp->drawArcadeOverlay(g_vars->scene11_arcadeIsOn); + + if (!res) + g_fp->_updateScreenCallback = 0; + + return res; +} + +void sceneHandler11_manToSwing() { + g_vars->scene11_arcadeIsOn = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_fp->_aniMan2->hide(); + + g_vars->scene11_swingCounter = 0; + g_vars->scene11_swingInertia = 1.28; //1.9849218; + + g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB; + g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1); + g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY); + g_vars->scene11_dudeOnSwing->_movement = 0; + g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_0, 0); + g_vars->scene11_dudeOnSwing->_priority = 20; + g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1); + g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(45); + + g_vars->scene11_mgm.addItem(g_fp->_aniMan->_id); + + g_fp->_currentScene->_x = 1400 - g_fp->_sceneRect.right; + + g_vars->scene11_scrollIsEnabled = true; + g_fp->_updateScreenCallback = sceneHandler11_updateScreenCallback; +} + +void sceneHandler11_putABoot() { + if (g_vars->scene11_boots->_flags & 4) { + if (g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_ONE) + chainObjQueue(0, QU_SC11_PUTBOOT2, 1); + } else { + chainObjQueue(0, QU_SC11_PUTBOOT1, 1); + } +} + +void sceneHandler11_putBoot() { + if (abs(353 - g_fp->_aniMan->_ox) > 1 || abs(498 - g_fp->_aniMan->_oy) > 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 353, 498, 1, ST_MAN_RIGHT); + + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC11_PUTBOOT, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, 353, 498, 0, -1); + } + } else { + sceneHandler11_putABoot(); + } +} + +void sceneHandler11_showSwing() { + g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1); + g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_KCH_0); + g_vars->scene11_dudeOnSwing->_movement = 0; + g_vars->scene11_dudeOnSwing->show1(691, 371, MV_KCH_START, 0); + g_vars->scene11_dudeOnSwing->_priority = 20; +} + +void sceneHandler11_jumpFromSwing() { + g_vars->scene11_arcadeIsOn = false; + g_vars->scene11_hint->_flags &= 0xFFFB; + g_vars->scene11_scrollIsEnabled = false; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_vars->scene11_swingOldAngle = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngle = 0.0; + + g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1); + g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB; + g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1); + g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC); + g_vars->scene11_dudeOnSwing->setOXY(691, 371); + g_vars->scene11_dudeOnSwing->_priority = 20; + g_vars->scene11_dudeOnSwing->_flags |= 4; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(g_fp->_aniMan->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0); + ex->_field_14 = 256; + ex->_messageNum = 0; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->setFlags(mq->getFlags() | 1); + + g_fp->_globalMessageQueueList->addMessageQueue(mq); + + g_fp->_aniMan->_flags |= 0x104; + g_fp->_aniMan->changeStatics2(ST_MAN11_SWING); + g_fp->_aniMan->setOXY(685, 373); + g_fp->_aniMan->startAnim(MV_MAN11_JUMPFROMSWING, mq->_id, -1); + + g_fp->_aniMan2 = g_fp->_aniMan; +} + +void sceneHandler11_swing0() { + g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY); + g_vars->scene11_dudeOnSwing->_movement = 0; + g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_0, 0); + g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1); + g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex); + + g_vars->scene11_swingDirection = 0; + g_vars->scene11_swingMaxAngle = 45; + g_vars->scene11_swingOldAngle = 0.0; +} + +void sceneHandler11_swing1() { + g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY); + g_vars->scene11_dudeOnSwing->_movement = 0; + g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_1, 0); + g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_1, 0, -1); + g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex); + + g_vars->scene11_swingDirection = 1; + g_vars->scene11_swingMaxAngle = 42; + g_vars->scene11_swingOldAngle = -(fabs(g_vars->scene11_swingAngle) * 0.075 + 0.12); +} + +void sceneHandler11_swing2() { + g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY); + g_vars->scene11_dudeOnSwing->_movement = 0; + g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_2, 0); + g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_2, 0, -1); + g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex); + + g_vars->scene11_swingDirection = 2; + g_vars->scene11_swingMaxAngle = 48; + g_vars->scene11_swingOldAngle = fabs(g_vars->scene11_swingAngle) * 0.075 + 0.12; +} + +void sceneHandler11_emptySwing() { + if (g_vars->scene11_swingDirection) + sceneHandler11_swing0(); + + g_vars->scene11_dudeOnSwing->stopAnim_maybe(); + g_vars->scene11_dudeOnSwing->hide(); + g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_KACHELI, -1); + g_vars->scene11_dudeOnSwing->show1(-1, -1, -1, 0); + g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_EMPTY); + g_vars->scene11_dudeOnSwing->startAnim(MV_KCH_MOVE2, 0, -1); + g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex); + + g_vars->scene11_swingInertia = 0.03; //1.9881250; +} + +void sceneHandler11_jumpHitAndWin() { + MGMInfo mgminfo; + + sceneHandler11_emptySwing(); + + g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0), + MV_MAN11_JUMPHIT, 0); + g_fp->_aniMan->_priority = 10; + + mgminfo.field_1C = 10; + mgminfo.ani = g_fp->_aniMan; + mgminfo.staticsId2 = ST_MAN_1PIX; + mgminfo.x1 = 1400; + mgminfo.y1 = 0; + mgminfo.field_10 = 1; + mgminfo.flags = 66; + mgminfo.movementId = MV_MAN11_JUMPHIT; + + MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo); + + if (mq) { + g_vars->scene11_crySound = SND_11_024; + ExCommand *ex = new ExCommand(ANI_MAN, 2, 36, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = -1; + ex->_excFlags = 2; + + mq->addExCommandToEnd(ex); + + ex = new ExCommand(SC_11, 17, 61, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = TrubaRight; + ex->_excFlags = 3; + + mq->addExCommandToEnd(ex); + + if (!mq->chain(g_fp->_aniMan)) + delete mq; + + + if (g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInCorner)) + g_fp->setObjectState(sO_Swingie, g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting)); + + g_fp->setObjectState(sO_DudeHasJumped, g_fp->getObjectEnumState(sO_DudeHasJumped, sO_Yes)); + } +} + +void sceneHandler11_jumpOver(double angle) { + MGMInfo mgminfo; + + sceneHandler11_emptySwing(); + + g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0), + MV_MAN11_JUMPOVER, 0); + g_fp->_aniMan->_priority = 0; + + mgminfo.staticsId2 = ST_MAN_1PIX; + mgminfo.ani = g_fp->_aniMan; + mgminfo.x1 = 1163; + mgminfo.y1 = 837 - (int)(angle * 153.0); + mgminfo.field_1C = 0; + mgminfo.field_10 = 1; + mgminfo.flags = 78; + mgminfo.movementId = MV_MAN11_JUMPOVER; + + MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo); + + if (mq) { + g_vars->scene11_crySound = SND_11_022; + + ExCommand *ex = new ExCommand(0, 17, MSG_SC11_RESTARTMAN, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + + mq->addExCommandToEnd(ex); + + if (!mq->chain(g_fp->_aniMan)) + delete mq; + } +} + +void sceneHandler11_jumpHit(double angle) { + MGMInfo mgminfo; + + sceneHandler11_emptySwing(); + + if (angle >= 0.0) { + if (angle > 1.0) + angle = 1.0; + } else { + angle = 0.0; + } + + g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0), + MV_MAN11_JUMPOVER, 0); + g_fp->_aniMan->_priority = 0; + + mgminfo.staticsId2 = ST_MAN_1PIX; + mgminfo.ani = g_fp->_aniMan; + mgminfo.x1 = 1017 - (int)(angle * -214.0); + mgminfo.y1 = 700; + mgminfo.field_1C = 0; + mgminfo.field_10 = 1; + mgminfo.flags = 78; + mgminfo.movementId = MV_MAN11_JUMPHIT; + + MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo); + + if (mq) { + g_vars->scene11_crySound = SND_11_022; + + ExCommand *ex = new ExCommand(0, 17, MSG_SC11_RESTARTMAN, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + + mq->addExCommandToEnd(ex); + + if (!mq->chain(g_fp->_aniMan)) + delete mq; + + } +} + +void sceneHandler11_swingLogic() { + if (g_vars->scene11_dudeOnSwing->_movement) { + int ph = g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex; + if (ph > 53 && ph < 90) { + if (ph < 70 && g_vars->scene11_swingSpeed >= 22.0) { + sceneHandler11_jumpOver((double)ph * 0.01428571428571429); // = 1 / 70 + } else if (ph <= 80 && g_vars->scene11_swingSpeed >= 22.0) { + sceneHandler11_jumpHitAndWin(); + } else { + sceneHandler11_jumpHit((double)ph * g_vars->scene11_swingSpeed * 0.0006493506493506494); // = 1/1540 + } + + g_vars->scene11_arcadeIsOn = false; + g_vars->scene11_hint->_flags &= 0xFFFB; + return; + } + + if (ph > 38 && ph < 53 && fabs(g_vars->scene11_swingSpeed) <= 5.0) + sceneHandler11_jumpFromSwing(); + } +} + +void sceneHandler11_setSwingDirection() { + if (g_vars->scene11_swingDirection == 2) + g_vars->scene11_swingDirectionPrevTurn = 1; + else if (g_vars->scene11_swingDirection == 1) + g_vars->scene11_swingDirectionPrevTurn = 2; + else + g_vars->scene11_swingDirectionPrevTurn = (g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex <= 45) + 1; +} + +void sceneHandler11_swingieSit() { + if (g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInBoots)) { + g_vars->scene11_swingIsSwinging = false; + g_vars->scene11_swingieStands = false; + + g_vars->scene11_swingie->changeStatics2(ST_SWR_SIT); + g_vars->scene11_swingie->setOXY(144, 389); + + g_fp->setObjectState(sO_Swingie, g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting)); + + getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0); + getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 0); + getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 1); + } +} + +void sceneHandler11_swingieJumpDown() { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SWR_JUMPDOWN), 0, 0); + + mq->setFlags(mq->getFlags() | 1); + + if (!mq->chain(g_vars->scene11_swingie)) + delete mq; + + g_vars->scene11_swingIsSwinging = false; + g_vars->scene11_swingieStands = true; + g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left; + + getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing1, 0); + getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing2, 1); + getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing3, 0); + + getCurrSceneSc2MotionController()->replaceNodeX(905, 805); +} + +void sceneHandler11_winArcade() { + if (g_vars->scene11_arcadeIsOn) { + g_vars->scene11_arcadeIsOn = false; + + sceneHandler11_emptySwing(); + + g_fp->_gameLoader->preloadScene(SC_11, TrubaRight); + } +} + int sceneHandler11(ExCommand *cmd) { -#if 0 if (cmd->_messageKind != 17) return 0; @@ -152,15 +589,16 @@ int sceneHandler11(ExCommand *cmd) { break; case MSG_SC11_SITSWINGER: - if (g_fp->getObjectState(sO_Swingie) == getObjectEnumState(sO_Swingie, sO_IsStandingInBoots) + if (g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInBoots) || g_fp->getObjectState(sO_Swingie) == g_fp->getObjectEnumState(sO_Swingie, sO_IsStandingInCorner)) { g_fp->setObjectState(sO_Swingie, g_fp->getObjectEnumState(sO_Swingie, sO_IsSitting)); } break; case MSG_SC11_MANCRY: - playSound(g_vars->scene11_var07, 0); - g_vars->scene11_var07 = 0; + g_fp->playSound(g_vars->scene11_crySound, 0); + + g_vars->scene11_crySound = 0; break; case MSG_SC11_RESTARTMAN: @@ -184,141 +622,156 @@ int sceneHandler11(ExCommand *cmd) { break; case 107: - if (g_vars->scene11_var02) - sceneHandler11_sub01(); + if (g_vars->scene11_arcadeIsOn) + sceneHandler11_swingLogic(); break; case 33: { + int res = 0; + int x, y; + if (!g_fp->_aniMan2) goto LABEL_27; - int x = g_fp->_aniMan2->_ox; - g_vars->scene11_var21 = g_fp->_aniMan2->_ox; - int y = g_fp->_aniMan2->_oy; - g_vars->scene11_var22 = g_fp->_aniMan2->_oy; - if (g_vars->scene11_var03) { + x = g_fp->_aniMan2->_ox; + y = g_fp->_aniMan2->_oy; + + g_vars->scene11_dudeX = x; + g_vars->scene11_dudeY = y; + + if (g_vars->scene11_scrollIsEnabled) { if (x > g_fp->_sceneRect.right - 200) - OffsetRect(&g_fp->_sceneRect, x - g_fp->_sceneRect.right + 200, 0); + g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300; goto LABEL_26; } - if (g_vars->scene11_var04) { - g_fp->_currentScene->bg._x = g_fp->_sceneWidth - x; - if (g_vars->scene11_var21 < 910) - g_vars->scene11_var04 = 0; + + if (g_vars->scene11_scrollIsMaximized) { + g_fp->_currentScene->_x = g_fp->_sceneWidth - x; + + if (g_vars->scene11_dudeX < 910) + g_vars->scene11_scrollIsMaximized = false; + LABEL_26: - v2 = 1; + res = 1; LABEL_27: - if (g_vars->scene11_var20) { - if (g_fp->_sceneRect.left >= 534 && g_vars->scene11_var06 < 534) - sceneHandler11_sub06(); - g_vars->scene11_var06 = g_fp->_sceneRect.left; + if (g_vars->scene11_swingieStands) { + if (g_fp->_sceneRect.left >= 534 && g_vars->scene11_swingieScreenEdge < 534) + sceneHandler11_swingieSit(); + + g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left; } - if (!g_vars->scene11_var02) + + if (!g_vars->scene11_arcadeIsOn) goto LABEL_50; - v6 = g_vars->scene11_var16; - if (g_vars->scene11_var16 <= 0 || g_vars->scene11_var15 - g_vars->scene11_var16 <= 72) { - v7 = g_vars->scene11_var18; + + if (g_vars->scene11_swingCounterPrevTurn <= 0 || g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn <= 72) { } else { - sceneHandler11_sub02(); - v7 = 0; - v6 = 0; - g_vars->scene11_var18 = 0; - g_vars->scene11_var16 = 0; + sceneHandler11_swing0(); + g_vars->scene11_swingDirectionPrevTurn = 0; + g_vars->scene11_swingCounterPrevTurn = 0; } - if (!g_vars->scene11_var02) + + if (!g_vars->scene11_arcadeIsOn) goto LABEL_50; - if (g_vars->scene11_var17 == v7 || v6 <= 0 || g_vars->scene11_var15 - v6 <= 2) { + + if (g_vars->scene11_swingDirection == g_vars->scene11_swingDirectionPrevTurn || g_vars->scene11_swingCounterPrevTurn <= 0 || g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn <= 2) { LABEL_49: - if (g_vars->scene11_var02) { - LABEL_61: - g_fp->_behaviorManager_updateBehaviors(); + if (g_vars->scene11_arcadeIsOn) { + g_fp->_behaviorManager->updateBehaviors(); g_fp->startSceneTrack(); - return v2; + return res; } LABEL_50: - if (g_vars->scene11_var19 - || 0.0 == g_vars->scene11_var10 - && (v8 = g_vars->scene11_dudeOnSwing->_movement) != 0 - && v8->_currDynamicPhaseIndex == 45 - && (g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC), !g_vars->scene11_var02) - && g_vars->scene11_var19) { + if (g_vars->scene11_swingIsSwinging + || (0.0 == g_vars->scene11_swingSpeed + && g_vars->scene11_dudeOnSwing->_movement != 0 + && g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex == 45 + && (g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC), !g_vars->scene11_arcadeIsOn) + && g_vars->scene11_swingIsSwinging)) { if (!g_vars->scene11_swingie->_movement) { - if (g_vars->scene11_boots->_flags & 4 && g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_2) { - sceneHandler11_sub07(); - BehaviorManager_updateBehaviors(&g_behaviorManager); - startSceneTrack(); - return v2; + if ((g_vars->scene11_boots->_flags & 4) && g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_2) { + sceneHandler11_swingieJumpDown(); + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + return res; } g_vars->scene11_swingie->startAnim(MV_SWR_SWING, 0, -1); } } - goto LABEL_61; + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + return res; } - if (v7 == 1) { - if (!g_vars->scene11_var17) { - sceneHandler11_sub03(); - LABEL_48: - g_vars->scene11_var16 = g_vars->scene11_var15; - goto LABEL_49; - } - } else { - if (v7 != 2) - goto LABEL_48; - if (!g_vars->scene11_var17) { - sceneHandler11_sub04(); - goto LABEL_48; - } + + if (g_vars->scene11_swingDirectionPrevTurn == 1) { + if (!g_vars->scene11_swingDirection) + sceneHandler11_swing1(); + else + sceneHandler11_swing0(); + } else if (g_vars->scene11_swingDirectionPrevTurn == 2) { + if (!g_vars->scene11_swingDirection) + sceneHandler11_swing2(); + else + sceneHandler11_swing0(); } - sceneHandler11_sub02(); - goto LABEL_48; + + g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter; + goto LABEL_49; } if (x >= g_fp->_sceneRect.left + 200) { if (x <= g_fp->_sceneRect.right - 200) { LABEL_18: if (y < g_fp->_sceneRect.top + 200) { - g_fp->_currentScene->bg._y = y - g_fp->_sceneRect.top - 300; - y = g_vars->scene11_var22; - x = g_vars->scene11_var21; + g_fp->_currentScene->_y = y - g_fp->_sceneRect.top - 300; + y = g_vars->scene11_dudeY; + x = g_vars->scene11_dudeX; } if (y > g_fp->_sceneRect.bottom - 300) { - g_fp->_currentScene->bg._y = y - g_fp->_sceneRect.bottom + 300; - x = g_vars->scene11_var21; + g_fp->_currentScene->_y = y - g_fp->_sceneRect.bottom + 300; + x = g_vars->scene11_dudeX; } if (x >= 940) - g_vars->scene11_var04 = 1; + g_vars->scene11_scrollIsMaximized = true; goto LABEL_26; } - g_fp->_currentScene->bg._x = x - g_fp->_sceneRect.right + 300; + g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300; } else { - g_fp->_currentScene->bg._x = x - g_fp->_sceneRect.left - 300; + g_fp->_currentScene->_x = x - g_fp->_sceneRect.left - 300; } - y = g_vars->scene11_var22; - x = g_vars->scene11_var21; + y = g_vars->scene11_dudeY; + x = g_vars->scene11_dudeX; goto LABEL_18; } break; case 29: - if (g_vars->scene11_var19) { - if (g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y) == g_vars->scene11_swingie && cmd->_keyCode == ANI_INV_BOOT) + if (g_vars->scene11_swingIsSwinging) { + if (g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y) == g_vars->scene11_swingie + && cmd->_keyCode == ANI_INV_BOOT) sceneHandler11_putBoot(); } else { - if (!g_vars->scene11_var02) - goto LABEL_69; - sceneHandler11_sub05(); - g_vars->scene11_var16 = g_vars->scene11_var15; + if (g_vars->scene11_arcadeIsOn) { + sceneHandler11_setSwingDirection(); + + g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter; + } } - if (!g_vars->scene11_var02) { - LABEL_69: - v10 = (GameObject *)Scene_getStaticANIObjectAtPos(g_fp->_currentScene, cmd->_sceneClickX, cmd->_sceneClickY); - if (!v10 || !canInteractAny(&g_fp->_aniMan->go, v10, cmd->_keyCode)) { - v11 = Scene_getPictureObjectIdAtPos(g_fp->_currentScene, cmd->_sceneClickX, cmd->_sceneClickY); - v12 = (GameObject *)Scene_getPictureObjectById(g_fp->_currentScene, v11, 0); - if (!v12 || !canInteractAny(g_fp->_aniMan, v12, cmd->_keyCode)) { - if ((v13 = cmd->_sceneClickX, g_fp->_sceneRect.right - v13 < 47) && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1 || v13 - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0) { - processArcade(cmd); + + if (!g_vars->scene11_arcadeIsOn) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { + g_fp->processArcade(cmd); + return 0; } } @@ -326,7 +779,6 @@ int sceneHandler11(ExCommand *cmd) { return 0; } } -#endif return 0; } diff --git a/engines/fullpipe/scenes/scene12.cpp b/engines/fullpipe/scenes/scene12.cpp index 65f50b465a..0295efcaf5 100644 --- a/engines/fullpipe/scenes/scene12.cpp +++ b/engines/fullpipe/scenes/scene12.cpp @@ -42,7 +42,7 @@ void scene12_initScene(Scene *sc) { g_vars->scene12_fly = g_fp->getObjectState(sO_Fly_12); if (g_vars->scene12_fly) - g_vars->scene12_flyCountdown = 600 * g_fp->_rnd->getRandomNumber(32767) / 0x7fff + 600; + g_vars->scene12_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600; g_fp->setObjectState(sO_Fly_12, g_fp->_rnd->getRandomNumber(1)); } diff --git a/engines/fullpipe/scenes/scene13.cpp b/engines/fullpipe/scenes/scene13.cpp new file mode 100644 index 0000000000..0a0c2f3906 --- /dev/null +++ b/engines/fullpipe/scenes/scene13.cpp @@ -0,0 +1,380 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene13_initScene(Scene *sc) { + g_vars->scene13_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLGIG_13, -1); + g_vars->scene13_guard = sc->getStaticANIObject1ById(ANI_STOROZH, -1); + g_vars->scene13_handleR = sc->getStaticANIObject1ById(ANI_HANDLE_R, -1); + g_vars->scene13_handleL = sc->getStaticANIObject1ById(ANI_HANDLE_L, -1); + g_vars->scene13_bridge = sc->getStaticANIObject1ById(ANI_BRIDGE, -1); + g_vars->scene13_guardDirection = true; + + MovGraphLink *lnk = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_Bridge); + Scene *oldsc = g_fp->_currentScene; + + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) { + g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED); + + lnk->_flags |= 0x20000000u; + + g_fp->playSound(SND_13_018, 1); + + g_vars->scene13_whirlgig->_callback2 = 0; + } else { + g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2); + + lnk->_flags &= 0xDFFFFFFF; + + g_vars->scene13_whirlgig->stopAnim_maybe(); + g_vars->scene13_whirlgig->_callback2 = 0; + g_vars->scene13_whirlgig->startAnim(MV_WHR13_SPIN, 0, -1); + + if (g_vars->scene13_whirlgig->_movement) + g_vars->scene13_whirlgig->_movement->setDynamicPhaseIndex(30); + + g_fp->playSound(SND_13_037, 1); + } + + g_vars->scene13_bridge->_flags &= 0xFFFD; + + g_fp->_currentScene = oldsc; + + g_fp->initArcadeKeys("SC_13"); +} + +void sceneHandler13_openBridge() { + Movement *mov = g_vars->scene13_bridge->_movement; + + if (mov && mov->_id == MV_BDG_CLOSE) { + int sz; + + if (mov->_currMovement) + sz = mov->_currMovement->_dynamicPhases.size(); + else + sz = mov->_dynamicPhases.size(); + + g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED); + g_vars->scene13_bridge->startAnim(MV_BDG_OPEN, 0, -1); + + mov->setDynamicPhaseIndex(sz - mov->_currDynamicPhaseIndex); + } else { + g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED); + g_vars->scene13_bridge->startAnim(MV_BDG_OPEN, 0, -1); + } +} + +void sceneHandler13_testClose() { + int id = g_vars->scene13_handleL->_statics->_staticsId; + + if (id == ST_HDLL_UP) + chainQueue(QU_SC13_CLOSEFAIL, 1); + else if (id == ST_HDLL_FIRECAN || id == ST_HDLL_HAMMER) + chainQueue(QU_SC13_CLOSESUCCESS, 1); +} + +void sceneHandler13_testOpen() { + switch (g_vars->scene13_handleR->_statics->_staticsId) { + case ST_HDLR_DOWN: + chainQueue(QU_SC13_OPENFAIL, 1); + break; + + case ST_HDLR_DOWN_GUM: + chainQueue(QU_SC13_OPENSUCCESS, 1); + break; + + case ST_HDLR_GUM: + g_vars->scene13_handleR->changeStatics2(ST_HDLR_DOWN_GUM); + + chainQueue(QU_SC13_OPENSUCCESS, 1); + break; + } +} + +void sceneHandler13_closeBridge() { + Movement *mov = g_vars->scene13_bridge->_movement; + + if (mov && mov->_id == MV_BDG_OPEN) { + int sz; + + if (mov->_currMovement) + sz = mov->_currMovement->_dynamicPhases.size(); + else + sz = mov->_dynamicPhases.size(); + + g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2); + g_vars->scene13_bridge->startAnim(MV_BDG_CLOSE, 0, -1); + + mov->setDynamicPhaseIndex(sz - mov->_currDynamicPhaseIndex); + } else { + g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2); + g_vars->scene13_bridge->startAnim(MV_BDG_CLOSE, 0, -1); + } +} + +void sceneHandler13_closeFast() { + g_vars->scene13_bridge->changeStatics2(ST_BDG_OPEN2); + g_vars->scene13_bridge->startAnim(MV_BDG_CLOSE, 0, -1); + g_vars->scene13_bridge->_movement->setDynamicPhaseIndex(21); +} + +void sceneHandler13_stopWhirlgig() { + g_vars->scene13_whirlgig->_callback2 = 0; + + g_fp->stopAllSoundInstances(SND_13_018); + g_fp->playSound(SND_13_033, 0); + g_fp->playSound(SND_13_037, 1); +} + +void sceneHandler13_startWhirlgig() { + g_vars->scene13_whirlgig->_callback2 = 0; + + g_fp->playSound(SND_13_018, 1); + g_fp->playSound(SND_13_034, 0); + + g_fp->stopAllSoundInstances(SND_13_037); +} + +void sceneHandler13_openFast() { + g_vars->scene13_bridge->changeStatics2(ST_BDG_CLOSED); + g_vars->scene13_bridge->startAnim(MV_BDG_OPEN, 0, -1); + g_vars->scene13_bridge->_movement->setDynamicPhaseIndex(15); +} + +void sceneHandler13_uneatGum() { + BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW); + + if (beh) { + beh->_percent = 0; + beh->_delay = 36; + } + + beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_PLUU); + if (beh) { + beh->_percent = 0; + beh->_delay = 36; + } +} + +void sceneHandler13_eatGum() { + BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW); + + if (beh) { + beh->_percent = 10922; + beh->_delay = 0; + } +} + +void sceneHandler13_updateBridge() { + MovGraphLink *lnk = getCurrSceneSc2MotionController()->getLinkByName(sO_Bridge); + + if (lnk) { + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) + lnk->_flags |= 0x20000000; + else + lnk->_flags &= 0xDFFFFFFF; + } +} + +void sceneHandler13_showGum() { + chainQueue(QU_SC13_SHOWGUM, 0); +} + +void sceneHandler13_setBehFlag(BehaviorEntryInfo *beh, bool flag) { + if (!flag) { + beh->_percent = 327; + beh->_flags |= 1; + beh->_delay = 36; + } else { + beh->_percent = 0x7FFF; + beh->_flags &= 0xFFFFFFFE; + beh->_delay = 0; + } +} + +void sceneHandler13_walkForward(bool flag) { + BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_RTOL); + + sceneHandler13_setBehFlag(beh, flag); + + beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT, QU_STR_TURNR); + + sceneHandler13_setBehFlag(beh, flag); + + beh->_flags &= 0xFE; +} + +void sceneHandler13_walkBackward(bool flag) { + BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT|0x4000, QU_STR_LTOR); + + sceneHandler13_setBehFlag(beh, flag); + + beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT|0x4000, QU_STR_TURNR_L); + + sceneHandler13_setBehFlag(beh, flag); + + beh->_flags &= 0xFE; +} + +int sceneHandler13(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch(cmd->_messageNum) { + case MSG_SC13_OPENBRIDGE: + sceneHandler13_openBridge(); + break; + + case MSG_SC13_TESTCLOSE: + sceneHandler13_testClose(); + break; + + case MSG_SC13_TESTOPEN: + sceneHandler13_testOpen(); + break; + + case MSG_SC13_CLOSEBRIDGE: + sceneHandler13_closeBridge(); + break; + + case MSG_SC13_CLOSEFAST: + sceneHandler13_closeFast(); + break; + + case MSG_SC13_STOPWHIRLGIG: + sceneHandler13_stopWhirlgig(); + break; + + case MSG_SC13_STARTWHIRLGIG: + sceneHandler13_startWhirlgig(); + break; + + case MSG_SC13_OPENFAST: + sceneHandler13_openFast(); + break; + + case MSG_SC13_UNEATGUM: + sceneHandler13_uneatGum(); + break; + + case MSG_SC13_EATGUM: + sceneHandler13_eatGum(); + break; + + case MSG_SC13_CHEW: + g_vars->scene13_guard->_flags &= 0xFF7Fu; + break; + + case MSG_SC13_UPDATEBRIDGE: + sceneHandler13_updateBridge(); + break; + + case MSG_SC13_SHOWGUM: + sceneHandler13_showGum(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 + && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { + g_fp->processArcade(cmd); + } + } + } + break; + } + + case 33: + { + int res = 0; + int x; + + if (g_fp->_aniMan2) { + x = g_fp->_aniMan2->_ox; + g_vars->scene13_dudeX = x; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - g_fp->_sceneRect.left - 300; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300; + + res = 1; + } else { + x = g_vars->scene13_dudeX; + } + + if (g_vars->scene13_guardDirection) { + if (x < 1022) { + sceneHandler13_walkForward(1); + sceneHandler13_walkBackward(0); + + g_vars->scene13_guardDirection = false; + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + return res; + } + } else if (x > 1022) { + sceneHandler13_walkForward(0); + sceneHandler13_walkBackward(1); + + g_vars->scene13_guardDirection = true; + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + return res; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp new file mode 100644 index 0000000000..4a09bc9cb6 --- /dev/null +++ b/engines/fullpipe/scenes/scene14.cpp @@ -0,0 +1,849 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/input.h" + +namespace Fullpipe { + +void scene14_initScene(Scene *sc) { + g_vars->scene14_grandma = sc->getStaticANIObject1ById(ANI_GRANDMA, -1); + g_vars->scene14_sceneDeltaX = 200; + g_vars->scene14_sceneDeltaY = 200; + g_vars->scene14_arcadeIsOn = false; + g_vars->scene14_dudeIsKicking = false; + g_vars->scene14_ballIsFlying = false; + g_vars->scene14_dudeCanKick = false; + g_vars->scene14_sceneDiffX = 300; + g_vars->scene14_sceneDiffY = 300; + g_vars->scene14_pink = 0; + g_vars->scene14_flyingBall = 0; + g_vars->scene14_balls.clear(); + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_14)) { + g_vars->scene14_grandmaIsHere = true; + + StaticANIObject *ball = sc->getStaticANIObject1ById(ANI_BALL14, -1); + + ball->_flags &= 0xFFFB; + g_vars->scene14_balls.push_back(ball); + + for (uint i = 0; i < 3; i++) { + ball = new StaticANIObject(ball); // create a copy + + ball->_flags &= 0xFFFB; + g_vars->scene14_balls.push_back(ball); + + sc->addStaticANIObject(ball, 1); + } + } else { + g_vars->scene14_grandmaIsHere = false; + g_vars->scene14_grandma->hide(); + } + + g_fp->lift_setButton(sO_Level4, ST_LBN_4N); + g_fp->lift_sub5(sc, QU_SC14_ENTERLIFT, QU_SC14_EXITLIFT); + + g_fp->initArcadeKeys("SC_14"); + g_fp->setArcadeOverlay(PIC_CSR_ARCADE6); +} + +void scene14_setupMusic() { + if (!g_vars->scene14_grandmaIsHere) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_14"), "MUSIC2", 0); +} + +int scene14_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene14_arcadeIsOn) { + if (g_vars->scene14_dudeIsKicking) { + g_fp->_cursorId = PIC_CSR_ARCADE2_D; + } else { + if (g_fp->_aniMan != g_fp->_objectAtCursor || g_fp->_aniMan->_movement || g_fp->_cursorId != PIC_CSR_DEFAULT) { + if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV) { + g_fp->_cursorId = PIC_CSR_DEFAULT; + } + } else { + g_fp->_cursorId = PIC_CSR_ITN; + } + } + } + + return g_fp->_cursorId; +} + +int sceneHandler14_updateScreenCallback() { + int res; + + res = g_fp->drawArcadeOverlay(g_vars->scene14_arcadeIsOn); + if (!res) + g_fp->_updateScreenCallback = 0; + + return res; +} + +void sceneHandler14_showBallGrandmaHit2() { + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 223, g_vars->scene14_grandmaY + 35, MV_BAL14_SPIN, 0); + g_vars->scene14_flyingBall->_priority = 27; + + g_vars->scene14_pink = g_vars->scene14_flyingBall; + + g_vars->scene14_flyingBall = 0; + } +} + +void sceneHandler14_showBallGrandmaDive() { + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 506, g_vars->scene14_grandmaY - 29, -1, 0); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + } + + g_fp->_aniMan2 = g_fp->_aniMan; +} + +void sceneHandler14_showBallGrandmaHit() { + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 190, g_vars->scene14_grandmaY + 56, MV_BAL14_TOGMA, 0); + g_vars->scene14_flyingBall->_priority = 27; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 2; + ex->_field_24 = 1; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->chain(0); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + } +} + +void sceneHandler14_exitScene() { + g_vars->scene14_arcadeIsOn = false; + + if (g_fp->_aniMan->_movement) + g_fp->_aniMan->_movement->gotoLastFrame(); + + g_fp->_aniMan->stopAnim_maybe(); + + handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC14_RTRUBA, 0), 0); + + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + chainQueue(QU_SC14_ENDARCADE, 0); + + getGameLoaderInteractionController()->disableFlag24(); + getCurrSceneSc2MotionController()->clearEnabled(); +} + +void sceneHandler14_showBallMan() { + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 166, g_vars->scene14_dudeY + 40, MV_BAL14_TOGMA, 0); + g_vars->scene14_flyingBall->_priority = 27; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 2; + ex->_field_24 = 1; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->chain(0); + + g_vars->scene14_flyingBall->startAnim(MV_BAL14_TOGMA, 0, -1); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + + if (g_vars->scene14_dudeX >= 1300) + sceneHandler14_exitScene(); + } +} + +void sceneHandler14_manKickBall() { + int val = (g_vars->scene14_grandmaX + 65 - (g_vars->scene14_dudeX - 85)) / -32; + int den = val; + + g_vars->scene14_ballX = g_vars->scene14_dudeX - 85; + g_vars->scene14_ballY = g_vars->scene14_dudeY - 76; + g_vars->scene14_ballDeltaX = -32; + + if (!val) + den = 1; + + g_vars->scene14_ballDeltaY = (g_vars->scene14_grandmaY - 102 - val * val / 2 - (g_vars->scene14_dudeY - 76)) / den; + + g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 85, g_vars->scene14_dudeY - 76, -1, 0); + g_vars->scene14_flyingBall->startAnim(MV_BAL14_SPIN, 0, -1); + g_vars->scene14_flyingBall->_priority = 5; + + g_vars->scene14_ballIsFlying = true; +} + +void sceneHandler14_showBallFly() { + if (g_vars->scene14_balls.size()) { + g_vars->scene14_flyingBall = g_vars->scene14_balls.front(); + g_vars->scene14_balls.pop_front(); + } + + int x, y; + + if (g_vars->scene14_grandma->_movement) { + x = g_vars->scene14_grandma->_movement->_ox; + g_vars->scene14_ballX = x; + y = g_vars->scene14_grandma->_movement->_oy; + } else { + x = g_vars->scene14_grandmaX; + y = g_vars->scene14_grandmaY; + } + + x = x + 38; + y = y - 77; + + g_vars->scene14_ballDeltaX = 32; + + int dist = (g_vars->scene14_dudeX - 16 - x) / 32; + int den = dist; + + if (!dist) + den = 1; + + g_vars->scene14_ballX = x + 32; + g_vars->scene14_ballDeltaY = (g_vars->scene14_dudeY - 40 - dist * dist / 2 - y) / den; + g_vars->scene14_ballY = g_vars->scene14_ballDeltaY + y; + + g_vars->scene14_flyingBall->show1(x + 32, g_vars->scene14_ballDeltaY + y, MV_BAL14_SPIN, 0); + g_vars->scene14_flyingBall->_priority = 5; + g_vars->scene14_flyingBall->startAnim(MV_BAL14_SPIN, 0, -1); + + g_vars->scene14_ballIsFlying = true; +} + +void sceneHandler14_grandmaJump() { + BehaviorEntryInfo *beh1 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPFW); + BehaviorEntryInfo *beh2 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPBK); + + if (beh1) { + if (beh2) { + int p = beh1->_percent; + beh1->_percent = beh2->_percent; + beh2->_percent = p; + } + } +} + +void sceneHandler14_endArcade() { + g_vars->scene14_arcadeIsOn = false; + + setInputDisabled(0); + + getGameLoaderInteractionController()->enableFlag24(); + getCurrSceneSc2MotionController()->setEnabled(); + + BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_BLINK); + if (beh) + beh->_percent = 327; + + beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_THROW); + if (beh) + beh->_percent = 0; + + g_vars->scene14_sceneDeltaX = 200; + g_vars->scene14_sceneDeltaY = 200; + + g_fp->_aniMan2 = g_fp->_aniMan; + + g_vars->scene14_sceneDiffX = 300; + g_vars->scene14_sceneDiffY = 300; +} + +void sceneHandler14_winArcade() { + if (g_vars->scene14_arcadeIsOn) { + if (g_vars->scene14_dudeIsKicking) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + g_vars->scene14_dudeIsKicking = false; + } + + if (g_vars->scene14_flyingBall) { + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + + g_vars->scene14_flyingBall->_flags &= 0xFFFB; + g_vars->scene14_flyingBall = 0; + } + + g_vars->scene14_ballIsFlying = false; + + sceneHandler14_endArcade(); + + g_vars->scene14_grandmaIsHere = false; + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_14)) { + g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_In_15)); + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + g_vars->scene14_grandma->_flags &= 0xFFFB; + } + + if (g_fp->_currentScene->_messageQueueId) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(g_fp->_currentScene->_messageQueueId); + if (mq) + delete mq; + + g_fp->_currentScene->_messageQueueId = 0; + } + } +} + +void sceneHandler14_showBallLast() { + if (g_vars->scene14_pink) { + g_vars->scene14_pink->show1(693, 491, MV_BAL14_SPIN, 0); + g_vars->scene14_pink->_priority = 27; + } +} + +void sceneHandler14_hideBallLast() { + if (g_vars->scene14_pink) { + g_vars->scene14_pink->hide(); + g_vars->scene14_balls.push_back(g_vars->scene14_pink); + g_vars->scene14_pink = 0; + } +} + +void sceneHandler14_startArcade() { + g_vars->scene14_arcadeIsOn = true; + g_vars->scene14_dudeCanKick = true; + + if (g_fp->_aniMan->_movement) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000); + g_fp->_aniMan->setOXY(1237, 451); + g_fp->_aniMan->_priority = 25; + } + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_fp->_aniMan2 = 0; + g_vars->scene14_sceneDeltaX = 50; + g_vars->scene14_sceneDiffX = 100; + g_vars->scene14_hitsLeft = 4; + g_vars->scene14_pink = 0; + + chainQueue(QU_SC14_STARTARCADE, 0); + + g_fp->_updateScreenCallback = sceneHandler14_updateScreenCallback; +} + +void sceneHandler14_clearCallback() { + g_fp->_aniMan->_callback2 = 0; + g_vars->scene14_dudeIsKicking = false; +} + +void sceneHandler14_kickAnimation() { + if (g_fp->_aniMan->_movement) { + sceneHandler14_clearCallback(); + + if (g_vars->scene14_flyingBall && g_vars->scene14_dudeX - g_vars->scene14_flyingBall->_ox < 180) { + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_movement->_staticsObj2->_staticsId); + g_fp->_aniMan->startAnim(MV_MAN14_KICK, 0, -1); + + g_vars->scene14_ballIsFlying = false; + + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->hide(); + } else { + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_movement->_staticsObj2->_staticsId); + g_fp->_aniMan->startAnim(MV_MAN14_KICKAIR, 0, -1); + } + } +} + +void sceneHandler14_declineCallback(int *arg) { + Common::Point point; + + if (g_vars->scene14_dudeIsKicking) { + *arg = (int)(sqrt((double)(g_fp->_mouseVirtY - g_vars->scene14_mouseCursorPos.y) + * (g_fp->_mouseVirtY - g_vars->scene14_mouseCursorPos.y) + + (g_fp->_mouseVirtX - g_vars->scene14_mouseCursorPos.x) + * (g_fp->_mouseVirtX - g_vars->scene14_mouseCursorPos.x)) * 0.1); + + if (*arg > 11) + *arg = 11; + } else { + ++*arg; + } +} + +void sceneHandler14_dudeDecline() { + g_vars->scene14_mouseCursorPos.x = g_fp->_mouseVirtX; + g_vars->scene14_mouseCursorPos.y = g_fp->_mouseVirtY; + + g_fp->_aniMan->_callback2 = sceneHandler14_declineCallback; + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + g_fp->_aniMan->startAnim(MV_MAN14_DECLINE, 0, -1); + + g_vars->scene14_dudeIsKicking = true; +} + +bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) { + if (!getCurrSceneSc2MotionController()->_isEnabled) + return 0; + + if (!g_vars->scene14_grandmaIsHere) { + if (!cmd->_keyCode) { + if (g_vars->scene14_pink) { + if (g_vars->scene14_pink->_flags & 4) { + if (cmd->_sceneClickX < g_vars->scene14_pink->_ox + 40) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene14_pink, 0); + cmd->_messageKind = 0; + return true; + } + } + } + } + return false; + } + + if (getCurrSceneSc2MotionController()->_objtype != kObjTypeMctlCompound) + return false; + + if (!getCurrSceneSc2MotionController()->_motionControllers[0]->_movGraphReactObj->pointInRegion(cmd->_sceneClickX, cmd->_sceneClickY)) + return false; + + if (cmd->_sceneClickX > 1237) + return false; + + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1237, 451, 1, 0); + + if (!mq) + return false; + + ExCommand *ex = new ExCommand(0, 17, MSG_SC14_STARTARCADE, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->setFlags(mq->getFlags() | 1); + + postExCommand(g_fp->_aniMan->_id, 2, 1237, 451, 0, -1); + + cmd->_messageKind = 0; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + return true; +} + +void sceneHandler14_grandmaThrow() { + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + MessageQueue *mq = new MessageQueue; + ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); +} + +void sceneHandler14_passToGrandma() { + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->_priority = 27; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_FALL, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 2; + ex->_field_24 = 1; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->chain(0); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + + sceneHandler14_grandmaThrow(); +} + +void sceneHandler14_grandmaJumpThrow() { + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + MessageQueue *mq = new MessageQueue; + ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_JUMPFW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); + + g_vars->scene14_dude2X += 71; + g_fp->_currentScene->_x = 71; + + g_fp->_aniMan2 = g_fp->_aniMan; +} + +void sceneHandler14_dudeFall() { + if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id != MV_MAN14_FALL) { + sceneHandler14_clearCallback(); + + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + g_fp->_aniMan->startAnim(MV_MAN14_FALL, 0, -1); + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->hide(); + + sceneHandler14_grandmaJumpThrow(); + } + ++g_vars->scene14_hitsLeft; +} + +void sceneHandler14_grandmaStepForward() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + g_fp->_aniMan->startAnim(MV_MAN14_STEPFW, 0, -1); + + g_vars->scene14_dude2X -= 71; + + g_fp->_currentScene->_x = -71; + g_fp->_aniMan2 = g_vars->scene14_grandma; +} + +void sceneHandler14_arcadeLogic() { + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->hide(); + + if (g_vars->scene14_dudeIsKicking) + sceneHandler14_clearCallback(); + + if (g_vars->scene14_hitsLeft <= 1) { + setInputDisabled(1); + + sceneHandler14_clearCallback(); + + g_vars->scene14_dudeCanKick = false; + g_fp->_aniMan2 = 0; + + chainQueue(QU_SC14_WINARCADE, 1); + + --g_vars->scene14_hitsLeft; + } else { + ExCommand *ex; + + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + if (g_vars->scene14_hitsLeft != 3 || g_vars->scene14_pink) { + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_BACKOFF, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); + } else { + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_BACKOFF2, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); + } + + sceneHandler14_grandmaStepForward(); + --g_vars->scene14_hitsLeft; + } +} + +void sceneHandler14_animateBall() { + int x = g_vars->scene14_ballDeltaX + g_vars->scene14_ballX; + int y = g_vars->scene14_ballDeltaY + g_vars->scene14_ballY; + + g_vars->scene14_ballX += g_vars->scene14_ballDeltaX; + g_vars->scene14_ballY += g_vars->scene14_ballDeltaY; + + g_vars->scene14_ballDeltaY++; + + if (g_vars->scene14_ballDeltaY - 1 + g_vars->scene14_ballY > 517) { + if (x <= g_vars->scene14_dudeX - 16 ) { + if ( g_vars->scene14_ballDeltaX >= 0 || x >= g_vars->scene14_grandmaX + 65 || x <= g_vars->scene14_grandmaX - 135 || y <= g_vars->scene14_grandmaY - 102 ) { + if (g_vars->scene14_flyingBall->_movement) + g_vars->scene14_flyingBall->_movement->setOXY(x, y); + else + g_vars->scene14_flyingBall->setOXY(x, y); + } else { + sceneHandler14_arcadeLogic(); + g_vars->scene14_ballIsFlying = false; + } + } else { + sceneHandler14_dudeFall(); + g_vars->scene14_ballIsFlying = false; + } + } else { + sceneHandler14_passToGrandma(); + g_vars->scene14_ballIsFlying = false; + } +} + +int sceneHandler14(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch(cmd->_messageNum) { + case MSG_SC14_SHOWBALLGMAHIT2: + sceneHandler14_showBallGrandmaHit2(); + break; + + case MSG_SC14_SHOWBALLGMADIVE: + sceneHandler14_showBallGrandmaDive(); + break; + + case MSG_LIFT_CLICKBUTTON: + g_fp->lift_animation3(); + break; + + case MSG_SC14_SHOWBALLGMAHIT: + sceneHandler14_showBallGrandmaHit(); + break; + + case MSG_SC14_SHOWBALLMAN: + sceneHandler14_showBallMan(); + break; + + case MSG_SC14_MANKICKBALL: + sceneHandler14_manKickBall(); + break; + + case MSG_SC14_SHOWBALLFLY: + sceneHandler14_showBallFly(); + break; + + case MSG_LIFT_GO: + g_fp->lift_goAnimation(); + break; + + case MSG_SC14_GMAJUMP: + sceneHandler14_grandmaJump(); + break; + + case MSG_LIFT_CLOSEDOOR: + g_fp->lift_closedoorSeq(); + break; + + case MSG_LIFT_EXITLIFT: + g_fp->lift_exitSeq(cmd); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fp->lift_startExitQueue(); + break; + + case MSG_SC14_RESTORESCROLL: + g_fp->_aniMan2 = g_fp->_aniMan; + g_fp->_scrollSpeed = 8; + break; + + case MSG_CMN_WINARCADE: + sceneHandler14_winArcade(); + break; + + case MSG_SC14_SCROLLLEFT: + g_fp->_aniMan2 = 0; + g_fp->_currentScene->_x = -g_fp->_sceneRect.left; + g_fp->_scrollSpeed = 24; + break; + + case MSG_SC14_SHOWBALLLAST: + sceneHandler14_showBallLast(); + break; + + case MSG_SC14_HIDEBALLLAST: + sceneHandler14_hideBallLast(); + break; + + case MSG_SC14_HIDEPINK: + if (!g_vars->scene14_pink) + break; + + g_vars->scene14_pink->hide(); + break; + + case MSG_SC14_GMATOTRUBA: + g_fp->_currentScene->_x = -g_fp->_sceneRect.left; + break; + + case MSG_SC14_STARTARCADE: + sceneHandler14_startArcade(); + break; + + case MSG_SC14_ENDARCADE: + sceneHandler14_endArcade(); + + g_vars->scene14_grandmaIsHere = false; + break; + + case 64: + g_fp->lift_sub05(cmd); + break; + + case 33: + { + Movement *mov = g_fp->_aniMan->_movement; + + if (mov) { + g_vars->scene14_dudeX = mov->_ox; + g_vars->scene14_dudeY = mov->_oy; + + if (mov->_id == MV_MAN14_KICK) + g_vars->scene14_dudeX = mov->_ox + 2 * g_fp->_aniMan->_movement->_currDynamicPhaseIndex; + } else { + g_vars->scene14_dudeX = g_fp->_aniMan->_ox; + g_vars->scene14_dudeY = g_fp->_aniMan->_oy; + } + + mov = g_vars->scene14_grandma->_movement; + if (mov) { + g_vars->scene14_grandmaX = mov->_ox; + g_vars->scene14_grandmaY = mov->_oy; + } else { + g_vars->scene14_grandmaX = g_vars->scene14_grandma->_ox; + g_vars->scene14_grandmaY = g_vars->scene14_grandma->_oy; + } + + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + g_vars->scene14_dude2X = x; + + if (x < g_fp->_sceneRect.left + g_vars->scene14_sceneDeltaX) { + g_fp->_currentScene->_x = x - g_vars->scene14_sceneDiffX - g_fp->_sceneRect.left; + x = g_vars->scene14_dude2X; + } + + if (x > g_fp->_sceneRect.right - g_vars->scene14_sceneDeltaX) + g_fp->_currentScene->_x = x + g_vars->scene14_sceneDiffX - g_fp->_sceneRect.right; + } + + if (g_vars->scene14_ballIsFlying) + sceneHandler14_animateBall(); + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + break; + } + + case 30: + if (g_vars->scene14_dudeIsKicking) { + sceneHandler14_kickAnimation(); + break; + } + + if (!g_vars->scene14_arcadeIsOn) { + break; + } + break; + + case 29: + if (g_vars->scene14_arcadeIsOn) { + int pixel; + + if (g_vars->scene14_dudeCanKick && g_fp->_aniMan->getPixelAtPos(cmd->_sceneClickX, cmd->_sceneClickY, &pixel) && !g_fp->_aniMan->_movement) { + sceneHandler14_dudeDecline(); + break; + } + } else { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fp->lift_sub1(ani); + cmd->_messageKind = 0; + break; + } + + if (!sceneHandler14_arcadeProcessClick(cmd) && (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode))) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { + g_fp->processArcade(cmd); + sceneHandler14_arcadeProcessClick(cmd); + break; + } + } + } + } + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene15.cpp b/engines/fullpipe/scenes/scene15.cpp index 8310fc8607..fa8db64497 100644 --- a/engines/fullpipe/scenes/scene15.cpp +++ b/engines/fullpipe/scenes/scene15.cpp @@ -82,7 +82,7 @@ void scene15_initScene(Scene *sc) { g_vars->scene15_ladder = sc->getPictureObjectById(PIC_SC15_LADDER, 0); g_vars->scene15_boot = sc->getStaticANIObject1ById(ANI_BOOT_15, -1); - if (g_fp->getObjectState(sO_Boot_15) != g_fp->getObjectEnumState(sO_Boot_15, sO_Available)) + if (g_fp->getObjectState(sO_Boot_15) != g_fp->getObjectEnumState(sO_Boot_15, sO_IsPresent)) g_vars->scene15_boot->_flags &= 0xFFFB; g_fp->_currentScene = oldsc; diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp new file mode 100644 index 0000000000..b1e261287a --- /dev/null +++ b/engines/fullpipe/scenes/scene16.cpp @@ -0,0 +1,484 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene16_initScene(Scene *sc) { + g_vars->scene16_figures.clear(); + g_vars->scene16_walkingBoy = 0; + g_vars->scene16_walkingGirl = 0; + g_vars->scene16_walkingCount = 200; + g_vars->scene16_wire = sc->getStaticANIObject1ById(ANI_WIRE16, -1); + g_vars->scene16_mug = sc->getStaticANIObject1ById(ANI_MUG, -1); + g_vars->scene16_jettie = sc->getStaticANIObject1ById(ANI_JETTIE, -1); + g_vars->scene16_boot = sc->getStaticANIObject1ById(ANI_BOOT_16, -1); + g_vars->scene16_girlIsLaughing = false; + g_vars->scene16_sound = SND_16_034; + + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) { + g_vars->scene16_placeIsOccupied = true; + + StaticANIObject *boy[2]; + boy[0] = sc->getStaticANIObject1ById(ANI_BOY, -1); + boy[0]->loadMovementsPixelData(); + + boy[1] = new StaticANIObject(boy[0]); + sc->addStaticANIObject(boy[1], 1); + + int idx = 0; + + for (int i = 0; i < 3; i++) { + g_vars->scene16_figures.push_back(boy[idx]); + + idx++; + + if (idx >= 2) + idx = 0; + } + + g_vars->scene16_figures.push_back(sc->getStaticANIObject1ById(ANI_GIRL, -1)); + + for (int i = 0; i < 4; i++) { + g_vars->scene16_figures.push_back(boy[idx]); + + idx++; + + if (idx >= 2) + idx = 0; + } + } else { + g_fp->setObjectState(sO_Girl, g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)); + + g_vars->scene16_placeIsOccupied = false; + + StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1)); + ani->_movement = 0; + ani->_statics = (Statics *)ani->_staticsList[0]; + sc->addStaticANIObject(ani, 1); + } + + if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsLaughing)) { + StaticANIObject *girl = sc->getStaticANIObject1ById(ANI_GIRL, -1); + + girl->show1(554, 432, MV_GRL_LAUGH_POPA, 0); + girl->_priority = 20; + } + + if (g_fp->getObjectState(sO_Cup) == g_fp->getObjectEnumState(sO_Cup, sO_In_16)) { + g_vars->scene16_mug->_statics = g_vars->scene16_mug->getStaticsById(ST_MUG_EMPTY); + g_vars->scene16_mug->_movement = 0; + g_vars->scene16_mug->setOXY(409, 459); + g_vars->scene16_mug->_priority = 5; + g_vars->scene16_mug->_flags |= 4; + } +} + +int scene16_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC16_TUMBA) { + if (g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + } else { + if (g_fp->_objectIdAtCursor == ANI_MUG && g_fp->_cursorId == PIC_CSR_ITN && g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL) + g_fp->_cursorId = PIC_CSR_ITN_GREEN; + } + + return g_fp->_cursorId; +} + +void sceneHandler16_laughSound() { + int snd = SND_16_035; + + switch (g_vars->scene16_sound) { + case SND_16_034: + snd = SND_16_035; + break; + + case SND_16_035: + snd = SND_16_037; + break; + + case SND_16_037: + snd = SND_16_034; + break; + } + + g_vars->scene16_sound = snd; + + g_fp->playSound(snd, 0); +} + +void sceneHandler16_showBearded() { + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Unconvoluted)) { + StaticANIObject *brd = g_fp->_currentScene->getStaticANIObject1ById(ANI_BEARDED_CMN, -1); + + if (!brd || !(brd->_flags & 4)) + chainQueue(QU_BRD16_STARTBEARDED, 0); + } +} + +void sceneHandler16_showMugFull() { + g_vars->scene16_mug->changeStatics2(ST_MUG_FULL); +} + +void sceneHandler16_fillMug() { + if (g_vars->scene16_mug->_flags & 4) { + g_vars->scene16_jettie->_priority = 2; + g_vars->scene16_jettie->startAnim(MV_JTI_FLOWIN, 0, -1); + + if (g_fp->_aniMan->_movement) { + if (g_fp->_aniMan->_movement->_id == MV_MAN16_TAKEMUG) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + + g_vars->scene16_mug->show1(-1, -1, -1, 0); + + g_fp->setObjectState(sO_Cup, g_fp->getObjectEnumState(sO_Cup, sO_DudeHas)); + } + } + return; + } + + MessageQueue *mq; + + if (!(g_vars->scene16_boot->_flags & 4)) { + g_vars->scene16_jettie->_priority = 15; + g_vars->scene16_jettie->startAnim(MV_JTI_FLOWBY, 0, -1); + + if (g_vars->scene16_walkingBoy) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); + if (mq->chain(g_vars->scene16_walkingBoy) || !mq) + return; + } else { + if (!g_vars->scene16_walkingGirl) + return; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode); + if (mq->chain(g_vars->scene16_walkingGirl)) + return; + } + delete mq; + + return; + } + + g_vars->scene16_jettie->_priority = 15; + + g_vars->scene16_boot->startAnim(MV_BT16_FILL, 0, -1); + + StaticANIObject *ani; + + if (g_vars->scene16_walkingBoy) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); + + ani = g_vars->scene16_walkingBoy; + } else { + if (!g_vars->scene16_walkingGirl) + return; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode); + ani = g_vars->scene16_walkingGirl; + } + + if (!mq->chain(ani)) + delete mq; +} + +void sceneHandler16_startLaugh() { + StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1); + + girl->changeStatics2(ST_GRL_STAND); + + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLLAUGH), 0, 1); + + mq->replaceKeyCode(-1, girl->_okeyCode); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->setSubVarAsInt(sO_DudeSwinged, 0); + + g_vars->scene16_girlIsLaughing = true; +} + +void sceneHandler16_drink() { + if (g_vars->scene16_mug->_flags & 4) { + if (!g_vars->scene16_jettie->_movement) { + if (!g_vars->scene16_walkingBoy || !g_vars->scene16_walkingBoy->_movement || g_vars->scene16_walkingBoy->_movement->_id != MV_BOY_DRINK) { + if (!g_vars->scene16_walkingGirl || !g_vars->scene16_walkingGirl->_movement || g_vars->scene16_walkingGirl->_movement->_id != MV_GRL_DRINK) { + if (g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL) { + MessageQueue *mq; + ExCommand *ex; + + if (g_vars->scene16_walkingBoy) { + g_fp->_aniMan->_flags |= 0x180; + + g_vars->scene16_walkingBoy->changeStatics2(ST_BOY_STAND); + g_vars->scene16_walkingBoy->queueMessageQueue(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYKICK), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); + + ex = new ExCommand(ANI_MAN, 34, 384, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3u; + ex->_field_14 = 384; + ex->_messageNum = 0; + + mq->insertExCommandAt(2, ex); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } else { + g_fp->_aniMan->_flags |= 1; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_MANDRINK), 0, 1); + + ex = new ExCommand(ANI_MAN, 34, 256, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3u; + ex->_field_14 = 256; + ex->_messageNum = 0; + + mq->addExCommandToEnd(ex); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1)->changeStatics2(ST_GRL_STAND); + } + + g_fp->_currentScene->getStaticANIObject1ById(ANI_WIRE16, -1)->show1(-1, -1, -1, 0); + } else { + chainObjQueue(g_fp->_aniMan, QU_SC16_TAKEMUG, 1); + } + } + } + } + } +} + +void sceneHandler16_mugClick() { + if (abs(310 - g_fp->_aniMan->_ox) >= 1 || abs(449 - g_fp->_aniMan->_oy) >= 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 310, 449, 1, ST_MAN_RIGHT); + + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC16_MUGCLICK, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, 310, 449, 0, -1); + } + } else { + sceneHandler16_drink(); + } +} + +void sceneHandler16_showMan() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + g_fp->_aniMan->show1(-1, -1, -1, 0); + + g_vars->scene16_mug->show1(-1, -1, -1, 0); +} + +void sceneHandler16_showMug() { + chainQueue(QU_SC16_SHOWMUG, 0); +} + +void sceneHandler16_hideMan() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + g_fp->_aniMan->hide(); + + g_vars->scene16_mug->hide(); +} + +void sceneHandler16_hideMug() { + g_vars->scene16_mug->hide(); +} + +void sceneHandler16_hideWire() { + g_vars->scene16_wire->hide(); +} + +void sceneHandler16_showWire() { + g_vars->scene16_wire->show1(-1, -1, -1, 0); +} + +void sceneHandler16_putOnWheel() { + StaticANIObject *ani = g_vars->scene16_walkingBoy; + + if (!ani) + ani = g_vars->scene16_walkingGirl; + + if (ani) + g_vars->scene16_figures.push_back(ani); + + ani = g_vars->scene16_figures.front(); + + g_vars->scene16_figures.pop_front(); + + if (ani) { + MessageQueue *mq; + + if (ani->_id == ANI_BOY) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOBOY), 0, 1); + + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene16_walkingBoy = ani; + g_vars->scene16_walkingGirl = 0; + } else if (ani->_id == ANI_GIRL) { + if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOGIRL), 0, 1); + + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene16_walkingBoy = 0; + g_vars->scene16_walkingGirl = ani; + } + } + } +} + +void sceneHandler16_girlROTFL() { + StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1); + + girl->changeStatics2(ST_GRL_LAUGH); + girl->startAnim(MV_GRL_FALL, 0, -1); + + g_vars->scene16_girlIsLaughing = false; +} + +int sceneHandler16(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch(cmd->_messageNum) { + case MSG_SC16_LAUGHSOUND: + sceneHandler16_laughSound(); + break; + + case MSG_SC16_SHOWBEARDED: + sceneHandler16_showBearded(); + break; + + case MSG_SC16_SHOWMUGFULL: + sceneHandler16_showMugFull(); + break; + + case MSG_SC16_FILLMUG: + sceneHandler16_fillMug(); + break; + + case MSG_SC16_STARTLAUGH: + sceneHandler16_startLaugh(); + break; + + case MSG_SC16_MUGCLICK: + if (!g_fp->_aniMan->isIdle() || g_fp->_aniMan->_flags & 0x100) + cmd->_messageKind = 0; + else + sceneHandler16_mugClick(); + + break; + + case MSG_SC16_SHOWMAN: + sceneHandler16_showMan(); + break; + + case MSG_SC16_SHOWMUG: + sceneHandler16_showMug(); + break; + + case MSG_SC16_HIDEMAN: + sceneHandler16_hideMan(); + break; + + case MSG_SC16_HIDEMUG: + sceneHandler16_hideMug(); + break; + + case MSG_SC16_HIDEWIRE: + sceneHandler16_hideWire(); + break; + + case MSG_SC16_SHOWWIRE: + sceneHandler16_showWire(); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene16_placeIsOccupied) { + g_vars->scene16_walkingCount++; + + if (g_vars->scene16_walkingCount < 280) { + sceneHandler16_putOnWheel(); + + g_vars->scene16_walkingCount = 0; + } + } + + if (g_vars->scene16_girlIsLaughing) { + if (g_fp->_aniMan->_movement) + if (g_fp->_aniMan->_movement->_id == MV_MAN_TURN_RL) + sceneHandler16_girlROTFL(); + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene17.cpp b/engines/fullpipe/scenes/scene17.cpp new file mode 100644 index 0000000000..73bf7ab1c0 --- /dev/null +++ b/engines/fullpipe/scenes/scene17.cpp @@ -0,0 +1,285 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void scene17_initScene(Scene *sc) { + g_vars->scene17_flyState = 1; + g_vars->scene17_sugarIsShown = false; + g_vars->scene17_sceneOldEdgeX = 0; + g_vars->scene17_flyCountdown = 0; + g_vars->scene17_hand = sc->getStaticANIObject1ById(ANI_HAND17, -1); +} + +void scene17_restoreState() { + if (g_fp->getObjectState(sO_UsherHand) == g_fp->getObjectEnumState(sO_UsherHand, sO_WithCoin)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0); + + g_vars->scene17_handPhase = false; + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1); + + g_vars->scene17_handPhase = true; + } + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_17")); + + g_vars->scene17_flyState = g_fp->getObjectState(sO_Fly_17); + + if (g_vars->scene17_flyState <= 0 ) { + g_vars->scene17_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600; + + g_vars->scene17_flyState = g_fp->_rnd->getRandomNumber(4) + 1; + } + + g_fp->setObjectState(sO_Fly_17, g_vars->scene17_flyState - 1); +} + +int scene17_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor != PIC_SC17_RTRUBA2 && g_fp->_objectIdAtCursor != PIC_SC17_RTRUBA) + return g_fp->_cursorId; + + if (!g_vars->scene17_handPhase) + return g_fp->_cursorId; + + int item = g_fp->_inventory->getSelectedItemId(); + + if ((g_fp->_cursorId != PIC_CSR_DEFAULT_INV || item != ANI_INV_COIN) && item != ANI_INV_BOOT && item != ANI_INV_HAMMER) + ; // empty + else + g_fp->_cursorId = PIC_CSR_ITN_INV; + + return g_fp->_cursorId; +} + +void sceneHandler17_drop() { + StaticANIObject *mug = g_fp->_currentScene->getStaticANIObject1ById(ANI_MUG_17, -1); + StaticANIObject *jet = g_fp->_currentScene->getStaticANIObject1ById(ANI_JET_17, -1); + + if (mug && mug->_flags & 4) { + mug->changeStatics2(ST_MUG17_EMPTY); + chainQueue(QU_SC17_FILLMUG_DROP, 0); + } else if (jet) { + jet->queueMessageQueue(0); + chainQueue(QU_JET17_DROP, 0); + } +} + +void sceneHandler17_fillBottle() { + StaticANIObject *bottle = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_BOTTLE, -1); + StaticANIObject *mug = g_fp->_currentScene->getStaticANIObject1ById(ANI_MUG_17, -1); + StaticANIObject *boot = g_fp->_currentScene->getStaticANIObject1ById(ANI_BOOT_17, -1); + + if (bottle && (bottle->_flags & 4)) + chainQueue(QU_SC17_FILLBOTTLE, 1); + else if (mug && (mug->_flags & 4) && mug->_statics->_staticsId == ST_MUG17_EMPTY) + chainQueue(QU_SC17_FILLMUG, 1); + else if (boot && (boot->_flags & 4)) + chainQueue(QU_SC17_FILLBOOT, 1); + else + chainQueue(QU_JET17_FLOW, 1); +} + +void sceneHandler17_testTruba() { + if (g_vars->scene17_hand->isIdle()) { + if (!g_vars->scene17_hand->_movement || g_vars->scene17_hand->_movement->_id != MV_HND17_FIGA) { + g_vars->scene17_hand->changeStatics2(ST_HND17_EMPTY); + g_vars->scene17_hand->startAnim(MV_HND17_FIGA, 0, -1); + } + } +} + +void sceneHandler17_showBottle() { + chainQueue(QU_SC17_SHOWBOTTLE, 0); +} + +void sceneHandler17_hideSugar() { + StaticANIObject *sugar = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_SUGAR, -1); + + if (sugar) + sugar->hide(); +} + +void sceneHandler17_showSugar() { + chainQueue(QU_SC17_SHOWSUGAR, 0); + + g_vars->scene17_sugarIsShown = true; +} + +void sceneHandler17_moonshineFill() { + StaticANIObject *moonshiner = g_fp->_currentScene->getStaticANIObject1ById(ANI_SAMOGONSHCHIK, -1); + + if (!(moonshiner->_flags & 0x80)) { + moonshiner->changeStatics2(ST_SMG_SIT); + chainObjQueue(moonshiner, QU_SMG_FILLBOTTLE, 1); + + g_vars->scene17_sugarIsShown = false; + } +} + +void sceneHandler17_updateFlies() { + g_fp->_floaters->genFlies(g_fp->_currentScene, 239, -50, 20, 4); + + g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd->getRandomNumber(5) + 6; + g_fp->_floaters->_array2[0]->val6 = 239; + g_fp->_floaters->_array2[0]->val7 = -50; +} + + +int sceneHandler17(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC17_DROP: + sceneHandler17_drop(); + break; + + case MSG_SC17_UPDATEHAND: + if (g_fp->getObjectState(sO_UsherHand) == g_fp->getObjectEnumState(sO_UsherHand, sO_WithCoin)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0); + + g_vars->scene17_handPhase = false; + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1); + + g_vars->scene17_handPhase = true; + } + break; + + case MSG_SC17_FILLBOTTLE: + sceneHandler17_fillBottle(); + break; + + case MSG_SC17_TESTTRUBA: + sceneHandler17_testTruba(); + break; + + case MSG_SC17_SHOWBOTTLE: + sceneHandler17_showBottle(); + break; + + case MSG_SC17_HIDESUGAR: + sceneHandler17_hideSugar(); + break; + + case MSG_SC17_SHOWSUGAR: + sceneHandler17_showSugar(); + break; + + case 29: + { + int pic = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (pic == PIC_SC17_RTRUBA2 || pic == PIC_SC17_RTRUBA) { + if (cmd->_keyCode == ANI_INV_COIN || cmd->_keyCode == ANI_INV_BOOT || cmd->_keyCode == ANI_INV_HAMMER) { + if (g_vars->scene17_handPhase) { + if (g_fp->_aniMan->isIdle()) { + if (!(g_fp->_aniMan->_flags & 0x100)) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene17_hand, cmd->_keyCode); + break; + } + } + } + } + } + } + break; + + case 33: + { + int x = g_vars->scene17_sceneEdgeX; + g_vars->scene17_sceneOldEdgeX = g_vars->scene17_sceneEdgeX; + + if (g_fp->_aniMan2) { + x = g_fp->_aniMan2->_ox; + + g_vars->scene17_sceneEdgeX = x; + + if (x < g_fp->_sceneRect.left + 200) { + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + x = g_vars->scene17_sceneEdgeX; + } + + if (x > g_fp->_sceneRect.right - 200) { + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + x = g_vars->scene17_sceneEdgeX; + } + } + + if (g_vars->scene17_sugarIsShown) { + sceneHandler17_moonshineFill(); + x = g_vars->scene17_sceneEdgeX; + } + + if (g_vars->scene17_handPhase) { + if (g_vars->scene17_sceneOldEdgeX < 410 && x >= 410) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_ATTRACT, QU_HND17_ATTRACT, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 1); + } else if (g_vars->scene17_sceneOldEdgeX > 410 && x <= 410) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_ATTRACT, QU_HND17_ATTRACT, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + } + } + + --g_vars->scene17_flyCountdown; + + if (!g_vars->scene17_flyCountdown) + sceneHandler17_updateFlies(); + + g_fp->_floaters->update(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene20.cpp b/engines/fullpipe/scenes/scene20.cpp new file mode 100644 index 0000000000..5fed24aabd --- /dev/null +++ b/engines/fullpipe/scenes/scene20.cpp @@ -0,0 +1,155 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void scene20_setExits(Scene *sc) { + int thingpar; + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool) + || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) + thingpar = 1; + else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe) + || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) { + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing, 1); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing2, 1); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing3, 0); + + return; + } else { + thingpar = 0; + } + + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing, thingpar); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing2, 0); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing3, 1); +} + +void scene20_initScene(Scene *sc) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene20_grandma = sc->getStaticANIObject1ById(ANI_GRANDMA_20, -1); + + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) + g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe)); + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool)) { + g_vars->scene20_grandma->changeStatics2(ST_GMA20_STOOL); + } else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) { + g_vars->scene20_grandma->changeStatics2(ST_GMA20_FLOOR); + } else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe) + || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) { + g_vars->scene20_grandma->changeStatics2(ST_GMA20_STAND); + } else { + g_vars->scene20_grandma->hide(); + } + + scene20_setExits(sc); + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_20")); + + for (int i = 0; i < 3; i++) { + g_fp->_floaters->genFlies(sc, g_fp->_rnd->getRandomNumber(101) + 70, g_fp->_rnd->getRandomNumber(51) + 175, 100, 0); + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = g_fp->_rnd->getRandomNumber(9); + } + + g_fp->_currentScene = oldsc; + + g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400; +} + +void sceneHandler20_updateFlies() { + int sz = g_fp->_floaters->_array2.size(); + + if (sz < 3) { + g_fp->_floaters->genFlies(g_fp->_currentScene, 253, 650, 200, 0); + g_fp->_floaters->_array2[sz - 1]->val2 = 250; + g_fp->_floaters->_array2[sz - 1]->val3 = 200; + } else { + int idx = g_fp->_rnd->getRandomNumber(sz); + + g_fp->_floaters->_array2[idx]->countdown = 0; + g_fp->_floaters->_array2[idx]->fflags |= 4u; + g_fp->_floaters->_array2[idx]->val2 = 250; + g_fp->_floaters->_array2[idx]->val3 = 200; + g_fp->_floaters->_array2[idx]->val6 = 253; + g_fp->_floaters->_array2[idx]->val7 = 650; + g_fp->_floaters->_array2[idx]->ani->_priority = 200; + } + + g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400; +} + +int sceneHandler20(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC20_UPDATELOCKABLE: + scene20_setExits(g_fp->_currentScene); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + --g_vars->scene20_fliesCountdown; + + if (g_vars->scene20_fliesCountdown <= 0) + sceneHandler20_updateFlies(); + + g_fp->_floaters->update(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene21.cpp b/engines/fullpipe/scenes/scene21.cpp new file mode 100644 index 0000000000..5a6509964d --- /dev/null +++ b/engines/fullpipe/scenes/scene21.cpp @@ -0,0 +1,148 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene21_initScene(Scene *sc) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene21_giraffeBottom = sc->getStaticANIObject1ById(ANI_GIRAFFE_BOTTOM, -1); + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG); + g_vars->scene21_pipeIsOpen = true; + g_vars->scene21_wigglePos = 0.0; + g_vars->scene21_giraffeBottomX = g_vars->scene21_giraffeBottom->_ox; + g_vars->scene21_giraffeBottomY = g_vars->scene21_giraffeBottom->_oy; + g_vars->scene21_wiggleTrigger = false; + } else { + g_vars->scene21_pipeIsOpen = false; + } + g_fp->_currentScene = oldsc; + g_fp->initArcadeKeys("SC_21"); +} + +int scene21_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC21_DTRUBA) + + g_fp->_cursorId = PIC_CSR_GOD; + + return g_fp->_cursorId; +} + +void sceneHandler21_doWiggle() { + g_vars->scene21_giraffeBottom->setOXY((int)(cos(g_vars->scene21_wigglePos) * 4.0) + g_vars->scene21_giraffeBottom->_ox, + g_vars->scene21_giraffeBottom->_oy); + + g_vars->scene21_wigglePos += 0.19635; + + if (g_vars->scene21_wigglePos > 6.2831853) { + g_vars->scene21_wigglePos = 0; + + if (!g_vars->scene21_giraffeBottom->_movement) + g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY); + } +} + +int sceneHandler21(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC21_UPDATEASS: + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG); + g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY); + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_SIT); + + g_vars->scene21_pipeIsOpen = false; + + g_fp->setObjectState(sO_LowerPipe_21, g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsClosed)); + } + + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode) ) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x <= g_fp->_sceneWidth - 460) { + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + } else { + g_fp->_currentScene->_x = g_fp->_sceneWidth - x; + } + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene21_pipeIsOpen && !g_vars->scene21_wiggleTrigger) + sceneHandler21_doWiggle(); + + g_vars->scene21_wiggleTrigger = !g_vars->scene21_wiggleTrigger; + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp new file mode 100644 index 0000000000..13c9ab36e9 --- /dev/null +++ b/engines/fullpipe/scenes/scene22.cpp @@ -0,0 +1,395 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene22_initScene(Scene *sc) { + g_vars->scene22_bag = sc->getStaticANIObject1ById(ANI_MESHOK, -1); + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + g_vars->scene22_giraffeMiddle = sc->getStaticANIObject1ById(ANI_GIRAFFE_MIDDLE, -1); + g_vars->scene22_dudeIsOnStool = false; + g_vars->scene22_interactionIsDisabled = false; + g_vars->scene22_craneIsOut = true; + + if (g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_NotFallen)) + g_vars->scene22_numBagFalls = 0; + else if (g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_FallenOnce)) + g_vars->scene22_numBagFalls = 1; + else if ( g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_FallenTwice)) + g_vars->scene22_numBagFalls = 2; + else { + g_vars->scene22_numBagFalls = 3; + g_vars->scene22_craneIsOut = false; + } + + + if ( g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) + g_vars->scene22_giraffeMiddle->changeStatics2(ST_GRFM_AFTER); + else + g_vars->scene22_giraffeMiddle->changeStatics2(ST_GRFM_NORM); + + g_fp->_currentScene = oldsc; + + g_fp->initArcadeKeys("SC_22"); +} + +int scene22_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor != ANI_HANDLE_L) + return g_fp->_cursorId; + + int sel = g_fp->_inventory->getSelectedItemId(); + + if (!sel) { + g_fp->_cursorId = PIC_CSR_ITN; + return g_fp->_cursorId; + } + + if (g_vars->scene22_dudeIsOnStool || (sel != ANI_INV_STOOL && sel != ANI_INV_BOX)) + ; //empty + else + g_fp->_cursorId = PIC_CSR_ITN_INV; + + return g_fp->_cursorId; +} + +void scene22_setBagState() { + if (g_vars->scene22_craneIsOut) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 0); + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 1); + } +} + +void sceneHandler22_showStool() { + chainQueue(QU_SC22_SHOWSTOOL, 0); +} + +void sceneHandler22_hideStool() { + g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1)->hide(); +} + +void sceneHandler22_handleDown() { + if (g_vars->scene22_bag->_statics->_staticsId == ST_MSH_SIT) { + chainQueue(QU_MSH_CRANEOUT, 1); + g_vars->scene22_interactionIsDisabled = false; + } else { + ++g_vars->scene22_numBagFalls; + + int qid; + + if (g_vars->scene22_numBagFalls == 3) { + chainQueue(QU_SC22_FALLSACK_GMA, 1); + qid = QU_SC22_FALLBROOM; + } else { + qid = QU_SC22_FALLSACK; + } + + chainQueue(qid, 1); + + int state; + + if (g_vars->scene22_numBagFalls) { + if (g_vars->scene22_numBagFalls == 1) { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_FallenOnce); + } else if (g_vars->scene22_numBagFalls == 2) { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_FallenTwice); + } else { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_BrushHasFallen); + } + } else { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_NotFallen); + } + + g_fp->setObjectState(sO_Bag_22, state); + } + + g_vars->scene22_craneIsOut = true; + + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 0); +} + +void sceneHandler22_fromStool(ExCommand *cmd) { + if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_FROMSTOOL), 0, 0); + + mq->addExCommandToEnd(cmd->createClone()); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } +} + +void sceneHandler22_stoolLogic(ExCommand *cmd) { + StaticANIObject *ani; + MessageQueue *mq; + int xpos; + int manId; + + if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) { + if (cmd->_keyCode == ANI_INV_STOOL) { + if (abs(841 - g_fp->_aniMan->_ox) <= 1) { + if (abs(449 - g_fp->_aniMan->_oy) <= 1) { + chainQueue(QU_SC22_PUTSTOOL, 1); + g_vars->scene22_interactionIsDisabled = true; + + return; + } + } + goto LABEL_13; + } + + if (cmd->_keyCode == ANI_INV_BOX) { + ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1); + if (!ani || !(ani->_flags & 4)) { + if (abs(841 - g_fp->_aniMan->_ox) <= 1) { + if (abs(449 - g_fp->_aniMan->_oy) <= 1) { + chainObjQueue(g_fp->_aniMan, QU_SC22_TRYBOX, 1); + return; + } + } + LABEL_13: + xpos = 841; + manId = ST_MAN_RIGHT; + LABEL_31: + mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, xpos, 449, 1, manId); + + if (!mq) + return; + + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 841, 449, 0, -1); + return; + } + } else { + if (cmd->_keyCode) + return; + + if (g_vars->scene22_dudeIsOnStool) { + if (g_fp->_aniMan->_movement) + return; + + chainQueue(QU_SC22_HANDLEDOWN, 1); + + g_vars->scene22_interactionIsDisabled = true; + return; + } + + ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1); + if (ani && (ani->_flags & 4)) { + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_ox; + + if (sqrt((double)((841 - x) * (841 - x) + (449 - y) * (449 - y))) + < sqrt((double)((1075 - x) * (1075 - x) + (449 - y) * (449 - y)))) { + if (abs(841 - x) <= 1) { + if (abs(449 - y) <= 1) { + chainQueue(QU_SC22_TOSTOOL, 1); + + g_vars->scene22_interactionIsDisabled = true; + return; + } + } + goto LABEL_13; + } + + if (abs(1075 - x) > 1 || abs(449 - y) > 1) { + xpos = 1075; + manId = ST_MAN_RIGHT | 0x4000; + goto LABEL_31; + } + + MGM mgm; + MGMInfo mgminfo; + + mgm.addItem(ANI_MAN); + mgminfo.ani = g_fp->_aniMan; + mgminfo.staticsId2 = ST_MAN_RIGHT; + mgminfo.x1 = 934; + mgminfo.y1 = 391; + mgminfo.field_1C = 10; + mgminfo.staticsId1 = 0x4145; + mgminfo.x2 = 981; + mgminfo.y2 = 390; + mgminfo.field_10 = 1; + mgminfo.flags = 127; + mgminfo.movementId = rMV_MAN_TURN_SRL; + + mq = mgm.genMovement(&mgminfo); + + ExCommand *ex = mq->getExCommandByIndex(0); + + mq->deleteExCommandByIndex(0, 0); + + delete mq; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_TOSTOOL_R), 0, 0); + + mq->insertExCommandAt(2, ex); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_vars->scene22_interactionIsDisabled = true; + } else { + if (abs(1010 - g_fp->_aniMan->_ox) <= 1) { + if (abs(443 - g_fp->_aniMan->_oy) <= 1) { + chainQueue(QU_SC22_TRYHANDLE, 1); + return; + } + } + + mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1010, 443, 1, ST_MAN_UP); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 1010, 443, 0, -1); + return; + } + } + } + } +} + +int sceneHandler22(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC22_CRANEOUT_GMA: + chainQueue(QU_MSH_CRANEOUT_GMA, 1); + break; + + case MSG_SC22_CHECKGMABOOT: + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_15)) + g_fp->setObjectState(sO_Boot_15, g_fp->getObjectEnumState(sO_Boot_15, sO_IsPresent)); + + break; + + case MSG_SC22_SHOWSTOOL: + sceneHandler22_showStool(); + break; + + case MSG_SC22_HIDESTOOL: + sceneHandler22_hideStool(); + break; + + case MSG_SC22_FROMSTOOL: + g_vars->scene22_dudeIsOnStool = false; + g_vars->scene22_interactionIsDisabled = false; + + getCurrSceneSc2MotionController()->setEnabled(); + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + break; + + case MSG_SC22_ONSTOOL: + g_vars->scene22_dudeIsOnStool = true; + getCurrSceneSc2MotionController()->clearEnabled(); + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + break; + + case MSG_SC22_HANDLEDOWN: + sceneHandler22_handleDown(); + break; + + case 29: + if (!g_vars->scene22_interactionIsDisabled) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_HANDLE_L) { + sceneHandler22_stoolLogic(cmd); + return 0; + } + + if (!g_vars->scene22_dudeIsOnStool) { + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { + g_fp->processArcade(cmd); + return 0; + } + } + } + return 0; + } + + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_RIGHT && !g_fp->_aniMan->_movement) { + sceneHandler22_fromStool(cmd); + + return 0; + } + } + + cmd->_messageKind = 0; + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x <= g_fp->_sceneWidth - 460) { + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + } else { + g_fp->_currentScene->_x = g_fp->_sceneWidth - x; + } + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + } + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene23.cpp b/engines/fullpipe/scenes/scene23.cpp new file mode 100644 index 0000000000..1f2587eba4 --- /dev/null +++ b/engines/fullpipe/scenes/scene23.cpp @@ -0,0 +1,555 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +bool sceneHandler23_testCalendar() { + int cal0, cal1, cal2, cal3; + + if (g_vars->scene23_calend0->_movement) + cal0 = g_vars->scene23_calend0->_movement->_staticsObj2->_staticsId; + else + cal0 = g_vars->scene23_calend0->_statics->_staticsId; + + if (g_vars->scene23_calend1->_movement) + cal1 = g_vars->scene23_calend1->_movement->_staticsObj2->_staticsId; + else + cal1 = g_vars->scene23_calend1->_statics->_staticsId; + + if (g_vars->scene23_calend2->_movement) + cal2 = g_vars->scene23_calend2->_movement->_staticsObj2->_staticsId; + else + cal2 = g_vars->scene23_calend2->_statics->_staticsId; + + if (g_vars->scene23_calend3->_movement) + cal3 = g_vars->scene23_calend3->_movement->_staticsObj2->_staticsId; + else + cal3 = g_vars->scene23_calend3->_statics->_staticsId; + + return (cal0 == ST_CND_1 && cal1 == ST_CND_4 && cal2 == ST_CND_0 && cal3 == ST_CND_2 && (g_vars->scene23_giraffee->_flags & 4)); +} + +void scene23_initScene(Scene *sc) { + g_vars->scene23_calend0 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 0); + g_vars->scene23_calend1 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 1); + g_vars->scene23_calend2 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 2); + g_vars->scene23_calend3 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 3); + g_vars->scene23_topReached = false; + g_vars->scene23_isOnStool = false; + g_vars->scene23_someVar = 0; + g_vars->scene23_giraffeTop = sc->getStaticANIObject1ById(ANI_GIRAFFE_TOP, -1); + g_vars->scene23_giraffee = sc->getStaticANIObject1ById(ANI_GIRAFFEE, -1); + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_23")); + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)) { + sc->getPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN1, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN2, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN3, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN4, 0)->_flags |= 4; + + if (g_vars->scene23_giraffee->_statics->_staticsId == ST_GRFG_EMPTY || !(g_vars->scene23_giraffee->_flags & 4)) { + g_vars->scene23_giraffee->changeStatics2(ST_GRFG_BALD); + g_vars->scene23_giraffee->_flags |= 4; + } + g_vars->scene23_calend0->show1(-1, -1, -1, 0); + g_vars->scene23_calend1->show1(-1, -1, -1, 0); + g_vars->scene23_calend2->show1(-1, -1, -1, 0); + g_vars->scene23_calend3->show1(-1, -1, -1, 0); + + sc->getStaticANIObject1ById(ANI_LUK23_U, -1)->changeStatics2(ST_LUK23U_OPEN); + } else { + sc->getPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN1, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN2, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN3, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN4, 0)->_flags &= 0xFFFB; + + g_vars->scene23_giraffee->hide(); + g_vars->scene23_calend0->hide(); + g_vars->scene23_calend1->hide(); + g_vars->scene23_calend2->hide(); + g_vars->scene23_calend3->hide(); + + sc->getStaticANIObject1ById(ANI_LUK23_U, -1)->changeStatics2(ST_LUK23U_CLOSED); + + g_fp->_floaters->genFlies(sc, 600, 90, 0, 0); + } + + if (g_fp->getObjectState(sO_LowerHatch_23) == g_fp->getObjectEnumState(sO_LowerHatch_23, sO_Opened)) { + g_vars->scene23_giraffeTop->show1(-1, -1, -1, 0); + g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_UP); + + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_KISS); + g_vars->scene23_giraffee->hide(); + } else { + if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened) + && (g_vars->scene23_giraffee->_flags & 4)) + g_vars->scene23_giraffeTop->setOXY(614, 362); + else + g_vars->scene23_giraffeTop->setOXY(618, 350); + + if (sceneHandler23_testCalendar()) + g_vars->scene23_calend1->_statics = g_vars->scene23_calend1->getStaticsById(ST_CND_5); + } + + sc->getStaticANIObject1ById(ANI_LUK23_D, -1)->changeStatics2(ST_LUK23_OPEN); + + if (g_fp->getObjectState(sO_Lever_23) == g_fp->getObjectEnumState(sO_Lever_23, sO_Taken)) + sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide(); + + sc->getStaticANIObject1ById(ANI_HANDLE23, -1)->hide(); + } else { + g_vars->scene23_giraffeTop->hide(); + + sc->getStaticANIObject1ById(ANI_LUK23_D, -1)->changeStatics2(ST_LUK23_WHANDLE2); + + sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide(); + } + + g_fp->_currentScene = oldsc; +} + +void scene23_setGiraffeState() { + if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene23_giraffeTop, ST_GRFU_UP, QU_GRFU_TURN_UL, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene23_giraffeTop, ST_GRFU_UP, QU_GRFU_TURN_UD, 0); + } +} + +int scene23_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC23_LADDERU) { + if (g_vars->scene23_topReached) + return g_fp->_cursorId; + + g_fp->_cursorId = getGameLoaderInventory()->getSelectedItemId() ? PIC_CSR_GOU : PIC_CSR_ITN; // FIXME check + } + + if (g_fp->_objectIdAtCursor == PIC_SC23_BTN1 || g_fp->_objectIdAtCursor == PIC_SC23_BTN2 + || g_fp->_objectIdAtCursor == PIC_SC23_BTN3 || g_fp->_objectIdAtCursor == PIC_SC23_BTN4 + || g_fp->_objectIdAtCursor == ANI_CALENDWHEEL) + g_fp->_cursorId = PIC_CSR_LIFT; + + return g_fp->_cursorId; +} + +void sceneHandler23_showStool() { + chainQueue(QU_SC23_SHOWSTOOL, 0); +} + +void sceneHandler23_hideStool() { + g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1)->hide(); +} + +void sceneHandler23_startKiss() { + g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_UP); + g_vars->scene23_giraffeTop->startMQIfIdle(QU_SC23_STARTKISS, 0); +} + +void sceneHandler23_spinWheel1() { + int mv = 0; + + switch (g_vars->scene23_calend0->_statics->_staticsId) { + case ST_CND_0: + mv = MV_CND_0_1; + break; + + case ST_CND_1: + mv = MV_CND_1_2; + break; + + case ST_CND_2: + mv = MV_CND_2_3; + break; + + case ST_CND_3: + g_vars->scene23_calend0->changeStatics2(ST_CND_9); + mv = MV_CND_9_0; + break; + + default: + break; + } + + if (mv) + g_vars->scene23_calend0->startAnim(mv, 0, -1); + + if (sceneHandler23_testCalendar()) + sceneHandler23_startKiss(); +} + +void sceneHandler23_spinWheel2and4(StaticANIObject *ani) { + int mv = 0; + + switch (ani->_statics->_staticsId) { + case ST_CND_0: + mv = MV_CND_0_1; + break; + + case ST_CND_1: + mv = MV_CND_1_2; + break; + + case ST_CND_2: + mv = MV_CND_2_3; + break; + + case ST_CND_3: + mv = MV_CND_3_4; + break; + + case ST_CND_4: + mv = MV_CND_4_5; + break; + + case ST_CND_5: + mv = MV_CND_5_6; + break; + + case ST_CND_6: + mv = MV_CND_6_7; + break; + + case ST_CND_7: + mv = MV_CND_7_8; + break; + + case ST_CND_8: + mv = MV_CND_8_9; + break; + + case ST_CND_9: + mv = MV_CND_9_0; + break; + + default: + break; + } + + if (mv) + ani->startAnim(mv, 0, -1); + + if (sceneHandler23_testCalendar()) + sceneHandler23_startKiss(); +} + +void sceneHandler23_spinWheel3() { + if (g_vars->scene23_calend2->_statics->_staticsId == ST_CND_0) { + g_vars->scene23_calend2->startAnim(MV_CND_0_1, 0, -1); + } else if (g_vars->scene23_calend2->_statics->_staticsId == ST_CND_1) { + g_vars->scene23_calend2->changeStatics2(ST_CND_9); + g_vars->scene23_calend2->startAnim(MV_CND_9_0, 0, -1); + } + + if (sceneHandler23_testCalendar()) + sceneHandler23_startKiss(); +} + +void sceneHandler23_pushButton(ExCommand *cmd) { + if (g_fp->_aniMan->isIdle() || !(g_fp->_aniMan->_flags & 0x100)) { + if (!g_vars->scene23_topReached) { + if (g_fp->_aniMan->_ox != 405 || g_fp->_aniMan->_oy != 220) { + if (g_fp->_aniMan->_ox != 276 || g_fp->_aniMan->_oy != 438 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + if (g_fp->_msgX == 276 && g_fp->_msgY == 438 ) + return; + + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 276, 438, 1, ST_MAN_RIGHT); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone());; + + postExCommand(g_fp->_aniMan->_id, 2, 276, 438, 0, -1); + } + } else { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_TOCALENDAR), 0, 0); + + mq->addExCommandToEnd(cmd->createClone());; + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } + + if (!g_vars->scene23_topReached) + return; + } else { + g_vars->scene23_topReached = true; + } + } + + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER) { + int mv = 0; + + switch (cmd->_messageNum) { + case MSG_SC23_CLICKBTN1: + mv = MV_MAN23_PUSH1; + break; + + case MSG_SC23_CLICKBTN2: + mv = MV_MAN23_PUSH2; + break; + + case MSG_SC23_CLICKBTN3: + mv = MV_MAN23_PUSH3; + break; + + case MSG_SC23_CLICKBTN4: + mv = MV_MAN23_PUSH4; + break; + + default: + return; + } + + if (mv) + g_fp->_aniMan->startAnim(mv, 0, -1); + + } + } +} + +void sceneHandler23_sendClick(StaticANIObject *ani) { + int msg = 0; + switch (ani->_okeyCode) { + case 0: + msg = MSG_SC23_CLICKBTN1; + break; + case 1: + msg = MSG_SC23_CLICKBTN2; + break; + case 2: + msg = MSG_SC23_CLICKBTN3; + break; + case 3: + msg = MSG_SC23_CLICKBTN4; + break; + default: + break; + } + + ExCommand *ex = new ExCommand(0, 17, msg, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + ex->postMessage(); +} + +void sceneHandler23_checkReachingTop() { + if (g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_STANDLADDER + || g_fp->_aniMan->_ox != 405 || g_fp->_aniMan->_oy != 220) + g_vars->scene23_topReached = false; + else + g_vars->scene23_topReached = true; +} + +void sceneHandler23_exitCalendar() { + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + && !g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) { + chainQueue(QU_SC23_FROMCALENDAREXIT, 1); + g_vars->scene23_someVar = 2; + } +} + +void sceneHandler23_fromCalendar(ExCommand *cmd) { + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + && !g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_FROMCALENDAR), 0, 0); + + mq->addExCommandToEnd(cmd->createClone()); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_vars->scene23_topReached = false; + g_vars->scene23_someVar = 0; + } +} + +void sceneHandler23_fromStool(ExCommand *cmd) { + if (!g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_FROMSTOOL), 0, 0); + + mq->addExCommandToEnd(cmd->createClone()); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + cmd->_messageKind = 0; + } +} + +int sceneHandler23(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC23_FROMSTOOL: + g_vars->scene23_isOnStool = false; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + break; + + case MSG_SC23_HIDEGIRAFFEE: + g_vars->scene23_giraffee->queueMessageQueue(0); + g_vars->scene23_giraffee->_flags &= 0xFFFB; + break; + + case MSG_SC23_ONSTOOL: + g_vars->scene23_isOnStool = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + break; + + case MSG_SC22_SHOWSTOOL: + sceneHandler23_showStool(); + break; + + case MSG_SC22_HIDESTOOL: + sceneHandler23_hideStool(); + break; + + case MSG_SC23_SPINWHEEL1: + sceneHandler23_spinWheel1(); + break; + + case MSG_SC23_SPINWHEEL2: + sceneHandler23_spinWheel2and4(g_vars->scene23_calend1); + break; + + case MSG_SC23_SPINWHEEL3: + sceneHandler23_spinWheel3(); + break; + + case MSG_SC23_SPINWHEEL4: + sceneHandler23_spinWheel2and4(g_vars->scene23_calend3); + break; + + case MSG_SC23_CLICKBTN1: + case MSG_SC23_CLICKBTN2: + case MSG_SC23_CLICKBTN3: + case MSG_SC23_CLICKBTN4: + sceneHandler23_pushButton(cmd); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_floaters->update(); + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + int picId; + + if (ani && ani->_id == ANI_CALENDWHEEL) { + sceneHandler23_sendClick(ani); + cmd->_messageKind = 0; + } + + sceneHandler23_checkReachingTop(); + + if (g_vars->scene23_topReached) { + picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (picId == PIC_SC23_LADDER) { + sceneHandler23_exitCalendar(); + + cmd->_messageKind = 0; + break; + } + + if (cmd->_sceneClickY > 450) { + sceneHandler23_fromCalendar(cmd); + + cmd->_messageKind = 0; + break; + } + break; + } + + if (!g_vars->scene23_isOnStool) { + picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (picId == PIC_SC23_LADDERU && !g_vars->scene23_topReached) { + sceneHandler23_pushButton(cmd); + + cmd->_messageKind = 0; + break; + } + break; + } + + if (ani && ani->_id == ANI_HANDLE23) { + handleObjectInteraction(g_fp->_aniMan, ani, cmd->_keyCode); + cmd->_messageKind = 0; + } else { + sceneHandler23_fromStool(cmd); + + cmd->_messageKind = 0; + } + + break; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene24.cpp b/engines/fullpipe/scenes/scene24.cpp new file mode 100644 index 0000000000..508f776573 --- /dev/null +++ b/engines/fullpipe/scenes/scene24.cpp @@ -0,0 +1,129 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene24_initScene(Scene *sc) { + g_vars->scene24_water = sc->getStaticANIObject1ById(ANI_WATER24, -1); + g_vars->scene24_jet = sc->getStaticANIObject1ById(ANI_JET24, -1); + g_vars->scene24_drop = sc->getStaticANIObject1ById(ANI_DROP_24, -1); + + g_vars->scene24_water->setAlpha(0xa0); + g_vars->scene24_jet->setAlpha(0xa0); + g_vars->scene24_drop->setAlpha(0xa0); + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)) { + g_vars->scene24_jetIsOn = true; + g_vars->scene24_flowIsLow = false; + } else { + g_vars->scene24_jet->hide(); + + g_vars->scene24_jetIsOn = false; + + g_vars->scene24_water->changeStatics2(ST_WTR24_FLOWLOWER); + + g_vars->scene24_flowIsLow = true; + } + + if (g_fp->getObjectState(sO_Pool) < g_fp->getObjectEnumState(sO_Pool, sO_Full)) { + g_vars->scene24_waterIsOn = false; + + g_vars->scene24_water->hide(); + + g_fp->setObjectState(sO_StairsDown_24, g_fp->getObjectEnumState(sO_StairsDown_24, sO_IsOpened)); + } else { + g_vars->scene24_waterIsOn = true; + + g_fp->setObjectState(sO_StairsDown_24, g_fp->getObjectEnumState(sO_StairsDown_24, sO_IsClosed)); + } + + g_fp->_currentScene = oldsc; +} + +void scene24_setPoolState() { + if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)) { + g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene24_drop, 0); + + g_fp->playSound(SND_24_007, 1); + } else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOFLOOR, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER2, 0); + + g_fp->playSound(SND_24_006, 1); + } else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOFLOOR, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER2, 1); + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOFLOOR, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene24_drop, ST_DRP24_EMPTY, QU_DRP24_TOWATER2, 0); + } +} + +int sceneHandler24(ExCommand *cmd) { + if (cmd->_messageKind == 17 && cmd->_messageNum == 33) { + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) { + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + } + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene24_waterIsOn && !g_vars->scene24_water->_movement) { + if (g_vars->scene24_flowIsLow) + g_vars->scene24_water->startAnim(MV_WTR24_FLOWLOWER, 0, -1); + else + g_vars->scene24_water->startAnim(MV_WTR24_FLOW, 0, -1); + } + + if (g_vars->scene24_jetIsOn && !g_vars->scene24_jet->_movement) + g_vars->scene24_jet->startAnim(MV_JET24_FLOW, 0, -1); + + g_fp->_behaviorManager->updateBehaviors(); + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp new file mode 100644 index 0000000000..ba07c3e5b9 --- /dev/null +++ b/engines/fullpipe/scenes/scene25.cpp @@ -0,0 +1,723 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene25_showBoardOnRightFar() { + g_vars->scene25_board->show1(453, 557, MV_BRD25_RIGHT, 0); + g_vars->scene25_board->_priority = 28; +} + +void scene25_showBoardOnRightClose() { + g_vars->scene25_board->show1(632, 557, rMV_BRD25_RIGHT, 0); + g_vars->scene25_board->_priority = 28; +} + +void scene25_initScene(Scene *sc, int entranceId) { + g_vars->scene25_water = sc->getStaticANIObject1ById(ANI_WATER25, -1); + g_vars->scene25_board = sc->getStaticANIObject1ById(ANI_BOARD25, -1); + g_vars->scene25_drop = sc->getStaticANIObject1ById(ANI_DROP_25, -1); + g_vars->scene25_water->setAlpha(0xa0); + g_vars->scene25_drop->setAlpha(0xa0); + g_vars->scene25_dudeIsOnBoard = false; + + if (g_fp->getObjectState(sO_Pool) < g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) { + g_vars->scene25_waterIsPresent = false; + + g_vars->scene25_water->hide(); + } else { + g_vars->scene25_waterIsPresent = true; + + g_fp->playSound(SND_25_006, 1); + } + + int boardState = g_fp->getObjectState(sO_Board_25); + + if (entranceId == TrubaRight) { + if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_FarAway)) { + scene25_showBoardOnRightFar(); + + g_fp->playSound(SND_25_029, 0); + + g_vars->scene25_boardIsSelectable = false; + } else { + if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_Nearby) + || boardState == g_fp->getObjectEnumState(sO_Board_25, sO_WithDudeOnRight)) + scene25_showBoardOnRightClose(); + g_vars->scene25_boardIsSelectable = false; + } + } else { + if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_WithDudeOnLeft)) { + if (!getGameLoaderInventory()->getCountItemsWithId(ANI_INV_BOARD)) { + getGameLoaderInventory()->addItem(ANI_INV_BOARD, 1); + getGameLoaderInventory()->rebuildItemRects(); + } + } else { + g_vars->scene25_boardIsSelectable = true; + } + } + + g_vars->scene25_beardersAreThere = false; + g_vars->scene25_beardersCounter = 0; +} + +int scene25_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene25_waterIsPresent) { + int inv = getGameLoaderInventory()->getSelectedItemId(); + + if (g_fp->_objectIdAtCursor == ANI_WATER25) { + if ((g_vars->scene25_boardIsSelectable && (!inv || inv == ANI_INV_BOARD)) || (g_vars->scene25_dudeIsOnBoard && (inv == ANI_INV_LOPAT || !inv))) + g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV; // FIXME check + } else if (g_fp->_objectIdAtCursor == ANI_BOARD25 && (!inv || inv == ANI_INV_SWAB || inv == ANI_INV_BROOM || inv == ANI_INV_LOPAT)) { + g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV; + } + } + + return g_fp->_cursorId; +} + +void scene25_setupWater(Scene *a1, int entranceId) { + if (g_vars->scene25_waterIsPresent) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOFLOOR, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOWATER, 1); + + if (entranceId != TrubaRight) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_25"), "MUSIC2", 0); + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOFLOOR, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOWATER, 0); + } +} + +void sceneHandler25_stopBearders() { + g_vars->scene25_beardersAreThere = false; + + g_vars->scene25_bearders.clear(); +} + +void sceneHandler25_startBearders() { + g_vars->scene25_bearders.clear(); + g_vars->scene25_beardersCounter = 0; + + StaticANIObject *bearded = g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1); + + for (int i = 0; i < 3; i++) { + StaticANIObject *ani = new StaticANIObject(bearded); + + g_vars->scene25_bearders.push_back(ani); + + ani->_statics = ani->getStaticsById(ST_BRDCMN_EMPTY); + + g_fp->_currentScene->addStaticANIObject(ani, 1); + } + + g_vars->scene25_beardersAreThere = true; +} + +void sceneHandler25_enterMan() { + if (g_vars->scene25_waterIsPresent) { + chainQueue(QU_SC25_ENTERUP_WATER, 1); + + getCurrSceneSc2MotionController()->clearEnabled(); + } else { + chainQueue(QU_SC25_ENTERUP_FLOOR, 1); + } +} + +void sceneHandler25_enterTruba() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 634 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_MANTOTRUBA; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_MANTOTRUBA_R; + } + + if (qid) { + chainQueue(qid, 1); + g_vars->scene25_sneezeFlipper = false; + } +} + +void sceneHandler25_saveEntrance(int value) { + g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME")->setSubVarAsInt("Entrance", value); +} + +void sceneHandler25_toLadder() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 307 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_BACKTOLADDER; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 192 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_BOARDTOLADDER; + } + + if (qid) { + chainQueue(qid, 1); + g_vars->scene25_dudeIsOnBoard = false; + g_vars->scene25_boardIsSelectable = true; + g_vars->scene25_sneezeFlipper = false; + + sceneHandler25_saveEntrance(TrubaUp); + } +} + +void sceneHandler25_animateBearders() { + if (g_fp->_rnd->getRandomNumber(32767) < 218) { + MessageQueue *mq; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene25_bearders[0]->_okeyCode); + mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100; + mq->chain(0); + + g_vars->scene25_beardersCounter = 0; + + if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene25_bearders[1]->_okeyCode); + mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100; + mq->chain(0); + + if (g_fp->_rnd->getRandomNumber(32767) < 8191) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene25_bearders[2]->_okeyCode); + mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100; + mq->chain(0); + } + } + } +} + +void sceneHandler25_sneeze() { + if (g_fp->_rnd->getRandomNumber(32767) % 10) { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) { + g_fp->_aniMan->startAnim(MV_MAN25_ONBOARD, 0, -1); + } else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) { + g_fp->_aniMan->startAnim(rMV_MAN25_ONBOARD, 0, -1); + } + } else if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) { + g_fp->_aniMan->startAnim(MV_MAN25_CHIH, 0, -1); + } else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) { + g_fp->_aniMan->startAnim(rMV_MAN25_CHIH, 0, -1); + } +} + +void sceneHandler25_rowShovel() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 370 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_ROWTOTRUBA; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_ROWTOLADDER; + + g_fp->playSound(SND_25_030, 0); + } + + if (qid) { + chainQueue(qid, 1); + + g_vars->scene25_sneezeFlipper = false; + } +} + +void sceneHandler25_rowHand() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 370 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_TRYROWHAND; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_TRYROWHAND_R; + } + + if (qid) { + chainObjQueue(g_fp->_aniMan, qid, 1); + g_vars->scene25_sneezeFlipper = false; + } +} + +void sceneHandler25_putBoard() { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) { + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + g_fp->_aniMan->setOXY(281, 481); + + chainQueue(QU_SC25_PUTBOARD, 1); + + g_vars->scene25_dudeIsOnBoard = true; + g_vars->scene25_sneezeFlipper = false; + g_vars->scene25_boardIsSelectable = false; + } +} + +void sceneHandler25_tryWater() { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) { + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + + chainQueue(QU_SC25_TRYWATER, 1); + } +} + +void sceneHandler25_tryRow(int obj) { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int qid = 0; + + if (x == 788 && y == 468) { + if (g_vars->scene25_board->_statics->_staticsId == ST_BRD25_RIGHT2) { + if (obj == ANI_INV_BROOM) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + qid = QU_SC25_TRYBROOM; + } + if (obj == ANI_INV_LOPAT) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + qid = QU_SC25_TRYSPADE; + } + + if (qid) { + chainQueue(qid, 1); + + g_fp->playSound(SND_25_028, 0); + + return; + } + + if (obj == ANI_INV_SWAB) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainQueue(QU_SC25_TRYSWAB, 1); + } else if (!obj) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainObjQueue(g_fp->_aniMan, QU_SC25_TRYHAND, 1); + + g_fp->playSound(SND_25_028, 0); + } + } else if (g_vars->scene25_board->_statics->_staticsId == (ST_MAN_RIGHT|0x4000) && !obj) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainQueue(QU_SC25_TRUBATOBOARD, 1); + + g_vars->scene25_dudeIsOnBoard = true; + } + } +} + +void sceneHandler25_ladderUp() { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) { + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + + chainQueue(QU_SC25_LADDERUP, 1); + } +} + +void sceneHandler25_backToPipe() { + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == (ST_MAN_RIGHT|0x4000)) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainQueue(QU_SC25_BACKTOTRUBA, 1); + } +} + +void sceneHandler25_walkOnLadder(StaticANIObject *ani, Common::Point *pnt, MessageQueue *mq, int flag) { + int aniY = ani->_oy; + int newx = 0, newy = 0; + Common::Point point; + ExCommand *ex; + + if (flag) { + if (ani->_movement) { + ani->_movement->calcSomeXY(point, 0); + newx = point.x; + aniY = ani->_oy - point.y; + } + } + + int pntx = pnt->x; + int pnty = pnt->y; + int numObsolete = -1; + int minDistance = 20000; + ExCommand *lastEx = 0; + + for (uint i = 0; i < mq->getCount(); i++) { + int curDistance = abs(pnty - aniY); + + ex = mq->getExCommandByIndex(i); + + if (ex->_messageKind == 1 && ani->_id == ex->_parentId) { + if (ex->_excFlags & 0x10000) { + if (ex->_messageNum == MV_MAN_TOLADDER) + ex->_messageNum = MV_MAN_TOLADDER2; + if (ex->_messageNum == MV_MAN_STARTLADDER) + ex->_messageNum = MV_MAN_STARTLADDER2; + if (ex->_messageNum == MV_MAN_GOLADDER) + ex->_messageNum = MV_MAN_GOLADDER2; + if (ex->_messageNum == MV_MAN_STOPLADDER) + ex->_messageNum = MV_MAN_STOPLADDER2; + } + + if (curDistance < minDistance || numObsolete < 0) { + numObsolete = i; + minDistance = curDistance; + lastEx = ex; + newx = pntx; + newy = pnty; + } + + ani->getMovementById(ex->_messageNum)->calcSomeXY(point, 0); + pntx += point.x; + pnty += point.y; + } + } + + for (int i = 0; i < numObsolete; i++) + mq->deleteExCommandByIndex(0, 1); + + ex = new ExCommand(ani->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_14 = 256; + ex->_messageNum = 0; + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + if (flag && ani->_movement && ani->_movement->_id == mq->getExCommandByIndex(0)->_messageNum) { + mq->deleteExCommandByIndex(0, 1); + + int movId = ani->_movement->_id; + int idx = ani->_movement->_currDynamicPhaseIndex; + + ani->changeStatics2(ani->_movement->_staticsObj1->_staticsId); + ani->setOXY(newx, newy); + + ani->startAnim(movId, mq->_id, -1); + + ani->_movement->setDynamicPhaseIndex(idx); + } else { + if (!lastEx) + error("sceneHandler25_walkOnLadder(): Incorrect state. Please report this to sev"); + + ani->changeStatics2(ani->getMovementById(lastEx->_messageNum)->_staticsObj1->_staticsId); + ani->setOXY(newx, newy); + ani->restartMessageQueue(mq); + } + + ani->_flags |= 1; +} + +bool sceneHandler25_isOnLadder(ExCommand *cmd) { + if ((g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id == MV_MAN_GOLADDERDOWN) + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_GOLADDERD) { + Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(PIC_SC25_LADDERDOWN, ANI_MAN, cmd->_keyCode); + + if (!inter) + return 0; + + MessageQueue *mq = new MessageQueue(inter->_messageQueue, 0, 1); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(PIC_SC25_LADDERDOWN, 0); + Common::Point point; + + point.x = inter->_xOffs + pic->_ox; + point.y = inter->_yOffs + pic->_oy; + + mq->setFlags(mq->getFlags() | 1); + + sceneHandler25_walkOnLadder(g_fp->_aniMan, &point, mq, 0); + + return true; + } else { + return false; + } +} + +void sceneHandler25_sub03() { + warning("STUB: sceneHandler25_sub03()"); +} + +int sceneHandler25(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC25_STOPBEARDEDS: + sceneHandler25_stopBearders(); + break; + + case MSG_SC25_STARTBEARDEDS: + sceneHandler25_startBearders(); + break; + + case MSG_SC25_ENTERMAN: + sceneHandler25_enterMan(); + break; + + case MSG_SC25_ENTERTRUBA: + sceneHandler25_enterTruba(); + break; + + case MSG_SC25_TOLADDER: + sceneHandler25_toLadder(); + break; + + case MSG_BRD_TURN: + switch (g_fp->_rnd->getRandomNumber(3)) { + case 0: + g_fp->playSound(SND_25_025, 0); + break; + + case 1: + g_fp->playSound(SND_25_026, 0); + break; + + default: + g_fp->playSound(SND_25_027, 0); + break; + } + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + int y = g_fp->_aniMan2->_oy; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + + if (!g_vars->scene25_waterIsPresent) { + if (y < g_fp->_sceneRect.top + 200) + g_fp->_currentScene->_y = y - 300 - g_fp->_sceneRect.top; + + if (y > g_fp->_sceneRect.bottom - 200) + g_fp->_currentScene->_y = y + 300 - g_fp->_sceneRect.bottom; + } + } + + if (g_vars->scene25_beardersAreThere) { + g_vars->scene25_beardersCounter++; + + if (g_vars->scene25_beardersCounter >= 120) + sceneHandler25_animateBearders(); + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + if (g_vars->scene25_waterIsPresent && !g_vars->scene25_water->_movement) + g_vars->scene25_water->startAnim(MV_WTR25_FLOW, 0, -1); + + if (g_vars->scene25_dudeIsOnBoard && !g_fp->_aniMan->_movement && g_vars->scene25_sneezeFlipper) + sceneHandler25_sneeze(); + + g_vars->scene25_sneezeFlipper = true; + + if (g_vars->scene25_board->_flags & 4) { + if (!g_vars->scene25_board->_movement) { + if (g_vars->scene25_board->_statics->_staticsId & 0x4000) + g_vars->scene25_board->startAnim(rMV_BRD25_RIGHT, 0, -1); + else + g_vars->scene25_board->startAnim(MV_BRD25_RIGHT, 0, -1); + } + } + break; + + case 29: + { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (!g_vars->scene25_waterIsPresent) { + if ((picId == PIC_SC25_LADDERUP || picId == PIC_SC25_LADDERDOWN) && sceneHandler25_isOnLadder(cmd)) + cmd->_messageKind = 0; + + break; + } + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani) { + if (g_fp->_aniMan != ani) { + if (g_fp->_aniMan->isIdle()) { + if (!(g_fp->_aniMan->_flags & 0x100)) { + if (ani->_id == ANI_WATER25) { + if (g_vars->scene25_dudeIsOnBoard) { + if (cmd->_keyCode == ANI_INV_LOPAT) + sceneHandler25_rowShovel(); + + if (!cmd->_keyCode) + sceneHandler25_rowHand(); + } else { + if (cmd->_keyCode == ANI_INV_BOARD) + sceneHandler25_putBoard(); + + if (!cmd->_keyCode) + sceneHandler25_tryWater(); + } + } else if (ani->_id == ANI_BOARD25) { + sceneHandler25_tryRow(cmd->_keyCode); + break; + } + break; + } + } + } + } + + if (picId == PIC_SC25_LADDERUP && sceneHandler25_isOnLadder(cmd)) + cmd->_messageKind = 0; + + if (!g_fp->_aniMan->isIdle() || (g_fp->_aniMan->_flags & 0x100)) + break; + + if (g_vars->scene25_dudeIsOnBoard) { + if (picId == PIC_SC25_RTRUBA && !cmd->_keyCode) { + sceneHandler25_enterTruba(); + break; + } + } else { + if (picId != PIC_SC25_RTRUBA) { + if (picId == PIC_SC25_LADDERUP && !cmd->_keyCode) + sceneHandler25_ladderUp(); + break; + } + + if (!cmd->_keyCode) { + sceneHandler25_backToPipe(); + break; + } + } + if (g_vars->scene25_dudeIsOnBoard) { + if (picId != PIC_SC25_LADDERUP || cmd->_keyCode) + break; + + sceneHandler25_toLadder(); + break; + } + + if (picId == PIC_SC25_LADDERUP && !cmd->_keyCode) + sceneHandler25_ladderUp(); + + break; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene26.cpp b/engines/fullpipe/scenes/scene26.cpp new file mode 100644 index 0000000000..91679347e6 --- /dev/null +++ b/engines/fullpipe/scenes/scene26.cpp @@ -0,0 +1,355 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene26_initScene(Scene *sc) { + g_vars->scene26_chhi = sc->getStaticANIObject1ById(ANI_CHHI, -1); + g_vars->scene26_drop = sc->getStaticANIObject1ById(ANI_DROP_26, -1); + g_vars->scene26_sockPic = sc->getPictureObjectById(PIC_SC26_SOCK, 0); + g_vars->scene26_sock = sc->getStaticANIObject1ById(ANI_SOCK_26, -1); + + if (g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_WithSock)) { + g_fp->setObjectState(sO_Hatch_26, g_fp->getObjectEnumState(sO_Hatch_26, sO_Closed)); + g_fp->setObjectState(sO_Sock_26, g_fp->getObjectEnumState(sO_Sock_26, sO_HangsOnPipe)); + } + + Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(ANI_LUK26, ANI_MAN, ANI_INV_SOCK); + + if (getGameLoaderInventory()->getCountItemsWithId(ANI_INV_VENT) == 0) + inter->_flags &= 0xFFFDFFFF; + else + inter->_flags |= 0x20000; + + if (g_fp->getObjectState(sO_Sock_26) == g_fp->getObjectEnumState(sO_Sock_26, sO_HangsOnPipe)) + g_vars->scene26_sockPic->_flags |= 4; + else + g_vars->scene26_sockPic->_flags &= 0xFFFB; + + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) + g_fp->playSound(SND_26_018, 1); +} + +int scene26_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor != ANI_VENT || g_fp->_cursorId != PIC_CSR_DEFAULT) { + if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC26_LTRUBA) + g_fp->_cursorId = PIC_CSR_GOL; + } else { + g_fp->_cursorId = PIC_CSR_ITN; + } + + return g_fp->_cursorId; +} + +void sceneHandler26_updateDrop() { + if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed)) + g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene26_drop, 0); + else + g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene26_drop, 1); +} + +void scene26_setupDrop(Scene *sc) { + sceneHandler26_updateDrop(); +} + +void sceneHandler26_showChi() { + g_vars->scene26_chhi->changeStatics2(ST_CHI_EMPTY); + + chainQueue(QU_CHI_SHOW, 1); +} + +void sceneHandler26_updatePool() { + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Valve1_26)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Overfull)); + else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Full)); + + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Valve1_26)) { + if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_Full)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)); + } + + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Valve1_26)) { + if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Empty)); + } +} + +void sceneHandler26_hideChi() { + g_vars->scene26_chhi->changeStatics2(ST_CHI_NORM); + + chainQueue(QU_CHI_HIDE, 1); +} + +void sceneHandler26_testVent() { + if (!g_vars->scene26_activeVent) + return; + + if (g_vars->scene26_activeVent->_okeyCode == 0) { + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) + g_fp->stopAllSoundInstances(SND_26_018); + else + g_fp->playSound(SND_26_018, 1); + + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened)) { + chainQueue(QU_SC26_AUTOCLOSE2, 0); + + g_fp->playSound(SND_26_020, 0); + } + + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened)) { + chainQueue(QU_SC26_AUTOCLOSE3, 0); + + g_fp->playSound(SND_26_020, 0); + } + } else if (g_vars->scene26_activeVent->_okeyCode == 1) { + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened)) + g_fp->playSound(SND_26_020, 0); + else + g_fp->playSound(SND_26_019, 0); + + if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull) + || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full)) + g_fp->playSound(SND_26_003, 0); + + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) { + g_fp->stopAllSoundInstances(SND_26_018); + + chainQueue(QU_SC26_AUTOCLOSE1, 0); + } + } else if (g_vars->scene26_activeVent->_okeyCode == 2) { + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened)) + g_fp->playSound(SND_26_020, 0); + else + g_fp->playSound(SND_26_019, 0); + + if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull) + || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full) + || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) + g_fp->playSound(SND_26_003, 0); + + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) { + g_fp->stopAllSoundInstances(SND_26_018); + + chainQueue(QU_SC26_AUTOCLOSE1, 0); + } + } +} + +void sceneHandler26_showVent() { + if (g_vars->scene26_activeVent) { + int id = g_vars->scene26_activeVent->_statics->_staticsId; + + if (id == ST_VNT26_UP2) { + g_vars->scene26_activeVent->changeStatics2(ST_VNT26_RIGHT2); + } else { + if (id != ST_VNT26_RIGHT2) + return; + + g_vars->scene26_activeVent->changeStatics2(ST_VNT26_UP2); + } + g_vars->scene26_activeVent->show1(-1, -1, -1, 0); + } +} + +void sceneHandler26_hideVent() { + if (g_vars->scene26_activeVent) + g_vars->scene26_activeVent->hide(); +} + +void sceneHandler26_animateVents(StaticANIObject *ani) { + int qId = 0; + + switch (ani->_okeyCode) { + case 0: + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Closed)) + qId = QU_SC26_OPEN1; + else + qId = QU_SC26_CLOSE1; + + break; + + case 1: + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Closed)) + qId = QU_SC26_OPEN2; + else + qId = QU_SC26_CLOSE2; + + break; + + case 2: + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Closed)) + qId = QU_SC26_OPEN3; + else + qId = QU_SC26_CLOSE3; + + break; + + case 3: + if (g_fp->getObjectState(sO_Valve4_26) == g_fp->getObjectEnumState(sO_Valve4_26, sO_Closed)) + qId = QU_SC26_OPEN4; + else + qId = QU_SC26_CLOSE4; + + break; + + case 4: + if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed)) + qId = QU_SC26_OPEN5; + else + qId = QU_SC26_CLOSE5; + + break; + + default: + return; + } + + if (qId) { + MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(qId); + + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } +} + +void sceneHandler26_clickVent(StaticANIObject *ani, ExCommand *cmd) { + if (ani->_okeyCode || g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_Opened)) { + if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) { + g_vars->scene26_activeVent = ani; + + int x = ani->_ox - 20; + int y = ani->_oy + 61; + + if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP); + + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC26_CLICKVENT, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 3; + ex->_keyCode = ani->_okeyCode; + + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1); + } + } else { + sceneHandler26_animateVents(ani); + } + } + } + + cmd->_messageKind = 0; +} + +int sceneHandler26(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC26_UPDATEDROP: + sceneHandler26_updateDrop(); + break; + + case MSG_SC26_SHOWCHI: + sceneHandler26_showChi(); + break; + + case MSG_SC26_UPDATEPOOL: + sceneHandler26_updatePool(); + break; + + case MSG_SC26_HIDECHI: + sceneHandler26_hideChi(); + break; + + case MSG_SC26_TESTVENT: + sceneHandler26_testVent(); + break; + + case MSG_SC26_SHOWVENT: + sceneHandler26_showVent(); + break; + + case MSG_SC26_CLICKVENT: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT, cmd->_keyCode); + + if (ani && ani->_id == ANI_VENT) + sceneHandler26_clickVent(ani, cmd); + + break; + } + + case MSG_SC26_HIDEVENT: + sceneHandler26_hideVent(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_VENT) + sceneHandler26_clickVent(ani, cmd); + + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp new file mode 100644 index 0000000000..9fad0f74f5 --- /dev/null +++ b/engines/fullpipe/scenes/scene28.cpp @@ -0,0 +1,294 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void scene28_initScene(Scene *sc) { + g_vars->scene28_var01 = 200; + g_vars->scene28_var02 = 200; + g_vars->scene28_var03 = 300; + g_vars->scene28_var04 = 300; + g_vars->scene28_var05 = 1; + g_vars->scene28_var06 = 1; + g_vars->scene28_var07 = 0; + g_vars->scene28_var08 = 0; + g_vars->scene28_var09 = 0; + g_vars->scene28_var10 = 0; + g_vars->scene28_var11 = 0; + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28")); + + g_fp->initArcadeKeys("SC_28"); +} + +int scene28_updateCursor() { + g_fp->updateCursorCommon(); + if (g_fp->_objectIdAtCursor == ANI_LIFT || g_fp->_objectIdAtCursor == ANI_LIFT_28) + if (g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + + return g_fp->_cursorId; +} + +void sceneHandler28_lift1ShowAfter() { + warning("STUB: sceneHandler28_lift1ShowAfter()"); +} + +void sceneHandler28_makeFaces(ExCommand *cmd) { + warning("STUB: sceneHandler28_makeFaces()"); +} + +void sceneHandler28_trySecondaryPers() { + warning("STUB: sceneHandler28_trySecondaryPers()"); +} + +void sceneHandler28_turnOn2() { + warning("STUB: sceneHandler28_turnOn2()"); +} + +void sceneHandler28_startWork1() { + warning("STUB: sceneHandler28_startWork1()"); +} + +void sceneHandler28_clickLift(int keyCode) { + warning("STUB: sceneHandler28_clickLift()"); +} + +void sceneHandler28_lift0Start() { + chainQueue(QU_SC28_LIFT0_START, 1); +} + +void sceneHandler28_lift1Start() { + warning("STUB: sceneHandler28_lift1Start()"); +} + +void sceneHandler28_lift2Start() { + chainQueue(QU_SC28_LIFT2_START, 1); +} + +void sceneHandler28_lift3Start() { + chainQueue(QU_SC28_LIFT3_START, 1); +} + +void sceneHandler28_lift4Start() { + warning("STUB: sceneHandler28_lift4Start()"); +} + +void sceneHandler28_lift5Start() { + chainQueue(QU_SC28_LIFT5_START, 1); +} + +void sceneHandler28_lift6Start() { + warning("STUB: sceneHandler28_lift6Start()"); +} + + +int sceneHandler28(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC28_LIFT6MUSIC: + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC_TIOTIA", 1); + break; + + case MSG_SC28_LIFT6INSIDE: + g_vars->scene28_var11 = 1; + break; + + case MSG_SC28_LIFT1_SHOWAFTER: + sceneHandler28_lift1ShowAfter(); + break; + + case MSG_SC28_MAKEFACES: + sceneHandler28_makeFaces(cmd); + break; + + case MSG_SC28_TRYVTORPERS: + sceneHandler28_trySecondaryPers(); + break; + + case MSG_SC28_TURNOFF_0: + g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); + g_vars->scene28_var08->_flags |= 4; + break; + + case MSG_SC28_TURNON_0: + g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); + break; + + case MSG_SC28_TURNON_1: + g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); + break; + + case MSG_SC28_TURNOFF_1: + g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); + g_vars->scene28_var08->_flags |= 4; + break; + + case MSG_SC28_TURNON_2: + g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); + sceneHandler28_turnOn2(); + break; + + case MSG_SC28_TURNOFF_2: + g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); + g_vars->scene28_var08->_flags |= 4; + break; + + case MSG_SC28_TURNON_3: + g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); + break; + + case MSG_SC28_TURNOFF_3: + g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); + g_vars->scene28_var08->_flags |= 4; + break; + + case MSG_SC28_TURNON_4: + g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); + break; + + case MSG_SC28_TURNOFF_4: + g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); + g_vars->scene28_var08->_flags |= 4; + break; + + case MSG_SC28_TURNON_6: + g_vars->scene28_var07 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); + break; + + case MSG_SC28_TURNOFF_6: + g_vars->scene28_var08 = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); + g_vars->scene28_var08->_flags |= 4; + break; + + case MSG_SC28_STARTWORK1: + sceneHandler28_startWork1(); + break; + + case MSG_SC28_CLICKLIFT: + sceneHandler28_clickLift(cmd->_keyCode); + break; + + case MSG_SC28_ENDLIFT1: + case MSG_SC28_ENDLIFT6: + case MSG_SC28_ENDCABIN: + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + g_fp->_aniMan->_flags &= 0xFEFF; + break; + + case 29: + { + if (g_vars->scene28_var11) { + chainObjQueue(g_fp->_aniMan, QU_SC28_LIFT6_END, 1); + + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC", 1); + + g_vars->scene28_var11 = 0; + } + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani) + if (ani->_id == ANI_LIFT || ani->_id == ANI_LIFT_28 ) { + sceneHandler28_clickLift(ani->_okeyCode); + + cmd->_messageKind = 0; + break; + } + + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + g_vars->scene28_var01) + g_fp->_currentScene->_x = x - g_vars->scene28_var03 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - g_vars->scene28_var01) + g_fp->_currentScene->_x = x + g_vars->scene28_var03 - g_fp->_sceneRect.right; + } + + if (g_vars->scene28_var07) { + if (g_vars->scene28_var07->_picture->getAlpha() > 10) { + g_vars->scene28_var07->_picture->setAlpha(g_vars->scene28_var07->_picture->getAlpha() - 10); + } else { + g_vars->scene28_var07->_flags &= 0xFFFB; + + g_vars->scene28_var07 = 0; + } + } + + if (g_vars->scene28_var08) { + if (g_vars->scene28_var08->_picture->getAlpha() < 0xF9u ) { + g_vars->scene28_var08->_picture->setAlpha(g_vars->scene28_var08->_picture->getAlpha() + 6); + } else { + g_vars->scene28_var08->_picture->setAlpha(0xff); + + g_vars->scene28_var08 = 0; + } + } + + g_fp->_floaters->update(); + + for (uint i = 0; i < g_fp->_floaters->_array2.size(); i++) + if (g_fp->_floaters->_array2[i]->val13 == 1) + g_fp->_floaters->_array2[i]->ani->_priority = 15; + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene30.cpp b/engines/fullpipe/scenes/scene30.cpp new file mode 100644 index 0000000000..59cb83efcd --- /dev/null +++ b/engines/fullpipe/scenes/scene30.cpp @@ -0,0 +1,152 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene30_enablePass(Scene *sc) { + MovGraphLink *lnk = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_WayToPipe); + + if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithAll)) + lnk->_flags &= 0xDFFFFFFF; + else + lnk->_flags |= 0x20000000; +} + +void scene30_initScene(Scene *sc, int flag) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene30_leg = sc->getStaticANIObject1ById(ANI_LEG, -1); + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_ShowingHeel)) + g_vars->scene30_leg->changeStatics2(ST_LEG_UP); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithoutJugs)) + g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithBig)) + g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN1); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithSmall)) + g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN2); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithAll)) + g_vars->scene30_leg->changeStatics2(ST_LEG_EMPTY); + + g_fp->_currentScene = oldsc; + + scene30_enablePass(sc); + + if (flag == LiftUp || flag == LiftDown) + g_vars->scene30_liftFlag = 0; + else + g_vars->scene30_liftFlag = 1; + + g_fp->lift_setButton(sO_Level8, ST_LBN_8N); + + g_fp->lift_sub5(sc, QU_SC30_ENTERLIFT, QU_SC30_EXITLIFT); +} + +int scene30_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC30_LTRUBA) { + g_fp->_cursorId = PIC_CSR_GOL; + } + return g_fp->_cursorId; +} + +int sceneHandler30(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch(cmd->_messageNum) { + case MSG_LIFT_CLOSEDOOR: + g_fp->lift_closedoorSeq(); + break; + + case MSG_LIFT_EXITLIFT: + g_fp->lift_exitSeq(cmd); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fp->lift_startExitQueue(); + break; + + case MSG_LIFT_CLICKBUTTON: + g_fp->lift_animation3(); + break; + + case MSG_SC30_UPDATEPATH: + scene30_enablePass(g_fp->_currentScene); + break; + + case 64: + g_fp->lift_sub05(cmd); + break; + + case MSG_LIFT_GO: + g_fp->lift_goAnimation(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fp->lift_sub1(ani); + + cmd->_messageKind = 0; + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene31.cpp b/engines/fullpipe/scenes/scene31.cpp new file mode 100644 index 0000000000..587fc6aaef --- /dev/null +++ b/engines/fullpipe/scenes/scene31.cpp @@ -0,0 +1,126 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene31_initScene(Scene *sc) { + g_vars->scene31_chantingCountdown = 0; + g_vars->scene31_cactus = sc->getStaticANIObject1ById(ANI_CACTUS_31, -1); + + if (g_fp->getObjectState(sO_Cactus) == g_fp->getObjectEnumState(sO_Cactus, sO_HasGrown)) { + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + g_vars->scene31_cactus->changeStatics2(ST_CTS31_GROWN2); + g_vars->scene31_cactus->_priority = 22; + + g_fp->_currentScene = oldsc; + } else { + g_vars->scene31_cactus->hide(); + } + + g_vars->scene31_plusMinus = sc->getStaticANIObject1ById(ANI_PLUSMINUS, -1); + + if (g_fp->getObjectState(sO_Guard_3) == g_fp->getObjectEnumState(sO_Guard_3, sO_Off)) + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_MINUS); + else + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_PLUS); +} + +void sceneHandler31_testCactus(ExCommand *cmd) { + if ((g_vars->scene31_cactus->_flags & 4) && g_vars->scene31_cactus->_statics->_staticsId == ST_CTS31_GROWN2) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (mq) { + mq->getExCommandByIndex(0)->_messageKind = 0; + mq->getExCommandByIndex(0)->_excFlags |= 1; + + mq->getExCommandByIndex(1)->_messageKind = 0; + mq->getExCommandByIndex(1)->_excFlags |= 1; + } + } +} + +int sceneHandler31(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC31_TESTCACTUS: + sceneHandler31_testCactus(cmd); + break; + + case MSG_SC15_STOPCHANTING: + g_fp->stopAllSoundInstances(SND_31_001); + + g_vars->scene31_chantingCountdown = 120; + break; + + case MSG_SC31_PULL: + if ( g_vars->scene31_plusMinus->_statics->_staticsId == ST_PMS_MINUS) + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_PLUS); + else + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_MINUS); + + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene31_chantingCountdown > 0) { + --g_vars->scene31_chantingCountdown; + + if (!g_vars->scene31_chantingCountdown) + g_fp->playSound(SND_31_001, 1); + } + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene36.cpp b/engines/fullpipe/scenes/scene36.cpp new file mode 100644 index 0000000000..7d237fd395 --- /dev/null +++ b/engines/fullpipe/scenes/scene36.cpp @@ -0,0 +1,94 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene36_initScene(Scene *sc) { + g_vars->scene36_rotohrust = sc->getStaticANIObject1ById(ANI_ROTOHRUST, -1); + g_vars->scene36_scissors = sc->getStaticANIObject1ById(ANI_SCISSORS_36, -1); +} + +int scene36_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId != PIC_CSR_ITN || g_fp->_objectIdAtCursor != ANI_ROTOHRUST) { + if (g_fp->_objectIdAtCursor == PIC_SC36_MASK && g_fp->_cursorId == PIC_CSR_DEFAULT && (g_vars->scene36_scissors->_flags & 4)) + g_fp->_cursorId = PIC_CSR_ITN; + } else if (g_vars->scene36_rotohrust->_statics->_staticsId == ST_RHT_OPEN) + g_fp->_cursorId = PIC_CSR_GOL; + + return g_fp->_cursorId; +} + +int sceneHandler36(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case 29: + if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC36_MASK) + if (g_vars->scene36_scissors) + if (g_vars->scene36_scissors->_flags & 4) + if (g_fp->_aniMan->isIdle()) + if (!(g_fp->_aniMan->_flags & 0x100) && g_fp->_msgObjectId2 != g_vars->scene36_scissors->_id ) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene36_scissors, cmd->_keyCode); + + cmd->_messageKind = 0; + } + + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index a08152e94c..da9e7e3984 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -23,8 +23,13 @@ #include "fullpipe/fullpipe.h" #include "fullpipe/objects.h" +#include "fullpipe/scene.h" #include "fullpipe/sound.h" #include "fullpipe/ngiarchive.h" +#include "common/memstream.h" +#include "audio/audiostream.h" +#include "audio/decoders/vorbis.h" +#include "audio/decoders/wave.h" namespace Fullpipe { @@ -113,14 +118,36 @@ void Sound::setPanAndVolumeByStaticAni() { void FullpipeEngine::setSceneMusicParameters(GameVar *var) { warning("STUB: FullpipeEngine::setSceneMusicParameters()"); + // TODO: Finish this (MINDELAY, MAXDELAY, LOCAL, SEQUENCE, STARTDELAY etc) + stopAllSoundStreams(); + _musicGameVar = var; } void FullpipeEngine::startSceneTrack() { - debug(3, "STUB: FullpipeEngine::startSceneTrack()"); + // TODO: Finish this +#ifdef USE_VORBIS + if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle)) + return; + + GameVar *musicTrackVar = _musicGameVar->getSubVarByName("MUSIC")->getSubVarByName("TRACKS")->_subVars; + if (!musicTrackVar) + return; + + char *trackName = musicTrackVar->_varName; + Common::File *track = new Common::File(); + if (!track->open(trackName)) { + warning("Could not open %s", trackName); + delete track; + return; + } + Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES); + g_fp->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg); +#endif } void FullpipeEngine::stopAllSounds() { - warning("STUB: FullpipeEngine::stopAllSounds()"); + // TODO: Differences from stopAllSoundStreams() + g_fp->_mixer->stopAll(); } void FullpipeEngine::toggleMute() { @@ -128,7 +155,18 @@ void FullpipeEngine::toggleMute() { } void FullpipeEngine::playSound(int id, int flag) { - warning("STUB: FullpipeEngine::playSound(%d, %d)", id, flag); + SoundList *soundList = g_fp->_currentScene->_soundList; + Sound *sound = soundList->getSoundById(id); + if (!sound) { + warning("playSound: Can't find sound with ID %d", id); + return; + } + byte *soundData = sound->loadData(); + Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, sound->getDataSize()); + Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); + Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1); + Audio::SoundHandle handle = sound->getHandle(); + g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); } void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) { @@ -144,11 +182,18 @@ void FullpipeEngine::stopSoundStream2() { } void FullpipeEngine::stopAllSoundStreams() { - warning("STUB: FullpipeEngine::stopAllSoundStreams()"); + // TODO: Differences from stopAllSounds() + g_fp->_mixer->stopAll(); } void FullpipeEngine::stopAllSoundInstances(int id) { - warning("STUB: FullpipeEngine::stopAllSoundInstances(%d)", id); + SoundList *soundList = g_fp->_currentScene->_soundList; + for (int i = 0; i < soundList->getCount(); i++) { + Sound *sound = soundList->getSoundByIndex(i); + if (sound->getId() == id) { + g_fp->_mixer->stopHandle(sound->getHandle()); + } + } } } // End of namespace Fullpipe diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index e2b271fe2c..07830e9617 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -32,12 +32,15 @@ class Sound : public MemoryObject { int _directSoundBuffer; int _directSoundBuffers[7]; byte *_soundData; + Audio::SoundHandle _handle; public: Sound(); virtual bool load(MfcArchive &file, NGIArchive *archive); virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class void updateVolume(); + int getId() const { return _id; } + Audio::SoundHandle getHandle() const { return _handle; } void setPanAndVolumeByStaticAni(); }; @@ -55,6 +58,13 @@ class SoundList : public CObject { int getCount() { return _soundItemsCount; } Sound *getSoundByIndex(int idx) { return _soundItems[idx]; } + Sound *getSoundById(int id) { + for (int i = 0; i < _soundItemsCount; i++) { + if (_soundItems[i]->getId() == id) + return _soundItems[i]; + } + return NULL; + } }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 6a56ffd662..9c54947b35 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -82,8 +82,11 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) { setMusicAllowed(_gameLoader->_gameVar->getSubVarAsInt("MUSIC_ALLOWED")); if (scene) { - _gameLoader->loadScene(scene); - _gameLoader->gotoScene(scene, TrubaLeft); + _gameLoader->loadScene(726); + _gameLoader->gotoScene(726, TrubaLeft); + + if (scene != 726) + _gameLoader->preloadScene(726, getSceneEntrance(scene)); } else { if (_flgPlayIntro) { _gameLoader->loadScene(SC_INTRO1); diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 2af9cff743..c6edce9621 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -281,6 +281,29 @@ void StaticANIObject::queueMessageQueue(MessageQueue *mq) { } } +void StaticANIObject::restartMessageQueue(MessageQueue *mq) { + ExCommand *ex = mq->getExCommandByIndex(0); + if (ex) { + while (ex->_messageKind != 1 || ex->_parentId != _id) { + ex->_parId = 0; + ex->_excFlags |= 2; + ex->handleMessage(); + + mq->deleteExCommandByIndex(0, 0); + + ex = mq->getExCommandByIndex(0); + + if (!ex) + return; + } + + if (ex) { + startAnim(ex->_messageNum, mq->_id, -1); + mq->deleteExCommandByIndex(0, 1); + } + } +} + MessageQueue *StaticANIObject::getMessageQueue() { if (this->_messageQueueId <= 0) return 0; @@ -302,6 +325,10 @@ bool StaticANIObject::trySetMessageQueue(int msgNum, int qId) { return true; } +void StaticANIObject::startMQIfIdle(int qId, int flag) { + warning("STUB: StaticANIObject::startMQIfIdle()"); +} + bool StaticANIObject::isIdle() { if (_messageQueueId) { MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId); @@ -708,7 +735,7 @@ void StaticANIObject::update(int counterdiff) { ex = dyn->getExCommand(); if (ex && ex->_messageKind != 35) { - newex = new ExCommand(ex); + newex = ex->createClone(); newex->_excFlags |= 2; if (newex->_messageKind == 17) { newex->_parentId = _id; @@ -741,7 +768,7 @@ void StaticANIObject::update(int counterdiff) { ex = dyn->getExCommand(); if (ex) { if (ex->_messageKind == 35) { - newex = new ExCommand(ex); + newex = ex->createClone(); newex->_excFlags |= 2; newex->sendMessage(); } @@ -1048,7 +1075,7 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase ExCommand *ex = _movement->_currDynamicPhase->getExCommand(); if (ex) { if (ex->_messageKind == 35) { - ExCommand *newex = new ExCommand(ex); + ExCommand *newex = ex->createClone(); newex->_excFlags |= 2; newex->sendMessage(); } @@ -1528,6 +1555,25 @@ int Movement::calcDuration() { return res; } +int Movement::countPhasesWithFlag(int maxidx, int flag) { + int res = 0; + int sz; + + if (_currMovement) + sz = _currMovement->_dynamicPhases.size(); + else + sz = _dynamicPhases.size(); + + if (maxidx < 0) + maxidx = sz; + + for (int i = 0; i < maxidx && i < sz; i++) + if (getDynamicPhaseByIndex(i)->_dynFlags & flag) + res++; + + return res; +} + void Movement::setDynamicPhaseIndex(int index) { debug(7, "Movement::setDynamicPhaseIndex(%d)", index); while (_currDynamicPhaseIndex < index) @@ -1852,7 +1898,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) { _field_7C = src->_field_7C; if (src->getExCommand()) - _exCommand = new ExCommand(src->getExCommand()); + _exCommand = src->getExCommand()->createClone(); else _exCommand = 0; @@ -1917,6 +1963,8 @@ bool StaticPhase::load(MfcArchive &file) { assert (g_fp->_gameProjectVersion >= 12); + warning("StaticPhase::load(): Code continues here"); + return true; } diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index c8537dfa97..258752edd1 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -153,6 +153,7 @@ class Movement : public GameObject { DynamicPhase *getDynamicPhaseByIndex(int idx); int calcDuration(); + int countPhasesWithFlag(int maxidx, int flag); void removeFirstPhase(); bool gotoNextFrame(void (*_callback1)(int, Common::Point *point, int, int), void (*callback2)(int *)); @@ -212,8 +213,10 @@ class StaticANIObject : public GameObject { void deleteFromGlobalMessageQueue(); void queueMessageQueue(MessageQueue *msg); + void restartMessageQueue(MessageQueue *msg); MessageQueue *getMessageQueue(); bool trySetMessageQueue(int msgNum, int qId); + void startMQIfIdle(int qId, int flag); void initMovements(); void loadMovementsPixelData(); diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 64f56ced0a..5714fd3b4c 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -66,6 +66,8 @@ class MfcArchive : public Common::SeekableReadStream { enum ObjType { kObjTypeDefault, + kObjTypeExCommand, + kObjTypeExCommand2, kObjTypeMovGraph, kObjTypeMovGraphLink, kObjTypeMovGraphNode, @@ -115,6 +117,7 @@ class MemoryObject : CObject { void load() { loadFile(_memfilename); } byte *getData(); byte *loadData(); + int getDataSize() const { return _dataSize; } bool testFlags(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index b7c6a9b5a9..615eace374 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -60,10 +60,6 @@ */ namespace Hopkins { -#define DEBUG_BASIC 1 -#define DEBUG_INTERMEDIATE 2 -#define DEBUG_DETAILED 3 - #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index 10f2bc1e00..feba193609 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -170,6 +170,14 @@ static const ExtraGuiOption neverhoodExtraGuiOption2 = { false }; +static const ExtraGuiOption neverhoodExtraGuiOption3 = { + _s("Scale the making of videos to full screen"), + _s("Scale the making of videos, so that they use the whole screen"), + "scalemakingofvideos", + false +}; + + class NeverhoodMetaEngine : public AdvancedMetaEngine { public: NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) { @@ -225,6 +233,7 @@ const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::Stri ExtraGuiOptions options; options.push_back(neverhoodExtraGuiOption1); options.push_back(neverhoodExtraGuiOption2); + options.push_back(neverhoodExtraGuiOption3); return options; } diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 31eee4da55..5e9981caa6 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -79,7 +79,7 @@ GameModule::GameModule(NeverhoodEngine *vm) _mainMenuRequested(false) { // Other initializations moved to actual engine class - _vm->_soundMan->playSoundThree(0x002D0031, 0x8861079); + _vm->_soundMan->playSoundThree(0x002D0031, 0x08861079); SetMessageHandler(&GameModule::handleMessage); } @@ -95,7 +95,7 @@ void GameModule::handleMouseMove(int16 x, int16 y) { mousePos.x = x; mousePos.y = y; debug(2, "GameModule::handleMouseMove(%d, %d)", x, y); - sendPointMessage(_childObject, 0, mousePos); + sendPointMessage(_childObject, NM_MOUSE_MOVE, mousePos); } } @@ -115,7 +115,19 @@ void GameModule::handleMouseUp(int16 x, int16 y) { mousePos.x = x; mousePos.y = y; debug(2, "GameModule::handleMouseUp(%d, %d)", x, y); - sendPointMessage(_childObject, 0x0002, mousePos); + sendPointMessage(_childObject, NM_MOUSE_RELEASE, mousePos); + } +} + +void GameModule::handleWheelUp() { + if (_childObject) { + sendMessage(_childObject, NM_MOUSE_WHEELUP, 0); + } +} + +void GameModule::handleWheelDown() { + if (_childObject) { + sendMessage(_childObject, NM_MOUSE_WHEELDOWN, 0); } } @@ -415,6 +427,8 @@ void GameModule::checkRequests() { _vm->_audioResourceMan->stopAllSounds(); _vm->_soundMan->stopAllMusic(); _vm->_soundMan->stopAllSounds(); + // Reinsert turning sound because SoundMan::stopAllSounds() removes it + _vm->_soundMan->playSoundThree(0x002D0031, 0x08861079); delete _childObject; delete _prevChildObject; _childObject = NULL; diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 2f2fecf463..198f8f6715 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -40,6 +40,8 @@ public: void handleMouseMove(int16 x, int16 y); void handleMouseDown(int16 x, int16 y); void handleMouseUp(int16 x, int16 y); + void handleWheelUp(); + void handleWheelDown(); void handleSpaceKey(); void handleAsciiKey(char key); void handleKeyDown(Common::KeyCode keyCode); diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index b6aff48e0e..b332418cf5 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -112,7 +112,7 @@ void MenuModule::createScene(int sceneNum, int which) { _childObject = new CreditsScene(_vm, this, true); break; case MAKING_OF: - createSmackerScene(kMakingOfSmackerFileHashList, false, true, true); + createSmackerScene(kMakingOfSmackerFileHashList, ConfMan.getBool("scalemakingofvideos"), true, true); break; case LOAD_GAME_MENU: createLoadGameMenu(); @@ -150,7 +150,6 @@ void MenuModule::updateScene() { leaveModule(0); break; case kMainMenuQuitGame: - leaveModule(0); _vm->quitGame(); break; case kMainMenuCredits: @@ -195,6 +194,14 @@ void MenuModule::updateScene() { } uint32 MenuModule::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { + switch(messageNum) { + case NM_KEYPRESS_ESC: + leaveModule(0); + break; + default: + break; + } + return Module::handleMessage(messageNum, param, sender);; } @@ -405,7 +412,6 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb _ticksTime = _vm->_system->getMillis() + 202100; - _vm->toggleSoundUpdate(true); _musicResource = new MusicResource(_vm); _musicResource->load(0x30812225); _musicResource->play(0); @@ -415,7 +421,6 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb CreditsScene::~CreditsScene() { _musicResource->unload(); delete _musicResource; - _vm->toggleSoundUpdate(false); } void CreditsScene::update() { @@ -1020,6 +1025,12 @@ uint32 GameStateMenu::handleMessage(int messageNum, const MessageParam ¶m, E break; } break; + case NM_MOUSE_WHEELUP: + _listBox->scrollUp(); + break; + case NM_MOUSE_WHEELDOWN: + _listBox->scrollDown(); + break; } return 0; } @@ -1072,7 +1083,7 @@ static const NRect kLoadGameMenuButtonCollisionBounds[] = { { 182, 358, 241, 433 } }; -static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 272 }; static const NRect kLoadGameMenuTextEditRect = { 0, 0, 320, 17 }; static const NRect kLoadGameMenuMouseRect = { 263, 48, 583, 65 }; @@ -1105,7 +1116,7 @@ static const NRect kDeleteGameMenuButtonCollisionBounds[] = { { 395, 278, 452, 372 } }; -static const NRect kDeleteGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kDeleteGameMenuListBoxRect = { 0, 0, 320, 272 }; static const NRect kDeleteGameMenuTextEditRect = { 0, 0, 320, 17 }; DeleteGameMenu::DeleteGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) diff --git a/engines/neverhood/messages.h b/engines/neverhood/messages.h index 7f165787bf..5f1e1b87dd 100644 --- a/engines/neverhood/messages.h +++ b/engines/neverhood/messages.h @@ -28,6 +28,7 @@ namespace Neverhood { enum NeverhoodMessage { NM_MOUSE_MOVE = 0x0000, NM_MOUSE_CLICK = 0x0001, + NM_MOUSE_RELEASE = 0x0002, NM_MOUSE_HIDE = 0x101D, NM_MOUSE_SHOW = 0x101E, NM_KEYPRESS_SPACE = 0x0009, @@ -56,15 +57,19 @@ enum NeverhoodMessage { NM_KLAYMEN_CLOSE_DOOR = 0x4809, NM_KLAYMEN_MOVE_OBJECT = 0x480A, NM_KLAYMEN_LOWER_LEVER = 0x480F, - NM_KLAYMEN_PICKUP = 0x4812, - NM_KLAYMEN_PRESS_BUTTON = 0x4816, - NM_KLAYMEN_INSERT_DISK = 0x481A, + NM_KLAYMEN_PICKUP = 0x4812, + NM_KLAYMEN_PRESS_BUTTON = 0x4816, + NM_KLAYMEN_INSERT_DISK = 0x481A, NM_KLAYMEN_TURN_TO_USE = 0x481D, NM_KLAYMEN_RETURN_FROM_USE = 0x481E, - NM_KLAYMEN_RELEASE_LEVER = 0x4827, + NM_KLAYMEN_RELEASE_LEVER = 0x4827, NM_MOVE_TO_BACK = 0x482A, - NM_MOVE_TO_FRONT = 0x482B + NM_MOVE_TO_FRONT = 0x482B, + + // New to ScummVM + NM_MOUSE_WHEELUP = 0xF000, + NM_MOUSE_WHEELDOWN = 0xF001 }; } // End of namespace Neverhood diff --git a/engines/neverhood/module.cpp b/engines/neverhood/module.cpp index d1578e680c..3ef4554334 100644 --- a/engines/neverhood/module.cpp +++ b/engines/neverhood/module.cpp @@ -48,7 +48,7 @@ void Module::draw() { uint32 Module::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x0008: - sendMessage(_parentModule, 8, 0); + sendMessage(_parentModule, 0x0008, 0); return 0; case 0x1009: _moduleResult = param.asInteger(); diff --git a/engines/neverhood/modules/module1600.cpp b/engines/neverhood/modules/module1600.cpp index d66d5c1b8e..76c5ca93d2 100644 --- a/engines/neverhood/modules/module1600.cpp +++ b/engines/neverhood/modules/module1600.cpp @@ -307,7 +307,7 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) _clipRect2 = _clipRect1; _clipRect2.y2 = 215; _kmScene1608->setClipRect(_clipRect1); - _asCar->setClipRect(_clipRect1); + _asCar->setClipRect(_clipRect3); _asIdleCarLower->setClipRect(_clipRect1); _asIdleCarFull->setClipRect(_clipRect1); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); @@ -401,7 +401,7 @@ void Scene1608::upRidingCar() { sendPointMessage(_asCar, 0x2004, _mouseClickPos); _mouseClicked = false; } - if (_asCar->getX() < 300) { + if (_asCar->getY() < 330) { if (_carClipFlag) { _carClipFlag = false; _asCar->setClipRect(_clipRect1); diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index 8f23de33db..5d892de224 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -59,154 +59,123 @@ Module2800::~Module2800() { _vm->_soundMan->deleteGroup(0x64210814); } +#define statueCloseup(backgroundFileHash, cursorFileHash) \ + _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); \ + createStaticScene(backgroundFileHash, cursorFileHash) + void Module2800::createScene(int sceneNum, int which) { debug(1, "Module2800::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; + + if (_sceneNum != 1001) + _vm->gameState().sceneNum = _sceneNum; + switch (_sceneNum) { - case 0: - _vm->gameState().sceneNum = 0; + case 0: // in front of radio _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); _childObject = new Scene2801(_vm, this, which); break; - case 1: - _vm->gameState().sceneNum = 1; + case 1: // radio _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); if (getGlobalVar(V_RADIO_ENABLED)) _childObject = new Scene2802(_vm, this, which); else createStaticScene(0x000C6444, 0xC6440008); break; - case 2: - _vm->gameState().sceneNum = 2; + case 2: // outside shrink machine _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); if (getGlobalVar(V_KLAYMEN_SMALL)) _childObject = new Scene2803Small(_vm, this, which); else _childObject = new Scene2803(_vm, this, which); break; - case 3: - _vm->gameState().sceneNum = 3; + case 3: // glass cylinder with diamonds _childObject = new Scene2804(_vm, this, which); break; - case 4: - _vm->gameState().sceneNum = 4; + case 4: // outside the transporter _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2805(_vm, this, which); break; - case 5: - _vm->gameState().sceneNum = 5; + case 5: // left test tube room _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2806(_vm, this, which); break; - case 6: - _vm->gameState().sceneNum = 6; + case 6: // the three test tubes next to the window _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2807(_vm, this, which); break; - case 7: - _vm->gameState().sceneNum = 7; + case 7: // left test tube room closeup _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2808(_vm, this, 0); break; - case 8: - _vm->gameState().sceneNum = 8; + case 8: // right test tube room _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2809(_vm, this, which); break; - case 9: - _vm->gameState().sceneNum = 9; + case 9: // statue room _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2810(_vm, this, which); break; - case 10: - _vm->gameState().sceneNum = 10; + case 10: // right test tube room closeup _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2808(_vm, this, 1); break; - case 11: - _vm->gameState().sceneNum = 11; + case 11: // disk player room (above the statue room) _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2812(_vm, this, which); break; case 12: - _vm->gameState().sceneNum = 12; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x0000A245, 0x0A241008); + statueCloseup(0x0000A245, 0x0A241008); break; case 13: - _vm->gameState().sceneNum = 13; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x81C60635, 0x60631814); + statueCloseup(0x81C60635, 0x60631814); break; case 14: - _vm->gameState().sceneNum = 14; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0xCA811204, 0x11200CA0); + statueCloseup(0xCA811204, 0x11200CA0); break; case 15: - _vm->gameState().sceneNum = 15; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x2D438A00, 0x38A042DC); + statueCloseup(0x2D438A00, 0x38A042DC); break; case 16: - _vm->gameState().sceneNum = 16; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x0A806204, 0x062000A0); + statueCloseup(0x0A806204, 0x062000A0); break; case 17: - _vm->gameState().sceneNum = 17; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x010F9284, 0xF9280018); + statueCloseup(0x010F9284, 0xF9280018); break; case 18: - _vm->gameState().sceneNum = 18; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x0100022B, 0x0022F018); + statueCloseup(0x0100022B, 0x0022F018); break; case 19: - _vm->gameState().sceneNum = 19; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x10866205, 0x66201100); + statueCloseup(0x10866205, 0x66201100); break; case 20: - _vm->gameState().sceneNum = 20; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x01C58000, 0x58004014); + statueCloseup(0x01C58000, 0x58004014); break; - case 21: - _vm->gameState().sceneNum = 21; + case 21: // statue with ladder down button _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2822(_vm, this, which); break; case 22: - _vm->gameState().sceneNum = 22; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x9408121E, 0x8121A948); + statueCloseup(0x9408121E, 0x8121A948); break; case 23: - _vm->gameState().sceneNum = 23; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x048C0600, 0xC0604040); + statueCloseup(0x048C0600, 0xC0604040); break; case 24: - _vm->gameState().sceneNum = 24; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x04270A94, 0x70A9004A); + statueCloseup(0x04270A94, 0x70A9004A); break; - case 25: - _vm->gameState().sceneNum = 25; + case 25: // window _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); if (getGlobalVar(V_SHRINK_LIGHTS_ON)) createStaticScene(0x01600204, 0x0020001E); else createStaticScene(0x08611204, 0x1120008E); break; - case 26: - _vm->gameState().sceneNum = 26; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); + case 26: // disk player + _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 2); _childObject = new DiskplayerScene(_vm, this, 4); break; - case 1001: + case 1001: // tower rotation video _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); _musicResource->stop(0); _currentMusicFileHash = 0; @@ -217,6 +186,8 @@ void Module2800::createScene(int sceneNum, int which) { _childObject->handleUpdate(); } +#undef statueCloseup + void Module2800::updateScene() { if (!updateChild()) { switch (_sceneNum) { @@ -603,7 +574,7 @@ uint32 Scene2802::handleMessage(int messageNum, const MessageParam ¶m, Entit } } break; - case 0x0002: + case NM_MOUSE_RELEASE: if (_countdown1 == 0) _currTuneStatus = 0; else { diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index b961bccea7..6b1f2d9346 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -178,6 +178,12 @@ void NeverhoodEngine::mainLoop() { case Common::EVENT_RBUTTONUP: _gameModule->handleMouseUp(event.mouse.x, event.mouse.y); break; + case Common::EVENT_WHEELUP: + _gameModule->handleWheelUp(); + break; + case Common::EVENT_WHEELDOWN: + _gameModule->handleWheelDown(); + break; case Common::EVENT_QUIT: _system->quit(); break; @@ -191,13 +197,12 @@ void NeverhoodEngine::mainLoop() { _gameModule->draw(); _console->onFrame(); _screen->update(); + if (_updateSound) + _soundMan->update(); nextFrameTime = _screen->getNextFrameTime(); }; - if (_updateSound) { - _soundMan->update(); - _audioResourceMan->updateMusic(); - } + _audioResourceMan->updateMusic(); _system->updateScreen(); _system->delayMillis(10); diff --git a/engines/neverhood/palette.cpp b/engines/neverhood/palette.cpp index 941bcc3cd3..134fec7163 100644 --- a/engines/neverhood/palette.cpp +++ b/engines/neverhood/palette.cpp @@ -119,7 +119,7 @@ void Palette::startFadeToBlack(int counter) { _fadeToG = 0; _fadeToB = 0; _palCounter = counter; - _fadeStep = 255 / counter; + _fadeStep = calculateFadeStep(counter); _status = 1; } @@ -131,7 +131,7 @@ void Palette::startFadeToWhite(int counter) { _fadeToG = 255; _fadeToB = 255; _palCounter = counter; - _fadeStep = 255 / counter; + _fadeStep = calculateFadeStep(counter); _status = 1; } @@ -140,7 +140,7 @@ void Palette::startFadeToPalette(int counter) { if (counter == 0) counter = 1; _palCounter = counter; - _fadeStep = 255 / counter; + _fadeStep = calculateFadeStep(counter); _status = 2; } @@ -203,4 +203,11 @@ void Palette::fadeColor(byte *rgb, byte toR, byte toG, byte toB) { #undef FADE } +int Palette::calculateFadeStep(int counter) { + int fadeStep = 255 / counter; + if (255 % counter) + fadeStep++; + return fadeStep; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/palette.h b/engines/neverhood/palette.h index c83207caae..016f856104 100644 --- a/engines/neverhood/palette.h +++ b/engines/neverhood/palette.h @@ -61,6 +61,7 @@ protected: int _fadeStep; void update(); void fadeColor(byte *rgb, byte toR, byte toG, byte toB); + int calculateFadeStep(int counter); }; } // End of namespace Neverhood diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index 4b4982f68e..014e094b94 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -21,6 +21,7 @@ */ #include "graphics/palette.h" +#include "neverhood/gamemodule.h" #include "neverhood/smackerplayer.h" #include "neverhood/palette.h" #include "neverhood/resourceman.h" @@ -160,7 +161,7 @@ void SmackerPlayer::close() { void SmackerPlayer::gotoFrame(int frameNumber) { if (_smackerDecoder) { _smackerDecoder->forceSeekToFrame(frameNumber); - _smackerDecoder->decodeNextFrame(); + updateFrame(); } } @@ -251,6 +252,15 @@ void SmackerPlayer::updatePalette() { tempPalette[i * 4 + 1] = smackerPalette[i * 3 + 1]; tempPalette[i * 4 + 2] = smackerPalette[i * 3 + 2]; } + + // WORKAROUND: Scene 3, module 3000 defines a black color 255 instead of + // white, which results in the mouse cursor showing black. I'm not sure if + // color 255 is always supposed to be white. It's not feasible to check + // all scenes for a glitch that only seems to manifest in one, therefore + // we define color 255 to be white only for that scene. + if (_vm->_gameModule->getCurrentModuleNum() == 3000 && _vm->_gameState.sceneNum == 3) + tempPalette[255 * 4 + 0] = tempPalette[255 * 4 + 1] = tempPalette[255 * 4 + 2] = 0xFF; + _palette->copyPalette(tempPalette, 0, 256, 0); } diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index 3ea45491a7..5821fd6df3 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -66,6 +66,12 @@ void SoundResource::play() { soundItem->playSound(false); } +void SoundResource::playLooping() { + AudioResourceManSoundItem *soundItem = getSoundItem(); + if (soundItem) + soundItem->playSound(true); +} + void SoundResource::stop() { AudioResourceManSoundItem *soundItem = getSoundItem(); if (soundItem) @@ -235,24 +241,24 @@ void SoundItem::update() { if (_playOnceAfterCountdown) { if (_currCountdown == 0) _currCountdown = _initialCountdown; - else if (--_currCountdown == 0) + else if (--_currCountdown <= 0) _soundResource->play(); } else if (_playOnceAfterRandomCountdown) { if (_currCountdown == 0) { if (_minCountdown > 0 && _maxCountdown > 0 && _minCountdown < _maxCountdown) _currCountdown = _vm->_rnd->getRandomNumberRng(_minCountdown, _maxCountdown); - } else if (--_currCountdown == 0) + } else if (--_currCountdown <= 0) _soundResource->play(); } else if (_playLooping && !_soundResource->isPlaying()) - _soundResource->play(); + _soundResource->playLooping(); } // SoundMan SoundMan::SoundMan(NeverhoodEngine *vm) : _vm(vm), _soundIndex1(-1), _soundIndex2(-1), _soundIndex3(-1), - _initialCountdown(0), _playOnceAfterCountdown(false), - _initialCountdown3(0), _playOnceAfterCountdown3(false) { + _initialCountdown(15), _playOnceAfterCountdown(false), + _initialCountdown3(9), _playOnceAfterCountdown3(false) { } SoundMan::~SoundMan() { @@ -373,7 +379,6 @@ void SoundMan::update() { if (soundItem) soundItem->update(); } - for (uint i = 0; i < _musicItems.size(); ++i) { MusicItem *musicItem = _musicItems[i]; if (musicItem) @@ -554,14 +559,16 @@ int NeverhoodAudioStream::readBuffer(int16 *buffer, const int numSamples) { } } else { memcpy(buffer, _buffer, bytesRead); - buffer += bytesRead; + buffer += samplesRead; } if (bytesRead < bytesToRead || _stream->pos() >= _stream->size() || _stream->err() || _stream->eos()) { - if (_isLooping) + if (_isLooping) { _stream->seek(0); - else + _prevValue = 0; + } else { _endOfData = true; + } } } @@ -609,7 +616,7 @@ void AudioResourceManSoundItem::playSound(bool looping) { if (_data) { const byte *shiftValue = _resourceHandle.extData(); Common::MemoryReadStream *stream = new Common::MemoryReadStream(_data, _resourceHandle.size(), DisposeAfterUse::NO); - NeverhoodAudioStream *audioStream = new NeverhoodAudioStream(22050, *shiftValue, false, DisposeAfterUse::YES, stream); + NeverhoodAudioStream *audioStream = new NeverhoodAudioStream(22050, *shiftValue, looping, DisposeAfterUse::YES, stream); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream, -1, VOLUME(_volume), PANNING(_panning)); debug(1, "playing sound %08X", _fileHash); diff --git a/engines/neverhood/sound.h b/engines/neverhood/sound.h index 548fe88501..1f80f8d6b0 100644 --- a/engines/neverhood/sound.h +++ b/engines/neverhood/sound.h @@ -50,6 +50,7 @@ public: void unload(); void play(uint32 fileHash); void play(); + void playLooping(); void stop(); void setVolume(int16 volume); void setPan(int16 pan); diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index bdba75dfa5..85d01ca380 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -106,7 +106,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.005", 0, "8a5ed3ba96e2eaf18e36fedfaab89419", 297838}, {"resource.006", 0, "dceed92e709cad1bd9582809a235b0a0", 266682}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Castle of Dr. Brain - English DOS 3.5" Floppy EGA (from nozomi77, bug report #3405307) {"castlebrain", "EGA", { @@ -116,7 +116,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.002", 0, "de2f182529efaad2c4b510b452ab77ac", 633662}, {"resource.003", 0, "38b4b37febc6b4f5061c461a283df148", 430388}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Castle of Dr. Brain - English DOS Floppy (from jvprat) // Executable scanning reports "1.000.044", Floppy label reports "1.0, 10.30.91", VERSION file reports "1.000" @@ -407,7 +407,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243}, {"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Conquests of the Longbow DOS 1.0 EGA (4 x 5.25" disks) // Provided by ssburnout in bug report #3046802 @@ -418,7 +418,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.002", 0, "8c767b3939add63d11274065e46aad04", 1152478}, {"resource.003", 0, "7025b87e735b1df3f0e9488a621f4333", 1171439}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Conquests of the Longbow - English DOS Non-Interactive Demo // SCI interpreter version 1.000.510 @@ -1022,14 +1022,14 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 202105}, {"resource.002", 0, "b86daa3ba2784d1502da881eedb80d9b", 341771}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Jones in the Fast Lane EGA - English DOS (supplied by EddyDrama in bug report #3038761) {"jones", "EGA", { {"resource.map", 0, "8e92cf319180cc8b5b87b2ce93a4fe22", 1602}, {"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 511528}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Jones in the Fast Lane VGA - English DOS // SCI interpreter version 1.000.172 @@ -1357,7 +1357,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.006", 0, "698c698570cde9015e4d51eb8d2e9db1", 666527}, {"resource.007", 0, "703d8df30e89541af337d7706540d5c4", 541743}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 5 EGA 1.2M disk version (from LordHoto) // VERSION file reports "0.000.055" @@ -1369,7 +1369,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.map", 0, "53206afb4fd73871a484e83acab80f31", 7608}, {"resource.004", 0, "83568edf7fde18b3eed988bc5d22ceb1", 1188053}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 5 EGA (supplied by omer_mor in bug report #3035421) // VERSION file reports "0.000.062" @@ -1384,7 +1384,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.006", 0, "698c698570cde9015e4d51eb8d2e9db1", 666541}, {"resource.007", 0, "703d8df30e89541af337d7706540d5c4", 541762}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest V DOS 0.000.062 EGA (5 x 5.25" disks) // Supplied by ssburnout in bug report #3046780 @@ -1396,7 +1396,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.003", 0, "3cca5b2dae8afe94532edfdc98d7edbe", 1092325}, {"resource.004", 0, "8e5c1bc4d738cf7316ff506f59d265e2", 1187803}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // King's Quest 5 DOS Spanish Floppy 0.000.062 VGA (5 x 3.5" disks) // Supplied by dianiu in bug report #3555646 @@ -1797,7 +1797,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.002", 0, "24c958bc922b07f91e25e8c93aa01fcf", 491230}, {"resource.003", 0, "685cd6c1e05a695ab1e0db826337ee2a", 553279}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, #if 0 // The resource.002 file, contained in disk 3, is broken in this version @@ -2202,7 +2202,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.006", 0, "f6046a8445422f17d40b1b10ab21ebf3", 568551}, {"resource.007", 0, "640ee65595d40372ef95462f2c1ae28a", 593429}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Larry 5 EGA // Supplied by omer_mor in bug report #3049771 @@ -2213,7 +2213,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.002", 0, "5a55af4e40728b1a8103dc47ad2afa8d", 1100539}, {"resource.003", 0, "16f4d8fb1b526125edaca4fc6cbb7530", 1064563}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Larry 6 - English DOS (from spookypeanut) // SCI interpreter version 1.001.113 @@ -2820,7 +2820,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.004", 0, "b96a86ab681769e4cbb439670d967ca6", 449682}, {"resource.005", 0, "9e6c53a0e7eef53694d260fade8b1fc7", 724000}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Police Quest 4 - English DOS Non-Interactive Demo (from FRG) // SCI interpreter version 1.001.096 @@ -3483,7 +3483,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.004", 0, "975c6e81194ae6b65e960a248129ecaa", 684119}, {"resource.005", 0, "13d96f7905637552c0647175ff816145", 695589}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Space Quest 3 - English Amiga (from www.back2roots.org) // SCI interpreter version 0.000.453 (just a guess) @@ -3679,7 +3679,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9a673e33c3f6dd560b993ffed77eeb49", 534994}, {"resource.005", 0, "3c4841d0a3ebba4404af588c93620c22", 595465}, AD_LISTEND}, - Common::EN_ANY, Common::kPlatformDOS, 0, GUIO5(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, + Common::EN_ANY, Common::kPlatformDOS, 0, GUIO4(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) }, // Space Quest 4 - German DOS (from Tobis87, also includes english language) // SCI interpreter version 1.000.200 (just a guess) diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index 7d7bca22a1..374f7208d8 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -132,7 +132,7 @@ void GfxPicture::drawSci11Vga() { _palette->createFromData(inbuffer + palette_data_ptr, size - palette_data_ptr, &palette); _palette->set(&palette, true); - drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0, 0); + drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0, 0, false); } // process vector data @@ -224,14 +224,14 @@ void GfxPicture::drawSci32Vga(int16 celNo, int16 drawX, int16 drawY, int16 pictu cel_RlePos = READ_SCI11ENDIAN_UINT32(inbuffer + cel_headerPos + 24); cel_LiteralPos = READ_SCI11ENDIAN_UINT32(inbuffer + cel_headerPos + 28); - drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, drawX, drawY, pictureX, pictureY); + drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, drawX, drawY, pictureX, pictureY, false); cel_headerPos += 42; } #endif extern void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCount, int rlePos, int literalPos, ViewType viewType, uint16 width, bool isMacSci11ViewData); -void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY) { +void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY, bool isEGA) { byte *celBitmap = NULL; byte *ptr = NULL; byte *headerPtr = inbuffer + headerPos; @@ -239,13 +239,17 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos // displaceX, displaceY fields are ignored, and may contain garbage // (e.g. pic 261 in Dr. Brain 1 Spanish - bug #3614914) //int16 displaceX, displaceY; - byte priority = _addToFlag ? _priority : 0; + byte priority = _priority; byte clearColor; bool compression = true; byte curByte; int16 y, lastY, x, leftX, rightX; int pixelCount; uint16 width, height; + + // if the picture is not an overlay and we are also not in EGA mode, use priority 0 + if (!isEGA && !_addToFlag) + priority = 0; #ifdef ENABLE_SCI32 if (_resourceType != SCI_PICTURE_TYPE_SCI32) { @@ -360,37 +364,78 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos ptr = celBitmap; ptr += skipCelBitmapPixels; ptr += skipCelBitmapLines * width; - if (!_mirroredFlag) { - // Draw bitmap to screen - x = leftX; - while (y < lastY) { - curByte = *ptr++; - if ((curByte != clearColor) && (priority >= _screen->getPriority(x, y))) - _screen->putPixel(x, y, drawMask, curByte, priority, 0); - - x++; - - if (x >= rightX) { - ptr += sourcePixelSkipPerRow; - x = leftX; - y++; + + if ((!isEGA) || (priority < 16)) { + // VGA + EGA, EGA only checks priority, when given priority is below 16 + if (!_mirroredFlag) { + // Draw bitmap to screen + x = leftX; + while (y < lastY) { + curByte = *ptr++; + if ((curByte != clearColor) && (priority >= _screen->getPriority(x, y))) + _screen->putPixel(x, y, drawMask, curByte, priority, 0); + + x++; + + if (x >= rightX) { + ptr += sourcePixelSkipPerRow; + x = leftX; + y++; + } + } + } else { + // Draw bitmap to screen (mirrored) + x = rightX - 1; + while (y < lastY) { + curByte = *ptr++; + if ((curByte != clearColor) && (priority >= _screen->getPriority(x, y))) + _screen->putPixel(x, y, drawMask, curByte, priority, 0); + + if (x == leftX) { + ptr += sourcePixelSkipPerRow; + x = rightX; + y++; + } + + x--; } } } else { - // Draw bitmap to screen (mirrored) - x = rightX - 1; - while (y < lastY) { - curByte = *ptr++; - if ((curByte != clearColor) && (priority >= _screen->getPriority(x, y))) - _screen->putPixel(x, y, drawMask, curByte, priority, 0); - - if (x == leftX) { - ptr += sourcePixelSkipPerRow; - x = rightX; - y++; + // EGA, when priority is above 15 + // we don't check priority and also won't set priority at all + // fixes picture 48 of kq5 (island overview). Bug #5182 + if (!_mirroredFlag) { + // EGA+priority>15: Draw bitmap to screen + x = leftX; + while (y < lastY) { + curByte = *ptr++; + if (curByte != clearColor) + _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, curByte, 0, 0); + + x++; + + if (x >= rightX) { + ptr += sourcePixelSkipPerRow; + x = leftX; + y++; + } } + } else { + // EGA+priority>15: Draw bitmap to screen (mirrored) + x = rightX - 1; + while (y < lastY) { + curByte = *ptr++; + if (curByte != clearColor) + _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, curByte, 0, 0); + + if (x == leftX) { + ptr += sourcePixelSkipPerRow; + x = rightX; + y++; + } - x--; + x--; + } } } } @@ -540,22 +585,6 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { if ((_screen->isUnditheringEnabled()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61))) icemanDrawFix = true; } - if (g_sci->getGameId() == GID_KQ5) { - // WORKAROUND: ignore the seemingly broken priority of picture 48 - // (island overview). Fixes bug #3041044. - if (_resourceId == 48) - ignoreBrokenPriority = true; - } - if (g_sci->getGameId() == GID_SQ4) { - // WORKAROUND: ignore the seemingly broken priority of pictures 546 - // and 547 (Vohaul's head and Roger Jr trapped). Fixes bug #3046543. - if (_resourceId == 546 || _resourceId == 547) - ignoreBrokenPriority = true; - // WORKAROUND: ignore the seemingly broken priority of picture 631 - // (SQ1 view from the cockpit). Fixes bug #3046513. - if (_resourceId == 631) - ignoreBrokenPriority = true; - } } // Drawing @@ -740,8 +769,15 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { case PIC_OPX_EGA_EMBEDDED_VIEW: vectorGetAbsCoordsNoMirror(data, curPos, x, y); size = READ_LE_UINT16(data + curPos); curPos += 2; - _priority = pic_priority; // set global priority so the cel gets drawn using current priority as well - drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0, 0); + // hardcoded in SSCI, 16 for SCI1early excluding Space Quest 4, 0 for anything else + // fixes sq4 pictures 546+547 (Vohaul's head and Roger Jr trapped). Bug #5250 + // fixes sq4 picture 631 (SQ1 view from cockpit). Bug 5249 + if ((getSciVersion() <= SCI_VERSION_1_EARLY) && (g_sci->getGameId() != GID_SQ4)) { + _priority = 16; + } else { + _priority = 0; + } + drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0, 0, true); curPos += size; break; case PIC_OPX_EGA_SET_PRIORITY_TABLE: @@ -790,7 +826,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { } else { _priority = pic_priority; // set global priority so the cel gets drawn using current priority as well } - drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0, 0); + drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0, 0, false); curPos += size; break; case PIC_OPX_VGA_PRIORITY_TABLE_EQDIST: diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h index 4f075a6226..53f83bc09f 100644 --- a/engines/sci/graphics/picture.h +++ b/engines/sci/graphics/picture.h @@ -65,7 +65,7 @@ private: void initData(GuiResourceId resourceId); void reset(); void drawSci11Vga(); - void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY); + void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY, bool isEGA); void drawVectorData(byte *data, int size); bool vectorIsNonOpcode(byte pixel); void vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index c4c8e543b2..6a22f48086 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -554,6 +554,7 @@ class SoundResource { public: struct Channel { byte number; + byte flags; byte poly; uint16 prio; uint16 size; diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 268180b531..8e1568f564 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -599,6 +599,7 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers _tracks->channels = new Channel[_tracks->channelCount]; memset(_tracks->channels, 0, sizeof(Channel) * _tracks->channelCount); channel = &_tracks->channels[0]; + channel->flags |= 2; // don't remap (SCI0 doesn't have remapping) if (_soundVersion == SCI_VERSION_0_EARLY) { channel->data = resource->data + 0x11; channel->size = resource->size - 0x11; @@ -676,33 +677,52 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers channelNr = 0; while (channelCount--) { channel = &_tracks[trackNr].channels[channelNr]; - channel->prio = READ_LE_UINT16(data); uint dataOffset = READ_LE_UINT16(data + 2); - if (dataOffset < resource->size) { - channel->data = resource->data + dataOffset; - channel->size = READ_LE_UINT16(data + 4); - channel->curPos = 0; - // FIXME: number contains (low nibble) channel and (high nibble) flags - // 0x20 is set on rhythm channels to prevent remapping - channel->number = *channel->data; - channel->poly = *(channel->data + 1); - channel->time = channel->prev = 0; - channel->data += 2; // skip over header - channel->size -= 2; // remove header size - if (channel->number == 0xFE) { // Digital channel - _tracks[trackNr].digitalChannelNr = channelNr; - _tracks[trackNr].digitalSampleRate = READ_LE_UINT16(channel->data); - _tracks[trackNr].digitalSampleSize = READ_LE_UINT16(channel->data + 2); - _tracks[trackNr].digitalSampleStart = READ_LE_UINT16(channel->data + 4); - _tracks[trackNr].digitalSampleEnd = READ_LE_UINT16(channel->data + 6); - channel->data += 8; // Skip over header - channel->size -= 8; - } - _tracks[trackNr].channelCount++; - channelNr++; - } else { + + if (dataOffset >= resource->size) { warning("Invalid offset inside sound resource %d: track %d, channel %d", resourceNr, trackNr, channelNr); + data += 6; + continue; + } + + channel->data = resource->data + dataOffset; + channel->size = READ_LE_UINT16(data + 4); + channel->curPos = 0; + channel->number = *channel->data; + + channel->poly = *(channel->data + 1) & 0x0F; + channel->prio = *(channel->data + 1) >> 4; + channel->time = channel->prev = 0; + channel->data += 2; // skip over header + channel->size -= 2; // remove header size + if (channel->number == 0xFE) { // Digital channel + _tracks[trackNr].digitalChannelNr = channelNr; + _tracks[trackNr].digitalSampleRate = READ_LE_UINT16(channel->data); + _tracks[trackNr].digitalSampleSize = READ_LE_UINT16(channel->data + 2); + _tracks[trackNr].digitalSampleStart = READ_LE_UINT16(channel->data + 4); + _tracks[trackNr].digitalSampleEnd = READ_LE_UINT16(channel->data + 6); + channel->data += 8; // Skip over header + channel->size -= 8; + channel->flags = 0; + } else { + channel->flags = channel->number >> 4; + channel->number = channel->number & 0x0F; + + // 0x20 is set on rhythm channels to prevent remapping + // CHECKME: Which SCI versions need that set manually? + channel->flags = (*channel->data) >> 4; + if (channel->number == 9) + channel->flags |= 2; + // Note: flag 1: channel start offset is 0 instead of 10 + // (currently: everything 0) + // also: don't map the channel to device + // flag 2: don't remap + // flag 4: start muted + // QfG2 lacks flags 2 and 4, and uses (flags >= 1) as + // the condition for starting offset 0, without the "don't map" } + _tracks[trackNr].channelCount++; + channelNr++; data += 6; } } else { diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 186fc18a5c..6f250e0a3a 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -58,6 +58,10 @@ MidiParser_SCI::MidiParser_SCI(SciVersion soundVersion, SciMusic *music) : _resetOnPause = false; _pSnd = 0; + + _mainThreadCalled = false; + + resetStateTracking(); } MidiParser_SCI::~MidiParser_SCI() { @@ -68,10 +72,12 @@ MidiParser_SCI::~MidiParser_SCI() { } void MidiParser_SCI::mainThreadBegin() { + assert(!_mainThreadCalled); _mainThreadCalled = true; } void MidiParser_SCI::mainThreadEnd() { + assert(_mainThreadCalled); _mainThreadCalled = false; } @@ -83,12 +89,21 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in for (int i = 0; i < 16; i++) { _channelUsed[i] = false; - _channelRemap[i] = -1; _channelMuted[i] = false; _channelVolume[i] = 127; + + if (_soundVersion <= SCI_VERSION_0_LATE) + _channelRemap[i] = i; + else + _channelRemap[i] = -1; } - _channelRemap[9] = 9; // never map channel 9, because that's used for percussion - _channelRemap[15] = 15; // never map channel 15, because thats used by sierra internally + + // FIXME: SSCI does not always start playing a track at the first byte. + // By default it skips 10 (or 13?) bytes containing prio/voices, patch, + // volume, pan commands in fixed locations, and possibly a signal + // in channel 15. We should initialize state tracking to those values + // so that they automatically get set up properly when the channels get + // mapped. See also the related FIXME in MidiParser_SCI::processEvent. if (channelFilterMask) { // SCI0 only has 1 data stream, but we need to filter out channels depending on music hardware selection @@ -314,31 +329,26 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) { return _mixedData; } -// This will get called right before actual playing and will try to own the used channels -void MidiParser_SCI::tryToOwnChannels() { - // We don't have SciMusic in case debug command show_instruments is used - if (!_music) - return; - for (int curChannel = 0; curChannel < 15; curChannel++) { - if (_channelUsed[curChannel]) { - if (_channelRemap[curChannel] == -1) { - _channelRemap[curChannel] = _music->tryToOwnChannel(_pSnd, curChannel); - } - } - } -} +void MidiParser_SCI::resetStateTracking() { + for (int i = 0; i < 16; ++i) { + ChannelState &s = _channelState[i]; + s._modWheel = 0; + s._pan = 64; + s._patch = 0; // TODO: Initialize properly (from data in LoadMusic?) + s._note = -1; + s._sustain = false; + s._pitchWheel = 0x2000; + s._voices = 0; -void MidiParser_SCI::lostChannels() { - for (int curChannel = 0; curChannel < 15; curChannel++) - if ((_channelUsed[curChannel]) && (curChannel != 9)) - _channelRemap[curChannel] = -1; + _channelVolume[i] = 127; + } } void MidiParser_SCI::sendInitCommands() { - // reset our "global" volume and channel volumes + resetStateTracking(); + + // reset our "global" volume _volume = 127; - for (int i = 0; i < 16; i++) - _channelVolume[i] = 127; // Set initial voice count if (_pSnd) { @@ -390,53 +400,119 @@ void MidiParser_SCI::sendFromScriptToDriver(uint32 midi) { // this happens for cmdSendMidi at least in sq1vga right at the start, it's a script issue return; } - if (_channelRemap[midiChannel] == -1) { - // trying to send to an unmapped channel - // this happens for cmdSendMidi at least in sq1vga right at the start, scripts are pausing the sound - // and then sending manually. it's a script issue - return; - } sendToDriver(midi); } void MidiParser_SCI::sendToDriver(uint32 midi) { - byte midiChannel = midi & 0xf; - - if ((midi & 0xFFF0) == 0x4EB0) { - // this is channel mute only for sci1 - // it's velocity control for sci0 - if (_soundVersion >= SCI_VERSION_1_EARLY) { - _channelMuted[midiChannel] = midi & 0xFF0000 ? true : false; - return; // don't send this to driver at all - } - } + // State tracking + trackState(midi); - // Is channel muted? if so, don't send command - if (_channelMuted[midiChannel]) + if ((midi & 0xFFF0) == 0x4EB0 && _soundVersion >= SCI_VERSION_1_EARLY) { + // Mute. Handled in trackState(). + // CHECKME: Should we send this on to the driver? return; + } if ((midi & 0xFFF0) == 0x07B0) { // someone trying to set channel volume? int channelVolume = (midi >> 16) & 0xFF; - // Remember, if we need to set it ourselves - _channelVolume[midiChannel] = channelVolume; // Adjust volume accordingly to current local volume channelVolume = channelVolume * _volume / 127; - midi = (midi & 0xFFF0) | ((channelVolume & 0xFF) << 16); + midi = (midi & 0xFFFF) | ((channelVolume & 0xFF) << 16); } + // Channel remapping + byte midiChannel = midi & 0xf; int16 realChannel = _channelRemap[midiChannel]; if (realChannel == -1) return; midi = (midi & 0xFFFFFFF0) | realChannel; + sendToDriver_raw(midi); +} + +void MidiParser_SCI::sendToDriver_raw(uint32 midi) { if (_mainThreadCalled) _music->putMidiCommandInQueue(midi); else _driver->send(midi); } +void MidiParser_SCI::trackState(uint32 b) { + // We keep track of most of the state of a midi channel, so we can + // at any time reset the device to the current state, even if the + // channel has been temporarily disabled due to remapping. + + byte command = b & 0xf0; + byte channel = b & 0xf; + byte op1 = (b >> 8) & 0x7f; + byte op2 = (b >> 16) & 0x7f; + + ChannelState &s = _channelState[channel]; + + switch (command) { + case 0x90: + if (op2 != 0) { + // note on + s._note = op1; + break; + } + // else, fall-through + case 0x80: + // note off + if (s._note == op1) + s._note = -1; + break; + case 0xB0: + // control change + switch (op1) { + case 0x01: // mod wheel + s._modWheel = op2; + break; + case 0x07: // channel volume + _channelVolume[channel] = op2; + break; + case 0x0A: // pan + s._pan = op2; + break; + case 0x40: // sustain + s._sustain = (op2 != 0); + break; + case 0x4B: // voices + s._voices = op2; + _pSnd->_chan[channel]._voices = op2; // Also sync our MusicEntry + break; + case 0x4E: // mute + // This is channel mute only for sci1. + // (It's velocity control for sci0, but we don't need state in sci0) + if (_soundVersion >= SCI_VERSION_1_EARLY) { + // FIXME: mute is a level, not a bool, in some SCI versions + bool m = op2; + if (_pSnd->_chan[channel]._mute != m) { + _pSnd->_chan[channel]._mute = m; + // TODO: If muting/unmuting a channel, remap channels. + warning("Mute change without immediate remapping (mainThread = %d)", _mainThreadCalled); + } + } + break; + default: + break; + } + break; + case 0xC0: + // program change + s._patch = op1; + break; + case 0xE0: + // pitchwheel + s._pitchWheel = (op2 << 7) | op1; + break; + default: + break; + } +} + void MidiParser_SCI::parseNextEvent(EventInfo &info) { info.start = _position._playPos; info.delta = 0; @@ -477,8 +553,10 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { case 0xE: info.basic.param1 = *(_position._playPos++); info.basic.param2 = *(_position._playPos++); - if (info.command() == 0x9 && info.basic.param2 == 0) + if (info.command() == 0x9 && info.basic.param2 == 0) { + // NoteOn with param2==0 is a NoteOff info.event = info.channel() | 0x80; + } info.length = 0; break; @@ -809,4 +887,44 @@ void MidiParser_SCI::setVolume(byte volume) { } } +void MidiParser_SCI::remapChannel(int channel, int devChannel) { + if (_channelRemap[channel] == devChannel) + return; + + _channelRemap[channel] = devChannel; + + if (devChannel == -1) + return; + +// debug(" restoring state: channel %d on devChannel %d", channel, devChannel); + + // restore state + ChannelState &s = _channelState[channel]; + + int channelVolume = _channelVolume[channel]; + channelVolume = (channelVolume * _volume / 127) & 0xFF; + byte pitch1 = s._pitchWheel & 0x7F; + byte pitch2 = (s._pitchWheel >> 7) & 0x7F; + + sendToDriver_raw(0x0040B0 | devChannel); // sustain off + sendToDriver_raw(0x004BB0 | devChannel | (s._voices << 16)); + sendToDriver_raw(0x0000C0 | devChannel | (s._patch << 8)); + sendToDriver_raw(0x0007B0 | devChannel | (channelVolume << 16)); + sendToDriver_raw(0x000AB0 | devChannel | (s._pan << 16)); + sendToDriver_raw(0x0001B0 | devChannel | (s._modWheel << 16)); + sendToDriver_raw(0x0040B0 | devChannel | (s._sustain ? 0x7F0000 : 0)); + sendToDriver_raw(0x0000E0 | devChannel | (pitch1 << 8) | (pitch2 << 16)); + + // CHECKME: Some SSCI version send a control change 0x4E with s._note as + // parameter. + // We need to investigate how (and if) drivers should act on this. + // Related: controller 0x4E is used for 'mute' in the midiparser. + // This could be a bug in SSCI that went unnoticed because few (or no?) + // drivers implement controller 0x4E + + // NB: The line below is _not_ valid since s._note can be 0xFF. + // SSCI handles this out of band in the driver interface. + // sendToDriver_raw(0x004EB0 | devChannel | (s._note << 16); +} + } // End of namespace Sci diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h index 5784dca1ab..7e24c34144 100644 --- a/engines/sci/sound/midiparser_sci.h +++ b/engines/sci/sound/midiparser_sci.h @@ -79,20 +79,23 @@ public: const byte *getMixedData() const { return _mixedData; } byte getSongReverb(); - void tryToOwnChannels(); - void lostChannels(); void sendFromScriptToDriver(uint32 midi); void sendToDriver(uint32 midi); void sendToDriver(byte status, byte firstOp, byte secondOp) { sendToDriver(status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16)); } + void remapChannel(int channel, int devChannel); + protected: void parseNextEvent(EventInfo &info); void processEvent(const EventInfo &info, bool fireEvents = true); byte *midiMixChannels(); byte *midiFilterChannels(int channelMask); byte midiGetNextChannel(long ticker); + void resetStateTracking(); + void trackState(uint32 midi); + void sendToDriver_raw(uint32 midi); SciMusic *_music; @@ -113,6 +116,19 @@ protected: int16 _channelRemap[16]; bool _channelMuted[16]; byte _channelVolume[16]; + + struct ChannelState { + int8 _modWheel; + int8 _pan; + int8 _patch; + int8 _note; + bool _sustain; + int16 _pitchWheel; + int8 _voices; + }; + + ChannelState _channelState[16]; + }; } // End of namespace Sci diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 8c6d0d6431..f46c1dfbb0 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -33,7 +33,7 @@ #include "sci/sound/midiparser_sci.h" #include "sci/sound/music.h" -//#define DISABLE_REMAPPING +//#define DEBUG_REMAP namespace Sci { @@ -47,6 +47,8 @@ SciMusic::SciMusic(SciVersion soundVersion, bool useDigitalSFX) for (int i = 0; i < 16; i++) { _usedChannel[i] = 0; _channelRemap[i] = -1; + _channelMap[i]._song = 0; + _channelMap[i]._channel = -1; } _queuedCommands.reserve(1000); @@ -291,6 +293,15 @@ void SciMusic::sortPlayList() { } void SciMusic::soundInitSnd(MusicEntry *pSnd) { + // Remove all currently mapped channels of this MusicEntry first, + // since they will no longer be valid. + for (int i = 0; i < 16; ++i) { + if (_channelMap[i]._song == pSnd) { + _channelMap[i]._song = 0; + _channelMap[i]._channel = -1; + } + } + int channelFilterMask = 0; SoundResource::Track *track = pSnd->soundRes->getTrackByType(_pMidiDrv->getPlayId()); @@ -337,6 +348,27 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { // Find out what channels to filter for SCI0 channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayId(), _pMidiDrv->hasRhythmChannel()); + for (int i = 0; i < 16; ++i) + pSnd->_usedChannels[i] = 0xFF; + for (int i = 0; i < track->channelCount; ++i) { + SoundResource::Channel &chan = track->channels[i]; + + pSnd->_usedChannels[i] = chan.number; + pSnd->_chan[chan.number]._dontRemap = (chan.flags & 2); + pSnd->_chan[chan.number]._prio = chan.prio; + pSnd->_chan[chan.number]._voices = chan.poly; + + // CHECKME: Some SCI versions use chan.flags & 1 for this: + pSnd->_chan[chan.number]._dontMap = false; + + // FIXME: Most MIDI tracks use the first 10 bytes for + // fixed MIDI commands. SSCI skips those the first iteration, + // but _does_ update channel state (including volume) with + // them. Specifically, prio/voices, patch, volume, pan. + // This should probably be implemented in + // MidiParser_SCI::loadMusic. + } + pSnd->pMidiParser->mainThreadBegin(); // loadMusic() below calls jumpToTick. // Disable sound looping and hold before jumpToTick is called, @@ -358,64 +390,6 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { } } -// This one checks, if requested channel is available -> in that case give -// caller that channel. Otherwise look for an unused one -int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) { -#ifdef DISABLE_REMAPPING - return bestChannel; -#endif - - // Don't even try this for SCI0 - if (_soundVersion <= SCI_VERSION_0_LATE) - return bestChannel; - if (!_usedChannel[bestChannel]) { - // currently unused, so give it to caller directly - _usedChannel[bestChannel] = caller; - _channelRemap[bestChannel] = bestChannel; - return bestChannel; - } - // otherwise look for unused channel - for (int channelNr = _driverFirstChannel; channelNr < 15; channelNr++) { - if (channelNr == 9) // never map to channel 9 (percussion) - continue; - if (!_usedChannel[channelNr]) { - _usedChannel[channelNr] = caller; - _channelRemap[bestChannel] = channelNr; - return channelNr; - } - } - // nothing found, don't map channel at all - // sierra did this as well, although i'm not sure if we act exactly the same way - // maybe they removed channels from previous playing music - return -1; -} - -void SciMusic::freeChannels(MusicEntry *caller) { - // Remove used channels - for (int i = 0; i < 15; i++) { - if (_usedChannel[i] == caller) { - if (_channelRemap[i] != -1) { - // athrxx: The original handles this differently. It seems to be checking for (and effecting) necessary - // remaps / resets etc. more or less all the time. There are several more tables to keep track of everything. - // I don't know whether all of that is needed and to which SCI versions it applies, though. - // At least it is necessary to release the allocated channels inside the driver. Otherwise these channels - // won't be available any more (e.g. after half of the KQ5 FM-Towns intro there will be no more music - // since the driver can't pick up any more channels). The channels also have to be reset to - // default values, since the original does the same (although in a different manny) and the music will be wrong - // otherwise (at least KQ5 FM-Towns). - - sendMidiCommand(0x4000e0 | _channelRemap[i]); // Reset pitch wheel - sendMidiCommand(0x0040b0 | _channelRemap[i]); // Release pedal - sendMidiCommand(0x004bb0 | _channelRemap[i]); // Release assigned driver channels - } - _usedChannel[i] = 0; - _channelRemap[i] = -1; - } - } - // Also tell midiparser, that he lost ownership - caller->pMidiParser->lostChannels(); -} - void SciMusic::soundPlay(MusicEntry *pSnd) { _mutex.lock(); @@ -481,28 +455,6 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { Common::StackLock lock(_mutex); pSnd->pMidiParser->mainThreadBegin(); - if (pSnd->status != kSoundPaused) { - // Stop any in progress music fading, as that will reset the - // volume of the sound channels that the faded song occupies.. - // Fixes bug #3266480 and partially fixes bug #3041738. - // CHECKME: Is this the right thing to do? Are these - // overlapping channels not a deeper underlying problem? - for (uint i = 0; i < playListCount; i++) { - // Is another MIDI song being faded down? If yes, stop it - // immediately instead - if (_playList[i]->fadeStep < 0 && _playList[i]->pMidiParser) { - _playList[i]->status = kSoundStopped; - if (_soundVersion <= SCI_VERSION_0_LATE) - _playList[i]->isQueued = false; - _playList[i]->pMidiParser->stop(); - freeChannels(_playList[i]); - _playList[i]->fadeStep = 0; - _playList[i]->fadeCompleted = true; - } - } - } - - pSnd->pMidiParser->tryToOwnChannels(); if (pSnd->status != kSoundPaused) pSnd->pMidiParser->sendInitCommands(); pSnd->pMidiParser->setVolume(pSnd->volume); @@ -532,6 +484,10 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { } pSnd->status = kSoundPlaying; + + _mutex.lock(); + remapChannels(); + _mutex.unlock(); } void SciMusic::soundStop(MusicEntry *pSnd) { @@ -549,8 +505,8 @@ void SciMusic::soundStop(MusicEntry *pSnd) { // allNotesOff() again if (previousStatus == kSoundPlaying) pSnd->pMidiParser->stop(); - freeChannels(pSnd); pSnd->pMidiParser->mainThreadEnd(); + remapChannels(); } pSnd->fadeStep = 0; // end fading, if fading was in progress @@ -586,8 +542,10 @@ void SciMusic::soundSetPriority(MusicEntry *pSnd, byte prio) { void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->status = kSoundStopped; + _mutex.lock(); + remapChannels(); + if (pSnd->pMidiParser) { - Common::StackLock lock(_mutex); pSnd->pMidiParser->mainThreadBegin(); pSnd->pMidiParser->unloadMusic(); pSnd->pMidiParser->mainThreadEnd(); @@ -595,6 +553,8 @@ void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->pMidiParser = NULL; } + _mutex.unlock(); + if (pSnd->pStreamAud) { _pMixer->stopHandle(pSnd->hCurrentAud); delete pSnd->pStreamAud; @@ -603,7 +563,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->pLoopStream = 0; } - Common::StackLock lock(_mutex); + _mutex.lock(); uint sz = _playList.size(), i; // Remove sound from playlist for (i = 0; i < sz; i++) { @@ -614,6 +574,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) { break; } } + _mutex.unlock(); } void SciMusic::soundPause(MusicEntry *pSnd) { @@ -639,8 +600,8 @@ void SciMusic::soundPause(MusicEntry *pSnd) { Common::StackLock lock(_mutex); pSnd->pMidiParser->mainThreadBegin(); pSnd->pMidiParser->pause(); - freeChannels(pSnd); pSnd->pMidiParser->mainThreadEnd(); + remapChannels(); } } } @@ -789,6 +750,14 @@ MusicEntry::MusicEntry() { pStreamAud = 0; pLoopStream = 0; pMidiParser = 0; + + for (int i = 0; i < 16; ++i) { + _usedChannels[i] = 0xFF; + _chan[i]._prio = 127; + _chan[i]._voices = 0; + _chan[i]._dontRemap = false; + _chan[i]._mute = false; + } } MusicEntry::~MusicEntry() { @@ -857,4 +826,447 @@ void MusicEntry::setSignal(int newSignal) { } } + +void ChannelRemapping::swap(int i, int j) { + DeviceChannelUsage t1; + int t2; + bool t3; + + t1 = _map[i]; _map[i] = _map[j]; _map[j] = t1; + t2 = _prio[i]; _prio[i] = _prio[j]; _prio[j] = t2; + t2 = _voices[i]; _voices[i] = _voices[j]; _voices[j] = t2; + t3 = _dontRemap[i]; _dontRemap[i] = _dontRemap[j]; _dontRemap[j] = t3; +} + +void ChannelRemapping::evict(int i) { + _freeVoices += _voices[i]; + + _map[i]._song = 0; + _map[i]._channel = -1; + _prio[i] = 0; + _voices[i] = 0; + _dontRemap[i] = false; +} + +void ChannelRemapping::clear() { + for (int i = 0; i < 16; ++i) { + _map[i]._song = 0; + _map[i]._channel = -1; + _prio[i] = 0; + _voices[i] = 0; + _dontRemap[i] = false; + } +} + +ChannelRemapping& ChannelRemapping::operator=(ChannelRemapping& other) { + for (int i = 0; i < 16; ++i) { + _map[i] = other._map[i]; + _prio[i] = other._prio[i]; + _voices[i] = other._voices[i]; + _dontRemap[i] = other._dontRemap[i]; + } + _freeVoices = other._freeVoices; + + return *this; +} + +int ChannelRemapping::lowestPrio() const { + int max = 0; + int channel = -1; + for (int i = 0; i < 16; ++i) { + if (_prio[i] > max) { + max = _prio[i]; + channel = i; + } + } + return channel; +} + + +void SciMusic::remapChannels() { + if (_soundVersion <= SCI_VERSION_0_LATE) + return; + + // NB: This function should only be called from the main thread, + // with _mutex locked + + + ChannelRemapping *map = determineChannelMap(); + + DeviceChannelUsage currentMap[16]; + +#ifdef DEBUG_REMAP + debug("Remap results:"); +#endif + + // Save current map, and then start from an empty map + for (int i = 0; i < 16; ++i) { + currentMap[i] = _channelMap[i]; + _channelMap[i]._song = 0; + _channelMap[i]._channel = -1; + } + + // Inform MidiParsers of any unmapped channels + const MusicList::iterator end = _playList.end(); + int songIndex = -1; + for (MusicList::iterator i = _playList.begin(); i != end; ++i) { + MusicEntry *song = *i; + songIndex++; + + if (!song || !song->pMidiParser) + continue; + + bool channelMapped[16]; +#ifdef DEBUG_REMAP + bool channelUsed[16]; +#endif + for (int j = 0; j < 16; ++j) { + channelMapped[j] = false; +#ifdef DEBUG_REMAP + channelUsed[j] = false; +#endif + } + + for (int j = 0; j < 16; ++j) { + if (map->_map[j]._song == song) { + int channel = map->_map[j]._channel; + assert(channel >= 0 && channel <= 0x0F); + channelMapped[channel] = true; + } +#ifdef DEBUG_REMAP + if (song->_usedChannels[j] <= 0x0F) + channelUsed[song->_usedChannels[j]] = true; +#endif + } + + for (int j = 0; j < 16; ++j) { + if (!channelMapped[j]) { + song->pMidiParser->mainThreadBegin(); + song->pMidiParser->remapChannel(j, -1); + song->pMidiParser->mainThreadEnd(); +#ifdef DEBUG_REMAP + if (channelUsed[j]) + debug(" Unmapping song %d, channel %d", songIndex, j); +#endif + } + } + } + + // Now reshuffle the channels on the device. + + // First, set up any dontRemap channels + for (int i = 0; i < 16; ++i) { + + if (!map->_map[i]._song || !map->_map[i]._song->pMidiParser || !map->_dontRemap[i]) + continue; + + songIndex = -1; + for (MusicList::iterator iter = _playList.begin(); iter != end; ++iter) { + songIndex++; + if (map->_map[i]._song == *iter) + break; + } + + _channelMap[i] = map->_map[i]; + map->_map[i]._song = 0; // mark as done + + // If this channel was not yet mapped to the device, reset it + if (currentMap[i] != _channelMap[i]) { +#ifdef DEBUG_REMAP + debug(" Mapping (dontRemap) song %d, channel %d to device channel %d", songIndex, _channelMap[i]._channel, i); +#endif + _channelMap[i]._song->pMidiParser->mainThreadBegin(); + _channelMap[i]._song->pMidiParser->remapChannel(_channelMap[i]._channel, i); + _channelMap[i]._song->pMidiParser->mainThreadEnd(); + } + + } + + // Next, we look for channels which were already playing. + // We keep those on the same device channel as before. + for (int i = 0; i < 16; ++i) { + + if (!map->_map[i]._song) + continue; + + songIndex = -1; + for (MusicList::iterator iter = _playList.begin(); iter != end; ++iter) { + songIndex++; + if (map->_map[i]._song == *iter) + break; + } + + + for (int j = 0; j < 16; ++j) { + if (map->_map[i] == currentMap[j]) { + // found it + _channelMap[j] = map->_map[i]; + map->_map[i]._song = 0; // mark as done +#ifdef DEBUG_REMAP + debug(" Keeping song %d, channel %d on device channel %d", songIndex, _channelMap[j]._channel, j); +#endif + break; + } + } + } + + // Then, remap the rest. + for (int i = 0; i < 16; ++i) { + + if (!map->_map[i]._song || !map->_map[i]._song->pMidiParser) + continue; + + songIndex = -1; + for (MusicList::iterator iter = _playList.begin(); iter != end; ++iter) { + songIndex++; + if (map->_map[i]._song == *iter) + break; + } + + for (int j = _driverLastChannel; j >= _driverFirstChannel; --j) { + if (_channelMap[j]._song == 0) { + _channelMap[j] = map->_map[i]; + map->_map[i]._song = 0; +#ifdef DEBUG_REMAP + debug(" Mapping song %d, channel %d to device channel %d", songIndex, _channelMap[j]._channel, j); +#endif + _channelMap[j]._song->pMidiParser->mainThreadBegin(); + _channelMap[j]._song->pMidiParser->remapChannel(_channelMap[j]._channel, j); + _channelMap[j]._song->pMidiParser->mainThreadEnd(); + break; + } + } + + } + + // And finally, stop any empty channels + for (int i = _driverFirstChannel; i <= _driverLastChannel; ++i) { + if (!_channelMap[i]._song) + resetDeviceChannel(i); + } + + delete map; +} + + +ChannelRemapping *SciMusic::determineChannelMap() { +#ifdef DEBUG_REMAP + debug("Remap: avail chans: %d-%d", _driverFirstChannel, _driverLastChannel); +#endif + + ChannelRemapping *map = new ChannelRemapping; + ChannelRemapping backupMap; + map->clear(); + map->_freeVoices = _pMidiDrv->getPolyphony(); + + if (_playList.empty()) + return map; + + // TODO: set reverb, either from first song, or from global??? + + MusicList::iterator songIter; + int songIndex = -1; + for (songIter = _playList.begin(); songIter != _playList.end(); ++songIter) { + songIndex++; + MusicEntry *song = *songIter; + if (song->status != kSoundPlaying) + continue; + + // If song is digital, skip. + // CHECKME: Is this condition correct? + if (!song->pMidiParser) { +#ifdef DEBUG_REMAP + debug(" Song %d (%p), digital?", songIndex, (void*)song); +#endif + continue; + } + + +#ifdef DEBUG_REMAP + debug(" Song %d (%p), prio %d", songIndex, (void*)song, song->priority); +#endif + + // Store backup. If we fail to map this song, we will revert to this. + backupMap = *map; + + bool songMapped = true; + + for (int i = 0; i < 16; ++i) { + int c = song->_usedChannels[i]; + if (c == 0xFF || c == 0xFE || c == 0x0F) + continue; + const MusicEntryChannel &channel = song->_chan[c]; + if (channel._dontMap) + continue; + if (channel._mute) + continue; + +#ifdef DEBUG_REMAP + debug(" Channel %d: prio %d, %d voice%s%s", c, channel._prio, channel._voices, channel._voices == 1 ? "" : "s", channel._dontRemap ? ", dontRemap" : "" ); +#endif + + DeviceChannelUsage dc = { song, c }; + + // our target + int devChannel = -1; + + if (channel._dontRemap && map->_map[c]._song == 0) { + // unremappable channel, with channel still free + devChannel = c; + } + + // try to find a free channel + if (devChannel == -1) { + for (int j = 0; j < 16; ++j) { + if (map->_map[j] == dc) { + // already mapped?! (Can this happen?) + devChannel = j; + break; + } + if (map->_map[j]._song) + continue; + + if (j >= _driverFirstChannel && j <= _driverLastChannel) + devChannel = j; + } + } + + int prio = channel._prio; + if (prio > 0) { + // prio > 0 means non-essential + prio = (16 - prio) + 16*songIndex; + } + + if (devChannel == -1 && prio > 0) { + // no empty channel, but this isn't an essential channel, + // so we just skip it. +#ifdef DEBUG_REMAP + debug(" skipping non-essential"); +#endif + continue; + } + + // try to empty a previous channel if this is an essential channel + if (devChannel == -1) { + devChannel = map->lowestPrio(); + if (devChannel != -1) + map->evict(devChannel); + } + + if (devChannel == -1) { + // failed to map this song. +#ifdef DEBUG_REMAP + debug(" no free (or lower priority) channel found"); +#endif + songMapped = false; + break; + } + + if (map->_map[devChannel] == dc) { + // already mapped?! (Can this happen?) + continue; + } + + int neededVoices = channel._voices; + // do we have enough free voices? + // We only care for essential channels + if (map->_freeVoices < neededVoices && prio > 0) { + do { + int j = map->lowestPrio(); + if (j == -1) { +#ifdef DEBUG_REMAP + debug(" not enough voices; need %d, have %d", neededVoices, map->_freeVoices); +#endif + // failed to free enough voices. + songMapped = false; + break; + } +#ifdef DEBUG_REMAP + debug(" creating room for voices; evict %d", j); +#endif + map->evict(j); + } while (map->_freeVoices < neededVoices); + + if (!songMapped) { + // failed to map this song. + break; + } + } + + // We have a channel and enough free voices now. +#ifdef DEBUG_REMAP + debug(" trying to map to %d", devChannel); +#endif + + map->_map[devChannel] = dc; + map->_voices[devChannel] = neededVoices; + map->_prio[devChannel] = prio; + map->_dontRemap[devChannel] = channel._dontRemap; + map->_freeVoices -= neededVoices; + + if (!channel._dontRemap || devChannel == c) { + // If this channel fits here, we're done. +#ifdef DEBUG_REMAP + debug(" OK"); +#endif + continue; + } + + // If this channel can't be remapped, we need to move it or fail. + + if (!map->_dontRemap[c]) { + // Target channel can be remapped, so just swap + map->swap(devChannel, c); + continue; + } +#ifdef DEBUG_REMAP + debug(" but %d is already dontRemap", c); +#endif + + if (prio > 0) { + // Channel collision, but this channel is non-essential, + // so drop it. + // TODO: Maybe we should have checked this before making room? + map->evict(devChannel); + continue; + } + + if (map->_prio[c] > 0) { + // Channel collision, but the other channel is non-essential, + // so we take its place. + map->evict(c); + map->swap(devChannel, c); + continue; + } + + // Otherwise, we have two essential channels claiming the same + // device channel. + songMapped = false; + break; + } + + if (!songMapped) { + // We failed to map this song, so unmap all its channels. +#ifdef DEBUG_REMAP + debug(" Failed song"); +#endif + *map = backupMap; + } + } + + return map; +} + +void SciMusic::resetDeviceChannel(int devChannel) { + // NB: This function should only be called from the main thread + + assert(devChannel >= 0 && devChannel <= 0x0F); + + putMidiCommandInQueue(0x0040B0 | devChannel); // sustain off + putMidiCommandInQueue(0x007BB0 | devChannel); // notes off + putMidiCommandInQueue(0x004BB0 | devChannel); // release voices +} + + + } // End of namespace Sci diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 40236c8445..23a072cb26 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -52,6 +52,17 @@ class SegManager; typedef Common::Array<uint16> SignalQueue; + +struct MusicEntryChannel { + // Channel info + int8 _prio; // 0 = essential; lower is higher priority + int8 _voices; + bool _dontRemap; + bool _dontMap; + bool _mute; +}; + + class MusicEntry : public Common::Serializable { public: // Do not get these directly for the sound objects! @@ -90,6 +101,8 @@ public: Audio::Mixer::SoundType soundType; + int _usedChannels[16]; + MusicEntryChannel _chan[16]; MidiParser_SCI *pMidiParser; // this is used for storing signals, when the current signal is not yet @@ -114,6 +127,27 @@ public: virtual void saveLoadWithSerializer(Common::Serializer &ser); }; +struct DeviceChannelUsage { + MusicEntry *_song; + int _channel; + bool operator==(const DeviceChannelUsage& other) const { return _song == other._song && _channel == other._channel; } + bool operator!=(const DeviceChannelUsage& other) const { return !(*this == other); } +}; + +struct ChannelRemapping { + DeviceChannelUsage _map[16]; + int _prio[16]; + int _voices[16]; + bool _dontRemap[16]; + int _freeVoices; + + void clear(); + void swap(int i, int j); + void evict(int i); + ChannelRemapping& operator=(ChannelRemapping& other); + int lowestPrio() const; +}; + typedef Common::Array<MusicEntry *> MusicList; typedef Common::Array<uint32> MidiCommandQueue; @@ -198,9 +232,6 @@ public: // where a deadlock can occur Common::Mutex _mutex; - int16 tryToOwnChannel(MusicEntry *caller, int16 bestChannel); - void freeChannels(MusicEntry *caller); - protected: void sortPlayList(); @@ -213,6 +244,11 @@ protected: // If true and a sound has a digital track, the sound from the AdLib track is played bool _useDigitalSFX; + // remapping: + void remapChannels(); + ChannelRemapping *determineChannelMap(); + void resetDeviceChannel(int devChannel); + private: MusicList _playList; bool _soundOn; @@ -221,6 +257,8 @@ private: int8 _channelRemap[16]; int8 _globalReverb; + DeviceChannelUsage _channelMap[16]; + MidiCommandQueue _queuedCommands; MusicType _musicType; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7f27c43a22..16fe45044b 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2964,8 +2964,9 @@ void SceneObjectList::draw() { g_globals->_sceneManager._sceneBgOffset.y); } - // Set up the flag mask - uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1; + // Set up the flag mask. Currently, paneNum is always set to 0, so the check is meaningless + // uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1; + uint32 flagMask = OBJFLAG_PANE_0; // Initial loop to set up object list and update object position, priority, and flags for (SynchronizedList<SceneObject *>::iterator i = g_globals->_sceneObjects->begin(); diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index 0f7f1e49bb..123f04f8e2 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -171,7 +171,20 @@ static const tSageGameDescription gameDescriptions[] = { GType_Ringworld2, GF_CD | GF_ALT_REGIONS }, - + // Return to Ringworld - Demo + { + { + "ringworld2", + "CD Demo", + AD_ENTRY1s("r2rw.rlb", "c8e1a82c67c3caf57368eadde13dc15f", 32384464), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_CD | ADGF_TESTING, + GUIO0() + }, + GType_Ringworld2, + GF_CD | GF_ALT_REGIONS | GF_DEMO + }, { AD_TABLE_END_MARKER, 0, 0 } }; diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 6baa654214..0ba60384bf 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -156,7 +156,7 @@ void EventsClass::setCursor(CursorType cursorType) { // No cursor g_globals->setFlag(122); - if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() != GType_Ringworld)) { + if ((g_vm->getGameID() != GType_Ringworld) || ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_DEMO))) { CursorMan.showMouse(false); return; } diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 50d4b4e008..9b1b0f1dcb 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -64,17 +64,39 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _stripNum = 0; _gfxEdgeAdjust = 3; - if (g_vm->getFeatures() & GF_DEMO) { - _gfxFontNumber = 0; - _gfxColors.background = 6; - _gfxColors.foreground = 0; - _fontColors.background = 255; - _fontColors.foreground = 6; - _dialogCenter.y = 80; - // Workaround in order to use later version of the engine - _color1 = _gfxColors.foreground; - _color2 = _gfxColors.foreground; - _color3 = _gfxColors.foreground; + if (g_vm->getGameID() == GType_Ringworld) { + if (g_vm->getFeatures() & GF_DEMO) { + _gfxFontNumber = 0; + _gfxColors.background = 6; + _gfxColors.foreground = 0; + _fontColors.background = 255; + _fontColors.foreground = 6; + _dialogCenter.y = 80; + // Workaround in order to use later version of the engine + _color1 = _gfxColors.foreground; + _color2 = _gfxColors.foreground; + _color3 = _gfxColors.foreground; + } else if (g_vm->getFeatures() & GF_CD) { + _gfxFontNumber = 50; + _gfxColors.background = 53; + _gfxColors.foreground = 0; + _fontColors.background = 51; + _fontColors.foreground = 54; + _color1 = 18; + _color2 = 18; + _color3 = 18; + } else { + // Floppy version + _gfxFontNumber = 50; + _gfxColors.background = 53; + _gfxColors.foreground = 18; + _fontColors.background = 51; + _fontColors.foreground = 54; + // Workaround in order to use later version of the engine + _color1 = _gfxColors.foreground; + _color2 = _gfxColors.foreground; + _color3 = _gfxColors.foreground; + } } else if (g_vm->getGameID() == GType_BlueForce) { // Blue Force _gfxFontNumber = 0; @@ -94,26 +116,6 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _color2 = 15; _color3 = 4; _dialogCenter.y = 100; - } else if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_CD)) { - _gfxFontNumber = 50; - _gfxColors.background = 53; - _gfxColors.foreground = 0; - _fontColors.background = 51; - _fontColors.foreground = 54; - _color1 = 18; - _color2 = 18; - _color3 = 18; - } else { - // Ringworld - _gfxFontNumber = 50; - _gfxColors.background = 53; - _gfxColors.foreground = 18; - _fontColors.background = 51; - _fontColors.foreground = 54; - // Workaround in order to use later version of the engine - _color1 = _gfxColors.foreground; - _color2 = _gfxColors.foreground; - _color3 = _gfxColors.foreground; } _screenSurface.setScreenSurface(); _gfxManagers.push_back(&_gfxManagerInstance); diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index fa3ed33302..97857aca34 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1390,7 +1390,10 @@ void GfxManager::copyFrom(GfxSurface &src, const Rect &srcBounds, const Rect &de GfxFont::GfxFont() { - _fontNumber = (g_vm->getFeatures() & GF_DEMO) ? 0 : 50; + if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_DEMO)) + _fontNumber = 0; + else + _fontNumber = 50; _numChars = 0; _bpp = 0; _fontData = NULL; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 25eafbb171..ef212bc52a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -65,8 +65,12 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Deck #2 - By Lift return new Scene200(); case 205: - // Star-field Credits - return new Scene205(); + if (g_vm->getFeatures() & GF_DEMO) + // End of Demo + return new Scene205Demo(); + else + // Star-field Credits + return new Scene205(); case 250: // Lift return new Scene250(); @@ -374,7 +378,16 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { int prevScene = R2_GLOBALS._sceneManager._previousScene; int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber; - if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) + if (g_vm->getFeatures() & GF_DEMO) { + if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) + || (prevScene == 0) || (sceneNumber == 600) + || ((prevScene == 205 || prevScene == 180) && (sceneNumber == 100))) { + R2_GLOBALS._uiElements._active = true; + R2_GLOBALS._uiElements.show(); + } else { + R2_GLOBALS._uiElements.updateInventory(); + } + } else if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) || (sceneNumber == 50) || ((sceneNumber == 100) && (prevScene == 0 || prevScene == 180 || prevScene == 205))) { R2_GLOBALS._uiElements._active = true; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 7fdc1dc8a7..e04f294b22 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2519,6 +2519,72 @@ void Scene205::handleText() { } /*-------------------------------------------------------------------------- + * Scene 205 Demo - End of Demo + * + *--------------------------------------------------------------------------*/ + +void Scene205Demo::Action1::signal() { + Scene205Demo *scene = (Scene205Demo *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(2); + break; + case 1: + MessageDialog::show2(BUY_FULL_GAME_MSG, OK_BTN_STRING); + setDelay(1); + break; + case 2: + scene->leaveScene(); + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene205Demo::leaveScene() { + if (g_globals->getFlag(85)) + R2_GLOBALS._sceneManager.changeScene(160); + else + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene); + + BF_GLOBALS._scenePalette.loadPalette(0); + BF_GLOBALS._scenePalette.refresh(); +} + +void Scene205Demo::postInit(SceneObjectList *OwnerList) { + R2_GLOBALS._sceneManager._hasPalette = true; + R2_GLOBALS._scenePalette.loadPalette(0); + + loadScene(1000); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._player.enableControl(); + + SceneExt::postInit(); + + _sound1.play(337); + _stripManager.addSpeaker(&_animationPlayer); + + setAction(&_action1); +} + +void Scene205Demo::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene205Demo::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + event.handled = true; + leaveScene(); + } else { + Scene::process(event); + } +} + +/*-------------------------------------------------------------------------- * Scene 250 - Lift * *--------------------------------------------------------------------------*/ @@ -3550,7 +3616,11 @@ void Scene300::signal() { R2_GLOBALS.setFlag(40); break; case 6: - R2_GLOBALS._sceneManager.changeScene(1000); + if (g_vm->getFeatures() & GF_DEMO) { + R2_GLOBALS.setFlag(85); + R2_GLOBALS._sceneManager.changeScene(205); + } else + R2_GLOBALS._sceneManager.changeScene(1000); break; default: break; @@ -3611,8 +3681,14 @@ void Scene300::signal() { case 16: if (_stripManager._exitMode == 1) { - R2_GLOBALS._player.setAction(NULL); - R2_GLOBALS._sceneManager.changeScene(1000); + if (g_vm->getFeatures() & GF_DEMO) { + R2_GLOBALS._player.setAction(NULL); + R2_GLOBALS.setFlag(85); + R2_GLOBALS._sceneManager.changeScene(205); + } else { + R2_GLOBALS._player.setAction(NULL); + R2_GLOBALS._sceneManager.changeScene(1000); + } } else { R2_GLOBALS._player.setAction(&_action1); R2_GLOBALS._player.enableControl(CURSOR_TALK); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 0e68b67ee7..216039a348 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -304,6 +304,24 @@ public: virtual void dispatch(); }; +class Scene205Demo: public SceneExt { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; +private: + void leaveScene(); +public: + VisualSpeaker _animationPlayer; + ASound _sound1; + Action1 _action1; +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void process(Event &event); +}; + class Scene250: public SceneExt { class Button: public SceneActor { public: diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 0025d0ba61..075420a1c9 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -11491,16 +11491,7 @@ void Scene1800::signal() { R2_GLOBALS._walkRegions.disableRegion(10); R2_GLOBALS._walkRegions.disableRegion(11); R2_GLOBALS.setFlag(63); - - // The following check is completely dumb. - // Either an original bug, or dead code. - if (R2_GLOBALS.getFlag(63)) { - R2_GLOBALS._player.enableControl(CURSOR_WALK); - } else { - _sceneMode = 10; - R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); - _stripManager.start(545, this); - } + R2_GLOBALS._player.enableControl(CURSOR_WALK); break; case 1802: R2_GLOBALS.clearFlag(14); diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 3c850cf8dc..fb08195180 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -253,6 +253,8 @@ char const *const USE_INTERCEPTOR = "Do you want to use your interceptor card?"; char const *const USE_DOUBLE_AGENT = "Do you want to use your double agent?"; char const *const NEED_INSTRUCTIONS = "Do you want instructions?"; char const *const WRONG_ANSWER_MSG = "Wrong respond value sent."; +char const *const BUY_FULL_GAME_MSG = "To order the complete game, RETURN TO RINGWORLD, call 1-800-482-3766!"; + const byte scene1550JunkLocationsDefault[] = { 20, 7, 41, 6, 3, 6, 42, 11, diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index c18f31fdfc..334a240f28 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -206,6 +206,7 @@ extern char const *const USE_DOUBLE_AGENT; extern char const *const NEED_INSTRUCTIONS; extern char const *const WRONG_ANSWER_MSG; +extern char const *const BUY_FULL_GAME_MSG; // Scene 1550 arrays of constants extern const byte scene1550JunkLocationsDefault[]; extern const byte scene1550AreaMap[]; diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 80e2116c54..36708e373e 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -39,10 +39,12 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) g_vm = this; DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging"); _debugger = nullptr; - if (g_vm->getFeatures() & GF_DEMO) - _debugger = new DemoDebugger(); - else if (g_vm->getGameID() == GType_Ringworld) - _debugger = new RingworldDebugger(); + if (g_vm->getGameID() == GType_Ringworld) { + if (g_vm->getFeatures() & GF_DEMO) + _debugger = new DemoDebugger(); + else + _debugger = new RingworldDebugger(); + } else if (g_vm->getGameID() == GType_BlueForce) _debugger = new BlueForceDebugger(); else if (g_vm->getGameID() == GType_Ringworld2) @@ -76,16 +78,16 @@ void TSageEngine::initialize() { // Set up the resource manager g_resourceManager = new ResourceManager(); - if (g_vm->getFeatures() & GF_DEMO) { - // Add the single library file associated with the demo - g_resourceManager->addLib(getPrimaryFilename()); - g_globals = new Globals(); - - } else if (g_vm->getGameID() == GType_Ringworld) { - g_resourceManager->addLib("RING.RLB"); - g_resourceManager->addLib("TSAGE.RLB"); - g_globals = new Globals(); - + if (g_vm->getGameID() == GType_Ringworld) { + if (g_vm->getFeatures() & GF_DEMO) { + // Add the single library file associated with the demo + g_resourceManager->addLib(getPrimaryFilename()); + g_globals = new Globals(); + } else { + g_resourceManager->addLib("RING.RLB"); + g_resourceManager->addLib("TSAGE.RLB"); + g_globals = new Globals(); + } } else if (g_vm->getGameID() == GType_BlueForce) { g_resourceManager->addLib("BLUE.RLB"); if (g_vm->getFeatures() & GF_FLOPPY) { diff --git a/gui/about.cpp b/gui/about.cpp index 3bb1934e28..459a6b5490 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -56,7 +56,7 @@ enum { static const char *copyright_text[] = { "", -"C0""Copyright (C) 2001-2013 The ScummVM project", +"C0""Copyright (C) 2001-2014 The ScummVM Team", "C0""http://www.scummvm.org", "", "C0""ScummVM is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this binary.", diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 35627dd584..9aa322e12e 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -133,6 +133,14 @@ Debugger *g_readline_debugger; char *readline_completionFunction(const char *text, int state) { return g_readline_debugger->readlineComplete(text, state); } + +#ifdef USE_READLINE_INT_COMPLETION +typedef int RLCompFunc_t(const char *, int); +#else +typedef char *RLCompFunc_t(const char *, int); +#endif + + } // end of anonymous namespace #endif @@ -162,7 +170,7 @@ void Debugger::enter() { // TODO: add support for saving/loading history? g_readline_debugger = this; - rl_completion_entry_function = &readline_completionFunction; + rl_completion_entry_function = (RLCompFunc_t *)&readline_completionFunction; char *line_read = 0; do { diff --git a/po/be_BY.po b/po/be_BY.po index 4c36c65f71..20b03b7725 100644 --- a/po/be_BY.po +++ b/po/be_BY.po @@ -1,5 +1,5 @@ # Belarusian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Ivan Lukyanov <greencis@mail.ru>, 2013. # diff --git a/po/ca_ES.po b/po/ca_ES.po index f201be5cba..b8238939a0 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -1,5 +1,5 @@ # Catalan translation for ScummVM. -# Copyright (C) 2007-2013 ScummVM Team +# Copyright (C) 2007-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Jordi Vilalta Prat <jvprat@jvprat.com>, 2007-2011. # diff --git a/po/cs_CZ.po b/po/cs_CZ.po index 4b330af830..67a21573b4 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -1,5 +1,5 @@ # Czech translation for ScummVM. -# Copyright (C) 2001-2013 ScummVM Team +# Copyright (C) 2001-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Zbynk Schwarz <zbynek.schwarz@gmail.com>, 2011-2013. # diff --git a/po/da_DA.po b/po/da_DA.po index bb7ed32c83..192ceeb50d 100644 --- a/po/da_DA.po +++ b/po/da_DA.po @@ -1,5 +1,5 @@ # Dansk translation for ScummVM -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Steffen Nyeland <steffen@nyeland.dk>, 2010. # diff --git a/po/de_DE.po b/po/de_DE.po index fac3c1f103..7275e136f2 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -1,5 +1,5 @@ # German translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Simon Sawatzki <SimSaw@gmx.de>, Lothar Serra Mari, 2013. # diff --git a/po/es_ES.po b/po/es_ES.po index 6bc001682d..a859019924 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -1,5 +1,5 @@ # Spanish translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Toms Maidagan, 2011. # @@ -1,5 +1,5 @@ # Basque translation for ScummVM. -# Copyright (C) 2012-2013 ScummVM Team +# Copyright (C) 2012-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Mikel Iturbe Urretxa <mikel@hamahiru.org>, 2012. # diff --git a/po/fi_FI.po b/po/fi_FI.po index 5471e5db58..73aac4cc9c 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -1,5 +1,5 @@ # Finnish translation for ScummVM. -# Copyright (c) 2012-2013 ScummVM Team +# Copyright (c) 2012-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Toni Saarela <saarela@gmail.com>, 2012. # diff --git a/po/fr_FR.po b/po/fr_FR.po index a853d190aa..c4978d4292 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -1,5 +1,5 @@ # French translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Thierry Crozat <criezy@scummvm.org>, 2011. # diff --git a/po/gl_ES.po b/po/gl_ES.po index cce9a5dfa7..3e0b92bef0 100644 --- a/po/gl_ES.po +++ b/po/gl_ES.po @@ -1,5 +1,5 @@ # Galician translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Santiago G. Sanz <s.sanz@uvigo.es>, 2013. # diff --git a/po/hu_HU.po b/po/hu_HU.po index 89bfa80d56..ae8f7a5aa9 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -1,5 +1,5 @@ # Hungarian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # George Kormendi <grubycza@hotmail.com>, 2010. # diff --git a/po/it_IT.po b/po/it_IT.po index cd449c269a..ddba2a0066 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -1,5 +1,5 @@ # Italian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Matteo 'Maff' Angelino <matteo.maff at gmail dot com>, 2010. # diff --git a/po/nb_NO.po b/po/nb_NO.po index f41e71f8ae..b438b53d78 100644 --- a/po/nb_NO.po +++ b/po/nb_NO.po @@ -1,5 +1,5 @@ # Norwegian (Bokmaal) translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Einar Johan T. Smen <einarjohants@gmail.com>, 2010. # diff --git a/po/nn_NO.po b/po/nn_NO.po index 2c09192d5c..443fae2970 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -1,5 +1,5 @@ # Norwegian (Nynorsk) translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Einar Johan T. Smen <einarjohants@gmail.com>, 2010. # diff --git a/po/pl_PL.po b/po/pl_PL.po index 38cedb55d7..826846dfcb 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -1,5 +1,5 @@ # Polish translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Grajpopolsku.pl <grajpopolsku@gmail.com>, 2011-2013. # diff --git a/po/pt_BR.po b/po/pt_BR.po index a3a5c3935c..595f36d56c 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -1,5 +1,5 @@ # Portuguese (Brazilian) translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Saulo Benigno <saulobenigno@gmail.com>, 2010. # diff --git a/po/ru_RU.po b/po/ru_RU.po index 8e52f3f342..dc0fc6cc80 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -1,5 +1,5 @@ # Russian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Eugene Sandulenko <sev@scummvm.org>, 2010` # diff --git a/po/se_SE.po b/po/se_SE.po index 0031e2dc06..eaff1de836 100644 --- a/po/se_SE.po +++ b/po/se_SE.po @@ -1,5 +1,5 @@ # Swedish translation for ScummVM. -# Copyright (C) 2011-2013 ScummVM Team +# Copyright (C) 2011-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Hampus Flink <hampus.flink@gmail.com>, 2011. # diff --git a/po/uk_UA.po b/po/uk_UA.po index 2a42ff47d9..5c27fcd479 100644 --- a/po/uk_UA.po +++ b/po/uk_UA.po @@ -1,5 +1,5 @@ # Ukrainian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Lubomyr Lisen, 2010. # diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 36fe83fa19..7f5a557474 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -59,6 +59,8 @@ namespace Video { #define ID_MIDS MKTAG('m','i','d','s') #define ID_TXTS MKTAG('t','x','t','s') #define ID_JUNK MKTAG('J','U','N','K') +#define ID_JUNQ MKTAG('J','U','N','Q') +#define ID_DMLH MKTAG('d','m','l','h') #define ID_STRF MKTAG('s','t','r','f') #define ID_MOVI MKTAG('m','o','v','i') #define ID_REC MKTAG('r','e','c',' ') @@ -155,9 +157,11 @@ bool AVIDecoder::parseNextChunk() { case ID_STRD: // Extra stream info, safe to ignore case ID_VEDT: // Unknown, safe to ignore case ID_JUNK: // Alignment bytes, should be ignored + case ID_JUNQ: // Same as JUNK, safe to ignore case ID_ISFT: // Metadata, safe to ignore case ID_DISP: // Metadata, should be safe to ignore case ID_STRN: // Metadata, safe to ignore + case ID_DMLH: // OpenDML extension, contains an extra total frames field, safe to ignore skipChunk(size); break; case ID_IDX1: diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index 3dbcebcde4..0247fe5dc9 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -726,16 +726,15 @@ void SmackerDecoder::SmackerVideoTrack::unpackPalette(Common::SeekableReadStream } else { // top 2 bits are 00 sz++; // get the lower 6 bits for each component (0x3f = 00111111) - byte b = b0 & 0x3f; + byte r = b0 & 0x3f; byte g = (*p++) & 0x3f; - byte r = (*p++) & 0x3f; + byte b = (*p++) & 0x3f; - assert(g < 0xc0 && b < 0xc0); - - // upscale to full 8-bit color values by multiplying by 4 - *pal++ = b * 4; - *pal++ = g * 4; - *pal++ = r * 4; + // upscale to full 8-bit color values. The Multimedia Wiki suggests + // a lookup table for this, but this should produce the same result. + *pal++ = (r * 4 + r / 16); + *pal++ = (g * 4 + g / 16); + *pal++ = (b * 4 + b / 16); } } |