[Scummvm-cvs-logs] scummvm master -> 7d1cc31e1e8158b2fc0989933c088941602c4193

dreammaster dreammaster at scummvm.org
Tue Feb 18 00:40:12 CET 2014


This automated email contains information about 327 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
db519373c1 VOYEUR: Added engine skeleton
b72298fa6f VOYEUR: Added proper detection entry
0c5561cc07 VOYEUR: In progress work on bolt file manager
4b638bc4b0 VOYEUR: Further work on bolt file loading
bff4076093 VOYEUR: Fixes for loading group index
a52dffb315 VOYEUR: Implemented code for default decompression
ca0eb9bd75 VOYEUR: Some initial bugfixes for resource decompression
7c85f94a57 VOYEUR: First group's members are now successfully decompressed
d4a137528f VOEYUR: Now the font data pointer loads correctly
71d2b5008d VOYEUR: Finished globalInitBolt method
0d26e515fb VOYEUR: Start of work on general initialisation
3c6507812e VOYEUR: Clean up of IntData usage
aff7c3d9bd VOYEUR: Beginnings of Bolt init function array
a855cf648b VOYEUR: Refactoring Bolt statics into a separate class
e33fb4f897 VOYEUR: Fixes for decompression, and picture initialisation
23f3866e14 VOYEUR: Implemented initViewPort and pointer resolve methods
ab4f798f5b VOYEUR: Added code for initViewPortList
83524863d7 VOYEUR: Implemented remaining Bolt init methods
d770907c33 VOYEUR: Starting on viewport activation, and extra bolt entry guards
452fdc64af VOYEUR: Fixes to pointer fields in viewport setup
04794adf5c VOYEUR: Completed setupViewPort
8e1325e538 VOYEUR: Implemented the setupMCGASaveRect method
43d31cc334 VOYEUR: Implemented first execution path through sInitPic
4279eedceb VOYEUR: Cleanup of sDrawPic parameter usage and viewport initialisation
a6c852c99d VOYEUR: Implemented flipPage
8b6d3169cc VOYEUR: Implemented sWaitFlip
99f474a3b6 VOYEUR: Implemented the restoreMCGASaveRect method
b85aa4f8d9 VOYEUR: Implemented the restoreBack method
0dc30622d3 VOYEUR: Firthur work on sDrawPic and add fn
e9e596e741 VOYEUR: Fixes for recent changes to ViewPortResource initialisation
f70fd94732 VOYEUR: Added in debugger and adding event manager methods
2a2e1a08cf VOYEUR: Fix to event manager delays and screen updates methods
6bce04959b VOYEUR: Implemented more doHeadTitle startup code, and startFade
f5ed290025 VOYEUR: Minor palette load bugfixes. First screen is now partly showing
adef1bc27d VOYEUR: Some cleanup of sDrawPic, and decompression fixes
8342e1ed75 VOYEUR: Fix glitch in decoding first screen
8d6d3d8aa6 VOYEUR: Some fixes for startup palette loading
48c18a7c14 VOYEUR: Implemented decoding of viewport list palette data
3780d9abec VOYEUR: Major cleanup of code between EventsManager and GraphicsManager
11a4fef956 VOYEUR: Some further work implementing fading
b1eeefaab1 VOYEUR: Implement freeBoltGroup and related logic
54c470d36f VOYEUR: Implemented fillPic and related code
7bf4d49253 VOYEUR: Starting to implement code for the lock screen
ca8a47700d VOYEUR: Add missing code from CMapResource & ViewPortListResource initialisation
f9b2c62bcd VOYEUR: Fading now works correctly
e24e181a2a VOYEUR: Work implementing the lock display screen
0fe067ba4a VOYEUR: Lock screen background now correctly showing
b02c72b45f VOYEUR: Initial implementation of drawText method
0a0db2bf73 VOYEUR: Refactoring and bugfixes for correctly loading fontInfo and font resources
76ba4bcafb VOYEUR: Font rendering fixes
8f3d5d5320 VOYEUR: Fixed initialisation of viewport parent pointer
eea9f9d2bb VOYEUR: Implemented setCursorTo method
90d916d26a VOYEUR: Added missing entry for Voyeur in engines.mk
ef902493c4 VOYEUR: Some cleanup and enum-ifying graphic drawing code
1a2f6fe6f3 VOYEUR: Fix memory overrun in fading code
b135ce3d28 VOYEUR: Further fading memory access bugfixes
65a6308a5a VOYEUR: Fix crash on shutdown
c0e6fcba73 VOYEUR: Implemented sDrawPic modes for screen clearing
3e62f279d5 VOYEUR: Fix loading and use of font resource top padding
4c70e6afce VOYEUR: On-screen text finally showing up
412ac6a00d VOYEUR: Minor cleanup of doLock cursor code
ff270eb61e VOYEUR: Fix setting cursor colour in lock screen
1c34c1847e VOYEUR: Lock screen mouse clicks now working
975cc8075d VOYEUR: Fixed colours of lock screen text display
8c2b956120 VOYEUR: Converted cursor drawing to use CursorMan
c4a56dbdb8 VOYEUR: Implemented RL2 video decoder
527a52e473 VOYEUR: Sound for RL2 video files is sort of working
b4bfc7c71c VOYEUR: Implementing code for showing title sequence
cc4486772c VOYEUR: Fix in bounds clipping in sDrawPic
2654135257 VOYEUR: Fix crash from using background resource after it's group is freed
a4e445702f VOYEUR: Implemented doTransitionCard
d8ef42a761 VOYEUR: Work on doOpening method
66d1f7a8de VOYEUR: Fixes for opening scene to start
ede418b67a VOYEUR: Merge of upstream
626c988841 VOYEUR: Fix for correctly displaying lock screen
1fb422cde2 VOYEUR: Implemented sound effects for the lock screen
08d68be2dc VOYEUR: Fix for playback of animations with a background
805230e163 VOYEUR: Fix for stuttering sound in animation playback
39a86aed6a VOYEUR: Implemented sDrawPic mode for writing transition card text
958654fe94 VOYEUR: Added staticres.cpp file
75c960081c VOYEUR: Did some refactoring of game files
9922353f56 VOYEUR: Implemented addVideoEventStart and dependent variable initialisation
b40c34a883 VOYEUR: Fix engine to not be enabled by default
a6ceaf2985 VOYEUR: Refactoring of BoltFile now that have more than one bolt file
a86b1c3d58 VOYEUR: Implementation of basic StampBoltFile resource types
ce3cb58d15 VOYEUR: Extra control/group initialisation
fc7c1cd33e VOYEUR: More thread/stack initialisation
bad9219c27 VOYEUR: Temporarily disable startup screens
96b1fb8601 VOYEUR: Fixes for ControlResource initialisation
7ccc9a3fab VOYEUR: Moved stm methods into ThreadResource class
ce9b127cbc VOYEUR: Further thread initialisation methods
afc4e0ed33 VOYEUR: Implemented thread getButtonsText and support methods
03f7fb64db VOYEUR: Implemented the playStamp method
9cb1122a98 VOYEUR: Implement stubs for thread methods needed by playStamp
573e2c143d VOYEUR: Start of implementing parsePlayCommands
9660652695 VOYEUR: More of parsePlayCommands implemented
10be9a527b VOYEUR: Split ThreadResource into it's own file
d08953ccd9 VOYEUR: Implemented more of parsePlayCommands
7f5a5606a5 VOYEUR: Implemented remainder of parsePlayCommands
d5762b5332 VOYEUR: Removed use of GET_WORD macro in parsePlayCommands
7f018dafd5 VOYEUR: Bugfixes for getField1CE method
ae7bb13f20 VOYEUR: Fix loading of ControlResource
888f35fe5e VOYEUR: Implemented the saveLastInplay method
dfd4e765f2 VOYEUR: Implementing code for chooseSTAMPButton and sub-methods
1187a4fc25 VOYEUR: Implemented goToState method
c479aed9d1 VOYEUR: Implemented cardPerform and cardPerform2
09b22952ce VOYEUR: Minor fix to getNextRecord and added a few debug lines
f2b8c51881 VOYEUR: Added extra initialisation for ControlResource objects
b80d0e9aa3 VOYEUR: Fix field intiialisation in getStateInfo
208c5aa6b7 VOYEUR: Fix for parsePlayCommands command 9
b9bd380a29 VOYEUR: Fixes for parsePlayCommands command 7
033929d701 VOYEUR: Fixes for parsePlayCommands command 8
4ffa060832 VOYEUR: Make parsePlayCommands debug parse Index be 1-based
debe14fc50 VOYEUR: Fixes for casting warnings
49d50afb47 VOYEUR: In progress implementation of doInterface
af90a11ff2 VOYEUR: Fix various warnings
95316a5956 VOYEUR: Implemented doInterface method
fc757c3169 VOYEUR: Fix shadowed variable in doInterface
798a93d899 VOYEUR: Slight fix to doInterface method
e44fa657e4 VOYEUR: Implemented support methods needed for doApt
8eae029669 VOYEUR: Fix for resource pointers resolveAll not clearing it's resolve it
2f3bb44f5e VOYEUR: Fix for loading bolt groups
28ecf5ba53 VOYEUR: Fix extra flag parameters for getBoltGroup and freeBoltGroup
663d08b192 VOYEUR: Fix for when multiple bolt files are open
e132e8b7c1 VOYEUR: Implemented doApt
7d8aa0a506 VOYEUR: Implemented getVOCFileName
5dde350ba0 VOYEUR: Implemented getVOCStatus
2346671e7c VOYEUR: Resource fix in doAptAnim
b99176fee6 VOYEUR: Fix for sound playback in the apartment
23f9cb19b4 VOYEUR: In progress work on fixing initial apartment animation
29fe53993b VOYEUR: Fix error in vDoFadeInt
1a4c6d46ac VOYEUR: Reset doAptAnim frame delay back to what it should be
6cd2d01397 VOYEUR: Fixes for doApt mouse handling
13b4c9ca68 VOYEUR: Renaming of mouse click fields
f588211815 VOYEUR: Implemented checkTransition
72c21cf0a7 VOYEUR: Implemented drawIfaceTime
a73ea5c3dc VOYEUR: Beginnings of camera spy screen
171d159489 VOYEUR: Implemented doRoom method
537ec24e1e VOYEUR: Renamed a couple of event fields
2fe3902dc9 VOYEUR: Fix to start doInterface after doApt
4f9c900a03 VOYEUR: Fixes for video camera battery countdown
1af5a3b1b4 VOYEUR: Fix for setting up viewport clipping rect
156f78e7cd VOYEUR: Bugfixes and move for doScroll method
fa6eb76d66 VOYEUR: Implemented further event methods, and miscellaneous
2721c2e3ed VOYEUR: Implemented reviewTape and dependent code
c5f9cf9134 VOYEUR: Implemented doGossip
562df7ede1 VOYEUR: Implement doTapePlaying
754601bbab VOYEUR: Better implementation of rect resources
6e801e246b VOYEUR: Enhance RectResource to handle rect sets
0c82fc1baf VOYEUR: Implemented checkForMurder
6e1a7abeef VOYEUR: Implemented checkForIncriminate
88c9dac8c0 VOYEUR: Implemented playAVideoDuration
906f2546b4 VOYEUR: Implemented getChooseButton
554756f93f VOYEUR: Fix prototype for playAVideoDuration
16cbccf09a VOYEUR: Remove redundant method definition
8ed1171ca0 VOYEUR: Convert doInterface to use new rects resource type
3b9cdf48ee VOYEUR: Fix for doRoom start and looping
9eccf91aea VOYEUR: Implemented startCursorBlink and drawDot
19c208a05d VOYEUR: Refactored code fragments to use flipPageAndWaitForFade method
84752aa272 VOYEUR: Refactored code fragments to use flipPageAndWait
b08e80cd66 VOYEUR: Implemented evidence display code
f01ff9a938 VOYEUR: Further replacement of page flip code with flipPageAndWait calls
f88c472778 VOYEUR: Fixed naming of mouse state flags
8fa75375d4 VOYEUR: Bugfixes for doEvidDisplay
aa42e7d2bd VOYEUR: Fix data needed for drawDot
d763f83862 VOYEUR: Fixes for mouse cursor calls
2c0a94d174 VOYEUR: Fix right click to exit room closeups
1256fb6b66 VOYEUR: Add support for creating a PictureResource from a Graphics::Surface
10af04da6a VOYEUR: Mouse flags cleanup and in progress work on doGossip
3fd1abbe32 VOYEUR: Implemented playAVideo code, and support for RLV3 videos
beb64fe527 VOYEUR: Adding support for manually set backgrounds to RL2 playback
c4197b4e30 VOYEUR: Move _isRLV3 flag to animation header class
c78e83d784 VOYEUR: Implemented remainder of playAVideoDuration
f1686fcf16 VOYEUR: Fix bugs in police arriving playback
485c19b569 VOYEUR: Clean up playAVideoDuration
60743fc8c9 VOYEUR: Implemented vDoCycleInt
cb15e2863f VOYEUR: Fix to doTapePlaying to show tape image
f08231939f VOYEUR: Removed duplicate vStopCycle method
87a6e72fc5 VOYEUR: Fixes to vDoCycleInt for tape playback palette animation
2d71a0594d VOYEUR: Fix guilt check post doTapePlaying call
577b7cefa0 VOYEUR: Animation improvements to better handle Voyeur RL2 videos
1cdca7cd7f VOYEUR: Fix memory leak in animation header class
f153ef4b46 VOYEUR: Fix compiler warning
9f103cb8fb VOYEUR: Workaround for original intrepreter frame overruns
3e268ca4e0 VOYEUR: Fix to cardPerform switch cases
5c20b3c331 VOYEUR: Implementing game end methods
86a0d366e4 VOYEUR: Implemented game ending title and credits
76f7d974f6 VOYEUR: In progress work trying to fix doGossip
1c3708630b VOYEUR: Replaced original game mansion scrolling with a more effective one
5b2ad8515e VOYEUR: Fix names of cursor variables in doInterface
795422bb29 VOYEUR: Fix loading of correct hotspot list in doInterface
ac157b7bc7 VOYEUR: Workaround for original code causing crash after calling doEvidDisplay
2db6d543a0 VOYEUR: Tweaked vertical scroll area/rate for viewing mansion
bbecd20818 VOYEUR: Variable renaming for Video Id
3672e3fa16 VOYEUR: Fix parsePlayCommands case 3 setting Video Id correctly
7d9680058a VOYEUR: Fixes for decoding RL2 videos with transparency
ce5b8c54a9 VOYEUR: Hooked up debugger, and added a 'time' command
99dc594cb9 VOYEUR: Fix for crash when changing time period
7c256c491a VOYEUR: Refactored doAptPosX/Y into a local variable
1690ffb2bf VOYEUR: Moved _stampFlags to VoyeurEngine
9c2b761b31 VOYEUR: Rename the old _playStamp1/2 variables to have better names
c884d5bf14 VOYEUR: Added a state field for current game area
1fb73446e3 VOYEUR: Clean up of some of the startup code
996b2aa43c VOYEUR: Use boolean for _isAM instead of int
12386de64b VOYEUR: Remove an unused variable and constant
6dff157459 VOYEUR: Remove a couple of useless variables, change type of some other to use booleans, add CHECKME
2a206ebd7f VOYEUR: Moved SVoy and game events to their own file
3eff4af3c5 VOYEUR: Added new data source file
e6e8008e67 VOYEUR: Change some more types, add comments about unused variables
7e5dea4f5e VOYEUR: Silent 2 CppCheck warnings by differencing if/else branches
d0703467b4 VOYEUR: Fix some more CppCheck warnings
dfe3d8b4ce VOYEUR: Preliminary savegame functionality
5774ce53df VOYEUR: Further saving logic
0985cc51c2 VOYEUR: Implement pictures with horizontal or vertical flip
b0e397551c VOYEUR: Implemented remaining initialisations in sInitPic
c1657dc278 VOYEUR: Fix selection of apartment music after initial phone call ends
6b059631ce VOYEUR: Cleanup of doGossip, and better generic video playback code
829de693ef VOYEUR: Fix for video playback when no custom pic list needs to be applied
7ad8dfa0a7 VOYEUR: Fix switching TV watch gossip to reviewing the tape
8792e4f97b VOYEUR: Fix anonymous resource in reviewTape to a hotspot list
cbbdf4db47 VOYEUR: Fix sFillBox to work for PictureResource as well
e387b016c0 VOYEUR: Implemented addSaveRect and clipRect
f084539957 VOYEUR: Converted drawText and textWidth to work on PictureResource
3f50f14698 VOYEUR: Implemented remainder of reviewTape and dependent methods
7f236696c9 VOYEUR: Minor fixes to reviewTape
00873d3124 VOYEUR: Fix for phone message playing every time apartment was shown
f49a0e3a06 VOYEUR: Some fixes for savegame loading
758e35e79b VOYEUR: Further savegame loading fixes
0e68c9ac59 VOYEUR: Fix for SVoy data initialization
a662be5369 VOYEUR: Fix palette issues in first half of doGossip
3fc2a80be6 VOYEUR: Fix palette issues in second half of doGossip
b247d8d0a7 VOYEUR: Fix for aborting out of sending someoneo the tape
3e12562654 VOYEUR: Renaming of thread data pointers
0f9cfc373f VOYEUR: Refactored RL2 decoder to better load audio on the fly
ee26919e90 VOYEUR: Simply RL2 video decoder, and add proper seeking support
d2e8a6bed5 VOYEUR: Implemented lots more sDrawPic logic
336a02047b VOYEUR: Fixes for flagging video events, and reviewing them in reviewTape
dacdca192d VOYEUR: Fixes for evidence viewing and review tape playback
f2af864c6b VOYEUR: Bugfixes for initializing audio events
55f2b4ea52 VOYEUR: Fixes for observing audio events
1e9bce479d VOYEUR: Fixes for reviewing audio events in review tape
dbc8e6bb31 VOYEUR: Fix for low battery charge leaving scene when time is turned off
77e86b3d48 VOYEUR: Renaming of _videoId to _audioVideoId and extra comments
4174c4a2be VOYEUR: Fix hotspot hightlighting in doInterface
b4ab7c3357 VOYEUR: Fix for loading rect resources with invalid rects
f31a422ddf VOYEUR: Add support for the extended rects used by room displays
da977f05f6 VOYEUR: Fix review tape entries when more than a page is available
f6477270b0 VOYEUR: Fix for cursor error in reviewTape after viewing evidence
cbebf203d6 VOYEUR: Add debugger command for setting the time remaining
37402e06e5 VOYEUR: Correct mistake in debugger command.. it's time expired, not remaining
256bf62ee4 VOYEUR: Refactored audio scene playback, and fixed a crash at the end
3b414f10ba VOYEUR: Fix hang when viewing scene is finished with very little time remaining
517df376a2 VOYEUR: Refactored hotspot time arrays into a cleaner template
971fd6304f VOYEUR: Renamed SVoy._arr7 to _roomHotspotsEnabled
10f9c2fb03 VOYEUR: Added method comments for SVoy and some of VoyeurEngine class methods
e1eddb5ecb VOYEUR: Initialization bugfixes
24e4028174 VOYEUR: Improvements for savegame support
d215fae721 VOYEUR: Renaming to standardize on stateId/stackId variable names
8af390ab9f VOYEUR: Further renaming of state Id, and merging of flag bytes
28fc97cbe7 VOYEUR: Fix for occasional palette corruption when reviewing a video event
f450b79476 VOYEUR: Converted doRoom to use ScummVM cursors
7cd966bc80 VOYEUR: Removed redundant LockClass class
54c479c3d9 VOYEUR: Bugfixes for computer event display
647a2ded95 VOYEUR: Set up enum for event flags, and improved blinking record indicator
a2b77b665e VOYEUR: Fix for loading in blocks from file correctly when decompressing data
a518102b21 VOYEUR: Fix for crash in playAudio
d545b5cb75 VOYEUR: Fix incorrect loop terminator in room data load loop
3fab3ebdcf VOYEUR: Fix clearing computer screen when viewing a computer event
d536c0afb2 VOYEUR: Fix another incorrect rectangle fill when viewing computer text
63a06bc3f7 VOYEUR: Refactored code for showing ending news into separate method
9c3216c301 VOYEUR: Graphical fixes for clipped variations within sDrawPic
2b69c5d07c VOYEUR: Fix issue with time not progressing, and renamed associated enum member
569fa63a3a VOYEUR: Fix for not highlighting camera on Monday morning after loading savegame
ff68d8f89a VOYEUR: Added some comments
f88985dc64 VOYEUR: Added debugger command to show mouse position
4ef57db61a VOYEUR: General field renaming and comments
d13b529c47 VOYEUR: Improvements to debugger command for changing time period
2234724891 VOYEUR: Clean up debug channels
fcaf2af616 VOYEUR: Add a hotspot to the aprtment for the ScummVM GMM
e0a142ed4c VOYEUR: Fix loading of savegame descriptions
8385a0ef8e VOYEUR: Implemented checkForKey
ae9bca6bdf VOYEUR: Remove a lot of outdated TODO's and clean up of stubbed methods
be296c58dd VOYEUR: Removed some method declarations that are no longer in the given class
683ef9d50f VOYEUR: Fix for control data comparisons in parsePlayCommands
d3f4156e6a VOYEUR: Clean up, commenting, and bugfixes for checking for murder
0c1a0a28c2 VOYEUR: Re-enabled and completed implementing title sequence
90b7d10a77 VOYEUR: Fixes to keep credits on-screen during opening sequence
d5231aa862 VOYEUR: Moved RL2Decoder into Voyeur namespace, and merged with VoyeurRL2Decoder
77d8810b19 VOYEUR: Converted RL2 header getFrameRate to use Common::Rational
bb37927afd VOYEUR: Cleaner implementation of RL2Decoder seek
07f57ac650 VOYEUR: Simplified reference to audio and video tracks in the RL2Decoder
49e3c9bcd2 VOYEUR: Moved RL2Decoder::seek to be seekIntern
f075f0336e VOYEUR: Convert ControlResource::_ptr raw data to a deserialized state object
eca87a63e9 VOYEUR: Renamings for the fields of the new StateResource class
d0ca824a62 VOYEUR: Opening sequence video should not be completely skipped
f6c6871918 VOYEUR: Fix preloading incriminating videos if the debug _iForceDeath is set
ab0cdde539 VOYEUR: Fix sound distortions in the second part of the gossip interview
f407a292a1 VOYEUR: Fix decoder _curFrame to start at -1
9d86715e30 VOYEUR: Renaming SVoy fields
e3b666a27a VOYEUR: Standardised delay amount between frame checks in video playback methods
26f5475136 VOYEUR: Remove redundant code from RL2Decoder class
9608a52162 VOYEUR: Reduce the scope of a couple of variables
72d2131263 VOYEUR: Remove a useless variable
e688cb5015 VOYEUR: Implement fadeIntFunc()
1ed4ed47af VOYEUR: Rename some fields related to fading
5cc1bd626d VOYEUR: Remove unused function header
0d99418791 VOYEUR: Some more renaming
1b7a4cf4a0 VOYEUR: Initialize properly a couple of Bolt variables
82b4768dd7 VOYEUR: Initialize some more variables
e7cc3fc4df VOYEUR: Use American English instead of British English in several places
1949f4511f VOYEUR: Some renaming in Files
013522457c VOYEUR: Remove useless fields in Events, some renaming
2a97f13c0e VOYEUR: Set private some variables and functions
bc8542aa20 VOYEUR: Set private some DATA variables
56a32b3652 VOYEUR: Fix checking RLV header signature
b2bf4c6b17 VOYEUR: Changed SVoy initialisation to individual field values
fe0376dbb0 VOYEUR: Indent register plugin lines to match standard practice
473732d9fb VOYEUR: Use AD_ENTRY1 for detection
4367ade8c7 VOYEUR: Fix maximum number of savegames
ed681f49e3 VOYEUR: Fix formatting
d439747147 VOYEUR: Fix formatting in GraphicsManager
ee9c59b225 VOYEUR: Fix tabulation in staticres
f660e3ba11 VOYEUR: Fix some function definitions in voyeur_game
1b46f5f616 VOYEUR: Remove a useless keystate variable
2725bc88aa VOYEUR: Get rid of a magic value, replaced by DECOMPRESS_SIZE
dc8b58a0f9 VOYEUR: Changed signature check for savegames to use MKTAG
7d1cc31e1e Merge pull request #436 from dreammaster/voyeur


Commit: db519373c111d8eced7d7fb4148d4655204813bc
    https://github.com/scummvm/scummvm/commit/db519373c111d8eced7d7fb4148d4655204813bc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-17T19:40:43-07:00

Commit Message:
VOYEUR: Added engine skeleton

Changed paths:
  A engines/voyeur/detection.cpp
  A engines/voyeur/detection_tables.h
  A engines/voyeur/module.mk
  A engines/voyeur/voyeur.cpp
  A engines/voyeur/voyeur.h
    engines/configure.engines
    engines/plugins_table.h



diff --git a/engines/configure.engines b/engines/configure.engines
index 15aa11d..7325b10 100644
--- a/engines/configure.engines
+++ b/engines/configure.engines
@@ -50,4 +50,5 @@ add_engine touche "Touche: The Adventures of the Fifth Musketeer" yes
 add_engine tony "Tony Tough and the Night of Roasted Moths" yes "" "" "16bit"
 add_engine tsage "TsAGE" yes
 add_engine tucker "Bud Tucker in Double Trouble" yes
+add_engine voyeur "Voyeur" yes
 add_engine wintermute "Wintermute" no "" "" "png zlib vorbis 16bit"
diff --git a/engines/plugins_table.h b/engines/plugins_table.h
index 4497945..c68aa05 100644
--- a/engines/plugins_table.h
+++ b/engines/plugins_table.h
@@ -113,6 +113,9 @@ LINK_PLUGIN(TOUCHE)
 #if PLUGIN_ENABLED_STATIC(TUCKER)
 LINK_PLUGIN(TUCKER)
 #endif
+#if PLUGIN_ENABLED_STATIC(VOYEUR)
+LINK_PLUGIN(VOYEUR)
+#endif
 #if PLUGIN_ENABLED_STATIC(WINTERMUTE)
 LINK_PLUGIN(WINTERMUTE)
 #endif
diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp
new file mode 100644
index 0000000..e9a5b8d
--- /dev/null
+++ b/engines/voyeur/detection.cpp
@@ -0,0 +1,170 @@
+/* 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 "voyeur/voyeur.h"
+
+#include "base/plugins.h"
+#include "common/savefile.h"
+#include "common/str-array.h"
+#include "common/memstream.h"
+#include "engines/advancedDetector.h"
+#include "common/system.h"
+#include "graphics/colormasks.h"
+#include "graphics/surface.h"
+
+#define MAX_SAVES 99
+
+namespace Voyeur {
+
+struct VoyeurGameDescription {
+	ADGameDescription desc;
+};
+
+uint32 VoyeurEngine::getFeatures() const {
+	return _gameDescription->desc.flags;
+}
+
+Common::Language VoyeurEngine::getLanguage() const {
+	return _gameDescription->desc.language;
+}
+
+Common::Platform VoyeurEngine::getPlatform() const {
+	return _gameDescription->desc.platform;
+}
+
+bool VoyeurEngine::getIsDemo() const {
+	return _gameDescription->desc.flags & ADGF_DEMO;
+}
+
+} // End of namespace Voyeur
+
+static const PlainGameDescriptor voyeurGames[] = {
+	{"voyeur", "Voyeur"},
+	{0, 0}
+};
+
+#include "voyeur/detection_tables.h"
+
+class VoyeurMetaEngine : public AdvancedMetaEngine {
+public:
+	VoyeurMetaEngine() : AdvancedMetaEngine(Voyeur::gameDescriptions, sizeof(Voyeur::VoyeurGameDescription), voyeurGames) {
+		_maxScanDepth = 3;
+	}
+
+	virtual const char *getName() const {
+		return "Voyeur Engine";
+	}
+
+	virtual const char *getOriginalCopyright() const {
+		return "Voyeur (c)";
+	}
+
+	virtual bool hasFeature(MetaEngineFeature f) const;
+	virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+	virtual SaveStateList listSaves(const char *target) const;
+	virtual int getMaximumSaveSlot() const;
+	virtual void removeSaveState(const char *target, int slot) const;
+	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+};
+
+bool VoyeurMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return
+	    (f == kSupportsListSaves) ||
+		(f == kSupportsLoadingDuringStartup) ||
+		(f == kSupportsDeleteSave) ||
+		(f == kSavesSupportMetaInfo) ||
+		(f == kSavesSupportThumbnail);
+}
+
+bool Voyeur::VoyeurEngine::hasFeature(EngineFeature f) const {
+	return
+		(f == kSupportsRTL) ||
+		(f == kSupportsLoadingDuringRuntime) ||
+		(f == kSupportsSavingDuringRuntime);
+}
+
+bool VoyeurMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+	const Voyeur::VoyeurGameDescription *gd = (const Voyeur::VoyeurGameDescription *)desc;
+	if (gd) {
+		*engine = new Voyeur::VoyeurEngine(syst, gd);
+	}
+	return gd != 0;
+}
+
+SaveStateList VoyeurMetaEngine::listSaves(const char *target) const {
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	Common::StringArray filenames;
+	Common::String saveDesc;
+	Common::String pattern = Common::String::format("%s.0??", target);
+
+	filenames = saveFileMan->listSavefiles(pattern);
+	sort(filenames.begin(), filenames.end());   // Sort to get the files in numerical order
+
+	SaveStateList saveList;
+	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+		const char *ext = strrchr(file->c_str(), '.');
+		int slot = ext ? atoi(ext + 1) : -1;
+
+		if (slot >= 0 && slot < MAX_SAVES) {
+			Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
+
+			if (in) {
+				delete in;
+			}
+		}
+	}
+
+	return saveList;
+}
+
+int VoyeurMetaEngine::getMaximumSaveSlot() const {
+	return MAX_SAVES;
+}
+
+void VoyeurMetaEngine::removeSaveState(const char *target, int slot) const {
+	Common::String filename = Common::String::format("%s.%03d", target, slot);
+	g_system->getSavefileManager()->removeSavefile(filename);
+}
+
+SaveStateDescriptor VoyeurMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+	Common::String filename = Common::String::format("%s.%03d", target, slot);
+	Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename);
+
+	if (f) {
+		delete f;
+
+		// Create the return descriptor
+		SaveStateDescriptor desc(slot, "");
+
+		return desc;
+	}
+
+	return SaveStateDescriptor();
+}
+
+
+#if PLUGIN_ENABLED_DYNAMIC(VOYEUR)
+REGISTER_PLUGIN_DYNAMIC(VOYEUR, PLUGIN_TYPE_ENGINE, VoyeurMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(VOYEUR, PLUGIN_TYPE_ENGINE, VoyeurMetaEngine);
+#endif
diff --git a/engines/voyeur/detection_tables.h b/engines/voyeur/detection_tables.h
new file mode 100644
index 0000000..8f85b92
--- /dev/null
+++ b/engines/voyeur/detection_tables.h
@@ -0,0 +1,45 @@
+/* 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.
+ *
+ */
+
+namespace Voyeur {
+
+static const VoyeurGameDescription gameDescriptions[] = {
+	{
+		// Voyeur
+		{
+			"voyeur",
+			0,
+			{
+				{"Voyeur.exe", 0, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 292864},
+				AD_LISTEND
+			},
+			Common::EN_ANY,
+			Common::kPlatformDOS,
+			ADGF_NO_FLAGS,
+			GUIO1(GUIO_NONE)
+		},
+	},
+
+	{ AD_TABLE_END_MARKER }
+};
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
new file mode 100644
index 0000000..c4dad92
--- /dev/null
+++ b/engines/voyeur/module.mk
@@ -0,0 +1,13 @@
+MODULE := engines/voyeur
+
+MODULE_OBJS := \
+	detection.o \
+	voyeur.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_VOYEUR), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
new file mode 100644
index 0000000..43e7f51
--- /dev/null
+++ b/engines/voyeur/voyeur.cpp
@@ -0,0 +1,83 @@
+/* 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 "voyeur/voyeur.h"
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+
+namespace Voyeur {
+
+VoyeurEngine *g_vm;
+
+VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
+		_gameDescription(gameDesc), _randomSource("Voyeur") {
+	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+}
+
+VoyeurEngine::~VoyeurEngine() {
+}
+
+Common::String VoyeurEngine::generateSaveName(int slot) {
+	return Common::String::format("%s.%03d", _targetName.c_str(), slot);
+}
+
+/**
+ * Returns true if it is currently okay to restore a game
+ */
+bool VoyeurEngine::canLoadGameStateCurrently() {
+	return true;
+}
+
+/**
+ * Returns true if it is currently okay to save the game
+ */
+bool VoyeurEngine::canSaveGameStateCurrently() {
+	return true;
+}
+
+/**
+ * Load the savegame at the specified slot index
+ */
+Common::Error VoyeurEngine::loadGameState(int slot) {
+	return Common::kNoError;
+}
+
+/**
+ * Save the game to the given slot index, and with the given name
+ */
+Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc) {
+	//TODO
+	return Common::kNoError;
+}
+
+Common::Error VoyeurEngine::run() {
+	
+
+	return Common::kNoError;
+}
+
+int VoyeurEngine::getRandomNumber(int maxNumber) {
+	return _randomSource.getRandomNumber(maxNumber);
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
new file mode 100644
index 0000000..fe82c91
--- /dev/null
+++ b/engines/voyeur/voyeur.h
@@ -0,0 +1,88 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_VOYEUR_H
+#define VOYEUR_VOYEUR_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/error.h"
+#include "common/random.h"
+#include "common/util.h"
+#include "engines/engine.h"
+#include "graphics/surface.h"
+
+/**
+ * This is the namespace of the Voyeur engine.
+ *
+ * Status of this engine: In Development
+ *
+ * Games using this engine:
+ * - Voyeur
+ */
+namespace Voyeur {
+
+#define DEBUG_BASIC 1
+#define DEBUG_INTERMEDIATE 2
+#define DEBUG_DETAILED 3
+
+#define SCREEN_WIDTH 320
+#define SCREEN_HEIGHT 200
+
+enum VoyeurDebugChannels {
+	kDebugPath      = 1 <<  0
+};
+
+struct VoyeurGameDescription;
+
+class VoyeurEngine : public Engine {
+private:
+	const VoyeurGameDescription *_gameDescription;
+	Common::RandomSource _randomSource;
+
+protected:
+	// Engine APIs
+	virtual Common::Error run();
+	virtual bool hasFeature(EngineFeature f) const;
+
+public:
+	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
+	virtual ~VoyeurEngine();
+	void GUIError(const Common::String &msg);
+
+	uint32 getFeatures() const;
+	Common::Language getLanguage() const;
+	Common::Platform getPlatform() const;
+	uint16 getVersion() const;
+	bool getIsDemo() const;
+
+	int getRandomNumber(int maxNumber);
+	Common::String generateSaveName(int slotNumber);
+	virtual bool canLoadGameStateCurrently();
+	virtual bool canSaveGameStateCurrently();
+	virtual Common::Error loadGameState(int slot);
+	virtual Common::Error saveGameState(int slot, const Common::String &desc);
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_VOYEUR_H */


Commit: b72298fa6f7da9eda854b78a1c69c8365ffdf30c
    https://github.com/scummvm/scummvm/commit/b72298fa6f7da9eda854b78a1c69c8365ffdf30c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-17T20:13:48-07:00

Commit Message:
VOYEUR: Added proper detection entry

Changed paths:
  A engines/voyeur/events.cpp
  A engines/voyeur/events.h
    engines/voyeur/detection_tables.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/detection_tables.h b/engines/voyeur/detection_tables.h
index 8f85b92..789eb4c 100644
--- a/engines/voyeur/detection_tables.h
+++ b/engines/voyeur/detection_tables.h
@@ -24,12 +24,12 @@ namespace Voyeur {
 
 static const VoyeurGameDescription gameDescriptions[] = {
 	{
-		// Voyeur
+		// Voyeur DOS English
 		{
 			"voyeur",
 			0,
 			{
-				{"Voyeur.exe", 0, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 292864},
+				{"a1100100.rl2", 0, "b44630677618d034970ca0a13c1c1237", 336361},
 				AD_LISTEND
 			},
 			Common::EN_ANY,
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
new file mode 100644
index 0000000..f84172f
--- /dev/null
+++ b/engines/voyeur/events.cpp
@@ -0,0 +1,31 @@
+/* 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 "voyeur/events.h"
+
+namespace Voyeur {
+
+void EventManager::resetMouse() {
+
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
new file mode 100644
index 0000000..5715591
--- /dev/null
+++ b/engines/voyeur/events.h
@@ -0,0 +1,45 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_EVENTS_H
+#define VOYEUR_EVENTS_H
+
+#include "common/scummsys.h"
+#include "common/events.h"
+
+namespace Voyeur {
+
+class VoyeurEngine;
+
+class EventManager {
+private:
+	VoyeurEngine *_vm;
+public:
+	EventManager() {}
+	void setVm(VoyeurEngine *vm) { _vm = vm; }
+
+	void resetMouse();
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_VOYEUR_H */
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 43e7f51..580bacb 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -71,7 +71,7 @@ Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc)
 }
 
 Common::Error VoyeurEngine::run() {
-	
+	ESP_Init();
 
 	return Common::kNoError;
 }
@@ -80,4 +80,11 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
 	return _randomSource.getRandomNumber(maxNumber);
 }
 
+void VoyeurEngine::ESP_Init() {
+	_eventManager.setVm(this);
+
+	_eventManager.resetMouse();
+
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index fe82c91..627f7d8 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -23,6 +23,7 @@
 #ifndef VOYEUR_VOYEUR_H
 #define VOYEUR_VOYEUR_H
 
+#include "voyeur/events.h"
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "common/error.h"
@@ -58,7 +59,9 @@ class VoyeurEngine : public Engine {
 private:
 	const VoyeurGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
+	EventManager _eventManager;
 
+	void ESP_Init();
 protected:
 	// Engine APIs
 	virtual Common::Error run();


Commit: 0c5561cc07ff6257b832feeca644bcd136fe2a0f
    https://github.com/scummvm/scummvm/commit/0c5561cc07ff6257b832feeca644bcd136fe2a0f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-19T19:45:54-07:00

Commit Message:
VOYEUR: In progress work on bolt file manager

Changed paths:
  A engines/voyeur/files.cpp
  A engines/voyeur/files.h
  A engines/voyeur/graphics.cpp
  A engines/voyeur/graphics.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
new file mode 100644
index 0000000..4480f48
--- /dev/null
+++ b/engines/voyeur/files.cpp
@@ -0,0 +1,143 @@
+/* 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 "voyeur/files.h"
+
+namespace Voyeur {
+
+FilesManager::FilesManager() {
+	_decompressSize = 0x7000;
+}
+
+bool FilesManager::openBOLTLib(const Common::String &filename, BoltFile *&boltFile) {
+	if (boltFile != NULL) {
+		_curLibPtr = boltFile;
+		return true;
+	}
+
+	// TODO: Specific library classes for buoy.blt versus stampblt.blt 
+	// Create the bolt file interface object and load the index
+	boltFile = _curLibPtr = new BoltFile();
+	return true;
+}
+
+/*------------------------------------------------------------------------*/
+
+#define BOLT_GROUP_SIZE 16
+
+BoltFile *BoltFile::_curLibPtr = NULL;
+BoltGroup *BoltFile::_curGroupPtr = NULL;
+byte *BoltFile::_curMemInfoPtr = NULL;
+int BoltFile::_fromGroupFlag = 0;
+
+BoltFile::BoltFile() {
+	if (!_curFd.open("buoy.blt"))
+		error("Could not open buoy.blt");
+	_curFilePosition = 0;
+
+	// Read in the file header
+	byte header[16];
+	_curFd.read(&header[0], 16);
+
+	if (strncmp((const char *)&header[0], "BOLT", 4) != 0)
+		error("Tried to load non-bolt file");
+
+	int totalGroups = header[11] ? header[11] : 0x100;
+	for (int i = 0; i < totalGroups; ++i)
+		_groups.push_back(BoltGroup(_curFd.readStream(_curFd.size())));
+}
+
+BoltFile::~BoltFile() {
+	_curFd.close();
+}
+
+bool BoltFile::getBoltGroup(uint32 id) {
+	++_fromGroupFlag;
+	_curLibPtr = this;
+	_curGroupPtr = &_groups[(id >> 8) & 0xff];
+	int count = _curGroupPtr->_count ? _curGroupPtr->_count : 256;
+
+	if (_curGroupPtr->_groupPtr) {
+		// Group already loaded
+		_curMemInfoPtr = _curGroupPtr->_groupPtr;
+	} else {
+		// Load the group
+		_curGroupPtr->load();
+	}
+
+	if (_curGroupPtr->_callInitGro)
+		initGro();
+
+	if ((id >> 16) == 0) {
+		if (!_curGroupPtr->_loaded) {
+			_curGroupPtr->load();
+		} else {
+			id &= 0xff00;
+			for (int idx = 0; idx < count; ++idx, ++id) {
+				byte *member = getBoltMember(id);
+				assert(member);
+			}
+		}
+	}
+
+	resolveAll();
+	--_fromGroupFlag;
+	return true;
+}
+
+/*------------------------------------------------------------------------*/
+
+BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
+	byte buffer[BOLT_GROUP_SIZE];
+
+	_groupPtr = NULL;
+
+	_file->read(&buffer[0], BOLT_GROUP_SIZE);
+	_loaded = false;
+	_callInitGro = buffer[1] != 0;
+	_count = buffer[3];
+	_fileOffset = READ_LE_UINT32(&buffer[8]);
+}
+
+void BoltGroup::load() {
+	_file->seek(_fileOffset);
+
+	byte header[4];
+	_file->read(&header[0], 4);
+
+	// Read the entries
+	int count = _count ? _count : 256;
+	for (int i = 0; i < count; ++i)
+		_entries.push_back(BoltEntry(_file));
+}
+
+/*------------------------------------------------------------------------*/
+
+BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
+	
+}
+
+void BoltEntry::load() {
+
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
new file mode 100644
index 0000000..1db1fdf
--- /dev/null
+++ b/engines/voyeur/files.h
@@ -0,0 +1,105 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_FILES_H
+#define VOYEUR_FILES_H
+
+#include "common/scummsys.h"
+#include "common/file.h"
+#include "common/str.h"
+
+namespace Voyeur {
+
+class VoyeurEngine;
+class BoltGroup;
+class BoltEntry;
+
+class BoltFile {
+private:
+	static BoltFile *_curLibPtr;
+	static BoltGroup *_curGroupPtr;
+	static byte *_curMemInfoPtr;
+	static int _fromGroupFlag;
+private:
+	Common::File _curFd;
+	int _curFilePosition;
+	Common::Array<BoltGroup> _groups;
+private:
+	bool getBoltGroup(uint32 id);
+	void resolveAll() {}
+	byte *getBoltMember(uint32 id) { return NULL; }
+public:
+	BoltFile();
+	~BoltFile();
+
+	// Methods copied into bolt virtual table
+	void initType() {}
+	void termType() {}
+	void initMem() {}
+	void termMem() {}
+	void initGro() {}
+	void termGro() {}
+};
+
+class BoltGroup {
+private:
+	Common::SeekableReadStream *_file;
+public:
+	bool _loaded;
+	bool _callInitGro;
+	int _count;
+	int _fileOffset;
+	byte *_groupPtr;
+	Common::Array<BoltEntry> _entries;
+public:
+	BoltGroup(Common::SeekableReadStream *f); 
+
+	void load();
+};
+
+
+class BoltEntry {
+private:
+	Common::SeekableReadStream *_file;
+public:
+	int _fileOffset;
+public:
+	BoltEntry(Common::SeekableReadStream *f);
+
+	void load();
+};
+
+class FilesManager {
+private:
+	int _decompressSize;
+public:
+	BoltFile *_curLibPtr;
+public:
+	FilesManager();
+
+	bool openBOLTLib(const Common::String &filename, BoltFile *&boltFile);
+
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_VOYEUR_H */
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
new file mode 100644
index 0000000..008b014
--- /dev/null
+++ b/engines/voyeur/graphics.cpp
@@ -0,0 +1,27 @@
+/* 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 "voyeur/graphics.h"
+
+namespace Voyeur {
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
new file mode 100644
index 0000000..f1b568e
--- /dev/null
+++ b/engines/voyeur/graphics.h
@@ -0,0 +1,38 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_GRAPHICS_H
+#define VOYEUR_GRAPHICS_H
+
+#include "common/scummsys.h"
+#include "graphics/surface.h"
+
+namespace Voyeur {
+
+class GraphicsManager {
+public:
+	GraphicsManager() {}
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_VOYEUR_H */
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index c4dad92..24984cd 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -2,6 +2,9 @@ MODULE := engines/voyeur
 
 MODULE_OBJS := \
 	detection.o \
+	events.o \
+	files.o \
+	graphics.o \
 	voyeur.o
 
 # This module can be built as a plugin
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 580bacb..dc3fcb2 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -32,9 +32,11 @@ VoyeurEngine *g_vm;
 VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
 		_gameDescription(gameDesc), _randomSource("Voyeur") {
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+	_bVoyBoltFile = NULL;
 }
 
 VoyeurEngine::~VoyeurEngine() {
+	delete _bVoyBoltFile;
 }
 
 Common::String VoyeurEngine::generateSaveName(int slot) {
@@ -73,17 +75,29 @@ Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc)
 Common::Error VoyeurEngine::run() {
 	ESP_Init();
 
+	globalInitBolt();
+	_eventManager.resetMouse();
+
+	//doHeadTitle();
+
 	return Common::kNoError;
 }
 
+
 int VoyeurEngine::getRandomNumber(int maxNumber) {
 	return _randomSource.getRandomNumber(maxNumber);
 }
 
-void VoyeurEngine::ESP_Init() {
+void VoyeurEngine::initialiseManagers() {
 	_eventManager.setVm(this);
+}
+
+void VoyeurEngine::ESP_Init() {
+}
+
+void VoyeurEngine::globalInitBolt() {
+	_filesManager.openBOLTLib("buoy.blt", _bVoyBoltFile);
 
-	_eventManager.resetMouse();
 
 }
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 627f7d8..8b5eb75 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -24,6 +24,8 @@
 #define VOYEUR_VOYEUR_H
 
 #include "voyeur/events.h"
+#include "voyeur/files.h"
+#include "voyeur/graphics.h"
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "common/error.h"
@@ -60,8 +62,14 @@ private:
 	const VoyeurGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
 	EventManager _eventManager;
+	FilesManager _filesManager;
+	GraphicsManager _graphicsManager;
+
+	BoltFile *_bVoyBoltFile;
 
 	void ESP_Init();
+	void initialiseManagers();
+	void globalInitBolt();
 protected:
 	// Engine APIs
 	virtual Common::Error run();


Commit: 4b638bc4b05ce42432979b8b06ad0afac31142a7
    https://github.com/scummvm/scummvm/commit/4b638bc4b05ce42432979b8b06ad0afac31142a7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-20T18:18:40-07:00

Commit Message:
VOYEUR: Further work on bolt file loading

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 4480f48..fa3d27e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -28,7 +28,7 @@ FilesManager::FilesManager() {
 	_decompressSize = 0x7000;
 }
 
-bool FilesManager::openBOLTLib(const Common::String &filename, BoltFile *&boltFile) {
+bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFile) {
 	if (boltFile != NULL) {
 		_curLibPtr = boltFile;
 		return true;
@@ -46,11 +46,14 @@ bool FilesManager::openBOLTLib(const Common::String &filename, BoltFile *&boltFi
 
 BoltFile *BoltFile::_curLibPtr = NULL;
 BoltGroup *BoltFile::_curGroupPtr = NULL;
+BoltEntry *BoltFile::_curMemberPtr = NULL;
 byte *BoltFile::_curMemInfoPtr = NULL;
 int BoltFile::_fromGroupFlag = 0;
+byte BoltFile::_xorMask = 0;
+bool BoltFile::_encrypt = false;
 
 BoltFile::BoltFile() {
-	if (!_curFd.open("buoy.blt"))
+	if (!_curFd.open("bvoy.blt"))
 		error("Could not open buoy.blt");
 	_curFilePosition = 0;
 
@@ -63,7 +66,7 @@ BoltFile::BoltFile() {
 
 	int totalGroups = header[11] ? header[11] : 0x100;
 	for (int i = 0; i < totalGroups; ++i)
-		_groups.push_back(BoltGroup(_curFd.readStream(_curFd.size())));
+		_groups.push_back(BoltGroup(_curFd)));
 }
 
 BoltFile::~BoltFile() {
@@ -104,6 +107,40 @@ bool BoltFile::getBoltGroup(uint32 id) {
 	return true;
 }
 
+byte *BoltFile::memberAddr(uint32 id) {
+	BoltGroup &group = _groups[id >> 8];
+	if (!group._loaded)
+		return NULL;
+
+	return group._entries[id & 0xff]._data;
+}
+
+byte *BoltFile::getBoltMember(uint32 id) {
+	_curLibPtr = this;
+
+	// Get the group, and load it's entry list if not already loaded
+	_curGroupPtr = &_groups[(id >> 8) & 0xff << 4];
+	if (!_curGroupPtr->_loaded)
+		_curGroupPtr->load();
+
+	// Get the entry
+	_curMemberPtr = &_curGroupPtr->_entries[id & 0xff];
+	if (_curMemberPtr->_field1)
+		initMem(_curMemberPtr->_field1);
+
+	// Return the data for the entry if it's already been loaded
+	if (_curMemberPtr->_data)
+		return _curMemberPtr->_data;
+
+	_xorMask = _curMemberPtr->_xorMask;
+	_encrypt = (_curMemberPtr->_mode & 0x10) != 0;
+
+	if (_curGroupPtr->_loaded) {
+
+	}
+	//TODO
+}
+
 /*------------------------------------------------------------------------*/
 
 BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
@@ -114,7 +151,7 @@ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 	_file->read(&buffer[0], BOLT_GROUP_SIZE);
 	_loaded = false;
 	_callInitGro = buffer[1] != 0;
-	_count = buffer[3];
+	_count = buffer[3] ? buffer[3] : 256;	// TODO: Added this in. Check it's okay
 	_fileOffset = READ_LE_UINT32(&buffer[8]);
 }
 
@@ -128,16 +165,30 @@ void BoltGroup::load() {
 	int count = _count ? _count : 256;
 	for (int i = 0; i < count; ++i)
 		_entries.push_back(BoltEntry(_file));
+
+	_loaded = true;
 }
 
 /*------------------------------------------------------------------------*/
 
 BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
-	
+	_data = NULL;
+
+	byte buffer[16];
+	_file->read(&buffer[0], 16);
+	_mode = buffer[0];
+	_field1 = buffer[1];
+	_field3 = buffer[3];
+	_xorMask = buffer[4] & 0xff;	// TODO: Is this right??
+	_size = READ_LE_UINT32(&buffer[4]);
+	_fileOffset = READ_LE_UINT32(&buffer[8]); 
 }
 
-void BoltEntry::load() {
+BoltEntry::~BoltEntry() {
+	delete[] _data;
+}
 
+void BoltEntry::load() {
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 1db1fdf..381ba20 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -37,27 +37,32 @@ class BoltFile {
 private:
 	static BoltFile *_curLibPtr;
 	static BoltGroup *_curGroupPtr;
+	static BoltEntry *_curMemberPtr;
 	static byte *_curMemInfoPtr;
 	static int _fromGroupFlag;
+	static byte _xorMask;
+	static bool _encrypt;
 private:
 	Common::File _curFd;
 	int _curFilePosition;
 	Common::Array<BoltGroup> _groups;
 private:
-	bool getBoltGroup(uint32 id);
 	void resolveAll() {}
-	byte *getBoltMember(uint32 id) { return NULL; }
-public:
-	BoltFile();
-	~BoltFile();
+	byte *getBoltMember(uint32 id);
 
 	// Methods copied into bolt virtual table
 	void initType() {}
 	void termType() {}
-	void initMem() {}
+	void initMem(int id) {}
 	void termMem() {}
 	void initGro() {}
 	void termGro() {}
+public:
+	BoltFile();
+	~BoltFile();
+
+	bool getBoltGroup(uint32 id);
+	byte *memberAddr(uint32 id);
 };
 
 class BoltGroup {
@@ -81,9 +86,16 @@ class BoltEntry {
 private:
 	Common::SeekableReadStream *_file;
 public:
+	byte _mode;
+	byte _field1;
+	byte _field3;
 	int _fileOffset;
+	byte _xorMask;
+	int _size;
+	byte *_data;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
+	virtual ~BoltEntry();
 
 	void load();
 };
@@ -96,8 +108,7 @@ public:
 public:
 	FilesManager();
 
-	bool openBOLTLib(const Common::String &filename, BoltFile *&boltFile);
-
+	bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index dc3fcb2..256a642 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -96,8 +96,10 @@ void VoyeurEngine::ESP_Init() {
 }
 
 void VoyeurEngine::globalInitBolt() {
-	_filesManager.openBOLTLib("buoy.blt", _bVoyBoltFile);
-
+	_filesManager.openBoltLib("bvoy.blt", _bVoyBoltFile);
+	_bVoyBoltFile->getBoltGroup(0x10000);
+	_bVoyBoltFile->getBoltGroup(0x10100);
+	_fontPtr = _bVoyBoltFile->memberAddr(0x101);
 
 }
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 8b5eb75..fb30359 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,6 +66,7 @@ private:
 	GraphicsManager _graphicsManager;
 
 	BoltFile *_bVoyBoltFile;
+	byte *_fontPtr;
 
 	void ESP_Init();
 	void initialiseManagers();


Commit: bff4076093554700e94c4db74a47adabb5f7c74e
    https://github.com/scummvm/scummvm/commit/bff4076093554700e94c4db74a47adabb5f7c74e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-20T20:19:12-07:00

Commit Message:
VOYEUR: Fixes for loading group index

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index fa3d27e..d6df3aa 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -66,7 +66,7 @@ BoltFile::BoltFile() {
 
 	int totalGroups = header[11] ? header[11] : 0x100;
 	for (int i = 0; i < totalGroups; ++i)
-		_groups.push_back(BoltGroup(_curFd)));
+		_groups.push_back(BoltGroup(&_curFd));
 }
 
 BoltFile::~BoltFile() {
@@ -90,16 +90,14 @@ bool BoltFile::getBoltGroup(uint32 id) {
 	if (_curGroupPtr->_callInitGro)
 		initGro();
 
-	if ((id >> 16) == 0) {
-		if (!_curGroupPtr->_loaded) {
-			_curGroupPtr->load();
-		} else {
-			id &= 0xff00;
-			for (int idx = 0; idx < count; ++idx, ++id) {
-				byte *member = getBoltMember(id);
-				assert(member);
-			}
+	if ((id >> 16) != 0) {
+		id &= 0xff00;
+		for (int idx = 0; idx < count; ++idx, ++id) {
+			byte *member = getBoltMember(id);
+			assert(member);
 		}
+	} else if (!_curGroupPtr->_loaded) {
+		_curGroupPtr->load();
 	}
 
 	resolveAll();
@@ -139,6 +137,8 @@ byte *BoltFile::getBoltMember(uint32 id) {
 
 	}
 	//TODO
+
+	return NULL;
 }
 
 /*------------------------------------------------------------------------*/
@@ -158,12 +158,8 @@ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 void BoltGroup::load() {
 	_file->seek(_fileOffset);
 
-	byte header[4];
-	_file->read(&header[0], 4);
-
 	// Read the entries
-	int count = _count ? _count : 256;
-	for (int i = 0; i < count; ++i)
+	for (int i = 0; i < _count; ++i)
 		_entries.push_back(BoltEntry(_file));
 
 	_loaded = true;


Commit: a52dffb3156220ed8ae7497b0273da0386bb335e
    https://github.com/scummvm/scummvm/commit/a52dffb3156220ed8ae7497b0273da0386bb335e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-21T19:07:17-07:00

Commit Message:
VOYEUR: Implemented code for default decompression

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index d6df3aa..6c4e824 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -51,6 +51,22 @@ byte *BoltFile::_curMemInfoPtr = NULL;
 int BoltFile::_fromGroupFlag = 0;
 byte BoltFile::_xorMask = 0;
 bool BoltFile::_encrypt = false;
+int BoltFile::_curFilePosition = 0;
+int BoltFile::_bufferEnd = 0;
+int BoltFile::_bufferBegin = 0;
+int BoltFile::_bytesLeft = 0;
+int BoltFile::_bufSize = 0;
+byte *BoltFile::_bufP = NULL;
+byte *BoltFile::_bufStart = NULL;
+byte *BoltFile::_bufPos = NULL;
+byte BoltFile::_decompressBuf[512];
+int BoltFile::_historyIndex;
+byte BoltFile::_historyBuffer[0x200];
+int BoltFile::_runLength;
+int BoltFile::_decompState;
+int BoltFile::_runType;
+int BoltFile::_runValue;
+int BoltFile::_runOffset;
 
 BoltFile::BoltFile() {
 	if (!_curFd.open("bvoy.blt"))
@@ -79,11 +95,8 @@ bool BoltFile::getBoltGroup(uint32 id) {
 	_curGroupPtr = &_groups[(id >> 8) & 0xff];
 	int count = _curGroupPtr->_count ? _curGroupPtr->_count : 256;
 
-	if (_curGroupPtr->_groupPtr) {
-		// Group already loaded
-		_curMemInfoPtr = _curGroupPtr->_groupPtr;
-	} else {
-		// Load the group
+	if (!_curGroupPtr->_loaded) {
+		// Load the group index
 		_curGroupPtr->load();
 	}
 
@@ -96,7 +109,8 @@ bool BoltFile::getBoltGroup(uint32 id) {
 			byte *member = getBoltMember(id);
 			assert(member);
 		}
-	} else if (!_curGroupPtr->_loaded) {
+	} else if (!_curGroupPtr->_processed) {
+		_curGroupPtr->_processed = true;
 		_curGroupPtr->load();
 	}
 
@@ -133,23 +147,154 @@ byte *BoltFile::getBoltMember(uint32 id) {
 	_xorMask = _curMemberPtr->_xorMask;
 	_encrypt = (_curMemberPtr->_mode & 0x10) != 0;
 
-	if (_curGroupPtr->_loaded) {
+	if (_curGroupPtr->_processed) {
+		// TODO: Figure out weird access type. Uncompressed read perhaps?
+		//int fileDiff = _curGroupPtr->_fileOffset - _curMemberPtr->_fileOffset;
+
+	} else {
+		_bufStart = _decompressBuf;
+		_bufSize = DECOMPRESS_SIZE;
+
+		if (_curMemberPtr->_fileOffset < _bufferBegin || _curMemberPtr->_fileOffset >= _bufferEnd) {
+			_bytesLeft = 0;
+			_bufPos = _bufStart;
+			_bufferBegin = -1;
+			_bufferEnd = _curMemberPtr->_fileOffset;
+		} else {
+			_bufPos = _curMemberPtr->_fileOffset + _bufferBegin + _bufStart;
+			_bufSize = ((_bufPos - _bufStart) << 16) >> 16; // TODO: Validate this
+			_bytesLeft = _bufSize;
+		}
 
+		_decompState = 0;
+		_historyIndex = 0;
+		initType();
 	}
 	//TODO
 
 	return NULL;
 }
 
+void BoltFile::initType() {
+	_curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode);
+}
+
+#define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
+
+byte *BoltFile::decompress(byte *buf, int size, int mode) {
+	if (buf)
+		buf = new byte[size];
+	byte *bufP = buf;
+
+	if (mode & 8) {
+		_decompState = 1;
+		_runType = 0;
+		_runLength = size;
+	}
+
+	while (size > 0) {
+		if (!_decompState) {
+			NEXT_BYTE;
+			byte nextByte = *_bufPos++;
+
+			switch (nextByte & 0xC0) {
+			case 0:
+				_runType = 0;
+				_runLength = 30 - (nextByte & 0x1f) + 1;
+				break;
+			case 0x40:
+				_runType = 1;
+				_runLength = 35 - (nextByte & 0x1f);
+				NEXT_BYTE;
+				_runOffset = *_bufPos++ + ((nextByte & 0x20) << 3);
+				break;
+			case 0x80:
+				_runType = 1;
+				_runLength = (nextByte & 0x20) ? ((32 - (nextByte & 0x1f)) << 2) + 2 :
+					(32 - (nextByte & 0x1f)) << 2;
+				NEXT_BYTE;
+				_runOffset = *_bufPos++ << 1;
+				break;
+			default:
+				_runType = 2;
+
+				if (nextByte & 0x20) {
+					_runLength = 0;
+				} else {
+					NEXT_BYTE;
+					_runLength = ((32 - (nextByte & 0x1f)) + (*_bufPos++ << 5)) << 2;
+					NEXT_BYTE;
+					_bufPos++;
+					NEXT_BYTE;
+					_runValue = *_bufPos++;
+				}
+				break;
+			}
+
+			_runOffset = _historyIndex - _runOffset;
+		}
+
+		int runOffset = _runOffset & 0x1ff;
+		int len;
+		if (_runLength <= size) {
+			len = _runLength;
+			_decompState = 0;
+		} else {
+			_decompState = 1;
+			_runLength = len = size;
+			if (_runType == 1)
+				_runOffset += len;
+		}
+
+		// Handle the run lengths
+		switch (_runType) {
+		case 0:
+			while (len-- > 0) {
+				NEXT_BYTE;
+				_historyBuffer[_historyIndex] = *_bufPos++;
+				_historyIndex = (_historyIndex + 1) & 0x1ff;
+			}
+			break;
+		case 1:
+			while (len-- > 0) {
+				_historyBuffer[_historyIndex] = _historyBuffer[runOffset];
+				*bufP++ = _historyBuffer[runOffset];
+				_historyIndex = (_historyIndex + 1) & 0x1ff;
+			}
+			break;
+		default:
+			while (len-- > 0) {
+				_historyBuffer[_historyIndex] = _runValue;
+				_historyIndex = (_historyIndex + 1) & 0x1ff;
+			}
+			break;
+		}
+	}
+
+	return buf;
+}
+
+void BoltFile::nextBlock() {
+	if (_curFilePosition != _bufferEnd)
+		_curFd.seek(_bufferEnd);
+
+	_bufferBegin = _curFilePosition;
+	int bytesRead = _curFd.read(_bufStart, _bufSize);
+
+	_bufferEnd = _curFilePosition = _bufferBegin + bytesRead;
+	_bytesLeft -= bytesRead;
+	_bufPos = _bufStart;
+}
+
 /*------------------------------------------------------------------------*/
 
 BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 	byte buffer[BOLT_GROUP_SIZE];
 
-	_groupPtr = NULL;
+	_loaded = false;
 
 	_file->read(&buffer[0], BOLT_GROUP_SIZE);
-	_loaded = false;
+	_processed = buffer[0] != 0;
 	_callInitGro = buffer[1] != 0;
 	_count = buffer[3] ? buffer[3] : 256;	// TODO: Added this in. Check it's okay
 	_fileOffset = READ_LE_UINT32(&buffer[8]);
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 381ba20..3b38dcc 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -32,6 +32,7 @@ namespace Voyeur {
 class VoyeurEngine;
 class BoltGroup;
 class BoltEntry;
+#define DECOMPRESS_SIZE 512
 
 class BoltFile {
 private:
@@ -42,16 +43,36 @@ private:
 	static int _fromGroupFlag;
 	static byte _xorMask;
 	static bool _encrypt;
+	// TODO: Move decompression statics and methods into BoltEntry
+	static int _curFilePosition;
+	static int _bufferEnd;
+	static int _bufferBegin;
+	static int _bytesLeft;
+	static int _bufSize;
+	static byte *_bufP;
+	static byte *_bufStart;
+	static byte *_bufPos;
+	static byte _decompressBuf[DECOMPRESS_SIZE];
+	static int _historyIndex;
+	static byte _historyBuffer[0x200];
+	static int _runLength;
+	static int _decompState;
+	static int _runType;
+	static int _runValue;
+	static int _runOffset;
 private:
 	Common::File _curFd;
-	int _curFilePosition;
 	Common::Array<BoltGroup> _groups;
+
+	// Decompression
+	byte *decompress(byte *buf, int size, int mode);
+	void nextBlock();
 private:
 	void resolveAll() {}
 	byte *getBoltMember(uint32 id);
 
 	// Methods copied into bolt virtual table
-	void initType() {}
+	void initType();
 	void termType() {}
 	void initMem(int id) {}
 	void termMem() {}
@@ -69,11 +90,11 @@ class BoltGroup {
 private:
 	Common::SeekableReadStream *_file;
 public:
-	bool _loaded;
+	byte _loaded;
+	bool _processed;
 	bool _callInitGro;
 	int _count;
 	int _fileOffset;
-	byte *_groupPtr;
 	Common::Array<BoltEntry> _entries;
 public:
 	BoltGroup(Common::SeekableReadStream *f); 


Commit: ca0eb9bd758e35b52f64eb84d225c2b0ffe3f921
    https://github.com/scummvm/scummvm/commit/ca0eb9bd758e35b52f64eb84d225c2b0ffe3f921
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-21T20:15:43-07:00

Commit Message:
VOYEUR: Some initial bugfixes for resource decompression

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 6c4e824..472d690 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -59,7 +59,7 @@ int BoltFile::_bufSize = 0;
 byte *BoltFile::_bufP = NULL;
 byte *BoltFile::_bufStart = NULL;
 byte *BoltFile::_bufPos = NULL;
-byte BoltFile::_decompressBuf[512];
+byte BoltFile::_decompressBuf[DECOMPRESS_SIZE];
 int BoltFile::_historyIndex;
 byte BoltFile::_historyBuffer[0x200];
 int BoltFile::_runLength;
@@ -278,11 +278,11 @@ void BoltFile::nextBlock() {
 	if (_curFilePosition != _bufferEnd)
 		_curFd.seek(_bufferEnd);
 
-	_bufferBegin = _curFilePosition;
+	_bufferBegin = _bufferEnd;
 	int bytesRead = _curFd.read(_bufStart, _bufSize);
 
 	_bufferEnd = _curFilePosition = _bufferBegin + bytesRead;
-	_bytesLeft -= bytesRead;
+	_bytesLeft = bytesRead - 1;
 	_bufPos = _bufStart;
 }
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 3b38dcc..b481a08 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -32,7 +32,7 @@ namespace Voyeur {
 class VoyeurEngine;
 class BoltGroup;
 class BoltEntry;
-#define DECOMPRESS_SIZE 512
+#define DECOMPRESS_SIZE 0x7000
 
 class BoltFile {
 private:


Commit: 7c85f94a57e74cdac6193db043fc9233f3fa6905
    https://github.com/scummvm/scummvm/commit/7c85f94a57e74cdac6193db043fc9233f3fa6905
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-21T21:00:47-07:00

Commit Message:
VOYEUR: First group's members are now successfully decompressed

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 472d690..7d6a11e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -56,7 +56,6 @@ int BoltFile::_bufferEnd = 0;
 int BoltFile::_bufferBegin = 0;
 int BoltFile::_bytesLeft = 0;
 int BoltFile::_bufSize = 0;
-byte *BoltFile::_bufP = NULL;
 byte *BoltFile::_bufStart = NULL;
 byte *BoltFile::_bufPos = NULL;
 byte BoltFile::_decompressBuf[DECOMPRESS_SIZE];
@@ -165,14 +164,13 @@ byte *BoltFile::getBoltMember(uint32 id) {
 			_bufSize = ((_bufPos - _bufStart) << 16) >> 16; // TODO: Validate this
 			_bytesLeft = _bufSize;
 		}
-
-		_decompState = 0;
-		_historyIndex = 0;
-		initType();
 	}
-	//TODO
 
-	return NULL;
+	_decompState = 0;
+	_historyIndex = 0;
+	initType();
+
+	return _curMemberPtr->_data;
 }
 
 void BoltFile::initType() {
@@ -182,7 +180,7 @@ void BoltFile::initType() {
 #define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
 
 byte *BoltFile::decompress(byte *buf, int size, int mode) {
-	if (buf)
+	if (!buf)
 		buf = new byte[size];
 	byte *bufP = buf;
 
@@ -246,6 +244,9 @@ byte *BoltFile::decompress(byte *buf, int size, int mode) {
 				_runOffset += len;
 		}
 
+		// Reduce the remaining size
+		size -= len;
+
 		// Handle the run lengths
 		switch (_runType) {
 		case 0:
@@ -265,6 +266,7 @@ byte *BoltFile::decompress(byte *buf, int size, int mode) {
 		default:
 			while (len-- > 0) {
 				_historyBuffer[_historyIndex] = _runValue;
+				*bufP++ = _runValue;
 				_historyIndex = (_historyIndex + 1) & 0x1ff;
 			}
 			break;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index b481a08..ed20528 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -49,7 +49,6 @@ private:
 	static int _bufferBegin;
 	static int _bytesLeft;
 	static int _bufSize;
-	static byte *_bufP;
 	static byte *_bufStart;
 	static byte *_bufPos;
 	static byte _decompressBuf[DECOMPRESS_SIZE];


Commit: d4a137528f17ef16d0d1ff703afcdfa7c71172ed
    https://github.com/scummvm/scummvm/commit/d4a137528f17ef16d0d1ff703afcdfa7c71172ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-22T04:43:26-07:00

Commit Message:
VOEYUR: Now the font data pointer loads correctly

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 7d6a11e..ca54a89 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -92,7 +92,6 @@ bool BoltFile::getBoltGroup(uint32 id) {
 	++_fromGroupFlag;
 	_curLibPtr = this;
 	_curGroupPtr = &_groups[(id >> 8) & 0xff];
-	int count = _curGroupPtr->_count ? _curGroupPtr->_count : 256;
 
 	if (!_curGroupPtr->_loaded) {
 		// Load the group index
@@ -104,7 +103,7 @@ bool BoltFile::getBoltGroup(uint32 id) {
 
 	if ((id >> 16) != 0) {
 		id &= 0xff00;
-		for (int idx = 0; idx < count; ++idx, ++id) {
+		for (int idx = 0; idx < _curGroupPtr->_count; ++idx, ++id) {
 			byte *member = getBoltMember(id);
 			assert(member);
 		}
@@ -130,7 +129,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
 	_curLibPtr = this;
 
 	// Get the group, and load it's entry list if not already loaded
-	_curGroupPtr = &_groups[(id >> 8) & 0xff << 4];
+	_curGroupPtr = &_groups[(id >> 8) & 0xff];
 	if (!_curGroupPtr->_loaded)
 		_curGroupPtr->load();
 


Commit: 71d2b5008de98bd94fc439cdda7ba8f8f13e760e
    https://github.com/scummvm/scummvm/commit/71d2b5008de98bd94fc439cdda7ba8f8f13e760e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-22T05:29:24-07:00

Commit Message:
VOYEUR: Finished globalInitBolt method

Changed paths:
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 008b014..4763a2d 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -24,4 +24,8 @@
 
 namespace Voyeur {
 
+GraphicsManager::GraphicsManager() {
+	_palFlag = false;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index f1b568e..bac4787 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -30,7 +30,11 @@ namespace Voyeur {
 
 class GraphicsManager {
 public:
-	GraphicsManager() {}
+	bool _palFlag;
+public:
+	GraphicsManager();
+
+	void addFadeInt() { } // TODO;
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 256a642..d20a916 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -101,6 +101,18 @@ void VoyeurEngine::globalInitBolt() {
 	_bVoyBoltFile->getBoltGroup(0x10100);
 	_fontPtr = _bVoyBoltFile->memberAddr(0x101);
 
+	// Setup default flags
+	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
+	_voy._eCursorOff[0x74 / 2] = 1;
+	_voy._eCursorOff[0x68 / 2] = 0;
+	_voy._eventTable[0x3e6]._data3 = 63;
+	_voy._eventTable[0x3e6]._data4 = 63;
+	_voy._evidence[19] = 0;
+	_voy._evidence[17] = 0;
+	_voy._evidence[18] = 9999;
+	
+	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90;
+	_graphicsManager.addFadeInt();
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index fb30359..a930c5d 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -57,6 +57,73 @@ enum VoyeurDebugChannels {
 
 struct VoyeurGameDescription;
 
+class Event {
+public:
+	int _hours;
+	int _minutes;
+	int _seconds;
+	int _type;
+	int _data1;
+	int _data2;
+	int _data3;
+	int _data4;
+};
+
+class SVoy {
+public:
+	int _delaySecs;
+	int _RTANum;
+	int _RTVNum;
+	int _switchBGNum;
+	int _group;
+	int _resolvePtr;
+	int _seconds;
+	int _minutes;
+	int _hours;
+	int _morning;
+	int _timeChangeFlag;
+	int _totalSeconds;
+	int _gameSeconds;
+	int _vCursorOn[160];
+	int _vCursorOff[160];
+	int _aCursorOn[60];
+	int _aCursorOff[60];
+	int _eCursorOn[60];
+	int _eCursorOff[60];
+	int _timeStart;
+	int _duration;
+	int _vidStart;
+	int _doApt;
+	int _function;
+	int _anim;
+	int _level;
+	int _levelDone;
+	int _flags;
+	int _evGroup;
+	byte *_evPicPtrs[6];
+	byte *_evCmPtrs[6];
+	int _audioTime;
+	int _phones[5];
+	int _numPhonesUsed;
+	int _evidence[20];
+	int _computerNum;
+	int _computerBut;
+	int _computerOn;
+	int _computerOff;
+	int _dead;
+	int _deadTime;
+	int _eventCnt;
+	Event _eventTable[1000];
+	int _curICF0;
+	int _curICF1;
+	int _fadeICF0;
+	int _fadeICF1;
+	int _fadeFunc;
+	int _lastInplay;
+	int _incriminate;
+	int _policeEvent;
+};
+
 class VoyeurEngine : public Engine {
 private:
 	const VoyeurGameDescription *_gameDescription;
@@ -67,6 +134,7 @@ private:
 
 	BoltFile *_bVoyBoltFile;
 	byte *_fontPtr;
+	SVoy _voy;
 
 	void ESP_Init();
 	void initialiseManagers();


Commit: 0d26e515fb89a2a61c16eb3bb5b2e9f544dc4aff
    https://github.com/scummvm/scummvm/commit/0d26e515fb89a2a61c16eb3bb5b2e9f544dc4aff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-23T06:13:28-07:00

Commit Message:
VOYEUR: Start of work on general initialisation

Changed paths:
  A engines/voyeur/game.cpp
  A engines/voyeur/game.h
    engines/voyeur/events.h
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 5715591..1588cac 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -24,7 +24,6 @@
 #define VOYEUR_EVENTS_H
 
 #include "common/scummsys.h"
-#include "common/events.h"
 
 namespace Voyeur {
 
@@ -42,4 +41,4 @@ public:
 
 } // End of namespace Voyeur
 
-#endif /* VOYEUR_VOYEUR_H */
+#endif /* VOYEUR_EVENTS_H */
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index ed20528..1503ddf 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -133,4 +133,4 @@ public:
 
 } // End of namespace Voyeur
 
-#endif /* VOYEUR_VOYEUR_H */
+#endif /* VOYEUR_FILES_H */
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
new file mode 100644
index 0000000..3d80b60
--- /dev/null
+++ b/engines/voyeur/game.cpp
@@ -0,0 +1,31 @@
+/* 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 "voyeur/game.h"
+
+namespace Voyeur {
+
+void IntData::audioInit() {
+
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
new file mode 100644
index 0000000..44d8c05
--- /dev/null
+++ b/engines/voyeur/game.h
@@ -0,0 +1,109 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_GAME_H
+#define VOYEUR_GAME_H
+
+#include "common/scummsys.h"
+#include "common/events.h"
+
+namespace Voyeur {
+
+class VoyeurEngine;
+
+class Event {
+public:
+	int _hours;
+	int _minutes;
+	int _seconds;
+	int _type;
+	int _data1;
+	int _data2;
+	int _data3;
+	int _data4;
+};
+
+class SVoy {
+public:
+	int _delaySecs;
+	int _RTANum;
+	int _RTVNum;
+	int _switchBGNum;
+	int _group;
+	int _resolvePtr;
+	int _seconds;
+	int _minutes;
+	int _hours;
+	int _morning;
+	int _timeChangeFlag;
+	int _totalSeconds;
+	int _gameSeconds;
+	int _vCursorOn[160];
+	int _vCursorOff[160];
+	int _aCursorOn[60];
+	int _aCursorOff[60];
+	int _eCursorOn[60];
+	int _eCursorOff[60];
+	int _timeStart;
+	int _duration;
+	int _vidStart;
+	int _doApt;
+	int _function;
+	int _anim;
+	int _level;
+	int _levelDone;
+	int _flags;
+	int _evGroup;
+	byte *_evPicPtrs[6];
+	byte *_evCmPtrs[6];
+	int _audioTime;
+	int _phones[5];
+	int _numPhonesUsed;
+	int _evidence[20];
+	int _computerNum;
+	int _computerBut;
+	int _computerOn;
+	int _computerOff;
+	int _dead;
+	int _deadTime;
+	int _eventCnt;
+	Event _eventTable[1000];
+	int _curICF0;
+	int _curICF1;
+	int _fadeICF0;
+	int _fadeICF1;
+	int _fadeFunc;
+	int _lastInplay;
+	int _incriminate;
+	int _policeEvent;
+};
+
+class IntData {
+public:
+	byte *_colors;
+public:
+	void audioInit();
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_GAME_H */
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 4763a2d..311199c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -21,6 +21,8 @@
  */
 
 #include "voyeur/graphics.h"
+#include "engines/util.h"
+#include "graphics/surface.h"
 
 namespace Voyeur {
 
@@ -28,4 +30,49 @@ GraphicsManager::GraphicsManager() {
 	_palFlag = false;
 }
 
+void GraphicsManager::sInitGraphics() {
+	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false);
+}
+
+void GraphicsManager::addFadeInt() {
+	_fadeIntNode._intFunc = fadeIntFunc;
+	_fadeIntNode._flags = 0;
+	_fadeIntNode._curTime = 0;
+	_fadeIntNode._timeReset = 1;
+	
+	addIntNode(&_fadeIntNode);
+}
+
+void GraphicsManager::vInitColor() {
+	_fadeIntNode._intFunc = vDoFadeInt;
+	_cycleIntNode._intFunc = vDoCycleInt;
+
+}
+
+void GraphicsManager::addIntNode(IntNode *node) {
+	
+}
+
+void GraphicsManager::fadeIntFunc() {
+
+}
+
+void GraphicsManager::vDoFadeInt() {
+	
+}
+
+void GraphicsManager::vDoCycleInt() {
+
+}
+
+/*------------------------------------------------------------------------*/
+
+IntNode::IntNode() {
+	_nextNode = NULL;
+	_intFunc = NULL;
+	_curTime = 0;
+	_timeReset = 0;
+	_flags = 0;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index bac4787..7589e8f 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -24,19 +24,51 @@
 #define VOYEUR_GRAPHICS_H
 
 #include "common/scummsys.h"
+#include "common/array.h"
 #include "graphics/surface.h"
 
 namespace Voyeur {
 
+#define SCREEN_WIDTH 320
+#define SCREEN_HEIGHT 200
+#define PALETTE_COUNT 256
+#define PALETTE_SIZE (256 * 3)
+
+typedef void (*IntFuncPtr)();
+
+class IntNode {
+public:
+	IntNode *_nextNode;
+	IntFuncPtr _intFunc;
+	uint32 _curTime;
+	uint32 _timeReset;
+	uint32 _flags;
+public:
+	IntNode();
+};
+
 class GraphicsManager {
+private:
+	static void fadeIntFunc();
+	static void vDoFadeInt();
+	static void vDoCycleInt();
+	void addIntNode(IntNode *node);
 public:
 	bool _palFlag;
+	IntNode _fadeIntNode;
+	IntNode _cycleIntNode;
+	IntNode _evintnode;
+	IntNode _mainintnode;
+	byte _VGAColors[PALETTE_SIZE];
+	Common::Array<byte *> _colorChain;
 public:
 	GraphicsManager();
+	void sInitGraphics();
 
-	void addFadeInt() { } // TODO;
+	void addFadeInt();
+	void vInitColor();
 };
 
 } // End of namespace Voyeur
 
-#endif /* VOYEUR_VOYEUR_H */
+#endif /* VOYEUR_GRAPHICS_H */
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 24984cd..b13c414 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/voyeur
 MODULE_OBJS := \
 	detection.o \
 	events.o \
+	game.o \
 	files.o \
 	graphics.o \
 	voyeur.o
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index d20a916..99671f6 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "voyeur/voyeur.h"
+#include "voyeur/graphics.h"
 #include "common/scummsys.h"
 #include "common/config-manager.h"
 #include "common/debug-channels.h"
@@ -74,8 +75,8 @@ Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc)
 
 Common::Error VoyeurEngine::run() {
 	ESP_Init();
-
 	globalInitBolt();
+
 	_eventManager.resetMouse();
 
 	//doHeadTitle();
@@ -96,6 +97,8 @@ void VoyeurEngine::ESP_Init() {
 }
 
 void VoyeurEngine::globalInitBolt() {
+	initBolt();
+
 	_filesManager.openBoltLib("bvoy.blt", _bVoyBoltFile);
 	_bVoyBoltFile->getBoltGroup(0x10000);
 	_bVoyBoltFile->getBoltGroup(0x10100);
@@ -115,4 +118,18 @@ void VoyeurEngine::globalInitBolt() {
 	_graphicsManager.addFadeInt();
 }
 
+void VoyeurEngine::initBolt() {
+	vInitInterrupts();
+	_graphicsManager.sInitGraphics();
+	_graphicsManager.vInitColor();
+	initInput();
+}
+
+void VoyeurEngine::vInitInterrupts() {
+	_intPtr._colors = &_graphicsManager._VGAColors[0];
+}
+
+void VoyeurEngine::initInput() {
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index a930c5d..e2092b3 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -25,6 +25,7 @@
 
 #include "voyeur/events.h"
 #include "voyeur/files.h"
+#include "voyeur/game.h"
 #include "voyeur/graphics.h"
 #include "common/scummsys.h"
 #include "common/system.h"
@@ -48,8 +49,7 @@ namespace Voyeur {
 #define DEBUG_INTERMEDIATE 2
 #define DEBUG_DETAILED 3
 
-#define SCREEN_WIDTH 320
-#define SCREEN_HEIGHT 200
+#define MAX_RESOLVE 1000
 
 enum VoyeurDebugChannels {
 	kDebugPath      = 1 <<  0
@@ -57,72 +57,6 @@ enum VoyeurDebugChannels {
 
 struct VoyeurGameDescription;
 
-class Event {
-public:
-	int _hours;
-	int _minutes;
-	int _seconds;
-	int _type;
-	int _data1;
-	int _data2;
-	int _data3;
-	int _data4;
-};
-
-class SVoy {
-public:
-	int _delaySecs;
-	int _RTANum;
-	int _RTVNum;
-	int _switchBGNum;
-	int _group;
-	int _resolvePtr;
-	int _seconds;
-	int _minutes;
-	int _hours;
-	int _morning;
-	int _timeChangeFlag;
-	int _totalSeconds;
-	int _gameSeconds;
-	int _vCursorOn[160];
-	int _vCursorOff[160];
-	int _aCursorOn[60];
-	int _aCursorOff[60];
-	int _eCursorOn[60];
-	int _eCursorOff[60];
-	int _timeStart;
-	int _duration;
-	int _vidStart;
-	int _doApt;
-	int _function;
-	int _anim;
-	int _level;
-	int _levelDone;
-	int _flags;
-	int _evGroup;
-	byte *_evPicPtrs[6];
-	byte *_evCmPtrs[6];
-	int _audioTime;
-	int _phones[5];
-	int _numPhonesUsed;
-	int _evidence[20];
-	int _computerNum;
-	int _computerBut;
-	int _computerOn;
-	int _computerOff;
-	int _dead;
-	int _deadTime;
-	int _eventCnt;
-	Event _eventTable[1000];
-	int _curICF0;
-	int _curICF1;
-	int _fadeICF0;
-	int _fadeICF1;
-	int _fadeFunc;
-	int _lastInplay;
-	int _incriminate;
-	int _policeEvent;
-};
 
 class VoyeurEngine : public Engine {
 private:
@@ -135,10 +69,15 @@ private:
 	BoltFile *_bVoyBoltFile;
 	byte *_fontPtr;
 	SVoy _voy;
+	Common::Array<int> _resolves;
+	IntData _intPtr;
 
 	void ESP_Init();
 	void initialiseManagers();
 	void globalInitBolt();
+	void initBolt();
+	void vInitInterrupts();
+	void initInput();
 protected:
 	// Engine APIs
 	virtual Common::Error run();


Commit: 3c6507812eed761c8c357b1bf41b378b6ca3dc9c
    https://github.com/scummvm/scummvm/commit/3c6507812eed761c8c357b1bf41b378b6ca3dc9c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-24T18:54:40-07:00

Commit Message:
VOYEUR: Clean up of IntData usage

Changed paths:
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index 3d80b60..26e5d31 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -28,4 +28,17 @@ void IntData::audioInit() {
 
 }
 
+void IntData::addIntNode(IntNode *node) {
+	_intNodes.push_back(node);
+}
+
+/*------------------------------------------------------------------------*/
+
+IntNode::IntNode() {
+	_intFunc = NULL;
+	_curTime = 0;
+	_timeReset = 0;
+	_flags = 0;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 44d8c05..99f97fd 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -97,11 +97,26 @@ public:
 	int _policeEvent;
 };
 
+typedef void (*IntFuncPtr)();
+
+class IntNode {
+public:
+	IntFuncPtr _intFunc;
+	uint32 _curTime;
+	uint32 _timeReset;
+	uint32 _flags;
+public:
+	IntNode();
+};
+
 class IntData {
 public:
 	byte *_colors;
+	Common::List<IntNode *> _intNodes;
 public:
 	void audioInit();
+	void addIntNode(IntNode *node);
+
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 311199c..4b1e05c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -21,6 +21,8 @@
  */
 
 #include "voyeur/graphics.h"
+#include "voyeur/game.h"
+#include "voyeur/voyeur.h"
 #include "engines/util.h"
 #include "graphics/surface.h"
 
@@ -39,18 +41,14 @@ void GraphicsManager::addFadeInt() {
 	_fadeIntNode._flags = 0;
 	_fadeIntNode._curTime = 0;
 	_fadeIntNode._timeReset = 1;
-	
-	addIntNode(&_fadeIntNode);
+
+	_vm->_intPtr.addIntNode(&_fadeIntNode);
 }
 
 void GraphicsManager::vInitColor() {
 	_fadeIntNode._intFunc = vDoFadeInt;
 	_cycleIntNode._intFunc = vDoCycleInt;
-
-}
-
-void GraphicsManager::addIntNode(IntNode *node) {
-	
+	// TODO: more
 }
 
 void GraphicsManager::fadeIntFunc() {
@@ -65,14 +63,4 @@ void GraphicsManager::vDoCycleInt() {
 
 }
 
-/*------------------------------------------------------------------------*/
-
-IntNode::IntNode() {
-	_nextNode = NULL;
-	_intFunc = NULL;
-	_curTime = 0;
-	_timeReset = 0;
-	_flags = 0;
-}
-
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 7589e8f..d92a6b6 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -23,6 +23,7 @@
 #ifndef VOYEUR_GRAPHICS_H
 #define VOYEUR_GRAPHICS_H
 
+#include "voyeur/game.h"
 #include "common/scummsys.h"
 #include "common/array.h"
 #include "graphics/surface.h"
@@ -34,26 +35,11 @@ namespace Voyeur {
 #define PALETTE_COUNT 256
 #define PALETTE_SIZE (256 * 3)
 
-typedef void (*IntFuncPtr)();
-
-class IntNode {
-public:
-	IntNode *_nextNode;
-	IntFuncPtr _intFunc;
-	uint32 _curTime;
-	uint32 _timeReset;
-	uint32 _flags;
-public:
-	IntNode();
-};
+class VoyeurEngine;
 
 class GraphicsManager {
-private:
-	static void fadeIntFunc();
-	static void vDoFadeInt();
-	static void vDoCycleInt();
-	void addIntNode(IntNode *node);
 public:
+	VoyeurEngine *_vm;
 	bool _palFlag;
 	IntNode _fadeIntNode;
 	IntNode _cycleIntNode;
@@ -61,12 +47,18 @@ public:
 	IntNode _mainintnode;
 	byte _VGAColors[PALETTE_SIZE];
 	Common::Array<byte *> _colorChain;
+private:
+	static void fadeIntFunc();
+	static void vDoFadeInt();
+	static void vDoCycleInt();
+	void addIntNode(IntNode *node);
 public:
 	GraphicsManager();
+	void setVm(VoyeurEngine *vm) { _vm = vm; }
 	void sInitGraphics();
 
-	void addFadeInt();
 	void vInitColor();
+	void addFadeInt();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 99671f6..ac1105e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -91,6 +91,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
 
 void VoyeurEngine::initialiseManagers() {
 	_eventManager.setVm(this);
+	_graphicsManager.setVm(this);
 }
 
 void VoyeurEngine::ESP_Init() {
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index e2092b3..6676b1c 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -70,7 +70,6 @@ private:
 	byte *_fontPtr;
 	SVoy _voy;
 	Common::Array<int> _resolves;
-	IntData _intPtr;
 
 	void ESP_Init();
 	void initialiseManagers();
@@ -82,7 +81,8 @@ protected:
 	// Engine APIs
 	virtual Common::Error run();
 	virtual bool hasFeature(EngineFeature f) const;
-
+public:
+	IntData _intPtr;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();


Commit: aff7c3d9bdd917044a7da4d5919cad9e3a86181d
    https://github.com/scummvm/scummvm/commit/aff7c3d9bdd917044a7da4d5919cad9e3a86181d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-25T06:58:03-07:00

Commit Message:
VOYEUR: Beginnings of Bolt init function array

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index f84172f..2fb4147 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -21,10 +21,22 @@
  */
 
 #include "voyeur/events.h"
+#include "voyeur/voyeur.h"
 
 namespace Voyeur {
 
-void EventManager::resetMouse() {
+void EventsManager::resetMouse() {
+	// No implementation
+}
+
+void EventsManager::startMainClockInt() {
+	_mainIntNode._intFunc = mainVoyeurIntFunc;
+	_mainIntNode._flags = 0;
+	_mainIntNode._curTime = 0;
+	_mainIntNode._timeReset = _vm->_graphicsManager._palFlag ? 50 : 60;
+}
+
+void EventsManager::mainVoyeurIntFunc() {
 
 }
 
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 1588cac..0acdc73 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -24,19 +24,28 @@
 #define VOYEUR_EVENTS_H
 
 #include "common/scummsys.h"
+#include "voyeur/game.h"
 
 namespace Voyeur {
 
 class VoyeurEngine;
 
-class EventManager {
+class EventsManager {
 private:
 	VoyeurEngine *_vm;
+
+	static void mainVoyeurIntFunc();
+public:
+	IntNode _fadeIntNode;
+	IntNode _cycleIntNode;
+	IntNode _evintnode;
+	IntNode _mainIntNode;
 public:
-	EventManager() {}
+	EventsManager() {}
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void resetMouse();
+	void startMainClockInt();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ca54a89..32b8917 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -67,6 +67,16 @@ int BoltFile::_runType;
 int BoltFile::_runValue;
 int BoltFile::_runOffset;
 
+const BoltMethodPtr BoltFile::_fnInitType[25] = {
+	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
+	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
+	&BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl,
+	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort,
+	&BoltFile::initViewPortList, &BoltFile::initDefault, &BoltFile::initFontInfo,
+	&BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
+	&BoltFile::initDefault, &BoltFile::initDefault
+};
+
 BoltFile::BoltFile() {
 	if (!_curFd.open("bvoy.blt"))
 		error("Could not open buoy.blt");
@@ -167,13 +177,12 @@ byte *BoltFile::getBoltMember(uint32 id) {
 
 	_decompState = 0;
 	_historyIndex = 0;
-	initType();
 
-	return _curMemberPtr->_data;
-}
+	// Initialise the resource
+	assert(_curMemberPtr->_initMethod < 25);
+	(this->*_fnInitType[_curMemberPtr->_initMethod])();
 
-void BoltFile::initType() {
-	_curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode);
+	return _curMemberPtr->_data;
 }
 
 #define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
@@ -287,6 +296,38 @@ void BoltFile::nextBlock() {
 	_bufPos = _bufStart;
 }
 
+void BoltFile::initDefault() {
+	_curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode);	
+}
+
+void BoltFile::sInitPic() {
+	error("TODO: sInitPic not implemented");
+}
+
+void BoltFile::vInitCMap() {
+	error("TODO: vInitCMap not implemented");
+}
+
+void BoltFile::vInitCycl() {
+	error("TODO: vInitCycl not implemented");
+}
+
+void BoltFile::initViewPort() {
+	error("TODO: initViewPort not implemented");
+}
+
+void BoltFile::initViewPortList() {
+	error("TODO: initViewPortList not implemented");
+}
+
+void BoltFile::initFontInfo() {
+	error("TODO: initFontInfo not implemented");
+}
+
+void BoltFile::initSoundMap() {
+	error("TODO: initSoundMap not implemented");
+}
+
 /*------------------------------------------------------------------------*/
 
 BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
@@ -320,7 +361,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_file->read(&buffer[0], 16);
 	_mode = buffer[0];
 	_field1 = buffer[1];
-	_field3 = buffer[3];
+	_initMethod = buffer[3];
 	_xorMask = buffer[4] & 0xff;	// TODO: Is this right??
 	_size = READ_LE_UINT32(&buffer[4]);
 	_fileOffset = READ_LE_UINT32(&buffer[8]); 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 1503ddf..095d3ea 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -30,10 +30,13 @@
 namespace Voyeur {
 
 class VoyeurEngine;
+class BoltFile;
 class BoltGroup;
 class BoltEntry;
 #define DECOMPRESS_SIZE 0x7000
 
+typedef void (BoltFile::*BoltMethodPtr)();
+
 class BoltFile {
 private:
 	static BoltFile *_curLibPtr;
@@ -59,10 +62,21 @@ private:
 	static int _runType;
 	static int _runValue;
 	static int _runOffset;
+	static const BoltMethodPtr _fnInitType[25];
 private:
 	Common::File _curFd;
 	Common::Array<BoltGroup> _groups;
 
+	// initType method table
+	void initDefault();
+	void sInitPic();
+	void vInitCMap();
+	void vInitCycl();
+	void initViewPort();
+	void initViewPortList();
+	void initFontInfo();
+	void initSoundMap();
+
 	// Decompression
 	byte *decompress(byte *buf, int size, int mode);
 	void nextBlock();
@@ -70,8 +84,7 @@ private:
 	void resolveAll() {}
 	byte *getBoltMember(uint32 id);
 
-	// Methods copied into bolt virtual table
-	void initType();
+	void initType() {}
 	void termType() {}
 	void initMem(int id) {}
 	void termMem() {}
@@ -108,7 +121,7 @@ private:
 public:
 	byte _mode;
 	byte _field1;
-	byte _field3;
+	byte _initMethod;
 	int _fileOffset;
 	byte _xorMask;
 	int _size;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 4b1e05c..2261b4f 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -37,17 +37,18 @@ void GraphicsManager::sInitGraphics() {
 }
 
 void GraphicsManager::addFadeInt() {
-	_fadeIntNode._intFunc = fadeIntFunc;
-	_fadeIntNode._flags = 0;
-	_fadeIntNode._curTime = 0;
-	_fadeIntNode._timeReset = 1;
+	IntNode &node = _vm->_eventsManager._fadeIntNode;
+	node._intFunc = fadeIntFunc;
+	node._flags = 0;
+	node._curTime = 0;
+	node._timeReset = 1;
 
-	_vm->_intPtr.addIntNode(&_fadeIntNode);
+	_vm->_intPtr.addIntNode(&node);
 }
 
 void GraphicsManager::vInitColor() {
-	_fadeIntNode._intFunc = vDoFadeInt;
-	_cycleIntNode._intFunc = vDoCycleInt;
+	_vm->_eventsManager._fadeIntNode._intFunc = vDoFadeInt;
+	_vm->_eventsManager._cycleIntNode._intFunc = vDoCycleInt;
 	// TODO: more
 }
 
@@ -63,4 +64,26 @@ void GraphicsManager::vDoCycleInt() {
 
 }
 
+void GraphicsManager::setupViewPort() {
+	setupViewPort(&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect, 
+		&GraphicsManager::restoreMCGASaveRect);
+}
+
+void GraphicsManager::setupViewPort(GraphicMethodPtr setupFn, 
+		GraphicMethodPtr addRectFn, GraphicMethodPtr restoreFn) {
+
+}
+
+void GraphicsManager::setupMCGASaveRect() {
+	
+}
+
+void GraphicsManager::restoreMCGASaveRect() {
+
+}
+
+void GraphicsManager::addRectOptSaveRect() {
+
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index d92a6b6..a0f01df 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -36,22 +36,29 @@ namespace Voyeur {
 #define PALETTE_SIZE (256 * 3)
 
 class VoyeurEngine;
+class GraphicsManager;
+
+typedef void (GraphicsManager::*GraphicMethodPtr)(); 
 
 class GraphicsManager {
 public:
 	VoyeurEngine *_vm;
 	bool _palFlag;
-	IntNode _fadeIntNode;
-	IntNode _cycleIntNode;
-	IntNode _evintnode;
-	IntNode _mainintnode;
 	byte _VGAColors[PALETTE_SIZE];
 	Common::Array<byte *> _colorChain;
+	byte *_backgroundPage;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
 	static void vDoCycleInt();
+
+	void setupMCGASaveRect();
+	void restoreMCGASaveRect();
+	void addRectOptSaveRect();
+
 	void addIntNode(IntNode *node);
+	void setupViewPort(GraphicMethodPtr setupFn, GraphicMethodPtr addRectFn, 
+		GraphicMethodPtr restoreFn);
 public:
 	GraphicsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -59,6 +66,7 @@ public:
 
 	void vInitColor();
 	void addFadeInt();
+	void setupViewPort();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index ac1105e..beded3e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -33,11 +33,13 @@ VoyeurEngine *g_vm;
 VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
 		_gameDescription(gameDesc), _randomSource("Voyeur") {
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	_bVoyBoltFile = NULL;
+	_bVoy = NULL;
+
+	initialiseManagers();
 }
 
 VoyeurEngine::~VoyeurEngine() {
-	delete _bVoyBoltFile;
+	delete _bVoy;
 }
 
 Common::String VoyeurEngine::generateSaveName(int slot) {
@@ -77,7 +79,8 @@ Common::Error VoyeurEngine::run() {
 	ESP_Init();
 	globalInitBolt();
 
-	_eventManager.resetMouse();
+	_eventsManager.resetMouse();
+	doHeadTitle();
 
 	//doHeadTitle();
 
@@ -90,7 +93,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
 }
 
 void VoyeurEngine::initialiseManagers() {
-	_eventManager.setVm(this);
+	_eventsManager.setVm(this);
 	_graphicsManager.setVm(this);
 }
 
@@ -100,22 +103,22 @@ void VoyeurEngine::ESP_Init() {
 void VoyeurEngine::globalInitBolt() {
 	initBolt();
 
-	_filesManager.openBoltLib("bvoy.blt", _bVoyBoltFile);
-	_bVoyBoltFile->getBoltGroup(0x10000);
-	_bVoyBoltFile->getBoltGroup(0x10100);
-	_fontPtr = _bVoyBoltFile->memberAddr(0x101);
+	_filesManager.openBoltLib("bvoy.blt", _bVoy);
+	_bVoy->getBoltGroup(0x10000);
+	_bVoy->getBoltGroup(0x10100);
+	_fontPtr = _bVoy->memberAddr(0x101);
 
 	// Setup default flags
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 	_voy._eCursorOff[0x74 / 2] = 1;
 	_voy._eCursorOff[0x68 / 2] = 0;
-	_voy._eventTable[0x3e6]._data3 = 63;
-	_voy._eventTable[0x3e6]._data4 = 63;
+	_voy._eventTable[998]._data3 = 63;
+	_voy._eventTable[998]._data4 = 63;
 	_voy._evidence[19] = 0;
 	_voy._evidence[17] = 0;
 	_voy._evidence[18] = 9999;
 	
-	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90;
+	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
 	_graphicsManager.addFadeInt();
 }
 
@@ -133,4 +136,14 @@ void VoyeurEngine::vInitInterrupts() {
 void VoyeurEngine::initInput() {
 }
 
+void VoyeurEngine::doHeadTitle() {
+	char dest[144];
+
+	_eventsManager.startMainClockInt();
+	if (_bVoy->getBoltGroup(0x10500)) {
+		_graphicsManager._backgroundPage = _bVoy->memberAddr(0x502);
+//		_graphicsManager._vPort.setupViewPort();
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 6676b1c..d8fb4ad 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -62,11 +62,8 @@ class VoyeurEngine : public Engine {
 private:
 	const VoyeurGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
-	EventManager _eventManager;
-	FilesManager _filesManager;
-	GraphicsManager _graphicsManager;
 
-	BoltFile *_bVoyBoltFile;
+	BoltFile *_bVoy;
 	byte *_fontPtr;
 	SVoy _voy;
 	Common::Array<int> _resolves;
@@ -83,6 +80,9 @@ protected:
 	virtual bool hasFeature(EngineFeature f) const;
 public:
 	IntData _intPtr;
+	EventsManager _eventsManager;
+	FilesManager _filesManager;
+	GraphicsManager _graphicsManager;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
@@ -100,6 +100,8 @@ public:
 	virtual bool canSaveGameStateCurrently();
 	virtual Common::Error loadGameState(int slot);
 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
+
+	void doHeadTitle();
 };
 
 } // End of namespace Voyeur


Commit: a855cf648bb0835f7fbc5f5622166697383e89ea
    https://github.com/scummvm/scummvm/commit/a855cf648bb0835f7fbc5f5622166697383e89ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-25T12:36:57-07:00

Commit Message:
VOYEUR: Refactoring Bolt statics into a separate class

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 32b8917..ee58106 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -24,170 +24,36 @@
 
 namespace Voyeur {
 
-FilesManager::FilesManager() {
-	_decompressSize = 0x7000;
-}
-
-bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFile) {
-	if (boltFile != NULL) {
-		_curLibPtr = boltFile;
-		return true;
-	}
-
-	// TODO: Specific library classes for buoy.blt versus stampblt.blt 
-	// Create the bolt file interface object and load the index
-	boltFile = _curLibPtr = new BoltFile();
-	return true;
-}
-
-/*------------------------------------------------------------------------*/
-
 #define BOLT_GROUP_SIZE 16
 
-BoltFile *BoltFile::_curLibPtr = NULL;
-BoltGroup *BoltFile::_curGroupPtr = NULL;
-BoltEntry *BoltFile::_curMemberPtr = NULL;
-byte *BoltFile::_curMemInfoPtr = NULL;
-int BoltFile::_fromGroupFlag = 0;
-byte BoltFile::_xorMask = 0;
-bool BoltFile::_encrypt = false;
-int BoltFile::_curFilePosition = 0;
-int BoltFile::_bufferEnd = 0;
-int BoltFile::_bufferBegin = 0;
-int BoltFile::_bytesLeft = 0;
-int BoltFile::_bufSize = 0;
-byte *BoltFile::_bufStart = NULL;
-byte *BoltFile::_bufPos = NULL;
-byte BoltFile::_decompressBuf[DECOMPRESS_SIZE];
-int BoltFile::_historyIndex;
-byte BoltFile::_historyBuffer[0x200];
-int BoltFile::_runLength;
-int BoltFile::_decompState;
-int BoltFile::_runType;
-int BoltFile::_runValue;
-int BoltFile::_runOffset;
-
-const BoltMethodPtr BoltFile::_fnInitType[25] = {
-	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
-	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
-	&BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl,
-	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort,
-	&BoltFile::initViewPortList, &BoltFile::initDefault, &BoltFile::initFontInfo,
-	&BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
-	&BoltFile::initDefault, &BoltFile::initDefault
-};
-
-BoltFile::BoltFile() {
-	if (!_curFd.open("bvoy.blt"))
-		error("Could not open buoy.blt");
+BoltFilesState::BoltFilesState() {
+	_curLibPtr = NULL;
+	_curGroupPtr = NULL;
+	_curMemberPtr = NULL;
+	_curMemInfoPtr = NULL;
+	_fromGroupFlag = 0;
+	_xorMask = 0;
+	_encrypt = false;
 	_curFilePosition = 0;
-
-	// Read in the file header
-	byte header[16];
-	_curFd.read(&header[0], 16);
-
-	if (strncmp((const char *)&header[0], "BOLT", 4) != 0)
-		error("Tried to load non-bolt file");
-
-	int totalGroups = header[11] ? header[11] : 0x100;
-	for (int i = 0; i < totalGroups; ++i)
-		_groups.push_back(BoltGroup(&_curFd));
-}
-
-BoltFile::~BoltFile() {
-	_curFd.close();
-}
-
-bool BoltFile::getBoltGroup(uint32 id) {
-	++_fromGroupFlag;
-	_curLibPtr = this;
-	_curGroupPtr = &_groups[(id >> 8) & 0xff];
-
-	if (!_curGroupPtr->_loaded) {
-		// Load the group index
-		_curGroupPtr->load();
-	}
-
-	if (_curGroupPtr->_callInitGro)
-		initGro();
-
-	if ((id >> 16) != 0) {
-		id &= 0xff00;
-		for (int idx = 0; idx < _curGroupPtr->_count; ++idx, ++id) {
-			byte *member = getBoltMember(id);
-			assert(member);
-		}
-	} else if (!_curGroupPtr->_processed) {
-		_curGroupPtr->_processed = true;
-		_curGroupPtr->load();
-	}
-
-	resolveAll();
-	--_fromGroupFlag;
-	return true;
-}
-
-byte *BoltFile::memberAddr(uint32 id) {
-	BoltGroup &group = _groups[id >> 8];
-	if (!group._loaded)
-		return NULL;
-
-	return group._entries[id & 0xff]._data;
-}
-
-byte *BoltFile::getBoltMember(uint32 id) {
-	_curLibPtr = this;
-
-	// Get the group, and load it's entry list if not already loaded
-	_curGroupPtr = &_groups[(id >> 8) & 0xff];
-	if (!_curGroupPtr->_loaded)
-		_curGroupPtr->load();
-
-	// Get the entry
-	_curMemberPtr = &_curGroupPtr->_entries[id & 0xff];
-	if (_curMemberPtr->_field1)
-		initMem(_curMemberPtr->_field1);
-
-	// Return the data for the entry if it's already been loaded
-	if (_curMemberPtr->_data)
-		return _curMemberPtr->_data;
-
-	_xorMask = _curMemberPtr->_xorMask;
-	_encrypt = (_curMemberPtr->_mode & 0x10) != 0;
-
-	if (_curGroupPtr->_processed) {
-		// TODO: Figure out weird access type. Uncompressed read perhaps?
-		//int fileDiff = _curGroupPtr->_fileOffset - _curMemberPtr->_fileOffset;
-
-	} else {
-		_bufStart = _decompressBuf;
-		_bufSize = DECOMPRESS_SIZE;
-
-		if (_curMemberPtr->_fileOffset < _bufferBegin || _curMemberPtr->_fileOffset >= _bufferEnd) {
-			_bytesLeft = 0;
-			_bufPos = _bufStart;
-			_bufferBegin = -1;
-			_bufferEnd = _curMemberPtr->_fileOffset;
-		} else {
-			_bufPos = _curMemberPtr->_fileOffset + _bufferBegin + _bufStart;
-			_bufSize = ((_bufPos - _bufStart) << 16) >> 16; // TODO: Validate this
-			_bytesLeft = _bufSize;
-		}
-	}
-
-	_decompState = 0;
+	_bufferEnd = 0;
+	_bufferBegin = 0;
+	_bytesLeft = 0;
+	_bufSize = 0;
+	_bufStart = NULL;
+	_bufPos = NULL;
 	_historyIndex = 0;
+	_runLength = 0;
+	_decompState = 0;
+	_runType = 0;
+	_runValue = 0;
+	_runOffset = 0;
 
-	// Initialise the resource
-	assert(_curMemberPtr->_initMethod < 25);
-	(this->*_fnInitType[_curMemberPtr->_initMethod])();
-
-	return _curMemberPtr->_data;
+	Common::fill(&_historyBuffer[0], &_historyBuffer[0x200], 0);
 }
 
 #define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
 
-byte *BoltFile::decompress(byte *buf, int size, int mode) {
+byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 	if (!buf)
 		buf = new byte[size];
 	byte *bufP = buf;
@@ -284,7 +150,9 @@ byte *BoltFile::decompress(byte *buf, int size, int mode) {
 	return buf;
 }
 
-void BoltFile::nextBlock() {
+#undef NEXT_BYTE
+
+void BoltFilesState::nextBlock() {
 	if (_curFilePosition != _bufferEnd)
 		_curFd.seek(_bufferEnd);
 
@@ -296,12 +164,153 @@ void BoltFile::nextBlock() {
 	_bufPos = _bufStart;
 }
 
+/*------------------------------------------------------------------------*/
+
+FilesManager::FilesManager() {
+	_decompressSize = 0x7000;
+}
+
+bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFile) {
+	if (boltFile != NULL) {
+		_boltFilesState._curLibPtr = boltFile;
+		return true;
+	}
+
+	// TODO: Specific library classes for buoy.blt versus stampblt.blt 
+	// Create the bolt file interface object and load the index
+	boltFile = _boltFilesState._curLibPtr = new BoltFile(_boltFilesState);
+	return true;
+}
+
+/*------------------------------------------------------------------------*/
+
+const BoltMethodPtr BoltFile::_fnInitType[25] = {
+	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
+	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
+	&BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl,
+	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort,
+	&BoltFile::initViewPortList, &BoltFile::initDefault, &BoltFile::initFontInfo,
+	&BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
+	&BoltFile::initDefault, &BoltFile::initDefault
+};
+
+BoltFile::BoltFile(BoltFilesState &state): _state(state) {
+	if (!_state._curFd.open("bvoy.blt"))
+		error("Could not open buoy.blt");
+	_state._curFilePosition = 0;
+
+	// Read in the file header
+	byte header[16];
+	_state._curFd.read(&header[0], 16);
+
+	if (strncmp((const char *)&header[0], "BOLT", 4) != 0)
+		error("Tried to load non-bolt file");
+
+	int totalGroups = header[11] ? header[11] : 0x100;
+	for (int i = 0; i < totalGroups; ++i)
+		_groups.push_back(BoltGroup(&_state._curFd));
+}
+
+BoltFile::~BoltFile() {
+	_state._curFd.close();
+}
+
+bool BoltFile::getBoltGroup(uint32 id) {
+	++_state._fromGroupFlag;
+	_state._curLibPtr = this;
+	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
+
+	if (!_state._curGroupPtr->_loaded) {
+		// Load the group index
+		_state._curGroupPtr->load();
+	}
+
+	if (_state._curGroupPtr->_callInitGro)
+		initGro();
+
+	if ((id >> 16) != 0) {
+		id &= 0xff00;
+		for (int idx = 0; idx < _state._curGroupPtr->_count; ++idx, ++id) {
+			byte *member = getBoltMember(id);
+			assert(member);
+		}
+	} else if (!_state._curGroupPtr->_processed) {
+		_state._curGroupPtr->_processed = true;
+		_state._curGroupPtr->load();
+	}
+
+	resolveAll();
+	--_state._fromGroupFlag;
+	return true;
+}
+
+byte *BoltFile::memberAddr(uint32 id) {
+	BoltGroup &group = _groups[id >> 8];
+	if (!group._loaded)
+		return NULL;
+
+	return group._entries[id & 0xff]._data;
+}
+
+byte *BoltFile::getBoltMember(uint32 id) {
+	_state._curLibPtr = this;
+
+	// Get the group, and load it's entry list if not already loaded
+	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
+	if (!_state._curGroupPtr->_loaded)
+		_state._curGroupPtr->load();
+
+	// Get the entry
+	_state._curMemberPtr = &_state._curGroupPtr->_entries[id & 0xff];
+	if (_state._curMemberPtr->_field1)
+		initMem(_state._curMemberPtr->_field1);
+
+	// Return the data for the entry if it's already been loaded
+	if (_state._curMemberPtr->_data)
+		return _state._curMemberPtr->_data;
+
+	_state._xorMask = _state._curMemberPtr->_xorMask;
+	_state._encrypt = (_state._curMemberPtr->_mode & 0x10) != 0;
+
+	if (_state._curGroupPtr->_processed) {
+		// TODO: Figure out weird access type. Uncompressed read perhaps?
+		//int fileDiff = _state._curGroupPtr->_fileOffset - _state._curMemberPtr->_fileOffset;
+
+	} else {
+		_state._bufStart = _state._decompressBuf;
+		_state._bufSize = DECOMPRESS_SIZE;
+
+		if (_state._curMemberPtr->_fileOffset < _state._bufferBegin || _state._curMemberPtr->_fileOffset >= _state._bufferEnd) {
+			_state._bytesLeft = 0;
+			_state._bufPos = _state._bufStart;
+			_state._bufferBegin = -1;
+			_state._bufferEnd = _state._curMemberPtr->_fileOffset;
+		} else {
+			_state._bufPos = _state._curMemberPtr->_fileOffset + _state._bufferBegin + _state._bufStart;
+			_state._bufSize = ((_state._bufPos - _state._bufStart) << 16) >> 16; // TODO: Validate this
+			_state._bytesLeft = _state._bufSize;
+		}
+	}
+
+	_state._decompState = 0;
+	_state._historyIndex = 0;
+
+	// Initialise the resource
+	assert(_state._curMemberPtr->_initMethod < 25);
+	(this->*_fnInitType[_state._curMemberPtr->_initMethod])();
+
+	return _state._curMemberPtr->_data;
+}
+
 void BoltFile::initDefault() {
-	_curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode);	
+	_state._curMemberPtr->_data = _state.decompress(0, _state._curMemberPtr->_size, 
+		_state._curMemberPtr->_mode);	
 }
 
 void BoltFile::sInitPic() {
-	error("TODO: sInitPic not implemented");
+	// Read in the header data
+	_state._curMemberPtr->_data = _state.decompress(0, 24, _state._curMemberPtr->_mode);
+
 }
 
 void BoltFile::vInitCMap() {
@@ -356,6 +365,7 @@ void BoltGroup::load() {
 
 BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_data = NULL;
+	_picResource = NULL;
 
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
@@ -369,9 +379,32 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 
 BoltEntry::~BoltEntry() {
 	delete[] _data;
+	delete _picResource;
 }
 
 void BoltEntry::load() {
+	// TODO: Currently, all entry loading and decompression is done in BoltFile::memberAddr.
+	// Ideally, a lot of the code should be moved here
+}
+
+/*------------------------------------------------------------------------*/
+
+PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
+	_flags = READ_LE_UINT16(src);
+	_select = src[2];
+	_pick = src[3];
+	_onOff = src[4];
+	_depth = src[5];
+	_offset = Common::Point(READ_LE_UINT16(&src[6]), READ_LE_UINT16(&src[8]));
+	_width = READ_LE_UINT16(&src[10]);
+	_height = READ_LE_UINT16(&src[12]);
+	_maskData = READ_LE_UINT32(&src[14]);
+
+	_imgData = NULL;
+}
+
+PictureResource::~PictureResource() {
+	delete _imgData;
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 095d3ea..658f7ac 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -25,6 +25,7 @@
 
 #include "common/scummsys.h"
 #include "common/file.h"
+#include "common/rect.h"
 #include "common/str.h"
 
 namespace Voyeur {
@@ -33,38 +34,48 @@ class VoyeurEngine;
 class BoltFile;
 class BoltGroup;
 class BoltEntry;
+class PictureResource;
 #define DECOMPRESS_SIZE 0x7000
 
 typedef void (BoltFile::*BoltMethodPtr)();
 
+class BoltFilesState {
+public:
+	BoltFile *_curLibPtr;
+	BoltGroup *_curGroupPtr;
+	BoltEntry *_curMemberPtr;
+	byte *_curMemInfoPtr;
+	int _fromGroupFlag;
+	byte _xorMask;
+	bool _encrypt;
+	int _curFilePosition;
+	int _bufferEnd;
+	int _bufferBegin;
+	int _bytesLeft;
+	int _bufSize;
+	byte *_bufStart;
+	byte *_bufPos;
+	byte _decompressBuf[DECOMPRESS_SIZE];
+	int _historyIndex;
+	byte _historyBuffer[0x200];
+	int _runLength;
+	int _decompState;
+	int _runType;
+	int _runValue;
+	int _runOffset;
+	Common::File _curFd;
+public:
+	BoltFilesState();
+
+	byte *decompress(byte *buf, int size, int mode);
+	void nextBlock();
+};
+
 class BoltFile {
 private:
-	static BoltFile *_curLibPtr;
-	static BoltGroup *_curGroupPtr;
-	static BoltEntry *_curMemberPtr;
-	static byte *_curMemInfoPtr;
-	static int _fromGroupFlag;
-	static byte _xorMask;
-	static bool _encrypt;
-	// TODO: Move decompression statics and methods into BoltEntry
-	static int _curFilePosition;
-	static int _bufferEnd;
-	static int _bufferBegin;
-	static int _bytesLeft;
-	static int _bufSize;
-	static byte *_bufStart;
-	static byte *_bufPos;
-	static byte _decompressBuf[DECOMPRESS_SIZE];
-	static int _historyIndex;
-	static byte _historyBuffer[0x200];
-	static int _runLength;
-	static int _decompState;
-	static int _runType;
-	static int _runValue;
-	static int _runOffset;
 	static const BoltMethodPtr _fnInitType[25];
 private:
-	Common::File _curFd;
+	BoltFilesState &_state;
 	Common::Array<BoltGroup> _groups;
 
 	// initType method table
@@ -76,10 +87,6 @@ private:
 	void initViewPortList();
 	void initFontInfo();
 	void initSoundMap();
-
-	// Decompression
-	byte *decompress(byte *buf, int size, int mode);
-	void nextBlock();
 private:
 	void resolveAll() {}
 	byte *getBoltMember(uint32 id);
@@ -91,7 +98,7 @@ private:
 	void initGro() {}
 	void termGro() {}
 public:
-	BoltFile();
+	BoltFile(BoltFilesState &state);
 	~BoltFile();
 
 	bool getBoltGroup(uint32 id);
@@ -126,6 +133,8 @@ public:
 	byte _xorMask;
 	int _size;
 	byte *_data;
+
+	PictureResource *_picResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
 	virtual ~BoltEntry();
@@ -137,6 +146,7 @@ class FilesManager {
 private:
 	int _decompressSize;
 public:
+	BoltFilesState _boltFilesState;
 	BoltFile *_curLibPtr;
 public:
 	FilesManager();
@@ -144,6 +154,24 @@ public:
 	bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
 };
 
+class PictureResource {
+	uint16 _flags;
+	byte _select;
+	byte _pick;
+	byte _onOff;
+	byte _depth;
+	Common::Point _offset;
+	int _width;
+	int _height;
+	uint32 _maskData;
+	uint16 _planeSize;
+
+	byte *_imgData;
+public:
+	PictureResource(BoltFilesState &state, const byte *src);
+	virtual ~PictureResource();
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_FILES_H */


Commit: e33fb4f897fae750e50502348b3e894b36b7f783
    https://github.com/scummvm/scummvm/commit/e33fb4f897fae750e50502348b3e894b36b7f783
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-25T17:51:53-07:00

Commit Message:
VOYEUR: Fixes for decompression, and picture initialisation

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ee58106..93f1b87 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -21,6 +21,8 @@
  */
 
 #include "voyeur/files.h"
+#include "voyeur/graphics.h"
+#include "voyeur/voyeur.h"
 
 namespace Voyeur {
 
@@ -47,8 +49,9 @@ BoltFilesState::BoltFilesState() {
 	_runType = 0;
 	_runValue = 0;
 	_runOffset = 0;
-
 	Common::fill(&_historyBuffer[0], &_historyBuffer[0x200], 0);
+	_curFd = NULL;
+	_boltPageFrame = NULL;
 }
 
 #define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
@@ -126,7 +129,9 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 		case 0:
 			while (len-- > 0) {
 				NEXT_BYTE;
-				_historyBuffer[_historyIndex] = *_bufPos++;
+				byte v = *_bufPos++;
+				_historyBuffer[_historyIndex] = v;
+				*bufP++ = v;
 				_historyIndex = (_historyIndex + 1) & 0x1ff;
 			}
 			break;
@@ -135,6 +140,7 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 				_historyBuffer[_historyIndex] = _historyBuffer[runOffset];
 				*bufP++ = _historyBuffer[runOffset];
 				_historyIndex = (_historyIndex + 1) & 0x1ff;
+				runOffset = (runOffset + 1) & 0x1ff;
 			}
 			break;
 		default:
@@ -154,10 +160,10 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 
 void BoltFilesState::nextBlock() {
 	if (_curFilePosition != _bufferEnd)
-		_curFd.seek(_bufferEnd);
+		_curFd->seek(_bufferEnd);
 
 	_bufferBegin = _bufferEnd;
-	int bytesRead = _curFd.read(_bufStart, _bufSize);
+	int bytesRead = _curFd->read(_bufStart, _bufSize);
 
 	_bufferEnd = _curFilePosition = _bufferBegin + bytesRead;
 	_bytesLeft = bytesRead - 1;
@@ -195,24 +201,25 @@ const BoltMethodPtr BoltFile::_fnInitType[25] = {
 };
 
 BoltFile::BoltFile(BoltFilesState &state): _state(state) {
-	if (!_state._curFd.open("bvoy.blt"))
+	_state._curFd = &_file;
+	if (!_file.open("bvoy.blt"))
 		error("Could not open buoy.blt");
 	_state._curFilePosition = 0;
 
 	// Read in the file header
 	byte header[16];
-	_state._curFd.read(&header[0], 16);
+	_file.read(&header[0], 16);
 
 	if (strncmp((const char *)&header[0], "BOLT", 4) != 0)
 		error("Tried to load non-bolt file");
 
 	int totalGroups = header[11] ? header[11] : 0x100;
 	for (int i = 0; i < totalGroups; ++i)
-		_groups.push_back(BoltGroup(&_state._curFd));
+		_groups.push_back(BoltGroup(_state._curFd));
 }
 
 BoltFile::~BoltFile() {
-	_state._curFd.close();
+	_state._curFd->close();
 }
 
 bool BoltFile::getBoltGroup(uint32 id) {
@@ -280,15 +287,15 @@ byte *BoltFile::getBoltMember(uint32 id) {
 		_state._bufStart = _state._decompressBuf;
 		_state._bufSize = DECOMPRESS_SIZE;
 
-		if (_state._curMemberPtr->_fileOffset < _state._bufferBegin || _state._curMemberPtr->_fileOffset >= _state._bufferEnd) {
+		if ((_state._curFd != &_file) || (_state._curMemberPtr->_fileOffset < _state._bufferBegin)
+				|| (_state._curMemberPtr->_fileOffset >= _state._bufferEnd)) {
 			_state._bytesLeft = 0;
 			_state._bufPos = _state._bufStart;
 			_state._bufferBegin = -1;
 			_state._bufferEnd = _state._curMemberPtr->_fileOffset;
 		} else {
-			_state._bufPos = _state._curMemberPtr->_fileOffset + _state._bufferBegin + _state._bufStart;
-			_state._bufSize = ((_state._bufPos - _state._bufStart) << 16) >> 16; // TODO: Validate this
-			_state._bytesLeft = _state._bufSize;
+			_state._bufPos = _state._curMemberPtr->_fileOffset - _state._bufferBegin + _state._bufStart;
+			_state._bytesLeft = _state._bufSize - (_state._bufPos - _state._bufStart);
 		}
 	}
 
@@ -309,8 +316,9 @@ void BoltFile::initDefault() {
 
 void BoltFile::sInitPic() {
 	// Read in the header data
-	_state._curMemberPtr->_data = _state.decompress(0, 24, _state._curMemberPtr->_mode);
-
+	_state._curMemberPtr->_data = _state.decompress(NULL, 24, _state._curMemberPtr->_mode);
+	_state._curMemberPtr->_picResource = new PictureResource(_state, 
+		_state._curMemberPtr->_data);
 }
 
 void BoltFile::vInitCMap() {
@@ -401,6 +409,76 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_maskData = READ_LE_UINT32(&src[14]);
 
 	_imgData = NULL;
+
+	int nbytes = _width * _height;
+	if (_flags & 0x20) {
+		warning("TODO: sInitPic flags&0x20");
+	} else if (_flags & 8) {
+		int mode = 0;
+		if (_width == 320) {
+			mode = 147;
+			state._sImageShift = 2;
+			state._SVGAReset = false;
+		} else {
+			state._SVGAReset = true;
+			if (_width == 640) {
+				if (_height == 400) {
+					mode = 220;
+					state._sImageShift = 3;
+				} else {
+					mode = 221;
+					state._sImageShift = 3;
+				}
+			} else if (_width == 800) {
+				mode = 222;
+				state._sImageShift = 3;
+			} else if (_width == 1024) {
+				mode = 226;
+				state._sImageShift = 3;
+			}
+		}
+
+		if (mode != state._vm->_graphicsManager._SVGAMode) {
+			state._vm->_graphicsManager._SVGAMode = mode;
+			// TODO: If necessary, simulate SVGA mode change
+		}
+
+//		byte *imgData = _imgData;
+		if (_flags & 0x10) {
+			// TODO: Figure out what it's doing. Looks like a direct clearing
+			// of the screen directly
+		} else {
+			// TODO: Figure out direct screen loading
+		}
+	} else {
+		if (_flags & 0x1000) {
+			if (!(_flags & 0x10))
+				nbytes = state._curMemberPtr->_size - 24;
+
+			int mask = (nbytes + 0x3FFF) >> 14;
+			_imgData = NULL;
+
+			if (state._boltPageFrame == 0)
+				state.EMSGetFrameAddr(&state._boltPageFrame);
+			if (state._boltPageFrame != 0) {
+				if (!state.EMSAllocatePages(&_planeSize)) {
+					_maskData = mask;
+
+					for (int idx = 0; idx < mask; ++idx)
+						state.EMSMapPageHandle(_planeSize, idx, idx);
+					
+					state.decompress(state._boltPageFrame, nbytes, state._curMemberPtr->_mode);
+					return;
+				}
+			}
+		}
+
+		if (_flags & 0x10) {
+			_imgData = new byte[nbytes];
+		} else {
+			_imgData = state.decompress(NULL, nbytes, state._curMemberPtr->_mode);			
+		}
+	}
 }
 
 PictureResource::~PictureResource() {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 658f7ac..64a164a 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -41,6 +41,7 @@ typedef void (BoltFile::*BoltMethodPtr)();
 
 class BoltFilesState {
 public:
+	VoyeurEngine *_vm;
 	BoltFile *_curLibPtr;
 	BoltGroup *_curGroupPtr;
 	BoltEntry *_curMemberPtr;
@@ -63,12 +64,20 @@ public:
 	int _runType;
 	int _runValue;
 	int _runOffset;
-	Common::File _curFd;
+	Common::File *_curFd;
+
+	byte *_boltPageFrame;
+	int _sImageShift;
+	bool _SVGAReset;
 public:
 	BoltFilesState();
 
 	byte *decompress(byte *buf, int size, int mode);
 	void nextBlock();
+
+	void EMSGetFrameAddr(byte **pageFrame) {} // TODO: Maybe?
+	bool EMSAllocatePages(uint *planeSize) { return false; } // TODO: Maybe?
+	void EMSMapPageHandle(int planeSize, int idx1, int idx2) {} // TODO: Maybe?
 };
 
 class BoltFile {
@@ -77,6 +86,7 @@ private:
 private:
 	BoltFilesState &_state;
 	Common::Array<BoltGroup> _groups;
+	Common::File _file;
 
 	// initType method table
 	void initDefault();
@@ -150,6 +160,7 @@ public:
 	BoltFile *_curLibPtr;
 public:
 	FilesManager();
+	void setVm(VoyeurEngine *vm) { _boltFilesState._vm = vm; }
 
 	bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
 };
@@ -164,7 +175,7 @@ class PictureResource {
 	int _width;
 	int _height;
 	uint32 _maskData;
-	uint16 _planeSize;
+	uint _planeSize;
 
 	byte *_imgData;
 public:
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 2261b4f..be8e531 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -30,6 +30,8 @@ namespace Voyeur {
 
 GraphicsManager::GraphicsManager() {
 	_palFlag = false;
+	_SVGAPage = 0;
+	_SVGAMode = 0;
 }
 
 void GraphicsManager::sInitGraphics() {
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index a0f01df..72b5047 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -47,6 +47,8 @@ public:
 	byte _VGAColors[PALETTE_SIZE];
 	Common::Array<byte *> _colorChain;
 	byte *_backgroundPage;
+	int _SVGAPage;
+	int _SVGAMode;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index beded3e..457d863 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -94,6 +94,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
 
 void VoyeurEngine::initialiseManagers() {
 	_eventsManager.setVm(this);
+	_filesManager.setVm(this);
 	_graphicsManager.setVm(this);
 }
 


Commit: 23f3866e14fb1795145c9f3631955e5138c34628
    https://github.com/scummvm/scummvm/commit/23f3866e14fb1795145c9f3631955e5138c34628
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-25T20:30:48-07:00

Commit Message:
VOYEUR: Implemented initViewPort and pointer resolve methods

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 93f1b87..343485e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -259,6 +259,49 @@ byte *BoltFile::memberAddr(uint32 id) {
 	return group._entries[id & 0xff]._data;
 }
 
+byte *BoltFile::memberAddrOffset(uint32 id) {
+	BoltGroup &group = _groups[(id >> 24) << 4];
+	if (!group._loaded)
+		return NULL;
+
+	return group._entries[(id >> 16) & 0xff]._data + (id & 0xffff);
+}
+
+/**
+ * Resolves an Id to an offset within a loaded resource
+ */
+void BoltFile::resolveIt(uint32 id, byte **p) {
+	if ((int32)id == -1) {
+		*p = NULL;
+	} else {
+		byte *ptr = memberAddrOffset(id);
+		if (ptr) {
+			*p = ptr;
+		} else {
+			*p = NULL;
+			assert(_state._resolves.size() < 1000);
+			_state._resolves.push_back(ResolveEntry(id, p));
+		}
+	}
+}
+
+void BoltFile::resolveFunction(uint32 id, BoltMethodPtr *fn) {
+	if ((int32)id == -1) {
+		*fn = NULL;
+	} else {
+		error("Function fnTermGro array not supported");
+	}
+}
+
+/**
+ * Resolve any data references to within resources that weren't
+ * previously loaded, but are now
+ */
+void BoltFile::resolveAll() {
+	for (uint idx = 0; idx < _state._resolves.size(); ++idx)
+		*_state._resolves[idx]._p = memberAddrOffset(_state._resolves[idx]._id);
+}
+
 byte *BoltFile::getBoltMember(uint32 id) {
 	_state._curLibPtr = this;
 
@@ -330,7 +373,9 @@ void BoltFile::vInitCycl() {
 }
 
 void BoltFile::initViewPort() {
-	error("TODO: initViewPort not implemented");
+	initDefault();
+	_state._curMemberPtr->_viewPortResource = new ViewPortResource(
+		_state, _state._curMemberPtr->_data);
 }
 
 void BoltFile::initViewPortList() {
@@ -374,6 +419,7 @@ void BoltGroup::load() {
 BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_data = NULL;
 	_picResource = NULL;
+	_viewPortResource = NULL;
 
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
@@ -388,6 +434,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 BoltEntry::~BoltEntry() {
 	delete[] _data;
 	delete _picResource;
+	delete _viewPortResource;
 }
 
 void BoltEntry::load() {
@@ -485,4 +532,27 @@ PictureResource::~PictureResource() {
 	delete _imgData;
 }
 
+/*------------------------------------------------------------------------*/
+
+ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) {
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 2), &_field2);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x20), &_field20);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x24), &_field24);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x28), &_field28);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x2c), &_field2C);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x7A), &_field7A);
+
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x7E), &_fn1);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x82), &_fn2);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x86), &_fn3);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x8A), &_fn4);
+
+	if (!_fn4 && _fn3)
+		_fn3 = &BoltFile::addRectNoSaveBack;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 64a164a..c8c4807 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -35,10 +35,20 @@ class BoltFile;
 class BoltGroup;
 class BoltEntry;
 class PictureResource;
+class ViewPortResource;
+
 #define DECOMPRESS_SIZE 0x7000
 
 typedef void (BoltFile::*BoltMethodPtr)();
 
+class ResolveEntry {
+public:
+	uint32 _id;
+	byte **_p;
+
+	ResolveEntry(uint32 id, byte **p) { _id = id; _p = p; }
+};
+
 class BoltFilesState {
 public:
 	VoyeurEngine *_vm;
@@ -65,6 +75,7 @@ public:
 	int _runValue;
 	int _runOffset;
 	Common::File *_curFd;
+	Common::Array<ResolveEntry> _resolves;
 
 	byte *_boltPageFrame;
 	int _sImageShift;
@@ -98,21 +109,25 @@ private:
 	void initFontInfo();
 	void initSoundMap();
 private:
-	void resolveAll() {}
+	void resolveAll();
 	byte *getBoltMember(uint32 id);
 
-	void initType() {}
-	void termType() {}
-	void initMem(int id) {}
-	void termMem() {}
-	void initGro() {}
-	void termGro() {}
+	void termType() {}	// TODO
+	void initMem(int id) {}	// TODO
+	void termMem() {}	// TODO
+	void initGro() {}	// TODO
+	void termGro() {}	// TODO
 public:
 	BoltFile(BoltFilesState &state);
 	~BoltFile();
 
 	bool getBoltGroup(uint32 id);
 	byte *memberAddr(uint32 id);
+	byte *memberAddrOffset(uint32 id);
+	void resolveIt(uint32 id, byte **p);
+	void resolveFunction(uint32 id, BoltMethodPtr *fn);
+
+	void addRectNoSaveBack() {}	// TODO
 };
 
 class BoltGroup {
@@ -145,6 +160,7 @@ public:
 	byte *_data;
 
 	PictureResource *_picResource;
+	ViewPortResource *_viewPortResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
 	virtual ~BoltEntry();
@@ -183,6 +199,27 @@ public:
 	virtual ~PictureResource();
 };
 
+class ViewPortResource {
+public:
+	byte *_field2;
+	byte *_field20;
+	byte *_field24;
+	byte *_field28;
+	byte *_field2C;
+	byte *_field30;
+	byte *_field34;
+	byte *_field38;
+	byte *_field3C;
+	byte *_field7A;
+	BoltMethodPtr _fn1;
+	BoltMethodPtr _fn2;
+	BoltMethodPtr _fn3;
+	BoltMethodPtr _fn4;
+public:
+	ViewPortResource(BoltFilesState &state, const byte *src);
+	virtual ~ViewPortResource() {}
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_FILES_H */


Commit: ab4f798f5bedeec7520c15f8b5b64efda469d95f
    https://github.com/scummvm/scummvm/commit/ab4f798f5bedeec7520c15f8b5b64efda469d95f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-26T19:18:54-07:00

Commit Message:
VOYEUR: Added code for initViewPortList

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 343485e..811bdf6 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -379,7 +379,9 @@ void BoltFile::initViewPort() {
 }
 
 void BoltFile::initViewPortList() {
-	error("TODO: initViewPortList not implemented");
+	initDefault();
+	_state._curMemberPtr->_viewPortListResource = new ViewPortListResource(
+		_state, _state._curMemberPtr->_data);
 }
 
 void BoltFile::initFontInfo() {
@@ -435,6 +437,7 @@ BoltEntry::~BoltEntry() {
 	delete[] _data;
 	delete _picResource;
 	delete _viewPortResource;
+	delete _viewPortListResource;
 }
 
 void BoltEntry::load() {
@@ -555,4 +558,20 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) {
 		_fn3 = &BoltFile::addRectNoSaveBack;
 }
 
+/*------------------------------------------------------------------------*/
+
+ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
+	uint32 *idP = (uint32 *)&src[0];
+	uint count = READ_LE_UINT32(idP++);
+
+	for (uint i = 0; i < count; ++i, ++idP) {
+		uint32 id = READ_LE_UINT32(idP);
+		_entries.push_back(NULL);
+		state._curLibPtr->resolveIt(id, &_entries[_entries.size() - 1]);
+	}
+
+	state._vm->_graphicsManager._vPort = &_entries[0];
+	state._curLibPtr->resolveIt(READ_LE_UINT32(&src[4]), &_field4);
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index c8c4807..47ef5a1 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -36,6 +36,7 @@ class BoltGroup;
 class BoltEntry;
 class PictureResource;
 class ViewPortResource;
+class ViewPortListResource;
 
 #define DECOMPRESS_SIZE 0x7000
 
@@ -161,6 +162,7 @@ public:
 
 	PictureResource *_picResource;
 	ViewPortResource *_viewPortResource;
+	ViewPortListResource *_viewPortListResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
 	virtual ~BoltEntry();
@@ -220,6 +222,15 @@ public:
 	virtual ~ViewPortResource() {}
 };
 
+class ViewPortListResource {
+public:
+	byte *_field4;
+	Common::Array<byte *> _entries;
+
+	ViewPortListResource(BoltFilesState &state, const byte *src);
+	virtual ~ViewPortListResource() {}
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_FILES_H */
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 72b5047..152ce00 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -49,6 +49,7 @@ public:
 	byte *_backgroundPage;
 	int _SVGAPage;
 	int _SVGAMode;
+	byte **_vPort;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();


Commit: 83524863d744c71eb5083fc4f9ce32d576f7810d
    https://github.com/scummvm/scummvm/commit/83524863d744c71eb5083fc4f9ce32d576f7810d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-27T20:01:15-07:00

Commit Message:
VOYEUR: Implemented remaining Bolt init methods

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 2fb4147..f84c978 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -25,6 +25,10 @@
 
 namespace Voyeur {
 
+EventsManager::EventsManager() {
+	_cycleStatus = 0;
+}
+
 void EventsManager::resetMouse() {
 	// No implementation
 }
@@ -40,4 +44,9 @@ void EventsManager::mainVoyeurIntFunc() {
 
 }
 
+void EventsManager::vStopCycle() {
+	_cycleIntNode._flags = 1;
+	_cycleStatus &= 2;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 0acdc73..a3696a9 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -40,12 +40,14 @@ public:
 	IntNode _cycleIntNode;
 	IntNode _evintnode;
 	IntNode _mainIntNode;
+	int _cycleStatus;
 public:
-	EventsManager() {}
+	EventsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void resetMouse();
 	void startMainClockInt();
+	void vStopCycle();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 811bdf6..74c2f17 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -365,11 +365,16 @@ void BoltFile::sInitPic() {
 }
 
 void BoltFile::vInitCMap() {
-	error("TODO: vInitCMap not implemented");
+	initDefault();
+	_state._curMemberPtr->_cMapResource = new CMapResource(
+		_state, _state._curMemberPtr->_data);
 }
 
 void BoltFile::vInitCycl() {
-	error("TODO: vInitCycl not implemented");
+	initDefault();
+	_state._vm->_eventsManager.vStopCycle();
+	_state._curMemberPtr->_vInitCyclResource = new VInitCyclResource(
+		_state, _state._curMemberPtr->_data);
 }
 
 void BoltFile::initViewPort() {
@@ -385,11 +390,13 @@ void BoltFile::initViewPortList() {
 }
 
 void BoltFile::initFontInfo() {
-	error("TODO: initFontInfo not implemented");
+	initDefault();
+	_state._curMemberPtr->_fontResource = new FontResource(
+		_state, _state._curMemberPtr->_data);
 }
 
 void BoltFile::initSoundMap() {
-	error("TODO: initSoundMap not implemented");
+	initDefault();
 }
 
 /*------------------------------------------------------------------------*/
@@ -422,6 +429,10 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_data = NULL;
 	_picResource = NULL;
 	_viewPortResource = NULL;
+	_viewPortListResource = NULL;
+	_fontResource = NULL;
+	_cMapResource = NULL;
+	_vInitCyclResource = NULL;
 
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
@@ -438,6 +449,9 @@ BoltEntry::~BoltEntry() {
 	delete _picResource;
 	delete _viewPortResource;
 	delete _viewPortListResource;
+	delete _fontResource;
+	delete _cMapResource;
+	delete _vInitCyclResource;
 }
 
 void BoltEntry::load() {
@@ -561,8 +575,9 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) {
 /*------------------------------------------------------------------------*/
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
-	uint32 *idP = (uint32 *)&src[0];
-	uint count = READ_LE_UINT32(idP++);
+	uint count = READ_LE_UINT16(src);
+
+	uint32 *idP = (uint32 *)&src[8];
 
 	for (uint i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
@@ -574,4 +589,33 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 	state._curLibPtr->resolveIt(READ_LE_UINT32(&src[4]), &_field4);
 }
 
+/*------------------------------------------------------------------------*/
+
+FontResource::FontResource(BoltFilesState &state, const byte *src) {
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0xC), &_fieldC);
+}
+
+/*------------------------------------------------------------------------*/
+
+CMapResource::CMapResource(BoltFilesState &state, const byte *src) {
+	_start = READ_LE_UINT16(src + 2);
+	_end = READ_LE_UINT16(src + 4);
+	
+	int count = _end - _start;
+	_palette = new byte[count * 3];
+	Common::copy(src + 6, src + 6 + 3 * count, _palette);
+}
+
+CMapResource::~CMapResource() {
+	delete[] _palette;
+}
+
+/*------------------------------------------------------------------------*/
+
+VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
+	for (int i = 0; i < 4; ++i) {
+		state._curLibPtr->resolveIt(READ_LE_UINT32(src + 8 + i * 4), &_ptr[i]);
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 47ef5a1..eb0c313 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -37,6 +37,9 @@ class BoltEntry;
 class PictureResource;
 class ViewPortResource;
 class ViewPortListResource;
+class FontResource;
+class CMapResource;
+class VInitCyclResource;
 
 #define DECOMPRESS_SIZE 0x7000
 
@@ -163,6 +166,9 @@ public:
 	PictureResource *_picResource;
 	ViewPortResource *_viewPortResource;
 	ViewPortListResource *_viewPortListResource;
+	FontResource *_fontResource;
+	CMapResource *_cMapResource;
+	VInitCyclResource *_vInitCyclResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
 	virtual ~BoltEntry();
@@ -231,6 +237,32 @@ public:
 	virtual ~ViewPortListResource() {}
 };
 
+class FontResource {
+public:
+	byte *_fieldC;
+
+	FontResource(BoltFilesState &state, const byte *src);
+	virtual ~FontResource() {}
+};
+
+class CMapResource {
+public:
+	int _start;
+	int _end;
+	byte *_palette;
+public:
+	CMapResource(BoltFilesState &state, const byte *src);
+	virtual ~CMapResource();
+};
+
+class VInitCyclResource {
+public:
+	byte *_ptr[4];
+public:
+	VInitCyclResource(BoltFilesState &state, const byte *src);
+	virtual ~VInitCyclResource() {}
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_FILES_H */


Commit: d770907c33c8991fa683500686ff3af3a09639fc
    https://github.com/scummvm/scummvm/commit/d770907c33c8991fa683500686ff3af3a09639fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-28T19:39:32-07:00

Commit Message:
VOYEUR: Starting on viewport activation, and extra bolt entry guards

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 74c2f17..70a6a6e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -251,12 +251,27 @@ bool BoltFile::getBoltGroup(uint32 id) {
 	return true;
 }
 
+BoltEntry &BoltFile::getBoltEntry(uint32 id) {
+	BoltGroup &group = _groups[id >> 8];
+	assert(!group._loaded);
+
+	BoltEntry &entry = group._entries[id & 0xff];
+	assert(!entry.hasResource() || (id & 0xffff) == 0);
+
+	return entry;
+}
+
 byte *BoltFile::memberAddr(uint32 id) {
 	BoltGroup &group = _groups[id >> 8];
 	if (!group._loaded)
 		return NULL;
 
-	return group._entries[id & 0xff]._data;
+	// If an entry already has a processed representation, we shouldn't
+	// still be accessing the raw data
+	BoltEntry &entry = group._entries[id & 0xff];
+	assert(!entry.hasResource());
+
+	return entry._data;
 }
 
 byte *BoltFile::memberAddrOffset(uint32 id) {
@@ -264,7 +279,12 @@ byte *BoltFile::memberAddrOffset(uint32 id) {
 	if (!group._loaded)
 		return NULL;
 
-	return group._entries[(id >> 16) & 0xff]._data + (id & 0xffff);
+	// If an entry already has a processed representation, we shouldn't
+	// still be accessing the raw data
+	BoltEntry &entry = group._entries[(id >> 16) & 0xff];
+	assert(!entry.hasResource());
+
+	return entry._data + (id & 0xffff);
 }
 
 /**
@@ -459,6 +479,14 @@ void BoltEntry::load() {
 	// Ideally, a lot of the code should be moved here
 }
 
+/**
+ * Returns true if the given bolt entry has an attached resource
+ */
+bool BoltEntry::hasResource() const {
+	return _picResource || _viewPortResource || _viewPortListResource
+		|| _fontResource || _cMapResource || _vInitCyclResource;
+}
+
 /*------------------------------------------------------------------------*/
 
 PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
@@ -551,8 +579,15 @@ PictureResource::~PictureResource() {
 
 /*------------------------------------------------------------------------*/
 
-ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) {
+ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
+		_state(state) {
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 2), &_field2);
+	_fieldC = READ_LE_UINT16(src + 0xC);
+	_fieldE = READ_LE_UINT16(src + 0xE);
+	_field10 = READ_LE_UINT16(src + 0x10);
+	_field12 = READ_LE_UINT16(src + 0x12);
+	_field18 = READ_LE_UINT16(src + 0x18);
+
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x20), &_field20);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x24), &_field24);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x28), &_field28);
@@ -561,6 +596,12 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) {
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
+
+	_field46 = READ_LE_UINT16(src + 0x46);
+	_field48 = READ_LE_UINT16(src + 0x48);
+	_field4A = READ_LE_UINT16(src + 0x4A);
+	_field4C = READ_LE_UINT16(src + 0x4C);
+
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x7A), &_field7A);
 
 	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x7E), &_fn1);
@@ -572,6 +613,30 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src) {
 		_fn3 = &BoltFile::addRectNoSaveBack;
 }
 
+void ViewPortResource::setupViewPort(int v, ViewPortMethodPtr setupFn, 
+		ViewPortMethodPtr addRectFn, ViewPortMethodPtr restoreFn, byte *page) {
+	byte *fld20 = _field20;
+	// TODO: More stuff
+}
+
+void ViewPortResource::setupMCGASaveRect() {
+	
+}
+
+void ViewPortResource::restoreMCGASaveRect() {
+
+}
+
+void ViewPortResource::addRectOptSaveRect() {
+
+}
+
+void ViewPortResource::setupViewPort() {
+	setupViewPort(0, &ViewPortResource::setupMCGASaveRect, 
+		&ViewPortResource::addRectOptSaveRect, &ViewPortResource::restoreMCGASaveRect,
+		_state._vm->_graphicsManager._backgroundPage);
+}
+
 /*------------------------------------------------------------------------*/
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
@@ -581,12 +646,13 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 
 	for (uint i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
-		_entries.push_back(NULL);
-		state._curLibPtr->resolveIt(id, &_entries[_entries.size() - 1]);
+		BoltEntry &entry = state._curLibPtr->getBoltEntry(id);
+
+		assert(entry._viewPortResource);
+		_entries.push_back(entry._viewPortResource);
 	}
 
-	state._vm->_graphicsManager._vPort = &_entries[0];
-	state._curLibPtr->resolveIt(READ_LE_UINT32(&src[4]), &_field4);
+	state._vm->_graphicsManager._vPort = _entries[0];
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index eb0c313..1bc9a9d 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -126,6 +126,7 @@ public:
 	~BoltFile();
 
 	bool getBoltGroup(uint32 id);
+	BoltEntry &getBoltEntry(uint32 id);
 	byte *memberAddr(uint32 id);
 	byte *memberAddrOffset(uint32 id);
 	void resolveIt(uint32 id, byte **p);
@@ -174,6 +175,7 @@ public:
 	virtual ~BoltEntry();
 
 	void load();
+	bool hasResource() const;
 };
 
 class FilesManager {
@@ -207,9 +209,25 @@ public:
 	virtual ~PictureResource();
 };
 
+typedef void (ViewPortResource::*ViewPortMethodPtr)();
+
 class ViewPortResource {
+private:
+	BoltFilesState &_state;
+
+	void setupMCGASaveRect();
+	void restoreMCGASaveRect();
+	void addRectOptSaveRect();
+private:
+	void setupViewPort(int v, ViewPortMethodPtr setupFn, ViewPortMethodPtr addRectFn, 
+		ViewPortMethodPtr restoreFn, byte *page);
 public:
 	byte *_field2;
+	int _fieldC;
+	int _fieldE;
+	int _field10;
+	int _field12;
+	int _field18;
 	byte *_field20;
 	byte *_field24;
 	byte *_field28;
@@ -218,6 +236,10 @@ public:
 	byte *_field34;
 	byte *_field38;
 	byte *_field3C;
+	int _field46;
+	int _field48;
+	int _field4A;
+	int _field4C;
 	byte *_field7A;
 	BoltMethodPtr _fn1;
 	BoltMethodPtr _fn2;
@@ -226,12 +248,14 @@ public:
 public:
 	ViewPortResource(BoltFilesState &state, const byte *src);
 	virtual ~ViewPortResource() {}
+
+	void setupViewPort();
 };
 
 class ViewPortListResource {
 public:
 	byte *_field4;
-	Common::Array<byte *> _entries;
+	Common::Array<ViewPortResource *> _entries;
 
 	ViewPortListResource(BoltFilesState &state, const byte *src);
 	virtual ~ViewPortListResource() {}
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index be8e531..2686049 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -66,26 +66,4 @@ void GraphicsManager::vDoCycleInt() {
 
 }
 
-void GraphicsManager::setupViewPort() {
-	setupViewPort(&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect, 
-		&GraphicsManager::restoreMCGASaveRect);
-}
-
-void GraphicsManager::setupViewPort(GraphicMethodPtr setupFn, 
-		GraphicMethodPtr addRectFn, GraphicMethodPtr restoreFn) {
-
-}
-
-void GraphicsManager::setupMCGASaveRect() {
-	
-}
-
-void GraphicsManager::restoreMCGASaveRect() {
-
-}
-
-void GraphicsManager::addRectOptSaveRect() {
-
-}
-
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 152ce00..ae23d28 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -23,6 +23,7 @@
 #ifndef VOYEUR_GRAPHICS_H
 #define VOYEUR_GRAPHICS_H
 
+#include "voyeur/files.h"
 #include "voyeur/game.h"
 #include "common/scummsys.h"
 #include "common/array.h"
@@ -49,19 +50,13 @@ public:
 	byte *_backgroundPage;
 	int _SVGAPage;
 	int _SVGAMode;
-	byte **_vPort;
+	ViewPortResource *_vPort;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
 	static void vDoCycleInt();
 
-	void setupMCGASaveRect();
-	void restoreMCGASaveRect();
-	void addRectOptSaveRect();
-
 	void addIntNode(IntNode *node);
-	void setupViewPort(GraphicMethodPtr setupFn, GraphicMethodPtr addRectFn, 
-		GraphicMethodPtr restoreFn);
 public:
 	GraphicsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -69,7 +64,6 @@ public:
 
 	void vInitColor();
 	void addFadeInt();
-	void setupViewPort();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 457d863..2a4a1cd 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -143,7 +143,8 @@ void VoyeurEngine::doHeadTitle() {
 	_eventsManager.startMainClockInt();
 	if (_bVoy->getBoltGroup(0x10500)) {
 		_graphicsManager._backgroundPage = _bVoy->memberAddr(0x502);
-//		_graphicsManager._vPort.setupViewPort();
+		_graphicsManager._vPort->setupViewPort();
+		
 	}
 }
 


Commit: 452fdc64af09d2f4dc95212581d3ee4d571ca04b
    https://github.com/scummvm/scummvm/commit/452fdc64af09d2f4dc95212581d3ee4d571ca04b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-28T20:57:16-07:00

Commit Message:
VOYEUR: Fixes to pointer fields in viewport setup

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 70a6a6e..51a414f 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -252,15 +252,22 @@ bool BoltFile::getBoltGroup(uint32 id) {
 }
 
 BoltEntry &BoltFile::getBoltEntry(uint32 id) {
-	BoltGroup &group = _groups[id >> 8];
-	assert(!group._loaded);
+	BoltGroup &group = _groups[id >> 24];
+	assert(group._loaded);
 
-	BoltEntry &entry = group._entries[id & 0xff];
+	BoltEntry &entry = group._entries[(id >> 16) & 0xff];
 	assert(!entry.hasResource() || (id & 0xffff) == 0);
 
 	return entry;
 }
 
+PictureResource *BoltFile::getPictureResouce(uint32 id) {
+	if ((int32)id == -1)
+		return NULL;
+
+	return getBoltEntry(id)._picResource;
+}
+
 byte *BoltFile::memberAddr(uint32 id) {
 	BoltGroup &group = _groups[id >> 8];
 	if (!group._loaded)
@@ -275,7 +282,7 @@ byte *BoltFile::memberAddr(uint32 id) {
 }
 
 byte *BoltFile::memberAddrOffset(uint32 id) {
-	BoltGroup &group = _groups[(id >> 24) << 4];
+	BoltGroup &group = _groups[id >> 24];
 	if (!group._loaded)
 		return NULL;
 
@@ -581,17 +588,18 @@ PictureResource::~PictureResource() {
 
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_state(state) {
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 2), &_field2);
+	_next = state._curLibPtr->getBoltEntry(READ_LE_UINT32(src + 2))._viewPortResource;
 	_fieldC = READ_LE_UINT16(src + 0xC);
 	_fieldE = READ_LE_UINT16(src + 0xE);
 	_field10 = READ_LE_UINT16(src + 0x10);
 	_field12 = READ_LE_UINT16(src + 0x12);
 	_field18 = READ_LE_UINT16(src + 0x18);
 
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x20), &_field20);
+	_picResource = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x24), &_field24);
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x28), &_field28);
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x2c), &_field2C);
+	_picResource2 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
+	_picResource3 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
+
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
@@ -614,8 +622,9 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 }
 
 void ViewPortResource::setupViewPort(int v, ViewPortMethodPtr setupFn, 
-		ViewPortMethodPtr addRectFn, ViewPortMethodPtr restoreFn, byte *page) {
-	byte *fld20 = _field20;
+		ViewPortMethodPtr addRectFn, ViewPortMethodPtr restoreFn, 
+		PictureResource *page) {
+	PictureResource *pic = _picResource;
 	// TODO: More stuff
 }
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 1bc9a9d..9d66cba 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -126,13 +126,15 @@ public:
 	~BoltFile();
 
 	bool getBoltGroup(uint32 id);
-	BoltEntry &getBoltEntry(uint32 id);
 	byte *memberAddr(uint32 id);
 	byte *memberAddrOffset(uint32 id);
 	void resolveIt(uint32 id, byte **p);
 	void resolveFunction(uint32 id, BoltMethodPtr *fn);
 
 	void addRectNoSaveBack() {}	// TODO
+
+	BoltEntry &getBoltEntry(uint32 id);
+	PictureResource *getPictureResouce(uint32 id);
 };
 
 class BoltGroup {
@@ -220,18 +222,18 @@ private:
 	void addRectOptSaveRect();
 private:
 	void setupViewPort(int v, ViewPortMethodPtr setupFn, ViewPortMethodPtr addRectFn, 
-		ViewPortMethodPtr restoreFn, byte *page);
+		ViewPortMethodPtr restoreFn, PictureResource *page);
 public:
-	byte *_field2;
+	ViewPortResource *_next;
 	int _fieldC;
 	int _fieldE;
 	int _field10;
 	int _field12;
 	int _field18;
-	byte *_field20;
+	PictureResource *_picResource;
 	byte *_field24;
-	byte *_field28;
-	byte *_field2C;
+	PictureResource *_picResource2;
+	PictureResource *_picResource3;
 	byte *_field30;
 	byte *_field34;
 	byte *_field38;
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index ae23d28..6598cb0 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -47,7 +47,7 @@ public:
 	bool _palFlag;
 	byte _VGAColors[PALETTE_SIZE];
 	Common::Array<byte *> _colorChain;
-	byte *_backgroundPage;
+	PictureResource *_backgroundPage;
 	int _SVGAPage;
 	int _SVGAMode;
 	ViewPortResource *_vPort;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 2a4a1cd..dc25ec4 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -142,7 +142,7 @@ void VoyeurEngine::doHeadTitle() {
 
 	_eventsManager.startMainClockInt();
 	if (_bVoy->getBoltGroup(0x10500)) {
-		_graphicsManager._backgroundPage = _bVoy->memberAddr(0x502);
+		_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
 		_graphicsManager._vPort->setupViewPort();
 		
 	}


Commit: 04794adf5cd9ac330aa82e6af6abe1390fca6cb7
    https://github.com/scummvm/scummvm/commit/04794adf5cd9ac330aa82e6af6abe1390fca6cb7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-29T20:21:07-07:00

Commit Message:
VOYEUR: Completed setupViewPort

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 51a414f..966e71b 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -312,7 +312,7 @@ void BoltFile::resolveIt(uint32 id, byte **p) {
 	}
 }
 
-void BoltFile::resolveFunction(uint32 id, BoltMethodPtr *fn) {
+void BoltFile::resolveFunction(uint32 id, GraphicMethodPtr *fn) {
 	if ((int32)id == -1) {
 		*fn = NULL;
 	} else {
@@ -502,36 +502,38 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_pick = src[3];
 	_onOff = src[4];
 	_depth = src[5];
-	_offset = Common::Point(READ_LE_UINT16(&src[6]), READ_LE_UINT16(&src[8]));
-	_width = READ_LE_UINT16(&src[10]);
-	_height = READ_LE_UINT16(&src[12]);
+
+	int xs = READ_LE_UINT16(&src[6]);
+	int ys = READ_LE_UINT16(&src[8]);
+	_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(&src[10]),
+		ys + READ_LE_UINT16(&src[12]));
 	_maskData = READ_LE_UINT32(&src[14]);
 
 	_imgData = NULL;
 
-	int nbytes = _width * _height;
+	int nbytes = _bounds.width() * _bounds.height();
 	if (_flags & 0x20) {
-		warning("TODO: sInitPic flags&0x20");
+		error("TODO: sInitPic flags&0x20");
 	} else if (_flags & 8) {
 		int mode = 0;
-		if (_width == 320) {
+		if (_bounds.width() == 320) {
 			mode = 147;
 			state._sImageShift = 2;
 			state._SVGAReset = false;
 		} else {
 			state._SVGAReset = true;
-			if (_width == 640) {
-				if (_height == 400) {
+			if (_bounds.width() == 640) {
+				if (_bounds.height() == 400) {
 					mode = 220;
 					state._sImageShift = 3;
 				} else {
 					mode = 221;
 					state._sImageShift = 3;
 				}
-			} else if (_width == 800) {
+			} else if (_bounds.width() == 800) {
 				mode = 222;
 				state._sImageShift = 3;
-			} else if (_width == 1024) {
+			} else if (_bounds.width() == 1024) {
 				mode = 226;
 				state._sImageShift = 3;
 			}
@@ -542,6 +544,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 			// TODO: If necessary, simulate SVGA mode change
 		}
 
+		error("TODO: Implement extra picture resource modes");
 //		byte *imgData = _imgData;
 		if (_flags & 0x10) {
 			// TODO: Figure out what it's doing. Looks like a direct clearing
@@ -589,14 +592,15 @@ PictureResource::~PictureResource() {
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_state(state) {
 	_next = state._curLibPtr->getBoltEntry(READ_LE_UINT32(src + 2))._viewPortResource;
-	_fieldC = READ_LE_UINT16(src + 0xC);
-	_fieldE = READ_LE_UINT16(src + 0xE);
-	_field10 = READ_LE_UINT16(src + 0x10);
-	_field12 = READ_LE_UINT16(src + 0x12);
+
+	int xs = READ_LE_UINT16(src + 0xC);
+	int ys = READ_LE_UINT16(src + 0xE);
+	_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 0x10), 
+		ys + READ_LE_UINT16(src + 0x12));
 	_field18 = READ_LE_UINT16(src + 0x18);
 
 	_picResource = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x24), &_field24);
+	_activePage = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x24));
 	_picResource2 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
 	_picResource3 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
 
@@ -605,45 +609,89 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
 
-	_field46 = READ_LE_UINT16(src + 0x46);
-	_field48 = READ_LE_UINT16(src + 0x48);
-	_field4A = READ_LE_UINT16(src + 0x4A);
-	_field4C = READ_LE_UINT16(src + 0x4C);
+	xs = READ_LE_UINT16(src + 0x46);
+	ys = READ_LE_UINT16(src + 0x48);
+	_clipRect = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 0x4A),
+		ys + READ_LE_UINT16(src + 0x4C));
 
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x7A), &_field7A);
 
-	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x7E), &_fn1);
-	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x82), &_fn2);
-	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x86), &_fn3);
-	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x8A), &_fn4);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x7E), (GraphicMethodPtr *)&_fn1);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x82), (GraphicMethodPtr *)&_setupFn);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x86), (GraphicMethodPtr *)&_addFn);
+	state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x8A), (GraphicMethodPtr *)&_restoreFn);
 
-	if (!_fn4 && _fn3)
-		_fn3 = &BoltFile::addRectNoSaveBack;
+	if (!_restoreFn && _addFn)
+		_addFn = &GraphicsManager::addRectNoSaveBack;
 }
 
-void ViewPortResource::setupViewPort(int v, ViewPortMethodPtr setupFn, 
-		ViewPortMethodPtr addRectFn, ViewPortMethodPtr restoreFn, 
-		PictureResource *page) {
+void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
+		ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
 	PictureResource *pic = _picResource;
-	// TODO: More stuff
-}
+	Common::Rect r(_bounds.left + pic->_bounds.left, _bounds.top + pic->_bounds.top,
+		_bounds.right, _bounds.bottom);
+	int xDiff, yDiff;
+
+	if (page) {
+		// Clip based on the passed picture resource
+		xDiff = page->_bounds.left - r.left;
+		yDiff = page->_bounds.top - r.top;
+
+		if (xDiff > 0) {
+			r.left = page->_bounds.left;
+			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0);
+		}
+		if (yDiff > 0) {
+			r.top = page->_bounds.top;
+			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
+		}
 
-void ViewPortResource::setupMCGASaveRect() {
-	
-}
+		xDiff = page->_bounds.left + page->_bounds.width();
+		yDiff = page->_bounds.top + page->_bounds.height();
 
-void ViewPortResource::restoreMCGASaveRect() {
+		if (xDiff > 0)
+			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0); 
+		if (yDiff > 0)
+			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
+	}
 
-}
+	if (clipRect) {
+		// Clip based on the passed clip rectangles
+		xDiff = clipRect->left - r.left;
+		yDiff = clipRect->top - r.top;
+
+		if (xDiff > 0) {
+			r.left = clipRect->left;
+			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0);
+		}
+		if (yDiff > 0) {
+			r.top = clipRect->top;
+			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
+		}
+		//dx=clipRec->left, cx=clipRect.y
+		xDiff = r.right - clipRect->right;
+		yDiff = r.right - clipRect->right;
+
+		if (xDiff > 0)
+			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0);
+		if (yDiff > 0)
+			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
+	}
 
-void ViewPortResource::addRectOptSaveRect() {
+	_activePage = page;
+	_field18 = 0;
+	_setupFn = setupFn;
+	_addFn = addFn;
+	_restoreFn = restoreFn;
 
+	if (setupFn)
+		(_state._vm->_graphicsManager.*setupFn)(this);
 }
 
 void ViewPortResource::setupViewPort() {
-	setupViewPort(0, &ViewPortResource::setupMCGASaveRect, 
-		&ViewPortResource::addRectOptSaveRect, &ViewPortResource::restoreMCGASaveRect,
-		_state._vm->_graphicsManager._backgroundPage);
+	setupViewPort(_state._vm->_graphicsManager._backgroundPage, NULL,
+		&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
+		&GraphicsManager::restoreMCGASaveRect);
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 9d66cba..91f47e2 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -27,6 +27,7 @@
 #include "common/file.h"
 #include "common/rect.h"
 #include "common/str.h"
+#include "voyeur/graphics.h"
 
 namespace Voyeur {
 
@@ -129,9 +130,7 @@ public:
 	byte *memberAddr(uint32 id);
 	byte *memberAddrOffset(uint32 id);
 	void resolveIt(uint32 id, byte **p);
-	void resolveFunction(uint32 id, BoltMethodPtr *fn);
-
-	void addRectNoSaveBack() {}	// TODO
+	void resolveFunction(uint32 id, GraphicMethodPtr *fn);
 
 	BoltEntry &getBoltEntry(uint32 id);
 	PictureResource *getPictureResouce(uint32 id);
@@ -194,14 +193,13 @@ public:
 };
 
 class PictureResource {
+public:
 	uint16 _flags;
 	byte _select;
 	byte _pick;
 	byte _onOff;
 	byte _depth;
-	Common::Point _offset;
-	int _width;
-	int _height;
+	Common::Rect _bounds;
 	uint32 _maskData;
 	uint _planeSize;
 
@@ -216,37 +214,27 @@ typedef void (ViewPortResource::*ViewPortMethodPtr)();
 class ViewPortResource {
 private:
 	BoltFilesState &_state;
-
-	void setupMCGASaveRect();
-	void restoreMCGASaveRect();
-	void addRectOptSaveRect();
 private:
-	void setupViewPort(int v, ViewPortMethodPtr setupFn, ViewPortMethodPtr addRectFn, 
-		ViewPortMethodPtr restoreFn, PictureResource *page);
+	void setupViewPort(PictureResource *page, Common::Rect *clipRect, ViewPortSetupPtr setupFn,
+		ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
 public:
 	ViewPortResource *_next;
-	int _fieldC;
-	int _fieldE;
-	int _field10;
-	int _field12;
+	Common::Rect _bounds;
 	int _field18;
 	PictureResource *_picResource;
-	byte *_field24;
+	PictureResource *_activePage;
 	PictureResource *_picResource2;
 	PictureResource *_picResource3;
 	byte *_field30;
 	byte *_field34;
 	byte *_field38;
 	byte *_field3C;
-	int _field46;
-	int _field48;
-	int _field4A;
-	int _field4C;
+	Common::Rect _clipRect;
 	byte *_field7A;
-	BoltMethodPtr _fn1;
-	BoltMethodPtr _fn2;
-	BoltMethodPtr _fn3;
-	BoltMethodPtr _fn4;
+	GraphicMethodPtr _fn1;
+	ViewPortSetupPtr _setupFn;
+	ViewPortAddPtr _addFn;
+	ViewPortRestorePtr _restoreFn;
 public:
 	ViewPortResource(BoltFilesState &state, const byte *src);
 	virtual ~ViewPortResource() {}
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 2686049..e7bff00 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -66,4 +66,20 @@ void GraphicsManager::vDoCycleInt() {
 
 }
 
+void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
+
+}
+
+void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3) {
+
+}
+
+void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
+
+}
+
+void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3) {
+
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 6598cb0..43f2563 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -23,7 +23,7 @@
 #ifndef VOYEUR_GRAPHICS_H
 #define VOYEUR_GRAPHICS_H
 
-#include "voyeur/files.h"
+//#include "voyeur/files.h"
 #include "voyeur/game.h"
 #include "common/scummsys.h"
 #include "common/array.h"
@@ -38,8 +38,13 @@ namespace Voyeur {
 
 class VoyeurEngine;
 class GraphicsManager;
+class PictureResource;
+class ViewPortResource;
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
+typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
+typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, void *v2, void *v3);
+typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
 
 class GraphicsManager {
 public:
@@ -64,6 +69,11 @@ public:
 
 	void vInitColor();
 	void addFadeInt();
+
+	void setupMCGASaveRect(ViewPortResource *viewPort);
+	void addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3);	
+	void restoreMCGASaveRect(ViewPortResource *viewPort);
+	void addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3);
 };
 
 } // End of namespace Voyeur


Commit: 8e1325e5384171b23f0951e7874487ff94389be5
    https://github.com/scummvm/scummvm/commit/8e1325e5384171b23f0951e7874487ff94389be5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-30T05:31:06-07:00

Commit Message:
VOYEUR: Implemented the setupMCGASaveRect method

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 966e71b..ee23855 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -542,9 +542,9 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 		if (mode != state._vm->_graphicsManager._SVGAMode) {
 			state._vm->_graphicsManager._SVGAMode = mode;
 			// TODO: If necessary, simulate SVGA mode change
+			warning("TODO: May need to implement SVGA stub code");
 		}
 
-		error("TODO: Implement extra picture resource modes");
 //		byte *imgData = _imgData;
 		if (_flags & 0x10) {
 			// TODO: Figure out what it's doing. Looks like a direct clearing
@@ -591,6 +591,7 @@ PictureResource::~PictureResource() {
 
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_state(state) {
+	_flags = READ_LE_UINT16(src);
 	_next = state._curLibPtr->getBoltEntry(READ_LE_UINT32(src + 2))._viewPortResource;
 
 	int xs = READ_LE_UINT16(src + 0xC);
@@ -609,6 +610,7 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
 
+	_field42 = (int16)READ_LE_UINT16(src + 0x42);
 	xs = READ_LE_UINT16(src + 0x46);
 	ys = READ_LE_UINT16(src + 0x48);
 	_clipRect = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 0x4A),
@@ -628,8 +630,8 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
 		ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
 	PictureResource *pic = _picResource;
-	Common::Rect r(_bounds.left + pic->_bounds.left, _bounds.top + pic->_bounds.top,
-		_bounds.right, _bounds.bottom);
+	Common::Rect r = _bounds;
+	r.translate(pic->_bounds.left, pic->_bounds.top);
 	int xDiff, yDiff;
 
 	if (page) {
@@ -638,16 +640,18 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRe
 		yDiff = page->_bounds.top - r.top;
 
 		if (xDiff > 0) {
+			int width = r.width();
 			r.left = page->_bounds.left;
-			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0);
+			r.setWidth(xDiff <= width ? width - xDiff : 0);
 		}
 		if (yDiff > 0) {
+			int height = r.height();
 			r.top = page->_bounds.top;
-			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
+			r.setHeight(yDiff <= height ? height - yDiff : 0);
 		}
 
-		xDiff = page->_bounds.left + page->_bounds.width();
-		yDiff = page->_bounds.top + page->_bounds.height();
+		xDiff = r.right - page->_bounds.right;
+		yDiff = r.bottom - page->_bounds.bottom;
 
 		if (xDiff > 0)
 			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0); 
@@ -661,14 +665,16 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRe
 		yDiff = clipRect->top - r.top;
 
 		if (xDiff > 0) {
+			int width = r.width();
 			r.left = clipRect->left;
-			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0);
+			r.setWidth(xDiff <= width ? width - xDiff : 0);
 		}
 		if (yDiff > 0) {
+			int height = r.height();
 			r.top = clipRect->top;
-			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
+			r.setHeight(yDiff <= height ? height - yDiff : 0);
 		}
-		//dx=clipRec->left, cx=clipRect.y
+		
 		xDiff = r.right - clipRect->right;
 		yDiff = r.right - clipRect->right;
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 91f47e2..228b509 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -218,6 +218,7 @@ private:
 	void setupViewPort(PictureResource *page, Common::Rect *clipRect, ViewPortSetupPtr setupFn,
 		ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
 public:
+	int _flags;
 	ViewPortResource *_next;
 	Common::Rect _bounds;
 	int _field18;
@@ -229,6 +230,7 @@ public:
 	byte *_field34;
 	byte *_field38;
 	byte *_field3C;
+	int16 _field42;
 	Common::Rect _clipRect;
 	byte *_field7A;
 	GraphicMethodPtr _fn1;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index e7bff00..3339170 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -29,9 +29,11 @@
 namespace Voyeur {
 
 GraphicsManager::GraphicsManager() {
-	_palFlag = false;
 	_SVGAPage = 0;
 	_SVGAMode = 0;
+	_palFlag = false;
+	_MCGAMode = false;
+	_clipPtr = NULL;
 }
 
 void GraphicsManager::sInitGraphics() {
@@ -67,7 +69,19 @@ void GraphicsManager::vDoCycleInt() {
 }
 
 void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
+	_MCGAMode = true;
+
+	if (viewPort->_activePage) {
+		viewPort->_activePage->_flags |= 1;
+		Common::Rect *clipRect = _clipPtr;
+		_clipPtr = &viewPort->_clipRect;
+
+		sDrawPic(viewPort->_activePage, viewPort->_picResource, viewPort, NULL);
 
+		_clipPtr = clipRect;
+	}
+
+	viewPort->_field42 = -1;
 }
 
 void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3) {
@@ -82,4 +96,8 @@ void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, void *v2, vo
 
 }
 
+void GraphicsManager::sDrawPic(PictureResource *pic, PictureResource *pic2, ViewPortResource *viewPort, void *v3) {
+
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 43f2563..ce89621 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -56,6 +56,8 @@ public:
 	int _SVGAPage;
 	int _SVGAMode;
 	ViewPortResource *_vPort;
+	bool _MCGAMode;
+	Common::Rect *_clipPtr;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
@@ -74,6 +76,8 @@ public:
 	void addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3);	
 	void restoreMCGASaveRect(ViewPortResource *viewPort);
 	void addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3);
+
+	void sDrawPic(PictureResource *pic, PictureResource *pic2, ViewPortResource *viewPort, void *v3);
 };
 
 } // End of namespace Voyeur


Commit: 43d31cc33424c053e8f42c7fcb5f18b422ef1ef9
    https://github.com/scummvm/scummvm/commit/43d31cc33424c053e8f42c7fcb5f18b422ef1ef9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-31T15:40:04-07:00

Commit Message:
VOYEUR: Implemented first execution path through sInitPic

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ee23855..6f2ef5c 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -510,6 +510,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_maskData = READ_LE_UINT32(&src[14]);
 
 	_imgData = NULL;
+	_secondPicture = NULL;
 
 	int nbytes = _bounds.width() * _bounds.height();
 	if (_flags & 0x20) {
@@ -683,9 +684,10 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRe
 		if (yDiff > 0)
 			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
 	}
-
+// clip = (0x20, 0x14, width: 0x140, height: 0C8h
 	_activePage = page;
 	_field18 = 0;
+	_clipRect = r;
 	_setupFn = setupFn;
 	_addFn = addFn;
 	_restoreFn = restoreFn;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 228b509..57fbb0f 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -204,6 +204,13 @@ public:
 	uint _planeSize;
 
 	byte *_imgData;
+
+	// TODO: Investigate further just why/how pictuers are chained
+	PictureResource *_secondPicture;
+	// TODO: Figure out if the following data is part of all pictures, or if
+	// only for certain types (when flags & 0x8000 != 0)
+	Common::Rect _bounds2;
+	Field86MethodPtr _field86;
 public:
 	PictureResource(BoltFilesState &state, const byte *src);
 	virtual ~PictureResource();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 3339170..006aca1 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -31,8 +31,11 @@ namespace Voyeur {
 GraphicsManager::GraphicsManager() {
 	_SVGAPage = 0;
 	_SVGAMode = 0;
+	_SVGAReset = 0;
+	_screenOffset = 0;
 	_palFlag = false;
 	_MCGAMode = false;
+	_saveBack = false;
 	_clipPtr = NULL;
 }
 
@@ -76,7 +79,7 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 		Common::Rect *clipRect = _clipPtr;
 		_clipPtr = &viewPort->_clipRect;
 
-		sDrawPic(viewPort->_activePage, viewPort->_picResource, viewPort, NULL);
+		sDrawPic(viewPort->_activePage, viewPort->_picResource, Common::Point(), NULL);
 
 		_clipPtr = clipRect;
 	}
@@ -96,8 +99,178 @@ void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, void *v2, vo
 
 }
 
-void GraphicsManager::sDrawPic(PictureResource *pic, PictureResource *pic2, ViewPortResource *viewPort, void *v3) {
+void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic, 
+		const Common::Point &offset, void *v3) {
+	int var4C = 0;
+	int width1, width2;
+	int widthDiff, widthDiff2;
+	int height1;
+	int srcOffset;
+	int screenOffset;
+	int flags1, flags2;
+	PictureResource *saveddestPic = NULL;
+	Common::Rect newBounds;
+	Common::Rect backBounds;
+	int var24;
+	bool isClipped = false;
+	int var52;
+	int var20, var22;
+	int var26;
+	byte *imgData1, *imgData2;
+	byte *srcP, *destP;
 
+	if (srcPic->_flags & 0x8000) {
+		srcPic = srcPic->_secondPicture;
+		warning("TODO: Particularly validate 'extended' pictures");
+	}
+	if (destPic->_flags & 0x8000) {
+		saveddestPic = destPic;
+		destPic = destPic->_secondPicture;
+		warning("TODO: Particularly validate 'extended' pictures");
+	}
+
+	Common::Point ofs = Common::Point(offset.x + srcPic->_bounds.left - destPic->_bounds.left, 
+		offset.y + srcPic->_bounds.top - destPic->_bounds.top);
+	width1 = width2 = srcPic->_bounds.width();
+	height1 = srcPic->_bounds.height();
+	srcOffset = 0;
+	flags1 = srcPic->_flags;
+	flags2 = destPic->_flags;
+
+	if (flags1 & 1) {
+		if (_clipPtr) {
+			int xs = _clipPtr->left - srcPic->_bounds.left;
+			int ys = _clipPtr->top - srcPic->_bounds.top;
+			newBounds = Common::Rect(xs, ys, xs + _clipPtr->width(), ys + _clipPtr->height());
+		} else if (saveddestPic) {
+			int xs = saveddestPic->_bounds2.left - destPic->_bounds.left;
+			int ys = saveddestPic->_bounds2.top - destPic->_bounds.top;
+			newBounds = Common::Rect(xs, ys, xs + destPic->_bounds2.width(), ys + destPic->_bounds2.height());
+		} else {
+			newBounds = Common::Rect(0, 0, destPic->_bounds.width(), destPic->_bounds.height());
+		}
+
+		var24 = ofs.y - newBounds.top;
+		if (var24 < 0) {
+			var52 = width2;
+			srcOffset -= var24 * var52;
+			height1 += var24;
+			ofs.y = newBounds.top;
+			
+			if (height1 <= 0)
+				return;
+
+			isClipped = true;
+		}
+
+		var20 = newBounds.bottom - (ofs.y + height1);
+		if (var20 < 0) {
+			height1 += var20;
+			if (height1 <= 0)
+				return;
+		}
+
+		var22 = ofs.x - newBounds.left;
+		if (var22 < 0) {
+			srcOffset -= var22;
+			width2 += var22;
+			ofs.x = newBounds.left;
+
+			if (width2 <= 0)
+				return;
+
+			isClipped = true;
+		}
+
+		var26 = newBounds.right - (ofs.x + width2);
+		if (var26 < 0) {
+			width2 += var26;
+			if (width2 <= 0)
+				return;
+
+			isClipped = true;
+		}
+	}
+
+	screenOffset = ofs.y * destPic->_bounds.width() + ofs.x;
+	widthDiff = width1 - width2;
+	widthDiff2 = destPic->_bounds.width() - width2;
+
+	if (saveddestPic) {
+		error("TODO: Examine further when it's actually used");
+		if (!_saveBack || ((srcPic->_flags & 0x800) != 0)) {
+			// TODO
+		} else if (!saveddestPic->_field86) {
+			// TODO
+		} else {
+			int xs = ofs.x + destPic->_bounds.left;
+			int ys = ofs.y + destPic->_bounds.top;
+			backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
+
+			(this->*saveddestPic->_field86)(saveddestPic, saveddestPic->_bounds.top, backBounds);
+		}
+	}
+
+	if (flags1 & 0x1000) {
+		imgData1 = srcPic->_imgData + (var4C << 14) + _screenOffset;
+		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
+			if (var4C < 4) {
+				EMSMapPageHandle(srcPic->_planeSize, srcPic->_imgData[idx], var4C);
+				++var4C;
+			}
+		}
+	} else {
+		imgData1 = srcPic->_imgData;
+	}
+	if (flags2 & 0x1000) {
+		imgData2 = destPic->_imgData + (var4C << 14) + _screenOffset;
+		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
+			if (var4C < 4) {
+				EMSMapPageHandle(destPic->_planeSize, destPic->_imgData[idx], var4C);
+				++var4C;
+			}
+		}		
+	} else {
+		imgData2 = destPic->_imgData;
+	}
+
+	_SVGAPage = _SVGAReset;
+	if (srcPic->_select != 0xff)
+		return;
+
+	if (srcPic->_pick == 0xff) {
+		if (flags1 & 8) {
+			error("TODO: sDrawPic");
+		} else {
+			srcP = imgData1 + srcOffset;
+
+			if (flags2 & 8) {
+				error("TODO: sDrawPic");
+			} else {
+				destP = imgData2 + screenOffset;
+
+				if (flags1 & 2) {
+					error("TODO: sDrawPic");
+				} else {
+					if (flags1 & 0x100) {
+						error("TODO: sDrawPic");
+					} else {
+						for (int yp = 0; yp < height1; ++yp) {
+							Common::copy(srcP, srcP + width2, destP);
+							destP += width2 + widthDiff2;
+							srcP += width2 + widthDiff;
+						}
+					}
+				}
+			}
+		}
+	} else {
+		error("TODO: sDrawPic");
+	}
+}
+
+void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
+	// TODO
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index ce89621..d17b18d 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -45,6 +45,7 @@ typedef void (GraphicsManager::*GraphicMethodPtr)();
 typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
 typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, void *v2, void *v3);
 typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
+typedef void (GraphicsManager::*Field86MethodPtr)(void *pic, int y, Common::Rect &bounds);
 
 class GraphicsManager {
 public:
@@ -55,9 +56,12 @@ public:
 	PictureResource *_backgroundPage;
 	int _SVGAPage;
 	int _SVGAMode;
+	int _SVGAReset;
 	ViewPortResource *_vPort;
 	bool _MCGAMode;
+	bool _saveBack;
 	Common::Rect *_clipPtr;
+	int _screenOffset;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
@@ -77,7 +81,8 @@ public:
 	void restoreMCGASaveRect(ViewPortResource *viewPort);
 	void addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3);
 
-	void sDrawPic(PictureResource *pic, PictureResource *pic2, ViewPortResource *viewPort, void *v3);
+	void EMSMapPageHandle(int v1, int v2, int v3);
+	void sDrawPic(PictureResource *srcPic, PictureResource *destPic, const Common::Point &offset, void *v3);
 };
 
 } // End of namespace Voyeur


Commit: 4279eedceb261e3c179343b15d2e6841dc0bd43b
    https://github.com/scummvm/scummvm/commit/4279eedceb261e3c179343b15d2e6841dc0bd43b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-31T18:03:16-07:00

Commit Message:
VOYEUR: Cleanup of sDrawPic parameter usage and viewport initialisation

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 6f2ef5c..f72517a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -412,8 +412,13 @@ void BoltFile::initViewPort() {
 
 void BoltFile::initViewPortList() {
 	initDefault();
-	_state._curMemberPtr->_viewPortListResource = new ViewPortListResource(
+
+	ViewPortListResource *res;
+	_state._curMemberPtr->_viewPortListResource = res = new ViewPortListResource(
 		_state, _state._curMemberPtr->_data);
+
+	_state._vm->_graphicsManager._viewPortListPtr = &res->_entries;
+	_state._vm->_graphicsManager._vPort = &res->_entries[0];
 }
 
 void BoltFile::initFontInfo() {
@@ -510,7 +515,6 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_maskData = READ_LE_UINT32(&src[14]);
 
 	_imgData = NULL;
-	_secondPicture = NULL;
 
 	int nbytes = _bounds.width() * _bounds.height();
 	if (_flags & 0x20) {
@@ -716,8 +720,6 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 		assert(entry._viewPortResource);
 		_entries.push_back(entry._viewPortResource);
 	}
-
-	state._vm->_graphicsManager._vPort = _entries[0];
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 57fbb0f..d75c88a 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -192,9 +192,13 @@ public:
 	bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
 };
 
-class PictureResource {
+class DisplayResource {
 public:
 	uint16 _flags;
+};
+
+class PictureResource: public DisplayResource {
+public:
 	byte _select;
 	byte _pick;
 	byte _onOff;
@@ -204,13 +208,6 @@ public:
 	uint _planeSize;
 
 	byte *_imgData;
-
-	// TODO: Investigate further just why/how pictuers are chained
-	PictureResource *_secondPicture;
-	// TODO: Figure out if the following data is part of all pictures, or if
-	// only for certain types (when flags & 0x8000 != 0)
-	Common::Rect _bounds2;
-	Field86MethodPtr _field86;
 public:
 	PictureResource(BoltFilesState &state, const byte *src);
 	virtual ~PictureResource();
@@ -218,14 +215,13 @@ public:
 
 typedef void (ViewPortResource::*ViewPortMethodPtr)();
 
-class ViewPortResource {
+class ViewPortResource: public DisplayResource {
 private:
 	BoltFilesState &_state;
 private:
 	void setupViewPort(PictureResource *page, Common::Rect *clipRect, ViewPortSetupPtr setupFn,
 		ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
 public:
-	int _flags;
 	ViewPortResource *_next;
 	Common::Rect _bounds;
 	int _field18;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 006aca1..0a208e4 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -37,6 +37,8 @@ GraphicsManager::GraphicsManager() {
 	_MCGAMode = false;
 	_saveBack = false;
 	_clipPtr = NULL;
+	_viewPortListPtr = NULL;
+	_vPort = NULL;
 }
 
 void GraphicsManager::sInitGraphics() {
@@ -87,19 +89,19 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 	viewPort->_field42 = -1;
 }
 
-void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3) {
-
+void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
+	// TODO
 }
 
 void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
-
+	// TODO
 }
 
-void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3) {
+void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
 
 }
 
-void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic, 
+void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
 		const Common::Point &offset, void *v3) {
 	int var4C = 0;
 	int width1, width2;
@@ -108,7 +110,7 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
 	int srcOffset;
 	int screenOffset;
 	int flags1, flags2;
-	PictureResource *saveddestPic = NULL;
+	ViewPortResource *destViewPort = NULL;
 	Common::Rect newBounds;
 	Common::Rect backBounds;
 	int var24;
@@ -119,14 +121,17 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
 	byte *imgData1, *imgData2;
 	byte *srcP, *destP;
 
-	if (srcPic->_flags & 0x8000) {
-		srcPic = srcPic->_secondPicture;
-		warning("TODO: Particularly validate 'extended' pictures");
+	// Get the picture parameters, or deference viewport pointers to get their pictures
+	PictureResource *srcPic = (PictureResource *)srcDisplay;
+	PictureResource *destPic = (PictureResource *)destDisplay;
+
+	if (srcDisplay->_flags & 0x8000) {
+		// A viewport was passed, not a picture
+		srcPic = ((ViewPortResource *)srcDisplay)->_picResource;
 	}
-	if (destPic->_flags & 0x8000) {
-		saveddestPic = destPic;
-		destPic = destPic->_secondPicture;
-		warning("TODO: Particularly validate 'extended' pictures");
+	if (destDisplay->_flags & 0x8000) {
+		destViewPort = (ViewPortResource *)destDisplay;
+		destPic = destViewPort->_picResource;
 	}
 
 	Common::Point ofs = Common::Point(offset.x + srcPic->_bounds.left - destPic->_bounds.left, 
@@ -142,10 +147,11 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
 			int xs = _clipPtr->left - srcPic->_bounds.left;
 			int ys = _clipPtr->top - srcPic->_bounds.top;
 			newBounds = Common::Rect(xs, ys, xs + _clipPtr->width(), ys + _clipPtr->height());
-		} else if (saveddestPic) {
-			int xs = saveddestPic->_bounds2.left - destPic->_bounds.left;
-			int ys = saveddestPic->_bounds2.top - destPic->_bounds.top;
-			newBounds = Common::Rect(xs, ys, xs + destPic->_bounds2.width(), ys + destPic->_bounds2.height());
+		} else if (destViewPort) {
+			int xs = destViewPort->_clipRect.left - destPic->_bounds.left;
+			int ys = destViewPort->_clipRect.top - destPic->_bounds.top;
+			newBounds = Common::Rect(xs, ys, xs + destViewPort->_clipRect.width(),
+				ys + destViewPort->_clipRect.height());
 		} else {
 			newBounds = Common::Rect(0, 0, destPic->_bounds.width(), destPic->_bounds.height());
 		}
@@ -196,18 +202,18 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
 	widthDiff = width1 - width2;
 	widthDiff2 = destPic->_bounds.width() - width2;
 
-	if (saveddestPic) {
+	if (destViewPort) {
 		error("TODO: Examine further when it's actually used");
 		if (!_saveBack || ((srcPic->_flags & 0x800) != 0)) {
 			// TODO
-		} else if (!saveddestPic->_field86) {
+		} else if (!destViewPort->_addFn) {
 			// TODO
 		} else {
 			int xs = ofs.x + destPic->_bounds.left;
 			int ys = ofs.y + destPic->_bounds.top;
 			backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
 
-			(this->*saveddestPic->_field86)(saveddestPic, saveddestPic->_bounds.top, backBounds);
+			(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, &backBounds);
 		}
 	}
 
@@ -273,4 +279,12 @@ void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
 	// TODO
 }
 
+void GraphicsManager::flipPage() {
+
+}
+
+void GraphicsManager::sWaitFlip() {
+
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index d17b18d..f7e43ff 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -38,14 +38,14 @@ namespace Voyeur {
 
 class VoyeurEngine;
 class GraphicsManager;
+class DisplayResource;
 class PictureResource;
 class ViewPortResource;
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
 typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
-typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, void *v2, void *v3);
+typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int y, Common::Rect *bounds);
 typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
-typedef void (GraphicsManager::*Field86MethodPtr)(void *pic, int y, Common::Rect &bounds);
 
 class GraphicsManager {
 public:
@@ -57,7 +57,8 @@ public:
 	int _SVGAPage;
 	int _SVGAMode;
 	int _SVGAReset;
-	ViewPortResource *_vPort;
+	Common::Array<ViewPortResource *> *_viewPortListPtr;
+	ViewPortResource **_vPort;
 	bool _MCGAMode;
 	bool _saveBack;
 	Common::Rect *_clipPtr;
@@ -77,12 +78,14 @@ public:
 	void addFadeInt();
 
 	void setupMCGASaveRect(ViewPortResource *viewPort);
-	void addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3);	
+	void addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds);	
 	void restoreMCGASaveRect(ViewPortResource *viewPort);
-	void addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3);
+	void addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds);
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
-	void sDrawPic(PictureResource *srcPic, PictureResource *destPic, const Common::Point &offset, void *v3);
+	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
+	void flipPage();
+	void sWaitFlip();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index dc25ec4..27bf858 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -143,8 +143,13 @@ void VoyeurEngine::doHeadTitle() {
 	_eventsManager.startMainClockInt();
 	if (_bVoy->getBoltGroup(0x10500)) {
 		_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
-		_graphicsManager._vPort->setupViewPort();
-		
+		(*_graphicsManager._vPort)->setupViewPort();
+		(*_graphicsManager._vPort)->_flags |= 8;
+
+		_graphicsManager.flipPage();
+		_graphicsManager.sWaitFlip();
+
+		// TODO: 
 	}
 }
 


Commit: a6c852c99d73d9bef30d85d59cbb8364858a0daa
    https://github.com/scummvm/scummvm/commit/a6c852c99d73d9bef30d85d59cbb8364858a0daa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-31T18:31:33-07:00

Commit Message:
VOYEUR: Implemented flipPage

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index f72517a..05617a0 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -598,17 +598,20 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_state(state) {
 	_flags = READ_LE_UINT16(src);
 	_next = state._curLibPtr->getBoltEntry(READ_LE_UINT32(src + 2))._viewPortResource;
-
-	int xs = READ_LE_UINT16(src + 0xC);
-	int ys = READ_LE_UINT16(src + 0xE);
-	_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 0x10), 
-		ys + READ_LE_UINT16(src + 0x12));
+	_pageCount = READ_LE_UINT16(src + 6);
+	_pageIndex = READ_LE_UINT16(src + 8);
+	_lastPage = READ_LE_UINT16(src + 10);
+
+	int xs = READ_LE_UINT16(src + 12);
+	int ys = READ_LE_UINT16(src + 14);
+	_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 16), 
+		ys + READ_LE_UINT16(src + 18));
 	_field18 = READ_LE_UINT16(src + 0x18);
 
-	_picResource = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
+	_currentPic = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
 	_activePage = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x24));
-	_picResource2 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
-	_picResource3 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
+	_pages[0] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
+	_pages[1] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
 
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
@@ -634,7 +637,7 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 
 void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
 		ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
-	PictureResource *pic = _picResource;
+	PictureResource *pic = _currentPic;
 	Common::Rect r = _bounds;
 	r.translate(pic->_bounds.left, pic->_bounds.top);
 	int xDiff, yDiff;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index d75c88a..8e00731 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -223,12 +223,14 @@ private:
 		ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
 public:
 	ViewPortResource *_next;
+	int _pageCount;
+	int _pageIndex;
+	int _lastPage;
 	Common::Rect _bounds;
 	int _field18;
-	PictureResource *_picResource;
+	PictureResource *_currentPic;
 	PictureResource *_activePage;
-	PictureResource *_picResource2;
-	PictureResource *_picResource3;
+	PictureResource *_pages[2];
 	byte *_field30;
 	byte *_field34;
 	byte *_field38;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 0a208e4..0b47e93 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -33,6 +33,7 @@ GraphicsManager::GraphicsManager() {
 	_SVGAMode = 0;
 	_SVGAReset = 0;
 	_screenOffset = 0;
+	_planeSelect = 0;
 	_palFlag = false;
 	_MCGAMode = false;
 	_saveBack = false;
@@ -81,7 +82,7 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 		Common::Rect *clipRect = _clipPtr;
 		_clipPtr = &viewPort->_clipRect;
 
-		sDrawPic(viewPort->_activePage, viewPort->_picResource, Common::Point(), NULL);
+		sDrawPic(viewPort->_activePage, viewPort->_currentPic, Common::Point(), NULL);
 
 		_clipPtr = clipRect;
 	}
@@ -127,11 +128,11 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 
 	if (srcDisplay->_flags & 0x8000) {
 		// A viewport was passed, not a picture
-		srcPic = ((ViewPortResource *)srcDisplay)->_picResource;
+		srcPic = ((ViewPortResource *)srcDisplay)->_currentPic;
 	}
 	if (destDisplay->_flags & 0x8000) {
 		destViewPort = (ViewPortResource *)destDisplay;
-		destPic = destViewPort->_picResource;
+		destPic = destViewPort->_currentPic;
 	}
 
 	Common::Point ofs = Common::Point(offset.x + srcPic->_bounds.left - destPic->_bounds.left, 
@@ -275,12 +276,41 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	}
 }
 
+void GraphicsManager::sDisplayPic(PictureResource *pic) {
+	// TODO
+}
+
 void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
 	// TODO
 }
 
 void GraphicsManager::flipPage() {
+	Common::Array<ViewPortResource *> &viewPorts = *_viewPortListPtr;
+	bool flipFlag = false;
+
+	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
+		if (viewPorts[idx]->_flags & 0x20) {
+			if ((viewPorts[idx]->_flags & 9) == 9) {
+				if (_planeSelect == idx)
+					sDisplayPic(viewPorts[idx]->_currentPic);
+				flipFlag = true;
+			}
+		}
 
+		if (flipFlag) {
+			ViewPortResource &viewPort = *viewPorts[idx];
+
+			viewPort._lastPage = viewPort._pageIndex;
+			++viewPort._pageIndex;
+
+			if (viewPort._pageIndex >= viewPort._pageCount)
+				viewPort._pageIndex = 0;
+
+			assert(viewPort._pageIndex < 2);
+			viewPort._currentPic = viewPort._pages[viewPort._pageIndex];
+			viewPort._flags = (viewPort._flags & 0xFFF7) | 0x40;
+		}
+	}
 }
 
 void GraphicsManager::sWaitFlip() {
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index f7e43ff..1c86952 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -63,6 +63,7 @@ public:
 	bool _saveBack;
 	Common::Rect *_clipPtr;
 	int _screenOffset;
+	uint _planeSelect;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
@@ -84,6 +85,7 @@ public:
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
+	void sDisplayPic(PictureResource *pic);
 	void flipPage();
 	void sWaitFlip();
 };


Commit: 8b6d3169cc407ba000dac4d9b4bec5719fce52a4
    https://github.com/scummvm/scummvm/commit/8b6d3169cc407ba000dac4d9b4bec5719fce52a4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-05-31T19:13:28-07:00

Commit Message:
VOYEUR: Implemented sWaitFlip

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index f84c978..c7ec6b9 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -49,4 +49,26 @@ void EventsManager::vStopCycle() {
 	_cycleStatus &= 2;
 }
 
+void EventsManager::sWaitFlip() {
+	// TODO: See if this needs a proper wait loop with event polling
+	//while (_intPtr._field39) ;
+
+	Common::Array<ViewPortResource *> &viewPorts = *_vm->_graphicsManager._viewPortListPtr;
+	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
+		ViewPortResource &viewPort = *viewPorts[idx];
+
+		if (_vm->_graphicsManager._saveBack && (viewPort._flags & 0x40)) {
+			Common::Rect *clipPtr = _vm->_graphicsManager._clipPtr;
+			_vm->_graphicsManager._clipPtr = &viewPort._clipRect;
+
+			if (viewPort._restoreFn)
+				(_vm->_graphicsManager.*viewPort._restoreFn)(&viewPort);
+
+			_vm->_graphicsManager._clipPtr = clipPtr;
+			viewPort._field40[viewPort._pageIndex] = 0;
+			viewPort._flags &= 0xFFBF;
+		}
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index a3696a9..98e491a 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -36,6 +36,7 @@ private:
 
 	static void mainVoyeurIntFunc();
 public:
+	IntData _intPtr;
 	IntNode _fadeIntNode;
 	IntNode _cycleIntNode;
 	IntNode _evintnode;
@@ -48,6 +49,7 @@ public:
 	void resetMouse();
 	void startMainClockInt();
 	void vStopCycle();
+	void sWaitFlip();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 05617a0..aacefd9 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -618,7 +618,9 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
 
-	_field42 = (int16)READ_LE_UINT16(src + 0x42);
+	for (int i = 0; i < 3; ++i)
+		_field40[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
+
 	xs = READ_LE_UINT16(src + 0x46);
 	ys = READ_LE_UINT16(src + 0x48);
 	_clipRect = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 0x4A),
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 8e00731..ccbea8a 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -235,7 +235,7 @@ public:
 	byte *_field34;
 	byte *_field38;
 	byte *_field3C;
-	int16 _field42;
+	int16 _field40[3];
 	Common::Rect _clipRect;
 	byte *_field7A;
 	GraphicMethodPtr _fn1;
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index 26e5d31..e38863a1 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -24,6 +24,10 @@
 
 namespace Voyeur {
 
+IntData::IntData() {
+	_field9 = false;
+}
+
 void IntData::audioInit() {
 
 }
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 99f97fd..35fffbe 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -111,9 +111,12 @@ public:
 
 class IntData {
 public:
+	bool _field9;
 	byte *_colors;
 	Common::List<IntNode *> _intNodes;
 public:
+	IntData();
+
 	void audioInit();
 	void addIntNode(IntNode *node);
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 0b47e93..b0487a0 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -53,7 +53,7 @@ void GraphicsManager::addFadeInt() {
 	node._curTime = 0;
 	node._timeReset = 1;
 
-	_vm->_intPtr.addIntNode(&node);
+	_vm->_eventsManager._intPtr.addIntNode(&node);
 }
 
 void GraphicsManager::vInitColor() {
@@ -63,15 +63,15 @@ void GraphicsManager::vInitColor() {
 }
 
 void GraphicsManager::fadeIntFunc() {
-
+	// TODO: more
 }
 
 void GraphicsManager::vDoFadeInt() {
-	
+	// TODO: more
 }
 
 void GraphicsManager::vDoCycleInt() {
-
+	// TODO: more
 }
 
 void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
@@ -87,7 +87,7 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 		_clipPtr = clipRect;
 	}
 
-	viewPort->_field42 = -1;
+	viewPort->_field40[1] = -1;
 }
 
 void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
@@ -99,7 +99,7 @@ void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
 }
 
 void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
-
+	// TODO: more
 }
 
 void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
@@ -313,8 +313,4 @@ void GraphicsManager::flipPage() {
 	}
 }
 
-void GraphicsManager::sWaitFlip() {
-
-}
-
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 1c86952..c34c2b4 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -87,7 +87,6 @@ public:
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();
-	void sWaitFlip();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 27bf858..1ff1bde 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -131,7 +131,7 @@ void VoyeurEngine::initBolt() {
 }
 
 void VoyeurEngine::vInitInterrupts() {
-	_intPtr._colors = &_graphicsManager._VGAColors[0];
+	_eventsManager._intPtr._colors = &_graphicsManager._VGAColors[0];
 }
 
 void VoyeurEngine::initInput() {
@@ -147,7 +147,7 @@ void VoyeurEngine::doHeadTitle() {
 		(*_graphicsManager._vPort)->_flags |= 8;
 
 		_graphicsManager.flipPage();
-		_graphicsManager.sWaitFlip();
+		_eventsManager.sWaitFlip();
 
 		// TODO: 
 	}
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index d8fb4ad..818615f 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -79,7 +79,6 @@ protected:
 	virtual Common::Error run();
 	virtual bool hasFeature(EngineFeature f) const;
 public:
-	IntData _intPtr;
 	EventsManager _eventsManager;
 	FilesManager _filesManager;
 	GraphicsManager _graphicsManager;


Commit: 99f474a3b6471392295f6d1cc33acd6ae4123447
    https://github.com/scummvm/scummvm/commit/99f474a3b6471392295f6d1cc33acd6ae4123447
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-01T09:35:50-07:00

Commit Message:
VOYEUR: Implemented the restoreMCGASaveRect method

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index c7ec6b9..c43c810 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -65,7 +65,7 @@ void EventsManager::sWaitFlip() {
 				(_vm->_graphicsManager.*viewPort._restoreFn)(&viewPort);
 
 			_vm->_graphicsManager._clipPtr = clipPtr;
-			viewPort._field40[viewPort._pageIndex] = 0;
+			viewPort._rectListCount[viewPort._pageIndex] = 0;
 			viewPort._flags &= 0xFFBF;
 		}
 	}
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index aacefd9..8522cc7 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -614,12 +614,21 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 	_pages[1] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
 
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
 
-	for (int i = 0; i < 3; ++i)
-		_field40[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
+	// Get the rect list
+	for (int i = 0; i < 3; ++i) {
+		_rectListCount[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
+
+		int16 *rectList = (int16 *)state._curLibPtr->memberAddrOffset(READ_LE_UINT32(src + 0x34 + i * 4));
+		_rectListPtr[i] = new Common::Array<Common::Rect>();
+
+		for (int i = 0; i < _rectListCount[0]; ++i) {
+			int xs = FROM_LE_16(rectList[0]);
+			int ys = FROM_LE_16(rectList[1]);
+			_rectListPtr[i]->push_back(Common::Rect(xs, ys, xs + FROM_LE_16(rectList[2]),
+				ys + FROM_LE_16(rectList[3])));
+		}
+	}
 
 	xs = READ_LE_UINT16(src + 0x46);
 	ys = READ_LE_UINT16(src + 0x48);
@@ -637,6 +646,11 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_addFn = &GraphicsManager::addRectNoSaveBack;
 }
 
+ViewPortResource::~ViewPortResource() {
+	for (int i = 0; i < 3; ++i)
+		delete _rectListPtr[i];
+}
+
 void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
 		ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
 	PictureResource *pic = _currentPic;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index ccbea8a..32c203e 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -232,10 +232,8 @@ public:
 	PictureResource *_activePage;
 	PictureResource *_pages[2];
 	byte *_field30;
-	byte *_field34;
-	byte *_field38;
-	byte *_field3C;
-	int16 _field40[3];
+	Common::Array<Common::Rect> *_rectListPtr[3];
+	int _rectListCount[3];
 	Common::Rect _clipRect;
 	byte *_field7A;
 	GraphicMethodPtr _fn1;
@@ -244,7 +242,7 @@ public:
 	ViewPortRestorePtr _restoreFn;
 public:
 	ViewPortResource(BoltFilesState &state, const byte *src);
-	virtual ~ViewPortResource() {}
+	virtual ~ViewPortResource();
 
 	void setupViewPort();
 };
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index e38863a1..9167cd9 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -26,6 +26,8 @@ namespace Voyeur {
 
 IntData::IntData() {
 	_field9 = false;
+	_flipWait = false;
+	_field2A = 0;
 }
 
 void IntData::audioInit() {
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 35fffbe..d99df39 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -112,6 +112,8 @@ public:
 class IntData {
 public:
 	bool _field9;
+	bool _flipWait;
+	int _field2A;
 	byte *_colors;
 	Common::List<IntNode *> _intNodes;
 public:
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index b0487a0..3acf2a3 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -34,6 +34,7 @@ GraphicsManager::GraphicsManager() {
 	_SVGAReset = 0;
 	_screenOffset = 0;
 	_planeSelect = 0;
+	_sImageShift = 3;
 	_palFlag = false;
 	_MCGAMode = false;
 	_saveBack = false;
@@ -87,18 +88,34 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 		_clipPtr = clipRect;
 	}
 
-	viewPort->_field40[1] = -1;
+	viewPort->_rectListCount[1] = -1;
 }
 
-void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
+void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
 	// TODO
 }
 
 void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
-	// TODO
+	if (viewPort->_rectListCount[0] != -1) {
+		for (int i = 0; i < viewPort->_rectListCount[0]; ++i) {
+			addRectOptSaveRect(viewPort, 1, (*viewPort->_rectListPtr[0])[i]);
+		}
+	} else {
+		viewPort->_rectListCount[1] = -1;
+	}
+
+	restoreBack(*viewPort->_rectListPtr[1], viewPort->_rectListCount[1], viewPort->_pages[0],
+		viewPort->_pages[1]);
+	
+	int count = viewPort->_rectListCount[0];
+	restoreBack(*viewPort->_rectListPtr[0], viewPort->_rectListCount[0], 
+		viewPort->_activePage, viewPort->_currentPic);
+
+	SWAP(viewPort->_rectListPtr[0], viewPort->_rectListPtr[1]);
+	viewPort->_rectListCount[1] = count;
 }
 
-void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
+void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
 	// TODO: more
 }
 
@@ -214,7 +231,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			int ys = ofs.y + destPic->_bounds.top;
 			backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
 
-			(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, &backBounds);
+			(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, backBounds);
 		}
 	}
 
@@ -276,8 +293,15 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	}
 }
 
+/**
+ * Queues the given picture for display
+ */
 void GraphicsManager::sDisplayPic(PictureResource *pic) {
-	// TODO
+	if (pic->_flags & 8) {
+		_vm->_eventsManager._intPtr._field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
+	}
+
+	_vm->_eventsManager._intPtr._flipWait = true;
 }
 
 void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
@@ -313,4 +337,9 @@ void GraphicsManager::flipPage() {
 	}
 }
 
+void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
+		PictureResource *srcPic, PictureResource *destPic) {
+	//TODO
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index c34c2b4..263d44e 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -44,7 +44,7 @@ class ViewPortResource;
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
 typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
-typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int y, Common::Rect *bounds);
+typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int idx, const Common::Rect &bounds);
 typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
 
 class GraphicsManager {
@@ -64,12 +64,15 @@ public:
 	Common::Rect *_clipPtr;
 	int _screenOffset;
 	uint _planeSelect;
+	int _sImageShift;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
 	static void vDoCycleInt();
 
 	void addIntNode(IntNode *node);
+	void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
+		PictureResource *srcPic, PictureResource *destPic);
 public:
 	GraphicsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -79,9 +82,9 @@ public:
 	void addFadeInt();
 
 	void setupMCGASaveRect(ViewPortResource *viewPort);
-	void addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds);	
+	void addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);	
 	void restoreMCGASaveRect(ViewPortResource *viewPort);
-	void addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds);
+	void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1ff1bde..82ee1a8 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -138,7 +138,7 @@ void VoyeurEngine::initInput() {
 }
 
 void VoyeurEngine::doHeadTitle() {
-	char dest[144];
+//	char dest[144];
 
 	_eventsManager.startMainClockInt();
 	if (_bVoy->getBoltGroup(0x10500)) {


Commit: b85aa4f8d92ecb1d66052837b0128786b52e3ee1
    https://github.com/scummvm/scummvm/commit/b85aa4f8d92ecb1d66052837b0128786b52e3ee1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-01T10:01:09-07:00

Commit Message:
VOYEUR: Implemented the restoreBack method

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 32c203e..da3d277 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -232,8 +232,13 @@ public:
 	PictureResource *_activePage;
 	PictureResource *_pages[2];
 	byte *_field30;
+
+	// Rect lists and counts. Note that _rectListCount values of '-1' seem to have
+	// special significance, which is why I'm not making them redundant in favour 
+	// of the arrays' .size() method
 	Common::Array<Common::Rect> *_rectListPtr[3];
 	int _rectListCount[3];
+
 	Common::Rect _clipRect;
 	byte *_field7A;
 	GraphicMethodPtr _fn1;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 3acf2a3..eaa7dfa 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -83,7 +83,7 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 		Common::Rect *clipRect = _clipPtr;
 		_clipPtr = &viewPort->_clipRect;
 
-		sDrawPic(viewPort->_activePage, viewPort->_currentPic, Common::Point(), NULL);
+		sDrawPic(viewPort->_activePage, viewPort->_currentPic, Common::Point());
 
 		_clipPtr = clipRect;
 	}
@@ -120,7 +120,7 @@ void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, con
 }
 
 void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
-		const Common::Point &offset, void *v3) {
+		const Common::Point &offset) {
 	int var4C = 0;
 	int width1, width2;
 	int widthDiff, widthDiff2;
@@ -339,7 +339,19 @@ void GraphicsManager::flipPage() {
 
 void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
 		PictureResource *srcPic, PictureResource *destPic) {
-	//TODO
+	bool saveBack = _saveBack;
+	_saveBack = false;
+
+	if (rectListCount == -1) {
+		sDrawPic(srcPic, destPic, Common::Point());
+	} else {
+		for (int i = rectListCount; i >= 0; --i) {
+			_clipPtr = &rectList[i];
+			sDrawPic(srcPic, destPic, Common::Point());
+		}
+	}
+
+	_saveBack = saveBack;
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 263d44e..7bb25d3 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -87,7 +87,7 @@ public:
 	void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
-	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
+	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();
 };


Commit: 0dc30622d3348321527d57e892dfadfc41b4c025
    https://github.com/scummvm/scummvm/commit/0dc30622d3348321527d57e892dfadfc41b4c025
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-01T16:38:50-07:00

Commit Message:
VOYEUR: Firthur work on sDrawPic and add fn

Changed paths:
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index eaa7dfa..da07794 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -45,6 +45,12 @@ GraphicsManager::GraphicsManager() {
 
 void GraphicsManager::sInitGraphics() {
 	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false);
+	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT,
+		Graphics::PixelFormat::createFormatCLUT8());
+}
+
+GraphicsManager::~GraphicsManager() {
+	_screenSurface.free();
 }
 
 void GraphicsManager::addFadeInt() {
@@ -92,7 +98,25 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 }
 
 void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
-	// TODO
+	int count1, count2;
+	int idx1, varE, var24;
+
+	if (viewPort->_rectListCount[idx] == -1)
+		return;
+
+	viewPort->_rectListPtr[idx]->push_back(bounds);
+	count1 = count2 = viewPort->_rectListCount[idx];
+	varE = var24 = 0;
+
+	if (count1 > 0) {
+		for (idx1 = 0; idx1 < count1; ++idx1) {
+			// TODO: In progress
+
+			Common::Array<Common::Rect> &rectList = *viewPort->_rectListPtr[idx];
+		}
+
+		viewPort->_rectListCount[idx] = idx1;
+	}
 }
 
 void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
@@ -269,15 +293,42 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			srcP = imgData1 + srcOffset;
 
 			if (flags2 & 8) {
-				error("TODO: sDrawPic");
+				// loc_258D8
+				destP = imgData2 + screenOffset;
+
+				if (flags1 & 2) {
+					// loc_258F5
+				} else {
+					// loc_25D40
+					if (flags1 & 0x100) {
+						// loc_25D4A
+					} else {
+						// loc_2606D
+						destP = (byte *)_screenSurface.pixels;
+
+						for (int yp = 0; yp < height1; ++yp) {
+							Common::copy(srcP, srcP + width2, destP);
+							destP += width2 + widthDiff2;
+							srcP += width2 + widthDiff;
+						}
+					}
+				}
 			} else {
 				destP = imgData2 + screenOffset;
 
+				// loc_2615E
 				if (flags1 & 2) {
 					error("TODO: sDrawPic");
 				} else {
 					if (flags1 & 0x100) {
-						error("TODO: sDrawPic");
+						srcP = imgData1;
+
+						if (isClipped) {
+							// loc_26424
+
+						} else {
+							// loc_26543
+						}
 					} else {
 						for (int yp = 0; yp < height1; ++yp) {
 							Common::copy(srcP, srcP + width2, destP);
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 7bb25d3..1eec37b 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -65,6 +65,7 @@ public:
 	int _screenOffset;
 	uint _planeSelect;
 	int _sImageShift;
+	Graphics::Surface _screenSurface;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
@@ -75,6 +76,7 @@ private:
 		PictureResource *srcPic, PictureResource *destPic);
 public:
 	GraphicsManager();
+	~GraphicsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 	void sInitGraphics();
 


Commit: e9e596e741b70a9a6b3481732ca2dd37adefe8f6
    https://github.com/scummvm/scummvm/commit/e9e596e741b70a9a6b3481732ca2dd37adefe8f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-01T17:07:20-07:00

Commit Message:
VOYEUR: Fixes for recent changes to ViewPortResource initialisation

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 8522cc7..758ba9f 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -616,17 +616,24 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
 
 	// Get the rect list
-	for (int i = 0; i < 3; ++i) {
-		_rectListCount[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
+	for (int listIndex = 0; listIndex < 3; ++listIndex) {
+		_rectListCount[listIndex] = (int16)READ_LE_UINT16(src + 0x40 + 2 * listIndex);
+		uint32 id = READ_LE_UINT32(src + 0x34 + listIndex * 4);
 
-		int16 *rectList = (int16 *)state._curLibPtr->memberAddrOffset(READ_LE_UINT32(src + 0x34 + i * 4));
-		_rectListPtr[i] = new Common::Array<Common::Rect>();
-
-		for (int i = 0; i < _rectListCount[0]; ++i) {
-			int xs = FROM_LE_16(rectList[0]);
-			int ys = FROM_LE_16(rectList[1]);
-			_rectListPtr[i]->push_back(Common::Rect(xs, ys, xs + FROM_LE_16(rectList[2]),
-				ys + FROM_LE_16(rectList[3])));
+		if (id == -1) {
+			_rectListPtr[listIndex] = NULL;
+		} else {
+			_rectListPtr[listIndex] = new Common::Array<Common::Rect>();
+
+			if (_rectListCount[listIndex] > 0) {
+				int16 *rectList = (int16 *)state._curLibPtr->memberAddrOffset(id);
+				for (int i = 0; i < _rectListCount[listIndex]; ++i) {
+					int xs = FROM_LE_16(rectList[0]);
+					int ys = FROM_LE_16(rectList[1]);
+					_rectListPtr[i]->push_back(Common::Rect(xs, ys, xs + FROM_LE_16(rectList[2]),
+						ys + FROM_LE_16(rectList[3])));
+				}
+			}
 		}
 	}
 


Commit: f70fd947327495b8c4ff9e595c1371dbcd43cd3f
    https://github.com/scummvm/scummvm/commit/f70fd947327495b8c4ff9e595c1371dbcd43cd3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-01T19:14:59-07:00

Commit Message:
VOYEUR: Added in debugger and adding event manager methods

Changed paths:
  A engines/voyeur/debugger.cpp
  A engines/voyeur/debugger.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
new file mode 100644
index 0000000..8407ead
--- /dev/null
+++ b/engines/voyeur/debugger.cpp
@@ -0,0 +1,34 @@
+/* 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 "voyeur/debugger.h"
+
+#include "voyeur/graphics.h"
+#include "voyeur/voyeur.h"
+
+namespace Voyeur {
+
+Debugger::Debugger() : GUI::Debugger() {
+	DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/debugger.h b/engines/voyeur/debugger.h
new file mode 100644
index 0000000..3020087
--- /dev/null
+++ b/engines/voyeur/debugger.h
@@ -0,0 +1,45 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_DEBUGGER_H
+#define VOYEUR_DEBUGGER_H
+
+#include "common/scummsys.h"
+#include "gui/debugger.h"
+
+namespace Voyeur {
+
+class VoyeurEngine;
+
+class Debugger : public GUI::Debugger {
+private:
+	VoyeurEngine *_vm;
+
+public:
+	Debugger();
+	virtual ~Debugger() {}
+	void setVm(VoyeurEngine *vm) { _vm = vm; }
+};
+
+} // End of namespace Voyeur
+
+#endif
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index c43c810..3202cb3 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -27,6 +27,9 @@ namespace Voyeur {
 
 EventsManager::EventsManager() {
 	_cycleStatus = 0;
+	_mouseButton = 0;
+	_priorFrameTime = g_system->getMillis();
+	Common::fill(&_keyState[0], &_keyState[256], false);
 }
 
 void EventsManager::resetMouse() {
@@ -71,4 +74,57 @@ void EventsManager::sWaitFlip() {
 	}
 }
 
+void EventsManager::checkForNextFrameCounter() {
+	// Check for next game frame
+	uint32 milli = g_system->getMillis();
+	if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
+		++_gameCounter;
+		_priorFrameTime = milli;
+
+		// Signal the ScummVM debugger
+		_vm->_debugger.onFrame();
+	}
+}
+
+void EventsManager::delay(int totalMilli) {
+	uint32 delayEnd = g_system->getMillis() + totalMilli;
+
+	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) {
+		g_system->delayMillis(10);
+	}
+}
+
+void EventsManager::pollEvents() {
+	checkForNextFrameCounter();
+
+	Common::Event event;
+	while (g_system->getEventManager()->pollEvent(event)) {
+		// Handle keypress
+		switch (event.type) {
+		case Common::EVENT_QUIT:
+		case Common::EVENT_RTL:
+			return;
+
+		case Common::EVENT_KEYDOWN:
+			_keyState[(byte)toupper(event.kbd.ascii)] = true;
+			return;
+		case Common::EVENT_KEYUP:
+			_keyState[(byte)toupper(event.kbd.ascii)] = false;
+			return;
+		case Common::EVENT_LBUTTONDOWN:
+			_mouseButton = 1;
+			return;
+		case Common::EVENT_RBUTTONDOWN:
+			_mouseButton = 2;
+			return;
+		case Common::EVENT_LBUTTONUP:
+		case Common::EVENT_RBUTTONUP:
+			_mouseButton = 0;
+			return;
+		default:
+ 			break;
+		}
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 98e491a..249db4a 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -30,11 +30,21 @@ namespace Voyeur {
 
 class VoyeurEngine;
 
+#define GAME_FRAME_RATE 50
+#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
+
 class EventsManager {
 private:
 	VoyeurEngine *_vm;
+	uint32 _priorFrameTime;
+	uint32 _gameCounter;
+	bool _keyState[256];
+	int _mouseButton;
 
 	static void mainVoyeurIntFunc();
+private:
+	void checkForNextFrameCounter();
+
 public:
 	IntData _intPtr;
 	IntNode _fadeIntNode;
@@ -50,6 +60,9 @@ public:
 	void startMainClockInt();
 	void vStopCycle();
 	void sWaitFlip();
+
+	void delay(int totalMilli);
+	void pollEvents();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index b13c414..bbe3d2e 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -1,6 +1,7 @@
 MODULE := engines/voyeur
 
 MODULE_OBJS := \
+	debugger.o \
 	detection.o \
 	events.o \
 	game.o \
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 82ee1a8..ea3e3ce 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -93,6 +93,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
 }
 
 void VoyeurEngine::initialiseManagers() {
+	_debugger.setVm(this);
 	_eventsManager.setVm(this);
 	_filesManager.setVm(this);
 	_graphicsManager.setVm(this);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 818615f..346d7fb 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -23,6 +23,7 @@
 #ifndef VOYEUR_VOYEUR_H
 #define VOYEUR_VOYEUR_H
 
+#include "voyeur/debugger.h"
 #include "voyeur/events.h"
 #include "voyeur/files.h"
 #include "voyeur/game.h"
@@ -79,6 +80,7 @@ protected:
 	virtual Common::Error run();
 	virtual bool hasFeature(EngineFeature f) const;
 public:
+	Debugger _debugger;
 	EventsManager _eventsManager;
 	FilesManager _filesManager;
 	GraphicsManager _graphicsManager;


Commit: 2a2e1a08cf07b6e1d2fed86e64fb8b71575bbd6c
    https://github.com/scummvm/scummvm/commit/2a2e1a08cf07b6e1d2fed86e64fb8b71575bbd6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-02T19:33:47-07:00

Commit Message:
VOYEUR: Fix to event manager delays and screen updates methods

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 3202cb3..7a9bd5a 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -81,6 +81,11 @@ void EventsManager::checkForNextFrameCounter() {
 		++_gameCounter;
 		_priorFrameTime = milli;
 
+		// Display the frame
+		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.pixels, 
+			SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+		g_system->updateScreen();
+
 		// Signal the ScummVM debugger
 		_vm->_debugger.onFrame();
 	}
@@ -91,6 +96,8 @@ void EventsManager::delay(int totalMilli) {
 
 	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) {
 		g_system->delayMillis(10);
+
+		pollEvents();
 	}
 }
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index da07794..fb32e75 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -37,7 +37,7 @@ GraphicsManager::GraphicsManager() {
 	_sImageShift = 3;
 	_palFlag = false;
 	_MCGAMode = false;
-	_saveBack = false;
+	_saveBack = true;
 	_clipPtr = NULL;
 	_viewPortListPtr = NULL;
 	_vPort = NULL;
@@ -396,7 +396,7 @@ void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rec
 	if (rectListCount == -1) {
 		sDrawPic(srcPic, destPic, Common::Point());
 	} else {
-		for (int i = rectListCount; i >= 0; --i) {
+		for (int i = rectListCount - 1; i >= 0; --i) {
 			_clipPtr = &rectList[i];
 			sDrawPic(srcPic, destPic, Common::Point());
 		}
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index ea3e3ce..79fb2fb 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -151,6 +151,7 @@ void VoyeurEngine::doHeadTitle() {
 		_eventsManager.sWaitFlip();
 
 		// TODO: 
+		_eventsManager.delay(1000);
 	}
 }
 


Commit: 6bce04959b05805829abf3382e699391f165f0fa
    https://github.com/scummvm/scummvm/commit/6bce04959b05805829abf3382e699391f165f0fa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-05T18:28:51-07:00

Commit Message:
VOYEUR: Implemented more doHeadTitle startup code, and startFade

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 7a9bd5a..29959a8 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -22,10 +22,11 @@
 
 #include "voyeur/events.h"
 #include "voyeur/voyeur.h"
+#include "graphics/palette.h"
 
 namespace Voyeur {
 
-EventsManager::EventsManager() {
+EventsManager::EventsManager(): _intPtr(_audioStruc) {
 	_cycleStatus = 0;
 	_mouseButton = 0;
 	_priorFrameTime = g_system->getMillis();
@@ -56,7 +57,7 @@ void EventsManager::sWaitFlip() {
 	// TODO: See if this needs a proper wait loop with event polling
 	//while (_intPtr._field39) ;
 
-	Common::Array<ViewPortResource *> &viewPorts = *_vm->_graphicsManager._viewPortListPtr;
+	Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries;
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
 		ViewPortResource &viewPort = *viewPorts[idx];
 
@@ -81,6 +82,9 @@ void EventsManager::checkForNextFrameCounter() {
 		++_gameCounter;
 		_priorFrameTime = milli;
 
+		// Run the timer-based updates
+		videoTimer();
+
 		// Display the frame
 		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.pixels, 
 			SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -91,7 +95,18 @@ void EventsManager::checkForNextFrameCounter() {
 	}
 }
 
-void EventsManager::delay(int totalMilli) {
+void EventsManager::videoTimer() {
+	if (_audioStruc._hasPalette) {
+		_audioStruc._hasPalette = false;
+
+		g_system->getPaletteManager()->setPalette(_audioStruc._palette,
+			_audioStruc._palStartIndex, 
+			_audioStruc._palEndIndex - _audioStruc._palStartIndex + 1);
+	}
+}
+
+void EventsManager::delay(int cycles) {
+	uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE;
 	uint32 delayEnd = g_system->getMillis() + totalMilli;
 
 	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) {
@@ -134,4 +149,68 @@ void EventsManager::pollEvents() {
 	}
 }
 
+void EventsManager::startFade(CMapResource *cMap) {
+	_fadeIntNode._flags |= 1;
+	if (_cycleStatus & 1)
+		_cycleIntNode._flags |= 1;
+
+	_fadeFirstCol = cMap->_start;
+	_fadeLastCol = cMap->_end;
+	_fadeCount = cMap->_steps + 1;
+
+	if (cMap->_steps > 0) {
+		_vm->_graphicsManager._fadeStatus = cMap->_fadeStatus;
+		uint16 *destP = (uint16 *)(_vm->_graphicsManager._viewPortListPtr->_palette +
+			(_fadeFirstCol * 16));
+		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
+		int mapIndex = 0;
+
+		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx) {
+			destP[0] = vgaP[0] << 8;
+			uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - destP[0]) | 0x80;
+			destP[3] = rComp / cMap->_steps;
+
+			destP[1] = vgaP[1] << 8;
+			uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - destP[1]) | 0x80;
+			destP[4] = gComp / cMap->_steps;
+
+			destP[2] = vgaP[2] << 8;
+			uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) - destP[2]) | 0x80;
+			destP[5] = bComp / cMap->_steps;
+			destP[6] = bComp % cMap->_steps;
+
+			destP += 8;
+
+			if (!(cMap->_fadeStatus & 1))
+				++mapIndex;
+		}
+
+		if (cMap->_fadeStatus & 2)
+			_intPtr._field3B = 1;
+		_fadeIntNode._flags &= ~1;
+	} else {
+		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
+		int mapIndex = 0;
+
+		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
+			Common::copy(&cMap->_entries[mapIndex], &cMap->_entries[mapIndex + 3], vgaP);
+
+			if (!(cMap->_fadeStatus & 1))
+				mapIndex += 3;
+		}
+
+		if (_intPtr._palStartIndex > _fadeFirstCol)
+			_intPtr._palStartIndex = _fadeFirstCol;
+		if (_intPtr._palEndIndex < _fadeLastCol)
+			_intPtr._palEndIndex = _fadeLastCol;
+
+		_intPtr._hasPalette = true;
+		if (!(cMap->_fadeStatus & 2))
+			_intPtr._field38 = 1;
+	}
+
+	if (_cycleStatus & 1)
+		_cycleIntNode._flags &= ~1;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 249db4a..f19a6ec 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -29,6 +29,7 @@
 namespace Voyeur {
 
 class VoyeurEngine;
+class CMapResource;
 
 #define GAME_FRAME_RATE 50
 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
@@ -44,14 +45,17 @@ private:
 	static void mainVoyeurIntFunc();
 private:
 	void checkForNextFrameCounter();
-
+	void videoTimer();
 public:
-	IntData _intPtr;
+	IntData _audioStruc;
+	IntData &_intPtr;
 	IntNode _fadeIntNode;
 	IntNode _cycleIntNode;
 	IntNode _evintnode;
 	IntNode _mainIntNode;
 	int _cycleStatus;
+	int _fadeFirstCol, _fadeLastCol;
+	int _fadeCount;
 public:
 	EventsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -61,8 +65,9 @@ public:
 	void vStopCycle();
 	void sWaitFlip();
 
-	void delay(int totalMilli);
+	void delay(int cycles);
 	void pollEvents();
+	void startFade(CMapResource *cMap);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 758ba9f..4970fc2 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -251,6 +251,10 @@ bool BoltFile::getBoltGroup(uint32 id) {
 	return true;
 }
 
+void BoltFile::freeBoltGroup(uint32 id) {
+	warning("TODO: freeBoltGroup");
+}
+
 BoltEntry &BoltFile::getBoltEntry(uint32 id) {
 	BoltGroup &group = _groups[id >> 24];
 	assert(group._loaded);
@@ -268,6 +272,13 @@ PictureResource *BoltFile::getPictureResouce(uint32 id) {
 	return getBoltEntry(id)._picResource;
 }
 
+CMapResource *BoltFile::getCMapResource(uint32 id) {
+		if ((int32)id == -1)
+		return NULL;
+
+	return getBoltEntry(id)._cMapResource;
+}
+
 byte *BoltFile::memberAddr(uint32 id) {
 	BoltGroup &group = _groups[id >> 8];
 	if (!group._loaded)
@@ -417,7 +428,7 @@ void BoltFile::initViewPortList() {
 	_state._curMemberPtr->_viewPortListResource = res = new ViewPortListResource(
 		_state, _state._curMemberPtr->_data);
 
-	_state._vm->_graphicsManager._viewPortListPtr = &res->_entries;
+	_state._vm->_graphicsManager._viewPortListPtr = res;
 	_state._vm->_graphicsManager._vPort = &res->_entries[0];
 }
 
@@ -441,6 +452,7 @@ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 	_file->read(&buffer[0], BOLT_GROUP_SIZE);
 	_processed = buffer[0] != 0;
 	_callInitGro = buffer[1] != 0;
+	_termGroIndex = buffer[2];
 	_count = buffer[3] ? buffer[3] : 256;	// TODO: Added this in. Check it's okay
 	_fileOffset = READ_LE_UINT32(&buffer[8]);
 }
@@ -546,8 +558,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 
 		if (mode != state._vm->_graphicsManager._SVGAMode) {
 			state._vm->_graphicsManager._SVGAMode = mode;
-			// TODO: If necessary, simulate SVGA mode change
-			warning("TODO: May need to implement SVGA stub code");
+			state._vm->_graphicsManager.clearPalette();			
 		}
 
 //		byte *imgData = _imgData;
@@ -746,6 +757,8 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 		assert(entry._viewPortResource);
 		_entries.push_back(entry._viewPortResource);
 	}
+
+	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 4), &_palette);
 }
 
 /*------------------------------------------------------------------------*/
@@ -756,17 +769,22 @@ FontResource::FontResource(BoltFilesState &state, const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
-CMapResource::CMapResource(BoltFilesState &state, const byte *src) {
+CMapResource::CMapResource(BoltFilesState &state, const byte *src): _vm(state._vm) {
+	_steps = READ_LE_UINT16(src);
 	_start = READ_LE_UINT16(src + 2);
 	_end = READ_LE_UINT16(src + 4);
 	
 	int count = _end - _start;
-	_palette = new byte[count * 3];
-	Common::copy(src + 6, src + 6 + 3 * count, _palette);
+	_entries = new byte[count * 3];
+	Common::copy(src + 6, src + 6 + 3 * count, _entries);
 }
 
 CMapResource::~CMapResource() {
-	delete[] _palette;
+	delete[] _entries;
+}
+
+void CMapResource::startFade() {
+	_vm->_eventsManager.startFade(this);
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index da3d277..49d6db1 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -127,6 +127,7 @@ public:
 	~BoltFile();
 
 	bool getBoltGroup(uint32 id);
+	void freeBoltGroup(uint32 id);
 	byte *memberAddr(uint32 id);
 	byte *memberAddrOffset(uint32 id);
 	void resolveIt(uint32 id, byte **p);
@@ -134,6 +135,7 @@ public:
 
 	BoltEntry &getBoltEntry(uint32 id);
 	PictureResource *getPictureResouce(uint32 id);
+	CMapResource *getCMapResource(uint32 id);
 };
 
 class BoltGroup {
@@ -143,6 +145,7 @@ public:
 	byte _loaded;
 	bool _processed;
 	bool _callInitGro;
+	int _termGroIndex;
 	int _count;
 	int _fileOffset;
 	Common::Array<BoltEntry> _entries;
@@ -254,7 +257,7 @@ public:
 
 class ViewPortListResource {
 public:
-	byte *_field4;
+	byte *_palette;
 	Common::Array<ViewPortResource *> _entries;
 
 	ViewPortListResource(BoltFilesState &state, const byte *src);
@@ -270,13 +273,19 @@ public:
 };
 
 class CMapResource {
+private:
+	VoyeurEngine *_vm;
 public:
+	int _steps;
+	int _fadeStatus;
 	int _start;
 	int _end;
-	byte *_palette;
+	byte *_entries;
 public:
 	CMapResource(BoltFilesState &state, const byte *src);
 	virtual ~CMapResource();
+
+	void startFade();
 };
 
 class VInitCyclResource {
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index 9167cd9..7c1f49f 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -27,7 +27,12 @@ namespace Voyeur {
 IntData::IntData() {
 	_field9 = false;
 	_flipWait = false;
+	_hasPalette = false;
+	_field3B = 0;
 	_field2A = 0;
+	_palStartIndex = 0;
+	_palEndIndex = 0;
+	_palette = NULL;
 }
 
 void IntData::audioInit() {
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index d99df39..2b9864c 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -114,7 +114,12 @@ public:
 	bool _field9;
 	bool _flipWait;
 	int _field2A;
-	byte *_colors;
+	bool _hasPalette;
+	int _field38;
+	int _field3B;
+	int _palStartIndex;
+	int _palEndIndex;
+	byte *_palette;
 	Common::List<IntNode *> _intNodes;
 public:
 	IntData();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index fb32e75..a172483 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -24,6 +24,7 @@
 #include "voyeur/game.h"
 #include "voyeur/voyeur.h"
 #include "engines/util.h"
+#include "graphics/palette.h"
 #include "graphics/surface.h"
 
 namespace Voyeur {
@@ -47,6 +48,8 @@ void GraphicsManager::sInitGraphics() {
 	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false);
 	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT,
 		Graphics::PixelFormat::createFormatCLUT8());
+
+	clearPalette();
 }
 
 GraphicsManager::~GraphicsManager() {
@@ -360,7 +363,7 @@ void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
 }
 
 void GraphicsManager::flipPage() {
-	Common::Array<ViewPortResource *> &viewPorts = *_viewPortListPtr;
+	Common::Array<ViewPortResource *> &viewPorts = _viewPortListPtr->_entries;
 	bool flipFlag = false;
 
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
@@ -405,4 +408,14 @@ void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rec
 	_saveBack = saveBack;
 }
 
+void GraphicsManager::clearPalette() {
+	byte palette[768];
+	Common::fill(&palette[0], &palette[768], 0);
+	g_system->getPaletteManager()->setPalette(&palette[0], 0, 256);
+}
+
+void GraphicsManager::screenReset() {
+	// TODO
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 1eec37b..98f01c3 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -41,6 +41,7 @@ class GraphicsManager;
 class DisplayResource;
 class PictureResource;
 class ViewPortResource;
+class ViewPortListResource;
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
 typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
@@ -57,7 +58,7 @@ public:
 	int _SVGAPage;
 	int _SVGAMode;
 	int _SVGAReset;
-	Common::Array<ViewPortResource *> *_viewPortListPtr;
+	ViewPortListResource *_viewPortListPtr;
 	ViewPortResource **_vPort;
 	bool _MCGAMode;
 	bool _saveBack;
@@ -66,6 +67,7 @@ public:
 	uint _planeSelect;
 	int _sImageShift;
 	Graphics::Surface _screenSurface;
+	int _fadeStatus;
 private:
 	static void fadeIntFunc();
 	static void vDoFadeInt();
@@ -92,6 +94,8 @@ public:
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();
+	void clearPalette();
+	void screenReset();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 79fb2fb..18f3edf 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -132,7 +132,7 @@ void VoyeurEngine::initBolt() {
 }
 
 void VoyeurEngine::vInitInterrupts() {
-	_eventsManager._intPtr._colors = &_graphicsManager._VGAColors[0];
+	_eventsManager._intPtr._palette = &_graphicsManager._VGAColors[0];
 }
 
 void VoyeurEngine::initInput() {
@@ -142,6 +142,8 @@ void VoyeurEngine::doHeadTitle() {
 //	char dest[144];
 
 	_eventsManager.startMainClockInt();
+
+	// Show starting screen
 	if (_bVoy->getBoltGroup(0x10500)) {
 		_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
 		(*_graphicsManager._vPort)->setupViewPort();
@@ -150,8 +152,36 @@ void VoyeurEngine::doHeadTitle() {
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
 
-		// TODO: 
-		_eventsManager.delay(1000);
+		// Fade in the screen
+		CMapResource *cMap = _bVoy->getCMapResource(0x5010000);
+		assert(cMap);
+		cMap->_steps = 60;
+		cMap->startFade();
+
+		_eventsManager.delay(150);
+		if (shouldQuit())
+			return;
+		/* Commented out until fade in is working
+		// Fade out the screen
+		cMap->_steps = 30;
+		cMap->startFade();
+		if (shouldQuit())
+			return;
+
+		(*_graphicsManager._vPort)->_flags |= 8;
+		_graphicsManager.flipPage();
+		_eventsManager.sWaitFlip();
+
+		while (!shouldQuit() && (_graphicsManager._fadeStatus & 1))
+			_eventsManager.delay(1);
+
+		_graphicsManager.screenReset();
+		_bVoy->freeBoltGroup(0x10500);
+		_graphicsManager.screenReset();
+
+		if (shouldQuit())
+			return;
+		*/
 	}
 }
 


Commit: f5ed290025ce2825fcdcc549ea6a1f651502bc44
    https://github.com/scummvm/scummvm/commit/f5ed290025ce2825fcdcc549ea6a1f651502bc44
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-05T19:10:13-07:00

Commit Message:
VOYEUR: Minor palette load bugfixes. First screen is now partly showing

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 4970fc2..9afbe79 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -770,7 +770,8 @@ FontResource::FontResource(BoltFilesState &state, const byte *src) {
 /*------------------------------------------------------------------------*/
 
 CMapResource::CMapResource(BoltFilesState &state, const byte *src): _vm(state._vm) {
-	_steps = READ_LE_UINT16(src);
+	_steps = src[0];
+	_fadeStatus = src[1];
 	_start = READ_LE_UINT16(src + 2);
 	_end = READ_LE_UINT16(src + 4);
 	
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 18f3edf..325d696 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -152,10 +152,10 @@ void VoyeurEngine::doHeadTitle() {
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
 
-		// Fade in the screen
-		CMapResource *cMap = _bVoy->getCMapResource(0x5010000);
+		// Immediate fade in to show the initial screen
+		CMapResource *cMap = _bVoy->getCMapResource(0x5030000);
 		assert(cMap);
-		cMap->_steps = 60;
+		cMap->_steps = 0;
 		cMap->startFade();
 
 		_eventsManager.delay(150);


Commit: adef1bc27df1208df20dc30ed83dea46b96e248d
    https://github.com/scummvm/scummvm/commit/adef1bc27df1208df20dc30ed83dea46b96e248d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-06T20:48:46-07:00

Commit Message:
VOYEUR: Some cleanup of sDrawPic, and decompression fixes

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9afbe79..9456aeb 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -57,8 +57,10 @@ BoltFilesState::BoltFilesState() {
 #define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
 
 byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
-	if (!buf)
+	if (!buf) {
 		buf = new byte[size];
+		Common::fill(buf, buf + size, 0);
+	}
 	byte *bufP = buf;
 
 	if (mode & 8) {
@@ -116,7 +118,8 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 			_decompState = 0;
 		} else {
 			_decompState = 1;
-			_runLength = len = size;
+			len = size;
+			_runLength -= size;
 			if (_runType == 1)
 				_runOffset += len;
 		}
@@ -593,6 +596,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 
 		if (_flags & 0x10) {
 			_imgData = new byte[nbytes];
+			Common::fill(_imgData, _imgData + nbytes, 0);
 		} else {
 			_imgData = state.decompress(NULL, nbytes, state._curMemberPtr->_mode);			
 		}
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index a172483..7a67800 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -154,7 +154,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	int height1;
 	int srcOffset;
 	int screenOffset;
-	int flags1, flags2;
+	int srcFlags, destFlags;
 	ViewPortResource *destViewPort = NULL;
 	Common::Rect newBounds;
 	Common::Rect backBounds;
@@ -163,7 +163,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	int var52;
 	int var20, var22;
 	int var26;
-	byte *imgData1, *imgData2;
+	byte *srcImgData, *destImgData;
 	byte *srcP, *destP;
 
 	// Get the picture parameters, or deference viewport pointers to get their pictures
@@ -184,10 +184,10 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	width1 = width2 = srcPic->_bounds.width();
 	height1 = srcPic->_bounds.height();
 	srcOffset = 0;
-	flags1 = srcPic->_flags;
-	flags2 = destPic->_flags;
+	srcFlags = srcPic->_flags;
+	destFlags = destPic->_flags;
 
-	if (flags1 & 1) {
+	if (srcFlags & 1) {
 		if (_clipPtr) {
 			int xs = _clipPtr->left - srcPic->_bounds.left;
 			int ys = _clipPtr->top - srcPic->_bounds.top;
@@ -262,8 +262,8 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		}
 	}
 
-	if (flags1 & 0x1000) {
-		imgData1 = srcPic->_imgData + (var4C << 14) + _screenOffset;
+	if (srcFlags & 0x1000) {
+		srcImgData = srcPic->_imgData + (var4C << 14) + _screenOffset;
 		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
 			if (var4C < 4) {
 				EMSMapPageHandle(srcPic->_planeSize, srcPic->_imgData[idx], var4C);
@@ -271,10 +271,10 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			}
 		}
 	} else {
-		imgData1 = srcPic->_imgData;
+		srcImgData = srcPic->_imgData;
 	}
-	if (flags2 & 0x1000) {
-		imgData2 = destPic->_imgData + (var4C << 14) + _screenOffset;
+	if (destFlags & 0x1000) {
+		destImgData = destPic->_imgData + (var4C << 14) + _screenOffset;
 		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
 			if (var4C < 4) {
 				EMSMapPageHandle(destPic->_planeSize, destPic->_imgData[idx], var4C);
@@ -282,7 +282,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			}
 		}		
 	} else {
-		imgData2 = destPic->_imgData;
+		destImgData = destPic->_imgData;
 	}
 
 	_SVGAPage = _SVGAReset;
@@ -290,24 +290,24 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		return;
 
 	if (srcPic->_pick == 0xff) {
-		if (flags1 & 8) {
+		if (srcFlags & 8) {
 			error("TODO: sDrawPic");
 		} else {
-			srcP = imgData1 + srcOffset;
+			srcP = srcImgData + srcOffset;
 
-			if (flags2 & 8) {
+			if (destFlags & 8) {
 				// loc_258D8
-				destP = imgData2 + screenOffset;
+				destP = destImgData + screenOffset;
 
-				if (flags1 & 2) {
-					// loc_258F5
+				if (srcFlags & 2) {
+					// loc_258F5f
 				} else {
 					// loc_25D40
-					if (flags1 & 0x100) {
+					if (srcFlags & 0x100) {
 						// loc_25D4A
 					} else {
 						// loc_2606D
-						destP = (byte *)_screenSurface.pixels;
+						destP = (byte *)_screenSurface.pixels + screenOffset;
 
 						for (int yp = 0; yp < height1; ++yp) {
 							Common::copy(srcP, srcP + width2, destP);
@@ -317,14 +317,14 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 					}
 				}
 			} else {
-				destP = imgData2 + screenOffset;
+				destP = destImgData + screenOffset;
 
 				// loc_2615E
-				if (flags1 & 2) {
+				if (srcFlags & 2) {
 					error("TODO: sDrawPic");
 				} else {
-					if (flags1 & 0x100) {
-						srcP = imgData1;
+					if (srcFlags & 0x100) {
+						srcP = srcImgData;
 
 						if (isClipped) {
 							// loc_26424


Commit: 8342e1ed75c9d17e262b9dbb9aad32153d530745
    https://github.com/scummvm/scummvm/commit/8342e1ed75c9d17e262b9dbb9aad32153d530745
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-07T17:15:26-07:00

Commit Message:
VOYEUR: Fix glitch in decoding first screen

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9456aeb..c335e8a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -54,7 +54,7 @@ BoltFilesState::BoltFilesState() {
 	_boltPageFrame = NULL;
 }
 
-#define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
+#define NEXT_BYTE if (--_bytesLeft < 0) nextBlock()
 
 byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 	if (!buf) {


Commit: 8d6d3d8aa629c452daa27aa8cf49497d8cf02fce
    https://github.com/scummvm/scummvm/commit/8d6d3d8aa629c452daa27aa8cf49497d8cf02fce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-07T18:22:00-07:00

Commit Message:
VOYEUR: Some fixes for startup palette loading

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 29959a8..02b0f7f 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -159,7 +159,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 	_fadeCount = cMap->_steps + 1;
 
 	if (cMap->_steps > 0) {
-		_vm->_graphicsManager._fadeStatus = cMap->_fadeStatus;
+		_vm->_graphicsManager._fadeStatus = cMap->_fadeStatus | 1;
 		uint16 *destP = (uint16 *)(_vm->_graphicsManager._viewPortListPtr->_palette +
 			(_fadeFirstCol * 16));
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 7a67800..36184db 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -77,7 +77,7 @@ void GraphicsManager::fadeIntFunc() {
 }
 
 void GraphicsManager::vDoFadeInt() {
-	// TODO: more
+	
 }
 
 void GraphicsManager::vDoCycleInt() {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 325d696..aa48ebd 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -152,17 +152,19 @@ void VoyeurEngine::doHeadTitle() {
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
 
-		// Immediate fade in to show the initial screen
+		// Immediate palette load to show the initial screen
 		CMapResource *cMap = _bVoy->getCMapResource(0x5030000);
 		assert(cMap);
 		cMap->_steps = 0;
 		cMap->startFade();
 
+		// Wait briefly
 		_eventsManager.delay(150);
 		if (shouldQuit())
 			return;
-		/* Commented out until fade in is working
+
 		// Fade out the screen
+		cMap = _bVoy->getCMapResource(0x5040000);
 		cMap->_steps = 30;
 		cMap->startFade();
 		if (shouldQuit())
@@ -181,7 +183,6 @@ void VoyeurEngine::doHeadTitle() {
 
 		if (shouldQuit())
 			return;
-		*/
 	}
 }
 


Commit: 48c18a7c1448a169cc07e21e4f2e883642e9e42a
    https://github.com/scummvm/scummvm/commit/48c18a7c1448a169cc07e21e4f2e883642e9e42a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-07T19:07:57-07:00

Commit Message:
VOYEUR: Implemented decoding of viewport list palette data

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 02b0f7f..a59d11c 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -160,26 +160,23 @@ void EventsManager::startFade(CMapResource *cMap) {
 
 	if (cMap->_steps > 0) {
 		_vm->_graphicsManager._fadeStatus = cMap->_fadeStatus | 1;
-		uint16 *destP = (uint16 *)(_vm->_graphicsManager._viewPortListPtr->_palette +
-			(_fadeFirstCol * 16));
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
 		int mapIndex = 0;
 
 		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx) {
-			destP[0] = vgaP[0] << 8;
-			uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - destP[0]) | 0x80;
-			destP[3] = rComp / cMap->_steps;
-
-			destP[1] = vgaP[1] << 8;
-			uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - destP[1]) | 0x80;
-			destP[4] = gComp / cMap->_steps;
-
-			destP[2] = vgaP[2] << 8;
-			uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) - destP[2]) | 0x80;
-			destP[5] = bComp / cMap->_steps;
-			destP[6] = bComp % cMap->_steps;
-
-			destP += 8;
+			ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[idx];
+			palEntry._rEntry = vgaP[0] << 8;
+			uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry) | 0x80;
+			palEntry.field6 = rComp / cMap->_steps;
+
+			palEntry._gEntry = vgaP[1] << 8;
+			uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry) | 0x80;
+			palEntry.field8 = gComp / cMap->_steps;
+
+			palEntry._bEntry = vgaP[2] << 8;
+			uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) -palEntry._bEntry) | 0x80;
+			palEntry.fieldA = bComp / cMap->_steps;
+			palEntry.fieldC = bComp % cMap->_steps;
 
 			if (!(cMap->_fadeStatus & 1))
 				++mapIndex;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index c335e8a..3bf0d51 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -752,8 +752,13 @@ void ViewPortResource::setupViewPort() {
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
 	uint count = READ_LE_UINT16(src);
 
-	uint32 *idP = (uint32 *)&src[8];
+	// Load palette map
+	byte *palData = state._curLibPtr->memberAddr(READ_LE_UINT32(src + 4));
+	for (uint i = 0; i < 256; ++i, palData += 16)
+		_palette.push_back(ViewPortPalEntry(palData));
 
+	// Load view port pointer list
+	uint32 *idP = (uint32 *)&src[8];
 	for (uint i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
 		BoltEntry &entry = state._curLibPtr->getBoltEntry(id);
@@ -761,10 +766,23 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 		assert(entry._viewPortResource);
 		_entries.push_back(entry._viewPortResource);
 	}
+}
 
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 4), &_palette);
+/*------------------------------------------------------------------------*/
+
+ViewPortPalEntry::ViewPortPalEntry(const byte *src) {
+	uint16 *v = (uint16 *)src;
+	_rEntry = READ_LE_UINT16(v++);
+	_gEntry = READ_LE_UINT16(v++);
+	_bEntry = READ_LE_UINT16(v++);
+	field6 = READ_LE_UINT16(v++);
+	field8 = READ_LE_UINT16(v++);
+	fieldA = READ_LE_UINT16(v++);
+	fieldC = READ_LE_UINT16(v++);
+	fieldE = READ_LE_UINT16(v++);
 }
 
+
 /*------------------------------------------------------------------------*/
 
 FontResource::FontResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 49d6db1..4edf189 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -255,9 +255,19 @@ public:
 	void setupViewPort();
 };
 
+class ViewPortPalEntry  {
+public:
+	uint16 _rEntry, _gEntry, _bEntry;
+	uint16 field6, field8, fieldA;
+	uint16 fieldC;
+	uint16 fieldE;
+public:
+	ViewPortPalEntry(const byte *src);
+};
+
 class ViewPortListResource {
 public:
-	byte *_palette;
+	Common::Array<ViewPortPalEntry> _palette;
 	Common::Array<ViewPortResource *> _entries;
 
 	ViewPortListResource(BoltFilesState &state, const byte *src);


Commit: 3780d9abecdb769f85129d63194df77aab364f21
    https://github.com/scummvm/scummvm/commit/3780d9abecdb769f85129d63194df77aab364f21
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-08T07:31:37-07:00

Commit Message:
VOYEUR: Major cleanup of code between EventsManager and GraphicsManager

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index a59d11c..88a0be8 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -26,9 +26,19 @@
 
 namespace Voyeur {
 
+IntNode::IntNode() {
+	_intFunc = NULL;
+	_curTime = 0;
+	_timeReset = 0;
+	_flags = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
 EventsManager::EventsManager(): _intPtr(_audioStruc) {
 	_cycleStatus = 0;
 	_mouseButton = 0;
+	_fadeStatus = 0;
 	_priorFrameTime = g_system->getMillis();
 	Common::fill(&_keyState[0], &_keyState[256], false);
 }
@@ -38,14 +48,14 @@ void EventsManager::resetMouse() {
 }
 
 void EventsManager::startMainClockInt() {
-	_mainIntNode._intFunc = mainVoyeurIntFunc;
+	_mainIntNode._intFunc = &EventsManager::mainVoyeurIntFunc;
 	_mainIntNode._flags = 0;
 	_mainIntNode._curTime = 0;
 	_mainIntNode._timeReset = _vm->_graphicsManager._palFlag ? 50 : 60;
 }
 
 void EventsManager::mainVoyeurIntFunc() {
-
+	// TODO
 }
 
 void EventsManager::vStopCycle() {
@@ -159,7 +169,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 	_fadeCount = cMap->_steps + 1;
 
 	if (cMap->_steps > 0) {
-		_vm->_graphicsManager._fadeStatus = cMap->_fadeStatus | 1;
+		_fadeStatus = cMap->_fadeStatus |= 1;
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
 		int mapIndex = 0;
 
@@ -167,16 +177,16 @@ void EventsManager::startFade(CMapResource *cMap) {
 			ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[idx];
 			palEntry._rEntry = vgaP[0] << 8;
 			uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry) | 0x80;
-			palEntry.field6 = rComp / cMap->_steps;
+			palEntry._rChange = rComp / cMap->_steps;
 
 			palEntry._gEntry = vgaP[1] << 8;
 			uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry) | 0x80;
-			palEntry.field8 = gComp / cMap->_steps;
+			palEntry._gChange = gComp / cMap->_steps;
 
 			palEntry._bEntry = vgaP[2] << 8;
 			uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) -palEntry._bEntry) | 0x80;
-			palEntry.fieldA = bComp / cMap->_steps;
-			palEntry.fieldC = bComp % cMap->_steps;
+			palEntry._bChange = bComp / cMap->_steps;
+			palEntry._palIndex = bComp % cMap->_steps;
 
 			if (!(cMap->_fadeStatus & 1))
 				++mapIndex;
@@ -210,4 +220,64 @@ void EventsManager::startFade(CMapResource *cMap) {
 		_cycleIntNode._flags &= ~1;
 }
 
+void EventsManager::addIntNode(IntNode *node) {
+	_intNodes.push_back(node);
+}
+
+void EventsManager::addFadeInt() {
+	IntNode &node = _fadeIntNode;
+	node._intFunc = &EventsManager::fadeIntFunc;
+	node._flags = 0;
+	node._curTime = 0;
+	node._timeReset = 1;
+
+	addIntNode(&node);
+}
+
+void EventsManager::vDoFadeInt() {
+	if (_intPtr._field3B & 1)
+		return;
+	if (--_fadeCount == 0) {
+		_fadeIntNode._flags |= 1;
+		_fadeStatus &= ~1;
+	}
+
+
+	for (int i = _fadeFirstCol; i <= _fadeLastCol; ++i) {
+		ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[i];
+		byte *vgaP = &_vm->_graphicsManager._VGAColors[palEntry._palIndex * 3];
+
+		palEntry._rEntry += palEntry._rChange;
+		palEntry._gEntry += palEntry._gChange;
+		palEntry._bEntry += palEntry._bChange;
+
+		vgaP[0] = palEntry._rEntry >> 8;
+		vgaP[1] = palEntry._gEntry >> 8;
+		vgaP[2] = palEntry._bEntry >> 8;
+	}
+
+	if (_intPtr._palStartIndex > _fadeFirstCol)
+		_intPtr._palStartIndex = _fadeFirstCol;
+	if (_intPtr._palEndIndex < _fadeLastCol)
+		_intPtr._palEndIndex = _fadeLastCol;
+
+	_intPtr._hasPalette = true;
+	_intPtr._field38 = 1;
+}
+
+void EventsManager::vDoCycleInt() {
+	// TODO: more
+}
+
+
+void EventsManager::fadeIntFunc() {
+	// TODO: more
+}
+
+void EventsManager::vInitColor() {
+	_fadeIntNode._intFunc = &EventsManager::vDoFadeInt;
+	_cycleIntNode._intFunc = &EventsManager::vDoCycleInt;
+	// TODO: more
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index f19a6ec..1b47109 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -29,11 +29,24 @@
 namespace Voyeur {
 
 class VoyeurEngine;
+class EventsManager;
 class CMapResource;
 
 #define GAME_FRAME_RATE 50
 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
 
+typedef void (EventsManager::*EventMethodPtr)();
+ 
+class IntNode {
+public:
+	EventMethodPtr _intFunc;
+	uint32 _curTime;
+	uint32 _timeReset;
+	uint32 _flags;
+public:
+	IntNode();
+};
+
 class EventsManager {
 private:
 	VoyeurEngine *_vm;
@@ -41,11 +54,15 @@ private:
 	uint32 _gameCounter;
 	bool _keyState[256];
 	int _mouseButton;
+	Common::List<IntNode *> _intNodes;
 
-	static void mainVoyeurIntFunc();
+	void mainVoyeurIntFunc();
 private:
 	void checkForNextFrameCounter();
 	void videoTimer();
+	void vDoFadeInt();
+	void vDoCycleInt();
+	void fadeIntFunc();
 public:
 	IntData _audioStruc;
 	IntData &_intPtr;
@@ -56,6 +73,8 @@ public:
 	int _cycleStatus;
 	int _fadeFirstCol, _fadeLastCol;
 	int _fadeCount;
+	int _fadeStatus;
+
 public:
 	EventsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -64,10 +83,13 @@ public:
 	void startMainClockInt();
 	void vStopCycle();
 	void sWaitFlip();
+	void vInitColor();
 
 	void delay(int cycles);
 	void pollEvents();
 	void startFade(CMapResource *cMap);
+	void addIntNode(IntNode *node);
+	void addFadeInt();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 3bf0d51..383523e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -775,11 +775,10 @@ ViewPortPalEntry::ViewPortPalEntry(const byte *src) {
 	_rEntry = READ_LE_UINT16(v++);
 	_gEntry = READ_LE_UINT16(v++);
 	_bEntry = READ_LE_UINT16(v++);
-	field6 = READ_LE_UINT16(v++);
-	field8 = READ_LE_UINT16(v++);
-	fieldA = READ_LE_UINT16(v++);
-	fieldC = READ_LE_UINT16(v++);
-	fieldE = READ_LE_UINT16(v++);
+	_rChange = READ_LE_UINT16(v++);
+	_gChange = READ_LE_UINT16(v++);
+	_bChange = READ_LE_UINT16(v++);
+	_palIndex = READ_LE_UINT16(v++);
 }
 
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4edf189..8168137 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -258,9 +258,8 @@ public:
 class ViewPortPalEntry  {
 public:
 	uint16 _rEntry, _gEntry, _bEntry;
-	uint16 field6, field8, fieldA;
-	uint16 fieldC;
-	uint16 fieldE;
+	uint16 _rChange, _gChange, _bChange;
+	uint16 _palIndex;
 public:
 	ViewPortPalEntry(const byte *src);
 };
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index 7c1f49f..d6aeb69 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -39,17 +39,4 @@ void IntData::audioInit() {
 
 }
 
-void IntData::addIntNode(IntNode *node) {
-	_intNodes.push_back(node);
-}
-
-/*------------------------------------------------------------------------*/
-
-IntNode::IntNode() {
-	_intFunc = NULL;
-	_curTime = 0;
-	_timeReset = 0;
-	_flags = 0;
-}
-
 } // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 2b9864c..7acc921 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -97,18 +97,6 @@ public:
 	int _policeEvent;
 };
 
-typedef void (*IntFuncPtr)();
-
-class IntNode {
-public:
-	IntFuncPtr _intFunc;
-	uint32 _curTime;
-	uint32 _timeReset;
-	uint32 _flags;
-public:
-	IntNode();
-};
-
 class IntData {
 public:
 	bool _field9;
@@ -120,13 +108,10 @@ public:
 	int _palStartIndex;
 	int _palEndIndex;
 	byte *_palette;
-	Common::List<IntNode *> _intNodes;
 public:
 	IntData();
 
 	void audioInit();
-	void addIntNode(IntNode *node);
-
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 36184db..a236e8b 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -56,34 +56,6 @@ GraphicsManager::~GraphicsManager() {
 	_screenSurface.free();
 }
 
-void GraphicsManager::addFadeInt() {
-	IntNode &node = _vm->_eventsManager._fadeIntNode;
-	node._intFunc = fadeIntFunc;
-	node._flags = 0;
-	node._curTime = 0;
-	node._timeReset = 1;
-
-	_vm->_eventsManager._intPtr.addIntNode(&node);
-}
-
-void GraphicsManager::vInitColor() {
-	_vm->_eventsManager._fadeIntNode._intFunc = vDoFadeInt;
-	_vm->_eventsManager._cycleIntNode._intFunc = vDoCycleInt;
-	// TODO: more
-}
-
-void GraphicsManager::fadeIntFunc() {
-	// TODO: more
-}
-
-void GraphicsManager::vDoFadeInt() {
-	
-}
-
-void GraphicsManager::vDoCycleInt() {
-	// TODO: more
-}
-
 void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 	_MCGAMode = true;
 
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 98f01c3..c1a0ada 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -67,13 +67,10 @@ public:
 	uint _planeSelect;
 	int _sImageShift;
 	Graphics::Surface _screenSurface;
-	int _fadeStatus;
 private:
 	static void fadeIntFunc();
-	static void vDoFadeInt();
 	static void vDoCycleInt();
 
-	void addIntNode(IntNode *node);
 	void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
 		PictureResource *srcPic, PictureResource *destPic);
 public:
@@ -82,9 +79,6 @@ public:
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 	void sInitGraphics();
 
-	void vInitColor();
-	void addFadeInt();
-
 	void setupMCGASaveRect(ViewPortResource *viewPort);
 	void addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);	
 	void restoreMCGASaveRect(ViewPortResource *viewPort);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index aa48ebd..98d88ac 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -121,13 +121,13 @@ void VoyeurEngine::globalInitBolt() {
 	_voy._evidence[18] = 9999;
 	
 	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
-	_graphicsManager.addFadeInt();
+	_eventsManager.addFadeInt();
 }
 
 void VoyeurEngine::initBolt() {
 	vInitInterrupts();
 	_graphicsManager.sInitGraphics();
-	_graphicsManager.vInitColor();
+	_eventsManager.vInitColor();
 	initInput();
 }
 
@@ -174,7 +174,7 @@ void VoyeurEngine::doHeadTitle() {
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
 
-		while (!shouldQuit() && (_graphicsManager._fadeStatus & 1))
+		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 			_eventsManager.delay(1);
 
 		_graphicsManager.screenReset();


Commit: 11a4fef956dc955c44fc323bdb28580bcb8888e5
    https://github.com/scummvm/scummvm/commit/11a4fef956dc955c44fc323bdb28580bcb8888e5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-08T12:41:22-07:00

Commit Message:
VOYEUR: Some further work implementing fading

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 88a0be8..f76f99a 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -33,9 +33,17 @@ IntNode::IntNode() {
 	_flags = 0;
 }
 
+IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
+	_intFunc = NULL;
+	_curTime = curTime;
+	_timeReset = timeReset;
+	_flags = flags;
+}
+
 /*------------------------------------------------------------------------*/
 
-EventsManager::EventsManager(): _intPtr(_audioStruc) {
+EventsManager::EventsManager(): _intPtr(_gameData),
+		_fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) {
 	_cycleStatus = 0;
 	_mouseButton = 0;
 	_fadeStatus = 0;
@@ -65,7 +73,7 @@ void EventsManager::vStopCycle() {
 
 void EventsManager::sWaitFlip() {
 	// TODO: See if this needs a proper wait loop with event polling
-	//while (_intPtr._field39) ;
+	//while (_intPtr.field39) ;
 
 	Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries;
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
@@ -93,7 +101,7 @@ void EventsManager::checkForNextFrameCounter() {
 		_priorFrameTime = milli;
 
 		// Run the timer-based updates
-		videoTimer();
+		voyeurTimer();
 
 		// Display the frame
 		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.pixels, 
@@ -105,13 +113,51 @@ void EventsManager::checkForNextFrameCounter() {
 	}
 }
 
+void EventsManager::voyeurTimer() {
+	_gameData.field22 += _gameData.field24;
+	_gameData.field1A += _gameData.field1E;
+	// _gameData.field1C += _gameData._timerFn; *** WHY INC field by a function pointer?!
+
+	_gameData.field16 = 0;
+	_gameData.field3D = 1;
+
+	if (--_gameData.field26 <= 0) {
+		if (_gameData._flipWait) {
+			_gameData.field38 = 1;
+			_gameData._flipWait = false;
+			_gameData.field3B = 0;
+		}
+
+		_gameData.field26 >>= 8;
+	}
+
+	videoTimer();
+
+	// Iterate through the list of registered nodes
+	Common::List<IntNode *>::iterator i;
+	for (i = _intNodes.begin(); i != _intNodes.end(); ++i) {
+		IntNode &node = **i;
+
+		if (node._flags & 1)
+			continue;
+		if (!(node._flags & 2)) {
+			if (--node._curTime != 0)
+				continue;
+
+			node._curTime = node._timeReset;
+		}
+
+		(this->*node._intFunc)();
+	}
+}
+
 void EventsManager::videoTimer() {
-	if (_audioStruc._hasPalette) {
-		_audioStruc._hasPalette = false;
+	if (_gameData._hasPalette) {
+		_gameData._hasPalette = false;
 
-		g_system->getPaletteManager()->setPalette(_audioStruc._palette,
-			_audioStruc._palStartIndex, 
-			_audioStruc._palEndIndex - _audioStruc._palStartIndex + 1);
+		g_system->getPaletteManager()->setPalette(_gameData._palette,
+			_gameData._palStartIndex, 
+			_gameData._palEndIndex - _gameData._palStartIndex + 1);
 	}
 }
 
@@ -193,7 +239,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 		}
 
 		if (cMap->_fadeStatus & 2)
-			_intPtr._field3B = 1;
+			_intPtr.field3B = 1;
 		_fadeIntNode._flags &= ~1;
 	} else {
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
@@ -213,7 +259,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 
 		_intPtr._hasPalette = true;
 		if (!(cMap->_fadeStatus & 2))
-			_intPtr._field38 = 1;
+			_intPtr.field38 = 1;
 	}
 
 	if (_cycleStatus & 1)
@@ -225,7 +271,7 @@ void EventsManager::addIntNode(IntNode *node) {
 }
 
 void EventsManager::addFadeInt() {
-	IntNode &node = _fadeIntNode;
+	IntNode &node = _fade2IntNode;
 	node._intFunc = &EventsManager::fadeIntFunc;
 	node._flags = 0;
 	node._curTime = 0;
@@ -235,7 +281,7 @@ void EventsManager::addFadeInt() {
 }
 
 void EventsManager::vDoFadeInt() {
-	if (_intPtr._field3B & 1)
+	if (_intPtr.field3B & 1)
 		return;
 	if (--_fadeCount == 0) {
 		_fadeIntNode._flags |= 1;
@@ -262,7 +308,7 @@ void EventsManager::vDoFadeInt() {
 		_intPtr._palEndIndex = _fadeLastCol;
 
 	_intPtr._hasPalette = true;
-	_intPtr._field38 = 1;
+	_intPtr.field38 = 1;
 }
 
 void EventsManager::vDoCycleInt() {
@@ -277,7 +323,9 @@ void EventsManager::fadeIntFunc() {
 void EventsManager::vInitColor() {
 	_fadeIntNode._intFunc = &EventsManager::vDoFadeInt;
 	_cycleIntNode._intFunc = &EventsManager::vDoCycleInt;
-	// TODO: more
+
+	addIntNode(&_fadeIntNode);
+	addIntNode(&_cycleIntNode);
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 1b47109..22626cd 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -24,6 +24,7 @@
 #define VOYEUR_EVENTS_H
 
 #include "common/scummsys.h"
+#include "common/list.h"
 #include "voyeur/game.h"
 
 namespace Voyeur {
@@ -40,11 +41,12 @@ typedef void (EventsManager::*EventMethodPtr)();
 class IntNode {
 public:
 	EventMethodPtr _intFunc;
-	uint32 _curTime;
-	uint32 _timeReset;
+	uint16 _curTime;
+	uint16 _timeReset;
 	uint32 _flags;
 public:
 	IntNode();
+	IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
 };
 
 class EventsManager {
@@ -59,14 +61,16 @@ private:
 	void mainVoyeurIntFunc();
 private:
 	void checkForNextFrameCounter();
+	void voyeurTimer();
 	void videoTimer();
 	void vDoFadeInt();
 	void vDoCycleInt();
 	void fadeIntFunc();
 public:
-	IntData _audioStruc;
+	IntData _gameData;
 	IntData &_intPtr;
 	IntNode _fadeIntNode;
+	IntNode _fade2IntNode;
 	IntNode _cycleIntNode;
 	IntNode _evintnode;
 	IntNode _mainIntNode;
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index d6aeb69..e1ad859 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -28,8 +28,16 @@ IntData::IntData() {
 	_field9 = false;
 	_flipWait = false;
 	_hasPalette = false;
-	_field3B = 0;
-	_field2A = 0;
+	field16 = 0;
+	field1A = 0;
+	field1E = 0;
+	field22 = 0;
+	field24 = 0;
+	field26 = 0;
+	field2A = 0;
+	field38 = 0;
+	field3B = 0;
+	field3D = 0;
 	_palStartIndex = 0;
 	_palEndIndex = 0;
 	_palette = NULL;
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 7acc921..5ad90dd 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -101,10 +101,17 @@ class IntData {
 public:
 	bool _field9;
 	bool _flipWait;
-	int _field2A;
+	int field16;
+	int field1A;
+	int field1E;
+	int field22;
+	int field24;
+	int field26;
+	int field2A;
 	bool _hasPalette;
-	int _field38;
-	int _field3B;
+	int field38;
+	int field3B;
+	int field3D;
 	int _palStartIndex;
 	int _palEndIndex;
 	byte *_palette;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index a236e8b..7f9fd48 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -324,7 +324,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
  */
 void GraphicsManager::sDisplayPic(PictureResource *pic) {
 	if (pic->_flags & 8) {
-		_vm->_eventsManager._intPtr._field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
+		_vm->_eventsManager._intPtr.field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
 	}
 
 	_vm->_eventsManager._intPtr._flipWait = true;


Commit: b1eeefaab1c0ac5b7fa3513bbe5415e2a08d23ca
    https://github.com/scummvm/scummvm/commit/b1eeefaab1c0ac5b7fa3513bbe5415e2a08d23ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-08T12:49:44-07:00

Commit Message:
VOYEUR: Implement freeBoltGroup and related logic

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 383523e..3bbea7a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -255,7 +255,11 @@ bool BoltFile::getBoltGroup(uint32 id) {
 }
 
 void BoltFile::freeBoltGroup(uint32 id) {
-	warning("TODO: freeBoltGroup");
+	_state._curLibPtr = this;
+	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
+
+	// Unload the group
+	_state._curGroupPtr->unload();
 }
 
 BoltEntry &BoltFile::getBoltEntry(uint32 id) {
@@ -460,6 +464,9 @@ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 	_fileOffset = READ_LE_UINT32(&buffer[8]);
 }
 
+BoltGroup::~BoltGroup() {
+}
+
 void BoltGroup::load() {
 	_file->seek(_fileOffset);
 
@@ -470,6 +477,14 @@ void BoltGroup::load() {
 	_loaded = true;
 }
 
+void BoltGroup::unload() {
+	if (!_loaded)
+		return;
+
+	_entries.clear();
+	_loaded = false;
+}
+
 /*------------------------------------------------------------------------*/
 
 BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 8168137..996dc2b 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -151,8 +151,10 @@ public:
 	Common::Array<BoltEntry> _entries;
 public:
 	BoltGroup(Common::SeekableReadStream *f); 
+	virtual ~BoltGroup();
 
 	void load();
+	void unload();
 };
 
 


Commit: 54c470d36ff9d739644bb93df7e693d162eedbd1
    https://github.com/scummvm/scummvm/commit/54c470d36ff9d739644bb93df7e693d162eedbd1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-08T14:51:41-07:00

Commit Message:
VOYEUR: Implemented fillPic and related code

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 3bbea7a..02d7c7a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -543,6 +543,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(&src[10]),
 		ys + READ_LE_UINT16(&src[12]));
 	_maskData = READ_LE_UINT32(&src[14]);
+	_planeSize = READ_LE_UINT16(&src[22]);
 
 	_imgData = NULL;
 
@@ -618,6 +619,17 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	}
 }
 
+PictureResource::PictureResource() {
+	_select = 0;
+	_pick = 0;
+	_onOff = 0;
+	_depth = 0;
+	_maskData = 0;
+	_planeSize = 0;
+
+	_imgData = NULL;
+}
+
 PictureResource::~PictureResource() {
 	delete _imgData;
 }
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 996dc2b..df29924 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -215,6 +215,7 @@ public:
 	byte *_imgData;
 public:
 	PictureResource(BoltFilesState &state, const byte *src);
+	PictureResource();
 	virtual ~PictureResource();
 };
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 7f9fd48..e579d7f 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -220,11 +220,24 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	widthDiff2 = destPic->_bounds.width() - width2;
 
 	if (destViewPort) {
-		error("TODO: Examine further when it's actually used");
 		if (!_saveBack || ((srcPic->_flags & 0x800) != 0)) {
-			// TODO
+			backBounds.left = destPic->_bounds.left + offset.x;
+			backBounds.top = destPic->_bounds.top + offset.y;
+			backBounds.setWidth(width2);
+			backBounds.setHeight(height1);
+			addRectOptSaveRect(destViewPort, 1, backBounds);
+
 		} else if (!destViewPort->_addFn) {
-			// TODO
+			if (destViewPort->_rectListCount[destViewPort->_pageIndex] < -1) {
+				Common::Rect r;
+				r.left = destPic->_bounds.left + offset.x;
+				r.top = destPic->_bounds.top + offset.y;
+				r.setWidth(width2);
+				r.setHeight(height1);
+
+				(*destViewPort->_rectListPtr[destViewPort->_pageIndex]).push_back(r);
+				++destViewPort->_rectListCount[destViewPort->_pageIndex];
+			}
 		} else {
 			int xs = ofs.x + destPic->_bounds.left;
 			int ys = ofs.y + destPic->_bounds.top;
@@ -315,8 +328,46 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			}
 		}
 	} else {
-		error("TODO: sDrawPic");
+		// loc_26666
+		if (srcPic->_pick == 0) {
+			// loc_2727A
+			int onOff = srcPic->_onOff;
+			int onOff2 = onOff | (onOff << 8);
+
+			if (srcFlags & 2) {
+				if (srcFlags & 8) {
+
+				} else {
+
+				}
+			} else {
+				// TODO
+
+			}
+
+		} else {
+			// loc_26673
+			// TODO
+		}
+	}
+}
+
+void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
+	PictureResource *pic;
+	if (display->_flags & 0x8000) {
+		pic = ((ViewPortResource *)display)->_currentPic;
+	} else {
+		pic = (PictureResource *)display;
 	}
+
+	PictureResource picResource;
+	picResource._flags = 0;
+	picResource._select = 0xff;
+	picResource._pick = 0;
+	picResource._onOff = onOff;
+	picResource._bounds = pic->_bounds;
+
+	sDrawPic(&picResource, display, Common::Point());
 }
 
 /**
@@ -386,8 +437,40 @@ void GraphicsManager::clearPalette() {
 	g_system->getPaletteManager()->setPalette(&palette[0], 0, 256);
 }
 
+void GraphicsManager::resetPalette() {
+	for (int i = 0; i < 256; ++i)
+		setColor(i, 0, 0, 0);
+
+	_vm->_eventsManager._intPtr.field38 = 1;
+	_vm->_eventsManager._intPtr._hasPalette = true;
+}
+
+void GraphicsManager::setColor(int idx, int r, int g, int b) {
+	byte *vgaP = &_VGAColors[idx * 3];
+	vgaP[0] = r >> 2;
+	vgaP[1] = g >> 2;
+	vgaP[2] = b >> 2;
+
+	_vm->_eventsManager._intPtr._palStartIndex = MIN(_vm->_eventsManager._intPtr._palStartIndex, idx);
+	_vm->_eventsManager._intPtr._palEndIndex = MAX(_vm->_eventsManager._intPtr._palEndIndex, idx);
+}
+
 void GraphicsManager::screenReset() {
-	// TODO
+	resetPalette();
+	(*_vPort)->setupViewPort();
+	fillPic(*_vPort, 0);
+	
+	// Flag the following viewport
+	uint i = 0;
+	while (i < _viewPortListPtr->_entries.size() && _viewPortListPtr->_entries[i] != *_vPort)
+		++i;
+	assert(i < (_viewPortListPtr->_entries.size() - 1));
+
+	_viewPortListPtr->_entries[i + 1]->_flags |= 8;
+
+	// Flip
+	flipPage();
+	_vm->_eventsManager.sWaitFlip();
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index c1a0ada..5d0b00d 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -86,9 +86,12 @@ public:
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
+	void GraphicsManager::fillPic(DisplayResource *display, byte onOff);
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();
 	void clearPalette();
+	void resetPalette();
+	void setColor(int idx, int r, int g, int b);
 	void screenReset();
 };
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 98d88ac..93bb7a6 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -179,7 +179,6 @@ void VoyeurEngine::doHeadTitle() {
 
 		_graphicsManager.screenReset();
 		_bVoy->freeBoltGroup(0x10500);
-		_graphicsManager.screenReset();
 
 		if (shouldQuit())
 			return;


Commit: 7bf4d492538fefa73787f687913f1b905af8f808
    https://github.com/scummvm/scummvm/commit/7bf4d492538fefa73787f687913f1b905af8f808
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-10T18:29:12-07:00

Commit Message:
VOYEUR: Starting to implement code for the lock screen

Changed paths:
  A engines/voyeur/utils.cpp
  A engines/voyeur/utils.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 02d7c7a..bdbf05c 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -191,6 +191,25 @@ bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFi
 	return true;
 }
 
+byte *FilesManager::fload(const Common::String &filename, int *size) {
+	Common::File f;
+	int filesize;
+	byte *data = NULL;
+
+	if (f.open(filename)) {
+		// Read in the file
+		filesize = f.size();
+		data = new byte[filesize];
+		f.read(data, filesize);
+	} else {
+		filesize = 0;
+	}
+
+	if (size)
+		*size = filesize;
+	return data;
+}
+
 /*------------------------------------------------------------------------*/
 
 const BoltMethodPtr BoltFile::_fnInitType[25] = {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index df29924..d1b3a09 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -195,6 +195,7 @@ public:
 	void setVm(VoyeurEngine *vm) { _boltFilesState._vm = vm; }
 
 	bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
+	byte *fload(const Common::String &filename, int *size = NULL);
 };
 
 class DisplayResource {
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index e1ad859..9d71fbf 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "voyeur/game.h"
+#include "voyeur/voyeur.h"
 
 namespace Voyeur {
 
@@ -47,4 +48,6 @@ void IntData::audioInit() {
 
 }
 
+/*------------------------------------------------------------------------*/
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index e579d7f..0f077d5 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -29,6 +29,23 @@
 
 namespace Voyeur {
 
+FontInfo::FontInfo() {
+	_curFont = NULL;
+	_picFlags = 3;
+	_picSelect = 0xff;
+	_picPick = 0xff;
+	_picOnOff = 0;
+	_fontFlags = 0;
+	_justify = 0;
+	_fontSaveBack = 0;
+	_justifyWidth = 1;
+	_justifyHeight = 1;
+	_shadow = Common::Point(1, 1);
+	_foreColor = 1;
+	_backColor = 0;
+	_shadowColor = 0;
+}
+
 GraphicsManager::GraphicsManager() {
 	_SVGAPage = 0;
 	_SVGAMode = 0;
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 5d0b00d..2e65089 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -42,6 +42,28 @@ class DisplayResource;
 class PictureResource;
 class ViewPortResource;
 class ViewPortListResource;
+class FontResource;
+
+class FontInfo {
+public:
+	FontResource *_curFont;
+	byte _picFlags;
+	byte _picSelect;
+	byte _picPick;
+	byte _picOnOff;
+	byte _fontFlags;
+	byte _justify;
+	int _fontSaveBack;
+	Common::Point _pos;
+	int _justifyWidth;
+	int _justifyHeight;
+	Common::Point _shadow;
+	int _foreColor;
+	int _backColor;
+	int _shadowColor;
+public:
+	FontInfo();
+};
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
 typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index bbe3d2e..3e9cbe4 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
 	game.o \
 	files.o \
 	graphics.o \
+	utils.o \
 	voyeur.o
 
 # This module can be built as a plugin
diff --git a/engines/voyeur/utils.cpp b/engines/voyeur/utils.cpp
new file mode 100644
index 0000000..4ddfd71
--- /dev/null
+++ b/engines/voyeur/utils.cpp
@@ -0,0 +1,31 @@
+/* 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 "voyeur/utils.h"
+
+namespace Voyeur {
+
+void LockClass::getSysData() {
+
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/utils.h b/engines/voyeur/utils.h
new file mode 100644
index 0000000..9aed6b3
--- /dev/null
+++ b/engines/voyeur/utils.h
@@ -0,0 +1,37 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_UTILS_H
+#define VOYEUR_UTILS_H
+
+#include "common/scummsys.h"
+
+namespace Voyeur {
+
+class LockClass {
+public:
+	void getSysData();
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_UTILS_H */
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 93bb7a6..5c3c42c 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -144,45 +144,70 @@ void VoyeurEngine::doHeadTitle() {
 	_eventsManager.startMainClockInt();
 
 	// Show starting screen
-	if (_bVoy->getBoltGroup(0x10500)) {
-		_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
-		(*_graphicsManager._vPort)->setupViewPort();
-		(*_graphicsManager._vPort)->_flags |= 8;
-
-		_graphicsManager.flipPage();
-		_eventsManager.sWaitFlip();
-
-		// Immediate palette load to show the initial screen
-		CMapResource *cMap = _bVoy->getCMapResource(0x5030000);
-		assert(cMap);
-		cMap->_steps = 0;
-		cMap->startFade();
-
-		// Wait briefly
-		_eventsManager.delay(150);
-		if (shouldQuit())
-			return;
-
-		// Fade out the screen
-		cMap = _bVoy->getCMapResource(0x5040000);
-		cMap->_steps = 30;
-		cMap->startFade();
-		if (shouldQuit())
-			return;
-
-		(*_graphicsManager._vPort)->_flags |= 8;
-		_graphicsManager.flipPage();
-		_eventsManager.sWaitFlip();
-
-		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
-			_eventsManager.delay(1);
-
-		_graphicsManager.screenReset();
-		_bVoy->freeBoltGroup(0x10500);
-
-		if (shouldQuit())
-			return;
+	if (_bVoy->getBoltGroup(0x10500))
+		showConversionScreen();
+	if (shouldQuit())
+		return;
+
+	doLock();
+
+	// TODO
+}
+
+void VoyeurEngine::showConversionScreen() {
+	_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
+	(*_graphicsManager._vPort)->setupViewPort();
+	(*_graphicsManager._vPort)->_flags |= 8;
+
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	// Immediate palette load to show the initial screen
+	CMapResource *cMap = _bVoy->getCMapResource(0x5030000);
+	assert(cMap);
+	cMap->_steps = 0;
+	cMap->startFade();
+
+	// Wait briefly
+	_eventsManager.delay(150);
+	if (shouldQuit())
+		return;
+
+	// Fade out the screen
+	cMap = _bVoy->getCMapResource(0x5040000);
+	cMap->_steps = 30;
+	cMap->startFade();
+	if (shouldQuit())
+		return;
+
+	(*_graphicsManager._vPort)->_flags |= 8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+		_eventsManager.delay(1);
+
+	_graphicsManager.screenReset();
+	_bVoy->freeBoltGroup(0x10500);
+}
+
+bool VoyeurEngine::doLock() {
+	int var12 = 0;
+	int var14 = 0;
+	int di = 1;
+	int wrongSize;
+	byte *buttonVoc = _filesManager.fload("button.voc");
+	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongSize);
+	bool result = false;
+
+	if (_bVoy->getBoltGroup(0x10700)) {
+
 	}
+
+	delete[] buttonVoc;
+	delete[] wrongVoc;
+
+	return result;
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 346d7fb..0b74208 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -75,6 +75,10 @@ private:
 	void initBolt();
 	void vInitInterrupts();
 	void initInput();
+
+	void doHeadTitle();
+	void showConversionScreen();
+	bool doLock();
 protected:
 	// Engine APIs
 	virtual Common::Error run();
@@ -101,8 +105,6 @@ public:
 	virtual bool canSaveGameStateCurrently();
 	virtual Common::Error loadGameState(int slot);
 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
-
-	void doHeadTitle();
 };
 
 } // End of namespace Voyeur


Commit: ca8a47700da17ef0c4de934a5fc980ca1e9de92e
    https://github.com/scummvm/scummvm/commit/ca8a47700da17ef0c4de934a5fc980ca1e9de92e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-10T18:46:19-07:00

Commit Message:
VOYEUR: Add missing code from CMapResource & ViewPortListResource initialisation

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index bdbf05c..f258e53 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -797,6 +797,7 @@ void ViewPortResource::setupViewPort() {
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
 	uint count = READ_LE_UINT16(src);
+	_palIndex = READ_LE_UINT16(src + 2);
 
 	// Load palette map
 	byte *palData = state._curLibPtr->memberAddr(READ_LE_UINT32(src + 4));
@@ -845,6 +846,12 @@ CMapResource::CMapResource(BoltFilesState &state, const byte *src): _vm(state._v
 	int count = _end - _start;
 	_entries = new byte[count * 3];
 	Common::copy(src + 6, src + 6 + 3 * count, _entries);
+
+	int palIndex = state._vm->_graphicsManager._viewPortListPtr->_palIndex;
+	if (_end > palIndex)
+		_end = palIndex;
+	if (_start > palIndex)
+		_start = palIndex;
 }
 
 CMapResource::~CMapResource() {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index d1b3a09..e24318f 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -272,6 +272,7 @@ class ViewPortListResource {
 public:
 	Common::Array<ViewPortPalEntry> _palette;
 	Common::Array<ViewPortResource *> _entries;
+	int _palIndex;
 
 	ViewPortListResource(BoltFilesState &state, const byte *src);
 	virtual ~ViewPortListResource() {}


Commit: f9b2c62bcd9522d67efde81af95b6c5401013f21
    https://github.com/scummvm/scummvm/commit/f9b2c62bcd9522d67efde81af95b6c5401013f21
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-10T20:24:02-07:00

Commit Message:
VOYEUR: Fading now works correctly

Changed paths:
    engines/voyeur/events.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index f76f99a..84e993e 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -215,25 +215,25 @@ void EventsManager::startFade(CMapResource *cMap) {
 	_fadeCount = cMap->_steps + 1;
 
 	if (cMap->_steps > 0) {
-		_fadeStatus = cMap->_fadeStatus |= 1;
+		_fadeStatus = cMap->_fadeStatus | 1;
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
 		int mapIndex = 0;
 
-		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx) {
+		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
 			ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[idx];
 			palEntry._rEntry = vgaP[0] << 8;
-			uint32 rComp = (uint16)((cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry) | 0x80;
-			palEntry._rChange = rComp / cMap->_steps;
+			int rDiff = (cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry;
+			palEntry._rChange = rDiff / cMap->_steps;
 
 			palEntry._gEntry = vgaP[1] << 8;
-			uint32 gComp = (uint16)((cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry) | 0x80;
-			palEntry._gChange = gComp / cMap->_steps;
+			int gDiff = (cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry;
+			palEntry._gChange = gDiff / cMap->_steps;
 
 			palEntry._bEntry = vgaP[2] << 8;
-			uint32 bComp = (uint16)((cMap->_entries[mapIndex * 3 + 2] << 8) -palEntry._bEntry) | 0x80;
-			palEntry._bChange = bComp / cMap->_steps;
-			palEntry._palIndex = bComp % cMap->_steps;
-
+			int bDiff = (cMap->_entries[mapIndex * 3 + 2] << 8) - palEntry._bEntry;
+			palEntry._bChange = bDiff / cMap->_steps;
+			
+			palEntry._palIndex = idx;
 			if (!(cMap->_fadeStatus & 1))
 				++mapIndex;
 		}


Commit: e24e181a2a7ca734550c75905ea6e8c079d4a20d
    https://github.com/scummvm/scummvm/commit/e24e181a2a7ca734550c75905ea6e8c079d4a20d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-12T19:13:52-07:00

Commit Message:
VOYEUR: Work implementing the lock display screen

Changed paths:
  A engines/voyeur/sound.cpp
  A engines/voyeur/sound.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/module.mk
    engines/voyeur/utils.cpp
    engines/voyeur/utils.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 84e993e..47f70d3 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -199,6 +199,9 @@ void EventsManager::pollEvents() {
 		case Common::EVENT_RBUTTONUP:
 			_mouseButton = 0;
 			return;
+		case Common::EVENT_MOUSEMOVE:
+			_mousePos = event.mouse;
+			break;
 		default:
  			break;
 		}
@@ -328,4 +331,8 @@ void EventsManager::vInitColor() {
 	addIntNode(&_cycleIntNode);
 }
 
+void EventsManager::setCursorTo(int idx, int mode) {
+	// TODO
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 22626cd..8689127 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -57,6 +57,7 @@ private:
 	bool _keyState[256];
 	int _mouseButton;
 	Common::List<IntNode *> _intNodes;
+	Common::Point _mousePos;
 
 	void mainVoyeurIntFunc();
 private:
@@ -78,7 +79,6 @@ public:
 	int _fadeFirstCol, _fadeLastCol;
 	int _fadeCount;
 	int _fadeStatus;
-
 public:
 	EventsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -94,6 +94,9 @@ public:
 	void startFade(CMapResource *cMap);
 	void addIntNode(IntNode *node);
 	void addFadeInt();
+
+	void setCursorTo(int idx, int mode);
+	Common::Point getMousePos() { return _mousePos; }
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index f258e53..b2f4d4f 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -291,7 +291,7 @@ BoltEntry &BoltFile::getBoltEntry(uint32 id) {
 	return entry;
 }
 
-PictureResource *BoltFile::getPictureResouce(uint32 id) {
+PictureResource *BoltFile::getPictureResource(uint32 id) {
 	if ((int32)id == -1)
 		return NULL;
 
@@ -669,10 +669,10 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		ys + READ_LE_UINT16(src + 18));
 	_field18 = READ_LE_UINT16(src + 0x18);
 
-	_currentPic = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
-	_activePage = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x24));
-	_pages[0] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
-	_pages[1] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
+	_currentPic = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x20));
+	_activePage = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x24));
+	_pages[0] = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x28));
+	_pages[1] = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x2C));
 
 	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
 
@@ -793,6 +793,10 @@ void ViewPortResource::setupViewPort() {
 		&GraphicsManager::restoreMCGASaveRect);
 }
 
+void ViewPortResource::drawText(const Common::String &msg) {
+	// TODO
+}
+
 /*------------------------------------------------------------------------*/
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index e24318f..4d3c203 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -134,7 +134,7 @@ public:
 	void resolveFunction(uint32 id, GraphicMethodPtr *fn);
 
 	BoltEntry &getBoltEntry(uint32 id);
-	PictureResource *getPictureResouce(uint32 id);
+	PictureResource *getPictureResource(uint32 id);
 	CMapResource *getCMapResource(uint32 id);
 };
 
@@ -257,6 +257,7 @@ public:
 	virtual ~ViewPortResource();
 
 	void setupViewPort();
+	void drawText(const Common::String &msg);
 };
 
 class ViewPortPalEntry  {
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 5ad90dd..e47a880 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -38,8 +38,7 @@ public:
 	int _type;
 	int _data1;
 	int _data2;
-	int _data3;
-	int _data4;
+	byte *_data;
 };
 
 class SVoy {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 0f077d5..9f547c6 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -46,7 +46,28 @@ FontInfo::FontInfo() {
 	_shadowColor = 0;
 }
 
-GraphicsManager::GraphicsManager() {
+FontInfo::FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, 
+		byte justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight,
+		const Common::Point &shadow, int foreColor, int backColor, int shadowColor) {
+	_curFont = NULL;
+	_picSelect = picSelect;
+	_picPick = picPick;
+	_picOnOff = picOnOff;
+	_fontFlags = fontFlags;
+	_justify = justify;
+	_fontSaveBack = fontSaveBack;
+	_pos = pos;
+	_justifyWidth = justifyWidth;
+	_justifyHeight = justifyHeight;
+	_shadow = shadow;
+	_foreColor = foreColor;
+	_backColor = backColor;
+	_shadowColor = shadowColor;
+}
+
+GraphicsManager::GraphicsManager():
+		_defaultFontInfo(3, 0xff, 0xff, 0, 0, 0, 0, Common::Point(), 1, 1, Common::Point(1, 1), 1, 0, 0),
+		_fontPtr(&_defaultFontInfo) {
 	_SVGAPage = 0;
 	_SVGAMode = 0;
 	_SVGAReset = 0;
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 2e65089..cd1d47b 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -43,6 +43,7 @@ class PictureResource;
 class ViewPortResource;
 class ViewPortListResource;
 class FontResource;
+class CMapResource;
 
 class FontInfo {
 public:
@@ -63,6 +64,9 @@ public:
 	int _shadowColor;
 public:
 	FontInfo();
+	FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, byte justify,
+		int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight,
+		const Common::Point &shadow, int foreColor, int backColor, int shadowColor);
 };
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
@@ -89,6 +93,9 @@ public:
 	uint _planeSelect;
 	int _sImageShift;
 	Graphics::Surface _screenSurface;
+	CMapResource *_backColors;
+	FontInfo *_fontPtr;
+	FontInfo _defaultFontInfo;
 private:
 	static void fadeIntFunc();
 	static void vDoCycleInt();
@@ -108,7 +115,7 @@ public:
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
-	void GraphicsManager::fillPic(DisplayResource *display, byte onOff);
+	void fillPic(DisplayResource *display, byte onOff = 0);
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();
 	void clearPalette();
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 3e9cbe4..48f63dc 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
 	game.o \
 	files.o \
 	graphics.o \
+	sound.o \
 	utils.o \
 	voyeur.o
 
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
new file mode 100644
index 0000000..628e6e2
--- /dev/null
+++ b/engines/voyeur/sound.cpp
@@ -0,0 +1,47 @@
+/* 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 "voyeur/sound.h"
+
+namespace Voyeur {
+
+SoundManager::SoundManager() {
+}
+
+void SoundManager::playVOCMap(byte *voc, int vocSize) {
+	// TODO
+}
+
+bool SoundManager::vocMapStatus() {
+	// TODO
+	return false;
+}
+
+void SoundManager::continueVocMap() {
+	// TODO
+}
+
+void SoundManager::abortVOCMap() {
+	// TODO
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
new file mode 100644
index 0000000..01d5dc2
--- /dev/null
+++ b/engines/voyeur/sound.h
@@ -0,0 +1,47 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_SOUND_H
+#define VOYEUR_SOUND_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "voyeur/files.h"
+
+namespace Voyeur {
+
+class SoundManager {
+private:
+	VoyeurEngine *_vm;
+public:
+	SoundManager();
+	void setVm(VoyeurEngine *vm) { _vm = vm; }
+
+	void playVOCMap(byte *voc, int vocSize);
+	bool vocMapStatus();
+	void continueVocMap();
+	void abortVOCMap();
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_SOUND_H */
diff --git a/engines/voyeur/utils.cpp b/engines/voyeur/utils.cpp
index 4ddfd71..a5745e6 100644
--- a/engines/voyeur/utils.cpp
+++ b/engines/voyeur/utils.cpp
@@ -21,11 +21,35 @@
  */
 
 #include "voyeur/utils.h"
+#include "common/savefile.h"
 
 namespace Voyeur {
 
-void LockClass::getSysData() {
+LockTime::LockTime() { 
+	field0 = field1 = field2 = field3 = 0; 
+}
+
+void LockClass::getSysDate() {
+
+}
+
+void LockClass::getThePassword() {
+	field0 = 26;
+	_password = "3333";
+	fieldE = field16;
+	field12 = field1A;
+	fieldC = -1;
+
+	// TODO: Original loaded 'VOYEUR.DAT' here to get most recent game's password.
+	// We'll want to transform this to proper savegames in ScummVM
+}
+
+void LockClass::saveThePassword() {
+	//TODO
+}
 
+Common::String LockClass::getDateString() {
+	return Common::String();
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/utils.h b/engines/voyeur/utils.h
index 9aed6b3..b926678 100644
--- a/engines/voyeur/utils.h
+++ b/engines/voyeur/utils.h
@@ -24,12 +24,34 @@
 #define VOYEUR_UTILS_H
 
 #include "common/scummsys.h"
+#include "common/str.h"
 
 namespace Voyeur {
 
+class LockTime {
+public:
+	int field0;
+	int field1;
+	int field2;
+	int field3;
+
+	LockTime();
+};
+
 class LockClass {
 public:
-	void getSysData();
+	int field0;
+	Common::String _password;
+	int fieldC;
+	LockTime fieldE;
+	int field12;
+	LockTime field16;
+	int field1A;
+public:
+	void getSysDate();
+	void getThePassword();
+	void saveThePassword();
+	Common::String getDateString();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 5c3c42c..c2e9907 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/voyeur.h"
 #include "voyeur/graphics.h"
+#include "voyeur/utils.h"
 #include "common/scummsys.h"
 #include "common/config-manager.h"
 #include "common/debug-channels.h"
@@ -97,6 +98,7 @@ void VoyeurEngine::initialiseManagers() {
 	_eventsManager.setVm(this);
 	_filesManager.setVm(this);
 	_graphicsManager.setVm(this);
+	_soundManager.setVm(this);
 }
 
 void VoyeurEngine::ESP_Init() {
@@ -114,8 +116,7 @@ void VoyeurEngine::globalInitBolt() {
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 	_voy._eCursorOff[0x74 / 2] = 1;
 	_voy._eCursorOff[0x68 / 2] = 0;
-	_voy._eventTable[998]._data3 = 63;
-	_voy._eventTable[998]._data4 = 63;
+	_voy._eventTable[998]._data = NULL; // Original set 63h:63h
 	_voy._evidence[19] = 0;
 	_voy._evidence[17] = 0;
 	_voy._evidence[18] = 9999;
@@ -192,16 +193,171 @@ void VoyeurEngine::showConversionScreen() {
 }
 
 bool VoyeurEngine::doLock() {
-	int var12 = 0;
-	int var14 = 0;
-	int di = 1;
-	int wrongSize;
-	byte *buttonVoc = _filesManager.fload("button.voc");
-	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongSize);
-	bool result = false;
+	bool result = true;
+	bool flag = false;
+	int buttonVocSize, wrongVocSize;
+	byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
+	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
+	LockClass lock;
+	PictureResource *srcPic;
+	byte *keyData;
+	int keyCount;
+	Common::String msg;
+	int key;
 
 	if (_bVoy->getBoltGroup(0x10700)) {
-
+		lock.getSysDate();
+		lock.getThePassword();
+		
+		_voy._eventTable[999]._type = lock.fieldC;
+		_voy._eventTable[999]._data = _bVoy->memberAddr(0x704);
+
+		Common::String password = lock._password;
+		srcPic = _bVoy->getPictureResource(0x702);
+
+		// Get the mappings of keys on the keypad
+		keyData = _bVoy->memberAddr(0x705);
+		keyCount = READ_LE_UINT16(keyData);
+
+		_graphicsManager._backColors = _bVoy->getCMapResource(0x7010000);
+		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x700);
+		(*_graphicsManager._vPort)->setupViewPort();
+
+		_graphicsManager._backColors->startFade();
+		(*_graphicsManager._vPort)->_flags |= 8;
+
+		_graphicsManager.flipPage();
+		_eventsManager.sWaitFlip();
+		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+			_eventsManager.delay(1);
+
+		_eventsManager.setCursorTo(127, 0);
+		_graphicsManager.setColor(1, 0x40, 0x40, 0x40);
+		_graphicsManager.setColor(2, 0x60, 0x60, 0x60);
+		_graphicsManager.setColor(3, 0x0A, 0xA0, 0x0A);
+		_graphicsManager.setColor(4, 0x0E, 0xE0, 0x0E);
+		
+		_eventsManager._intPtr.field38 = 1;
+		_eventsManager._intPtr._hasPalette = true;
+
+		_graphicsManager._fontPtr->_curFont = _bVoy->getBoltEntry(0x708)._fontResource;
+		_graphicsManager._fontPtr->_fontSaveBack = 0;
+		_graphicsManager._fontPtr->_fontFlags = 0;
+
+		Common::String dateString = lock.getDateString();
+		Common::String playString = Common::String::format("Last Play %s", msg.c_str());
+
+		bool breakFlag = false;
+		while (!breakFlag && !shouldQuit()) {
+			(*_graphicsManager._vPort)->setupViewPort();
+			(*_graphicsManager._vPort)->_flags |= 8;
+			_graphicsManager.flipPage();
+			_eventsManager.sWaitFlip();
+
+			// Display the last play time
+			_graphicsManager._fontPtr->_pos = Common::Point(0, 97);
+			_graphicsManager._fontPtr->_justify = 1;
+			_graphicsManager._fontPtr->_justifyWidth = 384;
+			_graphicsManager._fontPtr->_justifyHeight = 97;
+
+			(*_graphicsManager._vPort)->drawText(playString);
+			(*_graphicsManager._vPort)->_flags |= 8;
+			_graphicsManager.flipPage();
+			_eventsManager.sWaitFlip();
+
+			// Loop for getting key presses
+			do {
+				do {
+					// Scan through the list of key rects to check if a keypad key is highlighted
+					key = -1;
+					Common::Point mousePos = _eventsManager.getMousePos();
+
+					for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) { 
+						int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
+						int x2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 3) << 1));
+						int y1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
+						int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
+
+						if (mousePos.x >= x1 && mousePos.x <= x2 && mousePos.y >= y1 && mousePos.y <= y2) {
+							key = keyIndex;
+						}
+					}
+
+					_eventsManager.setCursorTo(127, (key == -1) ? 0 : 1);
+					_eventsManager._intPtr.field38 = 1;
+					_eventsManager._intPtr._hasPalette = true;
+
+					// TODO: Check is the mouse cursor being manually drawn here? I so, refactor
+					_graphicsManager.sDrawPic(srcPic, *_graphicsManager._vPort, mousePos);
+					(*_graphicsManager._vPort)->_flags |= 8;
+					_graphicsManager.flipPage();
+					_eventsManager.sWaitFlip();
+
+					_eventsManager.delay(1);
+				} while (!shouldQuit() && !_voy._incriminate);
+			} while (!shouldQuit() && key == -1);
+
+			_soundManager.abortVOCMap();
+			_soundManager.playVOCMap(buttonVoc, buttonVocSize);
+
+			while (_soundManager.vocMapStatus()) {
+				if (shouldQuit())
+					break;
+
+				_soundManager.continueVocMap();
+				_eventsManager.delay(1);
+			}
+
+			// Process the key
+			if (key < 10) {
+				if (playString.size() < 10) {
+					playString += '0' + key;
+					continue;
+				}
+			} else if (key == 10) {
+				if (!flag) {
+					if ((password.size() == 0 && !playString.size()) || (password == playString)) {
+						breakFlag = true;
+						result = true;
+						break;
+					}
+				} else {
+					if (playString.size() > 0) {
+						result = 1;
+						breakFlag = true;
+						break;
+					} 
+				}
+			} else if (key == 11) {
+				if ((password.size() == 0 && !playString.size()) || (password != playString)) {
+					(*_graphicsManager._vPort)->setupViewPort();
+					flag = true;
+					playString = "";
+					continue;
+				}
+			} else if (key == 12) {
+				breakFlag = true;
+				result = false;
+				break;
+			} else {
+				continue;
+			}
+
+			_soundManager.playVOCMap(wrongVoc, wrongVocSize);
+		}
+
+		_graphicsManager.fillPic(*_graphicsManager._vPort);
+		(*_graphicsManager._vPort)->_flags |= 8;
+		_graphicsManager.flipPage();
+		_eventsManager.sWaitFlip();
+		_graphicsManager.resetPalette();
+
+		if (flag && result)
+			lock._password = msg;
+		lock.saveThePassword();
+
+		_voy._eventTable[999]._data = NULL;
+		_bVoy->freeBoltGroup(0x10700);
 	}
 
 	delete[] buttonVoc;
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 0b74208..7238755 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -28,6 +28,7 @@
 #include "voyeur/files.h"
 #include "voyeur/game.h"
 #include "voyeur/graphics.h"
+#include "voyeur/sound.h"
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "common/error.h"
@@ -88,6 +89,7 @@ public:
 	EventsManager _eventsManager;
 	FilesManager _filesManager;
 	GraphicsManager _graphicsManager;
+	SoundManager _soundManager;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();


Commit: 0fe067ba4a2d0eea71ad91eaad1d537f1b42e97c
    https://github.com/scummvm/scummvm/commit/0fe067ba4a2d0eea71ad91eaad1d537f1b42e97c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-12T19:43:54-07:00

Commit Message:
VOYEUR: Lock screen background now correctly showing

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index b2f4d4f..74da77d 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -295,6 +295,8 @@ PictureResource *BoltFile::getPictureResource(uint32 id) {
 	if ((int32)id == -1)
 		return NULL;
 
+	if (id & 0xffff)
+		id <<= 16;
 	return getBoltEntry(id)._picResource;
 }
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 9f547c6..ace4b35 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -344,7 +344,31 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 
 				// loc_2615E
 				if (srcFlags & 2) {
-					error("TODO: sDrawPic");
+					srcP = srcImgData + srcOffset;
+
+					if (destFlags & 8) {
+						error("TODO: sDrawPic");
+					} else {
+						// loc_25773
+						// Copy from screen to surface with transparency
+						destP = destImgData + screenOffset;
+						srcP = (byte *)_screenSurface.pixels + srcOffset;
+
+						if (srcFlags & 2) {
+							for (int yp = 0; yp < height1; ++yp) {
+								for (int xp = 0; xp < width2; ++xp, ++destP) {
+									byte srcPixel = *srcP++;
+									if (srcPixel)
+										*destP = srcPixel;
+								}
+
+								destP += widthDiff2;
+								srcP += widthDiff; 
+							}
+						} else {
+							error("TODO: sDrawPic");
+						}
+					}
 				} else {
 					if (srcFlags & 0x100) {
 						srcP = srcImgData;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index c2e9907..83e5d80 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -214,6 +214,7 @@ bool VoyeurEngine::doLock() {
 
 		Common::String password = lock._password;
 		srcPic = _bVoy->getPictureResource(0x702);
+		assert(srcPic);
 
 		// Get the mappings of keys on the keypad
 		keyData = _bVoy->memberAddr(0x705);


Commit: b02c72b45f0ea15490b41896e33d40cb783b96e6
    https://github.com/scummvm/scummvm/commit/b02c72b45f0ea15490b41896e33d40cb783b96e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-14T19:01:59-07:00

Commit Message:
VOYEUR: Initial implementation of drawText method

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 74da77d..cfc82dd 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -795,10 +795,222 @@ void ViewPortResource::setupViewPort() {
 		&GraphicsManager::restoreMCGASaveRect);
 }
 
-void ViewPortResource::drawText(const Common::String &msg) {
+int ViewPortResource::drawText(const Common::String &msg) {
+	GraphicsManager &gfxManager = _state._vm->_graphicsManager;
+	FontInfo &fontInfo = *gfxManager._fontPtr;
+	FontResource &fontData = *fontInfo._curFont;
+	int xShadows[9] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };
+	int yShadows[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
+
+	Common::Rect *clipPtr = gfxManager._clipPtr;
+	if (!(fontInfo._picFlags & 1))
+		gfxManager._clipPtr = NULL;
+
+	int minChar = fontData._minChar;
+	int padding = fontData._padding;
+	int fontHeight = fontData._fontHeight;
+	int totalChars = fontData._maxChar - fontData._minChar;
+	int msgWidth = 0;
+	int xp = 0, yp = 0;
+
+	Common::Point pos = fontInfo._pos;
+
+	_fontChar._flags = fontInfo._picFlags | 2;
+	_fontChar._select = fontInfo._picSelect;
+	_fontChar._bounds.setHeight(fontHeight);
+
+	if (gfxManager._drawTextPermFlag || (fontInfo._fontFlags & 1) || fontInfo._justify ||
+			(gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & 0x8000))) {
+		msgWidth = textWidth(msg);
+		yp = pos.y;
+		xp = pos.x;
+
+		switch (fontInfo._justify) {
+		case 1:
+			xp = pos.x + (fontInfo._justifyWidth / 2) - (msgWidth / 2);
+			break;
+		case 2:
+			xp = pos.x + fontInfo._justifyWidth - msgWidth;
+			break;
+		default:
+			break;
+		}
+
+		if (!(fontInfo._fontFlags & 3)) {
+			_fontRect.left = xp;
+			_fontRect.top = yp;
+			_fontRect.setWidth(msgWidth);
+			_fontRect.setHeight(fontHeight);
+		} else {
+			_fontRect.left = pos.x;
+			_fontRect.top = pos.y;
+			_fontRect.setWidth(fontInfo._justifyWidth);
+			_fontRect.setHeight(fontInfo._justifyHeight);
+		}
+
+		pos.x = xp;
+		pos.y = yp;
+
+		if (fontInfo._fontFlags & 4) {
+			if (fontInfo._shadow.x <= 0) {
+				_fontRect.left += fontInfo._shadow.x;
+				_fontRect.right -= fontInfo._shadow.x * 2;
+			} else {
+				_fontRect.right += fontInfo._shadow.x;
+			}
+
+			if (fontInfo._shadow.y <= 0) {
+				_fontRect.top += fontInfo._shadow.y;
+				_fontRect.bottom -= fontInfo._shadow.y * 2;
+			} else {
+				_fontRect.bottom += fontInfo._shadow.y;
+			}
+		} else if (fontInfo._fontFlags & 8) {
+			if (fontInfo._shadow.x <= 0) {
+				_fontRect.left += fontInfo._shadow.x;
+				_fontRect.right -= fontInfo._shadow.x * 3;
+			} else {
+				_fontRect.right += fontInfo._shadow.x * 3;
+				_fontRect.left -= fontInfo._shadow.x;
+			}
+
+			if (fontInfo._shadow.y <= 0) {
+				_fontRect.top += fontInfo._shadow.y;
+				_fontRect.bottom -= fontInfo._shadow.y * 3;
+			} else {
+				_fontRect.bottom += fontInfo._shadow.y * 3;
+				_fontRect.top -= fontInfo._shadow.y;
+			}
+		}
+	} 
+
+	if (gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & 0x8000)) {
+		addSaveRect(_pageIndex, _fontRect);
+	}
+
+	if (fontInfo._fontFlags & 1) {
+		gfxManager._drawPtr->_pos = Common::Point(_fontRect.left, _fontRect.top);
+		gfxManager._drawPtr->_penColor = fontInfo._backColor;
+		sFillBox(_fontRect.width());
+	}
+
+	bool saveBack = gfxManager._saveBack;
+	gfxManager._saveBack = false;
+
+	int count = 0;
+	if (!(fontInfo._fontFlags & 4))
+		count = 1;
+	else if (fontInfo._fontFlags & 8)
+		count = 8;
+
+	for (int i = 0; i < count; ++i) {
+		xp = pos.x;
+		yp = pos.y;
+
+		switch (xShadows[i]) {
+		case -1:
+			xp -= fontInfo._shadow.x;
+			break;
+		case 1:
+			xp += fontInfo._shadow.x;
+			break;
+		default:
+			break;
+		}
+
+		switch (yShadows[i]) {
+		case -1:
+			yp -= fontInfo._shadow.y;
+			break;
+		case 1:
+			yp += fontInfo._shadow.y;
+			break;
+		default:
+			break;
+		}
+
+		if (i == 0) {
+			_fontChar._pick = 0;
+			_fontChar._onOff = fontInfo._shadowColor;
+		} else if (fontData.field2 == 1 || (fontInfo._fontFlags & 0x10)) {
+			_fontChar._pick = 0;
+			_fontChar._onOff = fontInfo._foreColor;
+		} else {
+			_fontChar._pick = fontInfo._picPick;
+			_fontChar._onOff = fontInfo._picOnOff;
+			_fontChar._depth = fontData.field2;
+		}
+
+		// Loop to draw each character in turn
+		msgWidth = -padding;
+		const char *msgP = msg.c_str();
+		char ch;
+
+		while ((ch = *msgP++) != '\0') {
+			int charValue = (int)ch - minChar;
+			if (charValue >= totalChars || fontData._charWidth[charValue] == 0)
+				charValue = fontData._maxChar - minChar;
+
+			int charWidth = fontData._charWidth[charValue];
+			_fontChar._bounds.setWidth(charWidth);
+
+			uint16 offset = READ_LE_UINT16(fontData._data1 + charValue * 2);
+			_fontChar._imgData = fontData._data2 + offset * 2;
+
+			gfxManager.sDrawPic(&_fontChar, this, Common::Point(xp, yp));
+			
+			xp += charWidth + padding;
+			msgWidth += charWidth + padding;
+		}
+	}
+
+	msgWidth = MAX(msgWidth, 0);
+	if (fontInfo._justify == ALIGN_LEFT)
+		fontInfo._pos.x = xp;
+
+	gfxManager._saveBack = saveBack;
+	gfxManager._clipPtr = clipPtr;
+
+	return msgWidth;
+}
+
+int ViewPortResource::textWidth(const Common::String &msg) {
+	if (msg.size() == 0)
+		return 0;
+
+	const char *msgP = msg.c_str();
+	FontResource &fontData = *_state._vm->_graphicsManager._fontPtr->_curFont;
+	int minChar = fontData._minChar;
+	int maxChar = fontData._maxChar;
+	int padding = fontData._padding;
+	int totalWidth = -padding;
+	char ch;
+
+	// Loop through the characters
+	while ((ch = *msgP++) != '\0') {
+		int charValue = (int)ch;
+		if (charValue < minChar || charValue > maxChar)
+			charValue = maxChar;
+
+		if (!fontData._charWidth[charValue - minChar])
+			charValue = maxChar;
+
+		totalWidth += fontData._charWidth[charValue - minChar] + padding;
+	}
+
+	if (totalWidth < 0)
+		totalWidth = 0;
+	return totalWidth;
+}
+
+void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
 	// TODO
 }
 
+void ViewPortResource::sFillBox(int width) {
+
+}
+
 /*------------------------------------------------------------------------*/
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
@@ -837,8 +1049,25 @@ ViewPortPalEntry::ViewPortPalEntry(const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
-FontResource::FontResource(BoltFilesState &state, const byte *src) {
-	state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0xC), &_fieldC);
+FontResource::FontResource(BoltFilesState &state, byte *src) {
+	_minChar = src[0];
+	_maxChar = src[1];
+	field2 = src[2];
+	_padding = src[3];
+	_fontHeight = src[5];
+	field6 = src[6];
+
+	int totalChars = _maxChar - _minChar + 1;
+	_charWidth = new int[totalChars];
+	for (int i = 0; i < totalChars; ++i)
+		_charWidth[i] = READ_LE_UINT16(src + 8 + 2 * i);
+
+	_data1 = src + 8 + totalChars * 2;
+	_data2 = _data1 + totalChars * 2;
+}
+
+FontResource::~FontResource() {
+	delete[] _charWidth;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4d3c203..499cbb8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -252,12 +252,17 @@ public:
 	ViewPortSetupPtr _setupFn;
 	ViewPortAddPtr _addFn;
 	ViewPortRestorePtr _restoreFn;
+	PictureResource _fontChar;
+	Common::Rect _fontRect;
 public:
 	ViewPortResource(BoltFilesState &state, const byte *src);
 	virtual ~ViewPortResource();
 
 	void setupViewPort();
-	void drawText(const Common::String &msg);
+	int drawText(const Common::String &msg);
+	int textWidth(const Common::String &msg);
+	void addSaveRect(int pageIndex, const Common::Rect &r);
+	void sFillBox(int width);
 };
 
 class ViewPortPalEntry  {
@@ -281,10 +286,17 @@ public:
 
 class FontResource {
 public:
-	byte *_fieldC;
-
-	FontResource(BoltFilesState &state, const byte *src);
-	virtual ~FontResource() {}
+	int _minChar, _maxChar;
+	int field2;
+	int _padding;
+	int _fontHeight;
+	int field6;
+	int *_charWidth;
+	byte *_data1;
+	byte *_data2;
+
+	FontResource(BoltFilesState &state, byte *src);
+	virtual ~FontResource();
 };
 
 class CMapResource {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index ace4b35..fda7c83 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -36,7 +36,7 @@ FontInfo::FontInfo() {
 	_picPick = 0xff;
 	_picOnOff = 0;
 	_fontFlags = 0;
-	_justify = 0;
+	_justify = ALIGN_LEFT;
 	_fontSaveBack = 0;
 	_justifyWidth = 1;
 	_justifyHeight = 1;
@@ -47,7 +47,7 @@ FontInfo::FontInfo() {
 }
 
 FontInfo::FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, 
-		byte justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight,
+		FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight,
 		const Common::Point &shadow, int foreColor, int backColor, int shadowColor) {
 	_curFont = NULL;
 	_picSelect = picSelect;
@@ -65,9 +65,20 @@ FontInfo::FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, b
 	_shadowColor = shadowColor;
 }
 
+/*------------------------------------------------------------------------*/
+
+DrawInfo::DrawInfo(int penColor, const Common::Point &pos, int flags) {
+	_penColor = penColor;
+	_pos = pos;
+	_flags = flags;
+}
+
+/*------------------------------------------------------------------------*/
+
 GraphicsManager::GraphicsManager():
-		_defaultFontInfo(3, 0xff, 0xff, 0, 0, 0, 0, Common::Point(), 1, 1, Common::Point(1, 1), 1, 0, 0),
-		_fontPtr(&_defaultFontInfo) {
+		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
+			Common::Point(1, 1), 1, 0, 0), _defaultDrawInfo(1, Common::Point(), 0),
+		_fontPtr(&_defaultFontInfo), _drawPtr(&_defaultDrawInfo) {
 	_SVGAPage = 0;
 	_SVGAMode = 0;
 	_SVGAReset = 0;
@@ -77,6 +88,7 @@ GraphicsManager::GraphicsManager():
 	_palFlag = false;
 	_MCGAMode = false;
 	_saveBack = true;
+	_drawTextPermFlag = false;
 	_clipPtr = NULL;
 	_viewPortListPtr = NULL;
 	_vPort = NULL;
@@ -350,11 +362,11 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 						error("TODO: sDrawPic");
 					} else {
 						// loc_25773
-						// Copy from screen to surface with transparency
 						destP = destImgData + screenOffset;
 						srcP = (byte *)_screenSurface.pixels + srcOffset;
 
 						if (srcFlags & 2) {
+							// Copy from screen to surface with transparency
 							for (int yp = 0; yp < height1; ++yp) {
 								for (int xp = 0; xp < width2; ++xp, ++destP) {
 									byte srcPixel = *srcP++;
@@ -366,7 +378,16 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 								srcP += widthDiff; 
 							}
 						} else {
-							error("TODO: sDrawPic");
+							// Copy from screen surface without transparency
+							for (int yp = 0; yp < height1; ++yp) {
+								for (int xp = 0; xp < width2; ++xp, ++destP) {
+									byte srcPixel = *srcP++;
+									*destP = srcPixel;
+								}
+
+								destP += widthDiff2;
+								srcP += widthDiff; 
+							}
 						}
 					}
 				} else {
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index cd1d47b..9c66a32 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -45,6 +45,8 @@ class ViewPortListResource;
 class FontResource;
 class CMapResource;
 
+enum FontJustify { ALIGN_LEFT = 0, ALIGN_CENTRE = 1, ALIGN_RIGHT = 2 };
+
 class FontInfo {
 public:
 	FontResource *_curFont;
@@ -53,7 +55,7 @@ public:
 	byte _picPick;
 	byte _picOnOff;
 	byte _fontFlags;
-	byte _justify;
+	FontJustify _justify;
 	int _fontSaveBack;
 	Common::Point _pos;
 	int _justifyWidth;
@@ -64,9 +66,19 @@ public:
 	int _shadowColor;
 public:
 	FontInfo();
-	FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, byte justify,
-		int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight,
-		const Common::Point &shadow, int foreColor, int backColor, int shadowColor);
+	FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, 
+		FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, 
+		int justifyHeight, const Common::Point &shadow, int foreColor, int backColor, 
+		int shadowColor);
+};
+
+class DrawInfo {
+public:
+	int _penColor;
+	Common::Point _pos;
+	int _flags;
+public:
+	DrawInfo(int penColor, const Common::Point &pos, int flags);
 };
 
 typedef void (GraphicsManager::*GraphicMethodPtr)(); 
@@ -96,6 +108,9 @@ public:
 	CMapResource *_backColors;
 	FontInfo *_fontPtr;
 	FontInfo _defaultFontInfo;
+	DrawInfo *_drawPtr;
+	DrawInfo _defaultDrawInfo;
+	bool _drawTextPermFlag;
 private:
 	static void fadeIntFunc();
 	static void vDoCycleInt();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 83e5d80..9078cc9 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -257,7 +257,7 @@ bool VoyeurEngine::doLock() {
 
 			// Display the last play time
 			_graphicsManager._fontPtr->_pos = Common::Point(0, 97);
-			_graphicsManager._fontPtr->_justify = 1;
+			_graphicsManager._fontPtr->_justify = ALIGN_CENTRE;
 			_graphicsManager._fontPtr->_justifyWidth = 384;
 			_graphicsManager._fontPtr->_justifyHeight = 97;
 
@@ -277,7 +277,7 @@ bool VoyeurEngine::doLock() {
 						int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
 						int x2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 3) << 1));
 						int y1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
-						int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
+						int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 4) << 1));
 
 						if (mousePos.x >= x1 && mousePos.x <= x2 && mousePos.y >= y1 && mousePos.y <= y2) {
 							key = keyIndex;


Commit: 0a0db2bf73fc417d1094ae744e0d350dd4462d38
    https://github.com/scummvm/scummvm/commit/0a0db2bf73fc417d1094ae744e0d350dd4462d38
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-15T08:39:28-07:00

Commit Message:
VOYEUR: Refactoring and bugfixes for correctly loading fontInfo and font resources

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index cfc82dd..94a770a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -217,7 +217,7 @@ const BoltMethodPtr BoltFile::_fnInitType[25] = {
 	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
 	&BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl,
 	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort,
-	&BoltFile::initViewPortList, &BoltFile::initDefault, &BoltFile::initFontInfo,
+	&BoltFile::initViewPortList, &BoltFile::initFont, &BoltFile::initFontInfo,
 	&BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
 	&BoltFile::initDefault, &BoltFile::initDefault
 };
@@ -281,7 +281,7 @@ void BoltFile::freeBoltGroup(uint32 id) {
 	_state._curGroupPtr->unload();
 }
 
-BoltEntry &BoltFile::getBoltEntry(uint32 id) {
+BoltEntry &BoltFile::getBoltEntryFromLong(uint32 id) {
 	BoltGroup &group = _groups[id >> 24];
 	assert(group._loaded);
 
@@ -291,20 +291,32 @@ BoltEntry &BoltFile::getBoltEntry(uint32 id) {
 	return entry;
 }
 
+BoltEntry &BoltFile::boltEntry(uint16 id) {
+	BoltGroup &group = _groups[id >> 8];
+	assert(group._loaded);
+
+	BoltEntry &entry = group._entries[id & 0xff];
+	assert(entry.hasResource());
+
+	return entry;
+}
+
 PictureResource *BoltFile::getPictureResource(uint32 id) {
 	if ((int32)id == -1)
 		return NULL;
 
 	if (id & 0xffff)
 		id <<= 16;
-	return getBoltEntry(id)._picResource;
+	return getBoltEntryFromLong(id)._picResource;
 }
 
 CMapResource *BoltFile::getCMapResource(uint32 id) {
 		if ((int32)id == -1)
 		return NULL;
 
-	return getBoltEntry(id)._cMapResource;
+	if (id & 0xffff)
+		id <<= 16;
+	return getBoltEntryFromLong(id)._cMapResource;
 }
 
 byte *BoltFile::memberAddr(uint32 id) {
@@ -462,10 +474,15 @@ void BoltFile::initViewPortList() {
 
 void BoltFile::initFontInfo() {
 	initDefault();
-	_state._curMemberPtr->_fontResource = new FontResource(
+	_state._curMemberPtr->_fontInfoResource = new FontInfoResource(
 		_state, _state._curMemberPtr->_data);
 }
 
+void BoltFile::initFont() {
+	initDefault();
+	_state._curMemberPtr->_fontResource = new FontResource(_state, _state._curMemberPtr->_data);
+}
+
 void BoltFile::initSoundMap() {
 	initDefault();
 }
@@ -514,6 +531,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_viewPortResource = NULL;
 	_viewPortListResource = NULL;
 	_fontResource = NULL;
+	_fontInfoResource = NULL;
 	_cMapResource = NULL;
 	_vInitCyclResource = NULL;
 
@@ -533,6 +551,7 @@ BoltEntry::~BoltEntry() {
 	delete _viewPortResource;
 	delete _viewPortListResource;
 	delete _fontResource;
+	delete _fontInfoResource;
 	delete _cMapResource;
 	delete _vInitCyclResource;
 }
@@ -547,7 +566,7 @@ void BoltEntry::load() {
  */
 bool BoltEntry::hasResource() const {
 	return _picResource || _viewPortResource || _viewPortListResource
-		|| _fontResource || _cMapResource || _vInitCyclResource;
+		|| _fontResource || _fontInfoResource || _cMapResource || _vInitCyclResource;
 }
 
 /*------------------------------------------------------------------------*/
@@ -660,7 +679,7 @@ PictureResource::~PictureResource() {
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_state(state) {
 	_flags = READ_LE_UINT16(src);
-	_next = state._curLibPtr->getBoltEntry(READ_LE_UINT32(src + 2))._viewPortResource;
+	_next = state._curLibPtr->getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
 	_pageCount = READ_LE_UINT16(src + 6);
 	_pageIndex = READ_LE_UINT16(src + 8);
 	_lastPage = READ_LE_UINT16(src + 10);
@@ -797,7 +816,9 @@ void ViewPortResource::setupViewPort() {
 
 int ViewPortResource::drawText(const Common::String &msg) {
 	GraphicsManager &gfxManager = _state._vm->_graphicsManager;
-	FontInfo &fontInfo = *gfxManager._fontPtr;
+	assert(gfxManager._fontPtr);
+	assert(gfxManager._fontPtr->_curFont);
+	FontInfoResource &fontInfo = *gfxManager._fontPtr;
 	FontResource &fontData = *fontInfo._curFont;
 	int xShadows[9] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };
 	int yShadows[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
@@ -1026,7 +1047,7 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 	uint32 *idP = (uint32 *)&src[8];
 	for (uint i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
-		BoltEntry &entry = state._curLibPtr->getBoltEntry(id);
+		BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
 
 		assert(entry._viewPortResource);
 		_entries.push_back(entry._viewPortResource);
@@ -1072,6 +1093,66 @@ FontResource::~FontResource() {
 
 /*------------------------------------------------------------------------*/
 
+FontInfoResource::FontInfoResource(BoltFilesState &state, const byte *src) {
+	_curFont = NULL;
+	_picFlags = src[4];
+	_picSelect = src[5];
+	_picPick = src[6];
+	_picOnOff = src[7];
+	_fontFlags = src[8];
+	_justify = (FontJustify)src[9];
+	_fontSaveBack = READ_LE_UINT16(src + 10);
+	_pos.x = (int16)READ_LE_UINT16(src + 12);
+	_pos.y = (int16)READ_LE_UINT16(src + 14);
+	_justifyWidth = READ_LE_UINT16(src + 16);
+	_justifyHeight = READ_LE_UINT16(src + 18);
+	_shadow.x = READ_LE_UINT16(src + 20);
+	_shadow.y = READ_LE_UINT16(src + 22);
+	_foreColor = READ_LE_UINT16(src + 24);
+	_backColor = READ_LE_UINT16(src + 26);
+	_shadowColor = READ_LE_UINT16(src + 28);
+}
+
+FontInfoResource::FontInfoResource() {
+	_curFont = NULL;
+	_picFlags = 3;
+	_picSelect = 0xff;
+	_picPick = 0xff;
+	_picOnOff = 0;
+	_fontFlags = 0;
+	_justify = ALIGN_LEFT;
+	_fontSaveBack = 0;
+	_justifyWidth = 1;
+	_justifyHeight = 1;
+	_shadow = Common::Point(1, 1);
+	_foreColor = 1;
+	_backColor = 0;
+	_shadowColor = 0;
+}
+
+FontInfoResource::FontInfoResource(byte picFlags, byte picSelect, byte picPick, byte picOnOff, 
+		byte fontFlags, FontJustify justify, int fontSaveBack, const Common::Point &pos, 
+		int justifyWidth, int justifyHeight, const Common::Point &shadow, int foreColor, 
+		int backColor, int shadowColor) {
+	_curFont = NULL;
+	_picFlags = picFlags;
+	_picSelect = picSelect;
+	_picPick = picPick;
+	_picOnOff = picOnOff;
+	_fontFlags = fontFlags;
+	_justify = justify;
+	_fontSaveBack = fontSaveBack;
+	_pos = pos;
+	_justifyWidth = justifyWidth;
+	_justifyHeight = justifyHeight;
+	_shadow = shadow;
+	_foreColor = foreColor;
+	_backColor = backColor;
+	_shadowColor = shadowColor;
+}
+
+/*------------------------------------------------------------------------*/
+
 CMapResource::CMapResource(BoltFilesState &state, const byte *src): _vm(state._vm) {
 	_steps = src[0];
 	_fadeStatus = src[1];
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 499cbb8..f612904 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -112,6 +112,7 @@ private:
 	void initViewPort();
 	void initViewPortList();
 	void initFontInfo();
+	void initFont();
 	void initSoundMap();
 private:
 	void resolveAll();
@@ -133,7 +134,8 @@ public:
 	void resolveIt(uint32 id, byte **p);
 	void resolveFunction(uint32 id, GraphicMethodPtr *fn);
 
-	BoltEntry &getBoltEntry(uint32 id);
+	BoltEntry &boltEntry(uint16 id); 
+	BoltEntry &getBoltEntryFromLong(uint32 id);
 	PictureResource *getPictureResource(uint32 id);
 	CMapResource *getCMapResource(uint32 id);
 };
@@ -174,6 +176,7 @@ public:
 	ViewPortResource *_viewPortResource;
 	ViewPortListResource *_viewPortListResource;
 	FontResource *_fontResource;
+	FontInfoResource *_fontInfoResource;
 	CMapResource *_cMapResource;
 	VInitCyclResource *_vInitCyclResource;
 public:
@@ -299,6 +302,34 @@ public:
 	virtual ~FontResource();
 };
 
+enum FontJustify { ALIGN_LEFT = 0, ALIGN_CENTRE = 1, ALIGN_RIGHT = 2 };
+
+class FontInfoResource {
+public:
+	FontResource *_curFont;
+	byte _picFlags;
+	byte _picSelect;
+	byte _picPick;
+	byte _picOnOff;
+	byte _fontFlags;
+	FontJustify _justify;
+	int _fontSaveBack;
+	Common::Point _pos;
+	int _justifyWidth;
+	int _justifyHeight;
+	Common::Point _shadow;
+	int _foreColor;
+	int _backColor;
+	int _shadowColor;
+public:
+	FontInfoResource(BoltFilesState &state, const byte *src);
+	FontInfoResource();
+	FontInfoResource(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, 
+		FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, 
+		int justifyHeight, const Common::Point &shadow, int foreColor, int backColor, 
+		int shadowColor);
+};
+
 class CMapResource {
 private:
 	VoyeurEngine *_vm;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index fda7c83..7a6c72c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -29,42 +29,6 @@
 
 namespace Voyeur {
 
-FontInfo::FontInfo() {
-	_curFont = NULL;
-	_picFlags = 3;
-	_picSelect = 0xff;
-	_picPick = 0xff;
-	_picOnOff = 0;
-	_fontFlags = 0;
-	_justify = ALIGN_LEFT;
-	_fontSaveBack = 0;
-	_justifyWidth = 1;
-	_justifyHeight = 1;
-	_shadow = Common::Point(1, 1);
-	_foreColor = 1;
-	_backColor = 0;
-	_shadowColor = 0;
-}
-
-FontInfo::FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, 
-		FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight,
-		const Common::Point &shadow, int foreColor, int backColor, int shadowColor) {
-	_curFont = NULL;
-	_picSelect = picSelect;
-	_picPick = picPick;
-	_picOnOff = picOnOff;
-	_fontFlags = fontFlags;
-	_justify = justify;
-	_fontSaveBack = fontSaveBack;
-	_pos = pos;
-	_justifyWidth = justifyWidth;
-	_justifyHeight = justifyHeight;
-	_shadow = shadow;
-	_foreColor = foreColor;
-	_backColor = backColor;
-	_shadowColor = shadowColor;
-}
-
 /*------------------------------------------------------------------------*/
 
 DrawInfo::DrawInfo(int penColor, const Common::Point &pos, int flags) {
@@ -76,9 +40,8 @@ DrawInfo::DrawInfo(int penColor, const Common::Point &pos, int flags) {
 /*------------------------------------------------------------------------*/
 
 GraphicsManager::GraphicsManager():
-		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
-			Common::Point(1, 1), 1, 0, 0), _defaultDrawInfo(1, Common::Point(), 0),
-		_fontPtr(&_defaultFontInfo), _drawPtr(&_defaultDrawInfo) {
+		_defaultDrawInfo(1, Common::Point(), 0),
+			_drawPtr(&_defaultDrawInfo) {
 	_SVGAPage = 0;
 	_SVGAMode = 0;
 	_SVGAReset = 0;
@@ -92,6 +55,7 @@ GraphicsManager::GraphicsManager():
 	_clipPtr = NULL;
 	_viewPortListPtr = NULL;
 	_vPort = NULL;
+	_fontPtr = NULL;
 }
 
 void GraphicsManager::sInitGraphics() {
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 9c66a32..02e9698 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -43,35 +43,9 @@ class PictureResource;
 class ViewPortResource;
 class ViewPortListResource;
 class FontResource;
+class FontInfoResource;
 class CMapResource;
 
-enum FontJustify { ALIGN_LEFT = 0, ALIGN_CENTRE = 1, ALIGN_RIGHT = 2 };
-
-class FontInfo {
-public:
-	FontResource *_curFont;
-	byte _picFlags;
-	byte _picSelect;
-	byte _picPick;
-	byte _picOnOff;
-	byte _fontFlags;
-	FontJustify _justify;
-	int _fontSaveBack;
-	Common::Point _pos;
-	int _justifyWidth;
-	int _justifyHeight;
-	Common::Point _shadow;
-	int _foreColor;
-	int _backColor;
-	int _shadowColor;
-public:
-	FontInfo();
-	FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, 
-		FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, 
-		int justifyHeight, const Common::Point &shadow, int foreColor, int backColor, 
-		int shadowColor);
-};
-
 class DrawInfo {
 public:
 	int _penColor;
@@ -106,8 +80,7 @@ public:
 	int _sImageShift;
 	Graphics::Surface _screenSurface;
 	CMapResource *_backColors;
-	FontInfo *_fontPtr;
-	FontInfo _defaultFontInfo;
+	FontInfoResource *_fontPtr;
 	DrawInfo *_drawPtr;
 	DrawInfo _defaultDrawInfo;
 	bool _drawTextPermFlag;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 9078cc9..3dec56f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -32,7 +32,9 @@ namespace Voyeur {
 VoyeurEngine *g_vm;
 
 VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
-		_gameDescription(gameDesc), _randomSource("Voyeur") {
+		_gameDescription(gameDesc), _randomSource("Voyeur"),
+		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
+			Common::Point(1, 1), 1, 0, 0) {
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
 	_bVoy = NULL;
 
@@ -99,6 +101,7 @@ void VoyeurEngine::initialiseManagers() {
 	_filesManager.setVm(this);
 	_graphicsManager.setVm(this);
 	_soundManager.setVm(this);
+
 }
 
 void VoyeurEngine::ESP_Init() {
@@ -110,7 +113,10 @@ void VoyeurEngine::globalInitBolt() {
 	_filesManager.openBoltLib("bvoy.blt", _bVoy);
 	_bVoy->getBoltGroup(0x10000);
 	_bVoy->getBoltGroup(0x10100);
-	_fontPtr = _bVoy->memberAddr(0x101);
+
+	_graphicsManager._fontPtr = &_defaultFontInfo;
+	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
+	assert(_graphicsManager._fontPtr->_curFont);
 
 	// Setup default flags
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
@@ -156,7 +162,7 @@ void VoyeurEngine::doHeadTitle() {
 }
 
 void VoyeurEngine::showConversionScreen() {
-	_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
+	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x502)._picResource;
 	(*_graphicsManager._vPort)->setupViewPort();
 	(*_graphicsManager._vPort)->_flags |= 8;
 
@@ -164,7 +170,7 @@ void VoyeurEngine::showConversionScreen() {
 	_eventsManager.sWaitFlip();
 
 	// Immediate palette load to show the initial screen
-	CMapResource *cMap = _bVoy->getCMapResource(0x5030000);
+	CMapResource *cMap = _bVoy->getCMapResource(0x503);
 	assert(cMap);
 	cMap->_steps = 0;
 	cMap->startFade();
@@ -238,10 +244,10 @@ bool VoyeurEngine::doLock() {
 		_graphicsManager.setColor(3, 0x0A, 0xA0, 0x0A);
 		_graphicsManager.setColor(4, 0x0E, 0xE0, 0x0E);
 		
-		_eventsManager._intPtr.field38 = 1;
+		_eventsManager._intPtr. field38 = 1;
 		_eventsManager._intPtr._hasPalette = true;
 
-		_graphicsManager._fontPtr->_curFont = _bVoy->getBoltEntry(0x708)._fontResource;
+		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
 		_graphicsManager._fontPtr->_fontSaveBack = 0;
 		_graphicsManager._fontPtr->_fontFlags = 0;
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 7238755..7a156b8 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,9 +66,9 @@ private:
 	Common::RandomSource _randomSource;
 
 	BoltFile *_bVoy;
-	byte *_fontPtr;
 	SVoy _voy;
 	Common::Array<int> _resolves;
+	FontInfoResource _defaultFontInfo;
 
 	void ESP_Init();
 	void initialiseManagers();


Commit: 76ba4bcafba4f8c70c318094650bfa45fd674308
    https://github.com/scummvm/scummvm/commit/76ba4bcafba4f8c70c318094650bfa45fd674308
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-16T06:03:03-07:00

Commit Message:
VOYEUR: Font rendering fixes

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 94a770a..69cfcc2 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -670,6 +670,20 @@ PictureResource::PictureResource() {
 	_imgData = NULL;
 }
 
+PictureResource::PictureResource(int flags, int select, int pick, int onOff, 
+		int depth,  const Common::Rect &bounds, int maskData, byte *imgData,
+		int planeSize) {
+	_flags = flags;
+	_select = select;
+	_pick = pick;
+	_onOff = onOff;
+	_depth = depth;
+	_bounds = bounds;
+	_maskData = maskData;
+	_imgData = imgData;
+	_planeSize = planeSize;
+}
+
 PictureResource::~PictureResource() {
 	delete _imgData;
 }
@@ -677,7 +691,7 @@ PictureResource::~PictureResource() {
 /*------------------------------------------------------------------------*/
 
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
-		_state(state) {
+		_fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), _state(state) {
 	_flags = READ_LE_UINT16(src);
 	_next = state._curLibPtr->getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
 	_pageCount = READ_LE_UINT16(src + 6);
@@ -919,12 +933,12 @@ int ViewPortResource::drawText(const Common::String &msg) {
 	gfxManager._saveBack = false;
 
 	int count = 0;
-	if (!(fontInfo._fontFlags & 4))
+	if (fontInfo._fontFlags & 4)
 		count = 1;
 	else if (fontInfo._fontFlags & 8)
 		count = 8;
 
-	for (int i = 0; i < count; ++i) {
+	for (int i = count; i >= 0; --i) {
 		xp = pos.x;
 		yp = pos.y;
 
@@ -950,7 +964,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 			break;
 		}
 
-		if (i == 0) {
+		if (i != 0) {
 			_fontChar._pick = 0;
 			_fontChar._onOff = fontInfo._shadowColor;
 		} else if (fontData.field2 == 1 || (fontInfo._fontFlags & 0x10)) {
@@ -969,7 +983,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 
 		while ((ch = *msgP++) != '\0') {
 			int charValue = (int)ch - minChar;
-			if (charValue >= totalChars || fontData._charWidth[charValue] == 0)
+			if (charValue < 0 || charValue >= totalChars || fontData._charWidth[charValue] == 0)
 				charValue = fontData._maxChar - minChar;
 
 			int charWidth = fontData._charWidth[charValue];
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index f612904..659f29b 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -219,6 +219,8 @@ public:
 	byte *_imgData;
 public:
 	PictureResource(BoltFilesState &state, const byte *src);
+	PictureResource(int flags, int select, int pick, int onOff, int depth, 
+		const Common::Rect &bounds, int maskData, byte *imgData, int planeSize);
 	PictureResource();
 	virtual ~PictureResource();
 };
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 7a6c72c..99abc11 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -93,19 +93,9 @@ void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, co
 	if (viewPort->_rectListCount[idx] == -1)
 		return;
 
+	// TODO: Lots of code in original, which I suspect may be overlapping rect merging
 	viewPort->_rectListPtr[idx]->push_back(bounds);
-	count1 = count2 = viewPort->_rectListCount[idx];
-	varE = var24 = 0;
-
-	if (count1 > 0) {
-		for (idx1 = 0; idx1 < count1; ++idx1) {
-			// TODO: In progress
-
-			Common::Array<Common::Rect> &rectList = *viewPort->_rectListPtr[idx];
-		}
-
-		viewPort->_rectListCount[idx] = idx1;
-	}
+	++viewPort->_rectListCount[idx];
 }
 
 void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
@@ -148,9 +138,11 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	bool isClipped = false;
 	int var52;
 	int var20, var22;
-	int var26;
+	int var26, var2C;
+
 	byte *srcImgData, *destImgData;
 	byte *srcP, *destP;
+	byte byteVal, byteVal2;
 
 	// Get the picture parameters, or deference viewport pointers to get their pictures
 	PictureResource *srcPic = (PictureResource *)srcDisplay;
@@ -292,6 +284,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		if (srcFlags & 8) {
 			error("TODO: sDrawPic");
 		} else {
+			// loc_258B8
 			srcP = srcImgData + srcOffset;
 
 			if (destFlags & 8) {
@@ -316,43 +309,94 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 					}
 				}
 			} else {
+				// loc_2615E
 				destP = destImgData + screenOffset;
 
-				// loc_2615E
 				if (srcFlags & 2) {
-					srcP = srcImgData + srcOffset;
-
-					if (destFlags & 8) {
-						error("TODO: sDrawPic");
-					} else {
-						// loc_25773
-						destP = destImgData + screenOffset;
-						srcP = (byte *)_screenSurface.pixels + srcOffset;
+					// loc_2617e
+					if (srcFlags & 0x100) {
+						// loc_26188
+						srcP = srcImgData;
+						if (isClipped) {
+							// loc_26199
+error("TODO: var22/var24/var2C not initialised before use?");
+							if (var22 < 0) {
+								var22 = -var22;
+							} else {
+								var22 = 0;
+							}
+							var26 = var22 + width2;
+							if (var24 < 0) {
+								var24 = -var24;
+							} else {
+								var24 = 0;
+							}
 
-						if (srcFlags & 2) {
-							// Copy from screen to surface with transparency
+							width2 = srcPic->_bounds.width();
+							height1 = var24 + height1;
+							byteVal = 0;
+							
 							for (int yp = 0; yp < height1; ++yp) {
-								for (int xp = 0; xp < width2; ++xp, ++destP) {
-									byte srcPixel = *srcP++;
-									if (srcPixel)
-										*destP = srcPixel;
+								for (int xp = 0; xp < width2; ++xp) {
+									if (byteVal2 <= 0) {
+										byteVal = *srcP++;
+										if (byteVal & 0x80) {
+											byteVal &= 0x7f;
+											byteVal2 = *srcP++;
+											if (!byteVal2)
+												byteVal2 = width2;
+										}
+									}
+
+									if (yp >= var24 && xp >= var22 && xp < var26) {
+										if (byteVal > 0)
+											*destP = byteVal;
+										++destP;
+									}
 								}
 
-								destP += widthDiff2;
-								srcP += widthDiff; 
+								if (yp >= var24)
+									destP += widthDiff2;
 							}
 						} else {
-							// Copy from screen surface without transparency
+							// loc_262BE
+							byteVal = 0;
 							for (int yp = 0; yp < height1; ++yp) {
-								for (int xp = 0; xp < width2; ++xp, ++destP) {
-									byte srcPixel = *srcP++;
-									*destP = srcPixel;
+								for (int xp = 0; xp < width2; ++xp) {
+									byteVal2 = 0;
+									if (!byteVal2) {
+										byteVal = *++srcP;
+										if (byteVal & 0x80) {
+											byteVal &= 0x7f;
+											byteVal2 = *srcP++;
+
+											if (!byteVal2)
+												byteVal2 = width2;
+										}
+									}
+
+									if (byteVal > 0)
+										*destP = byteVal;
+
+									++destP;
+									--byteVal2;
 								}
 
 								destP += widthDiff2;
-								srcP += widthDiff; 
 							}
 						}
+					} else {
+						// loc_2637F
+						// Copy with transparency
+						for (int yp = 0; yp < height1; ++yp) {
+							for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
+								if (*srcP != 0)
+									*destP = *srcP;
+							}
+
+							destP += widthDiff2;
+							srcP += widthDiff;
+						}
 					}
 				} else {
 					if (srcFlags & 0x100) {


Commit: 8f3d5d53200bc9a2b9f54ee94939766d34d8e3b6
    https://github.com/scummvm/scummvm/commit/8f3d5d53200bc9a2b9f54ee94939766d34d8e3b6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-16T18:20:42-07:00

Commit Message:
VOYEUR: Fixed initialisation of viewport parent pointer

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 47f70d3..9a22efe 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -72,8 +72,10 @@ void EventsManager::vStopCycle() {
 }
 
 void EventsManager::sWaitFlip() {
-	// TODO: See if this needs a proper wait loop with event polling
-	//while (_intPtr.field39) ;
+	while (_gameData._flipWait && !_vm->shouldQuit()) {
+		pollEvents();
+		g_system->delayMillis(10);
+	}
 
 	Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries;
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
@@ -88,6 +90,7 @@ void EventsManager::sWaitFlip() {
 
 			_vm->_graphicsManager._clipPtr = clipPtr;
 			viewPort._rectListCount[viewPort._pageIndex] = 0;
+			viewPort._rectListPtr[viewPort._pageIndex]->clear();
 			viewPort._flags &= 0xFFBF;
 		}
 	}
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 69cfcc2..335255d 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -457,8 +457,14 @@ void BoltFile::vInitCycl() {
 
 void BoltFile::initViewPort() {
 	initDefault();
-	_state._curMemberPtr->_viewPortResource = new ViewPortResource(
-		_state, _state._curMemberPtr->_data);
+
+	ViewPortResource *viewPort;
+	byte *src = _state._curMemberPtr->_data;
+	_state._curMemberPtr->_viewPortResource = viewPort = new ViewPortResource(_state, src);
+
+	// This is done post-constructor, since viewports can be self referential, so
+	// we ned the _viewPortResource field to have been set before resolving the pointer
+	viewPort->_parent = getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
 }
 
 void BoltFile::initViewPortList() {
@@ -693,7 +699,7 @@ PictureResource::~PictureResource() {
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 		_fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), _state(state) {
 	_flags = READ_LE_UINT16(src);
-	_next = state._curLibPtr->getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
+	_parent = NULL;
 	_pageCount = READ_LE_UINT16(src + 6);
 	_pageIndex = READ_LE_UINT16(src + 8);
 	_lastPage = READ_LE_UINT16(src + 10);
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 659f29b..4d8b86f 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -234,7 +234,7 @@ private:
 	void setupViewPort(PictureResource *page, Common::Rect *clipRect, ViewPortSetupPtr setupFn,
 		ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
 public:
-	ViewPortResource *_next;
+	ViewPortResource *_parent;
 	int _pageCount;
 	int _pageIndex;
 	int _lastPage;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 99abc11..9eacda8 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -549,15 +549,8 @@ void GraphicsManager::setColor(int idx, int r, int g, int b) {
 void GraphicsManager::screenReset() {
 	resetPalette();
 	(*_vPort)->setupViewPort();
-	fillPic(*_vPort, 0);
-	
-	// Flag the following viewport
-	uint i = 0;
-	while (i < _viewPortListPtr->_entries.size() && _viewPortListPtr->_entries[i] != *_vPort)
-		++i;
-	assert(i < (_viewPortListPtr->_entries.size() - 1));
-
-	_viewPortListPtr->_entries[i + 1]->_flags |= 8;
+	fillPic(*_vPort, 0);	
+	(*_vPort)->_parent->_flags |= 8;
 
 	// Flip
 	flipPage();


Commit: eea9f9d2bb970f73117c9293835f0eed786c87da
    https://github.com/scummvm/scummvm/commit/eea9f9d2bb970f73117c9293835f0eed786c87da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-16T18:50:31-07:00

Commit Message:
VOYEUR: Implemented setCursorTo method

Changed paths:
    engines/voyeur/events.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 9a22efe..bc69ea4 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -335,7 +335,22 @@ void EventsManager::vInitColor() {
 }
 
 void EventsManager::setCursorTo(int idx, int mode) {
-	// TODO
+	switch (idx) {
+	case 0:
+		_vm->_graphicsManager.setColor(idx, 90, 90, 232);
+		break;
+	case 1:
+		_vm->_graphicsManager.setColor(idx, 232, 90, 90);
+		break;
+	case 2:
+		_vm->_graphicsManager.setColor(idx, 90, 232, 90);
+		break;
+	case 3:
+		_vm->_graphicsManager.setColor(idx, 90, 232, 232);
+		break;
+	default:
+		break;
+	}
 }
 
 } // End of namespace Voyeur


Commit: 90d916d26ab39a80ad211811e9cd0a32d12dbaac
    https://github.com/scummvm/scummvm/commit/90d916d26ab39a80ad211811e9cd0a32d12dbaac
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-17T19:28:30-07:00

Commit Message:
VOYEUR: Added missing entry for Voyeur in engines.mk

Changed paths:
    engines/engines.mk



diff --git a/engines/engines.mk b/engines/engines.mk
index b905a28..595b0ae 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -241,3 +241,8 @@ ifdef ENABLE_WINTERMUTE
 DEFINES += -DENABLE_WINTERMUTE=$(ENABLE_WINTERMUTE)
 MODULES += engines/wintermute
 endif
+
+ifdef ENABLE_VOYEUR
+DEFINES += -DENABLE_VOYEUR=$(ENABLE_VOYEUR)
+MODULES += engines/voyeur
+endif


Commit: ef902493c4ba9f63a184ba25dbd8f608deabfcd5
    https://github.com/scummvm/scummvm/commit/ef902493c4ba9f63a184ba25dbd8f608deabfcd5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-17T19:41:58-07:00

Commit Message:
VOYEUR: Some cleanup and enum-ifying graphic drawing code

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index bc69ea4..7f8f55f 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -81,7 +81,7 @@ void EventsManager::sWaitFlip() {
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
 		ViewPortResource &viewPort = *viewPorts[idx];
 
-		if (_vm->_graphicsManager._saveBack && (viewPort._flags & 0x40)) {
+		if (_vm->_graphicsManager._saveBack && (viewPort._flags & DISPFLAG_40)) {
 			Common::Rect *clipPtr = _vm->_graphicsManager._clipPtr;
 			_vm->_graphicsManager._clipPtr = &viewPort._clipRect;
 
@@ -91,7 +91,7 @@ void EventsManager::sWaitFlip() {
 			_vm->_graphicsManager._clipPtr = clipPtr;
 			viewPort._rectListCount[viewPort._pageIndex] = 0;
 			viewPort._rectListPtr[viewPort._pageIndex]->clear();
-			viewPort._flags &= 0xFFBF;
+			viewPort._flags &= ~DISPFLAG_40;
 		}
 	}
 }
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 335255d..035162b 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -691,7 +691,7 @@ PictureResource::PictureResource(int flags, int select, int pick, int onOff,
 }
 
 PictureResource::~PictureResource() {
-	delete _imgData;
+	delete[] _imgData;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4d8b86f..77b53cc 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -201,6 +201,12 @@ public:
 	byte *fload(const Common::String &filename, int *size = NULL);
 };
 
+enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 = 8, 
+	DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
+	DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400, 
+	DISPFLAG_800 = 0x800, DISPFLAG_1000 = 0x1000, DISPFLAG_2000 = 0x2000,
+	DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000 };
+
 class DisplayResource {
 public:
 	uint16 _flags;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 9eacda8..b4443a2 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -148,11 +148,11 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	PictureResource *srcPic = (PictureResource *)srcDisplay;
 	PictureResource *destPic = (PictureResource *)destDisplay;
 
-	if (srcDisplay->_flags & 0x8000) {
+	if (srcDisplay->_flags & DISPFLAG_VIEWPORT) {
 		// A viewport was passed, not a picture
 		srcPic = ((ViewPortResource *)srcDisplay)->_currentPic;
 	}
-	if (destDisplay->_flags & 0x8000) {
+	if (destDisplay->_flags & DISPFLAG_VIEWPORT) {
 		destViewPort = (ViewPortResource *)destDisplay;
 		destPic = destViewPort->_currentPic;
 	}
@@ -465,7 +465,7 @@ void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
  * Queues the given picture for display
  */
 void GraphicsManager::sDisplayPic(PictureResource *pic) {
-	if (pic->_flags & 8) {
+	if (pic->_flags & DISPFLAG_8) {
 		_vm->_eventsManager._intPtr.field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
 	}
 
@@ -481,8 +481,9 @@ void GraphicsManager::flipPage() {
 	bool flipFlag = false;
 
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
-		if (viewPorts[idx]->_flags & 0x20) {
-			if ((viewPorts[idx]->_flags & 9) == 9) {
+		if (viewPorts[idx]->_flags & DISPFLAG_20) {
+			if ((viewPorts[idx]->_flags & (DISPFLAG_8 || DISPFLAG_1)) 
+					== (DISPFLAG_8 || DISPFLAG_1)) {
 				if (_planeSelect == idx)
 					sDisplayPic(viewPorts[idx]->_currentPic);
 				flipFlag = true;
@@ -500,7 +501,7 @@ void GraphicsManager::flipPage() {
 
 			assert(viewPort._pageIndex < 2);
 			viewPort._currentPic = viewPort._pages[viewPort._pageIndex];
-			viewPort._flags = (viewPort._flags & 0xFFF7) | 0x40;
+			viewPort._flags = (viewPort._flags & ~DISPFLAG_8) | DISPFLAG_40;
 		}
 	}
 }
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 3dec56f..a8a072e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -164,7 +164,7 @@ void VoyeurEngine::doHeadTitle() {
 void VoyeurEngine::showConversionScreen() {
 	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x502)._picResource;
 	(*_graphicsManager._vPort)->setupViewPort();
-	(*_graphicsManager._vPort)->_flags |= 8;
+	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 
 	_graphicsManager.flipPage();
 	_eventsManager.sWaitFlip();
@@ -187,7 +187,7 @@ void VoyeurEngine::showConversionScreen() {
 	if (shouldQuit())
 		return;
 
-	(*_graphicsManager._vPort)->_flags |= 8;
+	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 	_graphicsManager.flipPage();
 	_eventsManager.sWaitFlip();
 
@@ -231,7 +231,7 @@ bool VoyeurEngine::doLock() {
 		(*_graphicsManager._vPort)->setupViewPort();
 
 		_graphicsManager._backColors->startFade();
-		(*_graphicsManager._vPort)->_flags |= 8;
+		(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
@@ -257,7 +257,7 @@ bool VoyeurEngine::doLock() {
 		bool breakFlag = false;
 		while (!breakFlag && !shouldQuit()) {
 			(*_graphicsManager._vPort)->setupViewPort();
-			(*_graphicsManager._vPort)->_flags |= 8;
+			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 			_graphicsManager.flipPage();
 			_eventsManager.sWaitFlip();
 
@@ -268,7 +268,7 @@ bool VoyeurEngine::doLock() {
 			_graphicsManager._fontPtr->_justifyHeight = 97;
 
 			(*_graphicsManager._vPort)->drawText(playString);
-			(*_graphicsManager._vPort)->_flags |= 8;
+			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 			_graphicsManager.flipPage();
 			_eventsManager.sWaitFlip();
 
@@ -296,7 +296,7 @@ bool VoyeurEngine::doLock() {
 
 					// TODO: Check is the mouse cursor being manually drawn here? I so, refactor
 					_graphicsManager.sDrawPic(srcPic, *_graphicsManager._vPort, mousePos);
-					(*_graphicsManager._vPort)->_flags |= 8;
+					(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 					_graphicsManager.flipPage();
 					_eventsManager.sWaitFlip();
 
@@ -354,7 +354,7 @@ bool VoyeurEngine::doLock() {
 		}
 
 		_graphicsManager.fillPic(*_graphicsManager._vPort);
-		(*_graphicsManager._vPort)->_flags |= 8;
+		(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
 		_graphicsManager.resetPalette();


Commit: 1a2f6fe6f36a30d9dc6e6c4dcf48b448983a31b3
    https://github.com/scummvm/scummvm/commit/1a2f6fe6f36a30d9dc6e6c4dcf48b448983a31b3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-17T19:45:59-07:00

Commit Message:
VOYEUR: Fix memory overrun in fading code

Changed paths:
    engines/voyeur/events.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 7f8f55f..22b70b4 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -252,7 +252,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 		int mapIndex = 0;
 
 		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
-			Common::copy(&cMap->_entries[mapIndex], &cMap->_entries[mapIndex + 3], vgaP);
+			Common::copy(&cMap->_entries[mapIndex], &cMap->_entries[mapIndex + 2], vgaP);
 
 			if (!(cMap->_fadeStatus & 1))
 				mapIndex += 3;


Commit: b135ce3d28c0558433807fab73bd06514a1ec62f
    https://github.com/scummvm/scummvm/commit/b135ce3d28c0558433807fab73bd06514a1ec62f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-17T19:59:26-07:00

Commit Message:
VOYEUR: Further fading memory access bugfixes

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 22b70b4..7f8f55f 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -252,7 +252,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 		int mapIndex = 0;
 
 		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
-			Common::copy(&cMap->_entries[mapIndex], &cMap->_entries[mapIndex + 2], vgaP);
+			Common::copy(&cMap->_entries[mapIndex], &cMap->_entries[mapIndex + 3], vgaP);
 
 			if (!(cMap->_fadeStatus & 1))
 				mapIndex += 3;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 035162b..992fb5a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1179,7 +1179,7 @@ CMapResource::CMapResource(BoltFilesState &state, const byte *src): _vm(state._v
 	_start = READ_LE_UINT16(src + 2);
 	_end = READ_LE_UINT16(src + 4);
 	
-	int count = _end - _start;
+	int count = _end - _start + 1;
 	_entries = new byte[count * 3];
 	Common::copy(src + 6, src + 6 + 3 * count, _entries);
 


Commit: 65a6308a5a2dce2410ab8509e89a1c0e09d22558
    https://github.com/scummvm/scummvm/commit/65a6308a5a2dce2410ab8509e89a1c0e09d22558
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-17T20:06:00-07:00

Commit Message:
VOYEUR: Fix crash on shutdown

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 992fb5a..9e97dea 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1000,6 +1000,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 
 			gfxManager.sDrawPic(&_fontChar, this, Common::Point(xp, yp));
 			
+			_fontChar._imgData = NULL;
 			xp += charWidth + padding;
 			msgWidth += charWidth + padding;
 		}


Commit: c0e6fcba732e58c8aef16362971ae2a91d749e3c
    https://github.com/scummvm/scummvm/commit/c0e6fcba732e58c8aef16362971ae2a91d749e3c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-18T20:14:46-07:00

Commit Message:
VOYEUR: Implemented sDrawPic modes for screen clearing

Changed paths:
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index b4443a2..c2f6768 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -226,7 +226,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	widthDiff2 = destPic->_bounds.width() - width2;
 
 	if (destViewPort) {
-		if (!_saveBack || ((srcPic->_flags & 0x800) != 0)) {
+		if (!_saveBack || ((srcPic->_flags & DISPFLAG_800) != 0)) {
 			backBounds.left = destPic->_bounds.left + offset.x;
 			backBounds.top = destPic->_bounds.top + offset.y;
 			backBounds.setWidth(width2);
@@ -253,7 +253,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		}
 	}
 
-	if (srcFlags & 0x1000) {
+	if (srcFlags & DISPFLAG_1000) {
 		srcImgData = srcPic->_imgData + (var4C << 14) + _screenOffset;
 		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
 			if (var4C < 4) {
@@ -264,7 +264,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	} else {
 		srcImgData = srcPic->_imgData;
 	}
-	if (destFlags & 0x1000) {
+	if (destFlags & DISPFLAG_1000) {
 		destImgData = destPic->_imgData + (var4C << 14) + _screenOffset;
 		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
 			if (var4C < 4) {
@@ -422,18 +422,32 @@ error("TODO: var22/var24/var2C not initialised before use?");
 		// loc_26666
 		if (srcPic->_pick == 0) {
 			// loc_2727A
-			int onOff = srcPic->_onOff;
-			int onOff2 = onOff | (onOff << 8);
-
-			if (srcFlags & 2) {
-				if (srcFlags & 8) {
+			byte onOff = srcPic->_onOff;
 
+			if (srcFlags & DISPFLAG_2) {
+				if (srcFlags & DISPFLAG_8) {
+					error("sDrawPic: TODO");
 				} else {
-
+					error("sDrawPic: TODO");
 				}
 			} else {
-				// TODO
+				// loc_27477
+				if (destFlags & DISPFLAG_8) {
+					// loc_27481
+					destP = (byte *)_screenSurface.pixels + screenOffset;
+					for (int yp = 0; yp < height1; ++yp) {
+						Common::fill(srcP, srcP + width2, onOff);
+						destP += width2 + widthDiff2;
+					}
+				} else {
+					// loc_2753C
+					destP = destImgData + screenOffset;
 
+					for (int yp = 0; yp < height1; ++yp) {
+						Common::fill(destP, destP + width2, onOff);
+						destP += width2 + widthDiff2;
+					}
+				}
 			}
 
 		} else {
@@ -551,7 +565,7 @@ void GraphicsManager::screenReset() {
 	resetPalette();
 	(*_vPort)->setupViewPort();
 	fillPic(*_vPort, 0);	
-	(*_vPort)->_parent->_flags |= 8;
+	(*_vPort)->_parent->_flags |= DISPFLAG_8;
 
 	// Flip
 	flipPage();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index a8a072e..664e40e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -252,7 +252,8 @@ bool VoyeurEngine::doLock() {
 		_graphicsManager._fontPtr->_fontFlags = 0;
 
 		Common::String dateString = lock.getDateString();
-		Common::String playString = Common::String::format("Last Play %s", msg.c_str());
+		msg = "16:49 8/12";
+ 		Common::String playString = Common::String::format("Last Play %s", msg.c_str());
 
 		bool breakFlag = false;
 		while (!breakFlag && !shouldQuit()) {


Commit: 3e62f279d55b5ceb11c72887800fc5ed07e4e31b
    https://github.com/scummvm/scummvm/commit/3e62f279d55b5ceb11c72887800fc5ed07e4e31b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-18T21:16:51-07:00

Commit Message:
VOYEUR: Fix loading and use of font resource top padding

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9e97dea..09fbc17 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -844,7 +844,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 	int yShadows[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
 
 	Common::Rect *clipPtr = gfxManager._clipPtr;
-	if (!(fontInfo._picFlags & 1))
+	if (!(fontInfo._picFlags & DISPFLAG_1))
 		gfxManager._clipPtr = NULL;
 
 	int minChar = fontData._minChar;
@@ -854,14 +854,14 @@ int ViewPortResource::drawText(const Common::String &msg) {
 	int msgWidth = 0;
 	int xp = 0, yp = 0;
 
-	Common::Point pos = fontInfo._pos;
+	Common::Point pos = Common::Point(fontInfo._pos.x, fontInfo._pos.y + fontData._topPadding);
 
-	_fontChar._flags = fontInfo._picFlags | 2;
+	_fontChar._flags = fontInfo._picFlags | DISPFLAG_2;
 	_fontChar._select = fontInfo._picSelect;
 	_fontChar._bounds.setHeight(fontHeight);
 
-	if (gfxManager._drawTextPermFlag || (fontInfo._fontFlags & 1) || fontInfo._justify ||
-			(gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & 0x8000))) {
+	if (gfxManager._drawTextPermFlag || (fontInfo._fontFlags & DISPFLAG_1) || fontInfo._justify ||
+			(gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT))) {
 		msgWidth = textWidth(msg);
 		yp = pos.y;
 		xp = pos.x;
@@ -929,7 +929,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 		addSaveRect(_pageIndex, _fontRect);
 	}
 
-	if (fontInfo._fontFlags & 1) {
+	if (fontInfo._fontFlags & DISPFLAG_1) {
 		gfxManager._drawPtr->_pos = Common::Point(_fontRect.left, _fontRect.top);
 		gfxManager._drawPtr->_penColor = fontInfo._backColor;
 		sFillBox(_fontRect.width());
@@ -939,9 +939,9 @@ int ViewPortResource::drawText(const Common::String &msg) {
 	gfxManager._saveBack = false;
 
 	int count = 0;
-	if (fontInfo._fontFlags & 4)
+	if (fontInfo._fontFlags & DISPFLAG_4)
 		count = 1;
-	else if (fontInfo._fontFlags & 8)
+	else if (fontInfo._fontFlags & DISPFLAG_8)
 		count = 8;
 
 	for (int i = count; i >= 0; --i) {
@@ -1097,7 +1097,7 @@ FontResource::FontResource(BoltFilesState &state, byte *src) {
 	field2 = src[2];
 	_padding = src[3];
 	_fontHeight = src[5];
-	field6 = src[6];
+	_topPadding = (int8)src[6];
 
 	int totalChars = _maxChar - _minChar + 1;
 	_charWidth = new int[totalChars];
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 77b53cc..a006863 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -301,7 +301,7 @@ public:
 	int field2;
 	int _padding;
 	int _fontHeight;
-	int field6;
+	int _topPadding;
 	int *_charWidth;
 	byte *_data1;
 	byte *_data2;


Commit: 4c70e6afceeb262e2500a3d0920a762fedbf4e2f
    https://github.com/scummvm/scummvm/commit/4c70e6afceeb262e2500a3d0920a762fedbf4e2f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-19T20:02:40-07:00

Commit Message:
VOYEUR: On-screen text finally showing up

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 09fbc17..f0a7468 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -925,7 +925,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 		}
 	} 
 
-	if (gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & 0x8000)) {
+	if (gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT)) {
 		addSaveRect(_pageIndex, _fontRect);
 	}
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index c2f6768..3220977 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -123,7 +123,7 @@ void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, con
 }
 
 void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
-		const Common::Point &offset) {
+		const Common::Point &initialOffset) {
 	int var4C = 0;
 	int width1, width2;
 	int widthDiff, widthDiff2;
@@ -157,8 +157,8 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		destPic = destViewPort->_currentPic;
 	}
 
-	Common::Point ofs = Common::Point(offset.x + srcPic->_bounds.left - destPic->_bounds.left, 
-		offset.y + srcPic->_bounds.top - destPic->_bounds.top);
+	Common::Point offset = Common::Point(initialOffset.x + srcPic->_bounds.left - destPic->_bounds.left, 
+		initialOffset.y + srcPic->_bounds.top - destPic->_bounds.top);
 	width1 = width2 = srcPic->_bounds.width();
 	height1 = srcPic->_bounds.height();
 	srcOffset = 0;
@@ -179,12 +179,12 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			newBounds = Common::Rect(0, 0, destPic->_bounds.width(), destPic->_bounds.height());
 		}
 
-		var24 = ofs.y - newBounds.top;
+		var24 = offset.y - newBounds.top;
 		if (var24 < 0) {
 			var52 = width2;
 			srcOffset -= var24 * var52;
 			height1 += var24;
-			ofs.y = newBounds.top;
+			offset.y = newBounds.top;
 			
 			if (height1 <= 0)
 				return;
@@ -192,18 +192,18 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			isClipped = true;
 		}
 
-		var20 = newBounds.bottom - (ofs.y + height1);
+		var20 = newBounds.bottom - (offset.y + height1);
 		if (var20 < 0) {
 			height1 += var20;
 			if (height1 <= 0)
 				return;
 		}
 
-		var22 = ofs.x - newBounds.left;
+		var22 = offset.x - newBounds.left;
 		if (var22 < 0) {
 			srcOffset -= var22;
 			width2 += var22;
-			ofs.x = newBounds.left;
+			offset.x = newBounds.left;
 
 			if (width2 <= 0)
 				return;
@@ -211,7 +211,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			isClipped = true;
 		}
 
-		var26 = newBounds.right - (ofs.x + width2);
+		var26 = newBounds.right - (offset.x + width2);
 		if (var26 < 0) {
 			width2 += var26;
 			if (width2 <= 0)
@@ -221,7 +221,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		}
 	}
 
-	screenOffset = ofs.y * destPic->_bounds.width() + ofs.x;
+	screenOffset = offset.y * destPic->_bounds.width() + offset.x;
 	widthDiff = width1 - width2;
 	widthDiff2 = destPic->_bounds.width() - width2;
 
@@ -245,8 +245,8 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 				++destViewPort->_rectListCount[destViewPort->_pageIndex];
 			}
 		} else {
-			int xs = ofs.x + destPic->_bounds.left;
-			int ys = ofs.y + destPic->_bounds.top;
+			int xs = offset.x + destPic->_bounds.left;
+			int ys = offset.y + destPic->_bounds.top;
 			backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
 
 			(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, backBounds);
@@ -281,21 +281,21 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 		return;
 
 	if (srcPic->_pick == 0xff) {
-		if (srcFlags & 8) {
+		if (srcFlags & DISPFLAG_8) {
 			error("TODO: sDrawPic");
 		} else {
 			// loc_258B8
 			srcP = srcImgData + srcOffset;
 
-			if (destFlags & 8) {
+			if (destFlags & DISPFLAG_8) {
 				// loc_258D8
 				destP = destImgData + screenOffset;
 
-				if (srcFlags & 2) {
+				if (srcFlags & DISPFLAG_2) {
 					// loc_258F5f
 				} else {
 					// loc_25D40
-					if (srcFlags & 0x100) {
+					if (srcFlags & DISPFLAG_100) {
 						// loc_25D4A
 					} else {
 						// loc_2606D
@@ -312,9 +312,9 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 				// loc_2615E
 				destP = destImgData + screenOffset;
 
-				if (srcFlags & 2) {
+				if (srcFlags & DISPFLAG_2) {
 					// loc_2617e
-					if (srcFlags & 0x100) {
+					if (srcFlags & DISPFLAG_100) {
 						// loc_26188
 						srcP = srcImgData;
 						if (isClipped) {
@@ -459,7 +459,7 @@ error("TODO: var22/var24/var2C not initialised before use?");
 
 void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
 	PictureResource *pic;
-	if (display->_flags & 0x8000) {
+	if (display->_flags & DISPFLAG_VIEWPORT) {
 		pic = ((ViewPortResource *)display)->_currentPic;
 	} else {
 		pic = (PictureResource *)display;
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 02e9698..6e6fdb1 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -102,7 +102,7 @@ public:
 	void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
 
 	void EMSMapPageHandle(int v1, int v2, int v3);
-	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
+	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &initialOffset);
 	void fillPic(DisplayResource *display, byte onOff = 0);
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();


Commit: 412ac6a00df783802301463135659cbf5b5237ef
    https://github.com/scummvm/scummvm/commit/412ac6a00df783802301463135659cbf5b5237ef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-20T05:38:38-07:00

Commit Message:
VOYEUR: Minor cleanup of doLock cursor code

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 664e40e..276fd32 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -205,7 +205,7 @@ bool VoyeurEngine::doLock() {
 	byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
 	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
 	LockClass lock;
-	PictureResource *srcPic;
+	PictureResource *cursorPic;
 	byte *keyData;
 	int keyCount;
 	Common::String msg;
@@ -219,8 +219,8 @@ bool VoyeurEngine::doLock() {
 		_voy._eventTable[999]._data = _bVoy->memberAddr(0x704);
 
 		Common::String password = lock._password;
-		srcPic = _bVoy->getPictureResource(0x702);
-		assert(srcPic);
+		cursorPic = _bVoy->getPictureResource(0x702);
+		assert(cursorPic);
 
 		// Get the mappings of keys on the keypad
 		keyData = _bVoy->memberAddr(0x705);
@@ -295,8 +295,8 @@ bool VoyeurEngine::doLock() {
 					_eventsManager._intPtr.field38 = 1;
 					_eventsManager._intPtr._hasPalette = true;
 
-					// TODO: Check is the mouse cursor being manually drawn here? I so, refactor
-					_graphicsManager.sDrawPic(srcPic, *_graphicsManager._vPort, mousePos);
+					// TODO:Refactor the mouse cursor to use ScummVM cursor code
+					_graphicsManager.sDrawPic(cursorPic, *_graphicsManager._vPort, mousePos);
 					(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 					_graphicsManager.flipPage();
 					_eventsManager.sWaitFlip();


Commit: ff270eb61e49a10401b6643b7c5b430268597789
    https://github.com/scummvm/scummvm/commit/ff270eb61e49a10401b6643b7c5b430268597789
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-20T18:24:30-07:00

Commit Message:
VOYEUR: Fix setting cursor colour in lock screen

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 7f8f55f..ce481e0 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -335,7 +335,7 @@ void EventsManager::vInitColor() {
 }
 
 void EventsManager::setCursorTo(int idx, int mode) {
-	switch (idx) {
+	switch (mode) {
 	case 0:
 		_vm->_graphicsManager.setColor(idx, 90, 90, 232);
 		break;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 3220977..dd64aae 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -551,11 +551,11 @@ void GraphicsManager::resetPalette() {
 	_vm->_eventsManager._intPtr._hasPalette = true;
 }
 
-void GraphicsManager::setColor(int idx, int r, int g, int b) {
+void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
 	byte *vgaP = &_VGAColors[idx * 3];
-	vgaP[0] = r >> 2;
-	vgaP[1] = g >> 2;
-	vgaP[2] = b >> 2;
+	vgaP[0] = r;
+	vgaP[1] = g;
+	vgaP[2] = b;
 
 	_vm->_eventsManager._intPtr._palStartIndex = MIN(_vm->_eventsManager._intPtr._palStartIndex, idx);
 	_vm->_eventsManager._intPtr._palEndIndex = MAX(_vm->_eventsManager._intPtr._palEndIndex, idx);
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 6e6fdb1..f6ad837 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -108,7 +108,7 @@ public:
 	void flipPage();
 	void clearPalette();
 	void resetPalette();
-	void setColor(int idx, int r, int g, int b);
+	void setColor(int idx, byte r, byte g, byte b);
 	void screenReset();
 };
 


Commit: 1c34c1847e456c68b9633bb045d833b2b0e6e501
    https://github.com/scummvm/scummvm/commit/1c34c1847e456c68b9633bb045d833b2b0e6e501
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-20T18:42:48-07:00

Commit Message:
VOYEUR: Lock screen mouse clicks now working

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index ce481e0..e96ff12 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -194,12 +194,14 @@ void EventsManager::pollEvents() {
 			return;
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButton = 1;
+			_vm->_voy._incriminate = true;
 			return;
 		case Common::EVENT_RBUTTONDOWN:
 			_mouseButton = 2;
 			return;
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONUP:
+			_vm->_voy._incriminate = false;
 			_mouseButton = 0;
 			return;
 		case Common::EVENT_MOUSEMOVE:
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 276fd32..5afc461 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -303,6 +303,7 @@ bool VoyeurEngine::doLock() {
 
 					_eventsManager.delay(1);
 				} while (!shouldQuit() && !_voy._incriminate);
+				_voy._incriminate = false;
 			} while (!shouldQuit() && key == -1);
 
 			_soundManager.abortVOCMap();
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 7a156b8..95a664e 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,7 +66,6 @@ private:
 	Common::RandomSource _randomSource;
 
 	BoltFile *_bVoy;
-	SVoy _voy;
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
 
@@ -90,6 +89,7 @@ public:
 	FilesManager _filesManager;
 	GraphicsManager _graphicsManager;
 	SoundManager _soundManager;
+	SVoy _voy;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();


Commit: 975cc8075d89f91309c35adf778bb286ccc7d84e
    https://github.com/scummvm/scummvm/commit/975cc8075d89f91309c35adf778bb286ccc7d84e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-20T19:08:01-07:00

Commit Message:
VOYEUR: Fixed colours of lock screen text display

Changed paths:
    engines/voyeur/utils.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/utils.cpp b/engines/voyeur/utils.cpp
index a5745e6..5c86138 100644
--- a/engines/voyeur/utils.cpp
+++ b/engines/voyeur/utils.cpp
@@ -49,7 +49,7 @@ void LockClass::saveThePassword() {
 }
 
 Common::String LockClass::getDateString() {
-	return Common::String();
+	return Common::String("ScummVM");
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 5afc461..c969acd 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -208,7 +208,6 @@ bool VoyeurEngine::doLock() {
 	PictureResource *cursorPic;
 	byte *keyData;
 	int keyCount;
-	Common::String msg;
 	int key;
 
 	if (_bVoy->getBoltGroup(0x10700)) {
@@ -239,10 +238,10 @@ bool VoyeurEngine::doLock() {
 			_eventsManager.delay(1);
 
 		_eventsManager.setCursorTo(127, 0);
-		_graphicsManager.setColor(1, 0x40, 0x40, 0x40);
-		_graphicsManager.setColor(2, 0x60, 0x60, 0x60);
-		_graphicsManager.setColor(3, 0x0A, 0xA0, 0x0A);
-		_graphicsManager.setColor(4, 0x0E, 0xE0, 0x0E);
+		_graphicsManager.setColor(1, 64, 64, 64);
+		_graphicsManager.setColor(2, 96, 96, 96);
+		_graphicsManager.setColor(3, 160, 160, 160);
+		_graphicsManager.setColor(4, 224, 224, 224);
 		
 		_eventsManager._intPtr. field38 = 1;
 		_eventsManager._intPtr._hasPalette = true;
@@ -252,9 +251,9 @@ bool VoyeurEngine::doLock() {
 		_graphicsManager._fontPtr->_fontFlags = 0;
 
 		Common::String dateString = lock.getDateString();
-		msg = "16:49 8/12";
- 		Common::String playString = Common::String::format("Last Play %s", msg.c_str());
+ 		Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
 
+		bool firstLoop = true;
 		bool breakFlag = false;
 		while (!breakFlag && !shouldQuit()) {
 			(*_graphicsManager._vPort)->setupViewPort();
@@ -268,11 +267,16 @@ bool VoyeurEngine::doLock() {
 			_graphicsManager._fontPtr->_justifyWidth = 384;
 			_graphicsManager._fontPtr->_justifyHeight = 97;
 
-			(*_graphicsManager._vPort)->drawText(playString);
+			(*_graphicsManager._vPort)->drawText(displayString);
 			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 			_graphicsManager.flipPage();
 			_eventsManager.sWaitFlip();
 
+			if (firstLoop) {
+				firstLoop = false;
+				displayString = "";
+			}
+
 			// Loop for getting key presses
 			do {
 				do {
@@ -319,32 +323,36 @@ bool VoyeurEngine::doLock() {
 
 			// Process the key
 			if (key < 10) {
-				if (playString.size() < 10) {
-					playString += '0' + key;
+				// Numeric key
+				if (displayString.size() < 10) {
+					displayString += '0' + key;
 					continue;
 				}
 			} else if (key == 10) {
+				// Accept key
 				if (!flag) {
-					if ((password.size() == 0 && !playString.size()) || (password == playString)) {
+					if ((password.empty() && displayString.empty()) || (password == displayString)) {
 						breakFlag = true;
 						result = true;
 						break;
 					}
 				} else {
-					if (playString.size() > 0) {
-						result = 1;
+					if (displayString.size() > 0) {
+						result = true;
 						breakFlag = true;
 						break;
 					} 
 				}
 			} else if (key == 11) {
-				if ((password.size() == 0 && !playString.size()) || (password != playString)) {
+				// New code
+				if ((password.empty() && displayString.empty()) || (password != displayString)) {
 					(*_graphicsManager._vPort)->setupViewPort();
 					flag = true;
-					playString = "";
+					displayString = "";
 					continue;
 				}
 			} else if (key == 12) {
+				// Exit keyword
 				breakFlag = true;
 				result = false;
 				break;
@@ -362,7 +370,7 @@ bool VoyeurEngine::doLock() {
 		_graphicsManager.resetPalette();
 
 		if (flag && result)
-			lock._password = msg;
+			lock._password = displayString;
 		lock.saveThePassword();
 
 		_voy._eventTable[999]._data = NULL;


Commit: 8c2b956120c9f11e6aa89753aa5dcdee8d2f1d7a
    https://github.com/scummvm/scummvm/commit/8c2b956120c9f11e6aa89753aa5dcdee8d2f1d7a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-20T21:18:19-07:00

Commit Message:
VOYEUR: Converted cursor drawing to use CursorMan

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index e96ff12..6bd0012 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/events.h"
 #include "voyeur/voyeur.h"
+#include "graphics/cursorman.h"
 #include "graphics/palette.h"
 
 namespace Voyeur {
@@ -336,7 +337,19 @@ void EventsManager::vInitColor() {
 	addIntNode(&_cycleIntNode);
 }
 
-void EventsManager::setCursorTo(int idx, int mode) {
+void EventsManager::setCursor(PictureResource *pic) {
+	PictureResource cursor;
+	cursor._bounds = pic->_bounds;
+	cursor._flags = DISPFLAG_CURSOR;
+
+	_vm->_graphicsManager.sDrawPic(pic, &cursor, Common::Point());
+}
+
+void EventsManager::setCursor(byte *cursorData, int width, int height) {
+	CursorMan.replaceCursor(cursorData, width, height, 0, 0, 0);
+}
+
+void EventsManager::setCursorColor(int idx, int mode) {
 	switch (mode) {
 	case 0:
 		_vm->_graphicsManager.setColor(idx, 90, 90, 232);
@@ -355,4 +368,12 @@ void EventsManager::setCursorTo(int idx, int mode) {
 	}
 }
 
+void EventsManager::mouseOn() {
+	CursorMan.showMouse(true);
+}
+
+void EventsManager::mouseOff() {
+	CursorMan.showMouse(false);
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 8689127..0b78bc2 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -25,6 +25,8 @@
 
 #include "common/scummsys.h"
 #include "common/list.h"
+#include "graphics/surface.h"
+#include "voyeur/files.h"
 #include "voyeur/game.h"
 
 namespace Voyeur {
@@ -95,7 +97,11 @@ public:
 	void addIntNode(IntNode *node);
 	void addFadeInt();
 
-	void setCursorTo(int idx, int mode);
+	void setCursor(PictureResource *pic);
+	void setCursor(byte *cursorData, int width, int height);
+	void setCursorColor(int idx, int mode);
+	void mouseOn();
+	void mouseOff();
 	Common::Point getMousePos() { return _mousePos; }
 };
 
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index f0a7468..16566d8 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -666,6 +666,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 }
 
 PictureResource::PictureResource() {
+	_flags = 0;
 	_select = 0;
 	_pick = 0;
 	_onOff = 0;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index a006863..5d825ff 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -205,11 +205,11 @@ enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 =
 	DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
 	DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400, 
 	DISPFLAG_800 = 0x800, DISPFLAG_1000 = 0x1000, DISPFLAG_2000 = 0x2000,
-	DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000 };
+	DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000 };
 
 class DisplayResource {
 public:
-	uint16 _flags;
+	uint32 _flags;
 };
 
 class PictureResource: public DisplayResource {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index dd64aae..9cf2553 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -139,6 +139,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	int var52;
 	int var20, var22;
 	int var26, var2C;
+	byte pixel;
 
 	byte *srcImgData, *destImgData;
 	byte *srcP, *destP;
@@ -164,6 +165,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	srcOffset = 0;
 	srcFlags = srcPic->_flags;
 	destFlags = destPic->_flags;
+	byte *cursorData = NULL;
 
 	if (srcFlags & 1) {
 		if (_clipPtr) {
@@ -280,6 +282,12 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	if (srcPic->_select != 0xff)
 		return;
 
+	if (destFlags & DISPFLAG_CURSOR) {
+		cursorData = new byte[width2 * height1];
+		Common::fill(cursorData, cursorData + width2 * height1, 0);
+		destImgData = cursorData;
+	}
+
 	if (srcPic->_pick == 0xff) {
 		if (srcFlags & DISPFLAG_8) {
 			error("TODO: sDrawPic");
@@ -292,7 +300,55 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 				destP = destImgData + screenOffset;
 
 				if (srcFlags & DISPFLAG_2) {
-					// loc_258F5f
+					// loc_25652
+					srcP = srcImgData + srcOffset;
+
+					if (destFlags & DISPFLAG_8) {
+						// loc_2566F
+						if (srcFlags & DISPFLAG_2) {
+							// loc_256FA
+							srcP = (byte *)_screenSurface.pixels + srcOffset;
+
+							for (int yp = 0; yp < height1; ++yp) {
+								for (int xp = 0; xp < width2; ++width2, ++srcP, ++destP) {
+									pixel = *srcP;
+									if (pixel)
+										*destP = pixel;
+								}
+
+								srcP += widthDiff;
+								destP += widthDiff2;
+							}
+						} else {
+							// loc_25706
+							for (int yp = 0; yp < height1; ++yp) {
+								Common::copy(srcP, srcP + width2, destP);
+								srcP += width2 + widthDiff;
+								destP += width2 + widthDiff2;
+							}
+						}
+					} else {
+						// loc_25773
+						destP = destImgData + screenOffset;
+
+						if (srcFlags & DISPFLAG_2) {
+							// loc_25793
+							for (int yp = 0; yp < height1; ++yp) {
+								Common::copy(srcP, srcP + width2, destP);
+								srcP += width2 + widthDiff;
+								destP += width2 + widthDiff2;
+							}
+						} else {
+							// loc_25829
+							destP = (byte *)_screenSurface.pixels + screenOffset;
+
+							for (int yp = 0; yp < height1; ++yp) {
+								Common::copy(srcP, srcP + width2, destP);
+								srcP += width2 + widthDiff;
+								destP += width2 + widthDiff2;
+							}
+						}
+					}
 				} else {
 					// loc_25D40
 					if (srcFlags & DISPFLAG_100) {
@@ -455,6 +511,11 @@ error("TODO: var22/var24/var2C not initialised before use?");
 			// TODO
 		}
 	}
+
+	if (cursorData) {
+		_vm->_eventsManager.setCursor(cursorData, width2, height1);
+		delete[] cursorData;
+	}
 }
 
 void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index c969acd..8be57e4 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -237,12 +237,16 @@ bool VoyeurEngine::doLock() {
 		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 			_eventsManager.delay(1);
 
-		_eventsManager.setCursorTo(127, 0);
+		_eventsManager.setCursorColor(127, 0);
 		_graphicsManager.setColor(1, 64, 64, 64);
 		_graphicsManager.setColor(2, 96, 96, 96);
 		_graphicsManager.setColor(3, 160, 160, 160);
 		_graphicsManager.setColor(4, 224, 224, 224);
 		
+		// Set up the cursor
+		_eventsManager.setCursor(cursorPic);
+		_eventsManager.mouseOn();
+
 		_eventsManager._intPtr. field38 = 1;
 		_eventsManager._intPtr._hasPalette = true;
 
@@ -282,7 +286,8 @@ bool VoyeurEngine::doLock() {
 				do {
 					// Scan through the list of key rects to check if a keypad key is highlighted
 					key = -1;
-					Common::Point mousePos = _eventsManager.getMousePos();
+					Common::Point mousePos = _eventsManager.getMousePos() + 
+						Common::Point(30, 20);
 
 					for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) { 
 						int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
@@ -295,16 +300,10 @@ bool VoyeurEngine::doLock() {
 						}
 					}
 
-					_eventsManager.setCursorTo(127, (key == -1) ? 0 : 1);
+					_eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
 					_eventsManager._intPtr.field38 = 1;
 					_eventsManager._intPtr._hasPalette = true;
 
-					// TODO:Refactor the mouse cursor to use ScummVM cursor code
-					_graphicsManager.sDrawPic(cursorPic, *_graphicsManager._vPort, mousePos);
-					(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-					_graphicsManager.flipPage();
-					_eventsManager.sWaitFlip();
-
 					_eventsManager.delay(1);
 				} while (!shouldQuit() && !_voy._incriminate);
 				_voy._incriminate = false;


Commit: c4a56dbdb87ef347106ae9a16426df5306d8a91f
    https://github.com/scummvm/scummvm/commit/c4a56dbdb87ef347106ae9a16426df5306d8a91f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-22T08:57:51-07:00

Commit Message:
VOYEUR: Implemented RL2 video decoder

Changed paths:
  A engines/voyeur/animation.cpp
  A engines/voyeur/animation.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
new file mode 100644
index 0000000..b2bcb2a
--- /dev/null
+++ b/engines/voyeur/animation.cpp
@@ -0,0 +1,279 @@
+/* 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 "voyeur/animation.h"
+#include "common/system.h"
+#include "graphics/surface.h"
+
+namespace Video {
+
+RL2Decoder::RL2Decoder() {
+}
+
+RL2Decoder::~RL2Decoder() {
+	close();
+}
+
+bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
+	close();
+
+	stream->seek(8);
+
+	// Check RL2 magic number
+	uint32 signature = stream->readUint32LE();
+	if (signature != 0x33564c52 /* RLV3 */ && signature != 0x32564c52 /* RLV2 */) {
+		warning("RL2Decoder::loadStream(): attempted to load non-RL2 data (type = 0x%08X)", signature);
+		return false;
+	}
+
+	addTrack(new RL2VideoTrack(stream));
+	return true;
+}
+
+const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const {
+	const Track *track = getTrack(0);
+
+	if (track)
+		return ((const RL2VideoTrack *)track)->getDirtyRects();
+
+	return 0;
+}
+
+void RL2Decoder::clearDirtyRects() {
+	Track *track = getTrack(0);
+
+	if (track)
+		((RL2VideoTrack *)track)->clearDirtyRects();
+}
+
+void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
+	Track *track = getTrack(0);
+
+	if (track)
+		((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
+}
+
+RL2Decoder::RL2VideoTrack::RL2VideoTrack(Common::SeekableReadStream *stream) {
+	_fileStream = stream;
+
+	stream->seek(4);
+	uint32 backSize = stream->readUint32LE();
+	assert(backSize == 0 || backSize == (320 * 200));
+
+	stream->seek(16);
+	_frameCount = stream->readUint16LE();
+
+	// Calculate the frame rate
+	stream->seek(22);
+	int soundRate = stream->readUint16LE();
+	int rate = stream->readUint16LE();
+	stream->skip(2);
+	int defSoundSize = stream->readUint16LE();
+
+	int fps = (soundRate > 0) ? rate / defSoundSize : 11025 / 1103;
+	_frameDelay = 1000 / fps;
+
+	_surface = new Graphics::Surface();
+	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+	if (backSize == 0) {
+		_backSurface = NULL;
+	} else {
+		_backSurface = new Graphics::Surface();
+		_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+
+		stream->seek(0x324);
+		_fileStream->read((byte *)_backSurface->pixels, 320 * 200);
+	}
+
+	stream->seek(30);
+	_videoBase = stream->readUint16LE();
+	stream->seek(36);
+	_palette = new byte[3 * 256];
+	stream->read(_palette, 256 * 3);
+	_dirtyPalette = true;
+
+	_curFrame = 0;
+	_nextFrameStartTime = 0;
+
+	// Read in the frame offsets. Since we're only worried about the video data
+	// here, we'll calculate video offsets taking into account sound data size
+	stream->seek(0x324 + backSize + 4 * _frameCount);
+
+	_frameOffset = new uint32[_frameCount];
+	for (uint i = 0; i < _frameCount; ++i)
+		_frameOffset[i] = _fileStream->readUint32LE();
+
+	// Adust frame offsets to skip sound data
+	for (uint i = 0; i < _frameCount; ++i)
+		_frameOffset[i] += _fileStream->readUint32LE() & 0xffff;
+}
+
+RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
+	delete _fileStream;
+	delete[] _palette;
+	delete[] _frameOffset;
+
+	_surface->free();
+	delete _surface;
+	if (_backSurface) {
+		_backSurface->free();
+		delete _backSurface;
+	}
+}
+
+bool RL2Decoder::RL2VideoTrack::endOfTrack() const {
+	return getCurFrame() >= getFrameCount();
+}
+
+bool RL2Decoder::RL2VideoTrack::rewind() {
+	_curFrame = 0;
+	_nextFrameStartTime = 0;
+
+	_fileStream->seek(_frameOffset[0]);
+
+	return true;
+}
+
+uint16 RL2Decoder::RL2VideoTrack::getWidth() const {
+	return _surface->w;
+}
+
+uint16 RL2Decoder::RL2VideoTrack::getHeight() const {
+	return _surface->h;
+}
+
+Graphics::PixelFormat RL2Decoder::RL2VideoTrack::getPixelFormat() const {
+	return _surface->format;
+}
+
+const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
+	if (_curFrame == 0 && _backSurface) {
+		// Read in the background frame
+		_fileStream->seek(0x324);
+		rl2DecodeFrameWithoutBackground(0);
+		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
+	}
+
+	_fileStream->seek(_frameOffset[_curFrame]);
+		
+	if (_backSurface) 
+		rl2DecodeFrameWithBackground();
+	else
+		rl2DecodeFrameWithoutBackground();
+
+	_curFrame++;
+	_nextFrameStartTime += _frameDelay;
+
+	return _surface;
+}
+
+void RL2Decoder::RL2VideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
+	for (Common::List<Common::Rect>::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
+		for (int y = (*it).top; y < (*it).bottom; ++y) {
+			const int x = (*it).left;
+			memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x);
+		}
+	}
+
+	clearDirtyRects();
+}
+
+void RL2Decoder::RL2VideoTrack::copyFrame(uint8 *data) {
+	memcpy((byte *)_surface->pixels, data, getWidth() * getHeight());
+
+	// Redraw
+	_dirtyRects.clear();
+	_dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight()));
+}
+
+void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutBackground(int screenOffset) {
+	if (screenOffset == -1)
+		screenOffset = _videoBase;
+	byte *destP = (byte *)_surface->pixels + screenOffset;
+	int frameSize = _surface->w * _surface->h - screenOffset;
+
+	_fileStream->seek(_frameOffset[_curFrame]);
+	while (frameSize > 0) {
+		byte nextByte = _fileStream->readByte();
+
+		if (nextByte < 0x80) {
+			*destP++ = nextByte;
+			--frameSize;
+		} else if (nextByte == 0x80) {
+			int runLength = _fileStream->readByte();
+			if (runLength == 0)
+				return;
+
+			runLength = MIN(runLength, frameSize);
+			Common::fill(destP, destP + runLength, 0);
+			destP += runLength;
+			frameSize -= runLength;
+		} else {
+			int runLength = _fileStream->readByte();
+			
+			runLength = MIN(runLength, frameSize);
+			Common::fill(destP, destP + runLength, nextByte & 0x7f);
+			destP += runLength;
+			frameSize -= runLength;
+		}
+	}
+}
+
+void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
+	int screenOffset = _videoBase;
+	int frameSize = _surface->w * _surface->h - _videoBase;
+	byte *src = (byte *)_backSurface->pixels;
+	byte *dest = (byte *)_surface->pixels;
+
+	_fileStream->seek(_frameOffset[_curFrame]);
+	while (frameSize > 0) {
+		byte nextByte = _fileStream->readByte();
+
+		if (nextByte == 0) {
+			dest[screenOffset] = src[screenOffset];
+			++screenOffset;
+			--frameSize;
+		} else if (nextByte < 0x80) {
+			dest[screenOffset] = nextByte | 0x80;
+			++screenOffset;
+			--frameSize;
+		} else if (nextByte == 0x80) {
+			byte runLength = _fileStream->readByte();
+			if (runLength == 0)
+				return;
+
+			assert(runLength <= frameSize);
+			Common::copy(src + screenOffset, src + screenOffset + runLength, dest);
+			screenOffset += runLength;
+			frameSize -= runLength;
+		} else {
+			byte runLength = _fileStream->readByte();
+			
+			assert(runLength <= frameSize);
+			Common::fill(dest + screenOffset, dest + screenOffset + runLength, nextByte & 0x7f);
+			screenOffset += runLength;
+			frameSize -= runLength;
+		}
+	}
+}
+
+} // End of namespace Video
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
new file mode 100644
index 0000000..dccf409
--- /dev/null
+++ b/engines/voyeur/animation.h
@@ -0,0 +1,100 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_ANIMATION_H
+#define VOYEUR_ANIMATION_H
+
+#include "video/video_decoder.h"
+#include "common/list.h"
+#include "common/rect.h"
+#include "common/stream.h"
+
+namespace Video {
+
+/**
+ * Decoder for RL2 videos.
+ *
+ * Video decoder used in engines:
+ *  - voyeur
+ */
+class RL2Decoder : public VideoDecoder {
+public:
+	RL2Decoder();
+	virtual ~RL2Decoder();
+
+	bool loadStream(Common::SeekableReadStream *stream);
+
+	const Common::List<Common::Rect> *getDirtyRects() const;
+	void clearDirtyRects();
+	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
+
+private:
+	class RL2VideoTrack : public VideoTrack {
+	public:
+		RL2VideoTrack(Common::SeekableReadStream *stream);
+		~RL2VideoTrack();
+
+		bool endOfTrack() const;
+		bool isRewindable() const { return true; }
+		bool rewind();
+
+		uint16 getWidth() const;
+		uint16 getHeight() const;
+		Graphics::PixelFormat getPixelFormat() const;
+		int getCurFrame() const { return _curFrame; }
+		int getFrameCount() const { return _frameCount; }
+		uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
+		const Graphics::Surface *decodeNextFrame();
+		const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+		bool hasDirtyPalette() const { return _dirtyPalette; }
+
+		const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
+		void clearDirtyRects() { _dirtyRects.clear(); }
+		void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
+
+	private:
+		Common::SeekableReadStream *_fileStream;
+		Graphics::Surface *_surface;
+		Graphics::Surface *_backSurface;
+
+		int _curFrame;
+
+		byte *_palette;
+		mutable bool _dirtyPalette;
+
+		uint32 _frameCount;
+		uint32 _videoBase;
+		uint32 *_frameOffset;
+		uint32 _frameDelay;
+		uint32 _nextFrameStartTime;
+
+		Common::List<Common::Rect> _dirtyRects;
+
+		void copyFrame(uint8 *data);
+		void rl2DecodeFrameWithBackground();
+		void rl2DecodeFrameWithoutBackground(int screenOffset = -1);
+	};
+};
+
+} // End of namespace Video
+
+#endif /* VOYEUR_ANIMATION_H */
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 9cf2553..c79081c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -604,6 +604,10 @@ void GraphicsManager::clearPalette() {
 	g_system->getPaletteManager()->setPalette(&palette[0], 0, 256);
 }
 
+void GraphicsManager::setPalette(const byte *palette, int start, int count) {
+	g_system->getPaletteManager()->setPalette(palette, start, count);
+}
+
 void GraphicsManager::resetPalette() {
 	for (int i = 0; i < 256; ++i)
 		setColor(i, 0, 0, 0);
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index f6ad837..23a2965 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -107,6 +107,7 @@ public:
 	void sDisplayPic(PictureResource *pic);
 	void flipPage();
 	void clearPalette();
+	void setPalette(const byte *palette, int start, int count);
 	void resetPalette();
 	void setColor(int idx, byte r, byte g, byte b);
 	void screenReset();
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 48f63dc..645b62f 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -1,6 +1,7 @@
 MODULE := engines/voyeur
 
 MODULE_OBJS := \
+	animation.o \
 	debugger.o \
 	detection.o \
 	events.o \
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 8be57e4..1e140f8 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "voyeur/voyeur.h"
+#include "voyeur/animation.h"
 #include "voyeur/graphics.h"
 #include "voyeur/utils.h"
 #include "common/scummsys.h"
@@ -156,8 +157,13 @@ void VoyeurEngine::doHeadTitle() {
 	if (shouldQuit())
 		return;
 
-	doLock();
+	if (ConfMan.getBool("copy_protection")) {
+		bool result = doLock();
+		if (!result || shouldQuit())
+			return;
+	}
 
+	playRL2Video("a1100100.rl2");
 	// TODO
 }
 
@@ -196,6 +202,8 @@ void VoyeurEngine::showConversionScreen() {
 
 	_graphicsManager.screenReset();
 	_bVoy->freeBoltGroup(0x10500);
+
+
 }
 
 bool VoyeurEngine::doLock() {
@@ -376,10 +384,35 @@ bool VoyeurEngine::doLock() {
 		_bVoy->freeBoltGroup(0x10700);
 	}
 
+	_eventsManager.mouseOff();
+
 	delete[] buttonVoc;
 	delete[] wrongVoc;
 
 	return result;
 }
 
+void VoyeurEngine::playRL2Video(const Common::String &filename) {
+	::Video::RL2Decoder decoder;
+	decoder.loadFile(filename);
+	decoder.start();
+
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+		if (decoder.hasDirtyPalette()) {
+			const byte *palette = decoder.getPalette();
+			_graphicsManager.setPalette(palette, 0, 256);
+		}
+
+		if (decoder.needsUpdate()) {
+			const Graphics::Surface *frame = decoder.decodeNextFrame();
+
+			Common::copy((byte *)frame->pixels, (byte *)frame->pixels + 320 * 200,
+				(byte *)_graphicsManager._screenSurface.pixels);
+		}
+
+		_eventsManager.pollEvents();
+		g_system->delayMillis(10);
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 95a664e..06ac691 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -107,6 +107,8 @@ public:
 	virtual bool canSaveGameStateCurrently();
 	virtual Common::Error loadGameState(int slot);
 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
+
+	void playRL2Video(const Common::String &filename);
 };
 
 } // End of namespace Voyeur


Commit: 527a52e473789685ec601cf2f052cf5a3a65d2d2
    https://github.com/scummvm/scummvm/commit/527a52e473789685ec601cf2f052cf5a3a65d2d2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-22T16:28:52-07:00

Commit Message:
VOYEUR: Sound for RL2 video files is sort of working

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index b2bcb2a..7b5316b 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -21,12 +21,14 @@
  */
 
 #include "voyeur/animation.h"
+#include "common/memstream.h"
 #include "common/system.h"
+#include "audio/decoders/raw.h"
 #include "graphics/surface.h"
 
 namespace Video {
 
-RL2Decoder::RL2Decoder() {
+RL2Decoder::RL2Decoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
 }
 
 RL2Decoder::~RL2Decoder() {
@@ -36,16 +38,25 @@ RL2Decoder::~RL2Decoder() {
 bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	close();
 
-	stream->seek(8);
+	// Load basic file information
+	_header.load(stream);
 
 	// Check RL2 magic number
-	uint32 signature = stream->readUint32LE();
-	if (signature != 0x33564c52 /* RLV3 */ && signature != 0x32564c52 /* RLV2 */) {
-		warning("RL2Decoder::loadStream(): attempted to load non-RL2 data (type = 0x%08X)", signature);
+	if (!_header.isValid()) {
+		warning("RL2Decoder::loadStream(): attempted to load non-RL2 data (0x%08X)", _header._signature);
 		return false;
 	}
 
-	addTrack(new RL2VideoTrack(stream));
+	// Add an audio track if sound is present
+	RL2AudioTrack *audioTrack = NULL;
+	if (_header._soundRate) {
+		audioTrack = new RL2AudioTrack(_header, _soundType);
+		addTrack(audioTrack);
+	}
+
+	// Create a video track
+	addTrack(new RL2VideoTrack(_header, audioTrack, stream));
+
 	return true;
 }
 
@@ -72,65 +83,91 @@ void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
 		((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
 }
 
-RL2Decoder::RL2VideoTrack::RL2VideoTrack(Common::SeekableReadStream *stream) {
-	_fileStream = stream;
+/*------------------------------------------------------------------------*/
 
-	stream->seek(4);
-	uint32 backSize = stream->readUint32LE();
-	assert(backSize == 0 || backSize == (320 * 200));
+RL2Decoder::RL2FileHeader::RL2FileHeader() {
+	_frameOffsets = NULL;
+	_frameSoundSizes = NULL;
+}
 
-	stream->seek(16);
-	_frameCount = stream->readUint16LE();
+RL2Decoder::RL2FileHeader::~RL2FileHeader() {
+	delete[] _frameOffsets;
+	_frameSoundSizes;
+}
 
-	// Calculate the frame rate
-	stream->seek(22);
-	int soundRate = stream->readUint16LE();
-	int rate = stream->readUint16LE();
-	stream->skip(2);
-	int defSoundSize = stream->readUint16LE();
+void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
+	stream->seek(0);
+
+	_form = stream->readUint32LE();
+	_backSize = stream->readUint32LE();
+	_signature = stream->readUint32LE();
+
+	if (!isValid())
+		return;
+
+	_dataSize = stream->readUint32LE();
+	_numFrames = stream->readUint32LE();
+	_method = stream->readUint16LE();
+	_soundRate = stream->readUint16LE();
+	_rate = stream->readUint16LE();
+	_channels = stream->readUint16LE();
+	_defSoundSize = stream->readUint16LE();
+	_videoBase = stream->readUint16LE();
+	_colorCount = stream->readUint32LE();
+	assert(_colorCount <= 256);
+
+	stream->read(_palette, 768);
 
-	int fps = (soundRate > 0) ? rate / defSoundSize : 11025 / 1103;
+	// Skip over background frame, if any, and the list of overall frame sizes (which we don't use)
+	stream->skip(_backSize + 4 * _numFrames);
+
+	// Load frame offsets
+	_frameOffsets = new uint32[_numFrames];
+	for (int i = 0; i < _numFrames; ++i)
+		_frameOffsets[i] = stream->readUint32LE();
+
+	// Load the size of the sound portion of each frame
+	_frameSoundSizes = new int[_numFrames];
+	for (int i = 0; i < _numFrames; ++i)
+		_frameSoundSizes[i] = stream->readUint32LE() & 0xffff;
+}
+
+bool RL2Decoder::RL2FileHeader::isValid() const {
+	return _signature == MKTAG('R','L','V','2') || _signature != MKTAG('R','L','V','3');
+}
+
+/*------------------------------------------------------------------------*/
+
+RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack, 
+		Common::SeekableReadStream *stream): 
+		_header(header), _audioTrack(audioTrack), _fileStream(stream) {
+	assert(header._backSize == 0 || header._backSize == (320 * 200));
+
+	// Calculate the frame rate
+	int fps = (header._soundRate > 0) ? header._rate / header._defSoundSize : 11025 / 1103;
 	_frameDelay = 1000 / fps;
 
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
-	if (backSize == 0) {
+	if (header._backSize == 0) {
 		_backSurface = NULL;
 	} else {
 		_backSurface = new Graphics::Surface();
 		_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 
 		stream->seek(0x324);
-		_fileStream->read((byte *)_backSurface->pixels, 320 * 200);
+		rl2DecodeFrameWithoutBackground(0);
 	}
 
-	stream->seek(30);
-	_videoBase = stream->readUint16LE();
-	stream->seek(36);
-	_palette = new byte[3 * 256];
-	stream->read(_palette, 256 * 3);
+	_videoBase = header._videoBase;
 	_dirtyPalette = true;
 
 	_curFrame = 0;
 	_nextFrameStartTime = 0;
-
-	// Read in the frame offsets. Since we're only worried about the video data
-	// here, we'll calculate video offsets taking into account sound data size
-	stream->seek(0x324 + backSize + 4 * _frameCount);
-
-	_frameOffset = new uint32[_frameCount];
-	for (uint i = 0; i < _frameCount; ++i)
-		_frameOffset[i] = _fileStream->readUint32LE();
-
-	// Adust frame offsets to skip sound data
-	for (uint i = 0; i < _frameCount; ++i)
-		_frameOffset[i] += _fileStream->readUint32LE() & 0xffff;
 }
 
 RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
 	delete _fileStream;
-	delete[] _palette;
-	delete[] _frameOffset;
 
 	_surface->free();
 	delete _surface;
@@ -148,8 +185,6 @@ bool RL2Decoder::RL2VideoTrack::rewind() {
 	_curFrame = 0;
 	_nextFrameStartTime = 0;
 
-	_fileStream->seek(_frameOffset[0]);
-
 	return true;
 }
 
@@ -173,8 +208,14 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
 	}
 
-	_fileStream->seek(_frameOffset[_curFrame]);
-		
+	// Move to the next frame data
+	_fileStream->seek(_header._frameOffsets[_curFrame]);
+
+	// If there's any sound data, pass it to the audio track
+	if (_header._frameSoundSizes[_curFrame] > 0 && _audioTrack)
+		_audioTrack->queueSound(_fileStream, _header._frameSoundSizes[_curFrame]);
+
+	// Decode the graphic data
 	if (_backSurface) 
 		rl2DecodeFrameWithBackground();
 	else
@@ -211,7 +252,6 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutBackground(int screenOffset
 	byte *destP = (byte *)_surface->pixels + screenOffset;
 	int frameSize = _surface->w * _surface->h - screenOffset;
 
-	_fileStream->seek(_frameOffset[_curFrame]);
 	while (frameSize > 0) {
 		byte nextByte = _fileStream->readByte();
 
@@ -244,7 +284,6 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
 	byte *src = (byte *)_backSurface->pixels;
 	byte *dest = (byte *)_surface->pixels;
 
-	_fileStream->seek(_frameOffset[_curFrame]);
 	while (frameSize > 0) {
 		byte nextByte = _fileStream->readByte();
 
@@ -276,4 +315,38 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
 	}
 }
 
+/*------------------------------------------------------------------------*/
+
+RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Audio::Mixer::SoundType soundType): 
+		_header(header), _soundType(soundType) {
+	_audStream = createAudioStream();
+}
+
+RL2Decoder::RL2AudioTrack::~RL2AudioTrack() {
+	delete _audStream;
+}
+
+void RL2Decoder::RL2AudioTrack::queueSound(Common::SeekableReadStream *stream, int size) {
+	if (_audStream) {
+		// Queue the sound data
+		byte *data = new byte[size];
+		stream->read(data, size);
+		Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
+			DisposeAfterUse::YES);
+
+		_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
+			Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
+	} else {
+		delete stream;
+	}
+}
+
+Audio::AudioStream *RL2Decoder::RL2AudioTrack::getAudioStream() const {
+	return _audStream;
+}
+
+Audio::QueuingAudioStream *RL2Decoder::RL2AudioTrack::createAudioStream() {
+	return Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2);
+}
+
 } // End of namespace Video
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index dccf409..c5991f4 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -24,6 +24,8 @@
 #define VOYEUR_ANIMATION_H
 
 #include "video/video_decoder.h"
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
 #include "common/list.h"
 #include "common/rect.h"
 #include "common/stream.h"
@@ -37,8 +39,37 @@ namespace Video {
  *  - voyeur
  */
 class RL2Decoder : public VideoDecoder {
+
+	class RL2FileHeader {
+	public:
+		uint32 _form;
+		uint32 _backSize;
+		uint32 _signature;
+		uint32 _dataSize;
+		int _numFrames;
+		int _method;
+		int _soundRate;
+		int _rate;
+		int _channels;
+		int _defSoundSize;
+		int _videoBase;
+		int _colorCount;
+		byte _palette[768];
+
+		uint32 *_frameOffsets;
+		int *_frameSoundSizes;
+	public:
+		RL2FileHeader();
+		~RL2FileHeader();
+		void load(Common::SeekableReadStream *stream);
+		bool isValid() const;
+	};
+
+private:
+	Audio::Mixer::SoundType _soundType;
+	RL2FileHeader _header;
 public:
-	RL2Decoder();
+	RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
 	virtual ~RL2Decoder();
 
 	bool loadStream(Common::SeekableReadStream *stream);
@@ -48,9 +79,29 @@ public:
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 
 private:
+	class RL2AudioTrack : public AudioTrack {
+	public:
+		RL2AudioTrack(const RL2FileHeader &header, Audio::Mixer::SoundType soundType);
+		~RL2AudioTrack();
+
+		void queueSound(Common::SeekableReadStream *stream, int size);
+		Audio::Mixer::SoundType getSoundType() const { return _soundType; }
+
+	protected:
+		Audio::AudioStream *getAudioStream() const;
+
+	private:
+		Audio::Mixer::SoundType _soundType;
+		const RL2FileHeader &_header;
+
+		Audio::QueuingAudioStream *_audStream;
+		Audio::QueuingAudioStream *createAudioStream();
+	};
+
 	class RL2VideoTrack : public VideoTrack {
 	public:
-		RL2VideoTrack(Common::SeekableReadStream *stream);
+		RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack, 
+			Common::SeekableReadStream *stream);
 		~RL2VideoTrack();
 
 		bool endOfTrack() const;
@@ -61,10 +112,10 @@ private:
 		uint16 getHeight() const;
 		Graphics::PixelFormat getPixelFormat() const;
 		int getCurFrame() const { return _curFrame; }
-		int getFrameCount() const { return _frameCount; }
+		int getFrameCount() const { return _header._numFrames; }
 		uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
 		const Graphics::Surface *decodeNextFrame();
-		const byte *getPalette() const { _dirtyPalette = false; return _palette; }
+		const byte *getPalette() const { _dirtyPalette = false; return _header._palette; }
 		bool hasDirtyPalette() const { return _dirtyPalette; }
 
 		const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
@@ -73,17 +124,16 @@ private:
 
 	private:
 		Common::SeekableReadStream *_fileStream;
+		const RL2FileHeader &_header;
+		RL2AudioTrack *_audioTrack;
 		Graphics::Surface *_surface;
 		Graphics::Surface *_backSurface;
 
-		int _curFrame;
-
-		byte *_palette;
 		mutable bool _dirtyPalette;
 
-		uint32 _frameCount;
+		int _curFrame;
 		uint32 _videoBase;
-		uint32 *_frameOffset;
+		uint32 *_frameOffsets;
 		uint32 _frameDelay;
 		uint32 _nextFrameStartTime;
 


Commit: b4bfc7c71cd716111b97e389f98cf00e7e7163d9
    https://github.com/scummvm/scummvm/commit/b4bfc7c71cd716111b97e389f98cf00e7e7163d9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-22T18:09:20-07:00

Commit Message:
VOYEUR: Implementing code for showing title sequence

Changed paths:
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1e140f8..75d97aa 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -163,8 +163,7 @@ void VoyeurEngine::doHeadTitle() {
 			return;
 	}
 
-	playRL2Video("a1100100.rl2");
-	// TODO
+	showTitleScreen();
 }
 
 void VoyeurEngine::showConversionScreen() {
@@ -392,6 +391,49 @@ bool VoyeurEngine::doLock() {
 	return result;
 }
 
+void VoyeurEngine::showTitleScreen() {
+	if (_bVoy->getBoltGroup(0x10500)) {
+		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x500);
+
+		(*_graphicsManager._vPort)->setupViewPort();
+		(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
+		_graphicsManager.flipPage();
+		_eventsManager.sWaitFlip();
+
+		// Immediate palette load to show the initial screen
+		CMapResource *cMap = _bVoy->getCMapResource(0x501);
+		assert(cMap);
+		cMap->_steps = 60;
+		cMap->startFade();
+
+		// Wait briefly
+		_eventsManager.delay(200);
+		if (shouldQuit())
+			return;
+
+		// Fade out the screen
+		cMap = _bVoy->getCMapResource(0x504);
+		cMap->_steps = 30;
+		cMap->startFade();
+
+		(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
+		_graphicsManager.flipPage();
+		_eventsManager.sWaitFlip();
+
+		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+			_eventsManager.delay(1);
+		if (shouldQuit())
+			return;
+
+		_graphicsManager.screenReset();
+		_eventsManager.delay(200);
+		_bVoy->freeBoltGroup(0x10500);
+
+		playRL2Video("a1100100.rl2");
+		_graphicsManager.screenReset();
+	}
+}
+
 void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	::Video::RL2Decoder decoder;
 	decoder.loadFile(filename);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 06ac691..10fe192 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -79,6 +79,7 @@ private:
 	void doHeadTitle();
 	void showConversionScreen();
 	bool doLock();
+	void showTitleScreen();
 protected:
 	// Engine APIs
 	virtual Common::Error run();


Commit: cc4486772c32f3ccc334541c8200e31375d78c78
    https://github.com/scummvm/scummvm/commit/cc4486772c32f3ccc334541c8200e31375d78c78
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-23T08:16:53-07:00

Commit Message:
VOYEUR: Fix in bounds clipping in sDrawPic

Changed paths:
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index c79081c..98b3e74 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -169,8 +169,8 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 
 	if (srcFlags & 1) {
 		if (_clipPtr) {
-			int xs = _clipPtr->left - srcPic->_bounds.left;
-			int ys = _clipPtr->top - srcPic->_bounds.top;
+			int xs = _clipPtr->left - destPic->_bounds.left;
+			int ys = _clipPtr->top - destPic->_bounds.top;
 			newBounds = Common::Rect(xs, ys, xs + _clipPtr->width(), ys + _clipPtr->height());
 		} else if (destViewPort) {
 			int xs = destViewPort->_clipRect.left - destPic->_bounds.left;


Commit: 2654135257bc6771a3e18794df15b0d8fc238647
    https://github.com/scummvm/scummvm/commit/2654135257bc6771a3e18794df15b0d8fc238647
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-23T08:31:54-07:00

Commit Message:
VOYEUR: Fix crash from using background resource after it's group is freed

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 7b5316b..1f4e623 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -329,7 +329,7 @@ RL2Decoder::RL2AudioTrack::~RL2AudioTrack() {
 void RL2Decoder::RL2AudioTrack::queueSound(Common::SeekableReadStream *stream, int size) {
 	if (_audStream) {
 		// Queue the sound data
-		byte *data = new byte[size];
+		byte *data = (byte *)malloc(size);
 		stream->read(data, size);
 		Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
 			DisposeAfterUse::YES);
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 98b3e74..f517f1a 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -628,6 +628,7 @@ void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
 
 void GraphicsManager::screenReset() {
 	resetPalette();
+
 	(*_vPort)->setupViewPort();
 	fillPic(*_vPort, 0);	
 	(*_vPort)->_parent->_flags |= DISPFLAG_8;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 75d97aa..e7adc7d 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -427,10 +427,11 @@ void VoyeurEngine::showTitleScreen() {
 
 		_graphicsManager.screenReset();
 		_eventsManager.delay(200);
-		_bVoy->freeBoltGroup(0x10500);
 
 		playRL2Video("a1100100.rl2");
 		_graphicsManager.screenReset();
+
+		_bVoy->freeBoltGroup(0x10500);
 	}
 }
 


Commit: a4e445702f5c65337f21364ac9d5f37e28e8e657
    https://github.com/scummvm/scummvm/commit/a4e445702f5c65337f21364ac9d5f37e28e8e657
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-23T11:55:27-07:00

Commit Message:
VOYEUR: Implemented doTransitionCard

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 16566d8..34098e4 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1051,7 +1051,11 @@ void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
 }
 
 void ViewPortResource::sFillBox(int width) {
+	// TODO
+}
 
+void ViewPortResource::fillPic(byte onOff) {
+	_state._vm->_graphicsManager.fillPic(this, onOff);
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 5d825ff..b66546c 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -274,6 +274,7 @@ public:
 	int textWidth(const Common::String &msg);
 	void addSaveRect(int pageIndex, const Common::Rect &r);
 	void sFillBox(int width);
+	void fillPic(byte onOff = 0);
 };
 
 class ViewPortPalEntry  {
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index 9d71fbf..47b59b8 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -50,4 +50,49 @@ void IntData::audioInit() {
 
 /*------------------------------------------------------------------------*/
 
+Game::Game() {
+}
+
+void Game::doTransitionCard(const Common::String &time, const Common::String &location) {
+	_vm->_graphicsManager.setColor(128, 16, 16, 16);
+	_vm->_graphicsManager.setColor(224, 220, 220, 220);
+	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._hasPalette = true;
+
+	(*_vm->_graphicsManager._vPort)->setupViewPort();
+	(*_vm->_graphicsManager._vPort)->fillPic(128);
+	_vm->_graphicsManager.flipPage();
+	_vm->_eventsManager.sWaitFlip();
+
+	(*_vm->_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
+	_vm->_graphicsManager.flipPage();
+	_vm->_eventsManager.sWaitFlip();
+	(*_vm->_graphicsManager._vPort)->fillPic(128);
+
+	FontInfoResource &fi = *_vm->_graphicsManager._fontPtr;
+	fi._curFont = _vm->_bVoy->boltEntry(257)._fontResource;
+	fi._foreColor = 224;
+	fi._fontSaveBack = 0;
+	fi._pos = Common::Point(0, 116);
+	fi._justify = ALIGN_CENTRE;
+	fi._justifyWidth = 384;
+	fi._justifyHeight = 120;
+
+	(*_vm->_graphicsManager._vPort)->drawText(time);
+	
+	if (!location.empty()) {
+		fi._pos = Common::Point(0, 138);
+		fi._justify = ALIGN_CENTRE;
+		fi._justifyWidth = 384;
+		fi._justifyHeight = 140;
+
+		(*_vm->_graphicsManager._vPort)->drawText(location);
+	}
+
+	(*_vm->_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
+	_vm->_graphicsManager.flipPage();
+	_vm->_eventsManager.sWaitFlip();
+}
+
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index e47a880..b569cb7 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -25,6 +25,7 @@
 
 #include "common/scummsys.h"
 #include "common/events.h"
+#include "common/str.h"
 
 namespace Voyeur {
 
@@ -120,6 +121,16 @@ public:
 	void audioInit();
 };
 
+class Game {
+private:
+	VoyeurEngine *_vm;
+public:
+	Game();
+	void setVm(VoyeurEngine *vm) { _vm = vm; }
+
+	void doTransitionCard(const Common::String &time, const Common::String &location);
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_GAME_H */
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index e7adc7d..f54d72a 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -100,6 +100,7 @@ void VoyeurEngine::initialiseManagers() {
 	_debugger.setVm(this);
 	_eventsManager.setVm(this);
 	_filesManager.setVm(this);
+	_game.setVm(this);
 	_graphicsManager.setVm(this);
 	_soundManager.setVm(this);
 
@@ -146,7 +147,7 @@ void VoyeurEngine::vInitInterrupts() {
 void VoyeurEngine::initInput() {
 }
 
-void VoyeurEngine::doHeadTitle() {
+bool VoyeurEngine::doHeadTitle() {
 //	char dest[144];
 
 	_eventsManager.startMainClockInt();
@@ -155,15 +156,35 @@ void VoyeurEngine::doHeadTitle() {
 	if (_bVoy->getBoltGroup(0x10500))
 		showConversionScreen();
 	if (shouldQuit())
-		return;
+		return false;
 
 	if (ConfMan.getBool("copy_protection")) {
 		bool result = doLock();
 		if (!result || shouldQuit())
-			return;
+			return false;
 	}
 
 	showTitleScreen();
+
+	// Opening
+	if (!_voy._incriminate) {
+		doOpening();
+		_game.doTransitionCard("Saturday Afternoon", "Player's Apartment");
+		_eventsManager.delay(90);
+	} else {
+		_voy._incriminate = false;
+	}
+
+	if (_voy._eCursorOff[58] & 0x80) {
+		if (_voy._evidence[19] == 0) {
+			// TODO
+		} else {
+			// TODO
+		}
+	}
+
+	_voy._eCursorOff[55] = 140;
+	return true;
 }
 
 void VoyeurEngine::showConversionScreen() {
@@ -428,6 +449,7 @@ void VoyeurEngine::showTitleScreen() {
 		_graphicsManager.screenReset();
 		_eventsManager.delay(200);
 
+		// Voyeur title
 		playRL2Video("a1100100.rl2");
 		_graphicsManager.screenReset();
 
@@ -435,6 +457,10 @@ void VoyeurEngine::showTitleScreen() {
 	}
 }
 
+void VoyeurEngine::doOpening() {
+
+}
+
 void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	::Video::RL2Decoder decoder;
 	decoder.loadFile(filename);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 10fe192..f698aae 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -65,7 +65,6 @@ private:
 	const VoyeurGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
 
-	BoltFile *_bVoy;
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
 
@@ -76,18 +75,21 @@ private:
 	void vInitInterrupts();
 	void initInput();
 
-	void doHeadTitle();
+	bool doHeadTitle();
 	void showConversionScreen();
 	bool doLock();
 	void showTitleScreen();
+	void doOpening();
 protected:
 	// Engine APIs
 	virtual Common::Error run();
 	virtual bool hasFeature(EngineFeature f) const;
 public:
+	BoltFile *_bVoy;
 	Debugger _debugger;
 	EventsManager _eventsManager;
 	FilesManager _filesManager;
+	Game _game;
 	GraphicsManager _graphicsManager;
 	SoundManager _soundManager;
 	SVoy _voy;


Commit: d8ef42a7619113f57ce14aa3a4430e4d576ad0b4
    https://github.com/scummvm/scummvm/commit/d8ef42a7619113f57ce14aa3a4430e4d576ad0b4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-24T05:51:42-07:00

Commit Message:
VOYEUR: Work on doOpening method

Changed paths:
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index 47b59b8..a653a84 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -94,5 +94,8 @@ void Game::doTransitionCard(const Common::String &time, const Common::String &lo
 	_vm->_eventsManager.sWaitFlip();
 }
 
+void Game::addVideoEventStart() {
+
+}
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index b569cb7..eb7d5f5 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -125,10 +125,16 @@ class Game {
 private:
 	VoyeurEngine *_vm;
 public:
+	int _v2A098;
+	int _v2A0A6;
+	int _v2A0A4;
+	int _v2A09A;
+public:
 	Game();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void doTransitionCard(const Common::String &time, const Common::String &location);
+	void addVideoEventStart();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index f54d72a..f39d9be 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -259,9 +259,9 @@ bool VoyeurEngine::doLock() {
 
 		_graphicsManager._backColors->startFade();
 		(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-
 		_graphicsManager.flipPage();
 		_eventsManager.sWaitFlip();
+
 		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 			_eventsManager.delay(1);
 
@@ -458,7 +458,58 @@ void VoyeurEngine::showTitleScreen() {
 }
 
 void VoyeurEngine::doOpening() {
+	_graphicsManager.screenReset();
+
+	if (!_bVoy->getBoltGroup(0x10200))
+		return;
 
+	byte *frameTable = _bVoy->memberAddr(0x215);
+	byte *xyTable = _bVoy->memberAddr(0x216);
+	byte *whTable = _bVoy->memberAddr(0x217);
+	int frmaeIndex = 0;
+	int creditShow = 1;
+	_game._v2A098 = 1;
+	_voy._eCursorOff[52] = 0;
+	_voy._RTVNum = 0;
+	_voy._eCursorOff[50] = _voy._RTVNum;
+	_game._v2A0A6 = 4;
+	_game._v2A0A4 = 0;
+	_voy._eCursorOff[58] = 16;
+	_game._v2A09A = -1;
+	_game.addVideoEventStart();
+	_voy._eCursorOff[58] &= ~1;
+
+	for (int i = 0; i < 256; ++i)
+		_graphicsManager.setColor(i, 8, 8, 8);
+
+	_eventsManager._intPtr.field38 = 1;
+	_eventsManager._intPtr._hasPalette = true;
+	(*_graphicsManager._vPort)->setupViewPort();
+	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	::Video::RL2Decoder decoder;
+	decoder.loadFile("a2300100.rl2");
+	decoder.start();
+
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+		if (decoder.hasDirtyPalette()) {
+			const byte *palette = decoder.getPalette();
+			_graphicsManager.setPalette(palette, 0, 256);
+		}
+
+		if (decoder.needsUpdate()) {
+			const Graphics::Surface *frame = decoder.decodeNextFrame();
+
+			Common::copy((byte *)frame->pixels, (byte *)frame->pixels + 320 * 200,
+				(byte *)_graphicsManager._screenSurface.pixels);
+		}
+
+		_eventsManager.pollEvents();
+		g_system->delayMillis(10);
+	}
+	
 }
 
 void VoyeurEngine::playRL2Video(const Common::String &filename) {


Commit: 66d1f7a8de2ff5a21ad013f45924c406f4833e9a
    https://github.com/scummvm/scummvm/commit/66d1f7a8de2ff5a21ad013f45924c406f4833e9a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-06-26T19:23:50-07:00

Commit Message:
VOYEUR: Fixes for opening scene to start

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 1f4e623..3bcc6cf 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -141,7 +141,6 @@ bool RL2Decoder::RL2FileHeader::isValid() const {
 RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack, 
 		Common::SeekableReadStream *stream): 
 		_header(header), _audioTrack(audioTrack), _fileStream(stream) {
-	assert(header._backSize == 0 || header._backSize == (320 * 200));
 
 	// Calculate the frame rate
 	int fps = (header._soundRate > 0) ? header._rate / header._defSoundSize : 11025 / 1103;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index f517f1a..6e3ed10 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -54,6 +54,7 @@ GraphicsManager::GraphicsManager():
 	_drawTextPermFlag = false;
 	_clipPtr = NULL;
 	_viewPortListPtr = NULL;
+	_backgroundPage = NULL;
 	_vPort = NULL;
 	_fontPtr = NULL;
 }
@@ -586,6 +587,11 @@ void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rec
 	bool saveBack = _saveBack;
 	_saveBack = false;
 
+	// WORKAROUND: Since _backgroundPage can point to a resource freed at the end of display methods,
+	// I'm now explicitly resetting it to null in screenReset(), so at this point it can be null
+	if (!srcPic)
+		return;
+
 	if (rectListCount == -1) {
 		sDrawPic(srcPic, destPic, Common::Point());
 	} else {
@@ -629,6 +635,7 @@ void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
 void GraphicsManager::screenReset() {
 	resetPalette();
 
+	_backgroundPage = NULL;
 	(*_vPort)->setupViewPort();
 	fillPic(*_vPort, 0);	
 	(*_vPort)->_parent->_flags |= DISPFLAG_8;


Commit: ede418b67a0f14e4f17a2b03f5362741badd5532
    https://github.com/scummvm/scummvm/commit/ede418b67a0f14e4f17a2b03f5362741badd5532
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-11-30T17:44:23-08:00

Commit Message:
VOYEUR: Merge of upstream

Changed paths:
  A audio/softsynth/mt32/LA32FloatWaveGenerator.cpp
  A audio/softsynth/mt32/LA32FloatWaveGenerator.h
  A backends/graphics/opengl/debug.cpp
  A backends/graphics/opengl/debug.h
  A backends/graphics/opengl/extensions.cpp
  A backends/graphics/opengl/extensions.h
  A backends/graphics/opengl/opengl-sys.h
  A backends/graphics/opengl/texture.cpp
  A backends/graphics/opengl/texture.h
  A backends/mixer/nullmixer/nullsdl-mixer.cpp
  A backends/mixer/nullmixer/nullsdl-mixer.h
  A backends/platform/symbian/mmp/scummvm_avalanche.mmp.in
  A backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in
  A backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in
  A backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in
  A backends/platform/symbian/mmp/scummvm_neverhood.mmp.in
  A backends/platform/symbian/mmp/scummvm_sword25.mmp.in
  A backends/platform/symbian/mmp/scummvm_testbed.mmp.in
  A backends/platform/symbian/mmp/scummvm_zvision.mmp.in
  A backends/platform/tizen/README.TXT
  A backends/platform/tizen/application.cpp
  A backends/platform/tizen/application.h
  A backends/platform/tizen/audio.cpp
  A backends/platform/tizen/audio.h
  A backends/platform/tizen/form.cpp
  A backends/platform/tizen/form.h
  A backends/platform/tizen/fs.cpp
  A backends/platform/tizen/fs.h
  A backends/platform/tizen/graphics.cpp
  A backends/platform/tizen/graphics.h
  A backends/platform/tizen/main.cpp
  A backends/platform/tizen/missing.cpp
  A backends/platform/tizen/portdefs.h
  A backends/platform/tizen/sscanf.cpp
  A backends/platform/tizen/system.cpp
  A backends/platform/tizen/system.h
  A backends/platform/tizen/tizen.mk
  A backends/saves/recorder/recorder-saves.cpp
  A backends/saves/recorder/recorder-saves.h
  A backends/timer/tizen/timer.cpp
  A backends/timer/tizen/timer.h
  A common/ini-file.cpp
  A common/ini-file.h
  A common/recorderfile.cpp
  A common/recorderfile.h
  A common/ustr.cpp
  A common/ustr.h
  A devtools/create_mortdat/create_mortdat.cpp
  A devtools/create_mortdat/create_mortdat.h
  A devtools/create_mortdat/enginetext.h
  A devtools/create_mortdat/gametext.h
  A devtools/create_mortdat/menudata.h
  A devtools/create_mortdat/module.mk
  A devtools/create_neverhood/md5.cpp
  A devtools/create_neverhood/md5.h
  A devtools/create_project/msvc12/create_project.sln
  A devtools/create_project/msvc12/create_project.vcxproj
  A devtools/create_project/msvc12/create_project.vcxproj.filters
  A devtools/extract_mort/extract_mort.cpp
  A devtools/extract_mort/module.mk
  A dists/android/res-ouya/values-television/margins.xml
  A dists/android/res/drawable-xhdpi/ouya_icon.png
  A dists/android/res/values/margins.xml
  A dists/engine-data/mort.dat
  A dists/msvc12/create_msvc12.bat
  A dists/msvc12/readme.txt
  A engines/agi/POTFILES
  A engines/agi/configure.engine
  A engines/agos/POTFILES
  A engines/agos/configure.engine
  A engines/avalanche/animation.cpp
  A engines/avalanche/animation.h
  A engines/avalanche/avalanche.cpp
  A engines/avalanche/avalanche.h
  A engines/avalanche/avalot.cpp
  A engines/avalanche/avalot.h
  A engines/avalanche/background.cpp
  A engines/avalanche/background.h
  A engines/avalanche/closing.cpp
  A engines/avalanche/closing.h
  A engines/avalanche/configure.engine
  A engines/avalanche/console.cpp
  A engines/avalanche/console.h
  A engines/avalanche/detection.cpp
  A engines/avalanche/dialogs.cpp
  A engines/avalanche/dialogs.h
  A engines/avalanche/enums.h
  A engines/avalanche/graphics.cpp
  A engines/avalanche/graphics.h
  A engines/avalanche/menu.cpp
  A engines/avalanche/menu.h
  A engines/avalanche/module.mk
  A engines/avalanche/nim.cpp
  A engines/avalanche/nim.h
  A engines/avalanche/parser.cpp
  A engines/avalanche/parser.h
  A engines/avalanche/pingo.cpp
  A engines/avalanche/pingo.h
  A engines/avalanche/sequence.cpp
  A engines/avalanche/sequence.h
  A engines/avalanche/sound.cpp
  A engines/avalanche/sound.h
  A engines/avalanche/timer.cpp
  A engines/avalanche/timer.h
  A engines/cge/configure.engine
  A engines/cine/configure.engine
  A engines/composer/configure.engine
  A engines/cruise/POTFILES
  A engines/cruise/configure.engine
  A engines/draci/configure.engine
  A engines/drascula/POTFILES
  A engines/drascula/configure.engine
  A engines/dreamweb/POTFILES
  A engines/dreamweb/configure.engine
  A engines/fullpipe/behavior.cpp
  A engines/fullpipe/behavior.h
  A engines/fullpipe/configure.engine
  A engines/fullpipe/constants.h
  A engines/fullpipe/detection.cpp
  A engines/fullpipe/floaters.cpp
  A engines/fullpipe/floaters.h
  A engines/fullpipe/fullpipe.cpp
  A engines/fullpipe/fullpipe.h
  A engines/fullpipe/gameloader.cpp
  A engines/fullpipe/gameloader.h
  A engines/fullpipe/gfx.cpp
  A engines/fullpipe/gfx.h
  A engines/fullpipe/init.cpp
  A engines/fullpipe/input.cpp
  A engines/fullpipe/input.h
  A engines/fullpipe/interaction.cpp
  A engines/fullpipe/interaction.h
  A engines/fullpipe/inventory.cpp
  A engines/fullpipe/inventory.h
  A engines/fullpipe/lift.cpp
  A engines/fullpipe/messagehandlers.cpp
  A engines/fullpipe/messages.cpp
  A engines/fullpipe/messages.h
  A engines/fullpipe/modal.cpp
  A engines/fullpipe/modal.h
  A engines/fullpipe/module.mk
  A engines/fullpipe/motion.cpp
  A engines/fullpipe/motion.h
  A engines/fullpipe/ngiarchive.cpp
  A engines/fullpipe/ngiarchive.h
  A engines/fullpipe/objectnames.h
  A engines/fullpipe/objects.h
  A engines/fullpipe/scene.cpp
  A engines/fullpipe/scene.h
  A engines/fullpipe/scenes.cpp
  A engines/fullpipe/scenes.h
  A engines/fullpipe/scenes/scene01.cpp
  A engines/fullpipe/scenes/scene02.cpp
  A engines/fullpipe/scenes/scene03.cpp
  A engines/fullpipe/scenes/scene04.cpp
  A engines/fullpipe/scenes/sceneDbg.cpp
  A engines/fullpipe/scenes/sceneIntro.cpp
  A engines/fullpipe/sound.cpp
  A engines/fullpipe/sound.h
  A engines/fullpipe/stateloader.cpp
  A engines/fullpipe/statics.cpp
  A engines/fullpipe/statics.h
  A engines/fullpipe/utils.cpp
  A engines/fullpipe/utils.h
  A engines/gob/POTFILES
  A engines/gob/configure.engine
  A engines/groovie/POTFILES
  A engines/groovie/configure.engine
  A engines/hopkins/configure.engine
  A engines/hugo/configure.engine
  A engines/kyra/POTFILES
  A engines/kyra/configure.engine
  A engines/lastexpress/configure.engine
  A engines/lure/configure.engine
  A engines/made/configure.engine
  A engines/mohawk/POTFILES
  A engines/mohawk/configure.engine
  A engines/mortevielle/actions.cpp
  A engines/mortevielle/configure.engine
  A engines/mortevielle/debugger.cpp
  A engines/mortevielle/debugger.h
  A engines/mortevielle/detection.cpp
  A engines/mortevielle/detection_tables.h
  A engines/mortevielle/dialogs.cpp
  A engines/mortevielle/dialogs.h
  A engines/mortevielle/graphics.cpp
  A engines/mortevielle/graphics.h
  A engines/mortevielle/menu.cpp
  A engines/mortevielle/menu.h
  A engines/mortevielle/module.mk
  A engines/mortevielle/mortevielle.cpp
  A engines/mortevielle/mortevielle.h
  A engines/mortevielle/mouse.cpp
  A engines/mortevielle/mouse.h
  A engines/mortevielle/outtext.cpp
  A engines/mortevielle/outtext.h
  A engines/mortevielle/saveload.cpp
  A engines/mortevielle/saveload.h
  A engines/mortevielle/sound.cpp
  A engines/mortevielle/sound.h
  A engines/mortevielle/utils.cpp
  A engines/neverhood/POTFILES
  A engines/neverhood/configure.engine
  A engines/neverhood/console.cpp
  A engines/neverhood/console.h
  A engines/neverhood/modules/module1000_sprites.cpp
  A engines/neverhood/modules/module1000_sprites.h
  A engines/neverhood/modules/module1100_sprites.cpp
  A engines/neverhood/modules/module1100_sprites.h
  A engines/neverhood/modules/module1200_sprites.cpp
  A engines/neverhood/modules/module1200_sprites.h
  A engines/neverhood/modules/module1300_sprites.cpp
  A engines/neverhood/modules/module1300_sprites.h
  A engines/neverhood/modules/module1400_sprites.cpp
  A engines/neverhood/modules/module1400_sprites.h
  A engines/neverhood/modules/module1600_sprites.cpp
  A engines/neverhood/modules/module1600_sprites.h
  A engines/neverhood/modules/module1700_sprites.cpp
  A engines/neverhood/modules/module1700_sprites.h
  A engines/neverhood/modules/module1900_sprites.cpp
  A engines/neverhood/modules/module1900_sprites.h
  A engines/neverhood/modules/module2000_sprites.cpp
  A engines/neverhood/modules/module2000_sprites.h
  A engines/neverhood/modules/module2100_sprites.cpp
  A engines/neverhood/modules/module2100_sprites.h
  A engines/neverhood/modules/module2200_sprites.cpp
  A engines/neverhood/modules/module2200_sprites.h
  A engines/neverhood/modules/module2400_sprites.cpp
  A engines/neverhood/modules/module2400_sprites.h
  A engines/neverhood/modules/module2500_sprites.cpp
  A engines/neverhood/modules/module2500_sprites.h
  A engines/neverhood/modules/module2600_sprites.cpp
  A engines/neverhood/modules/module2600_sprites.h
  A engines/neverhood/modules/module2700_sprites.cpp
  A engines/neverhood/modules/module2700_sprites.h
  A engines/neverhood/modules/module2800_sprites.cpp
  A engines/neverhood/modules/module2800_sprites.h
  A engines/neverhood/modules/module2900_sprites.cpp
  A engines/neverhood/modules/module2900_sprites.h
  A engines/neverhood/modules/module3000_sprites.cpp
  A engines/neverhood/modules/module3000_sprites.h
  A engines/parallaction/POTFILES
  A engines/parallaction/configure.engine
  A engines/pegasus/POTFILES
  A engines/pegasus/configure.engine
  A engines/queen/POTFILES
  A engines/queen/configure.engine
  A engines/saga/configure.engine
  A engines/sci/POTFILES
  A engines/sci/configure.engine
  A engines/scumm/POTFILES
  A engines/scumm/configure.engine
  A engines/scumm/players/player_ad.cpp
  A engines/scumm/players/player_ad.h
  A engines/scumm/players/player_apple2.cpp
  A engines/scumm/players/player_apple2.h
  A engines/scumm/players/player_mac.cpp
  A engines/scumm/players/player_mac.h
  A engines/scumm/players/player_mod.cpp
  A engines/scumm/players/player_mod.h
  A engines/scumm/players/player_nes.cpp
  A engines/scumm/players/player_nes.h
  A engines/scumm/players/player_pce.cpp
  A engines/scumm/players/player_pce.h
  A engines/scumm/players/player_sid.cpp
  A engines/scumm/players/player_sid.h
  A engines/scumm/players/player_towns.cpp
  A engines/scumm/players/player_towns.h
  A engines/scumm/players/player_v1.cpp
  A engines/scumm/players/player_v1.h
  A engines/scumm/players/player_v2.cpp
  A engines/scumm/players/player_v2.h
  A engines/scumm/players/player_v2a.cpp
  A engines/scumm/players/player_v2a.h
  A engines/scumm/players/player_v2base.cpp
  A engines/scumm/players/player_v2base.h
  A engines/scumm/players/player_v2cms.cpp
  A engines/scumm/players/player_v2cms.h
  A engines/scumm/players/player_v3a.cpp
  A engines/scumm/players/player_v3a.h
  A engines/scumm/players/player_v3m.cpp
  A engines/scumm/players/player_v3m.h
  A engines/scumm/players/player_v4a.cpp
  A engines/scumm/players/player_v4a.h
  A engines/scumm/players/player_v5m.cpp
  A engines/scumm/players/player_v5m.h
  A engines/sky/POTFILES
  A engines/sky/configure.engine
  A engines/sword1/POTFILES
  A engines/sword1/configure.engine
  A engines/sword2/POTFILES
  A engines/sword2/configure.engine
  A engines/sword25/configure.engine
  A engines/teenagent/POTFILES
  A engines/teenagent/configure.engine
  A engines/testbed/configure.engine
  A engines/tinsel/POTFILES
  A engines/tinsel/configure.engine
  A engines/toltecs/POTFILES
  A engines/toltecs/configure.engine
  A engines/tony/configure.engine
  A engines/toon/configure.engine
  A engines/touche/configure.engine
  A engines/tsage/configure.engine
  A engines/tucker/configure.engine
  A engines/voyeur/configure.engine
  A engines/wintermute/configure.engine
  A engines/wintermute/graphics/transform_struct.cpp
  A engines/wintermute/graphics/transform_struct.h
  A engines/wintermute/graphics/transform_tools.cpp
  A engines/wintermute/graphics/transform_tools.h
  A engines/wintermute/math/floatpoint.h
  A engines/zvision/animation/rlf_animation.cpp
  A engines/zvision/animation/rlf_animation.h
  A engines/zvision/archives/zfs_archive.cpp
  A engines/zvision/archives/zfs_archive.h
  A engines/zvision/configure.engine
  A engines/zvision/core/console.cpp
  A engines/zvision/core/console.h
  A engines/zvision/core/events.cpp
  A engines/zvision/core/menu.h
  A engines/zvision/core/save_manager.cpp
  A engines/zvision/core/save_manager.h
  A engines/zvision/cursors/cursor.cpp
  A engines/zvision/cursors/cursor.h
  A engines/zvision/cursors/cursor_manager.cpp
  A engines/zvision/cursors/cursor_manager.h
  A engines/zvision/detection.cpp
  A engines/zvision/detection.h
  A engines/zvision/fonts/truetype_font.cpp
  A engines/zvision/fonts/truetype_font.h
  A engines/zvision/graphics/render_manager.cpp
  A engines/zvision/graphics/render_manager.h
  A engines/zvision/graphics/render_table.cpp
  A engines/zvision/graphics/render_table.h
  A engines/zvision/inventory/inventory_manager.h
  A engines/zvision/module.mk
  A engines/zvision/scripting/actions.cpp
  A engines/zvision/scripting/actions.h
  A engines/zvision/scripting/control.cpp
  A engines/zvision/scripting/control.h
  A engines/zvision/scripting/controls/animation_control.cpp
  A engines/zvision/scripting/controls/animation_control.h
  A engines/zvision/scripting/controls/input_control.cpp
  A engines/zvision/scripting/controls/input_control.h
  A engines/zvision/scripting/controls/lever_control.cpp
  A engines/zvision/scripting/controls/lever_control.h
  A engines/zvision/scripting/controls/push_toggle_control.cpp
  A engines/zvision/scripting/controls/push_toggle_control.h
  A engines/zvision/scripting/controls/timer_node.cpp
  A engines/zvision/scripting/controls/timer_node.h
  A engines/zvision/scripting/puzzle.h
  A engines/zvision/scripting/scr_file_handling.cpp
  A engines/zvision/scripting/script_manager.cpp
  A engines/zvision/scripting/script_manager.h
  A engines/zvision/sound/zork_raw.cpp
  A engines/zvision/sound/zork_raw.h
  A engines/zvision/strings/string_manager.cpp
  A engines/zvision/strings/string_manager.h
  A engines/zvision/subtitles/subtitles.h
  A engines/zvision/utility/clock.cpp
  A engines/zvision/utility/clock.h
  A engines/zvision/utility/lzss_read_stream.cpp
  A engines/zvision/utility/lzss_read_stream.h
  A engines/zvision/utility/single_value_container.cpp
  A engines/zvision/utility/single_value_container.h
  A engines/zvision/utility/utility.cpp
  A engines/zvision/utility/utility.h
  A engines/zvision/video/video.cpp
  A engines/zvision/video/zork_avi_decoder.cpp
  A engines/zvision/video/zork_avi_decoder.h
  A engines/zvision/zvision.cpp
  A engines/zvision/zvision.h
  A gui/EventRecorder.cpp
  A gui/EventRecorder.h
  A gui/editrecorddialog.cpp
  A gui/editrecorddialog.h
  A gui/onscreendialog.cpp
  A gui/onscreendialog.h
  A gui/recorderdialog.cpp
  A gui/recorderdialog.h
  A gui/themes/scummmodern/editbtn.bmp
  A gui/themes/scummmodern/editbtn_small.bmp
  A gui/themes/scummmodern/fastreplay.bmp
  A gui/themes/scummmodern/fastreplay_small.bmp
  A gui/themes/scummmodern/stopbtn.bmp
  A gui/themes/scummmodern/stopbtn_small.bmp
  A gui/themes/scummmodern/switchbtn.bmp
  A gui/themes/scummmodern/switchbtn_small.bmp
  A test/common/hash-str.h
  A test/common/huffman.h
  A test/common/rendermode.h
  A test/common/util.h
  A video/codecs/mpeg.cpp
  A video/codecs/mpeg.h
  R audio/softsynth/mt32/AReverbModel.cpp
  R audio/softsynth/mt32/AReverbModel.h
  R audio/softsynth/mt32/DelayReverb.cpp
  R audio/softsynth/mt32/DelayReverb.h
  R audio/softsynth/mt32/FreeverbModel.cpp
  R audio/softsynth/mt32/FreeverbModel.h
  R audio/softsynth/mt32/LegacyWaveGenerator.cpp
  R audio/softsynth/mt32/LegacyWaveGenerator.h
  R audio/softsynth/mt32/freeverb.cpp
  R audio/softsynth/mt32/freeverb.h
  R backends/graphics/opengl/gltexture.cpp
  R backends/graphics/opengl/gltexture.h
  R backends/graphics/opengl/glerrorcheck.cpp
  R backends/platform/bada/application.cpp
  R backends/platform/bada/bada.mk
  R backends/platform/bada/form.cpp
  R backends/platform/bada/form.h
  R backends/platform/bada/README.TXT
  R backends/platform/bada/audio.cpp
  R backends/platform/bada/audio.h
  R backends/platform/bada/fs.cpp
  R backends/platform/bada/fs.h
  R backends/platform/bada/graphics.cpp
  R backends/platform/bada/graphics.h
  R backends/platform/bada/main.cpp
  R backends/platform/bada/missing.cpp
  R backends/platform/bada/portdefs.h
  R backends/platform/bada/sscanf.cpp
  R backends/platform/bada/system.cpp
  R backends/platform/bada/system.h
  R backends/timer/bada/timer.cpp
  R backends/timer/bada/timer.h
  R common/EventRecorder.cpp
  R common/EventRecorder.h
  R common/config-file.cpp
  R common/config-file.h
  R engines/configure.engines
  R engines/engines.mk
  R backends/platform/bada/application.h
  R engines/neverhood/todo.txt
  R engines/plugins_table.h
  R engines/scumm/player_apple2.cpp
  R engines/scumm/player_apple2.h
  R engines/scumm/player_mac.cpp
  R engines/scumm/player_mac.h
  R engines/scumm/player_mod.cpp
  R engines/scumm/player_mod.h
  R engines/scumm/player_nes.cpp
  R engines/scumm/player_nes.h
  R engines/scumm/player_pce.cpp
  R engines/scumm/player_pce.h
  R engines/scumm/player_sid.cpp
  R engines/scumm/player_sid.h
  R engines/scumm/player_towns.cpp
  R engines/scumm/player_towns.h
  R engines/scumm/player_v1.cpp
  R engines/scumm/player_v1.h
  R engines/scumm/player_v2.cpp
  R engines/scumm/player_v2.h
  R engines/scumm/player_v2a.cpp
  R engines/scumm/player_v2a.h
  R engines/scumm/player_v2base.cpp
  R engines/scumm/player_v2base.h
  R engines/scumm/player_v2cms.cpp
  R engines/scumm/player_v2cms.h
  R engines/scumm/player_v3a.cpp
  R engines/scumm/player_v3a.h
  R engines/scumm/player_v3m.cpp
  R engines/scumm/player_v3m.h
  R engines/scumm/player_v4a.cpp
  R engines/scumm/player_v4a.h
  R engines/scumm/player_v5m.cpp
  R engines/scumm/player_v5m.h
  R backends/graphics/opengl/glerrorcheck.h
    .gitignore
    AUTHORS
    Makefile
    Makefile.common
    NEWS
    audio/midiparser.cpp
    audio/midiparser.h
    audio/mixer.cpp
    audio/softsynth/fluidsynth.cpp
    audio/softsynth/mt32.cpp
    audio/softsynth/mt32/BReverbModel.cpp
    audio/softsynth/mt32/BReverbModel.h
    audio/softsynth/mt32/LA32WaveGenerator.cpp
    audio/softsynth/mt32/LA32WaveGenerator.h
    audio/softsynth/mt32/Part.cpp
    audio/softsynth/mt32/Part.h
    audio/softsynth/mt32/Partial.cpp
    audio/softsynth/mt32/Partial.h
    audio/softsynth/mt32/PartialManager.cpp
    audio/softsynth/mt32/PartialManager.h
    audio/softsynth/mt32/Poly.cpp
    audio/softsynth/mt32/Poly.h
    audio/softsynth/mt32/Structures.h
    audio/softsynth/mt32/Synth.cpp
    audio/softsynth/mt32/Synth.h
    audio/softsynth/mt32/TVA.cpp
    audio/softsynth/mt32/TVP.cpp
    audio/softsynth/mt32/Tables.h
    audio/softsynth/mt32/module.mk
    audio/softsynth/mt32/mt32emu.h
    backends/audiocd/audiocd.h
    backends/base-backend.cpp
    backends/events/default/default-events.cpp
    backends/events/sdl/sdl-events.cpp
    backends/fs/abstract-fs.h
    backends/fs/amigaos4/amigaos4-fs.cpp
    backends/graphics/graphics.h
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/openglsdl/openglsdl-graphics.h
    backends/graphics/sdl/sdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/keymapper/keymapper.h
    backends/midi/timidity.cpp
    backends/modular-backend.cpp
    backends/module.mk
    backends/mutex/sdl/sdl-mutex.cpp
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/android.mk
    backends/platform/android/events.cpp
    backends/platform/android/gfx.cpp
    backends/platform/android/org/scummvm/scummvm/MouseHelper.java
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
    backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
    backends/platform/android/texture.cpp
    backends/platform/dc/dc.h
    backends/platform/dc/display.cpp
    backends/platform/dc/selector.cpp
    backends/platform/dc/time.cpp
    backends/platform/ds/arm9/source/dsmain.cpp
    backends/platform/ds/arm9/source/dsmain.h
    backends/platform/ds/arm9/source/osystem_ds.cpp
    backends/platform/ds/arm9/source/osystem_ds.h
    backends/platform/gph/gph-backend.cpp
    backends/platform/iphone/iphone_video.mm
    backends/platform/iphone/osys_main.cpp
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm
    backends/platform/maemo/debian/changelog
    backends/platform/n64/osys_n64.h
    backends/platform/n64/osys_n64_base.cpp
    backends/platform/null/null.cpp
    backends/platform/openpandora/op-backend.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/platform/psp/audio.cpp
    backends/platform/psp/default_display_client.cpp
    backends/platform/psp/osys_psp.cpp
    backends/platform/psp/osys_psp.h
    backends/platform/psp/rtc.cpp
    backends/platform/psp/rtc.h
    backends/platform/sdl/posix/posix.cpp
    backends/platform/sdl/sdl-sys.h
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/sdl.h
    backends/platform/symbian/AdaptAllMMPs.pl
    backends/platform/symbian/BuildPackageUpload_AllVersions.pl
    backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
    backends/platform/symbian/README
    backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
    backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg
    backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
    backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3_split.pkg
    backends/platform/symbian/mmp/scummvm_base.mmp.in
    backends/platform/symbian/mmp/scummvm_kyra.mmp.in
    backends/platform/symbian/mmp/scummvm_mohawk.mmp.in
    backends/platform/symbian/mmp/scummvm_sci.mmp.in
    backends/platform/symbian/src/SymbianOS.cpp
    backends/platform/symbian/src/portdefs.h
    backends/platform/wii/osystem.cpp
    backends/platform/wii/osystem.h
    backends/platform/wii/osystem_gfx.cpp
    backends/platform/wince/wince-sdl.cpp
    backends/timer/default/default-timer.cpp
    backends/vkeybd/virtual-keyboard-gui.cpp
    backends/vkeybd/virtual-keyboard-gui.h
    backends/vkeybd/virtual-keyboard.h
    base/commandLine.cpp
    base/main.cpp
    base/plugins.h
    base/version.cpp
    common/EventDispatcher.cpp
    common/archive.cpp
    common/archive.h
    common/c++11-compat.h
    common/config-manager.h
    common/coroutines.h
    common/cosinetables.cpp
    common/cosinetables.h
    common/dcl.cpp
    common/debug.h
    common/events.h
    common/macresman.cpp
    common/macresman.h
    common/math.h
    common/memstream.h
    common/module.mk
    common/random.cpp
    common/rdft.h
    common/scummsys.h
    common/sinetables.cpp
    common/sinetables.h
    common/str.cpp
    common/str.h
    common/system.cpp
    common/system.h
    common/unarj.cpp
    common/util.h
    common/winexe.cpp
    common/winexe_ne.cpp
    common/winexe_ne.h
    common/zlib.cpp
    configure
    devtools/README
    devtools/convbdf.cpp
    devtools/create_kyradat/create_kyradat.cpp
    devtools/create_kyradat/pak.cpp
    devtools/create_lure/process_actions.cpp
    devtools/create_neverhood/create_neverhood.cpp
    devtools/create_neverhood/module.mk
    devtools/create_neverhood/tables.h
    devtools/create_project/codeblocks.cpp
    devtools/create_project/config.h
    devtools/create_project/create_project.cpp
    devtools/create_project/create_project.h
    devtools/create_project/msbuild.cpp
    devtools/create_project/msbuild.h
    devtools/create_project/msvc.cpp
    devtools/create_project/msvc.h
    devtools/create_project/visualstudio.cpp
    devtools/create_project/visualstudio.h
    devtools/create_project/xcode.cpp
    devtools/create_teenagent/static_tables.h
    devtools/create_translations/create_translations.cpp
    devtools/create_translations/create_translations.h
    devtools/credits.pl
    devtools/scumm-md5.txt
    devtools/skycpt/cptcompiler.cpp
    dists/android/AndroidManifest.xml
    dists/android/AndroidManifest.xml.in
    dists/android/res/layout/main.xml
    dists/engine-data/README
    dists/msvc10/create_msvc10.bat
    dists/msvc11/create_msvc11.bat
    dists/msvc8/create_msvc8.bat
    dists/msvc9/create_msvc9.bat
    dists/redhat/scummvm.spec
    dists/redhat/scummvm.spec.in
    dists/scummvm.rc
    dists/scummvm.rc.in
    engines/advancedDetector.cpp
    engines/advancedDetector.h
    engines/agi/agi.cpp
    engines/agi/detection_tables.h
    engines/agi/loader_v1.cpp
    engines/agi/loader_v2.cpp
    engines/agi/loader_v3.cpp
    engines/agi/opcodes.cpp
    engines/agi/preagi_mickey.cpp
    engines/agi/preagi_troll.cpp
    engines/agi/preagi_winnie.cpp
    engines/agi/wagparser.cpp
    engines/agi/words.cpp
    engines/agos/agos.h
    engines/agos/animation.cpp
    engines/agos/charset-fontdata.cpp
    engines/agos/charset.cpp
    engines/agos/draw.cpp
    engines/agos/event.cpp
    engines/agos/gfx.cpp
    engines/agos/icons.cpp
    engines/agos/menus.cpp
    engines/agos/saveload.cpp
    engines/agos/script_pn.cpp
    engines/agos/verb.cpp
    engines/agos/vga.cpp
    engines/agos/vga_e2.cpp
    engines/agos/vga_pn.cpp
    engines/agos/vga_s2.cpp
    engines/agos/vga_ww.cpp
    engines/agos/window.cpp
    engines/cge/cge.cpp
    engines/cge/cge.h
    engines/cge/cge_main.cpp
    engines/cge/detection.cpp
    engines/cge/snail.cpp
    engines/cge/text.cpp
    engines/cge/vga13h.cpp
    engines/cine/script_fw.cpp
    engines/cine/sound.cpp
    engines/composer/composer.cpp
    engines/composer/composer.h
    engines/composer/graphics.cpp
    engines/cruise/cruise.h
    engines/cruise/detection.cpp
    engines/draci/barchive.cpp
    engines/draci/draci.cpp
    engines/draci/game.cpp
    engines/draci/screen.cpp
    engines/draci/script.cpp
    engines/draci/sprite.cpp
    engines/draci/surface.cpp
    engines/draci/walking.cpp
    engines/draci/walking.h
    engines/drascula/actors.cpp
    engines/drascula/animation.cpp
    engines/drascula/console.cpp
    engines/drascula/converse.cpp
    engines/drascula/detection.cpp
    engines/drascula/drascula.cpp
    engines/drascula/drascula.h
    engines/drascula/graphics.cpp
    engines/drascula/interface.cpp
    engines/drascula/objects.cpp
    engines/drascula/rooms.cpp
    engines/drascula/saveload.cpp
    engines/drascula/sound.cpp
    engines/drascula/talk.cpp
    engines/dreamweb/dreamweb.cpp
    engines/dreamweb/dreamweb.h
    engines/dreamweb/monitor.cpp
    engines/dreamweb/print.cpp
    engines/engine.cpp
    engines/gob/iniconfig.cpp
    engines/gob/iniconfig.h
    engines/gob/surface.cpp
    engines/gob/videoplayer.cpp
    engines/groovie/font.cpp
    engines/groovie/font.h
    engines/groovie/graphics.cpp
    engines/groovie/roq.cpp
    engines/groovie/script.cpp
    engines/groovie/stuffit.cpp
    engines/groovie/vdx.cpp
    engines/hopkins/computer.cpp
    engines/hopkins/computer.h
    engines/hopkins/detection.cpp
    engines/hopkins/detection_tables.h
    engines/hopkins/dialogs.cpp
    engines/hopkins/events.cpp
    engines/hopkins/globals.cpp
    engines/hopkins/graphics.cpp
    engines/hopkins/graphics.h
    engines/hopkins/hopkins.cpp
    engines/hopkins/hopkins.h
    engines/hopkins/lines.cpp
    engines/hopkins/menu.cpp
    engines/hopkins/saveload.cpp
    engines/hopkins/saveload.h
    engines/hopkins/script.cpp
    engines/hopkins/sound.cpp
    engines/hopkins/talk.cpp
    engines/hugo/dialogs.cpp
    engines/hugo/display.cpp
    engines/hugo/file.cpp
    engines/hugo/hugo.cpp
    engines/hugo/hugo.h
    engines/hugo/intro.cpp
    engines/hugo/inventory.cpp
    engines/hugo/mouse.cpp
    engines/hugo/object.cpp
    engines/hugo/parser.cpp
    engines/hugo/route.cpp
    engines/hugo/route.h
    engines/hugo/schedule.cpp
    engines/hugo/sound.cpp
    engines/hugo/text.cpp
    engines/kyra/animator_lok.cpp
    engines/kyra/chargen.cpp
    engines/kyra/gui_mr.cpp
    engines/kyra/kyra_rpg.cpp
    engines/kyra/resource.cpp
    engines/kyra/scene_mr.cpp
    engines/kyra/screen.cpp
    engines/kyra/screen_v2.cpp
    engines/kyra/sequences_lok.cpp
    engines/kyra/sound_towns.cpp
    engines/kyra/text_rpg.cpp
    engines/lastexpress/data/animation.cpp
    engines/lastexpress/data/scene.h
    engines/lastexpress/data/sequence.cpp
    engines/lastexpress/debug.cpp
    engines/lastexpress/entities/entity.h
    engines/lastexpress/entities/servers0.cpp
    engines/lastexpress/entities/verges.cpp
    engines/lastexpress/game/entities.h
    engines/lastexpress/game/inventory.cpp
    engines/lastexpress/game/logic.cpp
    engines/lastexpress/game/logic.h
    engines/lastexpress/game/object.cpp
    engines/lastexpress/game/savegame.h
    engines/lastexpress/game/scenes.cpp
    engines/lastexpress/game/state.h
    engines/lastexpress/graphics.cpp
    engines/lastexpress/lastexpress.cpp
    engines/lure/debugger.cpp
    engines/lure/hotspots.cpp
    engines/lure/menu.cpp
    engines/made/detection.cpp
    engines/made/graphics.cpp
    engines/made/made.cpp
    engines/made/pmvplayer.cpp
    engines/made/screen.cpp
    engines/made/screenfx.cpp
    engines/made/scriptfuncs.cpp
    engines/made/sound.cpp
    engines/mohawk/bitmap.cpp
    engines/mohawk/cstime.cpp
    engines/mohawk/cstime_game.cpp
    engines/mohawk/cstime_ui.cpp
    engines/mohawk/cstime_ui.h
    engines/mohawk/cursors.cpp
    engines/mohawk/livingbooks.cpp
    engines/mohawk/livingbooks.h
    engines/mohawk/livingbooks_lbx.cpp
    engines/mohawk/myst.cpp
    engines/mohawk/myst_stacks/myst.cpp
    engines/mohawk/riven_graphics.cpp
    engines/mohawk/video.cpp
    engines/neverhood/background.cpp
    engines/neverhood/blbarchive.cpp
    engines/neverhood/detection.cpp
    engines/neverhood/diskplayerscene.cpp
    engines/neverhood/diskplayerscene.h
    engines/neverhood/entity.cpp
    engines/neverhood/entity.h
    engines/neverhood/gamemodule.cpp
    engines/neverhood/gamemodule.h
    engines/neverhood/gamevars.cpp
    engines/neverhood/gamevars.h
    engines/neverhood/graphics.cpp
    engines/neverhood/graphics.h
    engines/neverhood/klaymen.cpp
    engines/neverhood/klaymen.h
    engines/neverhood/menumodule.cpp
    engines/neverhood/menumodule.h
    engines/neverhood/microtiles.cpp
    engines/neverhood/module.cpp
    engines/neverhood/module.h
    engines/neverhood/module.mk
    engines/neverhood/modules/module1000.cpp
    engines/neverhood/modules/module1000.h
    engines/neverhood/modules/module1100.cpp
    engines/neverhood/modules/module1100.h
    engines/neverhood/modules/module1200.cpp
    engines/neverhood/modules/module1200.h
    engines/neverhood/modules/module1300.cpp
    engines/neverhood/modules/module1300.h
    engines/neverhood/modules/module1400.cpp
    engines/neverhood/modules/module1400.h
    engines/neverhood/modules/module1500.cpp
    engines/neverhood/modules/module1600.cpp
    engines/neverhood/modules/module1600.h
    engines/neverhood/modules/module1700.cpp
    engines/neverhood/modules/module1700.h
    engines/neverhood/modules/module1800.cpp
    engines/neverhood/modules/module1900.cpp
    engines/neverhood/modules/module1900.h
    engines/neverhood/modules/module2000.cpp
    engines/neverhood/modules/module2000.h
    engines/neverhood/modules/module2100.cpp
    engines/neverhood/modules/module2100.h
    engines/neverhood/modules/module2200.cpp
    engines/neverhood/modules/module2200.h
    engines/neverhood/modules/module2300.cpp
    engines/neverhood/modules/module2400.cpp
    engines/neverhood/modules/module2400.h
    engines/neverhood/modules/module2500.cpp
    engines/neverhood/modules/module2500.h
    engines/neverhood/modules/module2600.cpp
    engines/neverhood/modules/module2600.h
    engines/neverhood/modules/module2700.cpp
    engines/neverhood/modules/module2700.h
    engines/neverhood/modules/module2800.cpp
    engines/neverhood/modules/module2800.h
    engines/neverhood/modules/module2900.cpp
    engines/neverhood/modules/module2900.h
    engines/neverhood/modules/module3000.cpp
    engines/neverhood/modules/module3000.h
    engines/neverhood/mouse.cpp
    engines/neverhood/mouse.h
    engines/neverhood/navigationscene.cpp
    engines/neverhood/navigationscene.h
    engines/neverhood/neverhood.cpp
    engines/neverhood/neverhood.h
    engines/neverhood/palette.cpp
    engines/neverhood/resource.cpp
    engines/neverhood/resource.h
    engines/neverhood/resourceman.cpp
    engines/neverhood/resourceman.h
    engines/neverhood/saveload.cpp
    engines/neverhood/scene.cpp
    engines/neverhood/scene.h
    engines/neverhood/screen.cpp
    engines/neverhood/screen.h
    engines/neverhood/smackerplayer.cpp
    engines/neverhood/smackerplayer.h
    engines/neverhood/smackerscene.cpp
    engines/neverhood/smackerscene.h
    engines/neverhood/sound.cpp
    engines/neverhood/sound.h
    engines/neverhood/sprite.cpp
    engines/neverhood/sprite.h
    engines/neverhood/staticdata.cpp
    engines/parallaction/debug.cpp
    engines/parallaction/disk_br.cpp
    engines/parallaction/disk_ns.cpp
    engines/parallaction/exec.h
    engines/parallaction/exec_ns.cpp
    engines/parallaction/font.cpp
    engines/parallaction/graphics.cpp
    engines/parallaction/graphics.h
    engines/parallaction/gui.h
    engines/parallaction/gui_br.cpp
    engines/parallaction/gui_ns.cpp
    engines/parallaction/input.cpp
    engines/parallaction/input.h
    engines/parallaction/inventory.h
    engines/parallaction/objects.h
    engines/parallaction/parallaction.cpp
    engines/parallaction/parallaction.h
    engines/parallaction/parallaction_br.cpp
    engines/parallaction/parallaction_ns.cpp
    engines/parallaction/parser.h
    engines/parallaction/sound.h
    engines/parallaction/sound_br.cpp
    engines/parallaction/sound_ns.cpp
    engines/pegasus/cursor.cpp
    engines/pegasus/graphics.cpp
    engines/pegasus/neighborhood/caldoria/caldoria.cpp
    engines/pegasus/neighborhood/neighborhood.cpp
    engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
    engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp
    engines/pegasus/neighborhood/norad/delta/globegame.cpp
    engines/pegasus/neighborhood/norad/delta/noraddelta.cpp
    engines/pegasus/neighborhood/norad/norad.cpp
    engines/pegasus/neighborhood/tsa/fulltsa.cpp
    engines/pegasus/neighborhood/tsa/tinytsa.cpp
    engines/pegasus/neighborhood/wsc/wsc.cpp
    engines/pegasus/pegasus.cpp
    engines/pegasus/timers.cpp
    engines/pegasus/transition.cpp
    engines/saga/animation.cpp
    engines/saga/events.cpp
    engines/saga/gfx.h
    engines/saga/introproc_ihnm.cpp
    engines/saga/introproc_ite.cpp
    engines/saga/introproc_saga2.cpp
    engines/saga/music.cpp
    engines/saga/saga.h
    engines/saga/scene.cpp
    engines/saga/shorten.cpp
    engines/saga/sndres.cpp
    engines/saga/sprite.cpp
    engines/sci/console.cpp
    engines/sci/detection.cpp
    engines/sci/detection_tables.h
    engines/sci/engine/features.cpp
    engines/sci/engine/kernel.cpp
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kfile.cpp
    engines/sci/engine/kpathing.cpp
    engines/sci/engine/kstring.cpp
    engines/sci/engine/kvideo.cpp
    engines/sci/engine/savegame.cpp
    engines/sci/engine/savegame.h
    engines/sci/engine/script.cpp
    engines/sci/engine/script.h
    engines/sci/engine/script_patches.cpp
    engines/sci/engine/seg_manager.cpp
    engines/sci/engine/seg_manager.h
    engines/sci/engine/vm.cpp
    engines/sci/engine/vm_types.cpp
    engines/sci/engine/vm_types.h
    engines/sci/engine/workarounds.cpp
    engines/sci/engine/workarounds.h
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/maciconbar.cpp
    engines/sci/graphics/picture.cpp
    engines/sci/graphics/ports.cpp
    engines/sci/graphics/screen.cpp
    engines/sci/resource.h
    engines/sci/sci.cpp
    engines/sci/sci.h
    engines/sci/sound/midiparser_sci.cpp
    engines/sci/sound/midiparser_sci.h
    engines/sci/sound/music.cpp
    engines/sci/sound/music.h
    engines/sci/sound/soundcmd.cpp
    engines/sci/video/robot_decoder.cpp
    engines/sci/video/seq_decoder.cpp
    engines/scumm/actor.cpp
    engines/scumm/akos.cpp
    engines/scumm/base-costume.cpp
    engines/scumm/bomp.cpp
    engines/scumm/charset.cpp
    engines/scumm/costume.cpp
    engines/scumm/cursor.cpp
    engines/scumm/debugger.cpp
    engines/scumm/detection.cpp
    engines/scumm/detection_tables.h
    engines/scumm/gfx.cpp
    engines/scumm/gfx_towns.cpp
    engines/scumm/he/animation_he.cpp
    engines/scumm/he/intern_he.h
    engines/scumm/he/logic/moonbase.cpp
    engines/scumm/he/script_v100he.cpp
    engines/scumm/he/script_v70he.cpp
    engines/scumm/he/script_v72he.cpp
    engines/scumm/he/script_v80he.cpp
    engines/scumm/imuse/imuse.cpp
    engines/scumm/imuse/imuse_internal.h
    engines/scumm/imuse_digi/dimuse.cpp
    engines/scumm/imuse_digi/dimuse_sndmgr.cpp
    engines/scumm/input.cpp
    engines/scumm/insane/insane_enemy.cpp
    engines/scumm/module.mk
    engines/scumm/nut_renderer.cpp
    engines/scumm/object.cpp
    engines/scumm/saveload.cpp
    engines/scumm/saveload.h
    engines/scumm/script_v5.cpp
    engines/scumm/script_v6.cpp
    engines/scumm/scumm-md5.h
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h
    engines/scumm/sound.cpp
    engines/scumm/vars.cpp
    engines/sky/music/musicbase.cpp
    engines/sky/sky.cpp
    engines/sword1/animation.cpp
    engines/sword1/animation.h
    engines/sword1/music.cpp
    engines/sword1/music.h
    engines/sword1/screen.cpp
    engines/sword1/sound.cpp
    engines/sword1/sword1.cpp
    engines/sword2/animation.cpp
    engines/sword2/animation.h
    engines/sword25/fmv/movieplayer.cpp
    engines/sword25/gfx/animation.cpp
    engines/sword25/gfx/animation.h
    engines/sword25/gfx/animationdescription.cpp
    engines/sword25/gfx/animationdescription.h
    engines/sword25/gfx/animationresource.cpp
    engines/sword25/gfx/animationtemplate.cpp
    engines/sword25/gfx/animationtemplateregistry.cpp
    engines/sword25/gfx/bitmap.h
    engines/sword25/gfx/dynamicbitmap.cpp
    engines/sword25/gfx/image/art.cpp
    engines/sword25/gfx/image/image.h
    engines/sword25/gfx/image/imgloader.cpp
    engines/sword25/gfx/image/renderedimage.cpp
    engines/sword25/gfx/image/renderedimage.h
    engines/sword25/gfx/microtiles.cpp
    engines/sword25/gfx/panel.cpp
    engines/sword25/gfx/panel.h
    engines/sword25/gfx/renderobject.cpp
    engines/sword25/gfx/renderobject.h
    engines/sword25/gfx/renderobjectmanager.cpp
    engines/sword25/gfx/screenshot.cpp
    engines/sword25/gfx/staticbitmap.cpp
    engines/sword25/gfx/text.cpp
    engines/sword25/gfx/text.h
    engines/sword25/input/inputengine.cpp
    engines/sword25/kernel/inputpersistenceblock.cpp
    engines/sword25/kernel/inputpersistenceblock.h
    engines/sword25/kernel/objectregistry.h
    engines/sword25/kernel/outputpersistenceblock.cpp
    engines/sword25/kernel/outputpersistenceblock.h
    engines/sword25/kernel/persistenceservice.cpp
    engines/sword25/math/polygon.cpp
    engines/sword25/math/polygon.h
    engines/sword25/math/region.cpp
    engines/sword25/math/regionregistry.cpp
    engines/sword25/math/walkregion.cpp
    engines/sword25/sfx/soundengine.cpp
    engines/sword25/sfx/soundengine.h
    engines/sword25/util/lua/lcode.cpp
    engines/sword25/util/lua/ldebug.cpp
    engines/sword25/util/lua/lfunc.cpp
    engines/sword25/util/lua/lgc.cpp
    engines/sword25/util/lua/llimits.h
    engines/sword25/util/lua/lmem.cpp
    engines/sword25/util/lua/lopcodes.cpp
    engines/sword25/util/lua/lparser.cpp
    engines/sword25/util/lua/lstate.cpp
    engines/sword25/util/lua/lstring.cpp
    engines/sword25/util/lua/lstrlib.cpp
    engines/sword25/util/lua/ltablib.cpp
    engines/sword25/util/lua/lua.h
    engines/sword25/util/pluto/pluto.cpp
    engines/teenagent/callbacks.cpp
    engines/teenagent/dialog.cpp
    engines/teenagent/font.cpp
    engines/teenagent/resources.cpp
    engines/teenagent/scene.cpp
    engines/teenagent/teenagent.cpp
    engines/testbed/config-params.cpp
    engines/testbed/config.cpp
    engines/testbed/config.h
    engines/testbed/events.cpp
    engines/testbed/graphics.cpp
    engines/testbed/midi.cpp
    engines/tinsel/bmv.cpp
    engines/tinsel/detection.cpp
    engines/tinsel/detection_tables.h
    engines/tinsel/graphics.cpp
    engines/tinsel/handle.cpp
    engines/tinsel/music.cpp
    engines/tinsel/rince.cpp
    engines/tinsel/scene.cpp
    engines/tinsel/sound.cpp
    engines/tinsel/tinsel.cpp
    engines/tinsel/tinsel.h
    engines/toltecs/detection.cpp
    engines/toltecs/menu.cpp
    engines/toltecs/render.cpp
    engines/toltecs/saveload.cpp
    engines/toltecs/screen.cpp
    engines/toltecs/script.cpp
    engines/toltecs/segmap.cpp
    engines/toltecs/toltecs.cpp
    engines/tony/detection.cpp
    engines/tony/detection_tables.h
    engines/tony/game.cpp
    engines/tony/gfxcore.cpp
    engines/tony/gfxcore.h
    engines/tony/gfxengine.cpp
    engines/tony/mpal/mpal.cpp
    engines/tony/mpal/mpal.h
    engines/tony/sound.cpp
    engines/tony/window.cpp
    engines/toon/anim.cpp
    engines/toon/audio.cpp
    engines/toon/character.cpp
    engines/toon/character.h
    engines/toon/font.cpp
    engines/toon/movie.cpp
    engines/toon/movie.h
    engines/toon/path.cpp
    engines/toon/picture.cpp
    engines/toon/resource.cpp
    engines/toon/resource.h
    engines/toon/script.cpp
    engines/toon/script_func.cpp
    engines/toon/state.cpp
    engines/toon/tools.cpp
    engines/toon/toon.cpp
    engines/touche/touche.cpp
    engines/touche/touche.h
    engines/tsage/blue_force/blueforce_logic.cpp
    engines/tsage/blue_force/blueforce_logic.h
    engines/tsage/blue_force/blueforce_scenes0.cpp
    engines/tsage/blue_force/blueforce_scenes0.h
    engines/tsage/blue_force/blueforce_scenes1.cpp
    engines/tsage/blue_force/blueforce_scenes2.cpp
    engines/tsage/blue_force/blueforce_scenes3.cpp
    engines/tsage/blue_force/blueforce_scenes3.h
    engines/tsage/blue_force/blueforce_scenes4.cpp
    engines/tsage/blue_force/blueforce_scenes4.h
    engines/tsage/blue_force/blueforce_scenes5.cpp
    engines/tsage/blue_force/blueforce_scenes5.h
    engines/tsage/blue_force/blueforce_scenes6.cpp
    engines/tsage/blue_force/blueforce_scenes7.cpp
    engines/tsage/blue_force/blueforce_scenes8.cpp
    engines/tsage/blue_force/blueforce_scenes8.h
    engines/tsage/blue_force/blueforce_scenes9.cpp
    engines/tsage/blue_force/blueforce_scenes9.h
    engines/tsage/blue_force/blueforce_speakers.cpp
    engines/tsage/blue_force/blueforce_speakers.h
    engines/tsage/converse.cpp
    engines/tsage/converse.h
    engines/tsage/core.cpp
    engines/tsage/core.h
    engines/tsage/debugger.cpp
    engines/tsage/detection.cpp
    engines/tsage/detection_tables.h
    engines/tsage/dialogs.cpp
    engines/tsage/events.cpp
    engines/tsage/events.h
    engines/tsage/globals.cpp
    engines/tsage/globals.h
    engines/tsage/graphics.cpp
    engines/tsage/graphics.h
    engines/tsage/ringworld/ringworld_logic.cpp
    engines/tsage/ringworld/ringworld_scenes1.cpp
    engines/tsage/ringworld/ringworld_scenes1.h
    engines/tsage/ringworld/ringworld_scenes10.cpp
    engines/tsage/ringworld/ringworld_scenes5.cpp
    engines/tsage/ringworld/ringworld_scenes5.h
    engines/tsage/ringworld/ringworld_scenes6.cpp
    engines/tsage/ringworld/ringworld_scenes6.h
    engines/tsage/ringworld/ringworld_scenes8.cpp
    engines/tsage/ringworld/ringworld_scenes8.h
    engines/tsage/ringworld2/ringworld2_dialogs.cpp
    engines/tsage/ringworld2/ringworld2_dialogs.h
    engines/tsage/ringworld2/ringworld2_logic.cpp
    engines/tsage/ringworld2/ringworld2_logic.h
    engines/tsage/ringworld2/ringworld2_scenes0.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.h
    engines/tsage/ringworld2/ringworld2_scenes1.cpp
    engines/tsage/ringworld2/ringworld2_scenes1.h
    engines/tsage/ringworld2/ringworld2_scenes2.cpp
    engines/tsage/ringworld2/ringworld2_scenes2.h
    engines/tsage/ringworld2/ringworld2_scenes3.cpp
    engines/tsage/ringworld2/ringworld2_scenes3.h
    engines/tsage/ringworld2/ringworld2_speakers.cpp
    engines/tsage/ringworld2/ringworld2_speakers.h
    engines/tsage/saveload.cpp
    engines/tsage/saveload.h
    engines/tsage/scenes.cpp
    engines/tsage/sound.cpp
    engines/tsage/sound.h
    engines/tsage/staticres.cpp
    engines/tsage/staticres.h
    engines/tsage/tsage.cpp
    engines/tsage/user_interface.cpp
    engines/tsage/user_interface.h
    engines/tucker/sequences.cpp
    engines/tucker/tucker.cpp
    engines/voyeur/animation.cpp
    engines/voyeur/events.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/wintermute/ad/ad_actor.cpp
    engines/wintermute/ad/ad_actor.h
    engines/wintermute/ad/ad_entity.cpp
    engines/wintermute/ad/ad_entity.h
    engines/wintermute/ad/ad_game.cpp
    engines/wintermute/ad/ad_game.h
    engines/wintermute/ad/ad_inventory.cpp
    engines/wintermute/ad/ad_inventory.h
    engines/wintermute/ad/ad_inventory_box.cpp
    engines/wintermute/ad/ad_inventory_box.h
    engines/wintermute/ad/ad_item.cpp
    engines/wintermute/ad/ad_item.h
    engines/wintermute/ad/ad_layer.cpp
    engines/wintermute/ad/ad_layer.h
    engines/wintermute/ad/ad_node_state.cpp
    engines/wintermute/ad/ad_node_state.h
    engines/wintermute/ad/ad_object.cpp
    engines/wintermute/ad/ad_object.h
    engines/wintermute/ad/ad_path.cpp
    engines/wintermute/ad/ad_path.h
    engines/wintermute/ad/ad_path_point.cpp
    engines/wintermute/ad/ad_path_point.h
    engines/wintermute/ad/ad_region.cpp
    engines/wintermute/ad/ad_region.h
    engines/wintermute/ad/ad_response.cpp
    engines/wintermute/ad/ad_response.h
    engines/wintermute/ad/ad_response_box.cpp
    engines/wintermute/ad/ad_response_box.h
    engines/wintermute/ad/ad_response_context.cpp
    engines/wintermute/ad/ad_response_context.h
    engines/wintermute/ad/ad_rot_level.cpp
    engines/wintermute/ad/ad_rot_level.h
    engines/wintermute/ad/ad_scale_level.cpp
    engines/wintermute/ad/ad_scale_level.h
    engines/wintermute/ad/ad_scene.cpp
    engines/wintermute/ad/ad_scene.h
    engines/wintermute/ad/ad_scene_node.cpp
    engines/wintermute/ad/ad_scene_state.cpp
    engines/wintermute/ad/ad_scene_state.h
    engines/wintermute/ad/ad_sentence.cpp
    engines/wintermute/ad/ad_sentence.h
    engines/wintermute/ad/ad_sprite_set.cpp
    engines/wintermute/ad/ad_sprite_set.h
    engines/wintermute/ad/ad_talk_def.cpp
    engines/wintermute/ad/ad_talk_def.h
    engines/wintermute/ad/ad_talk_holder.cpp
    engines/wintermute/ad/ad_talk_holder.h
    engines/wintermute/ad/ad_talk_node.cpp
    engines/wintermute/ad/ad_talk_node.h
    engines/wintermute/ad/ad_types.h
    engines/wintermute/ad/ad_waypoint_group.cpp
    engines/wintermute/ad/ad_waypoint_group.h
    engines/wintermute/base/base.cpp
    engines/wintermute/base/base.h
    engines/wintermute/base/base_active_rect.cpp
    engines/wintermute/base/base_active_rect.h
    engines/wintermute/base/base_dynamic_buffer.cpp
    engines/wintermute/base/base_dynamic_buffer.h
    engines/wintermute/base/base_engine.cpp
    engines/wintermute/base/base_engine.h
    engines/wintermute/base/base_fader.cpp
    engines/wintermute/base/base_fader.h
    engines/wintermute/base/base_file_manager.cpp
    engines/wintermute/base/base_file_manager.h
    engines/wintermute/base/base_frame.cpp
    engines/wintermute/base/base_frame.h
    engines/wintermute/base/base_game.cpp
    engines/wintermute/base/base_game.h
    engines/wintermute/base/base_game_music.cpp
    engines/wintermute/base/base_game_music.h
    engines/wintermute/base/base_game_settings.cpp
    engines/wintermute/base/base_game_settings.h
    engines/wintermute/base/base_keyboard_state.cpp
    engines/wintermute/base/base_keyboard_state.h
    engines/wintermute/base/base_named_object.cpp
    engines/wintermute/base/base_named_object.h
    engines/wintermute/base/base_object.cpp
    engines/wintermute/base/base_object.h
    engines/wintermute/base/base_parser.cpp
    engines/wintermute/base/base_parser.h
    engines/wintermute/base/base_persistence_manager.cpp
    engines/wintermute/base/base_persistence_manager.h
    engines/wintermute/base/base_point.cpp
    engines/wintermute/base/base_point.h
    engines/wintermute/base/base_quick_msg.cpp
    engines/wintermute/base/base_quick_msg.h
    engines/wintermute/base/base_region.cpp
    engines/wintermute/base/base_region.h
    engines/wintermute/base/base_script_holder.cpp
    engines/wintermute/base/base_script_holder.h
    engines/wintermute/base/base_scriptable.cpp
    engines/wintermute/base/base_scriptable.h
    engines/wintermute/base/base_sprite.cpp
    engines/wintermute/base/base_sprite.h
    engines/wintermute/base/base_string_table.cpp
    engines/wintermute/base/base_string_table.h
    engines/wintermute/base/base_sub_frame.cpp
    engines/wintermute/base/base_sub_frame.h
    engines/wintermute/base/base_surface_storage.cpp
    engines/wintermute/base/base_surface_storage.h
    engines/wintermute/base/base_transition_manager.cpp
    engines/wintermute/base/base_transition_manager.h
    engines/wintermute/base/base_viewport.cpp
    engines/wintermute/base/base_viewport.h
    engines/wintermute/base/file/base_disk_file.cpp
    engines/wintermute/base/file/base_disk_file.h
    engines/wintermute/base/file/base_file.cpp
    engines/wintermute/base/file/base_file.h
    engines/wintermute/base/file/base_file_entry.cpp
    engines/wintermute/base/file/base_file_entry.h
    engines/wintermute/base/file/base_package.cpp
    engines/wintermute/base/file/base_package.h
    engines/wintermute/base/file/base_save_thumb_file.cpp
    engines/wintermute/base/file/base_save_thumb_file.h
    engines/wintermute/base/file/dcpackage.h
    engines/wintermute/base/font/base_font.cpp
    engines/wintermute/base/font/base_font.h
    engines/wintermute/base/font/base_font_bitmap.cpp
    engines/wintermute/base/font/base_font_bitmap.h
    engines/wintermute/base/font/base_font_storage.cpp
    engines/wintermute/base/font/base_font_storage.h
    engines/wintermute/base/font/base_font_truetype.cpp
    engines/wintermute/base/font/base_font_truetype.h
    engines/wintermute/base/gfx/base_image.cpp
    engines/wintermute/base/gfx/base_image.h
    engines/wintermute/base/gfx/base_renderer.cpp
    engines/wintermute/base/gfx/base_renderer.h
    engines/wintermute/base/gfx/base_surface.cpp
    engines/wintermute/base/gfx/base_surface.h
    engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
    engines/wintermute/base/gfx/osystem/base_render_osystem.h
    engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
    engines/wintermute/base/gfx/osystem/base_surface_osystem.h
    engines/wintermute/base/gfx/osystem/render_ticket.cpp
    engines/wintermute/base/gfx/osystem/render_ticket.h
    engines/wintermute/base/particles/part_emitter.cpp
    engines/wintermute/base/particles/part_emitter.h
    engines/wintermute/base/particles/part_force.cpp
    engines/wintermute/base/particles/part_force.h
    engines/wintermute/base/particles/part_particle.cpp
    engines/wintermute/base/particles/part_particle.h
    engines/wintermute/base/save_thumb_helper.cpp
    engines/wintermute/base/save_thumb_helper.h
    engines/wintermute/base/saveload.cpp
    engines/wintermute/base/saveload.h
    engines/wintermute/base/scriptables/dcscript.h
    engines/wintermute/base/scriptables/script.cpp
    engines/wintermute/base/scriptables/script.h
    engines/wintermute/base/scriptables/script_engine.cpp
    engines/wintermute/base/scriptables/script_engine.h
    engines/wintermute/base/scriptables/script_ext_array.cpp
    engines/wintermute/base/scriptables/script_ext_array.h
    engines/wintermute/base/scriptables/script_ext_date.cpp
    engines/wintermute/base/scriptables/script_ext_date.h
    engines/wintermute/base/scriptables/script_ext_file.cpp
    engines/wintermute/base/scriptables/script_ext_file.h
    engines/wintermute/base/scriptables/script_ext_math.cpp
    engines/wintermute/base/scriptables/script_ext_math.h
    engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
    engines/wintermute/base/scriptables/script_ext_mem_buffer.h
    engines/wintermute/base/scriptables/script_ext_object.cpp
    engines/wintermute/base/scriptables/script_ext_object.h
    engines/wintermute/base/scriptables/script_ext_string.cpp
    engines/wintermute/base/scriptables/script_ext_string.h
    engines/wintermute/base/scriptables/script_stack.cpp
    engines/wintermute/base/scriptables/script_stack.h
    engines/wintermute/base/scriptables/script_value.cpp
    engines/wintermute/base/scriptables/script_value.h
    engines/wintermute/base/sound/base_sound.cpp
    engines/wintermute/base/sound/base_sound.h
    engines/wintermute/base/sound/base_sound_buffer.cpp
    engines/wintermute/base/sound/base_sound_buffer.h
    engines/wintermute/base/sound/base_sound_manager.cpp
    engines/wintermute/base/sound/base_sound_manager.h
    engines/wintermute/base/timer.cpp
    engines/wintermute/base/timer.h
    engines/wintermute/coll_templ.h
    engines/wintermute/dcgf.h
    engines/wintermute/dctypes.h
    engines/wintermute/debugger.cpp
    engines/wintermute/debugger.h
    engines/wintermute/detection.cpp
    engines/wintermute/detection_tables.h
    engines/wintermute/graphics/transparent_surface.cpp
    engines/wintermute/graphics/transparent_surface.h
    engines/wintermute/math/math_util.cpp
    engines/wintermute/math/math_util.h
    engines/wintermute/math/matrix4.cpp
    engines/wintermute/math/matrix4.h
    engines/wintermute/math/rect32.h
    engines/wintermute/math/vector2.cpp
    engines/wintermute/math/vector2.h
    engines/wintermute/module.mk
    engines/wintermute/persistent.h
    engines/wintermute/platform_osystem.cpp
    engines/wintermute/platform_osystem.h
    engines/wintermute/system/sys_class.cpp
    engines/wintermute/system/sys_class.h
    engines/wintermute/system/sys_class_registry.cpp
    engines/wintermute/system/sys_class_registry.h
    engines/wintermute/system/sys_instance.cpp
    engines/wintermute/system/sys_instance.h
    engines/wintermute/ui/ui_button.cpp
    engines/wintermute/ui/ui_button.h
    engines/wintermute/ui/ui_edit.cpp
    engines/wintermute/ui/ui_edit.h
    engines/wintermute/ui/ui_entity.cpp
    engines/wintermute/ui/ui_entity.h
    engines/wintermute/ui/ui_object.cpp
    engines/wintermute/ui/ui_object.h
    engines/wintermute/ui/ui_text.cpp
    engines/wintermute/ui/ui_text.h
    engines/wintermute/ui/ui_tiled_image.cpp
    engines/wintermute/ui/ui_tiled_image.h
    engines/wintermute/ui/ui_window.cpp
    engines/wintermute/ui/ui_window.h
    engines/wintermute/utils/crc.cpp
    engines/wintermute/utils/path_util.cpp
    engines/wintermute/utils/path_util.h
    engines/wintermute/utils/string_util.cpp
    engines/wintermute/utils/string_util.h
    engines/wintermute/utils/utils.cpp
    engines/wintermute/utils/utils.h
    engines/wintermute/video/video_player.cpp
    engines/wintermute/video/video_player.h
    engines/wintermute/video/video_theora_player.cpp
    engines/wintermute/video/video_theora_player.h
    engines/wintermute/wintermute.cpp
    engines/wintermute/wintypes.h
    graphics/VectorRenderer.h
    graphics/VectorRendererSpec.cpp
    graphics/VectorRendererSpec.h
    graphics/cursorman.cpp
    graphics/cursorman.h
    graphics/decoders/bmp.cpp
    graphics/decoders/iff.cpp
    graphics/decoders/iff.h
    graphics/decoders/image_decoder.h
    graphics/decoders/jpeg.cpp
    graphics/decoders/jpeg.h
    graphics/decoders/pcx.cpp
    graphics/decoders/pict.cpp
    graphics/decoders/png.cpp
    graphics/decoders/tga.cpp
    graphics/decoders/tga.h
    graphics/font.cpp
    graphics/font.h
    graphics/fonts/bdf.cpp
    graphics/fonts/bdf.h
    graphics/fonts/ttf.cpp
    graphics/fonts/winfont.cpp
    graphics/fonts/winfont.h
    graphics/scaler/thumbnail_intern.cpp
    graphics/surface.cpp
    graphics/surface.h
    graphics/thumbnail.cpp
    graphics/thumbnail.h
    graphics/yuv_to_rgb.cpp
    graphics/yuv_to_rgb.h
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/about.cpp
    gui/browser.h
    gui/browser_osx.mm
    gui/chooser.cpp
    gui/console.cpp
    gui/console.h
    gui/credits.h
    gui/dialog.h
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/launcher.cpp
    gui/launcher.h
    gui/module.mk
    gui/object.cpp
    gui/object.h
    gui/options.cpp
    gui/predictivedialog.cpp
    gui/saveload-dialog.cpp
    gui/themes/default.inc
    gui/themes/scummclassic.zip
    gui/themes/scummclassic/classic_layout.stx
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern.zip
    gui/themes/scummmodern/scummmodern_gfx.stx
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummmodern/scummmodern_layout_lowres.stx
    gui/themes/scummtheme.py
    gui/themes/translations.dat
    gui/widget.cpp
    gui/widgets/editable.cpp
    gui/widgets/editable.h
    gui/widgets/edittext.cpp
    gui/widgets/list.cpp
    po/POTFILES
    po/module.mk
    po/pl_PL.po
    ports.mk
    test/audio/raw.h
    test/common/str.h
    video/avi_decoder.cpp
    video/avi_decoder.h
    video/codecs/cdtoons.cpp
    video/codecs/cinepak.cpp
    video/codecs/codec.h
    video/codecs/indeo3.cpp
    video/codecs/msrle.cpp
    video/codecs/msvideo1.cpp
    video/codecs/qtrle.cpp
    video/codecs/rpza.cpp
    video/codecs/smc.cpp
    video/codecs/truemotion1.cpp
    video/codecs/truemotion1.h
    video/coktel_decoder.cpp
    video/dxa_decoder.cpp
    video/flic_decoder.cpp
    video/module.mk
    video/smk_decoder.cpp
    video/theora_decoder.cpp
    video/video_decoder.cpp
    video/video_decoder.h



diff --cc engines/voyeur/animation.cpp
index 3bcc6cf,0000000..cbd7b0a
mode 100644,000000..100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@@ -1,351 -1,0 +1,351 @@@
 +/* 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 "voyeur/animation.h"
 +#include "common/memstream.h"
 +#include "common/system.h"
 +#include "audio/decoders/raw.h"
 +#include "graphics/surface.h"
 +
 +namespace Video {
 +
 +RL2Decoder::RL2Decoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
 +}
 +
 +RL2Decoder::~RL2Decoder() {
 +	close();
 +}
 +
 +bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 +	close();
 +
 +	// Load basic file information
 +	_header.load(stream);
 +
 +	// Check RL2 magic number
 +	if (!_header.isValid()) {
 +		warning("RL2Decoder::loadStream(): attempted to load non-RL2 data (0x%08X)", _header._signature);
 +		return false;
 +	}
 +
 +	// Add an audio track if sound is present
 +	RL2AudioTrack *audioTrack = NULL;
 +	if (_header._soundRate) {
 +		audioTrack = new RL2AudioTrack(_header, _soundType);
 +		addTrack(audioTrack);
 +	}
 +
 +	// Create a video track
 +	addTrack(new RL2VideoTrack(_header, audioTrack, stream));
 +
 +	return true;
 +}
 +
 +const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const {
 +	const Track *track = getTrack(0);
 +
 +	if (track)
 +		return ((const RL2VideoTrack *)track)->getDirtyRects();
 +
 +	return 0;
 +}
 +
 +void RL2Decoder::clearDirtyRects() {
 +	Track *track = getTrack(0);
 +
 +	if (track)
 +		((RL2VideoTrack *)track)->clearDirtyRects();
 +}
 +
 +void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
 +	Track *track = getTrack(0);
 +
 +	if (track)
 +		((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
 +}
 +
 +/*------------------------------------------------------------------------*/
 +
 +RL2Decoder::RL2FileHeader::RL2FileHeader() {
 +	_frameOffsets = NULL;
 +	_frameSoundSizes = NULL;
 +}
 +
 +RL2Decoder::RL2FileHeader::~RL2FileHeader() {
 +	delete[] _frameOffsets;
 +	_frameSoundSizes;
 +}
 +
 +void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
 +	stream->seek(0);
 +
 +	_form = stream->readUint32LE();
 +	_backSize = stream->readUint32LE();
 +	_signature = stream->readUint32LE();
 +
 +	if (!isValid())
 +		return;
 +
 +	_dataSize = stream->readUint32LE();
 +	_numFrames = stream->readUint32LE();
 +	_method = stream->readUint16LE();
 +	_soundRate = stream->readUint16LE();
 +	_rate = stream->readUint16LE();
 +	_channels = stream->readUint16LE();
 +	_defSoundSize = stream->readUint16LE();
 +	_videoBase = stream->readUint16LE();
 +	_colorCount = stream->readUint32LE();
 +	assert(_colorCount <= 256);
 +
 +	stream->read(_palette, 768);
 +
 +	// Skip over background frame, if any, and the list of overall frame sizes (which we don't use)
 +	stream->skip(_backSize + 4 * _numFrames);
 +
 +	// Load frame offsets
 +	_frameOffsets = new uint32[_numFrames];
 +	for (int i = 0; i < _numFrames; ++i)
 +		_frameOffsets[i] = stream->readUint32LE();
 +
 +	// Load the size of the sound portion of each frame
 +	_frameSoundSizes = new int[_numFrames];
 +	for (int i = 0; i < _numFrames; ++i)
 +		_frameSoundSizes[i] = stream->readUint32LE() & 0xffff;
 +}
 +
 +bool RL2Decoder::RL2FileHeader::isValid() const {
 +	return _signature == MKTAG('R','L','V','2') || _signature != MKTAG('R','L','V','3');
 +}
 +
 +/*------------------------------------------------------------------------*/
 +
 +RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack, 
 +		Common::SeekableReadStream *stream): 
 +		_header(header), _audioTrack(audioTrack), _fileStream(stream) {
 +
 +	// Calculate the frame rate
 +	int fps = (header._soundRate > 0) ? header._rate / header._defSoundSize : 11025 / 1103;
 +	_frameDelay = 1000 / fps;
 +
 +	_surface = new Graphics::Surface();
 +	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 +	if (header._backSize == 0) {
 +		_backSurface = NULL;
 +	} else {
 +		_backSurface = new Graphics::Surface();
 +		_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 +
 +		stream->seek(0x324);
 +		rl2DecodeFrameWithoutBackground(0);
 +	}
 +
 +	_videoBase = header._videoBase;
 +	_dirtyPalette = true;
 +
 +	_curFrame = 0;
 +	_nextFrameStartTime = 0;
 +}
 +
 +RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
 +	delete _fileStream;
 +
 +	_surface->free();
 +	delete _surface;
 +	if (_backSurface) {
 +		_backSurface->free();
 +		delete _backSurface;
 +	}
 +}
 +
 +bool RL2Decoder::RL2VideoTrack::endOfTrack() const {
 +	return getCurFrame() >= getFrameCount();
 +}
 +
 +bool RL2Decoder::RL2VideoTrack::rewind() {
 +	_curFrame = 0;
 +	_nextFrameStartTime = 0;
 +
 +	return true;
 +}
 +
 +uint16 RL2Decoder::RL2VideoTrack::getWidth() const {
 +	return _surface->w;
 +}
 +
 +uint16 RL2Decoder::RL2VideoTrack::getHeight() const {
 +	return _surface->h;
 +}
 +
 +Graphics::PixelFormat RL2Decoder::RL2VideoTrack::getPixelFormat() const {
 +	return _surface->format;
 +}
 +
 +const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 +	if (_curFrame == 0 && _backSurface) {
 +		// Read in the background frame
 +		_fileStream->seek(0x324);
 +		rl2DecodeFrameWithoutBackground(0);
 +		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
 +	}
 +
 +	// Move to the next frame data
 +	_fileStream->seek(_header._frameOffsets[_curFrame]);
 +
 +	// If there's any sound data, pass it to the audio track
 +	if (_header._frameSoundSizes[_curFrame] > 0 && _audioTrack)
 +		_audioTrack->queueSound(_fileStream, _header._frameSoundSizes[_curFrame]);
 +
 +	// Decode the graphic data
 +	if (_backSurface) 
 +		rl2DecodeFrameWithBackground();
 +	else
 +		rl2DecodeFrameWithoutBackground();
 +
 +	_curFrame++;
 +	_nextFrameStartTime += _frameDelay;
 +
 +	return _surface;
 +}
 +
 +void RL2Decoder::RL2VideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
 +	for (Common::List<Common::Rect>::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
 +		for (int y = (*it).top; y < (*it).bottom; ++y) {
 +			const int x = (*it).left;
- 			memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x);
++			memcpy(dst + y * pitch + x, (byte *)_surface->getPixels() + y * getWidth() + x, (*it).right - x);
 +		}
 +	}
 +
 +	clearDirtyRects();
 +}
 +
 +void RL2Decoder::RL2VideoTrack::copyFrame(uint8 *data) {
- 	memcpy((byte *)_surface->pixels, data, getWidth() * getHeight());
++	memcpy((byte *)_surface->getPixels(), data, getWidth() * getHeight());
 +
 +	// Redraw
 +	_dirtyRects.clear();
 +	_dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight()));
 +}
 +
 +void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutBackground(int screenOffset) {
 +	if (screenOffset == -1)
 +		screenOffset = _videoBase;
- 	byte *destP = (byte *)_surface->pixels + screenOffset;
++	byte *destP = (byte *)_surface->getPixels() + screenOffset;
 +	int frameSize = _surface->w * _surface->h - screenOffset;
 +
 +	while (frameSize > 0) {
 +		byte nextByte = _fileStream->readByte();
 +
 +		if (nextByte < 0x80) {
 +			*destP++ = nextByte;
 +			--frameSize;
 +		} else if (nextByte == 0x80) {
 +			int runLength = _fileStream->readByte();
 +			if (runLength == 0)
 +				return;
 +
 +			runLength = MIN(runLength, frameSize);
 +			Common::fill(destP, destP + runLength, 0);
 +			destP += runLength;
 +			frameSize -= runLength;
 +		} else {
 +			int runLength = _fileStream->readByte();
 +			
 +			runLength = MIN(runLength, frameSize);
 +			Common::fill(destP, destP + runLength, nextByte & 0x7f);
 +			destP += runLength;
 +			frameSize -= runLength;
 +		}
 +	}
 +}
 +
 +void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
 +	int screenOffset = _videoBase;
 +	int frameSize = _surface->w * _surface->h - _videoBase;
- 	byte *src = (byte *)_backSurface->pixels;
- 	byte *dest = (byte *)_surface->pixels;
++	byte *src = (byte *)_backSurface->getPixels();
++	byte *dest = (byte *)_surface->getPixels();
 +
 +	while (frameSize > 0) {
 +		byte nextByte = _fileStream->readByte();
 +
 +		if (nextByte == 0) {
 +			dest[screenOffset] = src[screenOffset];
 +			++screenOffset;
 +			--frameSize;
 +		} else if (nextByte < 0x80) {
 +			dest[screenOffset] = nextByte | 0x80;
 +			++screenOffset;
 +			--frameSize;
 +		} else if (nextByte == 0x80) {
 +			byte runLength = _fileStream->readByte();
 +			if (runLength == 0)
 +				return;
 +
 +			assert(runLength <= frameSize);
 +			Common::copy(src + screenOffset, src + screenOffset + runLength, dest);
 +			screenOffset += runLength;
 +			frameSize -= runLength;
 +		} else {
 +			byte runLength = _fileStream->readByte();
 +			
 +			assert(runLength <= frameSize);
 +			Common::fill(dest + screenOffset, dest + screenOffset + runLength, nextByte & 0x7f);
 +			screenOffset += runLength;
 +			frameSize -= runLength;
 +		}
 +	}
 +}
 +
 +/*------------------------------------------------------------------------*/
 +
 +RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Audio::Mixer::SoundType soundType): 
 +		_header(header), _soundType(soundType) {
 +	_audStream = createAudioStream();
 +}
 +
 +RL2Decoder::RL2AudioTrack::~RL2AudioTrack() {
 +	delete _audStream;
 +}
 +
 +void RL2Decoder::RL2AudioTrack::queueSound(Common::SeekableReadStream *stream, int size) {
 +	if (_audStream) {
 +		// Queue the sound data
 +		byte *data = (byte *)malloc(size);
 +		stream->read(data, size);
 +		Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
 +			DisposeAfterUse::YES);
 +
 +		_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
 +			Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
 +	} else {
 +		delete stream;
 +	}
 +}
 +
 +Audio::AudioStream *RL2Decoder::RL2AudioTrack::getAudioStream() const {
 +	return _audStream;
 +}
 +
 +Audio::QueuingAudioStream *RL2Decoder::RL2AudioTrack::createAudioStream() {
 +	return Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2);
 +}
 +
 +} // End of namespace Video
diff --cc engines/voyeur/configure.engine
index 0000000,0000000..647e202
new file mode 100644
--- /dev/null
+++ b/engines/voyeur/configure.engine
@@@ -1,0 -1,0 +1,3 @@@
++# This file is included from the main "configure" script
++# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
++add_engine voyeur "Voyeur" yes
diff --cc engines/voyeur/events.cpp
index 6bd0012,0000000..56b7afd
mode 100644,000000..100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@@ -1,379 -1,0 +1,379 @@@
 +/* 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 "voyeur/events.h"
 +#include "voyeur/voyeur.h"
 +#include "graphics/cursorman.h"
 +#include "graphics/palette.h"
 +
 +namespace Voyeur {
 +
 +IntNode::IntNode() {
 +	_intFunc = NULL;
 +	_curTime = 0;
 +	_timeReset = 0;
 +	_flags = 0;
 +}
 +
 +IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 +	_intFunc = NULL;
 +	_curTime = curTime;
 +	_timeReset = timeReset;
 +	_flags = flags;
 +}
 +
 +/*------------------------------------------------------------------------*/
 +
 +EventsManager::EventsManager(): _intPtr(_gameData),
 +		_fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) {
 +	_cycleStatus = 0;
 +	_mouseButton = 0;
 +	_fadeStatus = 0;
 +	_priorFrameTime = g_system->getMillis();
 +	Common::fill(&_keyState[0], &_keyState[256], false);
 +}
 +
 +void EventsManager::resetMouse() {
 +	// No implementation
 +}
 +
 +void EventsManager::startMainClockInt() {
 +	_mainIntNode._intFunc = &EventsManager::mainVoyeurIntFunc;
 +	_mainIntNode._flags = 0;
 +	_mainIntNode._curTime = 0;
 +	_mainIntNode._timeReset = _vm->_graphicsManager._palFlag ? 50 : 60;
 +}
 +
 +void EventsManager::mainVoyeurIntFunc() {
 +	// TODO
 +}
 +
 +void EventsManager::vStopCycle() {
 +	_cycleIntNode._flags = 1;
 +	_cycleStatus &= 2;
 +}
 +
 +void EventsManager::sWaitFlip() {
 +	while (_gameData._flipWait && !_vm->shouldQuit()) {
 +		pollEvents();
 +		g_system->delayMillis(10);
 +	}
 +
 +	Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries;
 +	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
 +		ViewPortResource &viewPort = *viewPorts[idx];
 +
 +		if (_vm->_graphicsManager._saveBack && (viewPort._flags & DISPFLAG_40)) {
 +			Common::Rect *clipPtr = _vm->_graphicsManager._clipPtr;
 +			_vm->_graphicsManager._clipPtr = &viewPort._clipRect;
 +
 +			if (viewPort._restoreFn)
 +				(_vm->_graphicsManager.*viewPort._restoreFn)(&viewPort);
 +
 +			_vm->_graphicsManager._clipPtr = clipPtr;
 +			viewPort._rectListCount[viewPort._pageIndex] = 0;
 +			viewPort._rectListPtr[viewPort._pageIndex]->clear();
 +			viewPort._flags &= ~DISPFLAG_40;
 +		}
 +	}
 +}
 +
 +void EventsManager::checkForNextFrameCounter() {
 +	// Check for next game frame
 +	uint32 milli = g_system->getMillis();
 +	if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
 +		++_gameCounter;
 +		_priorFrameTime = milli;
 +
 +		// Run the timer-based updates
 +		voyeurTimer();
 +
 +		// Display the frame
- 		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.pixels, 
++		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.getPixels(), 
 +			SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 +		g_system->updateScreen();
 +
 +		// Signal the ScummVM debugger
 +		_vm->_debugger.onFrame();
 +	}
 +}
 +
 +void EventsManager::voyeurTimer() {
 +	_gameData.field22 += _gameData.field24;
 +	_gameData.field1A += _gameData.field1E;
 +	// _gameData.field1C += _gameData._timerFn; *** WHY INC field by a function pointer?!
 +
 +	_gameData.field16 = 0;
 +	_gameData.field3D = 1;
 +
 +	if (--_gameData.field26 <= 0) {
 +		if (_gameData._flipWait) {
 +			_gameData.field38 = 1;
 +			_gameData._flipWait = false;
 +			_gameData.field3B = 0;
 +		}
 +
 +		_gameData.field26 >>= 8;
 +	}
 +
 +	videoTimer();
 +
 +	// Iterate through the list of registered nodes
 +	Common::List<IntNode *>::iterator i;
 +	for (i = _intNodes.begin(); i != _intNodes.end(); ++i) {
 +		IntNode &node = **i;
 +
 +		if (node._flags & 1)
 +			continue;
 +		if (!(node._flags & 2)) {
 +			if (--node._curTime != 0)
 +				continue;
 +
 +			node._curTime = node._timeReset;
 +		}
 +
 +		(this->*node._intFunc)();
 +	}
 +}
 +
 +void EventsManager::videoTimer() {
 +	if (_gameData._hasPalette) {
 +		_gameData._hasPalette = false;
 +
 +		g_system->getPaletteManager()->setPalette(_gameData._palette,
 +			_gameData._palStartIndex, 
 +			_gameData._palEndIndex - _gameData._palStartIndex + 1);
 +	}
 +}
 +
 +void EventsManager::delay(int cycles) {
 +	uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE;
 +	uint32 delayEnd = g_system->getMillis() + totalMilli;
 +
 +	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) {
 +		g_system->delayMillis(10);
 +
 +		pollEvents();
 +	}
 +}
 +
 +void EventsManager::pollEvents() {
 +	checkForNextFrameCounter();
 +
 +	Common::Event event;
 +	while (g_system->getEventManager()->pollEvent(event)) {
 +		// Handle keypress
 +		switch (event.type) {
 +		case Common::EVENT_QUIT:
 +		case Common::EVENT_RTL:
 +			return;
 +
 +		case Common::EVENT_KEYDOWN:
 +			_keyState[(byte)toupper(event.kbd.ascii)] = true;
 +			return;
 +		case Common::EVENT_KEYUP:
 +			_keyState[(byte)toupper(event.kbd.ascii)] = false;
 +			return;
 +		case Common::EVENT_LBUTTONDOWN:
 +			_mouseButton = 1;
 +			_vm->_voy._incriminate = true;
 +			return;
 +		case Common::EVENT_RBUTTONDOWN:
 +			_mouseButton = 2;
 +			return;
 +		case Common::EVENT_LBUTTONUP:
 +		case Common::EVENT_RBUTTONUP:
 +			_vm->_voy._incriminate = false;
 +			_mouseButton = 0;
 +			return;
 +		case Common::EVENT_MOUSEMOVE:
 +			_mousePos = event.mouse;
 +			break;
 +		default:
 + 			break;
 +		}
 +	}
 +}
 +
 +void EventsManager::startFade(CMapResource *cMap) {
 +	_fadeIntNode._flags |= 1;
 +	if (_cycleStatus & 1)
 +		_cycleIntNode._flags |= 1;
 +
 +	_fadeFirstCol = cMap->_start;
 +	_fadeLastCol = cMap->_end;
 +	_fadeCount = cMap->_steps + 1;
 +
 +	if (cMap->_steps > 0) {
 +		_fadeStatus = cMap->_fadeStatus | 1;
 +		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
 +		int mapIndex = 0;
 +
 +		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
 +			ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[idx];
 +			palEntry._rEntry = vgaP[0] << 8;
 +			int rDiff = (cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry;
 +			palEntry._rChange = rDiff / cMap->_steps;
 +
 +			palEntry._gEntry = vgaP[1] << 8;
 +			int gDiff = (cMap->_entries[mapIndex * 3 + 1] << 8) - palEntry._gEntry;
 +			palEntry._gChange = gDiff / cMap->_steps;
 +
 +			palEntry._bEntry = vgaP[2] << 8;
 +			int bDiff = (cMap->_entries[mapIndex * 3 + 2] << 8) - palEntry._bEntry;
 +			palEntry._bChange = bDiff / cMap->_steps;
 +			
 +			palEntry._palIndex = idx;
 +			if (!(cMap->_fadeStatus & 1))
 +				++mapIndex;
 +		}
 +
 +		if (cMap->_fadeStatus & 2)
 +			_intPtr.field3B = 1;
 +		_fadeIntNode._flags &= ~1;
 +	} else {
 +		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
 +		int mapIndex = 0;
 +
 +		for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
 +			Common::copy(&cMap->_entries[mapIndex], &cMap->_entries[mapIndex + 3], vgaP);
 +
 +			if (!(cMap->_fadeStatus & 1))
 +				mapIndex += 3;
 +		}
 +
 +		if (_intPtr._palStartIndex > _fadeFirstCol)
 +			_intPtr._palStartIndex = _fadeFirstCol;
 +		if (_intPtr._palEndIndex < _fadeLastCol)
 +			_intPtr._palEndIndex = _fadeLastCol;
 +
 +		_intPtr._hasPalette = true;
 +		if (!(cMap->_fadeStatus & 2))
 +			_intPtr.field38 = 1;
 +	}
 +
 +	if (_cycleStatus & 1)
 +		_cycleIntNode._flags &= ~1;
 +}
 +
 +void EventsManager::addIntNode(IntNode *node) {
 +	_intNodes.push_back(node);
 +}
 +
 +void EventsManager::addFadeInt() {
 +	IntNode &node = _fade2IntNode;
 +	node._intFunc = &EventsManager::fadeIntFunc;
 +	node._flags = 0;
 +	node._curTime = 0;
 +	node._timeReset = 1;
 +
 +	addIntNode(&node);
 +}
 +
 +void EventsManager::vDoFadeInt() {
 +	if (_intPtr.field3B & 1)
 +		return;
 +	if (--_fadeCount == 0) {
 +		_fadeIntNode._flags |= 1;
 +		_fadeStatus &= ~1;
 +	}
 +
 +
 +	for (int i = _fadeFirstCol; i <= _fadeLastCol; ++i) {
 +		ViewPortPalEntry &palEntry = _vm->_graphicsManager._viewPortListPtr->_palette[i];
 +		byte *vgaP = &_vm->_graphicsManager._VGAColors[palEntry._palIndex * 3];
 +
 +		palEntry._rEntry += palEntry._rChange;
 +		palEntry._gEntry += palEntry._gChange;
 +		palEntry._bEntry += palEntry._bChange;
 +
 +		vgaP[0] = palEntry._rEntry >> 8;
 +		vgaP[1] = palEntry._gEntry >> 8;
 +		vgaP[2] = palEntry._bEntry >> 8;
 +	}
 +
 +	if (_intPtr._palStartIndex > _fadeFirstCol)
 +		_intPtr._palStartIndex = _fadeFirstCol;
 +	if (_intPtr._palEndIndex < _fadeLastCol)
 +		_intPtr._palEndIndex = _fadeLastCol;
 +
 +	_intPtr._hasPalette = true;
 +	_intPtr.field38 = 1;
 +}
 +
 +void EventsManager::vDoCycleInt() {
 +	// TODO: more
 +}
 +
 +
 +void EventsManager::fadeIntFunc() {
 +	// TODO: more
 +}
 +
 +void EventsManager::vInitColor() {
 +	_fadeIntNode._intFunc = &EventsManager::vDoFadeInt;
 +	_cycleIntNode._intFunc = &EventsManager::vDoCycleInt;
 +
 +	addIntNode(&_fadeIntNode);
 +	addIntNode(&_cycleIntNode);
 +}
 +
 +void EventsManager::setCursor(PictureResource *pic) {
 +	PictureResource cursor;
 +	cursor._bounds = pic->_bounds;
 +	cursor._flags = DISPFLAG_CURSOR;
 +
 +	_vm->_graphicsManager.sDrawPic(pic, &cursor, Common::Point());
 +}
 +
 +void EventsManager::setCursor(byte *cursorData, int width, int height) {
 +	CursorMan.replaceCursor(cursorData, width, height, 0, 0, 0);
 +}
 +
 +void EventsManager::setCursorColor(int idx, int mode) {
 +	switch (mode) {
 +	case 0:
 +		_vm->_graphicsManager.setColor(idx, 90, 90, 232);
 +		break;
 +	case 1:
 +		_vm->_graphicsManager.setColor(idx, 232, 90, 90);
 +		break;
 +	case 2:
 +		_vm->_graphicsManager.setColor(idx, 90, 232, 90);
 +		break;
 +	case 3:
 +		_vm->_graphicsManager.setColor(idx, 90, 232, 232);
 +		break;
 +	default:
 +		break;
 +	}
 +}
 +
 +void EventsManager::mouseOn() {
 +	CursorMan.showMouse(true);
 +}
 +
 +void EventsManager::mouseOff() {
 +	CursorMan.showMouse(false);
 +}
 +
 +} // End of namespace Voyeur
diff --cc engines/voyeur/graphics.cpp
index 6e3ed10,0000000..3a37eb9
mode 100644,000000..100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@@ -1,648 -1,0 +1,648 @@@
 +/* 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 "voyeur/graphics.h"
 +#include "voyeur/game.h"
 +#include "voyeur/voyeur.h"
 +#include "engines/util.h"
 +#include "graphics/palette.h"
 +#include "graphics/surface.h"
 +
 +namespace Voyeur {
 +
 +/*------------------------------------------------------------------------*/
 +
 +DrawInfo::DrawInfo(int penColor, const Common::Point &pos, int flags) {
 +	_penColor = penColor;
 +	_pos = pos;
 +	_flags = flags;
 +}
 +
 +/*------------------------------------------------------------------------*/
 +
 +GraphicsManager::GraphicsManager():
 +		_defaultDrawInfo(1, Common::Point(), 0),
 +			_drawPtr(&_defaultDrawInfo) {
 +	_SVGAPage = 0;
 +	_SVGAMode = 0;
 +	_SVGAReset = 0;
 +	_screenOffset = 0;
 +	_planeSelect = 0;
 +	_sImageShift = 3;
 +	_palFlag = false;
 +	_MCGAMode = false;
 +	_saveBack = true;
 +	_drawTextPermFlag = false;
 +	_clipPtr = NULL;
 +	_viewPortListPtr = NULL;
 +	_backgroundPage = NULL;
 +	_vPort = NULL;
 +	_fontPtr = NULL;
 +}
 +
 +void GraphicsManager::sInitGraphics() {
 +	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false);
 +	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT,
 +		Graphics::PixelFormat::createFormatCLUT8());
 +
 +	clearPalette();
 +}
 +
 +GraphicsManager::~GraphicsManager() {
 +	_screenSurface.free();
 +}
 +
 +void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 +	_MCGAMode = true;
 +
 +	if (viewPort->_activePage) {
 +		viewPort->_activePage->_flags |= 1;
 +		Common::Rect *clipRect = _clipPtr;
 +		_clipPtr = &viewPort->_clipRect;
 +
 +		sDrawPic(viewPort->_activePage, viewPort->_currentPic, Common::Point());
 +
 +		_clipPtr = clipRect;
 +	}
 +
 +	viewPort->_rectListCount[1] = -1;
 +}
 +
 +void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
 +	int count1, count2;
 +	int idx1, varE, var24;
 +
 +	if (viewPort->_rectListCount[idx] == -1)
 +		return;
 +
 +	// TODO: Lots of code in original, which I suspect may be overlapping rect merging
 +	viewPort->_rectListPtr[idx]->push_back(bounds);
 +	++viewPort->_rectListCount[idx];
 +}
 +
 +void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
 +	if (viewPort->_rectListCount[0] != -1) {
 +		for (int i = 0; i < viewPort->_rectListCount[0]; ++i) {
 +			addRectOptSaveRect(viewPort, 1, (*viewPort->_rectListPtr[0])[i]);
 +		}
 +	} else {
 +		viewPort->_rectListCount[1] = -1;
 +	}
 +
 +	restoreBack(*viewPort->_rectListPtr[1], viewPort->_rectListCount[1], viewPort->_pages[0],
 +		viewPort->_pages[1]);
 +	
 +	int count = viewPort->_rectListCount[0];
 +	restoreBack(*viewPort->_rectListPtr[0], viewPort->_rectListCount[0], 
 +		viewPort->_activePage, viewPort->_currentPic);
 +
 +	SWAP(viewPort->_rectListPtr[0], viewPort->_rectListPtr[1]);
 +	viewPort->_rectListCount[1] = count;
 +}
 +
 +void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
 +	// TODO: more
 +}
 +
 +void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
 +		const Common::Point &initialOffset) {
 +	int var4C = 0;
 +	int width1, width2;
 +	int widthDiff, widthDiff2;
 +	int height1;
 +	int srcOffset;
 +	int screenOffset;
 +	int srcFlags, destFlags;
 +	ViewPortResource *destViewPort = NULL;
 +	Common::Rect newBounds;
 +	Common::Rect backBounds;
 +	int var24;
 +	bool isClipped = false;
 +	int var52;
 +	int var20, var22;
 +	int var26, var2C;
 +	byte pixel;
 +
 +	byte *srcImgData, *destImgData;
 +	byte *srcP, *destP;
 +	byte byteVal, byteVal2;
 +
 +	// Get the picture parameters, or deference viewport pointers to get their pictures
 +	PictureResource *srcPic = (PictureResource *)srcDisplay;
 +	PictureResource *destPic = (PictureResource *)destDisplay;
 +
 +	if (srcDisplay->_flags & DISPFLAG_VIEWPORT) {
 +		// A viewport was passed, not a picture
 +		srcPic = ((ViewPortResource *)srcDisplay)->_currentPic;
 +	}
 +	if (destDisplay->_flags & DISPFLAG_VIEWPORT) {
 +		destViewPort = (ViewPortResource *)destDisplay;
 +		destPic = destViewPort->_currentPic;
 +	}
 +
 +	Common::Point offset = Common::Point(initialOffset.x + srcPic->_bounds.left - destPic->_bounds.left, 
 +		initialOffset.y + srcPic->_bounds.top - destPic->_bounds.top);
 +	width1 = width2 = srcPic->_bounds.width();
 +	height1 = srcPic->_bounds.height();
 +	srcOffset = 0;
 +	srcFlags = srcPic->_flags;
 +	destFlags = destPic->_flags;
 +	byte *cursorData = NULL;
 +
 +	if (srcFlags & 1) {
 +		if (_clipPtr) {
 +			int xs = _clipPtr->left - destPic->_bounds.left;
 +			int ys = _clipPtr->top - destPic->_bounds.top;
 +			newBounds = Common::Rect(xs, ys, xs + _clipPtr->width(), ys + _clipPtr->height());
 +		} else if (destViewPort) {
 +			int xs = destViewPort->_clipRect.left - destPic->_bounds.left;
 +			int ys = destViewPort->_clipRect.top - destPic->_bounds.top;
 +			newBounds = Common::Rect(xs, ys, xs + destViewPort->_clipRect.width(),
 +				ys + destViewPort->_clipRect.height());
 +		} else {
 +			newBounds = Common::Rect(0, 0, destPic->_bounds.width(), destPic->_bounds.height());
 +		}
 +
 +		var24 = offset.y - newBounds.top;
 +		if (var24 < 0) {
 +			var52 = width2;
 +			srcOffset -= var24 * var52;
 +			height1 += var24;
 +			offset.y = newBounds.top;
 +			
 +			if (height1 <= 0)
 +				return;
 +
 +			isClipped = true;
 +		}
 +
 +		var20 = newBounds.bottom - (offset.y + height1);
 +		if (var20 < 0) {
 +			height1 += var20;
 +			if (height1 <= 0)
 +				return;
 +		}
 +
 +		var22 = offset.x - newBounds.left;
 +		if (var22 < 0) {
 +			srcOffset -= var22;
 +			width2 += var22;
 +			offset.x = newBounds.left;
 +
 +			if (width2 <= 0)
 +				return;
 +
 +			isClipped = true;
 +		}
 +
 +		var26 = newBounds.right - (offset.x + width2);
 +		if (var26 < 0) {
 +			width2 += var26;
 +			if (width2 <= 0)
 +				return;
 +
 +			isClipped = true;
 +		}
 +	}
 +
 +	screenOffset = offset.y * destPic->_bounds.width() + offset.x;
 +	widthDiff = width1 - width2;
 +	widthDiff2 = destPic->_bounds.width() - width2;
 +
 +	if (destViewPort) {
 +		if (!_saveBack || ((srcPic->_flags & DISPFLAG_800) != 0)) {
 +			backBounds.left = destPic->_bounds.left + offset.x;
 +			backBounds.top = destPic->_bounds.top + offset.y;
 +			backBounds.setWidth(width2);
 +			backBounds.setHeight(height1);
 +			addRectOptSaveRect(destViewPort, 1, backBounds);
 +
 +		} else if (!destViewPort->_addFn) {
 +			if (destViewPort->_rectListCount[destViewPort->_pageIndex] < -1) {
 +				Common::Rect r;
 +				r.left = destPic->_bounds.left + offset.x;
 +				r.top = destPic->_bounds.top + offset.y;
 +				r.setWidth(width2);
 +				r.setHeight(height1);
 +
 +				(*destViewPort->_rectListPtr[destViewPort->_pageIndex]).push_back(r);
 +				++destViewPort->_rectListCount[destViewPort->_pageIndex];
 +			}
 +		} else {
 +			int xs = offset.x + destPic->_bounds.left;
 +			int ys = offset.y + destPic->_bounds.top;
 +			backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
 +
 +			(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, backBounds);
 +		}
 +	}
 +
 +	if (srcFlags & DISPFLAG_1000) {
 +		srcImgData = srcPic->_imgData + (var4C << 14) + _screenOffset;
 +		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
 +			if (var4C < 4) {
 +				EMSMapPageHandle(srcPic->_planeSize, srcPic->_imgData[idx], var4C);
 +				++var4C;
 +			}
 +		}
 +	} else {
 +		srcImgData = srcPic->_imgData;
 +	}
 +	if (destFlags & DISPFLAG_1000) {
 +		destImgData = destPic->_imgData + (var4C << 14) + _screenOffset;
 +		for (uint idx = 0; idx < srcPic->_maskData; ++idx) {
 +			if (var4C < 4) {
 +				EMSMapPageHandle(destPic->_planeSize, destPic->_imgData[idx], var4C);
 +				++var4C;
 +			}
 +		}		
 +	} else {
 +		destImgData = destPic->_imgData;
 +	}
 +
 +	_SVGAPage = _SVGAReset;
 +	if (srcPic->_select != 0xff)
 +		return;
 +
 +	if (destFlags & DISPFLAG_CURSOR) {
 +		cursorData = new byte[width2 * height1];
 +		Common::fill(cursorData, cursorData + width2 * height1, 0);
 +		destImgData = cursorData;
 +	}
 +
 +	if (srcPic->_pick == 0xff) {
 +		if (srcFlags & DISPFLAG_8) {
 +			error("TODO: sDrawPic");
 +		} else {
 +			// loc_258B8
 +			srcP = srcImgData + srcOffset;
 +
 +			if (destFlags & DISPFLAG_8) {
 +				// loc_258D8
 +				destP = destImgData + screenOffset;
 +
 +				if (srcFlags & DISPFLAG_2) {
 +					// loc_25652
 +					srcP = srcImgData + srcOffset;
 +
 +					if (destFlags & DISPFLAG_8) {
 +						// loc_2566F
 +						if (srcFlags & DISPFLAG_2) {
 +							// loc_256FA
- 							srcP = (byte *)_screenSurface.pixels + srcOffset;
++							srcP = (byte *)_screenSurface.getPixels() + srcOffset;
 +
 +							for (int yp = 0; yp < height1; ++yp) {
 +								for (int xp = 0; xp < width2; ++width2, ++srcP, ++destP) {
 +									pixel = *srcP;
 +									if (pixel)
 +										*destP = pixel;
 +								}
 +
 +								srcP += widthDiff;
 +								destP += widthDiff2;
 +							}
 +						} else {
 +							// loc_25706
 +							for (int yp = 0; yp < height1; ++yp) {
 +								Common::copy(srcP, srcP + width2, destP);
 +								srcP += width2 + widthDiff;
 +								destP += width2 + widthDiff2;
 +							}
 +						}
 +					} else {
 +						// loc_25773
 +						destP = destImgData + screenOffset;
 +
 +						if (srcFlags & DISPFLAG_2) {
 +							// loc_25793
 +							for (int yp = 0; yp < height1; ++yp) {
 +								Common::copy(srcP, srcP + width2, destP);
 +								srcP += width2 + widthDiff;
 +								destP += width2 + widthDiff2;
 +							}
 +						} else {
 +							// loc_25829
- 							destP = (byte *)_screenSurface.pixels + screenOffset;
++							destP = (byte *)_screenSurface.getPixels() + screenOffset;
 +
 +							for (int yp = 0; yp < height1; ++yp) {
 +								Common::copy(srcP, srcP + width2, destP);
 +								srcP += width2 + widthDiff;
 +								destP += width2 + widthDiff2;
 +							}
 +						}
 +					}
 +				} else {
 +					// loc_25D40
 +					if (srcFlags & DISPFLAG_100) {
 +						// loc_25D4A
 +					} else {
 +						// loc_2606D
- 						destP = (byte *)_screenSurface.pixels + screenOffset;
++						destP = (byte *)_screenSurface.getPixels() + screenOffset;
 +
 +						for (int yp = 0; yp < height1; ++yp) {
 +							Common::copy(srcP, srcP + width2, destP);
 +							destP += width2 + widthDiff2;
 +							srcP += width2 + widthDiff;
 +						}
 +					}
 +				}
 +			} else {
 +				// loc_2615E
 +				destP = destImgData + screenOffset;
 +
 +				if (srcFlags & DISPFLAG_2) {
 +					// loc_2617e
 +					if (srcFlags & DISPFLAG_100) {
 +						// loc_26188
 +						srcP = srcImgData;
 +						if (isClipped) {
 +							// loc_26199
 +error("TODO: var22/var24/var2C not initialised before use?");
 +							if (var22 < 0) {
 +								var22 = -var22;
 +							} else {
 +								var22 = 0;
 +							}
 +							var26 = var22 + width2;
 +							if (var24 < 0) {
 +								var24 = -var24;
 +							} else {
 +								var24 = 0;
 +							}
 +
 +							width2 = srcPic->_bounds.width();
 +							height1 = var24 + height1;
 +							byteVal = 0;
 +							
 +							for (int yp = 0; yp < height1; ++yp) {
 +								for (int xp = 0; xp < width2; ++xp) {
 +									if (byteVal2 <= 0) {
 +										byteVal = *srcP++;
 +										if (byteVal & 0x80) {
 +											byteVal &= 0x7f;
 +											byteVal2 = *srcP++;
 +											if (!byteVal2)
 +												byteVal2 = width2;
 +										}
 +									}
 +
 +									if (yp >= var24 && xp >= var22 && xp < var26) {
 +										if (byteVal > 0)
 +											*destP = byteVal;
 +										++destP;
 +									}
 +								}
 +
 +								if (yp >= var24)
 +									destP += widthDiff2;
 +							}
 +						} else {
 +							// loc_262BE
 +							byteVal = 0;
 +							for (int yp = 0; yp < height1; ++yp) {
 +								for (int xp = 0; xp < width2; ++xp) {
 +									byteVal2 = 0;
 +									if (!byteVal2) {
 +										byteVal = *++srcP;
 +										if (byteVal & 0x80) {
 +											byteVal &= 0x7f;
 +											byteVal2 = *srcP++;
 +
 +											if (!byteVal2)
 +												byteVal2 = width2;
 +										}
 +									}
 +
 +									if (byteVal > 0)
 +										*destP = byteVal;
 +
 +									++destP;
 +									--byteVal2;
 +								}
 +
 +								destP += widthDiff2;
 +							}
 +						}
 +					} else {
 +						// loc_2637F
 +						// Copy with transparency
 +						for (int yp = 0; yp < height1; ++yp) {
 +							for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
 +								if (*srcP != 0)
 +									*destP = *srcP;
 +							}
 +
 +							destP += widthDiff2;
 +							srcP += widthDiff;
 +						}
 +					}
 +				} else {
 +					if (srcFlags & 0x100) {
 +						srcP = srcImgData;
 +
 +						if (isClipped) {
 +							// loc_26424
 +
 +						} else {
 +							// loc_26543
 +						}
 +					} else {
 +						for (int yp = 0; yp < height1; ++yp) {
 +							Common::copy(srcP, srcP + width2, destP);
 +							destP += width2 + widthDiff2;
 +							srcP += width2 + widthDiff;
 +						}
 +					}
 +				}
 +			}
 +		}
 +	} else {
 +		// loc_26666
 +		if (srcPic->_pick == 0) {
 +			// loc_2727A
 +			byte onOff = srcPic->_onOff;
 +
 +			if (srcFlags & DISPFLAG_2) {
 +				if (srcFlags & DISPFLAG_8) {
 +					error("sDrawPic: TODO");
 +				} else {
 +					error("sDrawPic: TODO");
 +				}
 +			} else {
 +				// loc_27477
 +				if (destFlags & DISPFLAG_8) {
 +					// loc_27481
- 					destP = (byte *)_screenSurface.pixels + screenOffset;
++					destP = (byte *)_screenSurface.getPixels() + screenOffset;
 +					for (int yp = 0; yp < height1; ++yp) {
 +						Common::fill(srcP, srcP + width2, onOff);
 +						destP += width2 + widthDiff2;
 +					}
 +				} else {
 +					// loc_2753C
 +					destP = destImgData + screenOffset;
 +
 +					for (int yp = 0; yp < height1; ++yp) {
 +						Common::fill(destP, destP + width2, onOff);
 +						destP += width2 + widthDiff2;
 +					}
 +				}
 +			}
 +
 +		} else {
 +			// loc_26673
 +			// TODO
 +		}
 +	}
 +
 +	if (cursorData) {
 +		_vm->_eventsManager.setCursor(cursorData, width2, height1);
 +		delete[] cursorData;
 +	}
 +}
 +
 +void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
 +	PictureResource *pic;
 +	if (display->_flags & DISPFLAG_VIEWPORT) {
 +		pic = ((ViewPortResource *)display)->_currentPic;
 +	} else {
 +		pic = (PictureResource *)display;
 +	}
 +
 +	PictureResource picResource;
 +	picResource._flags = 0;
 +	picResource._select = 0xff;
 +	picResource._pick = 0;
 +	picResource._onOff = onOff;
 +	picResource._bounds = pic->_bounds;
 +
 +	sDrawPic(&picResource, display, Common::Point());
 +}
 +
 +/**
 + * Queues the given picture for display
 + */
 +void GraphicsManager::sDisplayPic(PictureResource *pic) {
 +	if (pic->_flags & DISPFLAG_8) {
 +		_vm->_eventsManager._intPtr.field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
 +	}
 +
 +	_vm->_eventsManager._intPtr._flipWait = true;
 +}
 +
 +void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
 +	// TODO
 +}
 +
 +void GraphicsManager::flipPage() {
 +	Common::Array<ViewPortResource *> &viewPorts = _viewPortListPtr->_entries;
 +	bool flipFlag = false;
 +
 +	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
 +		if (viewPorts[idx]->_flags & DISPFLAG_20) {
 +			if ((viewPorts[idx]->_flags & (DISPFLAG_8 || DISPFLAG_1)) 
 +					== (DISPFLAG_8 || DISPFLAG_1)) {
 +				if (_planeSelect == idx)
 +					sDisplayPic(viewPorts[idx]->_currentPic);
 +				flipFlag = true;
 +			}
 +		}
 +
 +		if (flipFlag) {
 +			ViewPortResource &viewPort = *viewPorts[idx];
 +
 +			viewPort._lastPage = viewPort._pageIndex;
 +			++viewPort._pageIndex;
 +
 +			if (viewPort._pageIndex >= viewPort._pageCount)
 +				viewPort._pageIndex = 0;
 +
 +			assert(viewPort._pageIndex < 2);
 +			viewPort._currentPic = viewPort._pages[viewPort._pageIndex];
 +			viewPort._flags = (viewPort._flags & ~DISPFLAG_8) | DISPFLAG_40;
 +		}
 +	}
 +}
 +
 +void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
 +		PictureResource *srcPic, PictureResource *destPic) {
 +	bool saveBack = _saveBack;
 +	_saveBack = false;
 +
 +	// WORKAROUND: Since _backgroundPage can point to a resource freed at the end of display methods,
 +	// I'm now explicitly resetting it to null in screenReset(), so at this point it can be null
 +	if (!srcPic)
 +		return;
 +
 +	if (rectListCount == -1) {
 +		sDrawPic(srcPic, destPic, Common::Point());
 +	} else {
 +		for (int i = rectListCount - 1; i >= 0; --i) {
 +			_clipPtr = &rectList[i];
 +			sDrawPic(srcPic, destPic, Common::Point());
 +		}
 +	}
 +
 +	_saveBack = saveBack;
 +}
 +
 +void GraphicsManager::clearPalette() {
 +	byte palette[768];
 +	Common::fill(&palette[0], &palette[768], 0);
 +	g_system->getPaletteManager()->setPalette(&palette[0], 0, 256);
 +}
 +
 +void GraphicsManager::setPalette(const byte *palette, int start, int count) {
 +	g_system->getPaletteManager()->setPalette(palette, start, count);
 +}
 +
 +void GraphicsManager::resetPalette() {
 +	for (int i = 0; i < 256; ++i)
 +		setColor(i, 0, 0, 0);
 +
 +	_vm->_eventsManager._intPtr.field38 = 1;
 +	_vm->_eventsManager._intPtr._hasPalette = true;
 +}
 +
 +void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
 +	byte *vgaP = &_VGAColors[idx * 3];
 +	vgaP[0] = r;
 +	vgaP[1] = g;
 +	vgaP[2] = b;
 +
 +	_vm->_eventsManager._intPtr._palStartIndex = MIN(_vm->_eventsManager._intPtr._palStartIndex, idx);
 +	_vm->_eventsManager._intPtr._palEndIndex = MAX(_vm->_eventsManager._intPtr._palEndIndex, idx);
 +}
 +
 +void GraphicsManager::screenReset() {
 +	resetPalette();
 +
 +	_backgroundPage = NULL;
 +	(*_vPort)->setupViewPort();
 +	fillPic(*_vPort, 0);	
 +	(*_vPort)->_parent->_flags |= DISPFLAG_8;
 +
 +	// Flip
 +	flipPage();
 +	_vm->_eventsManager.sWaitFlip();
 +}
 +
 +} // End of namespace Voyeur
diff --cc engines/voyeur/voyeur.cpp
index f39d9be,0000000..871fc41
mode 100644,000000..100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@@ -1,538 -1,0 +1,538 @@@
 +/* 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 "voyeur/voyeur.h"
 +#include "voyeur/animation.h"
 +#include "voyeur/graphics.h"
 +#include "voyeur/utils.h"
 +#include "common/scummsys.h"
 +#include "common/config-manager.h"
 +#include "common/debug-channels.h"
 +
 +namespace Voyeur {
 +
 +VoyeurEngine *g_vm;
 +
 +VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
 +		_gameDescription(gameDesc), _randomSource("Voyeur"),
 +		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
 +			Common::Point(1, 1), 1, 0, 0) {
 +	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
 +	_bVoy = NULL;
 +
 +	initialiseManagers();
 +}
 +
 +VoyeurEngine::~VoyeurEngine() {
 +	delete _bVoy;
 +}
 +
 +Common::String VoyeurEngine::generateSaveName(int slot) {
 +	return Common::String::format("%s.%03d", _targetName.c_str(), slot);
 +}
 +
 +/**
 + * Returns true if it is currently okay to restore a game
 + */
 +bool VoyeurEngine::canLoadGameStateCurrently() {
 +	return true;
 +}
 +
 +/**
 + * Returns true if it is currently okay to save the game
 + */
 +bool VoyeurEngine::canSaveGameStateCurrently() {
 +	return true;
 +}
 +
 +/**
 + * Load the savegame at the specified slot index
 + */
 +Common::Error VoyeurEngine::loadGameState(int slot) {
 +	return Common::kNoError;
 +}
 +
 +/**
 + * Save the game to the given slot index, and with the given name
 + */
 +Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc) {
 +	//TODO
 +	return Common::kNoError;
 +}
 +
 +Common::Error VoyeurEngine::run() {
 +	ESP_Init();
 +	globalInitBolt();
 +
 +	_eventsManager.resetMouse();
 +	doHeadTitle();
 +
 +	//doHeadTitle();
 +
 +	return Common::kNoError;
 +}
 +
 +
 +int VoyeurEngine::getRandomNumber(int maxNumber) {
 +	return _randomSource.getRandomNumber(maxNumber);
 +}
 +
 +void VoyeurEngine::initialiseManagers() {
 +	_debugger.setVm(this);
 +	_eventsManager.setVm(this);
 +	_filesManager.setVm(this);
 +	_game.setVm(this);
 +	_graphicsManager.setVm(this);
 +	_soundManager.setVm(this);
 +
 +}
 +
 +void VoyeurEngine::ESP_Init() {
 +}
 +
 +void VoyeurEngine::globalInitBolt() {
 +	initBolt();
 +
 +	_filesManager.openBoltLib("bvoy.blt", _bVoy);
 +	_bVoy->getBoltGroup(0x10000);
 +	_bVoy->getBoltGroup(0x10100);
 +
 +	_graphicsManager._fontPtr = &_defaultFontInfo;
 +	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
 +	assert(_graphicsManager._fontPtr->_curFont);
 +
 +	// Setup default flags
 +	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 +	_voy._eCursorOff[0x74 / 2] = 1;
 +	_voy._eCursorOff[0x68 / 2] = 0;
 +	_voy._eventTable[998]._data = NULL; // Original set 63h:63h
 +	_voy._evidence[19] = 0;
 +	_voy._evidence[17] = 0;
 +	_voy._evidence[18] = 9999;
 +	
 +	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
 +	_eventsManager.addFadeInt();
 +}
 +
 +void VoyeurEngine::initBolt() {
 +	vInitInterrupts();
 +	_graphicsManager.sInitGraphics();
 +	_eventsManager.vInitColor();
 +	initInput();
 +}
 +
 +void VoyeurEngine::vInitInterrupts() {
 +	_eventsManager._intPtr._palette = &_graphicsManager._VGAColors[0];
 +}
 +
 +void VoyeurEngine::initInput() {
 +}
 +
 +bool VoyeurEngine::doHeadTitle() {
 +//	char dest[144];
 +
 +	_eventsManager.startMainClockInt();
 +
 +	// Show starting screen
 +	if (_bVoy->getBoltGroup(0x10500))
 +		showConversionScreen();
 +	if (shouldQuit())
 +		return false;
 +
 +	if (ConfMan.getBool("copy_protection")) {
 +		bool result = doLock();
 +		if (!result || shouldQuit())
 +			return false;
 +	}
 +
 +	showTitleScreen();
 +
 +	// Opening
 +	if (!_voy._incriminate) {
 +		doOpening();
 +		_game.doTransitionCard("Saturday Afternoon", "Player's Apartment");
 +		_eventsManager.delay(90);
 +	} else {
 +		_voy._incriminate = false;
 +	}
 +
 +	if (_voy._eCursorOff[58] & 0x80) {
 +		if (_voy._evidence[19] == 0) {
 +			// TODO
 +		} else {
 +			// TODO
 +		}
 +	}
 +
 +	_voy._eCursorOff[55] = 140;
 +	return true;
 +}
 +
 +void VoyeurEngine::showConversionScreen() {
 +	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x502)._picResource;
 +	(*_graphicsManager._vPort)->setupViewPort();
 +	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 +
 +	_graphicsManager.flipPage();
 +	_eventsManager.sWaitFlip();
 +
 +	// Immediate palette load to show the initial screen
 +	CMapResource *cMap = _bVoy->getCMapResource(0x503);
 +	assert(cMap);
 +	cMap->_steps = 0;
 +	cMap->startFade();
 +
 +	// Wait briefly
 +	_eventsManager.delay(150);
 +	if (shouldQuit())
 +		return;
 +
 +	// Fade out the screen
 +	cMap = _bVoy->getCMapResource(0x5040000);
 +	cMap->_steps = 30;
 +	cMap->startFade();
 +	if (shouldQuit())
 +		return;
 +
 +	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 +	_graphicsManager.flipPage();
 +	_eventsManager.sWaitFlip();
 +
 +	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 +		_eventsManager.delay(1);
 +
 +	_graphicsManager.screenReset();
 +	_bVoy->freeBoltGroup(0x10500);
 +
 +
 +}
 +
 +bool VoyeurEngine::doLock() {
 +	bool result = true;
 +	bool flag = false;
 +	int buttonVocSize, wrongVocSize;
 +	byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
 +	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
 +	LockClass lock;
 +	PictureResource *cursorPic;
 +	byte *keyData;
 +	int keyCount;
 +	int key;
 +
 +	if (_bVoy->getBoltGroup(0x10700)) {
 +		lock.getSysDate();
 +		lock.getThePassword();
 +		
 +		_voy._eventTable[999]._type = lock.fieldC;
 +		_voy._eventTable[999]._data = _bVoy->memberAddr(0x704);
 +
 +		Common::String password = lock._password;
 +		cursorPic = _bVoy->getPictureResource(0x702);
 +		assert(cursorPic);
 +
 +		// Get the mappings of keys on the keypad
 +		keyData = _bVoy->memberAddr(0x705);
 +		keyCount = READ_LE_UINT16(keyData);
 +
 +		_graphicsManager._backColors = _bVoy->getCMapResource(0x7010000);
 +		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x700);
 +		(*_graphicsManager._vPort)->setupViewPort();
 +
 +		_graphicsManager._backColors->startFade();
 +		(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 +		_graphicsManager.flipPage();
 +		_eventsManager.sWaitFlip();
 +
 +		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 +			_eventsManager.delay(1);
 +
 +		_eventsManager.setCursorColor(127, 0);
 +		_graphicsManager.setColor(1, 64, 64, 64);
 +		_graphicsManager.setColor(2, 96, 96, 96);
 +		_graphicsManager.setColor(3, 160, 160, 160);
 +		_graphicsManager.setColor(4, 224, 224, 224);
 +		
 +		// Set up the cursor
 +		_eventsManager.setCursor(cursorPic);
 +		_eventsManager.mouseOn();
 +
 +		_eventsManager._intPtr. field38 = 1;
 +		_eventsManager._intPtr._hasPalette = true;
 +
 +		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
 +		_graphicsManager._fontPtr->_fontSaveBack = 0;
 +		_graphicsManager._fontPtr->_fontFlags = 0;
 +
 +		Common::String dateString = lock.getDateString();
 + 		Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
 +
 +		bool firstLoop = true;
 +		bool breakFlag = false;
 +		while (!breakFlag && !shouldQuit()) {
 +			(*_graphicsManager._vPort)->setupViewPort();
 +			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 +			_graphicsManager.flipPage();
 +			_eventsManager.sWaitFlip();
 +
 +			// Display the last play time
 +			_graphicsManager._fontPtr->_pos = Common::Point(0, 97);
 +			_graphicsManager._fontPtr->_justify = ALIGN_CENTRE;
 +			_graphicsManager._fontPtr->_justifyWidth = 384;
 +			_graphicsManager._fontPtr->_justifyHeight = 97;
 +
 +			(*_graphicsManager._vPort)->drawText(displayString);
 +			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 +			_graphicsManager.flipPage();
 +			_eventsManager.sWaitFlip();
 +
 +			if (firstLoop) {
 +				firstLoop = false;
 +				displayString = "";
 +			}
 +
 +			// Loop for getting key presses
 +			do {
 +				do {
 +					// Scan through the list of key rects to check if a keypad key is highlighted
 +					key = -1;
 +					Common::Point mousePos = _eventsManager.getMousePos() + 
 +						Common::Point(30, 20);
 +
 +					for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) { 
 +						int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
 +						int x2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 3) << 1));
 +						int y1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
 +						int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 4) << 1));
 +
 +						if (mousePos.x >= x1 && mousePos.x <= x2 && mousePos.y >= y1 && mousePos.y <= y2) {
 +							key = keyIndex;
 +						}
 +					}
 +
 +					_eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
 +					_eventsManager._intPtr.field38 = 1;
 +					_eventsManager._intPtr._hasPalette = true;
 +
 +					_eventsManager.delay(1);
 +				} while (!shouldQuit() && !_voy._incriminate);
 +				_voy._incriminate = false;
 +			} while (!shouldQuit() && key == -1);
 +
 +			_soundManager.abortVOCMap();
 +			_soundManager.playVOCMap(buttonVoc, buttonVocSize);
 +
 +			while (_soundManager.vocMapStatus()) {
 +				if (shouldQuit())
 +					break;
 +
 +				_soundManager.continueVocMap();
 +				_eventsManager.delay(1);
 +			}
 +
 +			// Process the key
 +			if (key < 10) {
 +				// Numeric key
 +				if (displayString.size() < 10) {
 +					displayString += '0' + key;
 +					continue;
 +				}
 +			} else if (key == 10) {
 +				// Accept key
 +				if (!flag) {
 +					if ((password.empty() && displayString.empty()) || (password == displayString)) {
 +						breakFlag = true;
 +						result = true;
 +						break;
 +					}
 +				} else {
 +					if (displayString.size() > 0) {
 +						result = true;
 +						breakFlag = true;
 +						break;
 +					} 
 +				}
 +			} else if (key == 11) {
 +				// New code
 +				if ((password.empty() && displayString.empty()) || (password != displayString)) {
 +					(*_graphicsManager._vPort)->setupViewPort();
 +					flag = true;
 +					displayString = "";
 +					continue;
 +				}
 +			} else if (key == 12) {
 +				// Exit keyword
 +				breakFlag = true;
 +				result = false;
 +				break;
 +			} else {
 +				continue;
 +			}
 +
 +			_soundManager.playVOCMap(wrongVoc, wrongVocSize);
 +		}
 +
 +		_graphicsManager.fillPic(*_graphicsManager._vPort);
 +		(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 +		_graphicsManager.flipPage();
 +		_eventsManager.sWaitFlip();
 +		_graphicsManager.resetPalette();
 +
 +		if (flag && result)
 +			lock._password = displayString;
 +		lock.saveThePassword();
 +
 +		_voy._eventTable[999]._data = NULL;
 +		_bVoy->freeBoltGroup(0x10700);
 +	}
 +
 +	_eventsManager.mouseOff();
 +
 +	delete[] buttonVoc;
 +	delete[] wrongVoc;
 +
 +	return result;
 +}
 +
 +void VoyeurEngine::showTitleScreen() {
 +	if (_bVoy->getBoltGroup(0x10500)) {
 +		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x500);
 +
 +		(*_graphicsManager._vPort)->setupViewPort();
 +		(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 +		_graphicsManager.flipPage();
 +		_eventsManager.sWaitFlip();
 +
 +		// Immediate palette load to show the initial screen
 +		CMapResource *cMap = _bVoy->getCMapResource(0x501);
 +		assert(cMap);
 +		cMap->_steps = 60;
 +		cMap->startFade();
 +
 +		// Wait briefly
 +		_eventsManager.delay(200);
 +		if (shouldQuit())
 +			return;
 +
 +		// Fade out the screen
 +		cMap = _bVoy->getCMapResource(0x504);
 +		cMap->_steps = 30;
 +		cMap->startFade();
 +
 +		(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 +		_graphicsManager.flipPage();
 +		_eventsManager.sWaitFlip();
 +
 +		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 +			_eventsManager.delay(1);
 +		if (shouldQuit())
 +			return;
 +
 +		_graphicsManager.screenReset();
 +		_eventsManager.delay(200);
 +
 +		// Voyeur title
 +		playRL2Video("a1100100.rl2");
 +		_graphicsManager.screenReset();
 +
 +		_bVoy->freeBoltGroup(0x10500);
 +	}
 +}
 +
 +void VoyeurEngine::doOpening() {
 +	_graphicsManager.screenReset();
 +
 +	if (!_bVoy->getBoltGroup(0x10200))
 +		return;
 +
 +	byte *frameTable = _bVoy->memberAddr(0x215);
 +	byte *xyTable = _bVoy->memberAddr(0x216);
 +	byte *whTable = _bVoy->memberAddr(0x217);
 +	int frmaeIndex = 0;
 +	int creditShow = 1;
 +	_game._v2A098 = 1;
 +	_voy._eCursorOff[52] = 0;
 +	_voy._RTVNum = 0;
 +	_voy._eCursorOff[50] = _voy._RTVNum;
 +	_game._v2A0A6 = 4;
 +	_game._v2A0A4 = 0;
 +	_voy._eCursorOff[58] = 16;
 +	_game._v2A09A = -1;
 +	_game.addVideoEventStart();
 +	_voy._eCursorOff[58] &= ~1;
 +
 +	for (int i = 0; i < 256; ++i)
 +		_graphicsManager.setColor(i, 8, 8, 8);
 +
 +	_eventsManager._intPtr.field38 = 1;
 +	_eventsManager._intPtr._hasPalette = true;
 +	(*_graphicsManager._vPort)->setupViewPort();
 +	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
 +	_graphicsManager.flipPage();
 +	_eventsManager.sWaitFlip();
 +
 +	::Video::RL2Decoder decoder;
 +	decoder.loadFile("a2300100.rl2");
 +	decoder.start();
 +
 +	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
 +		if (decoder.hasDirtyPalette()) {
 +			const byte *palette = decoder.getPalette();
 +			_graphicsManager.setPalette(palette, 0, 256);
 +		}
 +
 +		if (decoder.needsUpdate()) {
 +			const Graphics::Surface *frame = decoder.decodeNextFrame();
 +
- 			Common::copy((byte *)frame->pixels, (byte *)frame->pixels + 320 * 200,
- 				(byte *)_graphicsManager._screenSurface.pixels);
++			Common::copy((byte *)frame->getPixels(), (byte *)frame->getPixels() + 320 * 200,
++				(byte *)_graphicsManager._screenSurface.getPixels());
 +		}
 +
 +		_eventsManager.pollEvents();
 +		g_system->delayMillis(10);
 +	}
 +	
 +}
 +
 +void VoyeurEngine::playRL2Video(const Common::String &filename) {
 +	::Video::RL2Decoder decoder;
 +	decoder.loadFile(filename);
 +	decoder.start();
 +
 +	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
 +		if (decoder.hasDirtyPalette()) {
 +			const byte *palette = decoder.getPalette();
 +			_graphicsManager.setPalette(palette, 0, 256);
 +		}
 +
 +		if (decoder.needsUpdate()) {
 +			const Graphics::Surface *frame = decoder.decodeNextFrame();
 +
- 			Common::copy((byte *)frame->pixels, (byte *)frame->pixels + 320 * 200,
- 				(byte *)_graphicsManager._screenSurface.pixels);
++			Common::copy((byte *)frame->getPixels(), (byte *)frame->getPixels() + 320 * 200,
++				(byte *)_graphicsManager._screenSurface.getPixels());
 +		}
 +
 +		_eventsManager.pollEvents();
 +		g_system->delayMillis(10);
 +	}
 +}
 +
 +} // End of namespace Voyeur


Commit: 626c988841649f75c9c3dda46330f4b6805292a6
    https://github.com/scummvm/scummvm/commit/626c988841649f75c9c3dda46330f4b6805292a6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-01T19:56:28-08:00

Commit Message:
VOYEUR: Fix for correctly displaying lock screen

Changed paths:
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 3a37eb9..e220bbf 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -584,14 +584,14 @@ void GraphicsManager::flipPage() {
 
 void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
 		PictureResource *srcPic, PictureResource *destPic) {
-	bool saveBack = _saveBack;
-	_saveBack = false;
-
 	// WORKAROUND: Since _backgroundPage can point to a resource freed at the end of display methods,
 	// I'm now explicitly resetting it to null in screenReset(), so at this point it can be null
 	if (!srcPic)
 		return;
 
+	bool saveBack = _saveBack;
+	_saveBack = false;
+
 	if (rectListCount == -1) {
 		sDrawPic(srcPic, destPic, Common::Point());
 	} else {


Commit: 1fb422cde207b8b24ab9e8a545abb4c9204773c3
    https://github.com/scummvm/scummvm/commit/1fb422cde207b8b24ab9e8a545abb4c9204773c3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-02T05:29:51-08:00

Commit Message:
VOYEUR: Implemented sound effects for the lock screen

Changed paths:
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index 628e6e2..baba45f 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -20,15 +20,22 @@
  *
  */
 
+#include "audio/audiostream.h"
+#include "audio/decoders/raw.h"
+#include "common/memstream.h"
 #include "voyeur/sound.h"
 
 namespace Voyeur {
 
-SoundManager::SoundManager() {
+SoundManager::SoundManager(Audio::Mixer *mixer) {
+	_mixer = mixer;
 }
 
 void SoundManager::playVOCMap(byte *voc, int vocSize) {
-	// TODO
+	Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(voc, vocSize, DisposeAfterUse::NO);
+	Audio::AudioStream *audioStream = Audio::makeVOCStream(dataStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
+
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream);
 }
 
 bool SoundManager::vocMapStatus() {
@@ -37,11 +44,11 @@ bool SoundManager::vocMapStatus() {
 }
 
 void SoundManager::continueVocMap() {
-	// TODO
+	// No implementation needed in ScummVM
 }
 
 void SoundManager::abortVOCMap() {
-	// TODO
+	_mixer->stopHandle(_soundHandle);
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 01d5dc2..0784b92 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -25,6 +25,8 @@
 
 #include "common/scummsys.h"
 #include "common/str.h"
+#include "audio/mixer.h"
+#include "audio/decoders/voc.h"
 #include "voyeur/files.h"
 
 namespace Voyeur {
@@ -32,8 +34,10 @@ namespace Voyeur {
 class SoundManager {
 private:
 	VoyeurEngine *_vm;
+	Audio::Mixer *_mixer;
+	Audio::SoundHandle _soundHandle;
 public:
-	SoundManager();
+	SoundManager(Audio::Mixer *mixer);
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void playVOCMap(byte *voc, int vocSize);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 871fc41..bafc360 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -33,7 +33,7 @@ namespace Voyeur {
 VoyeurEngine *g_vm;
 
 VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
-		_gameDescription(gameDesc), _randomSource("Voyeur"),
+		_gameDescription(gameDesc), _randomSource("Voyeur"), _soundManager(_mixer),
 		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
 			Common::Point(1, 1), 1, 0, 0) {
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");


Commit: 08d68be2dceb1d3d3029ea415a3316bb81a9fde4
    https://github.com/scummvm/scummvm/commit/08d68be2dceb1d3d3029ea415a3316bb81a9fde4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-02T19:09:21-08:00

Commit Message:
VOYEUR: Fix for playback of animations with a background

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index cbd7b0a..4278d50 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -153,9 +153,6 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 	} else {
 		_backSurface = new Graphics::Surface();
 		_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
-
-		stream->seek(0x324);
-		rl2DecodeFrameWithoutBackground(0);
 	}
 
 	_videoBase = header._videoBase;
@@ -204,6 +201,9 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 		// Read in the background frame
 		_fileStream->seek(0x324);
 		rl2DecodeFrameWithoutBackground(0);
+
+		Common::copy((byte *)_surface->getPixels(), (byte *)_surface->getPixels() + (320 * 200), 
+			(byte *)_backSurface->getPixels());
 		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
 	}
 
@@ -215,10 +215,15 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 		_audioTrack->queueSound(_fileStream, _header._frameSoundSizes[_curFrame]);
 
 	// Decode the graphic data
-	if (_backSurface) 
+	if (_backSurface) {
+		if (_curFrame > 0)
+			Common::copy((byte *)_backSurface->getPixels(), (byte *)_backSurface->getPixels() + (320 * 200), 
+				(byte *)_surface->getPixels());
+
 		rl2DecodeFrameWithBackground();
-	else
+	} else {
 		rl2DecodeFrameWithoutBackground();
+	}
 
 	_curFrame++;
 	_nextFrameStartTime += _frameDelay;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index bafc360..080d40f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -164,7 +164,7 @@ bool VoyeurEngine::doHeadTitle() {
 			return false;
 	}
 
-	showTitleScreen();
+//	showTitleScreen();
 
 	// Opening
 	if (!_voy._incriminate) {


Commit: 805230e16364c5b4fbdb3f3450502ca59e2ba873
    https://github.com/scummvm/scummvm/commit/805230e16364c5b4fbdb3f3450502ca59e2ba873
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-02T19:45:29-08:00

Commit Message:
VOYEUR: Fix for stuttering sound in animation playback

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 4278d50..0f98dbb 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -50,7 +50,7 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	// Add an audio track if sound is present
 	RL2AudioTrack *audioTrack = NULL;
 	if (_header._soundRate) {
-		audioTrack = new RL2AudioTrack(_header, _soundType);
+		audioTrack = new RL2AudioTrack(_header, stream, _soundType);
 		addTrack(audioTrack);
 	}
 
@@ -211,8 +211,7 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 	_fileStream->seek(_header._frameOffsets[_curFrame]);
 
 	// If there's any sound data, pass it to the audio track
-	if (_header._frameSoundSizes[_curFrame] > 0 && _audioTrack)
-		_audioTrack->queueSound(_fileStream, _header._frameSoundSizes[_curFrame]);
+	_fileStream->seek(_header._frameSoundSizes[_curFrame], SEEK_CUR);
 
 	// Decode the graphic data
 	if (_backSurface) {
@@ -321,9 +320,24 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
 
 /*------------------------------------------------------------------------*/
 
-RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Audio::Mixer::SoundType soundType): 
+RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType): 
 		_header(header), _soundType(soundType) {
 	_audStream = createAudioStream();
+
+	// Add all the sound data for all the frames at once to avoid stuttering
+	for (int frameNumber = 0; frameNumber < header._numFrames; ++frameNumber) {
+		int offset = _header._frameOffsets[frameNumber];
+		int size = _header._frameSoundSizes[frameNumber];
+
+		byte *data = (byte *)malloc(size);
+		stream->seek(offset);
+		stream->read(data, size);
+		Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
+			DisposeAfterUse::YES);
+
+		_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
+			Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
+	}
 }
 
 RL2Decoder::RL2AudioTrack::~RL2AudioTrack() {
@@ -340,6 +354,8 @@ void RL2Decoder::RL2AudioTrack::queueSound(Common::SeekableReadStream *stream, i
 
 		_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
 			Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
+		//		_audioTrack->queueSound(_fileStream, _header._frameSoundSizes[_curFrame]);
+
 	} else {
 		delete stream;
 	}
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index c5991f4..53d24fc 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -81,7 +81,8 @@ public:
 private:
 	class RL2AudioTrack : public AudioTrack {
 	public:
-		RL2AudioTrack(const RL2FileHeader &header, Audio::Mixer::SoundType soundType);
+		RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream,
+			Audio::Mixer::SoundType soundType);
 		~RL2AudioTrack();
 
 		void queueSound(Common::SeekableReadStream *stream, int size);


Commit: 39a86aed6a7add9aaf90095af757a2876e93374a
    https://github.com/scummvm/scummvm/commit/39a86aed6a7add9aaf90095af757a2876e93374a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-03T19:17:04-08:00

Commit Message:
VOYEUR: Implemented sDrawPic mode for writing transition card text

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 34098e4..5171d58 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -996,8 +996,8 @@ int ViewPortResource::drawText(const Common::String &msg) {
 			int charWidth = fontData._charWidth[charValue];
 			_fontChar._bounds.setWidth(charWidth);
 
-			uint16 offset = READ_LE_UINT16(fontData._data1 + charValue * 2);
-			_fontChar._imgData = fontData._data2 + offset * 2;
+			uint16 offset = READ_LE_UINT16(fontData._charOffsets + charValue * 2);
+			_fontChar._imgData = fontData._charImages + offset * 2;
 
 			gfxManager.sDrawPic(&_fontChar, this, Common::Point(xp, yp));
 			
@@ -1109,8 +1109,8 @@ FontResource::FontResource(BoltFilesState &state, byte *src) {
 	for (int i = 0; i < totalChars; ++i)
 		_charWidth[i] = READ_LE_UINT16(src + 8 + 2 * i);
 
-	_data1 = src + 8 + totalChars * 2;
-	_data2 = _data1 + totalChars * 2;
+	_charOffsets = src + 8 + totalChars * 2;
+	_charImages = _charOffsets + totalChars * 2;
 }
 
 FontResource::~FontResource() {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index b66546c..43836f5 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -304,8 +304,8 @@ public:
 	int _fontHeight;
 	int _topPadding;
 	int *_charWidth;
-	byte *_data1;
-	byte *_data2;
+	byte *_charOffsets;
+	byte *_charImages;
 
 	FontResource(BoltFilesState &state, byte *src);
 	virtual ~FontResource();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index e220bbf..2ee385f 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -482,10 +482,24 @@ error("TODO: var22/var24/var2C not initialised before use?");
 			byte onOff = srcPic->_onOff;
 
 			if (srcFlags & DISPFLAG_2) {
-				if (srcFlags & DISPFLAG_8) {
-					error("sDrawPic: TODO");
-				} else {
-					error("sDrawPic: TODO");
+				if (!(srcFlags & DISPFLAG_8)) {
+					srcP = srcImgData + srcOffset;
+					
+					if (destFlags & DISPFLAG_8) {
+						// loc_272C3
+						error("TODO");
+					} else {
+						destP = destImgData + screenOffset;
+						for (int yp = 0; yp < height1; ++yp) {
+							for (int xp = 0; xp < width2; ++xp, ++destP) {
+								if ((int8)*srcP++ < 0)
+									*destP = onOff;
+							}
+
+							destP += widthDiff2;
+							srcP += widthDiff;
+						}
+					}
 				}
 			} else {
 				// loc_27477
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 080d40f..4c1d47d 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -509,7 +509,6 @@ void VoyeurEngine::doOpening() {
 		_eventsManager.pollEvents();
 		g_system->delayMillis(10);
 	}
-	
 }
 
 void VoyeurEngine::playRL2Video(const Common::String &filename) {


Commit: 958654fe94af389cced91c3e3955efbbb7288dab
    https://github.com/scummvm/scummvm/commit/958654fe94af389cced91c3e3955efbbb7288dab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-04T19:25:34-08:00

Commit Message:
VOYEUR: Added staticres.cpp file

Changed paths:
  A engines/voyeur/staticres.cpp
  A engines/voyeur/staticres.h
    engines/voyeur/game.cpp
    engines/voyeur/game.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index a653a84..85ea5df 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -51,6 +51,7 @@ void IntData::audioInit() {
 /*------------------------------------------------------------------------*/
 
 Game::Game() {
+	_iForceDeath = -1;
 }
 
 void Game::doTransitionCard(const Common::String &time, const Common::String &location) {
@@ -98,4 +99,8 @@ void Game::addVideoEventStart() {
 
 }
 
+void Game::playStamp() {
+
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index eb7d5f5..cb7f62d 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -129,12 +129,14 @@ public:
 	int _v2A0A6;
 	int _v2A0A4;
 	int _v2A09A;
+	int _iForceDeath;
 public:
 	Game();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void doTransitionCard(const Common::String &time, const Common::String &location);
 	void addVideoEventStart();
+	void playStamp();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 645b62f..40efce4 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS := \
 	files.o \
 	graphics.o \
 	sound.o \
+	staticres.o \
 	utils.o \
 	voyeur.o
 
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
new file mode 100644
index 0000000..23fa360
--- /dev/null
+++ b/engines/voyeur/staticres.cpp
@@ -0,0 +1,36 @@
+/* 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 "voyeur/staticres.h"
+
+namespace Voyeur {
+
+const int COMPUTER_DEFAULTS[] = {
+	18, 1, 0, 1, 33, 0, 998, -1, 18, 2, 0, 1, 41, 0,
+	998, -1, 18, 3, 0, 1, 47, 0, 998, -1, 18, 4, 0,
+	1, 53, 0, 998, -1, 18, 5, 0, 1, 46, 0, 998, -1,
+	18, 6, 0, 1, 50, 0, 998, -1, 18, 7, 0, 1, 40, 0,
+	998, -1, 18, 8, 0, 1, 43, 0, 998, -1, 19, 1, 0,
+	2, 28, 0, 998, -1
+};
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
new file mode 100644
index 0000000..cd92ae4
--- /dev/null
+++ b/engines/voyeur/staticres.h
@@ -0,0 +1,34 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_STATICRES_H
+#define VOYEUR_STATICRES_H
+
+#include "common/scummsys.h"
+
+namespace Voyeur {
+
+extern const int COMPUTER_DEFAULTS[];
+
+} // End of namespace Voyeur
+
+#endif
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 4c1d47d..4df5ebe 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -23,6 +23,7 @@
 #include "voyeur/voyeur.h"
 #include "voyeur/animation.h"
 #include "voyeur/graphics.h"
+#include "voyeur/staticres.h"
 #include "voyeur/utils.h"
 #include "common/scummsys.h"
 #include "common/config-manager.h"
@@ -84,7 +85,12 @@ Common::Error VoyeurEngine::run() {
 	globalInitBolt();
 
 	_eventsManager.resetMouse();
-	doHeadTitle();
+	if (doHeadTitle()) {
+		if (_game._iForceDeath >= 1 && _game._iForceDeath <= 4)
+			_voy._eCursorOff[58] |= 0x80;
+
+		_game.playStamp();
+	}
 
 	//doHeadTitle();
 
@@ -176,11 +182,16 @@ bool VoyeurEngine::doHeadTitle() {
 	}
 
 	if (_voy._eCursorOff[58] & 0x80) {
+		// TODO: Check when these are called, and the two different loops.
+		// Also, comptuerNu isn't an array in IDB?
+		/*
 		if (_voy._evidence[19] == 0) {
-			// TODO
+			Common::copy(&COMPUTER_DEFAULTS[0], &COMPUTER_DEFAULTS[9 * 8], &_voy._computerNum[0]);
+			_voy._evidence[19] = 9;
 		} else {
-			// TODO
+			error("_computerNum loaded with uninitialized list here");
 		}
+		*/
 	}
 
 	_voy._eCursorOff[55] = 140;


Commit: 75c960081c1a729c9f356c622ef9b2d9e0911f9d
    https://github.com/scummvm/scummvm/commit/75c960081c1a729c9f356c622ef9b2d9e0911f9d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-05T18:49:12-08:00

Commit Message:
VOYEUR: Did some refactoring of game files

Changed paths:
  A engines/voyeur/voyeur_game.cpp
  R engines/voyeur/game.cpp
  R engines/voyeur/game.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 56b7afd..2c534b6 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/events.h"
 #include "voyeur/voyeur.h"
+#include "common/events.h"
 #include "graphics/cursorman.h"
 #include "graphics/palette.h"
 
@@ -43,6 +44,27 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 
 /*------------------------------------------------------------------------*/
 
+IntData::IntData() {
+	_field9 = false;
+	_flipWait = false;
+	_hasPalette = false;
+	field16 = 0;
+	field1A = 0;
+	field1E = 0;
+	field22 = 0;
+	field24 = 0;
+	field26 = 0;
+	field2A = 0;
+	field38 = 0;
+	field3B = 0;
+	field3D = 0;
+	_palStartIndex = 0;
+	_palEndIndex = 0;
+	_palette = NULL;
+}
+
+/*------------------------------------------------------------------------*/
+
 EventsManager::EventsManager(): _intPtr(_gameData),
 		_fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) {
 	_cycleStatus = 0;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 0b78bc2..efc7ac4 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -27,7 +27,6 @@
 #include "common/list.h"
 #include "graphics/surface.h"
 #include "voyeur/files.h"
-#include "voyeur/game.h"
 
 namespace Voyeur {
 
@@ -51,6 +50,96 @@ public:
 	IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
 };
 
+class Event {
+public:
+	int _hours;
+	int _minutes;
+	int _seconds;
+	int _type;
+	int _data1;
+	int _data2;
+	byte *_data;
+};
+
+class SVoy {
+public:
+	int _delaySecs;
+	int _RTANum;
+	int _RTVNum;
+	int _switchBGNum;
+	int _group;
+	int _resolvePtr;
+	int _seconds;
+	int _minutes;
+	int _hours;
+	int _morning;
+	int _timeChangeFlag;
+	int _totalSeconds;
+	int _gameSeconds;
+	int _vCursorOn[160];
+	int _vCursorOff[160];
+	int _aCursorOn[60];
+	int _aCursorOff[60];
+	int _eCursorOn[60];
+	int _eCursorOff[60];
+	int _timeStart;
+	int _duration;
+	int _vidStart;
+	int _doApt;
+	int _function;
+	int _anim;
+	int _level;
+	int _levelDone;
+	int _flags;
+	int _evGroup;
+	byte *_evPicPtrs[6];
+	byte *_evCmPtrs[6];
+	int _audioTime;
+	int _phones[5];
+	int _numPhonesUsed;
+	int _evidence[20];
+	int _computerNum;
+	int _computerBut;
+	int _computerOn;
+	int _computerOff;
+	int _dead;
+	int _deadTime;
+	int _eventCnt;
+	Event _eventTable[1000];
+	int _curICF0;
+	int _curICF1;
+	int _fadeICF0;
+	int _fadeICF1;
+	int _fadeFunc;
+	int _lastInplay;
+	int _incriminate;
+	int _policeEvent;
+};
+
+class IntData {
+public:
+	bool _field9;
+	bool _flipWait;
+	int field16;
+	int field1A;
+	int field1E;
+	int field22;
+	int field24;
+	int field26;
+	int field2A;
+	bool _hasPalette;
+	int field38;
+	int field3B;
+	int field3D;
+	int _palStartIndex;
+	int _palEndIndex;
+	byte *_palette;
+public:
+	IntData();
+
+	void audioInit();
+};
+
 class EventsManager {
 private:
 	VoyeurEngine *_vm;
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
deleted file mode 100644
index 85ea5df..0000000
--- a/engines/voyeur/game.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* 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 "voyeur/game.h"
-#include "voyeur/voyeur.h"
-
-namespace Voyeur {
-
-IntData::IntData() {
-	_field9 = false;
-	_flipWait = false;
-	_hasPalette = false;
-	field16 = 0;
-	field1A = 0;
-	field1E = 0;
-	field22 = 0;
-	field24 = 0;
-	field26 = 0;
-	field2A = 0;
-	field38 = 0;
-	field3B = 0;
-	field3D = 0;
-	_palStartIndex = 0;
-	_palEndIndex = 0;
-	_palette = NULL;
-}
-
-void IntData::audioInit() {
-
-}
-
-/*------------------------------------------------------------------------*/
-
-Game::Game() {
-	_iForceDeath = -1;
-}
-
-void Game::doTransitionCard(const Common::String &time, const Common::String &location) {
-	_vm->_graphicsManager.setColor(128, 16, 16, 16);
-	_vm->_graphicsManager.setColor(224, 220, 220, 220);
-	_vm->_eventsManager._intPtr.field38 = true;
-	_vm->_eventsManager._intPtr._hasPalette = true;
-
-	(*_vm->_graphicsManager._vPort)->setupViewPort();
-	(*_vm->_graphicsManager._vPort)->fillPic(128);
-	_vm->_graphicsManager.flipPage();
-	_vm->_eventsManager.sWaitFlip();
-
-	(*_vm->_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-	_vm->_graphicsManager.flipPage();
-	_vm->_eventsManager.sWaitFlip();
-	(*_vm->_graphicsManager._vPort)->fillPic(128);
-
-	FontInfoResource &fi = *_vm->_graphicsManager._fontPtr;
-	fi._curFont = _vm->_bVoy->boltEntry(257)._fontResource;
-	fi._foreColor = 224;
-	fi._fontSaveBack = 0;
-	fi._pos = Common::Point(0, 116);
-	fi._justify = ALIGN_CENTRE;
-	fi._justifyWidth = 384;
-	fi._justifyHeight = 120;
-
-	(*_vm->_graphicsManager._vPort)->drawText(time);
-	
-	if (!location.empty()) {
-		fi._pos = Common::Point(0, 138);
-		fi._justify = ALIGN_CENTRE;
-		fi._justifyWidth = 384;
-		fi._justifyHeight = 140;
-
-		(*_vm->_graphicsManager._vPort)->drawText(location);
-	}
-
-	(*_vm->_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-	_vm->_graphicsManager.flipPage();
-	_vm->_eventsManager.sWaitFlip();
-}
-
-void Game::addVideoEventStart() {
-
-}
-
-void Game::playStamp() {
-
-}
-
-} // End of namespace Voyeur
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
deleted file mode 100644
index cb7f62d..0000000
--- a/engines/voyeur/game.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* 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.
- *
- */
-
-#ifndef VOYEUR_GAME_H
-#define VOYEUR_GAME_H
-
-#include "common/scummsys.h"
-#include "common/events.h"
-#include "common/str.h"
-
-namespace Voyeur {
-
-class VoyeurEngine;
-
-class Event {
-public:
-	int _hours;
-	int _minutes;
-	int _seconds;
-	int _type;
-	int _data1;
-	int _data2;
-	byte *_data;
-};
-
-class SVoy {
-public:
-	int _delaySecs;
-	int _RTANum;
-	int _RTVNum;
-	int _switchBGNum;
-	int _group;
-	int _resolvePtr;
-	int _seconds;
-	int _minutes;
-	int _hours;
-	int _morning;
-	int _timeChangeFlag;
-	int _totalSeconds;
-	int _gameSeconds;
-	int _vCursorOn[160];
-	int _vCursorOff[160];
-	int _aCursorOn[60];
-	int _aCursorOff[60];
-	int _eCursorOn[60];
-	int _eCursorOff[60];
-	int _timeStart;
-	int _duration;
-	int _vidStart;
-	int _doApt;
-	int _function;
-	int _anim;
-	int _level;
-	int _levelDone;
-	int _flags;
-	int _evGroup;
-	byte *_evPicPtrs[6];
-	byte *_evCmPtrs[6];
-	int _audioTime;
-	int _phones[5];
-	int _numPhonesUsed;
-	int _evidence[20];
-	int _computerNum;
-	int _computerBut;
-	int _computerOn;
-	int _computerOff;
-	int _dead;
-	int _deadTime;
-	int _eventCnt;
-	Event _eventTable[1000];
-	int _curICF0;
-	int _curICF1;
-	int _fadeICF0;
-	int _fadeICF1;
-	int _fadeFunc;
-	int _lastInplay;
-	int _incriminate;
-	int _policeEvent;
-};
-
-class IntData {
-public:
-	bool _field9;
-	bool _flipWait;
-	int field16;
-	int field1A;
-	int field1E;
-	int field22;
-	int field24;
-	int field26;
-	int field2A;
-	bool _hasPalette;
-	int field38;
-	int field3B;
-	int field3D;
-	int _palStartIndex;
-	int _palEndIndex;
-	byte *_palette;
-public:
-	IntData();
-
-	void audioInit();
-};
-
-class Game {
-private:
-	VoyeurEngine *_vm;
-public:
-	int _v2A098;
-	int _v2A0A6;
-	int _v2A0A4;
-	int _v2A09A;
-	int _iForceDeath;
-public:
-	Game();
-	void setVm(VoyeurEngine *vm) { _vm = vm; }
-
-	void doTransitionCard(const Common::String &time, const Common::String &location);
-	void addVideoEventStart();
-	void playStamp();
-};
-
-} // End of namespace Voyeur
-
-#endif /* VOYEUR_GAME_H */
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 2ee385f..dc62336 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -21,7 +21,6 @@
  */
 
 #include "voyeur/graphics.h"
-#include "voyeur/game.h"
 #include "voyeur/voyeur.h"
 #include "engines/util.h"
 #include "graphics/palette.h"
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 23a2965..518ec1a 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -23,10 +23,9 @@
 #ifndef VOYEUR_GRAPHICS_H
 #define VOYEUR_GRAPHICS_H
 
-//#include "voyeur/files.h"
-#include "voyeur/game.h"
 #include "common/scummsys.h"
 #include "common/array.h"
+#include "common/rect.h"
 #include "graphics/surface.h"
 
 namespace Voyeur {
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 40efce4..1562624 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -5,13 +5,13 @@ MODULE_OBJS := \
 	debugger.o \
 	detection.o \
 	events.o \
-	game.o \
 	files.o \
 	graphics.o \
 	sound.o \
 	staticres.o \
 	utils.o \
-	voyeur.o
+	voyeur.o \
+	voyeur_game.o
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_VOYEUR), DYNAMIC_PLUGIN)
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 4df5ebe..eaae6c8 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -39,6 +39,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 			Common::Point(1, 1), 1, 0, 0) {
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
 	_bVoy = NULL;
+	_iForceDeath = -1;
 
 	initialiseManagers();
 }
@@ -86,10 +87,10 @@ Common::Error VoyeurEngine::run() {
 
 	_eventsManager.resetMouse();
 	if (doHeadTitle()) {
-		if (_game._iForceDeath >= 1 && _game._iForceDeath <= 4)
+		if (_iForceDeath >= 1 && _iForceDeath <= 4)
 			_voy._eCursorOff[58] |= 0x80;
 
-		_game.playStamp();
+		playStamp();
 	}
 
 	//doHeadTitle();
@@ -106,7 +107,6 @@ void VoyeurEngine::initialiseManagers() {
 	_debugger.setVm(this);
 	_eventsManager.setVm(this);
 	_filesManager.setVm(this);
-	_game.setVm(this);
 	_graphicsManager.setVm(this);
 	_soundManager.setVm(this);
 
@@ -175,7 +175,7 @@ bool VoyeurEngine::doHeadTitle() {
 	// Opening
 	if (!_voy._incriminate) {
 		doOpening();
-		_game.doTransitionCard("Saturday Afternoon", "Player's Apartment");
+		doTransitionCard("Saturday Afternoon", "Player's Apartment");
 		_eventsManager.delay(90);
 	} else {
 		_voy._incriminate = false;
@@ -479,15 +479,15 @@ void VoyeurEngine::doOpening() {
 	byte *whTable = _bVoy->memberAddr(0x217);
 	int frmaeIndex = 0;
 	int creditShow = 1;
-	_game._v2A098 = 1;
+	_v2A098 = 1;
 	_voy._eCursorOff[52] = 0;
 	_voy._RTVNum = 0;
 	_voy._eCursorOff[50] = _voy._RTVNum;
-	_game._v2A0A6 = 4;
-	_game._v2A0A4 = 0;
+	_v2A0A6 = 4;
+	_v2A0A4 = 0;
 	_voy._eCursorOff[58] = 16;
-	_game._v2A09A = -1;
-	_game.addVideoEventStart();
+	_v2A09A = -1;
+	addVideoEventStart();
 	_voy._eCursorOff[58] &= ~1;
 
 	for (int i = 0; i < 256; ++i)
@@ -545,4 +545,45 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	}
 }
 
+void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
+	_graphicsManager.setColor(128, 16, 16, 16);
+	_graphicsManager.setColor(224, 220, 220, 220);
+	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._hasPalette = true;
+
+	(*_graphicsManager._vPort)->setupViewPort();
+	(*_graphicsManager._vPort)->fillPic(128);
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+	(*_graphicsManager._vPort)->fillPic(128);
+
+	FontInfoResource &fi = *_graphicsManager._fontPtr;
+	fi._curFont = _bVoy->boltEntry(257)._fontResource;
+	fi._foreColor = 224;
+	fi._fontSaveBack = 0;
+	fi._pos = Common::Point(0, 116);
+	fi._justify = ALIGN_CENTRE;
+	fi._justifyWidth = 384;
+	fi._justifyHeight = 120;
+
+	(*_graphicsManager._vPort)->drawText(time);
+	
+	if (!location.empty()) {
+		fi._pos = Common::Point(0, 138);
+		fi._justify = ALIGN_CENTRE;
+		fi._justifyWidth = 384;
+		fi._justifyHeight = 140;
+
+		(*_graphicsManager._vPort)->drawText(location);
+	}
+
+	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index f698aae..9306fb5 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -26,7 +26,6 @@
 #include "voyeur/debugger.h"
 #include "voyeur/events.h"
 #include "voyeur/files.h"
-#include "voyeur/game.h"
 #include "voyeur/graphics.h"
 #include "voyeur/sound.h"
 #include "common/scummsys.h"
@@ -64,9 +63,13 @@ class VoyeurEngine : public Engine {
 private:
 	const VoyeurGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
-
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
+	int _iForceDeath;
+	int _v2A098;
+	int _v2A0A6;
+	int _v2A0A4;
+	int _v2A09A;
 
 	void ESP_Init();
 	void initialiseManagers();
@@ -74,12 +77,14 @@ private:
 	void initBolt();
 	void vInitInterrupts();
 	void initInput();
+	void addVideoEventStart();
 
 	bool doHeadTitle();
 	void showConversionScreen();
 	bool doLock();
 	void showTitleScreen();
 	void doOpening();
+	void playStamp();
 protected:
 	// Engine APIs
 	virtual Common::Error run();
@@ -89,7 +94,6 @@ public:
 	Debugger _debugger;
 	EventsManager _eventsManager;
 	FilesManager _filesManager;
-	Game _game;
 	GraphicsManager _graphicsManager;
 	SoundManager _soundManager;
 	SVoy _voy;
@@ -112,6 +116,7 @@ public:
 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
 
 	void playRL2Video(const Common::String &filename);
+	void doTransitionCard(const Common::String &time, const Common::String &location);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
new file mode 100644
index 0000000..bc7fa6f
--- /dev/null
+++ b/engines/voyeur/voyeur_game.cpp
@@ -0,0 +1,36 @@
+/* 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 "voyeur/voyeur.h"
+
+namespace Voyeur {
+
+void VoyeurEngine::addVideoEventStart() {
+	
+}
+
+
+void VoyeurEngine::playStamp() {
+
+}
+
+} // End of namespace Voyeur


Commit: 9922353f5618a2f3b0371b02cca14707fbdc5a4b
    https://github.com/scummvm/scummvm/commit/9922353f5618a2f3b0371b02cca14707fbdc5a4b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-05T19:36:59-08:00

Commit Message:
VOYEUR: Implemented addVideoEventStart and dependent variable initialisation

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 2c534b6..5aa00e7 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -72,6 +72,11 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_fadeStatus = 0;
 	_priorFrameTime = g_system->getMillis();
 	Common::fill(&_keyState[0], &_keyState[256], false);
+
+	_videoComputerNum = 0;
+	_videoComputerBut1 = 0;
+	_videoComputerBut4 = 0;
+	_videoDead = 0;
 }
 
 void EventsManager::resetMouse() {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index efc7ac4..47a6c5a 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -50,15 +50,13 @@ public:
 	IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
 };
 
-class Event {
+class VoyeurEvent {
 public:
-	int _hours;
-	int _minutes;
-	int _seconds;
-	int _type;
-	int _data1;
-	int _data2;
-	byte *_data;
+	int _computerNum;
+	int _computerBut[4];
+	int _computerOn;
+	int _computerOff;
+	int _dead;
 };
 
 class SVoy {
@@ -98,14 +96,16 @@ public:
 	int _phones[5];
 	int _numPhonesUsed;
 	int _evidence[20];
-	int _computerNum;
-	int _computerBut;
-	int _computerOn;
-	int _computerOff;
-	int _dead;
-	int _deadTime;
-	int _eventCnt;
-	Event _eventTable[1000];
+	VoyeurEvent _events[1000];
+	int _field4376;
+	int _field4378;
+	int _field437A;
+	int _field437C;
+	int _field437E;
+	int _field4380;
+	int _field4382;
+	int _field4384;
+	byte *_field4386;
 	int _curICF0;
 	int _curICF1;
 	int _fadeICF0;
@@ -170,6 +170,11 @@ public:
 	int _fadeFirstCol, _fadeLastCol;
 	int _fadeCount;
 	int _fadeStatus;
+
+	int _videoComputerNum;
+	int _videoComputerBut1;
+	int _videoComputerBut4;
+	int _videoDead;
 public:
 	EventsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index dc62336..9b9ebe4 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -506,7 +506,7 @@ error("TODO: var22/var24/var2C not initialised before use?");
 					// loc_27481
 					destP = (byte *)_screenSurface.getPixels() + screenOffset;
 					for (int yp = 0; yp < height1; ++yp) {
-						Common::fill(srcP, srcP + width2, onOff);
+						Common::fill(destP, destP + width2, onOff);
 						destP += width2 + widthDiff2;
 					}
 				} else {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index eaae6c8..72de920 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -130,7 +130,7 @@ void VoyeurEngine::globalInitBolt() {
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 	_voy._eCursorOff[0x74 / 2] = 1;
 	_voy._eCursorOff[0x68 / 2] = 0;
-	_voy._eventTable[998]._data = NULL; // Original set 63h:63h
+	_voy._field4376 = NULL; // Original set 63h:63h
 	_voy._evidence[19] = 0;
 	_voy._evidence[17] = 0;
 	_voy._evidence[18] = 9999;
@@ -253,8 +253,8 @@ bool VoyeurEngine::doLock() {
 		lock.getSysDate();
 		lock.getThePassword();
 		
-		_voy._eventTable[999]._type = lock.fieldC;
-		_voy._eventTable[999]._data = _bVoy->memberAddr(0x704);
+		_voy._field4380 = lock.fieldC;
+		_voy._field4386 = _bVoy->memberAddr(0x704);
 
 		Common::String password = lock._password;
 		cursorPic = _bVoy->getPictureResource(0x702);
@@ -411,7 +411,7 @@ bool VoyeurEngine::doLock() {
 			lock._password = displayString;
 		lock.saveThePassword();
 
-		_voy._eventTable[999]._data = NULL;
+		_voy._field4386 = NULL;
 		_bVoy->freeBoltGroup(0x10700);
 	}
 
@@ -479,15 +479,17 @@ void VoyeurEngine::doOpening() {
 	byte *whTable = _bVoy->memberAddr(0x217);
 	int frmaeIndex = 0;
 	int creditShow = 1;
-	_v2A098 = 1;
+
 	_voy._eCursorOff[52] = 0;
 	_voy._RTVNum = 0;
 	_voy._eCursorOff[50] = _voy._RTVNum;
-	_v2A0A6 = 4;
-	_v2A0A4 = 0;
 	_voy._eCursorOff[58] = 16;
-	_v2A09A = -1;
+	_eventsManager._videoComputerNum = 4;
+	_eventsManager._videoComputerBut1  = 0;
+	_eventsManager._videoComputerBut4 = 1;
+	_eventsManager._videoDead = -1;
 	addVideoEventStart();
+
 	_voy._eCursorOff[58] &= ~1;
 
 	for (int i = 0; i < 256; ++i)
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 9306fb5..74bb714 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,10 +66,6 @@ private:
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
 	int _iForceDeath;
-	int _v2A098;
-	int _v2A0A6;
-	int _v2A0A4;
-	int _v2A09A;
 
 	void ESP_Init();
 	void initialiseManagers();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index bc7fa6f..48c65c5 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -25,10 +25,15 @@
 namespace Voyeur {
 
 void VoyeurEngine::addVideoEventStart() {
-	
+	VoyeurEvent &e = _voy._events[_voy._evidence[19]];
+	e._computerNum = _eventsManager._videoComputerNum;
+	e._computerBut[0] = _eventsManager._videoComputerBut1;
+	e._computerBut[1] = _voy._delaySecs;
+	e._computerBut[2] = 1;
+	e._computerBut[3] = _eventsManager._videoComputerBut4;
+	e._dead = _eventsManager._videoDead;
 }
 
-
 void VoyeurEngine::playStamp() {
 
 }


Commit: b40c34a8836dc12bc541579afad06dfb1e097a95
    https://github.com/scummvm/scummvm/commit/b40c34a8836dc12bc541579afad06dfb1e097a95
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-07T16:17:40-08:00

Commit Message:
VOYEUR: Fix engine to not be enabled by default

Changed paths:
    engines/voyeur/configure.engine



diff --git a/engines/voyeur/configure.engine b/engines/voyeur/configure.engine
index 647e202..23891fc 100644
--- a/engines/voyeur/configure.engine
+++ b/engines/voyeur/configure.engine
@@ -1,3 +1,4 @@
+
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine voyeur "Voyeur" yes
+add_engine voyeur "Voyeur" no


Commit: a6ceaf29854a47785c7a36831bea41411e1bb0cf
    https://github.com/scummvm/scummvm/commit/a6ceaf29854a47785c7a36831bea41411e1bb0cf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-07T17:44:28-08:00

Commit Message:
VOYEUR: Refactoring of BoltFile now that have more than one bolt file

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 5aa00e7..5d347d0 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -73,6 +73,7 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_priorFrameTime = g_system->getMillis();
 	Common::fill(&_keyState[0], &_keyState[256], false);
 
+	_v2A0A2 = 0;
 	_videoComputerNum = 0;
 	_videoComputerBut1 = 0;
 	_videoComputerBut4 = 0;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 47a6c5a..3cfdca4 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -66,7 +66,7 @@ public:
 	int _RTVNum;
 	int _switchBGNum;
 	int _group;
-	int _resolvePtr;
+	const int *_resolvePtr;
 	int _seconds;
 	int _minutes;
 	int _hours;
@@ -171,6 +171,7 @@ public:
 	int _fadeCount;
 	int _fadeStatus;
 
+	int _v2A0A2;
 	int _videoComputerNum;
 	int _videoComputerBut1;
 	int _videoComputerBut4;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 5171d58..9f7242c 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -185,9 +185,14 @@ bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFi
 		return true;
 	}
 
-	// TODO: Specific library classes for buoy.blt versus stampblt.blt 
 	// Create the bolt file interface object and load the index
-	boltFile = _boltFilesState._curLibPtr = new BoltFile(_boltFilesState);
+	if (filename == "bvoy.blt")
+		boltFile = _boltFilesState._curLibPtr = new BVoyBoltFile(_boltFilesState);
+	else if (filename == "stampblt.blt")
+		boltFile = _boltFilesState._curLibPtr = new StampBoltFile(_boltFilesState);
+	else
+		error("Unknown bolt file specified");
+
 	return true;
 }
 
@@ -212,20 +217,10 @@ byte *FilesManager::fload(const Common::String &filename, int *size) {
 
 /*------------------------------------------------------------------------*/
 
-const BoltMethodPtr BoltFile::_fnInitType[25] = {
-	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
-	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
-	&BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl,
-	&BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort,
-	&BoltFile::initViewPortList, &BoltFile::initFont, &BoltFile::initFontInfo,
-	&BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
-	&BoltFile::initDefault, &BoltFile::initDefault
-};
-
-BoltFile::BoltFile(BoltFilesState &state): _state(state) {
+BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _state(state) {
 	_state._curFd = &_file;
-	if (!_file.open("bvoy.blt"))
-		error("Could not open buoy.blt");
+	if (!_file.open(filename))
+		error("Could not open %s", filename.c_str());
 	_state._curFilePosition = 0;
 
 	// Read in the file header
@@ -403,7 +398,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
 	if (_state._curGroupPtr->_processed) {
 		// TODO: Figure out weird access type. Uncompressed read perhaps?
 		//int fileDiff = _state._curGroupPtr->_fileOffset - _state._curMemberPtr->_fileOffset;
-
+		error("TODO: processed bolt flag");
 	} else {
 		_state._bufStart = _state._decompressBuf;
 		_state._bufSize = DECOMPRESS_SIZE;
@@ -425,7 +420,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
 
 	// Initialise the resource
 	assert(_state._curMemberPtr->_initMethod < 25);
-	(this->*_fnInitType[_state._curMemberPtr->_initMethod])();
+	initResource(_state._curMemberPtr->_initMethod);
 
 	return _state._curMemberPtr->_data;
 }
@@ -435,27 +430,44 @@ void BoltFile::initDefault() {
 		_state._curMemberPtr->_mode);	
 }
 
-void BoltFile::sInitPic() {
-	// Read in the header data
-	_state._curMemberPtr->_data = _state.decompress(NULL, 24, _state._curMemberPtr->_mode);
-	_state._curMemberPtr->_picResource = new PictureResource(_state, 
-		_state._curMemberPtr->_data);
-}
+/*------------------------------------------------------------------------*/
 
-void BoltFile::vInitCMap() {
-	initDefault();
-	_state._curMemberPtr->_cMapResource = new CMapResource(
-		_state, _state._curMemberPtr->_data);
+BVoyBoltFile::BVoyBoltFile(BoltFilesState &state): BoltFile("bvoy.blt", state) {
 }
 
-void BoltFile::vInitCycl() {
-	initDefault();
-	_state._vm->_eventsManager.vStopCycle();
-	_state._curMemberPtr->_vInitCyclResource = new VInitCyclResource(
-		_state, _state._curMemberPtr->_data);
+void BVoyBoltFile::initResource(int resType) {
+	switch (resType) {
+	case 8:
+		sInitPic();
+		break;
+	case 10:
+		vInitCMap();
+		break;
+	case 11:
+		vInitCycl();
+		break;
+	case 15:
+		initViewPort();
+		break;
+	case 16:
+		initViewPortList();
+		break;
+	case 17:
+		initFont();
+		break;
+	case 18:
+		initFontInfo();
+		break;
+	case 19:
+		initSoundMap();
+		break;
+	default:
+		initDefault();
+		break;
+	}
 }
 
-void BoltFile::initViewPort() {
+void BVoyBoltFile::initViewPort() {
 	initDefault();
 
 	ViewPortResource *viewPort;
@@ -467,7 +479,7 @@ void BoltFile::initViewPort() {
 	viewPort->_parent = getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
 }
 
-void BoltFile::initViewPortList() {
+void BVoyBoltFile::initViewPortList() {
 	initDefault();
 
 	ViewPortListResource *res;
@@ -478,19 +490,52 @@ void BoltFile::initViewPortList() {
 	_state._vm->_graphicsManager._vPort = &res->_entries[0];
 }
 
-void BoltFile::initFontInfo() {
+void BVoyBoltFile::initFontInfo() {
 	initDefault();
 	_state._curMemberPtr->_fontInfoResource = new FontInfoResource(
 		_state, _state._curMemberPtr->_data);
 }
 
-void BoltFile::initFont() {
+void BVoyBoltFile::initFont() {
 	initDefault();
 	_state._curMemberPtr->_fontResource = new FontResource(_state, _state._curMemberPtr->_data);
 }
 
-void BoltFile::initSoundMap() {
+void BVoyBoltFile::initSoundMap() {
+	initDefault();
+}
+
+void BVoyBoltFile::sInitPic() {
+	// Read in the header data
+	_state._curMemberPtr->_data = _state.decompress(NULL, 24, _state._curMemberPtr->_mode);
+	_state._curMemberPtr->_picResource = new PictureResource(_state, 
+		_state._curMemberPtr->_data);
+}
+
+void BVoyBoltFile::vInitCMap() {
+	initDefault();
+	_state._curMemberPtr->_cMapResource = new CMapResource(
+		_state, _state._curMemberPtr->_data);
+}
+
+void BVoyBoltFile::vInitCycl() {
 	initDefault();
+	_state._vm->_eventsManager.vStopCycle();
+	_state._curMemberPtr->_vInitCyclResource = new VInitCyclResource(
+		_state, _state._curMemberPtr->_data);
+}
+
+/*------------------------------------------------------------------------*/
+
+StampBoltFile::StampBoltFile(BoltFilesState &state): BoltFile("stampblt.blt", state) {
+}
+
+void StampBoltFile::initResource(int resType) {
+	switch (resType) {
+	default:
+		initDefault();
+		break;
+	}
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 43836f5..0871a5e 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -44,8 +44,6 @@ class VInitCyclResource;
 
 #define DECOMPRESS_SIZE 0x7000
 
-typedef void (BoltFile::*BoltMethodPtr)();
-
 class ResolveEntry {
 public:
 	uint32 _id;
@@ -98,22 +96,13 @@ public:
 
 class BoltFile {
 private:
-	static const BoltMethodPtr _fnInitType[25];
-private:
-	BoltFilesState &_state;
 	Common::Array<BoltGroup> _groups;
 	Common::File _file;
+protected:
+	BoltFilesState &_state;
 
-	// initType method table
+	virtual void initResource(int resType) = 0;
 	void initDefault();
-	void sInitPic();
-	void vInitCMap();
-	void vInitCycl();
-	void initViewPort();
-	void initViewPortList();
-	void initFontInfo();
-	void initFont();
-	void initSoundMap();
 private:
 	void resolveAll();
 	byte *getBoltMember(uint32 id);
@@ -124,7 +113,7 @@ private:
 	void initGro() {}	// TODO
 	void termGro() {}	// TODO
 public:
-	BoltFile(BoltFilesState &state);
+	BoltFile(const Common::String &filename, BoltFilesState &state);
 	~BoltFile();
 
 	bool getBoltGroup(uint32 id);
@@ -140,6 +129,30 @@ public:
 	CMapResource *getCMapResource(uint32 id);
 };
 
+class BVoyBoltFile: public BoltFile {
+private:
+	// initType method table
+	void sInitPic();
+	void vInitCMap();
+	void vInitCycl();
+	void initViewPort();
+	void initViewPortList();
+	void initFontInfo();
+	void initFont();
+	void initSoundMap();
+protected:
+	virtual void initResource(int resType);
+public:
+	BVoyBoltFile(BoltFilesState &state);
+};
+
+class StampBoltFile: public BoltFile {
+protected:
+	virtual void initResource(int resType);
+public:
+	StampBoltFile(BoltFilesState &state);
+};
+
 class BoltGroup {
 private:
 	Common::SeekableReadStream *_file;
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 23fa360..a3a76b6 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -33,4 +33,14 @@ const int COMPUTER_DEFAULTS[] = {
 	2, 28, 0, 998, -1
 };
 
+const int RESOLVE_TABLE[] = {
+	0x2A00, 0x4A00, 0x1000, 0x4B00, 0x2C00, 0x4F00, 0x1400, 0x5000,
+	0x1700, 0x5100, 0x1800, 0x5200, 0x3300, 0x5400, 0x3700, 0x5500,
+	0x1A00, 0x1C00, 0x1E00, 0x1F00, 0x2100, 0x2200, 0x2400, 0x2700,
+	0x2B00, 0x1100, 0x4C00, 0x1200, 0x4D00, 0x1300, 0x4E00, 0x2E00,
+	0x1900, 0x3200, 0x3400, 0x3800, 0x2800, 0x3E00, 0x4100, 0x2900,
+	0x4400, 0x4600, 0x5300, 0x3900, 0x7600, 0x7200, 0x7300, 0x7400,
+	0x7500
+};
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index cd92ae4..704ea35 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -29,6 +29,8 @@ namespace Voyeur {
 
 extern const int COMPUTER_DEFAULTS[];
 
+extern const int RESOLVE_TABLE[];
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 74bb714..56301e5 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,6 +66,7 @@ private:
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
 	int _iForceDeath;
+	byte *_stampData;
 
 	void ESP_Init();
 	void initialiseManagers();
@@ -80,7 +81,9 @@ private:
 	bool doLock();
 	void showTitleScreen();
 	void doOpening();
+
 	void playStamp();
+	void initThreadStruct(int commandId);
 protected:
 	// Engine APIs
 	virtual Common::Error run();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 48c65c5..43227d3 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
 
 namespace Voyeur {
 
@@ -35,7 +36,27 @@ void VoyeurEngine::addVideoEventStart() {
 }
 
 void VoyeurEngine::playStamp() {
-
+	BoltFile *boltFile = NULL;
+	_filesManager.openBoltLib("stampblt.blt", boltFile);
+
+	boltFile->getBoltGroup(0x10000);
+	_voy._resolvePtr = &RESOLVE_TABLE[0];
+	byte *commandData = boltFile->memberAddr(3);
+	//uint32 commandId = READ_LE_UINT32(commandData);
+	//initThreadStruct(commandId);
+
+	_voy._delaySecs = 0;
+	_eventsManager._videoComputerNum = 9;
+	_eventsManager._videoComputerBut1 = 0;
+	_eventsManager._v2A0A2 = 0;
+	_voy._eCursorOff[53] = 1;
+
+	bool breakFlag = false;
+	while (!breakFlag && !shouldQuit()) {
+		breakFlag = true;
+	}
+
+	_voy._field4386 = 0;
 }
 
 } // End of namespace Voyeur


Commit: a86b1c3d583d0c1646844e23005f3197fca608f3
    https://github.com/scummvm/scummvm/commit/a86b1c3d583d0c1646844e23005f3197fca608f3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T07:40:26-08:00

Commit Message:
VOYEUR: Implementation of basic StampBoltFile resource types

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9f7242c..ab8c54d 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -532,12 +532,35 @@ StampBoltFile::StampBoltFile(BoltFilesState &state): BoltFile("stampblt.blt", st
 
 void StampBoltFile::initResource(int resType) {
 	switch (resType) {
+	case 6:
+		initPtr();
+		break;
+	case 24:
+		initControl();
+		break;
 	default:
 		initDefault();
 		break;
 	}
 }
 
+void StampBoltFile::initPtr() {
+	initDefault();
+
+	_state._curMemberPtr->_ptrResource = new PtrResource(_state, 
+		_state._curMemberPtr->_data);
+}
+
+void StampBoltFile::initControl() {
+	initDefault();
+
+	ControlResource *res;
+	_state._curMemberPtr->_controlResource = res = new ControlResource(_state, 
+		_state._curMemberPtr->_data);
+
+	_state._vm->_controlPtr = res;
+}
+
 /*------------------------------------------------------------------------*/
 
 BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
@@ -585,6 +608,8 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_fontInfoResource = NULL;
 	_cMapResource = NULL;
 	_vInitCyclResource = NULL;
+	_ptrResource = NULL;
+	_controlResource = NULL;
 
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
@@ -605,6 +630,8 @@ BoltEntry::~BoltEntry() {
 	delete _fontInfoResource;
 	delete _cMapResource;
 	delete _vInitCyclResource;
+	delete _ptrResource;
+	delete _controlResource;
 }
 
 void BoltEntry::load() {
@@ -617,7 +644,8 @@ void BoltEntry::load() {
  */
 bool BoltEntry::hasResource() const {
 	return _picResource || _viewPortResource || _viewPortListResource
-		|| _fontResource || _fontInfoResource || _cMapResource || _vInitCyclResource;
+		|| _fontResource || _fontInfoResource || _cMapResource 
+		|| _vInitCyclResource || _ptrResource || _controlResource;
 }
 
 /*------------------------------------------------------------------------*/
@@ -1257,4 +1285,38 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 	}
 }
 
+/*------------------------------------------------------------------------*/
+
+PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
+	// Load pointer list
+	uint32 *idP = (uint32 *)&src[0];
+	int size = state._curMemberPtr->_size;
+
+	for (int i = 0; i < size / 4; ++i, ++idP) {
+		uint32 id = READ_LE_UINT32(idP);
+		BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
+
+		_entries.push_back(&entry);
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
+	// Get pointer
+	uint32 ptrId = READ_LE_UINT32(&src[0x32]);
+	_ptr = state._curLibPtr->getBoltEntryFromLong(ptrId)._data;
+
+	// Load pointer list
+	uint32 *idP = (uint32 *)&src[0x10];
+	int count = READ_LE_UINT16(&src[0x36]);
+
+	for (int i = 0; i < count; ++i, ++idP) {
+		uint32 id = READ_LE_UINT32(idP);
+		BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
+
+		_entries.push_back(entry._data);
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 0871a5e..584328c 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -41,6 +41,8 @@ class ViewPortListResource;
 class FontResource;
 class CMapResource;
 class VInitCyclResource;
+class PtrResource;
+class ControlResource;
 
 #define DECOMPRESS_SIZE 0x7000
 
@@ -147,6 +149,9 @@ public:
 };
 
 class StampBoltFile: public BoltFile {
+private:
+	void initPtr();
+	void initControl();
 protected:
 	virtual void initResource(int resType);
 public:
@@ -185,6 +190,7 @@ public:
 	int _size;
 	byte *_data;
 
+	// bvoy.blt resource types
 	PictureResource *_picResource;
 	ViewPortResource *_viewPortResource;
 	ViewPortListResource *_viewPortListResource;
@@ -192,6 +198,10 @@ public:
 	FontInfoResource *_fontInfoResource;
 	CMapResource *_cMapResource;
 	VInitCyclResource *_vInitCyclResource;
+
+	// stampblt.blt resource types
+	PtrResource *_ptrResource;
+	ControlResource *_controlResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
 	virtual ~BoltEntry();
@@ -225,6 +235,8 @@ public:
 	uint32 _flags;
 };
 
+/* bvoy.blt resource types */
+
 class PictureResource: public DisplayResource {
 public:
 	byte _select;
@@ -376,6 +388,25 @@ public:
 	virtual ~VInitCyclResource() {}
 };
 
+/* stampblt.blt resources */
+
+class PtrResource {
+public:
+	Common::Array<BoltEntry *> _entries;
+
+	PtrResource(BoltFilesState &state, const byte *src);
+	virtual ~PtrResource() {}
+};
+
+class ControlResource {
+public:
+	byte *_ptr;
+	Common::Array<byte *> _entries;
+
+	ControlResource(BoltFilesState &state, const byte *src);
+	virtual ~ControlResource() {}
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_FILES_H */
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 72de920..b890d0a 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -40,6 +40,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
 	_bVoy = NULL;
 	_iForceDeath = -1;
+	_controlPtr = NULL;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 56301e5..681e876 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -83,7 +83,7 @@ private:
 	void doOpening();
 
 	void playStamp();
-	void initThreadStruct(int commandId);
+	void initThreadStruct(byte *threadStruct);
 protected:
 	// Engine APIs
 	virtual Common::Error run();
@@ -96,6 +96,8 @@ public:
 	GraphicsManager _graphicsManager;
 	SoundManager _soundManager;
 	SVoy _voy;
+
+	ControlResource *_controlPtr;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 43227d3..fc21604 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -41,9 +41,9 @@ void VoyeurEngine::playStamp() {
 
 	boltFile->getBoltGroup(0x10000);
 	_voy._resolvePtr = &RESOLVE_TABLE[0];
-	byte *commandData = boltFile->memberAddr(3);
-	//uint32 commandId = READ_LE_UINT32(commandData);
-	//initThreadStruct(commandId);
+	PtrResource *threadsList = boltFile->boltEntry(3)._ptrResource;
+	byte *threadP = threadsList->_entries[0]->_data;
+	initThreadStruct(threadP);
 
 	_voy._delaySecs = 0;
 	_eventsManager._videoComputerNum = 9;
@@ -59,4 +59,8 @@ void VoyeurEngine::playStamp() {
 	_voy._field4386 = 0;
 }
 
+void VoyeurEngine::initThreadStruct(byte *threadStruct) {
+	// TODO
+}
+
 } // End of namespace Voyeur


Commit: ce3cb58d1511aa7de1dfad5bc92149559b4450f6
    https://github.com/scummvm/scummvm/commit/ce3cb58d1511aa7de1dfad5bc92149559b4450f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T11:44:48-08:00

Commit Message:
VOYEUR: Extra control/group initialisation

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ab8c54d..b17f324 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -558,6 +558,7 @@ void StampBoltFile::initControl() {
 	_state._curMemberPtr->_controlResource = res = new ControlResource(_state, 
 		_state._curMemberPtr->_data);
 
+	_state._vm->_controlGroupPtr = _state._curGroupPtr;
 	_state._vm->_controlPtr = res;
 }
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index b890d0a..9348f5f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -41,6 +41,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_bVoy = NULL;
 	_iForceDeath = -1;
 	_controlPtr = NULL;
+	_stampFlags = 0;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 681e876..43a18e0 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,7 +66,6 @@ private:
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
 	int _iForceDeath;
-	byte *_stampData;
 
 	void ESP_Init();
 	void initialiseManagers();
@@ -83,6 +82,8 @@ private:
 	void doOpening();
 
 	void playStamp();
+	void initStamp();
+	void initUseCount();
 	void initThreadStruct(byte *threadStruct);
 protected:
 	// Engine APIs
@@ -97,7 +98,13 @@ public:
 	SoundManager _soundManager;
 	SVoy _voy;
 
+	BoltFile *_stampLibPtr;
+	BoltGroup *_controlGroupPtr;
 	ControlResource *_controlPtr;
+	byte *_stampData;
+	BoltGroup *_stackGroupPtr;
+	int _stampFlags;
+	int _stm_useCount[8];
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index fc21604..07821d8 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -36,12 +36,14 @@ void VoyeurEngine::addVideoEventStart() {
 }
 
 void VoyeurEngine::playStamp() {
-	BoltFile *boltFile = NULL;
-	_filesManager.openBoltLib("stampblt.blt", boltFile);
+	_stampLibPtr = NULL;
+	_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
 
-	boltFile->getBoltGroup(0x10000);
+	_stampLibPtr->getBoltGroup(0x10000);
 	_voy._resolvePtr = &RESOLVE_TABLE[0];
-	PtrResource *threadsList = boltFile->boltEntry(3)._ptrResource;
+	initStamp();
+
+	PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource;
 	byte *threadP = threadsList->_entries[0]->_data;
 	initThreadStruct(threadP);
 
@@ -59,6 +61,20 @@ void VoyeurEngine::playStamp() {
 	_voy._field4386 = 0;
 }
 
+void VoyeurEngine::initStamp() {
+	_stampFlags &= ~1;
+	_stackGroupPtr = _controlGroupPtr;
+
+	if (_controlPtr->_entries.size() == 0)
+		error("No control entries");
+
+	initUseCount();
+}
+
+void VoyeurEngine::initUseCount() {
+	Common::fill(&_stm_useCount[0], &_stm_useCount[8], 0);
+}
+
 void VoyeurEngine::initThreadStruct(byte *threadStruct) {
 	// TODO
 }


Commit: fc7c1cd33e21c7fd9b78764ee7bb02e35733fbac
    https://github.com/scummvm/scummvm/commit/fc7c1cd33e21c7fd9b78764ee7bb02e35733fbac
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T13:51:50-08:00

Commit Message:
VOYEUR: More thread/stack initialisation

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index b17f324..8f188fa 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -276,6 +276,11 @@ void BoltFile::freeBoltGroup(uint32 id) {
 	_state._curGroupPtr->unload();
 }
 
+void BoltFile::freeBoltMember(uint32 id) {
+	// TODO: Determine whether this is needed
+	warning("TODO: BoltFile::freeBoltMember");
+}
+
 BoltEntry &BoltFile::getBoltEntryFromLong(uint32 id) {
 	BoltGroup &group = _groups[id >> 24];
 	assert(group._loaded);
@@ -532,6 +537,9 @@ StampBoltFile::StampBoltFile(BoltFilesState &state): BoltFile("stampblt.blt", st
 
 void StampBoltFile::initResource(int resType) {
 	switch (resType) {
+	case 0:
+		initThread();
+		break;
 	case 6:
 		initPtr();
 		break;
@@ -544,6 +552,13 @@ void StampBoltFile::initResource(int resType) {
 	}
 }
 
+void StampBoltFile::initThread() {
+	initDefault();
+
+	_state._curMemberPtr->_threadResource = new ThreadResource(_state, 
+		_state._curMemberPtr->_data);
+}
+
 void StampBoltFile::initPtr() {
 	initDefault();
 
@@ -611,6 +626,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_vInitCyclResource = NULL;
 	_ptrResource = NULL;
 	_controlResource = NULL;
+	_threadResource = NULL;
 
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
@@ -646,7 +662,8 @@ void BoltEntry::load() {
 bool BoltEntry::hasResource() const {
 	return _picResource || _viewPortResource || _viewPortListResource
 		|| _fontResource || _fontInfoResource || _cMapResource 
-		|| _vInitCyclResource || _ptrResource || _controlResource;
+		|| _vInitCyclResource || _ptrResource || _controlResource
+		|| _threadResource;
 }
 
 /*------------------------------------------------------------------------*/
@@ -1288,6 +1305,11 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
+ThreadResource::ThreadResource(BoltFilesState &state, const byte *src) {
+}
+
+/*------------------------------------------------------------------------*/
+
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
 	// Load pointer list
 	uint32 *idP = (uint32 *)&src[0];
@@ -1308,6 +1330,11 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 	uint32 ptrId = READ_LE_UINT32(&src[0x32]);
 	_ptr = state._curLibPtr->getBoltEntryFromLong(ptrId)._data;
 
+	for (int i = 0; i < 8; ++i) {
+		_memberIds[i] = READ_LE_UINT16(src + i * 2);
+		_entries[i] = NULL;
+	}
+
 	// Load pointer list
 	uint32 *idP = (uint32 *)&src[0x10];
 	int count = READ_LE_UINT16(&src[0x36]);
@@ -1316,7 +1343,7 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 		uint32 id = READ_LE_UINT32(idP);
 		BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
 
-		_entries.push_back(entry._data);
+		_entries[i] = entry._data;
 	}
 }
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 584328c..8cb7fc8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -43,6 +43,7 @@ class CMapResource;
 class VInitCyclResource;
 class PtrResource;
 class ControlResource;
+class ThreadResource;
 
 #define DECOMPRESS_SIZE 0x7000
 
@@ -120,6 +121,7 @@ public:
 
 	bool getBoltGroup(uint32 id);
 	void freeBoltGroup(uint32 id);
+	void freeBoltMember(uint32 id);
 	byte *memberAddr(uint32 id);
 	byte *memberAddrOffset(uint32 id);
 	void resolveIt(uint32 id, byte **p);
@@ -150,6 +152,7 @@ public:
 
 class StampBoltFile: public BoltFile {
 private:
+	void initThread();
 	void initPtr();
 	void initControl();
 protected:
@@ -202,6 +205,7 @@ public:
 	// stampblt.blt resource types
 	PtrResource *_ptrResource;
 	ControlResource *_controlResource;
+	ThreadResource *_threadResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f);
 	virtual ~BoltEntry();
@@ -400,13 +404,27 @@ public:
 
 class ControlResource {
 public:
+	int _memberIds[8];
+	byte *_entries[8];
 	byte *_ptr;
-	Common::Array<byte *> _entries;
 
 	ControlResource(BoltFilesState &state, const byte *src);
 	virtual ~ControlResource() {}
 };
 
+class ThreadResource {
+public:
+	int _field0;
+	int _controlIndex;
+	int _field4, _field6;
+	int _field3A;
+	int _field3E;
+	byte *_ctlPtr;
+public:
+	ThreadResource(BoltFilesState &state, const byte *src);
+	virtual ~ThreadResource() {}
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_FILES_H */
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 43a18e0..236d83f 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,7 +84,10 @@ private:
 	void playStamp();
 	void initStamp();
 	void initUseCount();
-	void initThreadStruct(byte *threadStruct);
+	void initThreadStruct(ThreadResource *thread, int v1, int idx);
+	bool stm_loadAStack(ThreadResource *thread, int idx);
+	void stm_unloadAStack(int idx);
+	void stm_doState(ThreadResource *thread);
 protected:
 	// Engine APIs
 	virtual Common::Error run();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 07821d8..f6dc0b0 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -44,8 +44,8 @@ void VoyeurEngine::playStamp() {
 	initStamp();
 
 	PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource;
-	byte *threadP = threadsList->_entries[0]->_data;
-	initThreadStruct(threadP);
+	ThreadResource *threadP = threadsList->_entries[0]->_threadResource;
+	initThreadStruct(threadP, 0, 0);
 
 	_voy._delaySecs = 0;
 	_eventsManager._videoComputerNum = 9;
@@ -65,7 +65,7 @@ void VoyeurEngine::initStamp() {
 	_stampFlags &= ~1;
 	_stackGroupPtr = _controlGroupPtr;
 
-	if (_controlPtr->_entries.size() == 0)
+	if (!_controlPtr->_entries[0])
 		error("No control entries");
 
 	initUseCount();
@@ -75,8 +75,45 @@ void VoyeurEngine::initUseCount() {
 	Common::fill(&_stm_useCount[0], &_stm_useCount[8], 0);
 }
 
-void VoyeurEngine::initThreadStruct(byte *threadStruct) {
-	// TODO
+void VoyeurEngine::initThreadStruct(ThreadResource *thread, int v1, int idx) {
+	thread->_controlIndex = -1;
+	if (stm_loadAStack(thread, idx)) {
+		thread->_field4 = thread->_field6 = -1;
+		thread->_field0 = idx;
+		thread->_field3A = -1;
+		thread->_field3E = -1;
+
+		stm_doState(thread);
+	}
+}
+
+bool VoyeurEngine::stm_loadAStack(ThreadResource *thread, int idx) {
+	if (_stampFlags & 1) {
+		stm_unloadAStack(thread->_controlIndex);
+		if  (!_stm_useCount[idx]) {
+			BoltEntry &boltEntry = _stampLibPtr->boltEntry(_controlPtr->_memberIds[idx]);
+			if (!boltEntry._data)
+				return false;
+
+			_controlPtr->_entries[idx] = boltEntry._data;
+		}
+
+		++_stm_useCount[idx];
+	}
+
+	thread->_ctlPtr = _controlPtr->_entries[idx];
+}
+
+void VoyeurEngine::stm_unloadAStack(int idx) {
+	if ((_stampFlags & 1) && _stm_useCount[idx]) {
+		if (--_stm_useCount[idx] == 0) {
+			_stampLibPtr->freeBoltMember(_controlPtr->_memberIds[idx]);
+		}
+	}
+}
+
+void VoyeurEngine::stm_doState(ThreadResource *thread) {
+
 }
 
 } // End of namespace Voyeur


Commit: bad9219c27d8b62079fe0f96c8cc7020d2c58da7
    https://github.com/scummvm/scummvm/commit/bad9219c27d8b62079fe0f96c8cc7020d2c58da7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T15:02:46-08:00

Commit Message:
VOYEUR: Temporarily disable startup screens

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 9348f5f..000012c 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -161,8 +161,8 @@ bool VoyeurEngine::doHeadTitle() {
 	_eventsManager.startMainClockInt();
 
 	// Show starting screen
-	if (_bVoy->getBoltGroup(0x10500))
-		showConversionScreen();
+//	if (_bVoy->getBoltGroup(0x10500))
+//		showConversionScreen();
 	if (shouldQuit())
 		return false;
 
@@ -176,8 +176,8 @@ bool VoyeurEngine::doHeadTitle() {
 
 	// Opening
 	if (!_voy._incriminate) {
-		doOpening();
-		doTransitionCard("Saturday Afternoon", "Player's Apartment");
+//		doOpening();
+//		doTransitionCard("Saturday Afternoon", "Player's Apartment");
 		_eventsManager.delay(90);
 	} else {
 		_voy._incriminate = false;


Commit: 96b1fb8601ebdda0a6bd8220d55baf3386d1551a
    https://github.com/scummvm/scummvm/commit/96b1fb8601ebdda0a6bd8220d55baf3386d1551a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T15:23:40-08:00

Commit Message:
VOYEUR: Fixes for ControlResource initialisation

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 8f188fa..f9fce61 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -236,7 +236,9 @@ BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _stat
 }
 
 BoltFile::~BoltFile() {
-	_state._curFd->close();
+	_file.close();
+	if (_state._curFd == &_file)
+		_state._curFd = NULL;
 }
 
 bool BoltFile::getBoltGroup(uint32 id) {
@@ -1306,6 +1308,7 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 /*------------------------------------------------------------------------*/
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src) {
+	_flags = READ_LE_UINT16(&src[8]);
 }
 
 /*------------------------------------------------------------------------*/
@@ -1330,10 +1333,8 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 	uint32 ptrId = READ_LE_UINT32(&src[0x32]);
 	_ptr = state._curLibPtr->getBoltEntryFromLong(ptrId)._data;
 
-	for (int i = 0; i < 8; ++i) {
+	for (int i = 0; i < 8; ++i)
 		_memberIds[i] = READ_LE_UINT16(src + i * 2);
-		_entries[i] = NULL;
-	}
 
 	// Load pointer list
 	uint32 *idP = (uint32 *)&src[0x10];
@@ -1341,9 +1342,7 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 
 	for (int i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
-		BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
-
-		_entries[i] = entry._data;
+		state._curLibPtr->resolveIt(id, &_entries[i]);
 	}
 }
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 8cb7fc8..7ea7dea 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -417,6 +417,7 @@ public:
 	int _field0;
 	int _controlIndex;
 	int _field4, _field6;
+	int _flags;
 	int _field3A;
 	int _field3E;
 	byte *_ctlPtr;
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 236d83f..549a335 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -83,10 +83,12 @@ private:
 
 	void playStamp();
 	void initStamp();
+	void closeStamp();
 	void initUseCount();
 	void initThreadStruct(ThreadResource *thread, int v1, int idx);
 	bool stm_loadAStack(ThreadResource *thread, int idx);
 	void stm_unloadAStack(int idx);
+	void stm_unloadAllStacks();
 	void stm_doState(ThreadResource *thread);
 protected:
 	// Engine APIs
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index f6dc0b0..ee7ef66 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -59,6 +59,9 @@ void VoyeurEngine::playStamp() {
 	}
 
 	_voy._field4386 = 0;
+	closeStamp();
+	_stampLibPtr->freeBoltGroup(0x10000);
+	delete _stampLibPtr;
 }
 
 void VoyeurEngine::initStamp() {
@@ -71,6 +74,10 @@ void VoyeurEngine::initStamp() {
 	initUseCount();
 }
 
+void VoyeurEngine::closeStamp() {
+	stm_unloadAllStacks();
+}
+
 void VoyeurEngine::initUseCount() {
 	Common::fill(&_stm_useCount[0], &_stm_useCount[8], 0);
 }
@@ -102,6 +109,7 @@ bool VoyeurEngine::stm_loadAStack(ThreadResource *thread, int idx) {
 	}
 
 	thread->_ctlPtr = _controlPtr->_entries[idx];
+	return true;
 }
 
 void VoyeurEngine::stm_unloadAStack(int idx) {
@@ -112,8 +120,17 @@ void VoyeurEngine::stm_unloadAStack(int idx) {
 	}
 }
 
-void VoyeurEngine::stm_doState(ThreadResource *thread) {
+void VoyeurEngine::stm_unloadAllStacks() {
+	if (_stampFlags & 1) {
+		for (int i = 0; i < 8; ++i) {
+			if (_stm_useCount[i])
+				_stampLibPtr->freeBoltMember(_controlPtr->_memberIds[i]);
+		}
+	}
+}
 
+void VoyeurEngine::stm_doState(ThreadResource *thread) {
+	warning("TODO: stm_doState");
 }
 
 } // End of namespace Voyeur


Commit: 7ccc9a3fabc7138ab45dfe1bf987ac4e07739b50
    https://github.com/scummvm/scummvm/commit/7ccc9a3fabc7138ab45dfe1bf987ac4e07739b50
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T16:25:40-08:00

Commit Message:
VOYEUR: Moved stm methods into ThreadResource class

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index f9fce61..84f0df8 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1307,10 +1307,57 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
-ThreadResource::ThreadResource(BoltFilesState &state, const byte *src) {
+int ThreadResource::_stampFlags = 0;
+int ThreadResource::_useCount[8];
+
+ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
+		_vm(state._vm) {
 	_flags = READ_LE_UINT16(&src[8]);
 }
 
+bool ThreadResource::loadAStack(int idx) {
+	if (_stampFlags & 1) {
+		unloadAStack(_controlIndex);
+		if  (!_useCount[idx]) {
+			BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]);
+			if (!boltEntry._data)
+				return false;
+
+			_vm->_controlPtr->_entries[idx] = boltEntry._data;
+		}
+
+		++_useCount[idx];
+	}
+
+	_ctlPtr = _vm->_controlPtr->_entries[idx];
+	return true;
+}
+
+void ThreadResource::unloadAStack(int idx) {
+	if ((_stampFlags & 1) && _useCount[idx]) {
+		if (--_useCount[idx] == 0) {
+			_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]);
+		}
+	}
+}
+
+void ThreadResource::doState() {
+	warning("TODO: stm_doState");
+}
+
+void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
+	if (_stampFlags & 1) {
+		for (int i = 0; i < 8; ++i) {
+			if (_useCount[i])
+				vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]);
+		}
+	}
+}
+
+void ThreadResource::initUseCount() {
+	Common::fill(&_useCount[0], &_useCount[8], 0);
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 7ea7dea..3ce9d4c 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -414,6 +414,14 @@ public:
 
 class ThreadResource {
 public:
+	static int _stampFlags;
+	static int _useCount[8];
+
+	static void initUseCount();
+	static void unloadAllStacks(VoyeurEngine *vm);
+public:
+	VoyeurEngine *_vm;
+
 	int _field0;
 	int _controlIndex;
 	int _field4, _field6;
@@ -424,6 +432,10 @@ public:
 public:
 	ThreadResource(BoltFilesState &state, const byte *src);
 	virtual ~ThreadResource() {}
+
+	bool loadAStack(int idx);
+	void unloadAStack(int idx);
+	void doState();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 000012c..7312728 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -41,7 +41,6 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_bVoy = NULL;
 	_iForceDeath = -1;
 	_controlPtr = NULL;
-	_stampFlags = 0;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 549a335..772343b 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,12 +84,7 @@ private:
 	void playStamp();
 	void initStamp();
 	void closeStamp();
-	void initUseCount();
-	void initThreadStruct(ThreadResource *thread, int v1, int idx);
-	bool stm_loadAStack(ThreadResource *thread, int idx);
-	void stm_unloadAStack(int idx);
-	void stm_unloadAllStacks();
-	void stm_doState(ThreadResource *thread);
+	void initThreadStruct(ThreadResource *thread, int idx, int v3);
 protected:
 	// Engine APIs
 	virtual Common::Error run();
@@ -108,8 +103,6 @@ public:
 	ControlResource *_controlPtr;
 	byte *_stampData;
 	BoltGroup *_stackGroupPtr;
-	int _stampFlags;
-	int _stm_useCount[8];
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ee7ef66..adaff87 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -65,72 +65,29 @@ void VoyeurEngine::playStamp() {
 }
 
 void VoyeurEngine::initStamp() {
-	_stampFlags &= ~1;
+	ThreadResource::_stampFlags &= ~1;
 	_stackGroupPtr = _controlGroupPtr;
 
 	if (!_controlPtr->_entries[0])
 		error("No control entries");
 
-	initUseCount();
+	ThreadResource::initUseCount();
 }
 
 void VoyeurEngine::closeStamp() {
-	stm_unloadAllStacks();
+	ThreadResource::unloadAllStacks(this);
 }
 
-void VoyeurEngine::initUseCount() {
-	Common::fill(&_stm_useCount[0], &_stm_useCount[8], 0);
-}
-
-void VoyeurEngine::initThreadStruct(ThreadResource *thread, int v1, int idx) {
+void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int v3) {
 	thread->_controlIndex = -1;
-	if (stm_loadAStack(thread, idx)) {
+	if (thread->loadAStack(idx)) {
 		thread->_field4 = thread->_field6 = -1;
-		thread->_field0 = idx;
+		thread->_field0 = v3;
 		thread->_field3A = -1;
 		thread->_field3E = -1;
 
-		stm_doState(thread);
-	}
-}
-
-bool VoyeurEngine::stm_loadAStack(ThreadResource *thread, int idx) {
-	if (_stampFlags & 1) {
-		stm_unloadAStack(thread->_controlIndex);
-		if  (!_stm_useCount[idx]) {
-			BoltEntry &boltEntry = _stampLibPtr->boltEntry(_controlPtr->_memberIds[idx]);
-			if (!boltEntry._data)
-				return false;
-
-			_controlPtr->_entries[idx] = boltEntry._data;
-		}
-
-		++_stm_useCount[idx];
-	}
-
-	thread->_ctlPtr = _controlPtr->_entries[idx];
-	return true;
-}
-
-void VoyeurEngine::stm_unloadAStack(int idx) {
-	if ((_stampFlags & 1) && _stm_useCount[idx]) {
-		if (--_stm_useCount[idx] == 0) {
-			_stampLibPtr->freeBoltMember(_controlPtr->_memberIds[idx]);
-		}
-	}
-}
-
-void VoyeurEngine::stm_unloadAllStacks() {
-	if (_stampFlags & 1) {
-		for (int i = 0; i < 8; ++i) {
-			if (_stm_useCount[i])
-				_stampLibPtr->freeBoltMember(_controlPtr->_memberIds[i]);
-		}
+		thread->doState();
 	}
 }
 
-void VoyeurEngine::stm_doState(ThreadResource *thread) {
-	warning("TODO: stm_doState");
-}
-
 } // End of namespace Voyeur


Commit: ce9b127cbcea20c827cd20b0385776338b08b7bc
    https://github.com/scummvm/scummvm/commit/ce9b127cbcea20c827cd20b0385776338b08b7bc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T19:57:11-08:00

Commit Message:
VOYEUR: Further thread initialisation methods

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 84f0df8..5b7e475 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1309,10 +1309,11 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 
 int ThreadResource::_stampFlags = 0;
 int ThreadResource::_useCount[8];
+byte *ThreadResource::_threadDataPtr = NULL;
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
-	_flags = READ_LE_UINT16(&src[8]);
+	_flags = src[8];
 }
 
 bool ThreadResource::loadAStack(int idx) {
@@ -1341,8 +1342,52 @@ void ThreadResource::unloadAStack(int idx) {
 	}
 }
 
-void ThreadResource::doState() {
+bool ThreadResource::doState() {
+	_flags |= 1;
+
+	if (!getStateInfo()) 
+		return false;
+
 	warning("TODO: stm_doState");
+	return true;
+}
+
+bool ThreadResource::getStateInfo() {
+	_field9 = 0;
+	int id = READ_LE_UINT16(_ctlPtr);
+
+	if (id <= _threadId) {
+		_field9 |= 0x80;
+		return false;
+	} else {
+		uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
+		fld += _threadId << 3;
+		_field46 = READ_LE_UINT32(_ctlPtr + fld + 4);
+		
+		fld = READ_LE_UINT32(_ctlPtr + fld);
+		byte *baseP = _ctlPtr + fld;
+		_field42 = READ_LE_UINT16(baseP);
+		_field40 = READ_LE_UINT16(baseP + 2);
+		_field44 = READ_LE_UINT16(baseP + 4);
+
+		_field28E = getDataOffset();
+		_field28E += READ_LE_UINT32(baseP + 6) / 2;
+
+		_field4A = baseP + 10;
+		
+		getButtonsText();
+		return true;
+	}
+}
+
+byte *ThreadResource::getDataOffset() {
+	uint32 offset = READ_LE_UINT32(_ctlPtr + 10);
+	_threadDataPtr = _ctlPtr + offset;
+	return _threadDataPtr;
+}
+
+void ThreadResource::getButtonsText() {
+	warning("TODO: stm_getButtonsText");
 }
 
 void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 3ce9d4c..1beb091 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -416,26 +416,39 @@ class ThreadResource {
 public:
 	static int _stampFlags;
 	static int _useCount[8];
+	static byte *_threadDataPtr;
 
 	static void initUseCount();
 	static void unloadAllStacks(VoyeurEngine *vm);
+private:
+	bool getStateInfo();
+	byte *getDataOffset();
+	void getButtonsText();
 public:
 	VoyeurEngine *_vm;
 
-	int _field0;
+	int _threadId;
 	int _controlIndex;
 	int _field4, _field6;
-	int _flags;
+	byte _flags;
+	int _field9;
 	int _field3A;
 	int _field3E;
+	int _field40;
+	int _field42;
+	int _field44;
+	uint32 _field46;
+	byte *_field4A;
+
 	byte *_ctlPtr;
+	byte *_field28E;
 public:
 	ThreadResource(BoltFilesState &state, const byte *src);
 	virtual ~ThreadResource() {}
 
 	bool loadAStack(int idx);
 	void unloadAStack(int idx);
-	void doState();
+	bool doState();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 772343b..bf84893 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,7 +84,7 @@ private:
 	void playStamp();
 	void initStamp();
 	void closeStamp();
-	void initThreadStruct(ThreadResource *thread, int idx, int v3);
+	void initThreadStruct(ThreadResource *thread, int idx, int id);
 protected:
 	// Engine APIs
 	virtual Common::Error run();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index adaff87..0401704 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -78,11 +78,11 @@ void VoyeurEngine::closeStamp() {
 	ThreadResource::unloadAllStacks(this);
 }
 
-void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int v3) {
+void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int id) {
 	thread->_controlIndex = -1;
 	if (thread->loadAStack(idx)) {
 		thread->_field4 = thread->_field6 = -1;
-		thread->_field0 = v3;
+		thread->_threadId = id;
 		thread->_field3A = -1;
 		thread->_field3E = -1;
 


Commit: afc4e0ed333ca4acd5fcb092362f9910225ffd93
    https://github.com/scummvm/scummvm/commit/afc4e0ed333ca4acd5fcb092362f9910225ffd93
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-08T20:44:06-08:00

Commit Message:
VOYEUR: Implemented thread getButtonsText and support methods

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 5b7e475..c583863 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1387,7 +1387,21 @@ byte *ThreadResource::getDataOffset() {
 }
 
 void ThreadResource::getButtonsText() {
-	warning("TODO: stm_getButtonsText");
+	int idx = 0;
+	
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0xC0) {
+			++p;
+			if (*p++ & 0x80) {
+				assert(idx < 7);
+				_field8E[idx] = getRecordOffset(p);
+				p += 4;
+			}
+
+			++idx;
+			_field8E[idx] = NULL;
+		}
+	}
 }
 
 void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
@@ -1403,6 +1417,56 @@ void ThreadResource::initUseCount() {
 	Common::fill(&_useCount[0], &_useCount[8], 0);
 }
 
+const byte *ThreadResource::getRecordOffset(const byte *p) {
+	uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6);
+	return _ctlPtr + recSize;
+}
+
+const byte *ThreadResource::getNextRecord(const byte *p) {
+	byte v = *p++;
+
+	switch (v) {
+	case 2:
+	case 4:
+	case 6:
+	case 8:
+	case 10:
+		return p + 8;
+	case 1:
+	case 3:
+	case 5:
+	case 7:
+	case 9:
+	case 11:
+	case 21:
+	case 22:
+	case 25:
+	case 26:
+		return p + 5;
+	case 17:
+	case 23:
+	case 24:
+	case 27:
+	case 28:
+		return p + 2;
+	case 19:
+	case 41:
+		return p + 6;
+	case 18:
+	case 51:
+	case 52:
+		return p + 1;
+	case 74:
+		return p + 4;
+	case 192:
+		if (*p * 0x80)
+			p += 4;
+		return p + 2;
+	default:
+		return p;
+	}
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 1beb091..13023f8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -424,6 +424,8 @@ private:
 	bool getStateInfo();
 	byte *getDataOffset();
 	void getButtonsText();
+	const byte *getRecordOffset(const byte *p);
+	const byte *getNextRecord(const byte *p);
 public:
 	VoyeurEngine *_vm;
 
@@ -439,6 +441,7 @@ public:
 	int _field44;
 	uint32 _field46;
 	byte *_field4A;
+	const byte *_field8E[8];
 
 	byte *_ctlPtr;
 	byte *_field28E;


Commit: 03f7fb64dbbdd3d595f15b7fa0f12f42eaee02eb
    https://github.com/scummvm/scummvm/commit/03f7fb64dbbdd3d595f15b7fa0f12f42eaee02eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-09T19:22:32-08:00

Commit Message:
VOYEUR: Implemented the playStamp method

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 5d347d0..5edcf22 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -71,6 +71,7 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_mouseButton = 0;
 	_fadeStatus = 0;
 	_priorFrameTime = g_system->getMillis();
+	_joe = 0;
 	Common::fill(&_keyState[0], &_keyState[256], false);
 
 	_v2A0A2 = 0;
@@ -404,4 +405,32 @@ void EventsManager::mouseOff() {
 	CursorMan.showMouse(false);
 }
 
+void EventsManager::getMouseInfo() {
+	if (_vm->_voy._eCursorOff[58] & 0x10) {
+		if ((_gameCounter - _joe) > 8) {
+			_joe = _gameCounter;
+
+			// TODO: Figure out difference between setOneColor and setColor calls
+			if (_vm->_bob) {
+				_vm->_bob = false;
+				//_vm->_graphicsManager.setColor(128, 55, 5, 5);
+				_vm->_graphicsManager.setColor(128, 220, 20, 20);
+			} else {
+				_vm->_bob = true;
+				//_vm->_graphicsManager.setColor(128, 55, 55, 55);
+				_vm->_graphicsManager.setColor(128, 220, 20, 20);
+			}
+		}
+	}
+
+	_vm->_voy._incriminate = _vm->_voy._newIncriminate;
+	_vm->_voy._lastInplay = _vm->_voy._newLastInplay;
+	_vm->_voy._fadeFunc = _vm->_voy._newFadeFunc;
+	_vm->_voy._fadeICF1 = _vm->_voy._newFadeICF1;
+}
+
+void EventsManager::checkForKey() {
+	warning("TODO: checkForKey");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 3cfdca4..c7bd52d 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -104,16 +104,22 @@ public:
 	int _field437E;
 	int _field4380;
 	int _field4382;
-	int _field4384;
+	int _videoEventId;
 	byte *_field4386;
 	int _curICF0;
 	int _curICF1;
 	int _fadeICF0;
 	int _fadeICF1;
-	int _fadeFunc;
+	void (*_fadeFunc)();
 	int _lastInplay;
 	int _incriminate;
 	int _policeEvent;
+
+	// Fields not originally in _voy, but I'm putting in for convenience
+	int _newIncriminate;
+	int _newLastInplay;
+	int _newFadeICF1;
+	void (*_newFadeFunc)();
 };
 
 class IntData {
@@ -145,6 +151,7 @@ private:
 	VoyeurEngine *_vm;
 	uint32 _priorFrameTime;
 	uint32 _gameCounter;
+	uint32 _joe;
 	bool _keyState[256];
 	int _mouseButton;
 	Common::List<IntNode *> _intNodes;
@@ -198,6 +205,8 @@ public:
 	void mouseOn();
 	void mouseOff();
 	Common::Point getMousePos() { return _mousePos; }
+	void getMouseInfo();
+	void checkForKey();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index c583863..056be5d 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1316,6 +1316,18 @@ ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 	_flags = src[8];
 }
 
+void ThreadResource::initThreadStruct(int idx, int id) {
+	_controlIndex = -1;
+	if (loadAStack(idx)) {
+		_field4 = _field6 = -1;
+		_threadId = id;
+		_field3A = -1;
+		_field3E = -1;
+
+		doState();
+	}
+}
+
 bool ThreadResource::loadAStack(int idx) {
 	if (_stampFlags & 1) {
 		unloadAStack(_controlIndex);
@@ -1348,8 +1360,18 @@ bool ThreadResource::doState() {
 	if (!getStateInfo()) 
 		return false;
 
-	warning("TODO: stm_doState");
-	return true;
+	getButtonsFlags();
+	getField1CE();
+
+	_vm->_glGoScene = -1;
+	_vm->_glGoStack = -1;
+
+	performOpenCard();
+	if (_field40 & 1) {
+		return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1));
+	} else {
+		return true;
+	}
 }
 
 bool ThreadResource::getStateInfo() {
@@ -1393,7 +1415,7 @@ void ThreadResource::getButtonsText() {
 		if (*p == 0xC0) {
 			++p;
 			if (*p++ & 0x80) {
-				assert(idx < 7);
+				assert(idx < 63);
 				_field8E[idx] = getRecordOffset(p);
 				p += 4;
 			}
@@ -1404,6 +1426,35 @@ void ThreadResource::getButtonsText() {
 	}
 }
 
+void ThreadResource::getButtonsFlags() {
+	int idx = 0;
+	
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0xC0) {
+			if (*++p & 0x20)
+				_field40 |= 2;
+
+			_field4E[idx] = *p++;
+			_field18E[idx] = *p++;
+
+			if (_field4E[idx] & 0x80)
+				p += 4;
+
+			++idx;
+		}
+	}
+}
+
+void ThreadResource::getField1CE() {
+	int idx = 0;
+	
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		assert(idx < 47);
+		_field1CE[idx++] = getRecordOffset(p);
+		_field1CE[idx] = NULL;
+	}
+}
+
 void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
 	if (_stampFlags & 1) {
 		for (int i = 0; i < 8; ++i) {
@@ -1413,6 +1464,15 @@ void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
 	}
 }
 
+void ThreadResource::performOpenCard() {
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0x47) {
+			cardAction(p + 1);
+			return;
+		}
+	}
+}
+
 void ThreadResource::initUseCount() {
 	Common::fill(&_useCount[0], &_useCount[8], 0);
 }
@@ -1467,6 +1527,15 @@ const byte *ThreadResource::getNextRecord(const byte *p) {
 	}
 }
 
+void ThreadResource::cardAction(const byte *p) {
+	warning("TODO: cardAction");
+}
+
+bool ThreadResource::chooseSTAMPButton(int idx) {
+	warning("TODO: chooseSTAMPButton");
+	return false;
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 13023f8..f79c723 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -424,8 +424,12 @@ private:
 	bool getStateInfo();
 	byte *getDataOffset();
 	void getButtonsText();
+	void getButtonsFlags();
+	void getField1CE();
+	void performOpenCard();
 	const byte *getRecordOffset(const byte *p);
 	const byte *getNextRecord(const byte *p);
+	void cardAction(const byte *p);
 public:
 	VoyeurEngine *_vm;
 
@@ -441,17 +445,30 @@ public:
 	int _field44;
 	uint32 _field46;
 	byte *_field4A;
-	const byte *_field8E[8];
-
+	byte _field4E[64];
+	const byte *_field8E[64];
+	byte _field18E[64];
+	const byte *_field1CE[48];
 	byte *_ctlPtr;
 	byte *_field28E;
 public:
 	ThreadResource(BoltFilesState &state, const byte *src);
 	virtual ~ThreadResource() {}
 
+	void initThreadStruct(int idx, int id);
 	bool loadAStack(int idx);
 	void unloadAStack(int idx);
 	bool doState();
+
+	bool chooseSTAMPButton(int idx);
+	void parsePlayCommands();
+	int doInterface();
+	void doRoom();
+	int doApt();
+	void doTapePlaying();
+	void checkForMurder();
+	void checkForIncriminate();
+
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index baba45f..f30fc64 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -51,4 +51,8 @@ void SoundManager::abortVOCMap() {
 	_mixer->stopHandle(_soundHandle);
 }
 
+void SoundManager::stopVOCPlay() {
+	warning("TODO: stopVOCPlay()");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 0784b92..6f233e6 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -43,6 +43,7 @@ public:
 	void playVOCMap(byte *voc, int vocSize);
 	bool vocMapStatus();
 	void continueVocMap();
+	void stopVOCPlay();
 	void abortVOCMap();
 };
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 7312728..58e9486 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -41,6 +41,8 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_bVoy = NULL;
 	_iForceDeath = -1;
 	_controlPtr = NULL;
+	_bob = false;
+	_playStamp1 = _playStamp2 = 0;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index bf84893..a2bde98 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,7 +84,14 @@ private:
 	void playStamp();
 	void initStamp();
 	void closeStamp();
-	void initThreadStruct(ThreadResource *thread, int idx, int id);
+	void reviewTape();
+	bool doGossip();
+	int doApt();
+	void doTapePlaying();
+	bool checkForMurder();
+	void checkForIncriminate();
+	void playAVideoEvent(int eventId);
+	int getChooseButton();
 protected:
 	// Engine APIs
 	virtual Common::Error run();
@@ -103,6 +110,11 @@ public:
 	ControlResource *_controlPtr;
 	byte *_stampData;
 	BoltGroup *_stackGroupPtr;
+	int _glGoScene;
+	int _glGoStack;
+	bool _bob;
+	int _playStamp1;
+	int _playStamp2;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 0401704..4545a73 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -45,7 +45,7 @@ void VoyeurEngine::playStamp() {
 
 	PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource;
 	ThreadResource *threadP = threadsList->_entries[0]->_threadResource;
-	initThreadStruct(threadP, 0, 0);
+	threadP->initThreadStruct(0, 0);
 
 	_voy._delaySecs = 0;
 	_eventsManager._videoComputerNum = 9;
@@ -53,9 +53,159 @@ void VoyeurEngine::playStamp() {
 	_eventsManager._v2A0A2 = 0;
 	_voy._eCursorOff[53] = 1;
 
+	int buttonId;
 	bool breakFlag = false;
 	while (!breakFlag && !shouldQuit()) {
-		breakFlag = true;
+		_eventsManager.getMouseInfo();
+		_playStamp1 = _playStamp2 = -1;
+		_eventsManager._videoComputerBut4 = -1;
+
+		threadP->parsePlayCommands();
+
+		bool flag = breakFlag = (_voy._eCursorOff[58] & 2) != 0;
+
+		switch (_voy._eCursorOff[54]) {
+		case 5:
+			buttonId = threadP->doInterface();
+			
+			if (buttonId == -2) {
+				switch (doApt()) {
+				case 0:
+					_voy._eCursorOff[55] = 140;
+					break;
+				case 1:
+					_voy._eCursorOff[58] = -2;
+					_voy._eCursorOff[53] = 1;
+					threadP->chooseSTAMPButton(22);
+					_voy._eCursorOff[55] = 143;
+					break;
+				case 2:
+					_voy._eCursorOff[58] = -2;
+					reviewTape();
+					_voy._eCursorOff[53] = 1;
+					_voy._eCursorOff[55] = 142;
+					break;
+				case 3:
+					_voy._eCursorOff[58] = -2;
+					threadP->chooseSTAMPButton(21);
+					break;
+				case 4:
+					breakFlag = true;
+					break;
+				case 5:
+					doGossip();
+					_voy._eCursorOff[53] = 1;
+					_voy._eCursorOff[55] = 141;
+					_voy._eCursorOff[58] = -1;
+					break;
+				default:
+					break;
+				}
+			} else {
+				threadP->chooseSTAMPButton(buttonId);
+			}
+			break;
+
+		case 6:
+			threadP->doRoom();
+			break;
+
+		case 16:
+			_voy._eCursorOff[56] = 17;
+			buttonId = threadP->doApt();
+			
+			switch (buttonId) {
+			case 1:
+				threadP->chooseSTAMPButton(22);
+				flag = true;
+				break;
+			case 2:
+				reviewTape();
+				_voy._eCursorOff[53] = 1;
+				break;
+			case 4:
+				flag = true;
+				breakFlag = true;
+				break;
+			default:
+				break;
+			}
+			break;
+
+		case 17:
+			doTapePlaying();
+			if (!checkForMurder() && _voy._eCursorOff[56] <= 15)
+				checkForIncriminate();
+
+			if (_voy._videoEventId != -1)
+				playAVideoEvent(_voy._videoEventId);
+			_voy._eCursorOff[58] &= 0x10;
+			threadP->chooseSTAMPButton(0);
+			break;
+
+		case 130: {
+			//_tmflag = 1;
+			if (_bVoy->getBoltGroup(_playStamp1)) {
+				_graphicsManager._backgroundPage = _bVoy->boltEntry(_playStamp1)._picResource;
+				_graphicsManager._backColors = _bVoy->boltEntry(_playStamp1 + 1)._cMapResource;
+
+				int buttonId = getChooseButton();
+				if (_voy._fadeFunc)
+					buttonId = 4;
+
+				_bVoy->freeBoltGroup(_playStamp1);
+				_graphicsManager.screenReset();
+				_playStamp1 = -1;
+				flag = true;
+
+				if (buttonId == 4) {
+					_voy._eCursorOff[54] = 131;
+					_eventsManager.checkForKey();
+					threadP->chooseSTAMPButton(buttonId);
+					flag = true;
+				} else {
+					threadP->chooseSTAMPButton(buttonId);
+					_voy._eCursorOff[53] = 1;
+				}
+			}
+			break;
+		}
+
+		default:
+			break;
+		}
+
+		do {
+			if (flag) {
+				if (_playStamp2 != -1) {
+					_soundManager.stopVOCPlay();
+					_playStamp2 = -1;
+				}
+
+				_eventsManager._videoComputerBut4 = -1;
+
+				if (_voy._eCursorOff[59] != -1) {
+					_bVoy->freeBoltGroup(_voy._eCursorOff[59]);
+					_voy._eCursorOff[59] = -1;
+				}
+
+				if (_playStamp1 != -1) {
+					_bVoy->freeBoltGroup(_playStamp1);
+					_playStamp1 = -1;
+				}
+
+				// Break out of loop
+				flag = false;
+
+			} else if (threadP->_field40 == 2) {
+				_eventsManager.getMouseInfo();
+				threadP->chooseSTAMPButton(0);
+				flag = true;
+			} else {
+				threadP->chooseSTAMPButton(0);
+				flag = true;
+			}
+		} while (flag);
 	}
 
 	_voy._field4386 = 0;
@@ -78,16 +228,40 @@ void VoyeurEngine::closeStamp() {
 	ThreadResource::unloadAllStacks(this);
 }
 
-void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int id) {
-	thread->_controlIndex = -1;
-	if (thread->loadAStack(idx)) {
-		thread->_field4 = thread->_field6 = -1;
-		thread->_threadId = id;
-		thread->_field3A = -1;
-		thread->_field3E = -1;
+void VoyeurEngine::reviewTape() {
+	warning("TODO: reviewTape");
+}
 
-		thread->doState();
-	}
+bool VoyeurEngine::doGossip() {
+	warning("TODO: doGossip");
+	return false;
+}
+
+int VoyeurEngine::doApt() {
+	warning("TODO");
+	return 0;
+}
+
+void VoyeurEngine::doTapePlaying() {
+	warning("TODO");
+}
+
+bool VoyeurEngine::checkForMurder() {
+	warning("TODO");
+	return false;
+}
+
+void VoyeurEngine::checkForIncriminate() {
+	warning("TODO");
+}
+
+void VoyeurEngine::playAVideoEvent(int eventId) {
+	warning("TODO");
+}
+
+int VoyeurEngine::getChooseButton()  {
+	warning("TODO");
+	return 0;
 }
 
 } // End of namespace Voyeur


Commit: 9cb1122a989b255e8944c07afdeed2175b2ee5cc
    https://github.com/scummvm/scummvm/commit/9cb1122a989b255e8944c07afdeed2175b2ee5cc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-09T19:28:53-08:00

Commit Message:
VOYEUR: Implement stubs for thread methods needed by playStamp

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 056be5d..6b0fc77 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1536,6 +1536,24 @@ bool ThreadResource::chooseSTAMPButton(int idx) {
 	return false;
 }
 
+void ThreadResource::parsePlayCommands() {
+
+}
+
+int ThreadResource::doApt() {
+	warning("TODO: doApt");
+	return 0;
+}
+
+void ThreadResource::doRoom() {
+	warning("TODO: doRoom");
+}
+
+int ThreadResource::doInterface() {
+	warning("TODO: doInterface");
+	return 0;
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {


Commit: 573e2c143dd34658c23f9c5820bb8eac0262ad9b
    https://github.com/scummvm/scummvm/commit/573e2c143dd34658c23f9c5820bb8eac0262ad9b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-10T06:19:54-08:00

Commit Message:
VOYEUR: Start of implementing parsePlayCommands

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 5edcf22..67471ad 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -44,6 +44,19 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 
 /*------------------------------------------------------------------------*/
 
+VoyeurEvent::VoyeurEvent(int v1, int v2, int v3, int v4, int v5, int v6, int v7) {
+	_computerNum = v1;
+	_computerBut[0] = v2;
+	_computerBut[1] = v3;
+	_computerBut[2] = v4;
+	_computerBut[3] = v5;
+	_computerOn = v6;
+	_dead = v7;
+}
+
+
+/*------------------------------------------------------------------------*/
+
 IntData::IntData() {
 	_field9 = false;
 	_flipWait = false;
@@ -406,7 +419,7 @@ void EventsManager::mouseOff() {
 }
 
 void EventsManager::getMouseInfo() {
-	if (_vm->_voy._eCursorOff[58] & 0x10) {
+	if (_vm->_voy._field478 & 0x10) {
 		if ((_gameCounter - _joe) > 8) {
 			_joe = _gameCounter;
 
@@ -433,4 +446,8 @@ void EventsManager::checkForKey() {
 	warning("TODO: checkForKey");
 }
 
+void EventsManager::startCursorBlink() {
+	error("TODO: startCursorBlink");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index c7bd52d..62ae6fd 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -57,6 +57,8 @@ public:
 	int _computerOn;
 	int _computerOff;
 	int _dead;
+public:
+	VoyeurEvent(int v1, int v2, int v3, int v4, int v5, int v6, int v7);
 };
 
 class SVoy {
@@ -65,21 +67,25 @@ public:
 	int _RTANum;
 	int _RTVNum;
 	int _switchBGNum;
-	int _group;
-	const int *_resolvePtr;
-	int _seconds;
-	int _minutes;
-	int _hours;
-	int _morning;
-	int _timeChangeFlag;
-	int _totalSeconds;
-	int _gameSeconds;
-	int _vCursorOn[160];
-	int _vCursorOff[160];
-	int _aCursorOn[60];
-	int _aCursorOff[60];
-	int _eCursorOn[60];
-	int _eCursorOff[60];
+	int _arr1[8][20];
+	int _arr2[8][20];
+	int _arr3[3][20];
+	int _arr4[3][20];
+	int _arr5[3][20];
+	int _arr6[3][20];
+	int _arr7[20];
+
+	int _field468;
+	int _field46A;
+	int _vocSecondsOffset;
+	int _field46E;
+	int _field470;
+	int _field472;
+	int _field474;
+	int _field478;
+	int _field47A;
+	int _field4F2;
+
 	int _timeStart;
 	int _duration;
 	int _vidStart;
@@ -96,7 +102,8 @@ public:
 	int _phones[5];
 	int _numPhonesUsed;
 	int _evidence[20];
-	VoyeurEvent _events[1000];
+	
+	Common::Array<VoyeurEvent> _events;
 	int _field4376;
 	int _field4378;
 	int _field437A;
@@ -207,6 +214,7 @@ public:
 	Common::Point getMousePos() { return _mousePos; }
 	void getMouseInfo();
 	void checkForKey();
+	void startCursorBlink();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 6b0fc77..c8db339 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -23,6 +23,7 @@
 #include "voyeur/files.h"
 #include "voyeur/graphics.h"
 #include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
 
 namespace Voyeur {
 
@@ -1390,7 +1391,7 @@ bool ThreadResource::getStateInfo() {
 		byte *baseP = _ctlPtr + fld;
 		_field42 = READ_LE_UINT16(baseP);
 		_field40 = READ_LE_UINT16(baseP + 2);
-		_field44 = READ_LE_UINT16(baseP + 4);
+		_parseCount = READ_LE_UINT16(baseP + 4);
 
 		_field28E = getDataOffset();
 		_field28E += READ_LE_UINT32(baseP + 6) / 2;
@@ -1536,10 +1537,93 @@ bool ThreadResource::chooseSTAMPButton(int idx) {
 	return false;
 }
 
+#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {}
+
 void ThreadResource::parsePlayCommands() {
+	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
+	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
+	Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
+	Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0);
+	Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999);
+	Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0);
+	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
+
+	byte *dataP = _field28E;
+	int v2;
 
+	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
+		uint16 id = GET_WORD;
+
+		switch (id) {
+		case 0:
+			_vm->_playStamp2 = READ_LE_UINT16(dataP);
+			dataP += 2;
+			break;
+		case 1:
+			v2 = GET_WORD;
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
+				_vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
+
+				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
+						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
+					_vm->_eventsManager._videoComputerBut4 = -1;
+				} else {
+					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
+					addAudioEventStart();
+
+					assert(_vm->_eventsManager._videoComputerBut4 < 38);
+					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
+						0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource;
+					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 
+						BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource;
+
+					(*_vm->_graphicsManager._vPort)->setupViewPort();
+					_vm->_graphicsManager._backColors->startFade();
+					(*_vm->_graphicsManager._vPort)->_flags |= 8;
+					_vm->_graphicsManager.flipPage();
+					_vm->_eventsManager.sWaitFlip();
+
+					while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+						_vm->_eventsManager.delay(1);
+
+					_vm->_voy._field478 = -2;
+					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
+					Common::String filename = _vm->_soundManager.getVOCFileName(
+						_vm->_eventsManager._videoComputerBut4 + 159);
+					_vm->_soundManager.startVOCPlay(filename);
+					_vm->_voy._field478 |= 16;
+					_vm->_eventsManager.startCursorBlink();
+
+					while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
+							_vm->_soundManager.getVOCStatus())
+							_vm->_eventsManager.delay(1);
+
+					_vm->_voy._field478 |= 1;
+					_vm->_soundManager.stopVOCPlay();
+					addAudioEventEnd();
+					_vm->_eventsManager.incrementTime(1);
+					_vm->_eventsManager.incrementTime(1);
+
+					_vm->_bVoy->freeBoltGroup(0x17F00);
+					_vm->_voy._field478 = -17;
+					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_voy._field470 = 129;
+					parseIndex = 999;
+				}				
+			} 
+			
+			dataP += 6;
+			break;
+		default:
+			break;
+		}
+	}
 }
 
+#undef GET_WORD
+
 int ThreadResource::doApt() {
 	warning("TODO: doApt");
 	return 0;
@@ -1554,6 +1638,13 @@ int ThreadResource::doInterface() {
 	return 0;
 }
 
+void ThreadResource::addAudioEventStart() {
+	_vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum,
+		_vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2, 
+		_vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, 
+		_vm->_eventsManager._videoDead));
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index f79c723..12791cb 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -430,6 +430,7 @@ private:
 	const byte *getRecordOffset(const byte *p);
 	const byte *getNextRecord(const byte *p);
 	void cardAction(const byte *p);
+	void addAudioEventStart();
 public:
 	VoyeurEngine *_vm;
 
@@ -442,7 +443,7 @@ public:
 	int _field3E;
 	int _field40;
 	int _field42;
-	int _field44;
+	int _parseCount;
 	uint32 _field46;
 	byte *_field4A;
 	byte _field4E[64];
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index f30fc64..752a35d 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -55,4 +55,20 @@ void SoundManager::stopVOCPlay() {
 	warning("TODO: stopVOCPlay()");
 }
 
+void SoundManager::setVOCOffset(int offset) {
+	error("TODO: setVOCOffset");
+}
+
+Common::String SoundManager::getVOCFileName(int idx) {
+	error("TODO: getVOCFileName");
+}
+
+void SoundManager::startVOCPlay(const Common::String &filename) {
+	error("TODO: startVOCPlay");
+}
+
+int SoundManager::getVOCStatus() {
+	error("TODO: getVOCStatus");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 6f233e6..6de9804 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -45,6 +45,10 @@ public:
 	void continueVocMap();
 	void stopVOCPlay();
 	void abortVOCMap();
+	void setVOCOffset(int offset);
+	Common::String getVOCFileName(int idx);
+	void startVOCPlay(const Common::String &filename);
+	int getVOCStatus();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index a3a76b6..f64cbdc 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -43,4 +43,10 @@ const int RESOLVE_TABLE[] = {
 	0x7500
 };
 
+const int BLIND_TABLE[] = {
+	0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 9, 10, 11, 1, 11, 5, 12,
+	13, 16, 15, 16, 17, 18, 5, 6, 18, 17, 13, 13, 14, 14,
+	5, 12, 6, 6, 13, 14, 13
+};
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 704ea35..4cd00e4 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -31,6 +31,8 @@ extern const int COMPUTER_DEFAULTS[];
 
 extern const int RESOLVE_TABLE[];
 
+extern const int BLIND_TABLE[];
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 58e9486..184026a 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -91,7 +91,7 @@ Common::Error VoyeurEngine::run() {
 	_eventsManager.resetMouse();
 	if (doHeadTitle()) {
 		if (_iForceDeath >= 1 && _iForceDeath <= 4)
-			_voy._eCursorOff[58] |= 0x80;
+			_voy._field478 |= 0x80;
 
 		playStamp();
 	}
@@ -131,12 +131,11 @@ void VoyeurEngine::globalInitBolt() {
 
 	// Setup default flags
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
-	_voy._eCursorOff[0x74 / 2] = 1;
-	_voy._eCursorOff[0x68 / 2] = 0;
+	_voy._field478 = 1;
 	_voy._field4376 = NULL; // Original set 63h:63h
-	_voy._evidence[19] = 0;
-	_voy._evidence[17] = 0;
-	_voy._evidence[18] = 9999;
+	_voy._field4F2 = 9999;
+	_voy._field472 = -1;
+	_voy._field478 = 256;
 	
 	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
 	_eventsManager.addFadeInt();
@@ -184,7 +183,7 @@ bool VoyeurEngine::doHeadTitle() {
 		_voy._incriminate = false;
 	}
 
-	if (_voy._eCursorOff[58] & 0x80) {
+	if (_voy._field478 & 0x80) {
 		// TODO: Check when these are called, and the two different loops.
 		// Also, comptuerNu isn't an array in IDB?
 		/*
@@ -197,7 +196,7 @@ bool VoyeurEngine::doHeadTitle() {
 		*/
 	}
 
-	_voy._eCursorOff[55] = 140;
+	_voy._field472 = 140;
 	return true;
 }
 
@@ -483,17 +482,17 @@ void VoyeurEngine::doOpening() {
 	int frmaeIndex = 0;
 	int creditShow = 1;
 
-	_voy._eCursorOff[52] = 0;
+	_voy._vocSecondsOffset = 0;
 	_voy._RTVNum = 0;
-	_voy._eCursorOff[50] = _voy._RTVNum;
-	_voy._eCursorOff[58] = 16;
+	_voy._field468 = _voy._RTVNum;
+	_voy._field478 = 16;
 	_eventsManager._videoComputerNum = 4;
 	_eventsManager._videoComputerBut1  = 0;
 	_eventsManager._videoComputerBut4 = 1;
 	_eventsManager._videoDead = -1;
 	addVideoEventStart();
 
-	_voy._eCursorOff[58] &= ~1;
+	_voy._field478 &= ~1;
 
 	for (int i = 0; i < 256; ++i)
 		_graphicsManager.setColor(i, 8, 8, 8);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index a2bde98..9edabbf 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -115,6 +115,7 @@ public:
 	bool _bob;
 	int _playStamp1;
 	int _playStamp2;
+	const int *_resolvePtr;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 4545a73..1d453e3 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -40,7 +40,7 @@ void VoyeurEngine::playStamp() {
 	_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
 
 	_stampLibPtr->getBoltGroup(0x10000);
-	_voy._resolvePtr = &RESOLVE_TABLE[0];
+	_resolvePtr = &RESOLVE_TABLE[0];
 	initStamp();
 
 	PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource;
@@ -51,7 +51,7 @@ void VoyeurEngine::playStamp() {
 	_eventsManager._videoComputerNum = 9;
 	_eventsManager._videoComputerBut1 = 0;
 	_eventsManager._v2A0A2 = 0;
-	_voy._eCursorOff[53] = 1;
+	_voy._field46E = 1;
 
 	int buttonId;
 	bool breakFlag = false;
@@ -62,31 +62,31 @@ void VoyeurEngine::playStamp() {
 
 		threadP->parsePlayCommands();
 
-		bool flag = breakFlag = (_voy._eCursorOff[58] & 2) != 0;
-
-		switch (_voy._eCursorOff[54]) {
+		bool flag = breakFlag = (_voy._field478 & 2) != 0;
+		 
+		switch (_voy._field470) {
 		case 5:
 			buttonId = threadP->doInterface();
 			
 			if (buttonId == -2) {
 				switch (doApt()) {
 				case 0:
-					_voy._eCursorOff[55] = 140;
+					_voy._field472 = 140;
 					break;
 				case 1:
-					_voy._eCursorOff[58] = -2;
-					_voy._eCursorOff[53] = 1;
+					_voy._field478 = -2;
+					_voy._field46E = 1;
 					threadP->chooseSTAMPButton(22);
-					_voy._eCursorOff[55] = 143;
+					_voy._field472 = 143;
 					break;
 				case 2:
-					_voy._eCursorOff[58] = -2;
+					_voy._field478 = -2;
 					reviewTape();
-					_voy._eCursorOff[53] = 1;
-					_voy._eCursorOff[55] = 142;
+					_voy._field46E = 1;
+					_voy._field472 = 142;
 					break;
 				case 3:
-					_voy._eCursorOff[58] = -2;
+					_voy._field478 = -2;
 					threadP->chooseSTAMPButton(21);
 					break;
 				case 4:
@@ -94,9 +94,9 @@ void VoyeurEngine::playStamp() {
 					break;
 				case 5:
 					doGossip();
-					_voy._eCursorOff[53] = 1;
-					_voy._eCursorOff[55] = 141;
-					_voy._eCursorOff[58] = -1;
+					_voy._field46E = 1;
+					_voy._field472 = 141;
+					_voy._field478 = -1;
 					break;
 				default:
 					break;
@@ -111,7 +111,7 @@ void VoyeurEngine::playStamp() {
 			break;
 
 		case 16:
-			_voy._eCursorOff[56] = 17;
+			_voy._field474 = 17;
 			buttonId = threadP->doApt();
 			
 			switch (buttonId) {
@@ -121,7 +121,7 @@ void VoyeurEngine::playStamp() {
 				break;
 			case 2:
 				reviewTape();
-				_voy._eCursorOff[53] = 1;
+				_voy._field46E = 1;
 				break;
 			case 4:
 				flag = true;
@@ -134,12 +134,12 @@ void VoyeurEngine::playStamp() {
 
 		case 17:
 			doTapePlaying();
-			if (!checkForMurder() && _voy._eCursorOff[56] <= 15)
+			if (!checkForMurder() && _voy._field474 <= 15)
 				checkForIncriminate();
 
 			if (_voy._videoEventId != -1)
 				playAVideoEvent(_voy._videoEventId);
-			_voy._eCursorOff[58] &= 0x10;
+			_voy._field478 &= 0x10;
 			threadP->chooseSTAMPButton(0);
 			break;
 
@@ -159,13 +159,13 @@ void VoyeurEngine::playStamp() {
 				flag = true;
 
 				if (buttonId == 4) {
-					_voy._eCursorOff[54] = 131;
+					_voy._field470 = 131;
 					_eventsManager.checkForKey();
 					threadP->chooseSTAMPButton(buttonId);
 					flag = true;
 				} else {
 					threadP->chooseSTAMPButton(buttonId);
-					_voy._eCursorOff[53] = 1;
+					_voy._field46E = 1;
 				}
 			}
 			break;
@@ -184,9 +184,9 @@ void VoyeurEngine::playStamp() {
 
 				_eventsManager._videoComputerBut4 = -1;
 
-				if (_voy._eCursorOff[59] != -1) {
-					_bVoy->freeBoltGroup(_voy._eCursorOff[59]);
-					_voy._eCursorOff[59] = -1;
+				if (_voy._field47A != -1) {
+					_bVoy->freeBoltGroup(_voy._field47A);
+					_voy._field47A = -1;
 				}
 
 				if (_playStamp1 != -1) {


Commit: 966065269574f258d6106e2a48f23b6d5cf6da9a
    https://github.com/scummvm/scummvm/commit/966065269574f258d6106e2a48f23b6d5cf6da9a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-10T17:47:05-08:00

Commit Message:
VOYEUR: More of parsePlayCommands implemented

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 67471ad..6dbd7de 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -450,4 +450,8 @@ void EventsManager::startCursorBlink() {
 	error("TODO: startCursorBlink");
 }
 
+void EventsManager::incrementTime(int amt) {
+	error("TODO: incrementTime");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 62ae6fd..5c33bee 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -215,6 +215,7 @@ public:
 	void getMouseInfo();
 	void checkForKey();
 	void startCursorBlink();
+	void incrementTime(int amt);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index c8db339..4f2cfbf 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1555,11 +1555,12 @@ void ThreadResource::parsePlayCommands() {
 		uint16 id = GET_WORD;
 
 		switch (id) {
-		case 0:
+		case 1:
 			_vm->_playStamp2 = READ_LE_UINT16(dataP);
 			dataP += 2;
 			break;
-		case 1:
+
+		case 2:
 			v2 = GET_WORD;
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
@@ -1616,6 +1617,26 @@ void ThreadResource::parsePlayCommands() {
 			
 			dataP += 6;
 			break;
+
+		case 3:
+			break;
+
+		case 4:
+		case 22:
+			_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
+			dataP += 2;
+
+			// TODO: Original had a block here that would never be executed
+
+			_vm->_voy._vocSecondsOffset = 0;
+			_vm->_voy._field468 = _vm->_voy._RTVNum;
+			_vm->_voy._field478 &= ~0x11;
+			_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
+			_vm->_voy._field478 |= 1;
+			_vm->_eventsManager._videoComputerBut4 = -1;
+			parseIndex = 999;
+			break;			
+
 		default:
 			break;
 		}
@@ -1645,6 +1666,10 @@ void ThreadResource::addAudioEventStart() {
 		_vm->_eventsManager._videoDead));
 }
 
+void ThreadResource::addAudioEventEnd() {
+	error("TODO: addAudioEventEnd");
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 12791cb..4dc95fd 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -431,6 +431,7 @@ private:
 	const byte *getNextRecord(const byte *p);
 	void cardAction(const byte *p);
 	void addAudioEventStart();
+	void addAudioEventEnd();
 public:
 	VoyeurEngine *_vm;
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 184026a..6409bbb 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -590,4 +590,8 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
 	_eventsManager.sWaitFlip();
 }
 
+void VoyeurEngine::playAVideo(int id) {
+	warning("TODO: playAVideo");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 9edabbf..2619a51 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -136,6 +136,7 @@ public:
 
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
+	void playAVideo(int id);
 };
 
 } // End of namespace Voyeur


Commit: 10be9a527be4f6a0ac74cb8f916e93da712730c6
    https://github.com/scummvm/scummvm/commit/10be9a527be4f6a0ac74cb8f916e93da712730c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-10T18:34:48-08:00

Commit Message:
VOYEUR: Split ThreadResource into it's own file

Changed paths:
  A engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
new file mode 100644
index 0000000..bb58bcd
--- /dev/null
+++ b/engines/voyeur/files_threads.cpp
@@ -0,0 +1,392 @@
+/* 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 "voyeur/files.h"
+#include "voyeur/graphics.h"
+#include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
+
+namespace Voyeur {
+
+int ThreadResource::_stampFlags = 0;
+int ThreadResource::_useCount[8];
+byte *ThreadResource::_threadDataPtr = NULL;
+
+ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
+		_vm(state._vm) {
+	_flags = src[8];
+}
+
+void ThreadResource::initThreadStruct(int idx, int id) {
+	_controlIndex = -1;
+	if (loadAStack(idx)) {
+		_field4 = _field6 = -1;
+		_threadId = id;
+		_field3A = -1;
+		_field3E = -1;
+
+		doState();
+	}
+}
+
+bool ThreadResource::loadAStack(int idx) {
+	if (_stampFlags & 1) {
+		unloadAStack(_controlIndex);
+		if  (!_useCount[idx]) {
+			BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]);
+			if (!boltEntry._data)
+				return false;
+
+			_vm->_controlPtr->_entries[idx] = boltEntry._data;
+		}
+
+		++_useCount[idx];
+	}
+
+	_ctlPtr = _vm->_controlPtr->_entries[idx];
+	return true;
+}
+
+void ThreadResource::unloadAStack(int idx) {
+	if ((_stampFlags & 1) && _useCount[idx]) {
+		if (--_useCount[idx] == 0) {
+			_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]);
+		}
+	}
+}
+
+bool ThreadResource::doState() {
+	_flags |= 1;
+
+	if (!getStateInfo()) 
+		return false;
+
+	getButtonsFlags();
+	getField1CE();
+
+	_vm->_glGoScene = -1;
+	_vm->_glGoStack = -1;
+
+	performOpenCard();
+	if (_field40 & 1) {
+		return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1));
+	} else {
+		return true;
+	}
+}
+
+bool ThreadResource::getStateInfo() {
+	_field9 = 0;
+	int id = READ_LE_UINT16(_ctlPtr);
+
+	if (id <= _threadId) {
+		_field9 |= 0x80;
+		return false;
+	} else {
+		uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
+		fld += _threadId << 3;
+		_field46 = READ_LE_UINT32(_ctlPtr + fld + 4);
+		
+		fld = READ_LE_UINT32(_ctlPtr + fld);
+		byte *baseP = _ctlPtr + fld;
+		_field42 = READ_LE_UINT16(baseP);
+		_field40 = READ_LE_UINT16(baseP + 2);
+		_parseCount = READ_LE_UINT16(baseP + 4);
+
+		_field28E = getDataOffset();
+		_field28E += READ_LE_UINT32(baseP + 6) / 2;
+
+		_field4A = baseP + 10;
+		
+		getButtonsText();
+		return true;
+	}
+}
+
+byte *ThreadResource::getDataOffset() {
+	uint32 offset = READ_LE_UINT32(_ctlPtr + 10);
+	_threadDataPtr = _ctlPtr + offset;
+	return _threadDataPtr;
+}
+
+void ThreadResource::getButtonsText() {
+	int idx = 0;
+	
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0xC0) {
+			++p;
+			if (*p++ & 0x80) {
+				assert(idx < 63);
+				_field8E[idx] = getRecordOffset(p);
+				p += 4;
+			}
+
+			++idx;
+			_field8E[idx] = NULL;
+		}
+	}
+}
+
+void ThreadResource::getButtonsFlags() {
+	int idx = 0;
+	
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0xC0) {
+			if (*++p & 0x20)
+				_field40 |= 2;
+
+			_field4E[idx] = *p++;
+			_field18E[idx] = *p++;
+
+			if (_field4E[idx] & 0x80)
+				p += 4;
+
+			++idx;
+		}
+	}
+}
+
+void ThreadResource::getField1CE() {
+	int idx = 0;
+	
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		assert(idx < 47);
+		_field1CE[idx++] = getRecordOffset(p);
+		_field1CE[idx] = NULL;
+	}
+}
+
+void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
+	if (_stampFlags & 1) {
+		for (int i = 0; i < 8; ++i) {
+			if (_useCount[i])
+				vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]);
+		}
+	}
+}
+
+void ThreadResource::performOpenCard() {
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0x47) {
+			cardAction(p + 1);
+			return;
+		}
+	}
+}
+
+void ThreadResource::initUseCount() {
+	Common::fill(&_useCount[0], &_useCount[8], 0);
+}
+
+const byte *ThreadResource::getRecordOffset(const byte *p) {
+	uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6);
+	return _ctlPtr + recSize;
+}
+
+const byte *ThreadResource::getNextRecord(const byte *p) {
+	byte v = *p++;
+
+	switch (v) {
+	case 2:
+	case 4:
+	case 6:
+	case 8:
+	case 10:
+		return p + 8;
+	case 1:
+	case 3:
+	case 5:
+	case 7:
+	case 9:
+	case 11:
+	case 21:
+	case 22:
+	case 25:
+	case 26:
+		return p + 5;
+	case 17:
+	case 23:
+	case 24:
+	case 27:
+	case 28:
+		return p + 2;
+	case 19:
+	case 41:
+		return p + 6;
+	case 18:
+	case 51:
+	case 52:
+		return p + 1;
+	case 74:
+		return p + 4;
+	case 192:
+		if (*p * 0x80)
+			p += 4;
+		return p + 2;
+	default:
+		return p;
+	}
+}
+
+void ThreadResource::cardAction(const byte *p) {
+	warning("TODO: cardAction");
+}
+
+bool ThreadResource::chooseSTAMPButton(int idx) {
+	warning("TODO: chooseSTAMPButton");
+	return false;
+}
+
+#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {}
+
+void ThreadResource::parsePlayCommands() {
+	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
+	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
+	Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
+	Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0);
+	Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999);
+	Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0);
+	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
+
+	byte *dataP = _field28E;
+	int v2;
+
+	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
+		uint16 id = GET_WORD;
+
+		switch (id) {
+		case 1:
+			_vm->_playStamp2 = READ_LE_UINT16(dataP);
+			dataP += 2;
+			break;
+
+		case 2:
+			v2 = GET_WORD;
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
+				_vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
+
+				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
+						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
+					_vm->_eventsManager._videoComputerBut4 = -1;
+				} else {
+					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
+					addAudioEventStart();
+
+					assert(_vm->_eventsManager._videoComputerBut4 < 38);
+					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
+						0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource;
+					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 
+						BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource;
+
+					(*_vm->_graphicsManager._vPort)->setupViewPort();
+					_vm->_graphicsManager._backColors->startFade();
+					(*_vm->_graphicsManager._vPort)->_flags |= 8;
+					_vm->_graphicsManager.flipPage();
+					_vm->_eventsManager.sWaitFlip();
+
+					while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+						_vm->_eventsManager.delay(1);
+
+					_vm->_voy._field478 = -2;
+					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
+					Common::String filename = _vm->_soundManager.getVOCFileName(
+						_vm->_eventsManager._videoComputerBut4 + 159);
+					_vm->_soundManager.startVOCPlay(filename);
+					_vm->_voy._field478 |= 16;
+					_vm->_eventsManager.startCursorBlink();
+
+					while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
+							_vm->_soundManager.getVOCStatus())
+							_vm->_eventsManager.delay(1);
+
+					_vm->_voy._field478 |= 1;
+					_vm->_soundManager.stopVOCPlay();
+					addAudioEventEnd();
+					_vm->_eventsManager.incrementTime(1);
+					_vm->_eventsManager.incrementTime(1);
+
+					_vm->_bVoy->freeBoltGroup(0x17F00);
+					_vm->_voy._field478 = -17;
+					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_voy._field470 = 129;
+					parseIndex = 999;
+				}				
+			} 
+			
+			dataP += 6;
+			break;
+
+		case 3:
+			break;
+
+		case 4:
+		case 22:
+			_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
+			dataP += 2;
+
+			// TODO: Original had a block here that would never be executed
+
+			_vm->_voy._vocSecondsOffset = 0;
+			_vm->_voy._field468 = _vm->_voy._RTVNum;
+			_vm->_voy._field478 &= ~0x11;
+			_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
+			_vm->_voy._field478 |= 1;
+			_vm->_eventsManager._videoComputerBut4 = -1;
+			parseIndex = 999;
+			break;			
+
+		default:
+			break;
+		}
+	}
+}
+
+#undef GET_WORD
+
+int ThreadResource::doApt() {
+	warning("TODO: doApt");
+	return 0;
+}
+
+void ThreadResource::doRoom() {
+	warning("TODO: doRoom");
+}
+
+int ThreadResource::doInterface() {
+	warning("TODO: doInterface");
+	return 0;
+}
+
+void ThreadResource::addAudioEventStart() {
+	_vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum,
+		_vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2, 
+		_vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, 
+		_vm->_eventsManager._videoDead));
+}
+
+void ThreadResource::addAudioEventEnd() {
+	error("TODO: addAudioEventEnd");
+}
+
+} // End of namespace Voyeur


Commit: d08953ccd94b00c1e74cfb36fb230649c4e58bae
    https://github.com/scummvm/scummvm/commit/d08953ccd94b00c1e74cfb36fb230649c4e58bae
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-10T21:11:02-08:00

Commit Message:
VOYEUR: Implemented more of parsePlayCommands

Changed paths:
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/module.mk
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 5c33bee..97927e7 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -82,8 +82,14 @@ public:
 	int _field470;
 	int _field472;
 	int _field474;
+	int _field476;
 	int _field478;
 	int _field47A;
+	int _field4E2;
+	Common::Rect _rect4E4;
+	int _field4EC;
+	int _field4EE;
+	int _field4F0;
 	int _field4F2;
 
 	int _timeStart;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 4f2cfbf..9b1a0b1 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -242,7 +242,7 @@ BoltFile::~BoltFile() {
 		_state._curFd = NULL;
 }
 
-bool BoltFile::getBoltGroup(uint32 id) {
+BoltGroup *BoltFile::getBoltGroup(uint32 id) {
 	++_state._fromGroupFlag;
 	_state._curLibPtr = this;
 	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
@@ -268,7 +268,8 @@ bool BoltFile::getBoltGroup(uint32 id) {
 
 	resolveAll();
 	--_state._fromGroupFlag;
-	return true;
+
+	return _state._curGroupPtr;
 }
 
 void BoltFile::freeBoltGroup(uint32 id) {
@@ -929,6 +930,12 @@ void ViewPortResource::setupViewPort() {
 		&GraphicsManager::restoreMCGASaveRect);
 }
 
+void ViewPortResource::setupViewPort(PictureResource *pic) {
+	setupViewPort(pic, NULL,
+		&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
+		&GraphicsManager::restoreMCGASaveRect);
+}
+
 int ViewPortResource::drawText(const Common::String &msg) {
 	GraphicsManager &gfxManager = _state._vm->_graphicsManager;
 	assert(gfxManager._fontPtr);
@@ -1308,370 +1315,6 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
-int ThreadResource::_stampFlags = 0;
-int ThreadResource::_useCount[8];
-byte *ThreadResource::_threadDataPtr = NULL;
-
-ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
-		_vm(state._vm) {
-	_flags = src[8];
-}
-
-void ThreadResource::initThreadStruct(int idx, int id) {
-	_controlIndex = -1;
-	if (loadAStack(idx)) {
-		_field4 = _field6 = -1;
-		_threadId = id;
-		_field3A = -1;
-		_field3E = -1;
-
-		doState();
-	}
-}
-
-bool ThreadResource::loadAStack(int idx) {
-	if (_stampFlags & 1) {
-		unloadAStack(_controlIndex);
-		if  (!_useCount[idx]) {
-			BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]);
-			if (!boltEntry._data)
-				return false;
-
-			_vm->_controlPtr->_entries[idx] = boltEntry._data;
-		}
-
-		++_useCount[idx];
-	}
-
-	_ctlPtr = _vm->_controlPtr->_entries[idx];
-	return true;
-}
-
-void ThreadResource::unloadAStack(int idx) {
-	if ((_stampFlags & 1) && _useCount[idx]) {
-		if (--_useCount[idx] == 0) {
-			_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]);
-		}
-	}
-}
-
-bool ThreadResource::doState() {
-	_flags |= 1;
-
-	if (!getStateInfo()) 
-		return false;
-
-	getButtonsFlags();
-	getField1CE();
-
-	_vm->_glGoScene = -1;
-	_vm->_glGoStack = -1;
-
-	performOpenCard();
-	if (_field40 & 1) {
-		return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1));
-	} else {
-		return true;
-	}
-}
-
-bool ThreadResource::getStateInfo() {
-	_field9 = 0;
-	int id = READ_LE_UINT16(_ctlPtr);
-
-	if (id <= _threadId) {
-		_field9 |= 0x80;
-		return false;
-	} else {
-		uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
-		fld += _threadId << 3;
-		_field46 = READ_LE_UINT32(_ctlPtr + fld + 4);
-		
-		fld = READ_LE_UINT32(_ctlPtr + fld);
-		byte *baseP = _ctlPtr + fld;
-		_field42 = READ_LE_UINT16(baseP);
-		_field40 = READ_LE_UINT16(baseP + 2);
-		_parseCount = READ_LE_UINT16(baseP + 4);
-
-		_field28E = getDataOffset();
-		_field28E += READ_LE_UINT32(baseP + 6) / 2;
-
-		_field4A = baseP + 10;
-		
-		getButtonsText();
-		return true;
-	}
-}
-
-byte *ThreadResource::getDataOffset() {
-	uint32 offset = READ_LE_UINT32(_ctlPtr + 10);
-	_threadDataPtr = _ctlPtr + offset;
-	return _threadDataPtr;
-}
-
-void ThreadResource::getButtonsText() {
-	int idx = 0;
-	
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
-		if (*p == 0xC0) {
-			++p;
-			if (*p++ & 0x80) {
-				assert(idx < 63);
-				_field8E[idx] = getRecordOffset(p);
-				p += 4;
-			}
-
-			++idx;
-			_field8E[idx] = NULL;
-		}
-	}
-}
-
-void ThreadResource::getButtonsFlags() {
-	int idx = 0;
-	
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
-		if (*p == 0xC0) {
-			if (*++p & 0x20)
-				_field40 |= 2;
-
-			_field4E[idx] = *p++;
-			_field18E[idx] = *p++;
-
-			if (_field4E[idx] & 0x80)
-				p += 4;
-
-			++idx;
-		}
-	}
-}
-
-void ThreadResource::getField1CE() {
-	int idx = 0;
-	
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
-		assert(idx < 47);
-		_field1CE[idx++] = getRecordOffset(p);
-		_field1CE[idx] = NULL;
-	}
-}
-
-void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
-	if (_stampFlags & 1) {
-		for (int i = 0; i < 8; ++i) {
-			if (_useCount[i])
-				vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]);
-		}
-	}
-}
-
-void ThreadResource::performOpenCard() {
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
-		if (*p == 0x47) {
-			cardAction(p + 1);
-			return;
-		}
-	}
-}
-
-void ThreadResource::initUseCount() {
-	Common::fill(&_useCount[0], &_useCount[8], 0);
-}
-
-const byte *ThreadResource::getRecordOffset(const byte *p) {
-	uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6);
-	return _ctlPtr + recSize;
-}
-
-const byte *ThreadResource::getNextRecord(const byte *p) {
-	byte v = *p++;
-
-	switch (v) {
-	case 2:
-	case 4:
-	case 6:
-	case 8:
-	case 10:
-		return p + 8;
-	case 1:
-	case 3:
-	case 5:
-	case 7:
-	case 9:
-	case 11:
-	case 21:
-	case 22:
-	case 25:
-	case 26:
-		return p + 5;
-	case 17:
-	case 23:
-	case 24:
-	case 27:
-	case 28:
-		return p + 2;
-	case 19:
-	case 41:
-		return p + 6;
-	case 18:
-	case 51:
-	case 52:
-		return p + 1;
-	case 74:
-		return p + 4;
-	case 192:
-		if (*p * 0x80)
-			p += 4;
-		return p + 2;
-	default:
-		return p;
-	}
-}
-
-void ThreadResource::cardAction(const byte *p) {
-	warning("TODO: cardAction");
-}
-
-bool ThreadResource::chooseSTAMPButton(int idx) {
-	warning("TODO: chooseSTAMPButton");
-	return false;
-}
-
-#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {}
-
-void ThreadResource::parsePlayCommands() {
-	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
-	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
-	Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
-	Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0);
-	Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999);
-	Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0);
-	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
-
-	byte *dataP = _field28E;
-	int v2;
-
-	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
-		uint16 id = GET_WORD;
-
-		switch (id) {
-		case 1:
-			_vm->_playStamp2 = READ_LE_UINT16(dataP);
-			dataP += 2;
-			break;
-
-		case 2:
-			v2 = GET_WORD;
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
-				_vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
-				_vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
-
-				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
-						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
-					_vm->_eventsManager._videoComputerBut4 = -1;
-				} else {
-					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
-					addAudioEventStart();
-
-					assert(_vm->_eventsManager._videoComputerBut4 < 38);
-					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
-						0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource;
-					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 
-						BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource;
-
-					(*_vm->_graphicsManager._vPort)->setupViewPort();
-					_vm->_graphicsManager._backColors->startFade();
-					(*_vm->_graphicsManager._vPort)->_flags |= 8;
-					_vm->_graphicsManager.flipPage();
-					_vm->_eventsManager.sWaitFlip();
-
-					while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-						_vm->_eventsManager.delay(1);
-
-					_vm->_voy._field478 = -2;
-					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
-					Common::String filename = _vm->_soundManager.getVOCFileName(
-						_vm->_eventsManager._videoComputerBut4 + 159);
-					_vm->_soundManager.startVOCPlay(filename);
-					_vm->_voy._field478 |= 16;
-					_vm->_eventsManager.startCursorBlink();
-
-					while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
-							_vm->_soundManager.getVOCStatus())
-							_vm->_eventsManager.delay(1);
-
-					_vm->_voy._field478 |= 1;
-					_vm->_soundManager.stopVOCPlay();
-					addAudioEventEnd();
-					_vm->_eventsManager.incrementTime(1);
-					_vm->_eventsManager.incrementTime(1);
-
-					_vm->_bVoy->freeBoltGroup(0x17F00);
-					_vm->_voy._field478 = -17;
-					_vm->_eventsManager._videoComputerBut4 = -1;
-					_vm->_voy._field470 = 129;
-					parseIndex = 999;
-				}				
-			} 
-			
-			dataP += 6;
-			break;
-
-		case 3:
-			break;
-
-		case 4:
-		case 22:
-			_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
-			dataP += 2;
-
-			// TODO: Original had a block here that would never be executed
-
-			_vm->_voy._vocSecondsOffset = 0;
-			_vm->_voy._field468 = _vm->_voy._RTVNum;
-			_vm->_voy._field478 &= ~0x11;
-			_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
-			_vm->_voy._field478 |= 1;
-			_vm->_eventsManager._videoComputerBut4 = -1;
-			parseIndex = 999;
-			break;			
-
-		default:
-			break;
-		}
-	}
-}
-
-#undef GET_WORD
-
-int ThreadResource::doApt() {
-	warning("TODO: doApt");
-	return 0;
-}
-
-void ThreadResource::doRoom() {
-	warning("TODO: doRoom");
-}
-
-int ThreadResource::doInterface() {
-	warning("TODO: doInterface");
-	return 0;
-}
-
-void ThreadResource::addAudioEventStart() {
-	_vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum,
-		_vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2, 
-		_vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, 
-		_vm->_eventsManager._videoDead));
-}
-
-void ThreadResource::addAudioEventEnd() {
-	error("TODO: addAudioEventEnd");
-}
-
-/*------------------------------------------------------------------------*/
-
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
 	// Load pointer list
 	uint32 *idP = (uint32 *)&src[0];
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4dc95fd..5705608 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -119,7 +119,7 @@ public:
 	BoltFile(const Common::String &filename, BoltFilesState &state);
 	~BoltFile();
 
-	bool getBoltGroup(uint32 id);
+	BoltGroup *getBoltGroup(uint32 id);
 	void freeBoltGroup(uint32 id);
 	void freeBoltMember(uint32 id);
 	byte *memberAddr(uint32 id);
@@ -299,6 +299,7 @@ public:
 	virtual ~ViewPortResource();
 
 	void setupViewPort();
+	void setupViewPort(PictureResource *pic);
 	int drawText(const Common::String &msg);
 	int textWidth(const Common::String &msg);
 	void addSaveRect(int pageIndex, const Common::Rect &r);
@@ -432,6 +433,7 @@ private:
 	void cardAction(const byte *p);
 	void addAudioEventStart();
 	void addAudioEventEnd();
+	void addVideoEventEnd();
 public:
 	VoyeurEngine *_vm;
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index bb58bcd..e89e603 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -268,7 +268,7 @@ void ThreadResource::parsePlayCommands() {
 	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
 
 	byte *dataP = _field28E;
-	int v2;
+	int v2, v3;
 
 	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
 		uint16 id = GET_WORD;
@@ -338,6 +338,50 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 3:
+			v2 = GET_WORD;
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
+				_vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
+
+				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
+						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
+					_vm->_eventsManager._videoComputerBut4 = -1;
+				} else {
+					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
+					addAudioEventStart();
+					_vm->_voy._field478 &= ~1;
+					_vm->_voy._field478 |= 0x10;
+					_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
+
+					_vm->_voy._field478 &= ~0x10;
+					_vm->_voy._field478 |= 1;
+					addVideoEventEnd();
+					_vm->_eventsManager.incrementTime(1);
+				
+					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_playStamp1 = -1;
+
+					if (_vm->_eventsManager._videoDead != -1) {
+						_vm->_bVoy->freeBoltGroup(0x10E00);
+						_vm->_eventsManager._videoDead = -1;
+						(*_vm->_graphicsManager._vPort)->_flags |= 8;
+
+						_vm->_graphicsManager.flipPage();
+						_vm->_eventsManager.sWaitFlip();
+					}
+
+					_vm->_eventsManager._videoDead = -1;
+					if (_field42 == 2 && _vm->_voy._incriminate == 0) {
+						_vm->_voy._field470 = 132;
+						parseIndex = 999;
+					} else {
+						_vm->_voy._field470 = 129;
+					}
+				}
+			}
+
+			dataP += 6;
 			break;
 
 		case 4:
@@ -345,17 +389,205 @@ void ThreadResource::parsePlayCommands() {
 			_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
 			dataP += 2;
 
-			// TODO: Original had a block here that would never be executed
+			if (id == 22) {
+				int resolveIndex = GET_WORD;
+				_vm->_playStamp1 = _vm->_resolvePtr[resolveIndex];
+			}
 
 			_vm->_voy._vocSecondsOffset = 0;
 			_vm->_voy._field468 = _vm->_voy._RTVNum;
 			_vm->_voy._field478 &= ~0x11;
 			_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
 			_vm->_voy._field478 |= 1;
-			_vm->_eventsManager._videoComputerBut4 = -1;
-			parseIndex = 999;
+
+			if (id != 2) {
+				_vm->_eventsManager._videoComputerBut4 = -1;
+				parseIndex = 999;
+			} else {
+				// TODO: Double-check this
+				int count = _vm->_bVoy->getBoltGroup(_vm->_playStamp1)->_entries.size();
+				_vm->_soundManager.stopVOCPlay();
+				_vm->_eventsManager.getMouseInfo();
+
+				for (int i = 0; i < count; ++i) {
+					PictureResource *pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource;
+					CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource;
+
+					(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
+					pal->startFade();
+
+					(*_vm->_graphicsManager._vPort)->_flags |= 8;
+					_vm->_graphicsManager.flipPage();
+					_vm->_eventsManager.sWaitFlip();
+
+					while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+						_vm->_eventsManager.delay(1);
+
+					if (i > 0) {
+						_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2);
+						_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2 + 1);
+					}
+
+					Common::String file = Common::String::format("news%d.voc", i + 1);
+					_vm->_soundManager.startVOCPlay(file);
+
+					while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
+							_vm->_soundManager.getVOCStatus()) {
+						_vm->_eventsManager.delay(1);
+						_vm->_eventsManager.getMouseInfo();
+					}
+
+					_vm->_soundManager.stopVOCPlay();
+
+					if (i == (count - 1))
+						_vm->_eventsManager.delay(480);
+
+					if (_vm->shouldQuit() || _vm->_voy._incriminate)
+						break;
+				}
+
+				_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
+				_vm->_playStamp1 = -1;
+				_vm->_eventsManager._videoComputerBut4 = -1;
+				parseIndex = 999;
+			}
 			break;			
 
+		case 5:
+			v2 = READ_LE_UINT16(dataP);
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				_vm->_voy._field470 = 5;
+				int count = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field476 = READ_LE_UINT16(dataP + 4);
+
+				if (_vm->_voy._field474 != count) {
+					if (_vm->_voy._field474 > 1)
+						_vm->_voy._field478 &= ~0x100;
+
+					_vm->_voy._field474 = count;
+					_vm->_eventsManager._videoComputerBut1 = LEVEL_M[count - 1];
+					_vm->_eventsManager._videoComputerNum = LEVEL_H[count - 1];
+					//_vm->_v2A0A2 = 0;
+					_vm->_voy._RTVNum = 0;
+					_vm->_voy._RTANum = 255;
+				}
+
+				_vm->_voy._delaySecs = (_vm->_voy._field474 == 6) ? 1 : 0;
+			}
+
+			dataP += 6;
+			break;
+
+		case 6:
+			_vm->_voy._field470 = 6;
+			v2 = GET_WORD;
+			_vm->_playStamp1 = _vm->_resolvePtr[v2];
+			break;
+
+		case 7:
+			v2 = READ_LE_UINT16(dataP);
+			v3 = READ_LE_UINT16(dataP + 2) - 1;
+
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				int idx = 0;
+				while (_vm->_voy._arr1[idx][v3] != 9999)
+					++idx;
+
+				_vm->_voy._arr1[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
+				_vm->_voy._arr2[idx][v3] = v3;
+			}
+
+			dataP += 8;
+			break;
+
+		case 8:
+			v2 = READ_LE_UINT16(dataP);
+			v3 = READ_LE_UINT16(dataP + 2) - 1;
+
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				int idx = 0;
+				while (_vm->_voy._arr3[idx][v3] != 9999)
+					++idx;
+
+				_vm->_voy._arr3[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
+				_vm->_voy._arr4[idx][v3] = v3;
+			}
+
+			dataP += 8;
+			break;
+
+		case 9:
+			v2 = READ_LE_UINT16(dataP);
+			v3 = READ_LE_UINT16(dataP + 2) - 1;
+
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				int idx = 0;
+				while (_vm->_voy._arr5[idx][v3] != 9999)
+					++idx;
+
+				_vm->_voy._arr5[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
+				_vm->_voy._arr6[idx][v3] = v3;
+			}
+
+			dataP += 8;
+			break;
+
+		case 10:
+			if (_vm->_iForceDeath == -1) {
+				int randomVal;
+				do {
+					randomVal = _vm->getRandomNumber(3);
+				} while (randomVal == _vm->_voy._field4380);
+
+				_vm->_voy._field4380 = randomVal;
+				WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal);
+			} else {
+				_vm->_voy._field4380 = _vm->_iForceDeath;
+				WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath);
+			}
+
+			_vm->saveLastInplay();
+			break;
+
+		case 11:
+			_vm->_voy._field478 = 2;
+			break;
+
+		case 12:
+			v2 = READ_LE_UINT16(dataP);
+
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				_vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
+				_vm->_voy._arr7[READ_LE_UINT16(dataP + 4) - 1] = 1;
+			}
+
+			dataP += 6;
+			break;
+
+		case 13:
+			v2 = READ_LE_UINT16(dataP);
+
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+				_vm->_voy._field4E2 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field4EC = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._field4EE = READ_LE_UINT16(dataP + 6);
+
+				_vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4];
+				_vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 1];
+				_vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 2];
+				_vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 3];
+			}
+
+			dataP += 8;
+			break;
+
+		case 14:
+			_vm->_playStamp1 = 2048;
+			_vm->_voy._field470 = 130;
+			break;
+
+		// TODO: More
+
 		default:
 			break;
 		}
@@ -389,4 +621,8 @@ void ThreadResource::addAudioEventEnd() {
 	error("TODO: addAudioEventEnd");
 }
 
+void ThreadResource::addVideoEventEnd() {
+	error("TODO: addVideoEventEnd");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 1562624..c52502d 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
 	detection.o \
 	events.o \
 	files.o \
+	files_threads.o \
 	graphics.o \
 	sound.o \
 	staticres.o \
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index f64cbdc..f5dd561 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -43,10 +43,35 @@ const int RESOLVE_TABLE[] = {
 	0x7500
 };
 
+const int LEVEL_H[] = { 
+	4, 7, 7, 8, 9, 10, 2, 2, 4, 8, 8, 9, 9, 10, 10, 11, 11
+};
+
+const int LEVEL_M[] = {
+	0, 0, 30, 0, 30, 0, 0, 0, 30, 0, 30, 0, 45, 0, 30, 0, 30
+};
+
 const int BLIND_TABLE[] = {
 	0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 9, 10, 11, 1, 11, 5, 12,
 	13, 16, 15, 16, 17, 18, 5, 6, 18, 17, 13, 13, 14, 14,
 	5, 12, 6, 6, 13, 14, 13
 };
 
+const int COMP_BUT_TABLE[] = {
+	269, 128, 307, 163, 
+	269, 128, 307, 163, 
+	68, 79, 98, 102, 
+	68, 79, 98, 102, 
+	68, 79, 98, 102, 
+	68, 79, 98, 102,
+	248, 138, 291, 163, 
+	83, 132, 143, 156, 
+	248, 138, 291, 163, 
+	83, 132, 143, 156, 
+	83, 132, 143, 156, 
+	248, 138, 291, 163, 
+	68, 79, 98, 102, 
+	68, 79, 98, 102
+};
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 4cd00e4..e9c4164 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -31,8 +31,14 @@ extern const int COMPUTER_DEFAULTS[];
 
 extern const int RESOLVE_TABLE[];
 
+extern const int LEVEL_H[];
+
+extern const int LEVEL_M[];
+
 extern const int BLIND_TABLE[];
 
+extern const int COMP_BUT_TABLE[];
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 6409bbb..9d5c6a3 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -594,4 +594,8 @@ void VoyeurEngine::playAVideo(int id) {
 	warning("TODO: playAVideo");
 }
 
+void VoyeurEngine::saveLastInplay() {
+	error("TODO: saveLastInplay");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 2619a51..7a58529 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -65,7 +65,6 @@ private:
 	Common::RandomSource _randomSource;
 	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
-	int _iForceDeath;
 
 	void ESP_Init();
 	void initialiseManagers();
@@ -116,6 +115,7 @@ public:
 	int _playStamp1;
 	int _playStamp2;
 	const int *_resolvePtr;
+	int _iForceDeath;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
@@ -137,6 +137,7 @@ public:
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
 	void playAVideo(int id);
+	void saveLastInplay();
 };
 
 } // End of namespace Voyeur


Commit: 7f5a5606a53ac4e17f4465b0e127dc2a44531cbe
    https://github.com/scummvm/scummvm/commit/7f5a5606a53ac4e17f4465b0e127dc2a44531cbe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-11T18:46:06-08:00

Commit Message:
VOYEUR: Implemented remainder of parsePlayCommands

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 5705608..f32cbdf 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -418,7 +418,7 @@ public:
 	static int _stampFlags;
 	static int _useCount[8];
 	static byte *_threadDataPtr;
-
+	static CMapResource *_cmd14Pal;
 	static void initUseCount();
 	static void unloadAllStacks(VoyeurEngine *vm);
 private:
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index e89e603..a657102 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -30,6 +30,7 @@ namespace Voyeur {
 int ThreadResource::_stampFlags = 0;
 int ThreadResource::_useCount[8];
 byte *ThreadResource::_threadDataPtr = NULL;
+CMapResource *ThreadResource::_cmd14Pal = NULL;
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
@@ -269,6 +270,8 @@ void ThreadResource::parsePlayCommands() {
 
 	byte *dataP = _field28E;
 	int v2, v3;
+	PictureResource *pic;
+	CMapResource *pal;
 
 	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
 		uint16 id = GET_WORD;
@@ -410,8 +413,8 @@ void ThreadResource::parsePlayCommands() {
 				_vm->_eventsManager.getMouseInfo();
 
 				for (int i = 0; i < count; ++i) {
-					PictureResource *pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource;
-					CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource;
+					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource;
+					pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource;
 
 					(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 					pal->startFade();
@@ -586,7 +589,113 @@ void ThreadResource::parsePlayCommands() {
 			_vm->_voy._field470 = 130;
 			break;
 
-		// TODO: More
+		case 15:
+			_vm->_playStamp1 = (_vm->_voy._field4382 - 1) * 8 + 0x7700;
+			_vm->_voy._field47A = ((READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) 
+				- 1) << 8) + 0x7B00;
+
+			pic = _vm->_bVoy->boltEntry(_vm->_playStamp1)._picResource;
+			_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._cMapResource;
+
+			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
+			_cmd14Pal->startFade();
+
+			(*_vm->_graphicsManager._vPort)->_flags |= 8;
+			_vm->_graphicsManager.flipPage();
+			_vm->_eventsManager.sWaitFlip();
+
+			while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+				_vm->_eventsManager.delay(1);
+			_vm->_eventsManager.getMouseInfo();
+
+			for (int idx = 1; idx < 4; ++idx) {
+				if (idx == 3) {
+					pic = _vm->_bVoy->boltEntry(_vm->_voy._field47A)._picResource;
+					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_voy._field47A + 1)._cMapResource;
+				} else {
+					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2)._picResource;
+					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2 + 1)._cMapResource;
+				}
+
+				(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
+				_cmd14Pal->startFade();
+
+				(*_vm->_graphicsManager._vPort)->_flags |= 8;
+				_vm->_graphicsManager.flipPage();
+				_vm->_eventsManager.sWaitFlip();
+
+				while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+					_vm->_eventsManager.delay(1);
+
+				_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2);
+				_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2 + 1);
+
+				Common::String fname = Common::String::format("news%d.voc", idx);
+
+				while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
+						_vm->_soundManager.getVOCStatus())
+					_vm->_eventsManager.delay(1);
+
+				_vm->_soundManager.stopVOCPlay();
+				if (idx == 3)
+					_vm->_eventsManager.delay(3);
+
+				if (_vm->shouldQuit() || _vm->_voy._incriminate)
+					break;
+			}
+
+			_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
+			_vm->_bVoy->freeBoltGroup(_vm->_voy._field47A);
+			_vm->_playStamp1 = -1;
+			_vm->_voy._field47A = -1;
+			break;
+
+		case 16:
+			_vm->_voy._field470 = 16;
+			break;
+
+		case 17:
+			_vm->_voy._field470 = 17;
+			break;
+
+		case 18:
+			v2 = READ_LE_UINT16(dataP);
+			v3 = READ_LE_UINT16(dataP + 2);
+
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0)
+				_vm->_voy._field4F2 = v3;
+			
+			dataP += 4;
+			break;
+
+		case 19:
+			_vm->_voy._field472 = 140;
+			_vm->loadTheApt();
+			_vm->_voy._field472 = 141;
+			_vm->freeTheApt();
+			break;
+
+		case 20:
+			_vm->_voy._field472 = -1;
+			_vm->loadTheApt();
+			_vm->_voy._field472 = 141;
+			_vm->freeTheApt();
+			break;
+
+		case 21:
+			_vm->_voy._field472 = -1;
+			_vm->loadTheApt();
+			_vm->_voy._field472 = 140;
+			_vm->freeTheApt();
+			break;
+
+		case 23:
+			_vm->_voy._field474 = 17;
+			_vm->_voy._field472 = -1;
+			_vm->loadTheApt();
+			_vm->_voy._field472 = 144;
+			_vm->freeTheApt();
+			break;
 
 		default:
 			break;
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 7a58529..675200e 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -138,6 +138,8 @@ public:
 	void doTransitionCard(const Common::String &time, const Common::String &location);
 	void playAVideo(int id);
 	void saveLastInplay();
+	void loadTheApt();
+	void freeTheApt();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1d453e3..616a0b8 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -264,4 +264,12 @@ int VoyeurEngine::getChooseButton()  {
 	return 0;
 }
 
+void VoyeurEngine::loadTheApt() {
+	error("TODO: loadTheApt");
+}
+
+void VoyeurEngine::freeTheApt() {
+	error("TODO: freeTheApt");
+}
+
 } // End of namespace Voyeur


Commit: d5762b5332d0031cd3e4327fb868d8358dcaf7c2
    https://github.com/scummvm/scummvm/commit/d5762b5332d0031cd3e4327fb868d8358dcaf7c2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-11T18:51:33-08:00

Commit Message:
VOYEUR: Removed use of GET_WORD macro in parsePlayCommands

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index a657102..dc9d014 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -257,8 +257,6 @@ bool ThreadResource::chooseSTAMPButton(int idx) {
 	return false;
 }
 
-#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {}
-
 void ThreadResource::parsePlayCommands() {
 	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
 	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
@@ -274,7 +272,8 @@ void ThreadResource::parsePlayCommands() {
 	CMapResource *pal;
 
 	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
-		uint16 id = GET_WORD;
+		uint16 id = READ_LE_UINT16(dataP);
+		dataP += 2;
 
 		switch (id) {
 		case 1:
@@ -283,11 +282,12 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 2:
-			v2 = GET_WORD;
+			v2 = READ_LE_UINT16(dataP);
+
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
-				_vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
-				_vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
+				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
 				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
 						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
@@ -337,15 +337,16 @@ void ThreadResource::parsePlayCommands() {
 				}				
 			} 
 			
-			dataP += 6;
+			dataP += 8;
 			break;
 
 		case 3:
-			v2 = GET_WORD;
+			v2 = READ_LE_UINT16(dataP);
+
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
-				_vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
-				_vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
+				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
 				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
 						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
@@ -384,7 +385,7 @@ void ThreadResource::parsePlayCommands() {
 				}
 			}
 
-			dataP += 6;
+			dataP += 8;
 			break;
 
 		case 4:
@@ -393,7 +394,8 @@ void ThreadResource::parsePlayCommands() {
 			dataP += 2;
 
 			if (id == 22) {
-				int resolveIndex = GET_WORD;
+				int resolveIndex = READ_LE_UINT16(dataP);
+				dataP += 2;
 				_vm->_playStamp1 = _vm->_resolvePtr[resolveIndex];
 			}
 
@@ -483,8 +485,9 @@ void ThreadResource::parsePlayCommands() {
 
 		case 6:
 			_vm->_voy._field470 = 6;
-			v2 = GET_WORD;
+			v2 = READ_LE_UINT16(dataP);
 			_vm->_playStamp1 = _vm->_resolvePtr[v2];
+			dataP += 2;
 			break;
 
 		case 7:
@@ -703,8 +706,6 @@ void ThreadResource::parsePlayCommands() {
 	}
 }
 
-#undef GET_WORD
-
 int ThreadResource::doApt() {
 	warning("TODO: doApt");
 	return 0;


Commit: 7f018dafd5e56285e40d834de17447de3894a148
    https://github.com/scummvm/scummvm/commit/7f018dafd5e56285e40d834de17447de3894a148
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-11T19:20:48-08:00

Commit Message:
VOYEUR: Bugfixes for getField1CE method

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index dc9d014..0c0e9ab 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -169,10 +169,11 @@ void ThreadResource::getButtonsFlags() {
 void ThreadResource::getField1CE() {
 	int idx = 0;
 	
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _field4A; *p++ != 0x49; p = getNextRecord(p)) {
 		assert(idx < 47);
 		_field1CE[idx++] = getRecordOffset(p);
 		_field1CE[idx] = NULL;
+		p += 4;
 	}
 }
 
@@ -199,7 +200,7 @@ void ThreadResource::initUseCount() {
 }
 
 const byte *ThreadResource::getRecordOffset(const byte *p) {
-	uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6);
+	uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(_ctlPtr + 6);
 	return _ctlPtr + recSize;
 }
 


Commit: ae7bb13f20889c402b55f7d9ef55223b3437da06
    https://github.com/scummvm/scummvm/commit/ae7bb13f20889c402b55f7d9ef55223b3437da06
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-11T19:36:40-08:00

Commit Message:
VOYEUR: Fix loading of ControlResource

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9b1a0b1..c725169 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1333,7 +1333,7 @@ PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
 ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 	// Get pointer
 	uint32 ptrId = READ_LE_UINT32(&src[0x32]);
-	_ptr = state._curLibPtr->getBoltEntryFromLong(ptrId)._data;
+	state._curLibPtr->resolveIt(ptrId, &_ptr);
 
 	for (int i = 0; i < 8; ++i)
 		_memberIds[i] = READ_LE_UINT16(src + i * 2);
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 0c0e9ab..a437f01 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -543,7 +543,7 @@ void ThreadResource::parsePlayCommands() {
 			if (_vm->_iForceDeath == -1) {
 				int randomVal;
 				do {
-					randomVal = _vm->getRandomNumber(3);
+					randomVal = _vm->getRandomNumber(3) + 1;
 				} while (randomVal == _vm->_voy._field4380);
 
 				_vm->_voy._field4380 = randomVal;


Commit: 888f35fe5edb2c9de74651f2ba4be1975470bd0f
    https://github.com/scummvm/scummvm/commit/888f35fe5edb2c9de74651f2ba4be1975470bd0f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-11T19:57:51-08:00

Commit Message:
VOYEUR: Implemented the saveLastInplay method

Changed paths:
    engines/voyeur/utils.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/utils.cpp b/engines/voyeur/utils.cpp
index 5c86138..74470dc 100644
--- a/engines/voyeur/utils.cpp
+++ b/engines/voyeur/utils.cpp
@@ -30,7 +30,7 @@ LockTime::LockTime() {
 }
 
 void LockClass::getSysDate() {
-
+	// May not be needed for ScummVM
 }
 
 void LockClass::getThePassword() {
@@ -41,11 +41,11 @@ void LockClass::getThePassword() {
 	fieldC = -1;
 
 	// TODO: Original loaded 'VOYEUR.DAT' here to get most recent game's password.
-	// We'll want to transform this to proper savegames in ScummVM
+	// but since we allow seperate savegames in ScummVM, this is somewhat deprecated.
 }
 
 void LockClass::saveThePassword() {
-	//TODO
+	// May not be needed for ScummVM
 }
 
 Common::String LockClass::getDateString() {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 9d5c6a3..3b924fe 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -595,7 +595,11 @@ void VoyeurEngine::playAVideo(int id) {
 }
 
 void VoyeurEngine::saveLastInplay() {
-	error("TODO: saveLastInplay");
+	LockClass lock;
+	lock.getThePassword();
+	lock.fieldC = _voy._field4380;
+	lock.getSysDate();
+	lock.saveThePassword();
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 675200e..248d150 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -137,6 +137,10 @@ public:
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
 	void playAVideo(int id);
+
+	/**
+	 * Saves the last time the game was played
+	 */
 	void saveLastInplay();
 	void loadTheApt();
 	void freeTheApt();


Commit: dfd4e765f2072a108308be183427504c2efad643
    https://github.com/scummvm/scummvm/commit/dfd4e765f2072a108308be183427504c2efad643
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-12T05:51:13-08:00

Commit Message:
VOYEUR: Implementing code for chooseSTAMPButton and sub-methods

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index f32cbdf..e753b1d 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -430,10 +430,18 @@ private:
 	void performOpenCard();
 	const byte *getRecordOffset(const byte *p);
 	const byte *getNextRecord(const byte *p);
+	const byte *getSTAMPCard(int cardId);
+	int getStateFromID(uint32 id);
+	uint32 getSID(int sid);
 	void cardAction(const byte *p);
+	void doSTAMPCardAction();
 	void addAudioEventStart();
 	void addAudioEventEnd();
 	void addVideoEventEnd();
+	bool goToStateID(int stackId, int sceneId);
+	bool goToState(int stackId, int sceneId);
+	const byte *cardPerform(const byte *card);
+	void savePrevious();
 public:
 	VoyeurEngine *_vm;
 
@@ -464,7 +472,7 @@ public:
 	void unloadAStack(int idx);
 	bool doState();
 
-	bool chooseSTAMPButton(int idx);
+	bool chooseSTAMPButton(int buttonId);
 	void parsePlayCommands();
 	int doInterface();
 	void doRoom();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index a437f01..8176a4f 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -249,16 +249,88 @@ const byte *ThreadResource::getNextRecord(const byte *p) {
 	}
 }
 
-void ThreadResource::cardAction(const byte *p) {
-	warning("TODO: cardAction");
+const byte *ThreadResource::getSTAMPCard(int cardId) {
+	const byte *p;
+	int count = 0;
+	for (p = _field4A; count <= cardId && *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0xC0)
+			++count;
+	}
+
+	return p;
+}
+
+int ThreadResource::getStateFromID(uint32 id) {
+	int count = READ_LE_UINT16(_ctlPtr);
+
+	for (int i = 0; i < count; ++i) {
+		uint32 sid = getSID(i);
+		if (sid == id)
+			return i;
+	}
+
+	return -1;
+}
+
+uint32 ThreadResource::getSID(int sid) {
+	uint32 offset = READ_LE_UINT32(_ctlPtr + 2) + (sid << 3) + 4;
+	return READ_LE_UINT32(_ctlPtr + offset);
+}
+
+void ThreadResource::doSTAMPCardAction() {
+	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+		if (*p == 0x48) {
+			cardAction(p + 1);
+			return;
+		}
+	}
+}
+
+void ThreadResource::cardAction(const byte *card) {
+	_vm->_glGoScene = -1;
+	_vm->_glGoStack = -1;
+
+	// Loop to perform card commands
+	while (!_vm->shouldQuit() && *card < 70 && _vm->_glGoScene == -1) {
+		card = cardPerform(card);
+	}
 }
 
-bool ThreadResource::chooseSTAMPButton(int idx) {
-	warning("TODO: chooseSTAMPButton");
+bool ThreadResource::chooseSTAMPButton(int buttonId) {
+	_flags &= ~1;
+
+	for (int idx = 0; idx < _field42; ++idx) {
+		if (_field18E[idx] == buttonId) {
+			const byte *card = getSTAMPCard(idx);
+			cardAction(card);
+
+			bool flag = true;
+			while (!_vm->shouldQuit() && _vm->_glGoStack != -1 && flag) {
+				doSTAMPCardAction();
+				flag = goToStateID(_vm->_glGoStack, _vm->_glGoScene);
+			}
+
+			while (!_vm->shouldQuit() && _vm->_glGoScene != -1 && flag) {
+				doSTAMPCardAction();
+				flag = goToState(-1, _vm->_glGoScene);
+			}
+
+			return flag;
+		}
+	}
+
 	return false;
 }
 
 void ThreadResource::parsePlayCommands() {
+	_vm->_voy._field470 = -1;
+	_vm->_voy._field468 = 0;
+	_vm->_voy._field46A = 0;
+	_vm->_voy._field47A = -1;
+	_vm->_voy._field4E2 = -1;
+	_vm->_voy._field478 &= ~8;
+	_vm->_eventsManager._videoDead = -1;
+
 	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
 	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
 	Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
@@ -707,6 +779,11 @@ void ThreadResource::parsePlayCommands() {
 	}
 }
 
+const byte *ThreadResource::cardPerform(const byte *card) {
+	error("TODO");
+	return NULL;
+}
+
 int ThreadResource::doApt() {
 	warning("TODO: doApt");
 	return 0;
@@ -736,4 +813,37 @@ void ThreadResource::addVideoEventEnd() {
 	error("TODO: addVideoEventEnd");
 }
 
+bool ThreadResource::goToStateID(int stackId, int sceneId) {
+	// Save current stack
+	savePrevious();
+
+	if (_controlIndex == stackId || stackId == -1 || loadAStack(stackId)) {
+		// Now in the correct state
+		_threadId = getStateFromID(sceneId);
+
+		if (_threadId != -1) {
+			return doState();
+		} else {
+			_threadId = _field4;
+			_controlIndex = _field6;
+		}
+	}
+
+	return false;
+}
+
+bool ThreadResource::goToState(int stackId, int sceneId) {
+	error("TODO: goToState");
+}
+
+void ThreadResource::savePrevious() {
+	if (_field4 == _threadId && _controlIndex == _field6) {
+		_flags &= ~1;
+	} else {
+		_flags |= 1;
+		_field4 = _threadId;
+		_field6 = _controlIndex;
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 616a0b8..8c765b2 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -197,7 +197,7 @@ void VoyeurEngine::playStamp() {
 				// Break out of loop
 				flag = false;
 
-			} else if (threadP->_field40 == 2) {
+			} else if (threadP->_field40 & 2) {
 				_eventsManager.getMouseInfo();
 				threadP->chooseSTAMPButton(0);
 				flag = true;


Commit: 1187a4fc2516e01f951f0f165f287098f133cfee
    https://github.com/scummvm/scummvm/commit/1187a4fc2516e01f951f0f165f287098f133cfee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-12T17:33:59-08:00

Commit Message:
VOYEUR: Implemented goToState method

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 8176a4f..7ba3c5e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -833,7 +833,15 @@ bool ThreadResource::goToStateID(int stackId, int sceneId) {
 }
 
 bool ThreadResource::goToState(int stackId, int sceneId) {
-	error("TODO: goToState");
+	savePrevious();
+	if (stackId == -1 || loadAStack(stackId)) {
+		if (sceneId != -1)
+			_threadId = sceneId;
+
+		return doState();
+	} else {
+		return false;
+	}
 }
 
 void ThreadResource::savePrevious() {


Commit: c479aed9d1282469656fa74bafd5d99758c03931
    https://github.com/scummvm/scummvm/commit/c479aed9d1282469656fa74bafd5d99758c03931
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-12T20:56:54-08:00

Commit Message:
VOYEUR: Implemented cardPerform and cardPerform2

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index e753b1d..43057af 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -441,7 +441,10 @@ private:
 	bool goToStateID(int stackId, int sceneId);
 	bool goToState(int stackId, int sceneId);
 	const byte *cardPerform(const byte *card);
+	bool cardPerform2(const byte *p, int cardCmdId);
 	void savePrevious();
+	void setButtonFlag(int idx, byte bits);
+	void clearButtonFlag(int idx, byte bits);
 public:
 	VoyeurEngine *_vm;
 
@@ -450,6 +453,8 @@ public:
 	int _field4, _field6;
 	byte _flags;
 	int _field9;
+	int _fieldA[8];
+	int _field2A[8];
 	int _field3A;
 	int _field3E;
 	int _field40;
@@ -457,7 +462,7 @@ public:
 	int _parseCount;
 	uint32 _field46;
 	byte *_field4A;
-	byte _field4E[64];
+	byte _buttonFlags[64];
 	const byte *_field8E[64];
 	byte _field18E[64];
 	const byte *_field1CE[48];
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 7ba3c5e..bba87cf 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -155,10 +155,10 @@ void ThreadResource::getButtonsFlags() {
 			if (*++p & 0x20)
 				_field40 |= 2;
 
-			_field4E[idx] = *p++;
+			_buttonFlags[idx] = *p++;
 			_field18E[idx] = *p++;
 
-			if (_field4E[idx] & 0x80)
+			if (_buttonFlags[idx] & 0x80)
 				p += 4;
 
 			++idx;
@@ -780,10 +780,259 @@ void ThreadResource::parsePlayCommands() {
 }
 
 const byte *ThreadResource::cardPerform(const byte *card) {
-	error("TODO");
-	return NULL;
+	int var7 = 0;
+	uint32 varC = 0;
+	const byte *p, *p2;
+	byte *pDest;
+
+	uint16 id = *card++;
+	int varD = 5;
+	uint32 v2;
+	int v3;
+	byte bVal;
+	uint32 idx1, idx2;
+
+	switch (id) {
+	case 1:
+		v2 = READ_LE_UINT32(card);
+		card += 4;
+		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card << 2), v2);
+		++card;
+		break;
+
+	case 2:
+		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)),
+		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		break;
+
+	case 3:
+		v2 = READ_LE_UINT32(card);
+		card += 4;
+		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		break;
+
+	case 4:
+		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
+		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		break;
+
+	case 5:
+		v2 = READ_LE_UINT32(card);
+		card += 4;
+		pDest = _vm->_controlPtr->_ptr + (*card++ << 2);
+		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2);
+		break;
+
+	case 6:
+		idx1 = *card++;
+		idx2 = *card++;
+
+		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + idx2);
+		pDest = _vm->_controlPtr->_ptr + idx1;
+		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2);
+		break;
+
+	case 7:
+		v3 = *card++;
+		v2 = READ_LE_UINT32(card);
+		card += 4;
+		pDest = _vm->_controlPtr->_ptr + (v3 << 2);
+		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * v2);
+		break;
+
+	case 8:
+		idx1 = *card++;
+		idx2 = *card++;
+
+		pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
+		p2 = _vm->_controlPtr->_ptr + (idx2 << 2);
+		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * READ_LE_UINT32(p2));
+		break;
+
+	case 9:
+		idx1 = *card++;
+		v2 = READ_LE_UINT32(card);
+		card += 4;
+
+		pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
+		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / v2);
+		break;
+
+	case 10:
+		idx1 = *card++;
+		idx2 = *card++;
+
+		pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
+		p2 = _vm->_controlPtr->_ptr + (idx2 << 2);
+		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / READ_LE_UINT32(p2));
+		break;
+	
+	case 11:
+		v2 = READ_LE_UINT32(card);
+		card += 4;
+		v2 = _vm->getRandomNumber(v2 - 1) + 1;
+		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		break;
+
+	case 17:
+		_vm->_glGoScene = READ_LE_UINT16(card);
+		card += 2;
+		_vm->_glGoStack = -1;
+		break;
+
+	case 18:
+		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
+		_vm->_glGoScene = getStateFromID(v2);
+		break;
+
+	case 19:
+		_vm->_glGoScene = READ_LE_UINT32(card);
+		card += 4;
+		_vm->_glGoStack = READ_LE_UINT16(card);
+		card += 2;
+		break;
+
+	case 22:
+	case 23:
+	case 26:
+	case 27:
+		varD -= 3;	
+		// Deliberate fall-through
+
+	case 20:
+	case 21:
+	case 24:
+	case 25:
+		bVal = card[varD];
+		if (bVal == 61) {
+			if (cardPerform2(card, id)) {
+				card += varD;
+				while (*card != 30 && *card != 29)
+					card = cardPerform(card);
+
+				if (*card == 29) {
+					int count = 1;
+					while (count > 0) {
+						card = getNextRecord(card);
+						if (*card == 30)
+							--count;
+						if (*card >= 21 && *card <= 28)
+							++count;
+					}
+				}
+			} else {
+				card += varD;
+				int count = 1;
+				while (count > 0) {
+					card = getNextRecord(card);
+					if (*card == 29 || *card == 30)
+						--count;
+					if (*card < 21 || *card > 28)
+						continue;
+
+					const byte *nextP = getNextRecord(card + 2);
+					if (*nextP == 61)
+						++count;
+				}
+			}
+			
+			++card;
+		} else {
+			if (cardPerform2(card, id)) {
+				card += varD;
+				card = cardPerform(card);
+				while (*card++ != 61) ;		
+			} else {
+				card += varD;
+				while (*card != 61 && *card != 29)
+					++card;
+			}
+		}
+		break;
+
+	case 41:
+		bVal = *card++;
+		assert(bVal < 8);
+		_fieldA[bVal] = READ_LE_UINT32(card);
+		card += 4;
+
+		_field2A[bVal] = READ_LE_UINT16(card);
+		card += 2;
+	
+	case 45:
+		_field3A = _field46;
+		_field3E = _controlIndex;
+		break;
+
+	case 46:
+		_vm->_glGoScene = _field3A;
+		_vm->_glGoStack = _field3E;
+		_field3A = -1;
+		_field3E = -1;
+		break;
+
+	case 51:
+		setButtonFlag(READ_LE_UINT16(card), 64);
+		break;
+
+	case 52:
+		clearButtonFlag(READ_LE_UINT16(card), 64);
+		break;
+
+	default:
+		break;
+	}
+
+	return card;
 }
 
+bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
+	uint32 vLong, vLong2;
+
+	switch (cardCmdId) {
+	case 21:
+		vLong = READ_LE_UINT32(pSrc + 1);
+		return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) == vLong;
+
+	case 22:
+		vLong = READ_LE_UINT32(pSrc + 1);
+		return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) != vLong;
+
+	case 23:
+		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
+		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		return vLong == vLong2;
+
+	case 24:
+		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
+		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		return vLong != vLong2;
+
+	case 25:
+		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); 
+		vLong2 = READ_LE_UINT32(pSrc + 1);
+		return vLong < vLong2;
+
+	case 26:
+		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); 
+		vLong2 = READ_LE_UINT32(pSrc + 1);
+		return vLong > vLong2;
+
+	case 27:
+		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
+		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		return vLong < vLong2;
+
+	case 28:
+		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
+		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		return vLong > vLong2;
+
+	default:
+		return false;
+	}
+}	
+
 int ThreadResource::doApt() {
 	warning("TODO: doApt");
 	return 0;
@@ -854,4 +1103,12 @@ void ThreadResource::savePrevious() {
 	}
 }
 
+void ThreadResource::setButtonFlag(int idx, byte bits) {
+	_buttonFlags[idx] |= bits;
+}
+
+void ThreadResource::clearButtonFlag(int idx, byte bits) {
+	_buttonFlags[idx] &= ~bits;
+}
+
 } // End of namespace Voyeur


Commit: 09b22952ce6d108ae5063c79a2e08bcddda1fc6c
    https://github.com/scummvm/scummvm/commit/09b22952ce6d108ae5063c79a2e08bcddda1fc6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T17:51:06-08:00

Commit Message:
VOYEUR: Minor fix to getNextRecord and added a few debug lines

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index bba87cf..40febd7 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -241,7 +241,7 @@ const byte *ThreadResource::getNextRecord(const byte *p) {
 	case 74:
 		return p + 4;
 	case 192:
-		if (*p * 0x80)
+		if (*p & 0x80)
 			p += 4;
 		return p + 2;
 	default:
@@ -252,6 +252,7 @@ const byte *ThreadResource::getNextRecord(const byte *p) {
 const byte *ThreadResource::getSTAMPCard(int cardId) {
 	const byte *p;
 	int count = 0;
+
 	for (p = _field4A; count <= cardId && *p != 0x49; p = getNextRecord(p)) {
 		if (*p == 0xC0)
 			++count;
@@ -1063,6 +1064,8 @@ void ThreadResource::addVideoEventEnd() {
 }
 
 bool ThreadResource::goToStateID(int stackId, int sceneId) {
+	debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId);
+
 	// Save current stack
 	savePrevious();
 
@@ -1082,6 +1085,8 @@ bool ThreadResource::goToStateID(int stackId, int sceneId) {
 }
 
 bool ThreadResource::goToState(int stackId, int sceneId) {
+	debugC(DEBUG_BASIC, kDebugScripts, "goToState - %d, %d", stackId, sceneId);
+
 	savePrevious();
 	if (stackId == -1 || loadAStack(stackId)) {
 		if (sceneId != -1)
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 248d150..9712f2b 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -53,9 +53,11 @@ namespace Voyeur {
 #define MAX_RESOLVE 1000
 
 enum VoyeurDebugChannels {
-	kDebugPath      = 1 <<  0
+	kDebugPath      = 1 << 0,
+	kDebugScripts	= 1 << 1
 };
 
+
 struct VoyeurGameDescription;
 
 


Commit: f2b8c518811998bd05b59c332092dc6fa28024b4
    https://github.com/scummvm/scummvm/commit/f2b8c518811998bd05b59c332092dc6fa28024b4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T19:10:39-08:00

Commit Message:
VOYEUR: Added extra initialisation for ControlResource objects

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index c725169..61c5e42 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1342,6 +1342,7 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 	uint32 *idP = (uint32 *)&src[0x10];
 	int count = READ_LE_UINT16(&src[0x36]);
 
+	Common::fill(&_entries[0], &_entries[8], (byte *)nullptr);
 	for (int i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
 		state._curLibPtr->resolveIt(id, &_entries[i]);


Commit: b80d0e9aa3c6d7fe3706a7e634623559a36e4548
    https://github.com/scummvm/scummvm/commit/b80d0e9aa3c6d7fe3706a7e634623559a36e4548
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T19:11:16-08:00

Commit Message:
VOYEUR: Fix field intiialisation in getStateInfo

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 40febd7..67df87f 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -35,6 +35,7 @@ CMapResource *ThreadResource::_cmd14Pal = NULL;
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
 	_flags = src[8];
+	_ctlPtr = nullptr;
 }
 
 void ThreadResource::initThreadStruct(int idx, int id) {
@@ -114,7 +115,7 @@ bool ThreadResource::getStateInfo() {
 		_parseCount = READ_LE_UINT16(baseP + 4);
 
 		_field28E = getDataOffset();
-		_field28E += READ_LE_UINT32(baseP + 6) / 2;
+		_field28E += (READ_LE_UINT32(baseP + 6) / 2) << 1;
 
 		_field4A = baseP + 10;
 		


Commit: 208c5aa6b75f31135fda7af7484b17ca1b14c82d
    https://github.com/scummvm/scummvm/commit/208c5aa6b75f31135fda7af7484b17ca1b14c82d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T20:03:25-08:00

Commit Message:
VOYEUR: Fix for parsePlayCommands command 9

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 67df87f..3880893 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -348,6 +348,8 @@ void ThreadResource::parsePlayCommands() {
 
 	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
 		uint16 id = READ_LE_UINT16(dataP);
+		debugC(DEBUG_BASIC, kDebugScripts, "parsePlayCommands (%d of %d) - cmd #%d",
+			parseIndex, _parseCount, id);
 		dataP += 2;
 
 		switch (id) {
@@ -606,8 +608,9 @@ void ThreadResource::parsePlayCommands() {
 				while (_vm->_voy._arr5[idx][v3] != 9999)
 					++idx;
 
-				_vm->_voy._arr5[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
-				_vm->_voy._arr6[idx][v3] = v3;
+				v2 = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._arr5[idx][v3] = v2;
+				_vm->_voy._arr6[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
 			}
 
 			dataP += 8;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 3b924fe..b8f0bab 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -38,6 +38,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
 			Common::Point(1, 1), 1, 0, 0) {
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
 	_bVoy = NULL;
 	_iForceDeath = -1;
 	_controlPtr = NULL;


Commit: b9bd380a29cff9e1ad3a11b47dbc273630c740a4
    https://github.com/scummvm/scummvm/commit/b9bd380a29cff9e1ad3a11b47dbc273630c740a4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T20:13:35-08:00

Commit Message:
VOYEUR: Fixes for parsePlayCommands command 7

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 3880893..195e05d 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -333,7 +333,7 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._field478 &= ~8;
 	_vm->_eventsManager._videoDead = -1;
 
-	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
+	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 9999);
 	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
 	Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
 	Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0);
@@ -576,8 +576,9 @@ void ThreadResource::parsePlayCommands() {
 				while (_vm->_voy._arr1[idx][v3] != 9999)
 					++idx;
 
-				_vm->_voy._arr1[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
-				_vm->_voy._arr2[idx][v3] = v3;
+				v2 = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._arr1[idx][v3] = v2;
+				_vm->_voy._arr2[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
 			}
 
 			dataP += 8;


Commit: 033929d70184eea4f8a0507380f316ea9f27373f
    https://github.com/scummvm/scummvm/commit/033929d70184eea4f8a0507380f316ea9f27373f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T20:18:59-08:00

Commit Message:
VOYEUR: Fixes for parsePlayCommands command 8

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 195e05d..c09293a 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -585,7 +585,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 8:
-			v2 = READ_LE_UINT16(dataP);
+ 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
@@ -593,8 +593,9 @@ void ThreadResource::parsePlayCommands() {
 				while (_vm->_voy._arr3[idx][v3] != 9999)
 					++idx;
 
-				_vm->_voy._arr3[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
-				_vm->_voy._arr4[idx][v3] = v3;
+				v2 = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._arr3[idx][v3] = v2;
+				_vm->_voy._arr4[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
 			}
 
 			dataP += 8;


Commit: 4ffa060832dbf7ad103ae80790e07eac91b329f0
    https://github.com/scummvm/scummvm/commit/4ffa060832dbf7ad103ae80790e07eac91b329f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-13T20:26:51-08:00

Commit Message:
VOYEUR: Make parsePlayCommands debug parse Index be 1-based

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index c09293a..893e5e9 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -349,7 +349,7 @@ void ThreadResource::parsePlayCommands() {
 	for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
 		uint16 id = READ_LE_UINT16(dataP);
 		debugC(DEBUG_BASIC, kDebugScripts, "parsePlayCommands (%d of %d) - cmd #%d",
-			parseIndex, _parseCount, id);
+			parseIndex + 1, _parseCount, id);
 		dataP += 2;
 
 		switch (id) {


Commit: debe14fc5089a7be9edc1a86843c0213f48c6af4
    https://github.com/scummvm/scummvm/commit/debe14fc5089a7be9edc1a86843c0213f48c6af4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T08:07:01-08:00

Commit Message:
VOYEUR: Fixes for casting warnings

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 0f98dbb..c771f04 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -92,7 +92,7 @@ RL2Decoder::RL2FileHeader::RL2FileHeader() {
 
 RL2Decoder::RL2FileHeader::~RL2FileHeader() {
 	delete[] _frameOffsets;
-	_frameSoundSizes;
+	delete[] _frameSoundSizes;
 }
 
 void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 61c5e42..fb9bcc3 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -816,7 +816,7 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 	// Get the rect list
 	for (int listIndex = 0; listIndex < 3; ++listIndex) {
 		_rectListCount[listIndex] = (int16)READ_LE_UINT16(src + 0x40 + 2 * listIndex);
-		uint32 id = READ_LE_UINT32(src + 0x34 + listIndex * 4);
+		int id = (int)READ_LE_UINT32(src + 0x34 + listIndex * 4);
 
 		if (id == -1) {
 			_rectListPtr[listIndex] = NULL;
@@ -826,8 +826,8 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
 			if (_rectListCount[listIndex] > 0) {
 				int16 *rectList = (int16 *)state._curLibPtr->memberAddrOffset(id);
 				for (int i = 0; i < _rectListCount[listIndex]; ++i) {
-					int xs = FROM_LE_16(rectList[0]);
-					int ys = FROM_LE_16(rectList[1]);
+					xs = FROM_LE_16(rectList[0]);
+					ys = FROM_LE_16(rectList[1]);
 					_rectListPtr[i]->push_back(Common::Rect(xs, ys, xs + FROM_LE_16(rectList[2]),
 						ys + FROM_LE_16(rectList[3])));
 				}
@@ -1171,7 +1171,7 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 		_palette.push_back(ViewPortPalEntry(palData));
 
 	// Load view port pointer list
-	uint32 *idP = (uint32 *)&src[8];
+	const uint32 *idP = (const uint32 *)&src[8];
 	for (uint i = 0; i < count; ++i, ++idP) {
 		uint32 id = READ_LE_UINT32(idP);
 		BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
@@ -1184,7 +1184,7 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
 /*------------------------------------------------------------------------*/
 
 ViewPortPalEntry::ViewPortPalEntry(const byte *src) {
-	uint16 *v = (uint16 *)src;
+	const uint16 *v = (const uint16 *)src;
 	_rEntry = READ_LE_UINT16(v++);
 	_gEntry = READ_LE_UINT16(v++);
 	_bEntry = READ_LE_UINT16(v++);
@@ -1317,7 +1317,7 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
 	// Load pointer list
-	uint32 *idP = (uint32 *)&src[0];
+	const uint32 *idP = (const uint32 *)&src[0];
 	int size = state._curMemberPtr->_size;
 
 	for (int i = 0; i < size / 4; ++i, ++idP) {
@@ -1339,7 +1339,7 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 		_memberIds[i] = READ_LE_UINT16(src + i * 2);
 
 	// Load pointer list
-	uint32 *idP = (uint32 *)&src[0x10];
+	const uint32 *idP = (const uint32 *)&src[0x10];
 	int count = READ_LE_UINT16(&src[0x36]);
 
 	Common::fill(&_entries[0], &_entries[8], (byte *)nullptr);
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 43057af..98e0aa2 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -117,7 +117,7 @@ private:
 	void termGro() {}	// TODO
 public:
 	BoltFile(const Common::String &filename, BoltFilesState &state);
-	~BoltFile();
+	virtual ~BoltFile();
 
 	BoltGroup *getBoltGroup(uint32 id);
 	void freeBoltGroup(uint32 id);


Commit: 49d50afb4728d6a5773fb8faeac3629bf56953ee
    https://github.com/scummvm/scummvm/commit/49d50afb4728d6a5773fb8faeac3629bf56953ee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T08:39:15-08:00

Commit Message:
VOYEUR: In progress implementation of doInterface

Changed paths:
    engines/voyeur/events.h
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 97927e7..9fe3464 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -201,6 +201,7 @@ public:
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void resetMouse();
+	void setMousePos(const Common::Point &p) { _mousePos = p; }
 	void startMainClockInt();
 	void vStopCycle();
 	void sWaitFlip();
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 98e0aa2..0386283 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -421,6 +421,10 @@ public:
 	static CMapResource *_cmd14Pal;
 	static void initUseCount();
 	static void unloadAllStacks(VoyeurEngine *vm);
+	static int _currentMouseX;
+	static int _currentMouseY;
+
+	static void init();
 private:
 	bool getStateInfo();
 	byte *getDataOffset();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 893e5e9..aacc619 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -27,10 +27,21 @@
 
 namespace Voyeur {
 
-int ThreadResource::_stampFlags = 0;
+int ThreadResource::_stampFlags;
 int ThreadResource::_useCount[8];
-byte *ThreadResource::_threadDataPtr = NULL;
-CMapResource *ThreadResource::_cmd14Pal = NULL;
+byte *ThreadResource::_threadDataPtr;
+CMapResource *ThreadResource::_cmd14Pal;
+int ThreadResource::_currentMouseX;
+int ThreadResource::_currentMouseY;
+
+void ThreadResource::init() {
+	_stampFlags = 0;
+	Common::fill(&_useCount[0], &_useCount[8], 0);
+	_threadDataPtr = nullptr;
+	_cmd14Pal = nullptr;
+	_currentMouseX = 392;
+	_currentMouseY = 57;
+}
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
@@ -1050,7 +1061,76 @@ void ThreadResource::doRoom() {
 }
 
 int ThreadResource::doInterface() {
-	warning("TODO: doInterface");
+	int varA = -1;
+	int var8 = 0;
+
+	if (_vm->_voy._field478 != _vm->_voy._field46E) {
+		_vm->_voy._field46E = 0;
+		return -1;
+	}
+
+	_vm->_voy._field478 &= ~0x100;
+	_vm->_playStamp1 = -1;
+	_vm->_eventsManager._intPtr.field1E = 1;
+	_vm->_eventsManager._intPtr.field1A = 0;
+
+	if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0)
+		_vm->_voy._RTVNum = _vm->_voy._field476 - 1;
+
+	if (_vm->_voy._field474 < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) {
+		_vm->_voy._RTVNum = _vm->_voy._field476;
+		_vm->makeViewFinder();
+
+		_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
+		_vm->initIFace();
+		_vm->_voy._RTVNum = _vm->_voy._field476 - 4;
+		_vm->_voy._field478 &= ~1;
+
+		while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._field476) {
+			_vm->flashTimeBar();
+		}
+
+		_vm->_voy._field478 = 1;
+		chooseSTAMPButton(20);
+		parsePlayCommands();
+	}
+
+	_vm->checkTransition();
+	_vm->makeViewFinder();
+	_vm->_eventsManager.getMouseInfo();
+	_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
+	_vm->initIFace();
+
+	byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1);
+	_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
+	_vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29);
+
+	Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_playStamp2);
+	_vm->_soundManager.startVOCPlay(fname);
+	_vm->_eventsManager.getMouseInfo();
+	_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
+	
+	_vm->_graphicsManager.setColor(240, 220, 220, 220);
+	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._hasPalette = true;
+	_vm->_voy._field478 &= ~1;
+
+	for (;;) {
+		_vm->doTimeBar(1);
+		_vm->_eventsManager.getMouseInfo();
+
+		const Common::Point &pt = _vm->_eventsManager.getMousePos();
+		if (pt.x != _currentMouseX || pt.y != _currentMouseY || var8 != varA) {
+			varA = var8;
+			_vm->_graphicsManager.doScroll(pt);
+
+			_currentMouseX = pt.x;
+			_currentMouseY = pt.y;
+		}
+
+		// TODO
+	}
+
 	return 0;
 }
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 9b9ebe4..c8b554c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -658,4 +658,8 @@ void GraphicsManager::screenReset() {
 	_vm->_eventsManager.sWaitFlip();
 }
 
+void GraphicsManager::doScroll(const Common::Point &pt) {
+	error("TODO: doScroll");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 518ec1a..10dab5b 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -110,6 +110,7 @@ public:
 	void resetPalette();
 	void setColor(int idx, byte r, byte g, byte b);
 	void screenReset();
+	void doScroll(const Common::Point &pt);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index b8f0bab..84aa0c4 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -117,6 +117,7 @@ void VoyeurEngine::initialiseManagers() {
 }
 
 void VoyeurEngine::ESP_Init() {
+	ThreadResource::init();
 }
 
 void VoyeurEngine::globalInitBolt() {
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 9712f2b..264c203 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -146,6 +146,11 @@ public:
 	void saveLastInplay();
 	void loadTheApt();
 	void freeTheApt();
+	void makeViewFinder();
+	void initIFace();
+	void checkTransition();
+	void doTimeBar(int v);
+	void flashTimeBar();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 8c765b2..505f794 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -272,4 +272,24 @@ void VoyeurEngine::freeTheApt() {
 	error("TODO: freeTheApt");
 }
 
+void VoyeurEngine::makeViewFinder() {
+	error("TODO");
+}
+
+void VoyeurEngine::initIFace(){
+	error("TODO");
+}
+
+void VoyeurEngine::checkTransition(){
+	error("TODO");
+}
+
+void VoyeurEngine::doTimeBar(int v) {
+	error("TODO");
+}
+
+void VoyeurEngine::flashTimeBar(){
+	error("TODO");
+}
+
 } // End of namespace Voyeur


Commit: af90a11ff258461cd84dfc89ecfbe54fc720c312
    https://github.com/scummvm/scummvm/commit/af90a11ff258461cd84dfc89ecfbe54fc720c312
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T14:38:01-08:00

Commit Message:
VOYEUR: Fix various warnings

Changed paths:
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 9fe3464..decd233 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -110,7 +110,7 @@ public:
 	int _evidence[20];
 	
 	Common::Array<VoyeurEvent> _events;
-	int _field4376;
+	byte *_field4376;
 	int _field4378;
 	int _field437A;
 	int _field437C;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index aacc619..f74b7db 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -798,9 +798,7 @@ void ThreadResource::parsePlayCommands() {
 }
 
 const byte *ThreadResource::cardPerform(const byte *card) {
-	int var7 = 0;
-	uint32 varC = 0;
-	const byte *p, *p2;
+	const byte *p2;
 	byte *pDest;
 
 	uint16 id = *card++;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index c8b554c..1ac7f48 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -87,9 +87,6 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 }
 
 void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
-	int count1, count2;
-	int idx1, varE, var24;
-
 	if (viewPort->_rectListCount[idx] == -1)
 		return;
 
@@ -138,7 +135,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	bool isClipped = false;
 	int var52;
 	int var20, var22;
-	int var26, var2C;
+	int var26;
 	byte pixel;
 
 	byte *srcImgData, *destImgData;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 84aa0c4..6c4e841 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -134,7 +134,7 @@ void VoyeurEngine::globalInitBolt() {
 	// Setup default flags
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 	_voy._field478 = 1;
-	_voy._field4376 = NULL; // Original set 63h:63h
+	_voy._field4376 = nullptr; // Original set 63h:63h
 	_voy._field4F2 = 9999;
 	_voy._field472 = -1;
 	_voy._field478 = 256;
@@ -473,6 +473,7 @@ void VoyeurEngine::showTitleScreen() {
 }
 
 void VoyeurEngine::doOpening() {
+/*
 	_graphicsManager.screenReset();
 
 	if (!_bVoy->getBoltGroup(0x10200))
@@ -519,13 +520,14 @@ void VoyeurEngine::doOpening() {
 		if (decoder.needsUpdate()) {
 			const Graphics::Surface *frame = decoder.decodeNextFrame();
 
-			Common::copy((byte *)frame->getPixels(), (byte *)frame->getPixels() + 320 * 200,
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
 		}
 
 		_eventsManager.pollEvents();
 		g_system->delayMillis(10);
 	}
+	*/
 }
 
 void VoyeurEngine::playRL2Video(const Common::String &filename) {
@@ -542,7 +544,7 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 		if (decoder.needsUpdate()) {
 			const Graphics::Surface *frame = decoder.decodeNextFrame();
 
-			Common::copy((byte *)frame->getPixels(), (byte *)frame->getPixels() + 320 * 200,
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
 		}
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 505f794..f887e73 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -149,7 +149,7 @@ void VoyeurEngine::playStamp() {
 				_graphicsManager._backgroundPage = _bVoy->boltEntry(_playStamp1)._picResource;
 				_graphicsManager._backColors = _bVoy->boltEntry(_playStamp1 + 1)._cMapResource;
 
-				int buttonId = getChooseButton();
+				buttonId = getChooseButton();
 				if (_voy._fadeFunc)
 					buttonId = 4;
 


Commit: 95316a59569b08eb0fb1df7548da500da7948bca
    https://github.com/scummvm/scummvm/commit/95316a59569b08eb0fb1df7548da500da7948bca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T17:40:19-08:00

Commit Message:
VOYEUR: Implemented doInterface method

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index f74b7db..532e7f9 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1061,10 +1061,12 @@ void ThreadResource::doRoom() {
 int ThreadResource::doInterface() {
 	int varA = -1;
 	int var8 = 0;
+	PictureResource *pic;
+	Common::Point pt;
 
 	if (_vm->_voy._field478 != _vm->_voy._field46E) {
 		_vm->_voy._field46E = 0;
-		return -1;
+		return -2;
 	}
 
 	_vm->_voy._field478 &= ~0x100;
@@ -1113,11 +1115,11 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager._intPtr._hasPalette = true;
 	_vm->_voy._field478 &= ~1;
 
-	for (;;) {
+	do {
 		_vm->doTimeBar(1);
 		_vm->_eventsManager.getMouseInfo();
 
-		const Common::Point &pt = _vm->_eventsManager.getMousePos();
+		pt = _vm->_eventsManager.getMousePos();
 		if (pt.x != _currentMouseX || pt.y != _currentMouseY || var8 != varA) {
 			varA = var8;
 			_vm->_graphicsManager.doScroll(pt);
@@ -1126,10 +1128,126 @@ int ThreadResource::doInterface() {
 			_currentMouseY = pt.y;
 		}
 
-		// TODO
-	}
+		_vm->checkPhoneCall();
+		if (!_vm->_soundManager.getVOCStatus()) {
+			_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
+			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
+		}
 
-	return 0;
+		Common::Point pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75);
+
+		for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) {
+			if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x &&
+					READ_LE_UINT16(dataP + (idx * 8 + 6)) >= pt.x &&
+					READ_LE_UINT16(dataP + (idx * 8 + 4)) <= pt.y &&
+					READ_LE_UINT16(dataP + (idx * 8 + 8)) >= pt.y) {
+				// Rect check done
+				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
+					if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum &&
+							_vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) {
+						// Draw the picture
+						pic = _vm->_bVoy->boltEntry(276)._picResource;
+						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
+							Common::Point(178, 108));
+						var8 = idx;
+					}
+
+					if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum &&
+							_vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) {
+						// Draw the picture
+						pic = _vm->_bVoy->boltEntry(277)._picResource;
+						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
+							Common::Point(178, 108));
+						var8 = idx;
+					}
+				}
+
+				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
+					if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum &&
+							_vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) {
+						// Draw the picture
+						pic = _vm->_bVoy->boltEntry(375)._picResource;
+						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
+							Common::Point(178, 108));
+						var8 = idx;
+					}
+				}
+			}
+		}
+
+		if (var8 == -1) {
+			// Draw the default picture
+			pic = _vm->_bVoy->boltEntry(274)._picResource;
+			_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
+				Common::Point(178, 108));
+		}
+
+		if (_vm->_voy._RTVNum & 2) {
+			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
+				10 / _vm->_eventsManager._videoComputerBut1, 0x1900BE);
+			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
+				10 % _vm->_eventsManager._videoComputerBut1, 0x1900BE);
+
+			if (_vm->_voy._RTANum & 4) {
+				int v = 10 / _vm->_eventsManager._videoComputerNum;
+				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
+					v == 0 ? 10 : v, 0x1900BE);
+				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
+					_vm->_eventsManager._videoComputerNum % 10, 0x1900AC);
+
+				pic = _vm->_bVoy->boltEntry(274)._picResource;
+				_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
+					Common::Point(215, 27));
+			}
+		}
+
+		_vm->_voy._RTANum = 0;
+		(*_vm->_graphicsManager._vPort)->_flags |= 8;
+		_vm->_graphicsManager.flipPage();
+		_vm->_eventsManager.sWaitFlip();
+
+		pt = _vm->_eventsManager.getMousePos();
+		if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) &&
+				(_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) {
+			_vm->_eventsManager.getMouseInfo();
+
+			if (_vm->_voy._field474 == 15) {
+				var8 = 20;
+				_vm->_voy._field474 = 17;
+				_vm->_soundManager.stopVOCPlay();
+				_vm->checkTransition();
+				_vm->_voy._lastInplay = true;
+			} else {
+				_vm->_voy._field478 = 1;
+				_currentMouseX = pt.x;
+				_currentMouseY = pt.y;
+
+				chooseSTAMPButton(20);
+				parsePlayCommands();
+				_vm->checkTransition();
+				_vm->makeViewFinder();
+
+				_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
+				_vm->initIFace();
+				
+				dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1);
+				_vm->_eventsManager.getMouseInfo();
+				_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
+
+				_vm->_voy._field478 &= ~2;
+				_vm->_eventsManager._intPtr.field1E = 1;
+				_vm->_eventsManager._intPtr.field1A = 0;
+			}
+		}
+	} while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && 
+		(!_vm->_voy._lastInplay || var8 == -1));
+
+	_vm->_voy._field478 |= 1;
+	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
+	if (_vm->_playStamp2 != -1)
+		_vm->_soundManager.stopVOCPlay();
+
+	return !_vm->_voy._fadeFunc ? var8 : -2;
 }
 
 void ThreadResource::addAudioEventStart() {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 1ac7f48..fbf671c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -529,6 +529,10 @@ error("TODO: var22/var24/var2C not initialised before use?");
 	}
 }
 
+void GraphicsManager::drawANumber(DisplayResource *display, int num, int offset) {
+	warning("TODO: drawANumber");
+}
+
 void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
 	PictureResource *pic;
 	if (display->_flags & DISPFLAG_VIEWPORT) {
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 10dab5b..4c31a44 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -104,6 +104,7 @@ public:
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &initialOffset);
 	void fillPic(DisplayResource *display, byte onOff = 0);
 	void sDisplayPic(PictureResource *pic);
+	void drawANumber(DisplayResource *display, int num, int offset);
 	void flipPage();
 	void clearPalette();
 	void setPalette(const byte *palette, int start, int count);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 264c203..1fd6b24 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -151,6 +151,7 @@ public:
 	void checkTransition();
 	void doTimeBar(int v);
 	void flashTimeBar();
+	void checkPhoneCall();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index f887e73..ff53208 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -273,23 +273,27 @@ void VoyeurEngine::freeTheApt() {
 }
 
 void VoyeurEngine::makeViewFinder() {
-	error("TODO");
+	error("TODO:makeViewFinder");
 }
 
 void VoyeurEngine::initIFace(){
-	error("TODO");
+	error("TODO: initIFace");
 }
 
 void VoyeurEngine::checkTransition(){
-	error("TODO");
+	error("TODO: checkTransition");
 }
 
 void VoyeurEngine::doTimeBar(int v) {
-	error("TODO");
+	error("TODO: doTimeBar");
 }
 
 void VoyeurEngine::flashTimeBar(){
-	error("TODO");
+	error("TODO: flashTimeBar");
+}
+
+void VoyeurEngine::checkPhoneCall() {
+	error("TODO: checkPhoneCall");
 }
 
 } // End of namespace Voyeur


Commit: fc757c3169c2ec9df8064ae9e901fae79105be3a
    https://github.com/scummvm/scummvm/commit/fc757c3169c2ec9df8064ae9e901fae79105be3a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T17:42:16-08:00

Commit Message:
VOYEUR: Fix shadowed variable in doInterface

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 532e7f9..12314df 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1134,7 +1134,7 @@ int ThreadResource::doInterface() {
 			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
 		}
 
-		Common::Point pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75);
+		pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75);
 
 		for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) {
 			if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x &&


Commit: 798a93d8995011a5cc2cc2a611fb2c6f774d9600
    https://github.com/scummvm/scummvm/commit/798a93d8995011a5cc2cc2a611fb2c6f774d9600
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T18:08:56-08:00

Commit Message:
VOYEUR: Slight fix to doInterface method

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 12314df..a8cf288 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1064,7 +1064,8 @@ int ThreadResource::doInterface() {
 	PictureResource *pic;
 	Common::Point pt;
 
-	if (_vm->_voy._field478 != _vm->_voy._field46E) {
+	_vm->_voy._field478 |= 1;
+	if (_vm->_voy._field46E) {
 		_vm->_voy._field46E = 0;
 		return -2;
 	}


Commit: e44fa657e4cfc3c27b4eb607ba1d1cb11aade053
    https://github.com/scummvm/scummvm/commit/e44fa657e4cfc3c27b4eb607ba1d1cb11aade053
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-14T19:27:16-08:00

Commit Message:
VOYEUR: Implemented support methods needed for doApt

Changed paths:
    engines/voyeur/events.h
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index decd233..9fe3464 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -110,7 +110,7 @@ public:
 	int _evidence[20];
 	
 	Common::Array<VoyeurEvent> _events;
-	byte *_field4376;
+	int _field4376;
 	int _field4378;
 	int _field437A;
 	int _field437C;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 0386283..c81761a 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -423,6 +423,8 @@ public:
 	static void unloadAllStacks(VoyeurEngine *vm);
 	static int _currentMouseX;
 	static int _currentMouseY;
+	static int _doAptState1;
+	static int _doAptState2;
 
 	static void init();
 private:
@@ -449,6 +451,9 @@ private:
 	void savePrevious();
 	void setButtonFlag(int idx, byte bits);
 	void clearButtonFlag(int idx, byte bits);
+	void loadTheApt();
+	void freeTheApt();
+	void doAptAnim(int mode);
 public:
 	VoyeurEngine *_vm;
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index a8cf288..0143084 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -33,6 +33,8 @@ byte *ThreadResource::_threadDataPtr;
 CMapResource *ThreadResource::_cmd14Pal;
 int ThreadResource::_currentMouseX;
 int ThreadResource::_currentMouseY;
+int ThreadResource::_doAptState1;
+int ThreadResource::_doAptState2;
 
 void ThreadResource::init() {
 	_stampFlags = 0;
@@ -41,6 +43,8 @@ void ThreadResource::init() {
 	_cmd14Pal = nullptr;
 	_currentMouseX = 392;
 	_currentMouseY = 57;
+	_doAptState1 = -1;
+	_doAptState2 = -1;
 }
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
@@ -764,31 +768,31 @@ void ThreadResource::parsePlayCommands() {
 
 		case 19:
 			_vm->_voy._field472 = 140;
-			_vm->loadTheApt();
+			loadTheApt();
 			_vm->_voy._field472 = 141;
-			_vm->freeTheApt();
+			freeTheApt();
 			break;
 
 		case 20:
 			_vm->_voy._field472 = -1;
-			_vm->loadTheApt();
+			loadTheApt();
 			_vm->_voy._field472 = 141;
-			_vm->freeTheApt();
+			freeTheApt();
 			break;
 
 		case 21:
 			_vm->_voy._field472 = -1;
-			_vm->loadTheApt();
+			loadTheApt();
 			_vm->_voy._field472 = 140;
-			_vm->freeTheApt();
+			freeTheApt();
 			break;
 
 		case 23:
 			_vm->_voy._field474 = 17;
 			_vm->_voy._field472 = -1;
-			_vm->loadTheApt();
+			loadTheApt();
 			_vm->_voy._field472 = 144;
-			_vm->freeTheApt();
+			freeTheApt();
 			break;
 
 		default:
@@ -1050,7 +1054,24 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
 }	
 
 int ThreadResource::doApt() {
-	warning("TODO: doApt");
+	int varC = -1;
+	loadTheApt();
+
+	_vm->_playStamp2 = 151;
+	byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1);
+	PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource;
+	_vm->_eventsManager.getMouseInfo();
+
+	if (_doAptState1 == -1) {
+		_doAptState1 = READ_LE_UINT16(dataP + 18) + 16;
+		_doAptState2 = READ_LE_UINT16(dataP + 20) + 16;
+		_vm->_playStamp2 = 153;
+	}
+
+	if (_vm->_voy._field470 == 16) {
+		// TODO
+	}
+
 	return 0;
 }
 
@@ -1319,4 +1340,164 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) {
 	_buttonFlags[idx] &= ~bits;
 }
 
+void ThreadResource::loadTheApt() {
+	switch (_vm->_voy._field474) {
+	case 1:
+	case 2:
+	case 5:
+	case 6:
+	case 7:
+	case 8:
+	case 9:
+	case 17:
+		_vm->_playStamp1 = 0x5700;
+		break;
+	case 3:
+		_vm->_playStamp1 = 0x5800;
+		break;
+	case 4:
+	case 10:
+	case 11:
+	case 12:
+	case 13:
+	case 14:
+	case 15:
+	case 16:
+		_vm->_playStamp1 = 0x5900;
+		break;
+	default:
+		break;
+	}
+
+	if (_vm->_voy._field472 == 143)
+		_vm->_voy._field472 = -1;
+
+	if (_vm->_voy._field472  != -1) {
+		doAptAnim(1);
+		_vm->_bVoy->getBoltGroup(_vm->_playStamp1);
+		_vm->_voy._field472 = -1;
+		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
+			_vm->_playStamp1 + 5)._picResource;
+		(*_vm->_graphicsManager._vPort)->setupViewPort(
+			_vm->_graphicsManager._backgroundPage);
+	} else {
+		_vm->_bVoy->getBoltGroup(_vm->_playStamp1);
+		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
+			_vm->_playStamp1 + 5)._picResource;
+		(*_vm->_graphicsManager._vPort)->setupViewPort(
+			_vm->_graphicsManager._backgroundPage);
+	}
+
+	CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource;
+	pal->_steps = 1; 
+	pal->startFade();
+
+	(*_vm->_graphicsManager._vPort)->_flags |= 8;
+	_vm->_graphicsManager.flipPage();
+	_vm->_eventsManager.sWaitFlip();
+
+	while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+		_vm->_eventsManager.delay(1);
+}
+
+void ThreadResource::freeTheApt() {
+	_vm->_graphicsManager.fadeDownICF1(5);
+	(*_vm->_graphicsManager._vPort)->_flags |= 8;
+	_vm->_graphicsManager.flipPage();
+	_vm->_eventsManager.sWaitFlip();
+
+	while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+		_vm->_eventsManager.delay(1);
+
+	_vm->_graphicsManager.fadeUpICF1(0);
+
+	if (_vm->_playStamp2 != -1) {
+		_vm->_soundManager.stopVOCPlay();
+		_vm->_playStamp2 = -1;
+	}
+
+	if (_vm->_voy._field472 == -1) {
+		_vm->_graphicsManager.fadeDownICF(6);
+	} else {
+		doAptAnim(2);
+	}
+
+	if (_vm->_voy._field472 == 140) {
+		_vm->_graphicsManager.screenReset();
+		_vm->_graphicsManager.resetPalette();
+	}
+
+	(*_vm->_graphicsManager._vPort)->setupViewPort(nullptr);
+	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
+	_vm->_playStamp1 = -1;
+	_vm->_voy._field4386 = 0;
+}
+
+void ThreadResource::doAptAnim(int mode) {
+	_vm->_bVoy->freeBoltGroup(0x10100);
+
+	int id = 0;
+	switch (_vm->_voy._field472) {
+	case 140:
+		id = 0x5A00;
+		break;
+	case 141:
+		id = 0x6000;
+		break;
+	case 142:
+		id = 0x6600;
+		break;
+	case 143:
+		id = 0x6C00;
+		break;
+	case 144:
+		id = 0x6F00;
+		break;
+	default:
+		break;
+	}
+
+	int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2;
+	switch (_vm->_voy._field474) {
+	case 3:
+		id += id2 << 8;
+		break;
+	case 4:
+	case 10:
+	case 11:
+	case 12:
+	case 13:
+	case 14:
+	case 15:
+	case 16:
+		id += id2 << 9;
+		break;
+	default:
+		break;
+	}
+
+	if (mode)
+		id += 0x100;
+
+	if (_vm->_bVoy->getBoltGroup(id)) {
+		CMapResource *pal = _vm->_bVoy->boltEntry(id)._cMapResource;
+		pal->_steps = 1;
+
+		for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) {
+			PictureResource *pic = _vm->_bVoy->boltEntry(id + idx)._picResource;
+			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
+
+			(*_vm->_graphicsManager._vPort)->_flags |= 8;
+			_vm->_graphicsManager.flipPage();
+			_vm->_eventsManager.sWaitFlip();
+
+			_vm->_eventsManager.delay(5);
+		}
+
+		_vm->_bVoy->freeBoltGroup(id);
+	}
+
+	_vm->_bVoy->getBoltGroup(0x10100);
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index fbf671c..96214b7 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -663,4 +663,47 @@ void GraphicsManager::doScroll(const Common::Point &pt) {
 	error("TODO: doScroll");
 }
 
+void GraphicsManager::fadeDownICF1(int steps) {
+	if (steps > 0) {
+		int stepAmount = _vm->_voy._field4378 / steps;
+
+		for (int idx = 0; idx < steps; ++idx) {
+			_vm->_voy._field4378 -= stepAmount;
+			_vm->_eventsManager.delay(1);
+		}
+	}
+
+	_vm->_voy._field4378 = 0;
+}
+
+void GraphicsManager::fadeUpICF1(int steps) {
+	if (steps > 0) {
+		int stepAmount = (63 - _vm->_voy._field4378) / steps;
+
+		for (int idx = 0; idx < steps; ++idx) {
+			_vm->_voy._field4378 += stepAmount;
+			_vm->_eventsManager.delay(1);
+		}
+	}
+
+	_vm->_voy._field4378 = 63;
+}
+
+void GraphicsManager::fadeDownICF(int steps) {
+	if (steps > 0) {
+		_vm->_eventsManager.mouseOff();
+		int stepAmount1 = _vm->_voy._field4376 / steps;
+		int stepAmount2 = _vm->_voy._field4378 / steps;
+
+		for (int idx = 0; idx < steps; ++idx) {
+			_vm->_voy._field4376 -= stepAmount1;
+			_vm->_voy._field4378 -= stepAmount2;
+			_vm->_eventsManager.delay(1);
+		}
+	}
+
+	_vm->_voy._field4376 = 0;
+	_vm->_voy._field4378 = 0;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 4c31a44..cdd5828 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -112,6 +112,9 @@ public:
 	void setColor(int idx, byte r, byte g, byte b);
 	void screenReset();
 	void doScroll(const Common::Point &pt);
+	void fadeDownICF1(int steps);
+	void fadeUpICF1(int steps);
+	void fadeDownICF(int steps);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 6c4e841..f143b0d 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -134,7 +134,7 @@ void VoyeurEngine::globalInitBolt() {
 	// Setup default flags
 	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 	_voy._field478 = 1;
-	_voy._field4376 = nullptr; // Original set 63h:63h
+	_voy._field4376 = _voy._field4378 = 127;
 	_voy._field4F2 = 9999;
 	_voy._field472 = -1;
 	_voy._field478 = 256;
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 1fd6b24..5d0c267 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -87,7 +87,6 @@ private:
 	void closeStamp();
 	void reviewTape();
 	bool doGossip();
-	int doApt();
 	void doTapePlaying();
 	bool checkForMurder();
 	void checkForIncriminate();
@@ -144,8 +143,6 @@ public:
 	 * Saves the last time the game was played
 	 */
 	void saveLastInplay();
-	void loadTheApt();
-	void freeTheApt();
 	void makeViewFinder();
 	void initIFace();
 	void checkTransition();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ff53208..93bb9d9 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -69,7 +69,7 @@ void VoyeurEngine::playStamp() {
 			buttonId = threadP->doInterface();
 			
 			if (buttonId == -2) {
-				switch (doApt()) {
+				switch (threadP->doApt()) {
 				case 0:
 					_voy._field472 = 140;
 					break;
@@ -237,11 +237,6 @@ bool VoyeurEngine::doGossip() {
 	return false;
 }
 
-int VoyeurEngine::doApt() {
-	warning("TODO");
-	return 0;
-}
-
 void VoyeurEngine::doTapePlaying() {
 	warning("TODO");
 }
@@ -264,14 +259,6 @@ int VoyeurEngine::getChooseButton()  {
 	return 0;
 }
 
-void VoyeurEngine::loadTheApt() {
-	error("TODO: loadTheApt");
-}
-
-void VoyeurEngine::freeTheApt() {
-	error("TODO: freeTheApt");
-}
-
 void VoyeurEngine::makeViewFinder() {
 	error("TODO:makeViewFinder");
 }


Commit: 8eae02966998007397a056c99b7e236c30d88bf1
    https://github.com/scummvm/scummvm/commit/8eae02966998007397a056c99b7e236c30d88bf1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-15T08:15:58-08:00

Commit Message:
VOYEUR: Fix for resource pointers resolveAll not clearing it's resolve it

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index fb9bcc3..ec95664 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -382,6 +382,8 @@ void BoltFile::resolveFunction(uint32 id, GraphicMethodPtr *fn) {
 void BoltFile::resolveAll() {
 	for (uint idx = 0; idx < _state._resolves.size(); ++idx)
 		*_state._resolves[idx]._p = memberAddrOffset(_state._resolves[idx]._id);
+
+	_state._resolves.clear();
 }
 
 byte *BoltFile::getBoltMember(uint32 id) {


Commit: 2f3bb44f5e00c34bd852b65ce8aa04a34941526b
    https://github.com/scummvm/scummvm/commit/2f3bb44f5e00c34bd852b65ce8aa04a34941526b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-15T10:28:42-08:00

Commit Message:
VOYEUR: Fix for loading bolt groups

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ec95664..8d0b1a6 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -255,7 +255,7 @@ BoltGroup *BoltFile::getBoltGroup(uint32 id) {
 	if (_state._curGroupPtr->_callInitGro)
 		initGro();
 
-	if ((id >> 16) != 0) {
+	if ((id >> 8) != 0) {
 		id &= 0xff00;
 		for (int idx = 0; idx < _state._curGroupPtr->_count; ++idx, ++id) {
 			byte *member = getBoltMember(id);


Commit: 28ecf5ba53c81389dfd3ef8f7f4ee25d00ced39e
    https://github.com/scummvm/scummvm/commit/28ecf5ba53c81389dfd3ef8f7f4ee25d00ced39e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-15T12:08:25-08:00

Commit Message:
VOYEUR: Fix extra flag parameters for getBoltGroup and freeBoltGroup

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 8d0b1a6..a9473d4 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -242,7 +242,7 @@ BoltFile::~BoltFile() {
 		_state._curFd = NULL;
 }
 
-BoltGroup *BoltFile::getBoltGroup(uint32 id) {
+BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) {
 	++_state._fromGroupFlag;
 	_state._curLibPtr = this;
 	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
@@ -255,7 +255,8 @@ BoltGroup *BoltFile::getBoltGroup(uint32 id) {
 	if (_state._curGroupPtr->_callInitGro)
 		initGro();
 
-	if ((id >> 8) != 0) {
+	if (process) {
+		// Pre-process the resources
 		id &= 0xff00;
 		for (int idx = 0; idx < _state._curGroupPtr->_count; ++idx, ++id) {
 			byte *member = getBoltMember(id);
@@ -272,7 +273,9 @@ BoltGroup *BoltFile::getBoltGroup(uint32 id) {
 	return _state._curGroupPtr;
 }
 
-void BoltFile::freeBoltGroup(uint32 id) {
+void BoltFile::freeBoltGroup(uint16 id, bool freeEntries) {
+	// TODO: I currently ignore freeEntries flag, in favour of always
+	// freeing. Need to check whether this can really ever be false.
 	_state._curLibPtr = this;
 	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
 
@@ -691,9 +694,13 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_imgData = NULL;
 
 	int nbytes = _bounds.width() * _bounds.height();
-	if (_flags & 0x20) {
-		error("TODO: sInitPic flags&0x20");
-	} else if (_flags & 8) {
+	if (_flags & PICFLAG_20) {
+		if (_flags & (PICFLAG_80 | PICFLAG_40)) {
+			error("TODO: sInitPic");
+		} else {
+			error("TODO: sInitPic");
+		}
+	} else if (_flags & PICFLAG_8) {
 		int mode = 0;
 		if (_bounds.width() == 320) {
 			mode = 147;
@@ -724,15 +731,15 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 		}
 
 //		byte *imgData = _imgData;
-		if (_flags & 0x10) {
+		if (_flags & PICFLAG_10) {
 			// TODO: Figure out what it's doing. Looks like a direct clearing
 			// of the screen directly
 		} else {
 			// TODO: Figure out direct screen loading
 		}
 	} else {
-		if (_flags & 0x1000) {
-			if (!(_flags & 0x10))
+		if (_flags & PICFLAG_1000) {
+			if (!(_flags & PICFLAG_10))
 				nbytes = state._curMemberPtr->_size - 24;
 
 			int mask = (nbytes + 0x3FFF) >> 14;
@@ -753,7 +760,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 			}
 		}
 
-		if (_flags & 0x10) {
+		if (_flags & PICFLAG_10) {
 			_imgData = new byte[nbytes];
 			Common::fill(_imgData, _imgData + nbytes, 0);
 		} else {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index c81761a..28c77bb 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -119,8 +119,8 @@ public:
 	BoltFile(const Common::String &filename, BoltFilesState &state);
 	virtual ~BoltFile();
 
-	BoltGroup *getBoltGroup(uint32 id);
-	void freeBoltGroup(uint32 id);
+	BoltGroup *getBoltGroup(uint16 id, bool process = true);
+	void freeBoltGroup(uint16 id, bool freeEntries = true);
 	void freeBoltMember(uint32 id);
 	byte *memberAddr(uint32 id);
 	byte *memberAddrOffset(uint32 id);
@@ -241,6 +241,9 @@ public:
 
 /* bvoy.blt resource types */
 
+enum PictureFlag { PICFLAG_8 = 8, PICFLAG_10 = 0x10, PICFLAG_20 = 0x20, 
+	PICFLAG_40 = 0x40, PICFLAG_80 = 0x80, PICFLAG_1000 = 0x1000 };
+
 class PictureResource: public DisplayResource {
 public:
 	byte _select;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 0143084..944fbc0 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -421,7 +421,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_eventsManager.incrementTime(1);
 					_vm->_eventsManager.incrementTime(1);
 
-					_vm->_bVoy->freeBoltGroup(0x17F00);
+					_vm->_bVoy->freeBoltGroup(0x7F00);
 					_vm->_voy._field478 = -17;
 					_vm->_eventsManager._videoComputerBut4 = -1;
 					_vm->_voy._field470 = 129;
@@ -459,7 +459,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_playStamp1 = -1;
 
 					if (_vm->_eventsManager._videoDead != -1) {
-						_vm->_bVoy->freeBoltGroup(0x10E00);
+						_vm->_bVoy->freeBoltGroup(0xE00);
 						_vm->_eventsManager._videoDead = -1;
 						(*_vm->_graphicsManager._vPort)->_flags |= 8;
 
@@ -1434,8 +1434,9 @@ void ThreadResource::freeTheApt() {
 }
 
 void ThreadResource::doAptAnim(int mode) {
-	_vm->_bVoy->freeBoltGroup(0x10100);
+	_vm->_bVoy->freeBoltGroup(0x100, true);
 
+	// Figure out the resource to use
 	int id = 0;
 	switch (_vm->_voy._field472) {
 	case 140:
@@ -1479,6 +1480,7 @@ void ThreadResource::doAptAnim(int mode) {
 	if (mode)
 		id += 0x100;
 
+	// Do the display
 	if (_vm->_bVoy->getBoltGroup(id)) {
 		CMapResource *pal = _vm->_bVoy->boltEntry(id)._cMapResource;
 		pal->_steps = 1;
@@ -1497,7 +1499,7 @@ void ThreadResource::doAptAnim(int mode) {
 		_vm->_bVoy->freeBoltGroup(id);
 	}
 
-	_vm->_bVoy->getBoltGroup(0x10100);
+	_vm->_bVoy->getBoltGroup(0x100);
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index f143b0d..bb8b137 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -124,8 +124,8 @@ void VoyeurEngine::globalInitBolt() {
 	initBolt();
 
 	_filesManager.openBoltLib("bvoy.blt", _bVoy);
-	_bVoy->getBoltGroup(0x10000);
-	_bVoy->getBoltGroup(0x10100);
+	_bVoy->getBoltGroup(0x000);
+	_bVoy->getBoltGroup(0x100);
 
 	_graphicsManager._fontPtr = &_defaultFontInfo;
 	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
@@ -163,7 +163,7 @@ bool VoyeurEngine::doHeadTitle() {
 	_eventsManager.startMainClockInt();
 
 	// Show starting screen
-//	if (_bVoy->getBoltGroup(0x10500))
+//	if (_bVoy->getBoltGroup(0x500))
 //		showConversionScreen();
 	if (shouldQuit())
 		return false;
@@ -236,7 +236,7 @@ void VoyeurEngine::showConversionScreen() {
 		_eventsManager.delay(1);
 
 	_graphicsManager.screenReset();
-	_bVoy->freeBoltGroup(0x10500);
+	_bVoy->freeBoltGroup(0x500);
 
 
 }
@@ -253,7 +253,7 @@ bool VoyeurEngine::doLock() {
 	int keyCount;
 	int key;
 
-	if (_bVoy->getBoltGroup(0x10700)) {
+	if (_bVoy->getBoltGroup(0x700)) {
 		lock.getSysDate();
 		lock.getThePassword();
 		
@@ -416,7 +416,7 @@ bool VoyeurEngine::doLock() {
 		lock.saveThePassword();
 
 		_voy._field4386 = NULL;
-		_bVoy->freeBoltGroup(0x10700);
+		_bVoy->freeBoltGroup(0x700);
 	}
 
 	_eventsManager.mouseOff();
@@ -428,7 +428,7 @@ bool VoyeurEngine::doLock() {
 }
 
 void VoyeurEngine::showTitleScreen() {
-	if (_bVoy->getBoltGroup(0x10500)) {
+	if (_bVoy->getBoltGroup(0x500)) {
 		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x500);
 
 		(*_graphicsManager._vPort)->setupViewPort();
@@ -468,7 +468,7 @@ void VoyeurEngine::showTitleScreen() {
 		playRL2Video("a1100100.rl2");
 		_graphicsManager.screenReset();
 
-		_bVoy->freeBoltGroup(0x10500);
+		_bVoy->freeBoltGroup(0x500);
 	}
 }
 
@@ -476,7 +476,7 @@ void VoyeurEngine::doOpening() {
 /*
 	_graphicsManager.screenReset();
 
-	if (!_bVoy->getBoltGroup(0x10200))
+	if (!_bVoy->getBoltGroup(0x200, true))
 		return;
 
 	byte *frameTable = _bVoy->memberAddr(0x215);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 93bb9d9..1721503 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -39,7 +39,7 @@ void VoyeurEngine::playStamp() {
 	_stampLibPtr = NULL;
 	_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
 
-	_stampLibPtr->getBoltGroup(0x10000);
+	_stampLibPtr->getBoltGroup(0);
 	_resolvePtr = &RESOLVE_TABLE[0];
 	initStamp();
 
@@ -210,7 +210,7 @@ void VoyeurEngine::playStamp() {
 
 	_voy._field4386 = 0;
 	closeStamp();
-	_stampLibPtr->freeBoltGroup(0x10000);
+	_stampLibPtr->freeBoltGroup(0);
 	delete _stampLibPtr;
 }
 


Commit: 663d08b192027a534f077168b72e79fe63a799fd
    https://github.com/scummvm/scummvm/commit/663d08b192027a534f077168b72e79fe63a799fd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-15T14:51:47-08:00

Commit Message:
VOYEUR: Fix for when multiple bolt files are open

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index a9473d4..28f4763 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -163,9 +163,10 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 #undef NEXT_BYTE
 
 void BoltFilesState::nextBlock() {
-	if (_curFilePosition != _bufferEnd)
-		_curFd->seek(_bufferEnd);
+	if (&_curLibPtr->_file != _curFd || _curFilePosition != _bufferEnd)
+		_curLibPtr->_file.seek(_bufferEnd);
 
+	_curFd = &_curLibPtr->_file;
 	_bufferBegin = _bufferEnd;
 	int bytesRead = _curFd->read(_bufStart, _bufSize);
 
@@ -219,7 +220,6 @@ byte *FilesManager::fload(const Common::String &filename, int *size) {
 /*------------------------------------------------------------------------*/
 
 BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _state(state) {
-	_state._curFd = &_file;
 	if (!_file.open(filename))
 		error("Could not open %s", filename.c_str());
 	_state._curFilePosition = 0;
@@ -233,13 +233,15 @@ BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _stat
 
 	int totalGroups = header[11] ? header[11] : 0x100;
 	for (int i = 0; i < totalGroups; ++i)
-		_groups.push_back(BoltGroup(_state._curFd));
+		_groups.push_back(BoltGroup(&_file));
 }
 
 BoltFile::~BoltFile() {
 	_file.close();
 	if (_state._curFd == &_file)
 		_state._curFd = NULL;
+	if (_state._curLibPtr == this)
+		_state._curLibPtr = NULL;
 }
 
 BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 28c77bb..e82d6a8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -100,7 +100,6 @@ public:
 class BoltFile {
 private:
 	Common::Array<BoltGroup> _groups;
-	Common::File _file;
 protected:
 	BoltFilesState &_state;
 
@@ -116,6 +115,8 @@ private:
 	void initGro() {}	// TODO
 	void termGro() {}	// TODO
 public:
+	Common::File _file;
+public:
 	BoltFile(const Common::String &filename, BoltFilesState &state);
 	virtual ~BoltFile();
 


Commit: e132e8b7c1c99c503a9e369dbe9bb7383fd0c221
    https://github.com/scummvm/scummvm/commit/e132e8b7c1c99c503a9e369dbe9bb7383fd0c221
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-15T16:01:44-08:00

Commit Message:
VOYEUR: Implemented doApt

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index e82d6a8..0a7df28 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -427,8 +427,8 @@ public:
 	static void unloadAllStacks(VoyeurEngine *vm);
 	static int _currentMouseX;
 	static int _currentMouseY;
-	static int _doAptState1;
-	static int _doAptState2;
+	static int _doAptPosX;
+	static int _doAptPosY;
 
 	static void init();
 private:
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 944fbc0..3411d7e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -33,8 +33,8 @@ byte *ThreadResource::_threadDataPtr;
 CMapResource *ThreadResource::_cmd14Pal;
 int ThreadResource::_currentMouseX;
 int ThreadResource::_currentMouseY;
-int ThreadResource::_doAptState1;
-int ThreadResource::_doAptState2;
+int ThreadResource::_doAptPosX;
+int ThreadResource::_doAptPosY;
 
 void ThreadResource::init() {
 	_stampFlags = 0;
@@ -43,8 +43,8 @@ void ThreadResource::init() {
 	_cmd14Pal = nullptr;
 	_currentMouseX = 392;
 	_currentMouseY = 57;
-	_doAptState1 = -1;
-	_doAptState2 = -1;
+	_doAptPosX = -1;
+	_doAptPosY = -1;
 }
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
@@ -1062,17 +1062,104 @@ int ThreadResource::doApt() {
 	PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource;
 	_vm->_eventsManager.getMouseInfo();
 
-	if (_doAptState1 == -1) {
-		_doAptState1 = READ_LE_UINT16(dataP + 18) + 16;
-		_doAptState2 = READ_LE_UINT16(dataP + 20) + 16;
+	if (_doAptPosX == -1) {
+		_doAptPosX = READ_LE_UINT16(dataP + 18) + 16;
+		_doAptPosY = READ_LE_UINT16(dataP + 20) + 16;
 		_vm->_playStamp2 = 153;
 	}
 
 	if (_vm->_voy._field470 == 16) {
-		// TODO
+		WRITE_LE_UINT16(dataP + 2, 999);
+		WRITE_LE_UINT16(dataP + 26, 999);
+		_doAptPosX = READ_LE_UINT16(dataP + 34) + 28;
+		_doAptPosY = READ_LE_UINT16(dataP + 36) + 28;
 	}
 
-	return 0;
+	_vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY));
+	_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
+	_vm->_playStamp2 = 151;
+
+	_vm->_graphicsManager.setColor(129, 82, 82, 82);
+	_vm->_graphicsManager.setColor(130, 112, 112, 112);
+	_vm->_graphicsManager.setColor(131, 215, 215, 215);
+	_vm->_graphicsManager.setColor(132, 235, 235, 235);
+
+	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._hasPalette = true;
+
+	int result;
+	Common::Point pt;
+	PictureResource *pic;
+	do {
+		_vm->_eventsManager.getMouseInfo();
+		if (_vm->_soundManager.getVOCStatus()) {
+			_vm->_playStamp2 = _vm->getRandomNumber(4) + 151;
+			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
+		}
+
+		result = -1;
+		pt = _vm->_eventsManager.getMousePos();
+		for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) {
+			if (READ_LE_UINT16(dataP + idx * 8 + 2) <= pt.x &&
+				READ_LE_UINT16(dataP + idx * 8 + 6) >= pt.x &&
+				READ_LE_UINT16(dataP + idx * 8 + 4) <= pt.y &&
+				READ_LE_UINT16(dataP + idx * 8 + 8) >= pt.y) {
+				// Found entry
+				result = idx;
+
+				if (idx != varC) {
+					if ((_vm->_voy._field478 & 0x100) && (result == 2))
+						result = 5;
+
+					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 
+						result + 6)._picResource;
+					_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort,
+						Common::Point(106, 200));
+				}
+
+				break;
+			}
+		}
+
+		pic = _vm->_bVoy->boltEntry((result == -1) ? _vm->_playStamp1 + 2 :
+			_vm->_playStamp1 + 3)._picResource;
+		_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt);
+
+		(*_vm->_graphicsManager._vPort)->_flags |= 8;
+		_vm->_graphicsManager.flipPage();
+		_vm->_eventsManager.sWaitFlip();
+
+	} while (!_vm->shouldQuit() && !_vm->_voy._lastInplay && result == -1);
+
+	pt = _vm->_eventsManager.getMousePos();
+	_doAptPosX = pt.x;
+	_doAptPosY = pt.y;
+
+	switch (result) {
+	case 0:
+		_vm->_voy._field472 = 140;
+		break;
+	case 1:
+		_vm->_voy._field472 = 143;
+		break;
+	case 2:
+		_vm->_voy._field472 = 142;
+	case 5:
+		_vm->_voy._field472 = 141;
+		break;
+	default:
+		_vm->_voy._field472 = -1;
+		break;
+	}
+
+	freeTheApt();
+	if (_vm->_voy._field474 == 1 && result == 0)
+		_vm->checkTransition();
+
+	if (!result)
+		_vm->makeViewFinder();
+
+	return result;
 }
 
 void ThreadResource::doRoom() {


Commit: 7d8aa0a506ea635a1e60ebef34a704b8d7a24fde
    https://github.com/scummvm/scummvm/commit/7d8aa0a506ea635a1e60ebef34a704b8d7a24fde
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-15T17:11:11-08:00

Commit Message:
VOYEUR: Implemented getVOCFileName

Changed paths:
    engines/voyeur/sound.cpp
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h



diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index 752a35d..ea6f9fa 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -24,6 +24,7 @@
 #include "audio/decoders/raw.h"
 #include "common/memstream.h"
 #include "voyeur/sound.h"
+#include "voyeur/staticres.h"
 
 namespace Voyeur {
 
@@ -60,11 +61,18 @@ void SoundManager::setVOCOffset(int offset) {
 }
 
 Common::String SoundManager::getVOCFileName(int idx) {
-	error("TODO: getVOCFileName");
+	return Common::String::format("%s.voc", VOC_FILENAMES[idx]);
 }
 
 void SoundManager::startVOCPlay(const Common::String &filename) {
-	error("TODO: startVOCPlay");
+	Common::File f;
+	if (!f.open(filename))
+		error("Could not find voc file - %s", filename.c_str());
+
+	Audio::AudioStream *audioStream = Audio::makeVOCStream(f.readStream(f.size()), 
+		Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
+
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream);
 }
 
 int SoundManager::getVOCStatus() {
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index f5dd561..0056bbe 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -74,4 +74,35 @@ const int COMP_BUT_TABLE[] = {
 	68, 79, 98, 102
 };
 
+const char *const VOC_FILENAMES[] = {
+    "A2110100", nullptr, "A2300100", nullptr, "B1220100", nullptr, "C1220100", nullptr, 
+	"C1290100", nullptr, "D1220100", nullptr, "D1270100", nullptr, "E1210100", nullptr, 
+	"E1260100", nullptr, "E1280100", nullptr, "E1325100", nullptr, "F1200100", nullptr,
+	"G1250100", nullptr, "G1260100", nullptr, "H1200100", nullptr, "H1230100", nullptr, 
+	"H1310100", nullptr, "I1300100", nullptr, "J1220100", nullptr, "J1230100", nullptr, 
+	"J1320100", nullptr, "K1260100", nullptr, "K1280100", nullptr, "K1325100", nullptr,
+	"L1210100", nullptr, "L1280100", nullptr, "L1290100", nullptr, "L1300100", nullptr, 
+	"L1310100", nullptr, "M1260100", nullptr, "M1310100", nullptr, "N1210100", nullptr, 
+	"N1225100", nullptr, "N1275510", nullptr, "N1280510", nullptr, "N1325100", nullptr,
+	"O1230100", nullptr, "O1260100", nullptr, "O1260520", nullptr, "O1280100", nullptr, 
+	"O1325540", nullptr, "P1276710", nullptr, "P1280540", nullptr, "P1280740", nullptr, 
+	"P1290510", nullptr, "P1325100", nullptr, "P1325300", nullptr, "P1325520", nullptr,
+	"Q1230100", nullptr, "Q1240530", nullptr, "Q1240730", nullptr, "Q1260100", nullptr, 
+	"Q1260520", nullptr, "Q1260720", nullptr, "Q1325100", nullptr, "R1280540", nullptr, 
+	"Z1110510", nullptr, "Z1110520", nullptr, "Z1110530", nullptr, "Z1110540", nullptr,
+	"Z1110545", nullptr, "Z2320100", nullptr, "Z2905300", nullptr, "Z3110100", nullptr, 
+	"Z3115510", nullptr, "Z3115520", nullptr, "Z3115530", nullptr, "Z3115540", nullptr, 
+	"Z4915100", nullptr, "Z4915200", nullptr, "Z4915300",
+	nullptr, nullptr, nullptr, nullptr, nullptr,
+	"MMARG", "MZACK", "MREED", "MJESSI", "MCHLOE", "MCAMERA", "MENDCRED",
+	"NEWCALL2", "PHONE1", "PHONE2", "PHONE3", "PHONE6", "PHONE8",
+	"B1300100", "C1250100", "C1320100", "D1320100", "E1210200", "E1260200",
+	"E1280200", "E1310100", "G1230100", "G1300100", "I1210100", "I1270100",
+	"I1280100", "J1250100", "J1280100", "K1260200", "K1270100", "K1325200",
+	"L1240100", "M1200100", "M1230100", "M1290100", "N1250100", "N1260100",
+	"N1280100", "O1250510", "O1290510", "O1320510", "O1320710", "P1240100",
+	"P1240530", "P1260100", "P1270100", "P1280100", "P1280530", "P1320530",
+	"Q1240100", "E1325100"
+};
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index e9c4164..505b644 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -39,6 +39,8 @@ extern const int BLIND_TABLE[];
 
 extern const int COMP_BUT_TABLE[];
 
+extern const char *const VOC_FILENAMES[];
+
 } // End of namespace Voyeur
 
 #endif


Commit: 5dde350ba085e0d22001614f354bd3718490bffe
    https://github.com/scummvm/scummvm/commit/5dde350ba085e0d22001614f354bd3718490bffe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-16T19:21:11-08:00

Commit Message:
VOYEUR: Implemented getVOCStatus

Changed paths:
    engines/voyeur/sound.cpp



diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index ea6f9fa..baad356 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -76,7 +76,7 @@ void SoundManager::startVOCPlay(const Common::String &filename) {
 }
 
 int SoundManager::getVOCStatus() {
-	error("TODO: getVOCStatus");
+	return _mixer->isSoundHandleActive(_soundHandle);
 }
 
 } // End of namespace Voyeur


Commit: 2346671e7c9d8034d79e72549e3e468deadefdbd
    https://github.com/scummvm/scummvm/commit/2346671e7c9d8034d79e72549e3e468deadefdbd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-16T19:21:41-08:00

Commit Message:
VOYEUR: Resource fix in doAptAnim

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 3411d7e..903ff4f 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1573,7 +1573,7 @@ void ThreadResource::doAptAnim(int mode) {
 		pal->_steps = 1;
 
 		for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) {
-			PictureResource *pic = _vm->_bVoy->boltEntry(id + idx)._picResource;
+			PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource;
 			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 
 			(*_vm->_graphicsManager._vPort)->_flags |= 8;


Commit: b99176fee6f8f3f78783f19ba760fbb35647044b
    https://github.com/scummvm/scummvm/commit/b99176fee6f8f3f78783f19ba760fbb35647044b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-17T17:18:01-08:00

Commit Message:
VOYEUR: Fix for sound playback in the apartment

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 903ff4f..eb9f27d 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1092,7 +1092,7 @@ int ThreadResource::doApt() {
 	PictureResource *pic;
 	do {
 		_vm->_eventsManager.getMouseInfo();
-		if (_vm->_soundManager.getVOCStatus()) {
+		if (!_vm->_soundManager.getVOCStatus()) {
 			_vm->_playStamp2 = _vm->getRandomNumber(4) + 151;
 			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
 		}


Commit: 23f9cb19b4e4d36b2a1c52847a54a8ae9c430f32
    https://github.com/scummvm/scummvm/commit/23f9cb19b4e4d36b2a1c52847a54a8ae9c430f32
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T05:53:44-08:00

Commit Message:
VOYEUR: In progress work on fixing initial apartment animation

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 6dbd7de..b752c50 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -201,8 +201,8 @@ void EventsManager::videoTimer() {
 	if (_gameData._hasPalette) {
 		_gameData._hasPalette = false;
 
-		g_system->getPaletteManager()->setPalette(_gameData._palette,
-			_gameData._palStartIndex, 
+		g_system->getPaletteManager()->setPalette(_gameData._palette +
+			_gameData._palStartIndex * 3, _gameData._palStartIndex, 
 			_gameData._palEndIndex - _gameData._palStartIndex + 1);
 	}
 }
@@ -423,14 +423,13 @@ void EventsManager::getMouseInfo() {
 		if ((_gameCounter - _joe) > 8) {
 			_joe = _gameCounter;
 
-			// TODO: Figure out difference between setOneColor and setColor calls
 			if (_vm->_bob) {
 				_vm->_bob = false;
-				//_vm->_graphicsManager.setColor(128, 55, 5, 5);
+				_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
 				_vm->_graphicsManager.setColor(128, 220, 20, 20);
 			} else {
 				_vm->_bob = true;
-				//_vm->_graphicsManager.setColor(128, 55, 55, 55);
+				_vm->_graphicsManager.setOneColor(128, 55, 55, 55);
 				_vm->_graphicsManager.setColor(128, 220, 20, 20);
 			}
 		}
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index eb9f27d..c808064 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1575,12 +1575,13 @@ void ThreadResource::doAptAnim(int mode) {
 		for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) {
 			PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource;
 			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
+			pal->startFade();
 
 			(*_vm->_graphicsManager._vPort)->_flags |= 8;
 			_vm->_graphicsManager.flipPage();
 			_vm->_eventsManager.sWaitFlip();
 
-			_vm->_eventsManager.delay(5);
+			_vm->_eventsManager.delay(50);
 		}
 
 		_vm->_bVoy->freeBoltGroup(id);
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 96214b7..25f63a9 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -56,6 +56,7 @@ GraphicsManager::GraphicsManager():
 	_backgroundPage = NULL;
 	_vPort = NULL;
 	_fontPtr = NULL;
+	Common::fill(&_VGAColors[0], &_VGAColors[PALETTE_SIZE], 0);
 }
 
 void GraphicsManager::sInitGraphics() {
@@ -350,6 +351,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 					// loc_25D40
 					if (srcFlags & DISPFLAG_100) {
 						// loc_25D4A
+						error("TODO: sDrawPic");
 					} else {
 						// loc_2606D
 						destP = (byte *)_screenSurface.getPixels() + screenOffset;
@@ -453,13 +455,35 @@ error("TODO: var22/var24/var2C not initialised before use?");
 					}
 				} else {
 					if (srcFlags & 0x100) {
+						// Simple run-length encoded image
 						srcP = srcImgData;
 
 						if (isClipped) {
 							// loc_26424
+							error("TODO: sDrawPic");
 
 						} else {
 							// loc_26543
+							for (int yp = 0; yp < height1; ++yp) {
+								int runLength = 0;
+								for (int xp = 0; xp < width2; ++xp, --runLength) {
+									if (runLength <= 0) {
+										// Start of run length, so get pixel and repeat length
+										pixel = *srcP++;
+										if (pixel & 0x80) {
+											pixel &= 0x7f;
+											runLength = *srcP++;
+											if (runLength == 0)
+												runLength = width2;
+										}
+									}
+
+									// Copy pixel to output
+									*destP++ = pixel;
+								}
+
+								destP += widthDiff2;
+							}
 						}
 					} else {
 						for (int yp = 0; yp < height1; ++yp) {
@@ -646,6 +670,14 @@ void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
 	_vm->_eventsManager._intPtr._palEndIndex = MAX(_vm->_eventsManager._intPtr._palEndIndex, idx);
 }
 
+void GraphicsManager::setOneColor(int idx, byte r, byte g, byte b) {
+	byte palEntry[3];
+	palEntry[0] = r;
+	palEntry[1] = g;
+	palEntry[2] = b;
+	g_system->getPaletteManager()->setPalette(&palEntry[0], idx, 1);
+}
+
 void GraphicsManager::screenReset() {
 	resetPalette();
 
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index cdd5828..549d05f 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -110,6 +110,7 @@ public:
 	void setPalette(const byte *palette, int start, int count);
 	void resetPalette();
 	void setColor(int idx, byte r, byte g, byte b);
+	void setOneColor(int idx, byte r, byte g, byte b);
 	void screenReset();
 	void doScroll(const Common::Point &pt);
 	void fadeDownICF1(int steps);


Commit: 29fe53993bae1c3317901d7a333588dbb8ba6d83
    https://github.com/scummvm/scummvm/commit/29fe53993bae1c3317901d7a333588dbb8ba6d83
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T06:03:18-08:00

Commit Message:
VOYEUR: Fix error in vDoFadeInt

Changed paths:
    engines/voyeur/events.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index b752c50..2cf3d9e 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -337,6 +337,7 @@ void EventsManager::vDoFadeInt() {
 	if (--_fadeCount == 0) {
 		_fadeIntNode._flags |= 1;
 		_fadeStatus &= ~1;
+		return;
 	}
 
 


Commit: 1a4c6d46ace615ec82893dcd11b6e5a4260496a4
    https://github.com/scummvm/scummvm/commit/1a4c6d46ace615ec82893dcd11b6e5a4260496a4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T06:17:47-08:00

Commit Message:
VOYEUR: Reset doAptAnim frame delay back to what it should be

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index c808064..bf68659 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1581,7 +1581,7 @@ void ThreadResource::doAptAnim(int mode) {
 			_vm->_graphicsManager.flipPage();
 			_vm->_eventsManager.sWaitFlip();
 
-			_vm->_eventsManager.delay(50);
+			_vm->_eventsManager.delay(5);
 		}
 
 		_vm->_bVoy->freeBoltGroup(id);


Commit: 6cd2d0139797e47527190d670cbf6453277046f0
    https://github.com/scummvm/scummvm/commit/6cd2d0139797e47527190d670cbf6453277046f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T06:34:48-08:00

Commit Message:
VOYEUR: Fixes for doApt mouse handling

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index bf68659..c4e4708 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1054,25 +1054,25 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
 }	
 
 int ThreadResource::doApt() {
-	int varC = -1;
 	loadTheApt();
 
 	_vm->_playStamp2 = 151;
-	byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1);
+	_vm->_voy._field4386 = _vm->_bVoy->memberAddr(_vm->_playStamp1); 
+	byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1);
 	PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource;
 	_vm->_eventsManager.getMouseInfo();
 
 	if (_doAptPosX == -1) {
-		_doAptPosX = READ_LE_UINT16(dataP + 18) + 16;
-		_doAptPosY = READ_LE_UINT16(dataP + 20) + 16;
+		_doAptPosX = READ_LE_UINT16(hotspotsP + 18) + 16;
+		_doAptPosY = READ_LE_UINT16(hotspotsP + 20) + 16;
 		_vm->_playStamp2 = 153;
 	}
 
 	if (_vm->_voy._field470 == 16) {
-		WRITE_LE_UINT16(dataP + 2, 999);
-		WRITE_LE_UINT16(dataP + 26, 999);
-		_doAptPosX = READ_LE_UINT16(dataP + 34) + 28;
-		_doAptPosY = READ_LE_UINT16(dataP + 36) + 28;
+		WRITE_LE_UINT16(hotspotsP + 2, 999);
+		WRITE_LE_UINT16(hotspotsP + 26, 999);
+		_doAptPosX = READ_LE_UINT16(hotspotsP + 34) + 28;
+		_doAptPosY = READ_LE_UINT16(hotspotsP + 36) + 28;
 	}
 
 	_vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY));
@@ -1087,32 +1087,37 @@ int ThreadResource::doApt() {
 	_vm->_eventsManager._intPtr.field38 = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 
-	int result;
+	// Main loop to allow users to move the cursor and select hotspots
+	int hotspotId;
+	int prevHotspotId = -1;
 	Common::Point pt;
 	PictureResource *pic;
 	do {
 		_vm->_eventsManager.getMouseInfo();
 		if (!_vm->_soundManager.getVOCStatus()) {
+			// Previous sound ended, so start up a new one
 			_vm->_playStamp2 = _vm->getRandomNumber(4) + 151;
 			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
 		}
 
-		result = -1;
+		// Loop through the hotspot list
+		hotspotId = -1;
 		pt = _vm->_eventsManager.getMousePos();
-		for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) {
-			if (READ_LE_UINT16(dataP + idx * 8 + 2) <= pt.x &&
-				READ_LE_UINT16(dataP + idx * 8 + 6) >= pt.x &&
-				READ_LE_UINT16(dataP + idx * 8 + 4) <= pt.y &&
-				READ_LE_UINT16(dataP + idx * 8 + 8) >= pt.y) {
-				// Found entry
-				result = idx;
-
-				if (idx != varC) {
-					if ((_vm->_voy._field478 & 0x100) && (result == 2))
-						result = 5;
-
+		for (int idx = 0; idx < READ_LE_UINT16(hotspotsP); ++idx) {
+			if (pt.x > READ_LE_UINT16(hotspotsP + idx * 8 + 2) &&
+				pt.x < READ_LE_UINT16(hotspotsP + idx * 8 + 6) &&
+				pt.y > READ_LE_UINT16(hotspotsP + idx * 8 + 4) &&
+				pt.y < READ_LE_UINT16(hotspotsP + idx * 8 + 8)) {
+				// Cursor is within hotspot area
+				hotspotId = idx;
+
+				if (idx != prevHotspotId) {
+					if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2))
+						hotspotId = 5;
+
+					// Draw the text description for the highlighted hotspot
 					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 
-						result + 6)._picResource;
+						hotspotId + 6)._picResource;
 					_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort,
 						Common::Point(106, 200));
 				}
@@ -1121,7 +1126,8 @@ int ThreadResource::doApt() {
 			}
 		}
 
-		pic = _vm->_bVoy->boltEntry((result == -1) ? _vm->_playStamp1 + 2 :
+		// Draw either standard or highlighted eye cursor
+		pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStamp1 + 2 :
 			_vm->_playStamp1 + 3)._picResource;
 		_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt);
 
@@ -1129,13 +1135,13 @@ int ThreadResource::doApt() {
 		_vm->_graphicsManager.flipPage();
 		_vm->_eventsManager.sWaitFlip();
 
-	} while (!_vm->shouldQuit() && !_vm->_voy._lastInplay && result == -1);
+	} while (!_vm->shouldQuit() && (!_vm->_voy._lastInplay || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();
 	_doAptPosX = pt.x;
 	_doAptPosY = pt.y;
 
-	switch (result) {
+	switch (hotspotId) {
 	case 0:
 		_vm->_voy._field472 = 140;
 		break;
@@ -1153,13 +1159,13 @@ int ThreadResource::doApt() {
 	}
 
 	freeTheApt();
-	if (_vm->_voy._field474 == 1 && result == 0)
+	if (_vm->_voy._field474 == 1 && hotspotId == 0)
 		_vm->checkTransition();
 
-	if (!result)
+	if (!hotspotId)
 		_vm->makeViewFinder();
 
-	return result;
+	return hotspotId;
 }
 
 void ThreadResource::doRoom() {


Commit: 13b4c9ca68b5505f4b851d3d36f3f9cb9a333f95
    https://github.com/scummvm/scummvm/commit/13b4c9ca68b5505f4b851d3d36f3f9cb9a333f95
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T17:13:34-08:00

Commit Message:
VOYEUR: Renaming of mouse click fields

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 2cf3d9e..866706d 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -237,14 +237,15 @@ void EventsManager::pollEvents() {
 			return;
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButton = 1;
-			_vm->_voy._incriminate = true;
+			_vm->_voy._newMouseClicked = true;
 			return;
 		case Common::EVENT_RBUTTONDOWN:
 			_mouseButton = 2;
+			_vm->_voy._newMouseClicked = true;
 			return;
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONUP:
-			_vm->_voy._incriminate = false;
+			_vm->_voy._newMouseClicked = false;
 			_mouseButton = 0;
 			return;
 		case Common::EVENT_MOUSEMOVE:
@@ -437,7 +438,7 @@ void EventsManager::getMouseInfo() {
 	}
 
 	_vm->_voy._incriminate = _vm->_voy._newIncriminate;
-	_vm->_voy._lastInplay = _vm->_voy._newLastInplay;
+	_vm->_voy._mouseClicked = _vm->_voy._newMouseClicked;
 	_vm->_voy._fadeFunc = _vm->_voy._newFadeFunc;
 	_vm->_voy._fadeICF1 = _vm->_voy._newFadeICF1;
 }
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 9fe3464..b341a23 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -124,13 +124,13 @@ public:
 	int _fadeICF0;
 	int _fadeICF1;
 	void (*_fadeFunc)();
-	int _lastInplay;
+	bool _mouseClicked;
 	int _incriminate;
 	int _policeEvent;
 
 	// Fields not originally in _voy, but I'm putting in for convenience
 	int _newIncriminate;
-	int _newLastInplay;
+	bool _newMouseClicked;
 	int _newFadeICF1;
 	void (*_newFadeFunc)();
 };
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index c4e4708..70bbf32 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1135,7 +1135,7 @@ int ThreadResource::doApt() {
 		_vm->_graphicsManager.flipPage();
 		_vm->_eventsManager.sWaitFlip();
 
-	} while (!_vm->shouldQuit() && (!_vm->_voy._lastInplay || hotspotId == -1));
+	} while (!_vm->shouldQuit() && (!_vm->_voy._mouseClicked || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();
 	_doAptPosX = pt.x;
@@ -1331,7 +1331,7 @@ int ThreadResource::doInterface() {
 				_vm->_voy._field474 = 17;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->checkTransition();
-				_vm->_voy._lastInplay = true;
+				_vm->_voy._mouseClicked = true;
 			} else {
 				_vm->_voy._field478 = 1;
 				_currentMouseX = pt.x;
@@ -1355,7 +1355,7 @@ int ThreadResource::doInterface() {
 			}
 		}
 	} while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && 
-		(!_vm->_voy._lastInplay || var8 == -1));
+		(!_vm->_voy._mouseClicked || var8 == -1));
 
 	_vm->_voy._field478 |= 1;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);


Commit: f588211815d6383665072cb7637d40c8c4b5582a
    https://github.com/scummvm/scummvm/commit/f588211815d6383665072cb7637d40c8c4b5582a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T18:26:26-08:00

Commit Message:
VOYEUR: Implemented checkTransition

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/sound.cpp
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 866706d..e575539 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -88,8 +88,6 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	Common::fill(&_keyState[0], &_keyState[256], false);
 
 	_v2A0A2 = 0;
-	_videoComputerNum = 0;
-	_videoComputerBut1 = 0;
 	_videoComputerBut4 = 0;
 	_videoDead = 0;
 }
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index b341a23..9313ba3 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -63,7 +63,7 @@ public:
 
 class SVoy {
 public:
-	int _delaySecs;
+	int _isAM;
 	int _RTANum;
 	int _RTVNum;
 	int _switchBGNum;
@@ -81,7 +81,7 @@ public:
 	int _field46E;
 	int _field470;
 	int _field472;
-	int _field474;
+	int _checkTransitionId;
 	int _field476;
 	int _field478;
 	int _field47A;
@@ -192,8 +192,6 @@ public:
 	int _fadeStatus;
 
 	int _v2A0A2;
-	int _videoComputerNum;
-	int _videoComputerBut1;
 	int _videoComputerBut4;
 	int _videoDead;
 public:
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 70bbf32..e774674 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -557,19 +557,19 @@ void ThreadResource::parsePlayCommands() {
 				int count = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._field476 = READ_LE_UINT16(dataP + 4);
 
-				if (_vm->_voy._field474 != count) {
-					if (_vm->_voy._field474 > 1)
+				if (_vm->_voy._checkTransitionId != count) {
+					if (_vm->_voy._checkTransitionId > 1)
 						_vm->_voy._field478 &= ~0x100;
 
-					_vm->_voy._field474 = count;
-					_vm->_eventsManager._videoComputerBut1 = LEVEL_M[count - 1];
-					_vm->_eventsManager._videoComputerNum = LEVEL_H[count - 1];
+					_vm->_voy._checkTransitionId = count;
+					_vm->_gameMinute = LEVEL_M[count - 1];
+					_vm->_gameHour = LEVEL_H[count - 1];
 					//_vm->_v2A0A2 = 0;
 					_vm->_voy._RTVNum = 0;
 					_vm->_voy._RTANum = 255;
 				}
 
-				_vm->_voy._delaySecs = (_vm->_voy._field474 == 6) ? 1 : 0;
+				_vm->_voy._isAM = (_vm->_voy._checkTransitionId == 6) ? 1 : 0;
 			}
 
 			dataP += 6;
@@ -788,7 +788,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 23:
-			_vm->_voy._field474 = 17;
+			_vm->_voy._checkTransitionId = 17;
 			_vm->_voy._field472 = -1;
 			loadTheApt();
 			_vm->_voy._field472 = 144;
@@ -1059,7 +1059,6 @@ int ThreadResource::doApt() {
 	_vm->_playStamp2 = 151;
 	_vm->_voy._field4386 = _vm->_bVoy->memberAddr(_vm->_playStamp1); 
 	byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1);
-	PictureResource *srcPic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 3)._picResource;
 	_vm->_eventsManager.getMouseInfo();
 
 	if (_doAptPosX == -1) {
@@ -1159,7 +1158,7 @@ int ThreadResource::doApt() {
 	}
 
 	freeTheApt();
-	if (_vm->_voy._field474 == 1 && hotspotId == 0)
+	if (_vm->_voy._checkTransitionId == 1 && hotspotId == 0)
 		_vm->checkTransition();
 
 	if (!hotspotId)
@@ -1192,7 +1191,7 @@ int ThreadResource::doInterface() {
 	if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0)
 		_vm->_voy._RTVNum = _vm->_voy._field476 - 1;
 
-	if (_vm->_voy._field474 < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) {
+	if (_vm->_voy._checkTransitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) {
 		_vm->_voy._RTVNum = _vm->_voy._field476;
 		_vm->makeViewFinder();
 
@@ -1299,16 +1298,16 @@ int ThreadResource::doInterface() {
 
 		if (_vm->_voy._RTVNum & 2) {
 			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-				10 / _vm->_eventsManager._videoComputerBut1, 0x1900BE);
+				10 / _vm->_gameMinute, 0x1900BE);
 			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-				10 % _vm->_eventsManager._videoComputerBut1, 0x1900BE);
+				10 % _vm->_gameMinute, 0x1900BE);
 
 			if (_vm->_voy._RTANum & 4) {
-				int v = 10 / _vm->_eventsManager._videoComputerNum;
+				int v = 10 / _vm->_gameHour;
 				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
 					v == 0 ? 10 : v, 0x1900BE);
 				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-					_vm->_eventsManager._videoComputerNum % 10, 0x1900AC);
+					_vm->_gameHour % 10, 0x1900AC);
 
 				pic = _vm->_bVoy->boltEntry(274)._picResource;
 				_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
@@ -1326,9 +1325,9 @@ int ThreadResource::doInterface() {
 				(_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) {
 			_vm->_eventsManager.getMouseInfo();
 
-			if (_vm->_voy._field474 == 15) {
+			if (_vm->_voy._checkTransitionId == 15) {
 				var8 = 20;
-				_vm->_voy._field474 = 17;
+				_vm->_voy._checkTransitionId = 17;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->checkTransition();
 				_vm->_voy._mouseClicked = true;
@@ -1366,8 +1365,8 @@ int ThreadResource::doInterface() {
 }
 
 void ThreadResource::addAudioEventStart() {
-	_vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum,
-		_vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2, 
+	_vm->_voy._events.push_back(VoyeurEvent(_vm->_gameHour,
+		_vm->_gameMinute, _vm->_voy._isAM, 2, 
 		_vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, 
 		_vm->_eventsManager._videoDead));
 }
@@ -1434,7 +1433,7 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) {
 }
 
 void ThreadResource::loadTheApt() {
-	switch (_vm->_voy._field474) {
+	switch (_vm->_voy._checkTransitionId) {
 	case 1:
 	case 2:
 	case 5:
@@ -1552,7 +1551,7 @@ void ThreadResource::doAptAnim(int mode) {
 	}
 
 	int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2;
-	switch (_vm->_voy._field474) {
+	switch (_vm->_voy._checkTransitionId) {
 	case 3:
 		id += id2 << 8;
 		break;
@@ -1570,7 +1569,7 @@ void ThreadResource::doAptAnim(int mode) {
 		break;
 	}
 
-	if (mode)
+	if (mode == 1)
 		id += 0x100;
 
 	// Do the display
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index baad356..1cd0cf3 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -53,7 +53,7 @@ void SoundManager::abortVOCMap() {
 }
 
 void SoundManager::stopVOCPlay() {
-	warning("TODO: stopVOCPlay()");
+	_mixer->stopHandle(_soundHandle);
 }
 
 void SoundManager::setVOCOffset(int offset) {
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 0056bbe..b6f3730 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -105,4 +105,10 @@ const char *const VOC_FILENAMES[] = {
 	"Q1240100", "E1325100"
 };
 
+const char *const SATURDAY = "Saturday";
+const char *const SUNDAY = "Sunday";
+const char *const MONDAY = "Monday Morning";
+const char *const AM = "am";
+const char *const PM = "pm";
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 505b644..990e2cf 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -41,6 +41,12 @@ extern const int COMP_BUT_TABLE[];
 
 extern const char *const VOC_FILENAMES[];
 
+extern const char *const SATURDAY;
+extern const char *const SUNDAY;
+extern const char *const MONDAY;
+extern const char *const AM;
+extern const char *const PM;
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index bb8b137..1c8c185 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -44,6 +44,9 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_controlPtr = NULL;
 	_bob = false;
 	_playStamp1 = _playStamp2 = 0;
+	_checkTransitionId = -1;
+	_gameHour = 0;
+	_gameMinute = 0;
 
 	initialiseManagers();
 }
@@ -489,8 +492,8 @@ void VoyeurEngine::doOpening() {
 	_voy._RTVNum = 0;
 	_voy._field468 = _voy._RTVNum;
 	_voy._field478 = 16;
-	_eventsManager._videoComputerNum = 4;
-	_eventsManager._videoComputerBut1  = 0;
+	_eventsManager._gameHour = 4;
+	_eventsManager._gameMinute  = 0;
 	_eventsManager._videoComputerBut4 = 1;
 	_eventsManager._videoDead = -1;
 	addVideoEventStart();
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 5d0c267..f35af7d 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -117,6 +117,9 @@ public:
 	int _playStamp2;
 	const int *_resolvePtr;
 	int _iForceDeath;
+	int _checkTransitionId;
+	int _gameHour;
+	int _gameMinute;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1721503..54ff568 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -27,9 +27,9 @@ namespace Voyeur {
 
 void VoyeurEngine::addVideoEventStart() {
 	VoyeurEvent &e = _voy._events[_voy._evidence[19]];
-	e._computerNum = _eventsManager._videoComputerNum;
-	e._computerBut[0] = _eventsManager._videoComputerBut1;
-	e._computerBut[1] = _voy._delaySecs;
+	e._computerNum = _gameHour;
+	e._computerBut[0] = _gameMinute;
+	e._computerBut[1] = _voy._isAM;
 	e._computerBut[2] = 1;
 	e._computerBut[3] = _eventsManager._videoComputerBut4;
 	e._dead = _eventsManager._videoDead;
@@ -47,9 +47,9 @@ void VoyeurEngine::playStamp() {
 	ThreadResource *threadP = threadsList->_entries[0]->_threadResource;
 	threadP->initThreadStruct(0, 0);
 
-	_voy._delaySecs = 0;
-	_eventsManager._videoComputerNum = 9;
-	_eventsManager._videoComputerBut1 = 0;
+	_voy._isAM = 0;
+	_gameHour = 9;
+	_gameMinute = 0;
 	_eventsManager._v2A0A2 = 0;
 	_voy._field46E = 1;
 
@@ -111,7 +111,7 @@ void VoyeurEngine::playStamp() {
 			break;
 
 		case 16:
-			_voy._field474 = 17;
+			_voy._checkTransitionId = 17;
 			buttonId = threadP->doApt();
 			
 			switch (buttonId) {
@@ -134,7 +134,7 @@ void VoyeurEngine::playStamp() {
 
 		case 17:
 			doTapePlaying();
-			if (!checkForMurder() && _voy._field474 <= 15)
+			if (!checkForMurder() && _voy._checkTransitionId <= 15)
 				checkForIncriminate();
 
 			if (_voy._videoEventId != -1)
@@ -268,7 +268,41 @@ void VoyeurEngine::initIFace(){
 }
 
 void VoyeurEngine::checkTransition(){
-	error("TODO: checkTransition");
+	Common::String time, day;
+
+	if (_voy._checkTransitionId != _checkTransitionId) {
+		switch (_voy._checkTransitionId) {
+		case 0:
+			break;
+		case 1:
+		case 2:
+		case 3:
+		case 4:
+			day = SATURDAY;
+			break;
+		case 17: 
+			day = MONDAY;
+			break;
+		default:
+			day = SUNDAY;
+			break;
+		}
+
+		if (!day.empty()) {
+			_graphicsManager.fadeDownICF(6);
+
+			if (_voy._checkTransitionId != 17) {
+				const char *amPm = _voy._isAM ? AM : PM;
+				time = Common::String::format("%d:%02d%s",
+					_gameHour, _gameMinute, amPm);
+			}
+
+			doTransitionCard(day, time);
+			_eventsManager.delay(180);
+		}
+
+		_checkTransitionId = _voy._checkTransitionId;
+	}
 }
 
 void VoyeurEngine::doTimeBar(int v) {


Commit: 72c21cf0a77519e71febcfe0a2aef0fc44a3af87
    https://github.com/scummvm/scummvm/commit/72c21cf0a77519e71febcfe0a2aef0fc44a3af87
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-18T19:01:16-08:00

Commit Message:
VOYEUR: Implemented drawIfaceTime

Changed paths:
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 9313ba3..0db1281 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -81,7 +81,7 @@ public:
 	int _field46E;
 	int _field470;
 	int _field472;
-	int _checkTransitionId;
+	int _transitionId;
 	int _field476;
 	int _field478;
 	int _field47A;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 28f4763..31f6362 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1170,6 +1170,26 @@ void ViewPortResource::fillPic(byte onOff) {
 	_state._vm->_graphicsManager.fillPic(this, onOff);
 }
 
+void ViewPortResource::drawIfaceTime() {
+	// Hour display
+	_state._vm->_graphicsManager.drawANumber(*_state._vm->_graphicsManager._vPort, 
+		(_state._vm->_gameHour / 10) == 0 ? 10 : _state._vm->_gameHour / 10,
+		Common::Point(161, 25));
+	_state._vm->_graphicsManager.drawANumber(*_state._vm->_graphicsManager._vPort, 
+		_state._vm->_gameHour % 10, Common::Point(172, 25));
+
+	// Minute display
+	_state._vm->_graphicsManager.drawANumber(*_state._vm->_graphicsManager._vPort, 
+		_state._vm->_gameMinute / 10, Common::Point(190, 25));
+	_state._vm->_graphicsManager.drawANumber(*_state._vm->_graphicsManager._vPort, 
+		_state._vm->_gameMinute % 10, Common::Point(201, 25));
+
+	// AM/PM indicator
+	PictureResource *pic = _state._vm->_bVoy->boltEntry(_state._vm->_voy._isAM ? 272 : 273)._picResource;
+	_state._vm->_graphicsManager.sDrawPic(pic, *_state._vm->_graphicsManager._vPort, 
+		Common::Point(215, 27));
+}
+
 /*------------------------------------------------------------------------*/
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 0a7df28..f25f56f 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -309,6 +309,7 @@ public:
 	void addSaveRect(int pageIndex, const Common::Rect &r);
 	void sFillBox(int width);
 	void fillPic(byte onOff = 0);
+	void drawIfaceTime();
 };
 
 class ViewPortPalEntry  {
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index e774674..3aada4c 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -557,11 +557,11 @@ void ThreadResource::parsePlayCommands() {
 				int count = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._field476 = READ_LE_UINT16(dataP + 4);
 
-				if (_vm->_voy._checkTransitionId != count) {
-					if (_vm->_voy._checkTransitionId > 1)
+				if (_vm->_voy._transitionId != count) {
+					if (_vm->_voy._transitionId > 1)
 						_vm->_voy._field478 &= ~0x100;
 
-					_vm->_voy._checkTransitionId = count;
+					_vm->_voy._transitionId = count;
 					_vm->_gameMinute = LEVEL_M[count - 1];
 					_vm->_gameHour = LEVEL_H[count - 1];
 					//_vm->_v2A0A2 = 0;
@@ -569,7 +569,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._RTANum = 255;
 				}
 
-				_vm->_voy._isAM = (_vm->_voy._checkTransitionId == 6) ? 1 : 0;
+				_vm->_voy._isAM = (_vm->_voy._transitionId == 6) ? 1 : 0;
 			}
 
 			dataP += 6;
@@ -788,7 +788,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 23:
-			_vm->_voy._checkTransitionId = 17;
+			_vm->_voy._transitionId = 17;
 			_vm->_voy._field472 = -1;
 			loadTheApt();
 			_vm->_voy._field472 = 144;
@@ -1158,7 +1158,7 @@ int ThreadResource::doApt() {
 	}
 
 	freeTheApt();
-	if (_vm->_voy._checkTransitionId == 1 && hotspotId == 0)
+	if (_vm->_voy._transitionId == 1 && hotspotId == 0)
 		_vm->checkTransition();
 
 	if (!hotspotId)
@@ -1191,7 +1191,7 @@ int ThreadResource::doInterface() {
 	if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0)
 		_vm->_voy._RTVNum = _vm->_voy._field476 - 1;
 
-	if (_vm->_voy._checkTransitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) {
+	if (_vm->_voy._transitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) {
 		_vm->_voy._RTVNum = _vm->_voy._field476;
 		_vm->makeViewFinder();
 
@@ -1298,16 +1298,16 @@ int ThreadResource::doInterface() {
 
 		if (_vm->_voy._RTVNum & 2) {
 			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-				10 / _vm->_gameMinute, 0x1900BE);
+				10 / _vm->_gameMinute, Common::Point(190, 25));
 			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-				10 % _vm->_gameMinute, 0x1900BE);
+				10 % _vm->_gameMinute, Common::Point(190, 25));
 
 			if (_vm->_voy._RTANum & 4) {
 				int v = 10 / _vm->_gameHour;
 				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-					v == 0 ? 10 : v, 0x1900BE);
+					v == 0 ? 10 : v, Common::Point(190, 25));
 				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-					_vm->_gameHour % 10, 0x1900AC);
+					_vm->_gameHour % 10, Common::Point(172, 25));
 
 				pic = _vm->_bVoy->boltEntry(274)._picResource;
 				_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
@@ -1325,9 +1325,9 @@ int ThreadResource::doInterface() {
 				(_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) {
 			_vm->_eventsManager.getMouseInfo();
 
-			if (_vm->_voy._checkTransitionId == 15) {
+			if (_vm->_voy._transitionId == 15) {
 				var8 = 20;
-				_vm->_voy._checkTransitionId = 17;
+				_vm->_voy._transitionId = 17;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->checkTransition();
 				_vm->_voy._mouseClicked = true;
@@ -1433,7 +1433,7 @@ void ThreadResource::clearButtonFlag(int idx, byte bits) {
 }
 
 void ThreadResource::loadTheApt() {
-	switch (_vm->_voy._checkTransitionId) {
+	switch (_vm->_voy._transitionId) {
 	case 1:
 	case 2:
 	case 5:
@@ -1551,7 +1551,7 @@ void ThreadResource::doAptAnim(int mode) {
 	}
 
 	int id2 = (id == 0x6C00 || id == 0x6F00) ? 1 : 2;
-	switch (_vm->_voy._checkTransitionId) {
+	switch (_vm->_voy._transitionId) {
 	case 3:
 		id += id2 << 8;
 		break;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 25f63a9..dad1d6e 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -553,7 +553,7 @@ error("TODO: var22/var24/var2C not initialised before use?");
 	}
 }
 
-void GraphicsManager::drawANumber(DisplayResource *display, int num, int offset) {
+void GraphicsManager::drawANumber(DisplayResource *display, int num, const Common::Point &pt) {
 	warning("TODO: drawANumber");
 }
 
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 549d05f..1017726 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -104,7 +104,7 @@ public:
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &initialOffset);
 	void fillPic(DisplayResource *display, byte onOff = 0);
 	void sDisplayPic(PictureResource *pic);
-	void drawANumber(DisplayResource *display, int num, int offset);
+	void drawANumber(DisplayResource *display, int num, const Common::Point &pt);
 	void flipPage();
 	void clearPalette();
 	void setPalette(const byte *palette, int start, int count);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 54ff568..52b7272 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -111,7 +111,7 @@ void VoyeurEngine::playStamp() {
 			break;
 
 		case 16:
-			_voy._checkTransitionId = 17;
+			_voy._transitionId = 17;
 			buttonId = threadP->doApt();
 			
 			switch (buttonId) {
@@ -134,7 +134,7 @@ void VoyeurEngine::playStamp() {
 
 		case 17:
 			doTapePlaying();
-			if (!checkForMurder() && _voy._checkTransitionId <= 15)
+			if (!checkForMurder() && _voy._transitionId <= 15)
 				checkForIncriminate();
 
 			if (_voy._videoEventId != -1)
@@ -260,7 +260,58 @@ int VoyeurEngine::getChooseButton()  {
 }
 
 void VoyeurEngine::makeViewFinder() {
-	error("TODO:makeViewFinder");
+	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x103)._picResource;
+	_graphicsManager.sDrawPic(_graphicsManager._backgroundPage, 
+		*_graphicsManager._vPort, Common::Point(0, 0));
+	CMapResource *pal = _bVoy->boltEntry(0x104)._cMapResource;
+
+	int palOffset = 0;
+	switch (_voy._transitionId) {
+	case 1:
+	case 2:
+	case 5:
+	case 6:
+	case 7:
+	case 8:
+	case 9:
+	case 17:
+		palOffset = 0;
+		break;
+	case 3:
+		palOffset = 1;
+		break;
+	case 4:
+	case 10:
+	case 11:
+	case 12:
+	case 13:
+	case 14:
+	case 15:
+	case 16:
+		palOffset = 2;
+		break;
+	default:
+		break;
+	}
+
+	(*_graphicsManager._vPort)->drawIfaceTime();
+	doTimeBar(1);
+	pal->startFade();
+
+	(*_graphicsManager._vPort)->_flags |= 8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+		_eventsManager.delay(1);
+
+	_graphicsManager.setColor(241, 105, 105, 105);
+	_graphicsManager.setColor(242, 105, 105, 105);
+	_graphicsManager.setColor(243, 105, 105, 105);
+	_graphicsManager.setColor(palOffset + 241, 219, 235, 235);
+
+	_eventsManager._intPtr.field38 = 1;
+	_eventsManager._intPtr._hasPalette = true;
 }
 
 void VoyeurEngine::initIFace(){
@@ -270,8 +321,8 @@ void VoyeurEngine::initIFace(){
 void VoyeurEngine::checkTransition(){
 	Common::String time, day;
 
-	if (_voy._checkTransitionId != _checkTransitionId) {
-		switch (_voy._checkTransitionId) {
+	if (_voy._transitionId != _checkTransitionId) {
+		switch (_voy._transitionId) {
 		case 0:
 			break;
 		case 1:
@@ -291,7 +342,7 @@ void VoyeurEngine::checkTransition(){
 		if (!day.empty()) {
 			_graphicsManager.fadeDownICF(6);
 
-			if (_voy._checkTransitionId != 17) {
+			if (_voy._transitionId != 17) {
 				const char *amPm = _voy._isAM ? AM : PM;
 				time = Common::String::format("%d:%02d%s",
 					_gameHour, _gameMinute, amPm);
@@ -301,7 +352,7 @@ void VoyeurEngine::checkTransition(){
 			_eventsManager.delay(180);
 		}
 
-		_checkTransitionId = _voy._checkTransitionId;
+		_checkTransitionId = _voy._transitionId;
 	}
 }
 


Commit: a73ea5c3dc0bfd8c5ad6909fcf74cb51fffe3702
    https://github.com/scummvm/scummvm/commit/a73ea5c3dc0bfd8c5ad6909fcf74cb51fffe3702
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-19T06:25:40-08:00

Commit Message:
VOYEUR: Beginnings of camera spy screen

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 31f6362..6f44806 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -941,8 +941,8 @@ void ViewPortResource::setupViewPort() {
 		&GraphicsManager::restoreMCGASaveRect);
 }
 
-void ViewPortResource::setupViewPort(PictureResource *pic) {
-	setupViewPort(pic, NULL,
+void ViewPortResource::setupViewPort(PictureResource *pic, Common::Rect *clipRect) {
+	setupViewPort(pic, clipRect,
 		&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
 		&GraphicsManager::restoreMCGASaveRect);
 }
@@ -1045,7 +1045,7 @@ int ViewPortResource::drawText(const Common::String &msg) {
 	if (fontInfo._fontFlags & DISPFLAG_1) {
 		gfxManager._drawPtr->_pos = Common::Point(_fontRect.left, _fontRect.top);
 		gfxManager._drawPtr->_penColor = fontInfo._backColor;
-		sFillBox(_fontRect.width());
+		sFillBox(_fontRect.width(), _fontRect.height());
 	}
 
 	bool saveBack = gfxManager._saveBack;
@@ -1160,10 +1160,23 @@ int ViewPortResource::textWidth(const Common::String &msg) {
 
 void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
 	// TODO
+	warning("TODO: addSaveRect");
 }
 
-void ViewPortResource::sFillBox(int width) {
-	// TODO
+void ViewPortResource::sFillBox(int width, int height) {
+	bool saveBack = _state._vm->_graphicsManager._saveBack;
+	_state._vm->_graphicsManager._saveBack = false;
+
+	PictureResource pr;
+	pr._flags = 1;
+	pr._select = 0xff;
+	pr._pick = 0;
+	pr._onOff = _state._vm->_graphicsManager._drawPtr->_penColor;
+	pr._bounds = Common::Rect(0, 0, width, height);
+
+	_state._vm->_graphicsManager.sDrawPic(&pr, this, 
+		_state._vm->_graphicsManager._drawPtr->_pos);
+	_state._vm->_graphicsManager._saveBack = saveBack;
 }
 
 void ViewPortResource::fillPic(byte onOff) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index f25f56f..a48dbaa 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -303,11 +303,11 @@ public:
 	virtual ~ViewPortResource();
 
 	void setupViewPort();
-	void setupViewPort(PictureResource *pic);
+	void setupViewPort(PictureResource *pic, Common::Rect *clipRect = NULL);
 	int drawText(const Common::String &msg);
 	int textWidth(const Common::String &msg);
 	void addSaveRect(int pageIndex, const Common::Rect &r);
-	void sFillBox(int width);
+	void sFillBox(int width, int height);
 	void fillPic(byte onOff = 0);
 	void drawIfaceTime();
 };
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 3aada4c..1692405 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1230,7 +1230,7 @@ int ThreadResource::doInterface() {
 	_vm->_voy._field478 &= ~1;
 
 	do {
-		_vm->doTimeBar(1);
+		_vm->doTimeBar(true);
 		_vm->_eventsManager.getMouseInfo();
 
 		pt = _vm->_eventsManager.getMousePos();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index dad1d6e..185f51b 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -554,7 +554,8 @@ error("TODO: var22/var24/var2C not initialised before use?");
 }
 
 void GraphicsManager::drawANumber(DisplayResource *display, int num, const Common::Point &pt) {
-	warning("TODO: drawANumber");
+	PictureResource *pic = _vm->_bVoy->boltEntry(num + 261)._picResource;
+	sDrawPic(pic, display, pt);
 }
 
 void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
@@ -692,7 +693,44 @@ void GraphicsManager::screenReset() {
 }
 
 void GraphicsManager::doScroll(const Common::Point &pt) {
-	error("TODO: doScroll");
+	Common::Rect clipRect(72, 47, 240, 148);
+	(*_vm->_graphicsManager._vPort)->setupViewPort(NULL, &clipRect);
+
+	PictureResource *pic;
+	int base = 0;
+	switch (_vm->_voy._transitionId) {
+	case 0:
+		break;
+	case 1:
+	case 2:
+	case 5:
+	case 6:
+	case 7:
+	case 8:
+	case 9:
+		base = 0xB00;
+		break;
+	case 3:
+		base = 0xC00;
+		break;
+	default:
+		base = 0xD00;
+	}
+
+	if (base) {
+		pic = _vm->_bVoy->boltEntry(base + 3)._picResource;
+		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y - 104));
+		pic = _vm->_bVoy->boltEntry(base + 4)._picResource;
+		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y - 44));
+		pic = _vm->_bVoy->boltEntry(base + 5)._picResource;
+		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y + 16));
+		pic = _vm->_bVoy->boltEntry(base + 6)._picResource;
+		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y + 76));
+		pic = _vm->_bVoy->boltEntry(base + 7)._picResource;
+		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y + 136));
+	}
+
+	(*_vPort)->setupViewPort();
 }
 
 void GraphicsManager::fadeDownICF1(int steps) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1c8c185..fe27307 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -47,6 +47,9 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_checkTransitionId = -1;
 	_gameHour = 0;
 	_gameMinute = 0;
+	_flashTimeVal = 0;
+	_flashTimeFlag = false;
+	_timeBarVal = -1;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index f35af7d..b18a7c0 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -120,6 +120,9 @@ public:
 	int _checkTransitionId;
 	int _gameHour;
 	int _gameMinute;
+	int _flashTimeVal;
+	bool _flashTimeFlag;
+	int _timeBarVal;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
@@ -149,7 +152,7 @@ public:
 	void makeViewFinder();
 	void initIFace();
 	void checkTransition();
-	void doTimeBar(int v);
+	void doTimeBar(bool force);
 	void flashTimeBar();
 	void checkPhoneCall();
 };
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 52b7272..bdf4ee0 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -295,7 +295,7 @@ void VoyeurEngine::makeViewFinder() {
 	}
 
 	(*_graphicsManager._vPort)->drawIfaceTime();
-	doTimeBar(1);
+	doTimeBar(true);
 	pal->startFade();
 
 	(*_graphicsManager._vPort)->_flags |= 8;
@@ -315,7 +315,40 @@ void VoyeurEngine::makeViewFinder() {
 }
 
 void VoyeurEngine::initIFace(){
-	error("TODO: initIFace");
+	int playStamp1 = _playStamp1;
+	switch (_voy._transitionId) {
+	case 0:
+		break;
+	case 1:
+	case 2:
+	case 5:
+	case 6:
+	case 7:
+	case 8:
+	case 9:
+		_playStamp1 = 0xB00;
+		break;
+	case 3:
+		_playStamp1 = 0xC00;
+		break;
+	default:
+		_playStamp1 = 0xD00;
+		break;
+	}
+	if (playStamp1 != -1)
+		_bVoy->freeBoltGroup(playStamp1, true);
+
+	_bVoy->getBoltGroup(_playStamp1);
+	CMapResource *pal = _bVoy->boltEntry(_playStamp1 + 2)._cMapResource;
+	pal->startFade();
+
+	_graphicsManager.doScroll(_eventsManager.getMousePos());
+	
+	_voy._field4386 = _bVoy->memberAddr(_playStamp1);
+
+	// Note: the original did two loops to preload members here, which is
+	// redundant for ScummVM, since computers are faster these days, and
+	// getting resources as needed will be fast enough.
 }
 
 void VoyeurEngine::checkTransition(){
@@ -356,12 +389,49 @@ void VoyeurEngine::checkTransition(){
 	}
 }
 
-void VoyeurEngine::doTimeBar(int v) {
-	error("TODO: doTimeBar");
+void VoyeurEngine::doTimeBar(bool force) {
+	flashTimeBar();
+
+	if ((force || _timeBarVal != _voy._RTVNum) && _voy._field476 > 0) {
+		if (_voy._RTVNum > _voy._field476 || _voy._RTVNum < 0)
+			_voy._RTVNum = _voy._field476 - 1;
+		
+		_timeBarVal = _voy._RTVNum;
+		int height = ((_voy._field476 - _voy._RTVNum) * 59) / _voy._field476;
+		int fullHeight = MAX(151 - height, 93);
+
+		_graphicsManager._drawPtr->_penColor = 134;
+		_graphicsManager._drawPtr->_pos = Common::Point(39, 92);
+
+		(*_graphicsManager._vPort)->sFillBox(6, fullHeight - 92);
+		if (height > 0) {
+			_graphicsManager.setColor(215, 238, 238, 238);
+			_eventsManager._intPtr.field38 = 1;
+			_eventsManager._intPtr._hasPalette = true;
+
+			_graphicsManager._drawPtr->_penColor = 215;
+			_graphicsManager._drawPtr->_pos = Common::Point(39, fullHeight);
+			(*_graphicsManager._vPort)->sFillBox(6, height);
+		}
+	}
 }
 
 void VoyeurEngine::flashTimeBar(){
-	error("TODO: flashTimeBar");
+	if (_voy._RTVNum >= 0 && (_voy._field476 - _voy._RTVNum) < 11 &&
+		(_eventsManager._intPtr.field1A >= (_flashTimeVal + 15) ||
+		_eventsManager._intPtr.field1A < _flashTimeVal)) {
+		// Within time range
+		_flashTimeVal = _eventsManager._intPtr.field1A;
+
+		if (_flashTimeFlag)
+			_graphicsManager.setColor(240, 220, 20, 20);
+		else
+			_graphicsManager.setColor(240, 220, 220, 220);
+		
+		_eventsManager._intPtr.field38 = 1;
+		_eventsManager._intPtr._hasPalette = true;
+		_flashTimeFlag = !_flashTimeFlag;
+	}
 }
 
 void VoyeurEngine::checkPhoneCall() {


Commit: 171d1594899e7064f2ebbbafd0f7b7858aaa2444
    https://github.com/scummvm/scummvm/commit/171d1594899e7064f2ebbbafd0f7b7858aaa2444
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-20T19:51:31-08:00

Commit Message:
VOYEUR: Implemented doRoom method

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index e575539..b28acfb 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -418,6 +418,10 @@ void EventsManager::mouseOff() {
 	CursorMan.showMouse(false);
 }
 
+void EventsManager::hideCursor() {
+	error("TODO: hideCursor");
+}
+
 void EventsManager::getMouseInfo() {
 	if (_vm->_voy._field478 & 0x10) {
 		if ((_gameCounter - _joe) > 8) {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 0db1281..494b90d 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -85,6 +85,10 @@ public:
 	int _field476;
 	int _field478;
 	int _field47A;
+	int _field4AC;
+	int _field4AE[5];
+	int _field4B8;
+
 	int _field4E2;
 	Common::Rect _rect4E4;
 	int _field4EC;
@@ -216,6 +220,7 @@ public:
 	void setCursorColor(int idx, int mode);
 	void mouseOn();
 	void mouseOff();
+	void hideCursor();
 	Common::Point getMousePos() { return _mousePos; }
 	void getMouseInfo();
 	void checkForKey();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 1692405..ef6022a 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1168,7 +1168,210 @@ int ThreadResource::doApt() {
 }
 
 void ThreadResource::doRoom() {
-	warning("TODO: doRoom");
+	VoyeurEngine &vm = *_vm;
+	SVoy &voy = vm._voy;
+
+	vm.makeViewFinderP();
+	voy._field437E = 0;
+	int varE = 0;
+	
+	if (!vm._bVoy->getBoltGroup(vm._playStamp1, true))
+		return;
+
+	vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStamp1 + 1)._cMapResource;
+	vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStamp1)._picResource;
+	(*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage);
+	vm._graphicsManager._backColors->startFade();
+
+	voy._field437A = 2;
+	voy._field437C = 0;
+	voy._field437E = 1;
+	
+	byte *dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4);
+	int count = READ_LE_UINT16(dataP);
+	int i4e4 = -1;
+
+	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
+	PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
+
+	byte arr[10];
+	strcpy((char *)&arr[0], "0");
+	voy._field4386 = &arr[0];
+
+	vm._eventsManager.getMouseInfo();
+	vm._eventsManager.setMousePos(Common::Point(192, 120));
+	voy._field437E = 0;
+	vm._playStamp2 = 146;
+	voy._field4AC = voy._RTVNum;
+
+	voy._vocSecondsOffset = 0;
+	vm._soundManager.startVOCPlay(vm._playStamp2);
+	voy._field478 &= ~1;
+
+	bool breakFlag = false;
+	while (!breakFlag) {
+		vm._graphicsManager.setColor(128, 0, 255, 0);
+		vm._eventsManager._intPtr.field38 = 1;
+		vm._eventsManager._intPtr._hasPalette = true;
+
+		do {
+			if (vm._playStamp2 != -1 && !vm._soundManager.getVOCStatus()) {
+				voy._field4AC = voy._RTVNum;
+				voy._vocSecondsOffset = 0;
+				vm._soundManager.startVOCPlay(vm._playStamp2);
+			}
+
+			vm._eventsManager.getMouseInfo();
+			Common::Point pt = vm._eventsManager.getMousePos();
+			i4e4 = -1;
+			if (voy._field4E2 != -1 && voy._rect4E4.contains(pt))
+				i4e4 = 999;
+
+			for (int idx = 0; idx < count; ++idx) {
+				if (pt.x > READ_LE_UINT16(dataP + idx * 12 + 6) &&
+						pt.x < READ_LE_UINT16(dataP + idx * 12 + 10) &&
+						pt.y > READ_LE_UINT16(dataP + idx * 12 + 8) &&
+						pt.y < READ_LE_UINT16(dataP + idx * 12 + 12)) {
+					int arrIndex = READ_LE_UINT16(dataP + idx * 12 + 2);
+					if (voy._arr7[arrIndex - 1] == 1) {
+						i4e4 = idx;
+						break;
+					}
+				}
+			}
+
+			if (i4e4 == -1) {
+				vm._graphicsManager.sDrawPic(pic1, *vm._graphicsManager._vPort,
+					Common::Point(pt.x - 9, pt.y - 9));
+				vm._eventsManager.setCursorColor(128, 0);
+			} else if (i4e4 != 999 || voy._RTVNum < voy._field4EC ||
+					(voy._field4EE - 2) < voy._RTVNum) {
+				vm._graphicsManager.sDrawPic(pic2, *vm._graphicsManager._vPort,
+					Common::Point(pt.x - 12, pt.y - 9));
+				vm._eventsManager.setCursorColor(128, 1);
+			} else {
+				vm._graphicsManager.sDrawPic(pic2, 
+					*vm._graphicsManager._vPort,
+					Common::Point(pt.x - 12, pt.y - 9));
+				vm._eventsManager.setCursorColor(128, 2);
+			}
+
+			vm._eventsManager._intPtr.field38 = 1;
+			vm._eventsManager._intPtr._hasPalette = true;
+			vm._graphicsManager.flipPage();
+			vm._eventsManager.sWaitFlip();
+		} while (!vm.shouldQuit() && !voy._incriminate);
+
+		if (!voy._mouseClicked || i4e4 == -1) {
+			if (voy._fadeFunc)
+				breakFlag = true;
+
+			Common::Point pt = vm._eventsManager.getMousePos();
+			vm._eventsManager.getMouseInfo();
+			vm._eventsManager.setMousePos(pt);
+		} else {
+			voy._field478 |= 16;
+			vm._eventsManager.startCursorBlink();
+
+			if (i4e4 == 999) {
+				(*_vm->_graphicsManager._vPort)->_flags |= 8;
+				_vm->_graphicsManager.flipPage();
+				_vm->_eventsManager.sWaitFlip();
+
+				if (vm._playStamp2 != -1) {
+					voy._vocSecondsOffset = voy._RTVNum - 
+						voy._field4AC;
+					vm._soundManager.stopVOCPlay();
+				}
+
+				vm.getComputerBrush();
+
+				(*vm._graphicsManager._vPort)->_flags |= 8;
+				vm._graphicsManager.flipPage();
+				vm._eventsManager.sWaitFlip();
+				vm.addPlainEvent();
+
+				voy._incriminate = false;
+				vm._eventsManager.startCursorBlink();
+
+				if (vm.doComputerText(9999))
+					vm.addComputerEventEnd();
+
+				vm._bVoy->freeBoltGroup(0x4900);
+			} else {
+				vm.doEvidDisplay(i4e4, 999);
+			}
+
+			voy._field478 &= ~0x10;
+			if (!voy._incriminate)
+				vm._eventsManager.delay(18000);
+
+			vm._bVoy->freeBoltGroup(vm._playStamp1);
+			vm._bVoy->getBoltGroup(vm._playStamp1);
+			dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4);
+			pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
+			pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
+			vm._graphicsManager._backColors = vm._bVoy->boltEntry(
+				vm._playStamp1 + 2)._cMapResource;
+			vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(
+				vm._playStamp1)._picResource;
+
+			vm._graphicsManager._backColors->startFade();
+			(*vm._graphicsManager._vPort)->_flags |= 8;
+			vm._graphicsManager.flipPage();
+			vm._eventsManager.sWaitFlip();
+
+			while (!vm.shouldQuit() && (vm._eventsManager._fadeStatus & 1))
+				vm._eventsManager.delay(1);
+			vm._eventsManager.hideCursor();
+
+			while (!vm.shouldQuit() && voy._field4378 > 0) {
+				if (voy._field4376 < 63) {
+					voy._field4376 += 4;
+					if (voy._field4376 > 63)
+						voy._field4376 = 63;
+				}
+
+				if (voy._field4378 > 0) {
+					voy._field4378 -= 8;
+					if (voy._field4378 < 0)
+						voy._field4378 = 0;
+				}
+
+				vm._eventsManager.delay(1);
+			}
+
+			(*vm._graphicsManager._vPort)->_flags |= 8;
+			vm._graphicsManager.flipPage();
+			vm._eventsManager.sWaitFlip();
+
+			vm._graphicsManager.fadeUpICF1(0);
+			voy._field478 &= 0x10;
+		}
+	}
+
+	voy._field478 = 1;
+	vm._eventsManager.incrementTime(1);
+	voy._field4386 = 0;
+	voy._field437E = 0;
+	vm.makeViewFinderP();
+
+	if (voy._field47A != -1) {
+		vm._bVoy->freeBoltGroup(voy._field47A, 1);
+		voy._field47A = -1;
+	}
+
+	if (vm._playStamp1 != -1) {
+		vm._bVoy->freeBoltGroup(vm._playStamp1);
+		vm._playStamp1 = -1;
+	}
+
+	if (vm._playStamp2 != -1) {
+		vm._soundManager.stopVOCPlay();
+		vm._playStamp2 = -1;
+	}
+
+	chooseSTAMPButton(0);
 }
 
 int ThreadResource::doInterface() {
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index 1cd0cf3..e53716a 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -75,6 +75,10 @@ void SoundManager::startVOCPlay(const Common::String &filename) {
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream);
 }
 
+void SoundManager::startVOCPlay(int soundId) {
+	startVOCPlay(getVOCFileName(soundId));
+}
+
 int SoundManager::getVOCStatus() {
 	return _mixer->isSoundHandleActive(_soundHandle);
 }
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 6de9804..a73bd4a 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -48,6 +48,7 @@ public:
 	void setVOCOffset(int offset);
 	Common::String getVOCFileName(int idx);
 	void startVOCPlay(const Common::String &filename);
+	void startVOCPlay(int soundId);
 	int getVOCStatus();
 };
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index fe27307..53698b2 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -50,6 +50,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_flashTimeVal = 0;
 	_flashTimeFlag = false;
 	_timeBarVal = -1;
+	_checkPhoneVal = 0;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index b18a7c0..31f05fb 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -74,7 +74,6 @@ private:
 	void initBolt();
 	void vInitInterrupts();
 	void initInput();
-	void addVideoEventStart();
 
 	bool doHeadTitle();
 	void showConversionScreen();
@@ -123,6 +122,7 @@ public:
 	int _flashTimeVal;
 	bool _flashTimeFlag;
 	int _timeBarVal;
+	int _checkPhoneVal;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
@@ -150,11 +150,19 @@ public:
 	 */
 	void saveLastInplay();
 	void makeViewFinder();
+	void makeViewFinderP();
 	void initIFace();
 	void checkTransition();
+	bool doComputerText(int v);
+	void getComputerBrush();
 	void doTimeBar(bool force);
 	void flashTimeBar();
 	void checkPhoneCall();
+	void doEvidDisplay(int v1, int v2);
+
+	void addVideoEventStart();
+	void addComputerEventEnd();
+	void addPlainEvent();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index bdf4ee0..8ebb2c2 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -35,6 +35,14 @@ void VoyeurEngine::addVideoEventStart() {
 	e._dead = _eventsManager._videoDead;
 }
 
+void VoyeurEngine::addComputerEventEnd() {
+	error("TODO: addComputerEventEnd");
+}
+
+void VoyeurEngine::addPlainEvent() {
+	error("TODO: addPlainEvent");
+}
+
 void VoyeurEngine::playStamp() {
 	_stampLibPtr = NULL;
 	_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
@@ -314,6 +322,10 @@ void VoyeurEngine::makeViewFinder() {
 	_eventsManager._intPtr._hasPalette = true;
 }
 
+void VoyeurEngine::makeViewFinderP() {
+	_graphicsManager.screenReset();
+}
+
 void VoyeurEngine::initIFace(){
 	int playStamp1 = _playStamp1;
 	switch (_voy._transitionId) {
@@ -389,6 +401,14 @@ void VoyeurEngine::checkTransition(){
 	}
 }
 
+bool VoyeurEngine::doComputerText(int v) {
+	error("TODO: doComputerText");
+}
+
+void VoyeurEngine::getComputerBrush() {
+	error("TODO: getComputerBrush");
+}
+
 void VoyeurEngine::doTimeBar(bool force) {
 	flashTimeBar();
 
@@ -435,7 +455,27 @@ void VoyeurEngine::flashTimeBar(){
 }
 
 void VoyeurEngine::checkPhoneCall() {
-	error("TODO: checkPhoneCall");
+	if ((_voy._field476 - _voy._RTVNum) >= 36 && _voy._field4B8 < 5 && 
+			_playStamp2 <= 151 && _playStamp2 > 146) {
+		if ((_voy._switchBGNum < _checkPhoneVal || _checkPhoneVal > 180) &&
+				!_soundManager.getVOCStatus()) {
+			int soundIndex;
+			do {
+				soundIndex = getRandomNumber(4);
+			} while (_voy._field4AE[soundIndex]);
+			_playStamp2 = 154 + soundIndex;
+
+			_soundManager.stopVOCPlay();
+			_soundManager.startVOCPlay(_playStamp2);
+			_checkPhoneVal = _voy._switchBGNum;
+			++_voy._field4AE[soundIndex];
+			++_voy._field4B8;
+		}
+	}
+}
+
+void VoyeurEngine::doEvidDisplay(int v1, int v2) {
+	error("TODO: doEvidDisplay");
 }
 
 } // End of namespace Voyeur


Commit: 537ec24e1ee3d7c9e4dd082d2ebec5e6880a869f
    https://github.com/scummvm/scummvm/commit/537ec24e1ee3d7c9e4dd082d2ebec5e6880a869f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-20T20:03:17-08:00

Commit Message:
VOYEUR: Renamed a couple of event fields

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index b28acfb..eb793d3 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -44,12 +44,12 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 
 /*------------------------------------------------------------------------*/
 
-VoyeurEvent::VoyeurEvent(int v1, int v2, int v3, int v4, int v5, int v6, int v7) {
-	_computerNum = v1;
-	_computerBut[0] = v2;
-	_computerBut[1] = v3;
-	_computerBut[2] = v4;
-	_computerBut[3] = v5;
+VoyeurEvent::VoyeurEvent(int hour, int minute, bool isAM, int v4, int v5, int v6, int v7) {
+	_hour = hour;
+	_minute = minute;
+	_isAM = isAM;
+	_field6 = v4;
+	_field8 = v5;
 	_computerOn = v6;
 	_dead = v7;
 }
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 494b90d..c837748 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -52,13 +52,16 @@ public:
 
 class VoyeurEvent {
 public:
-	int _computerNum;
-	int _computerBut[4];
+	int _hour;
+	int _minute;
+	bool _isAM;
+	int _field6;
+	int _field8;
 	int _computerOn;
 	int _computerOff;
 	int _dead;
 public:
-	VoyeurEvent(int v1, int v2, int v3, int v4, int v5, int v6, int v7);
+	VoyeurEvent(int hour, int minute, bool isAM, int v4, int v5, int v6, int v7);
 };
 
 class SVoy {
@@ -95,6 +98,9 @@ public:
 	int _field4EE;
 	int _field4F0;
 	int _field4F2;
+	int _eventCount;
+	Common::Array<VoyeurEvent> _events;
+
 
 	int _timeStart;
 	int _duration;
@@ -113,7 +119,6 @@ public:
 	int _numPhonesUsed;
 	int _evidence[20];
 	
-	Common::Array<VoyeurEvent> _events;
 	int _field4376;
 	int _field4378;
 	int _field437A;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index ef6022a..229d4c3 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1170,10 +1170,9 @@ int ThreadResource::doApt() {
 void ThreadResource::doRoom() {
 	VoyeurEngine &vm = *_vm;
 	SVoy &voy = vm._voy;
-
+	
 	vm.makeViewFinderP();
 	voy._field437E = 0;
-	int varE = 0;
 	
 	if (!vm._bVoy->getBoltGroup(vm._playStamp1, true))
 		return;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 8ebb2c2..41a657f 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -26,12 +26,12 @@
 namespace Voyeur {
 
 void VoyeurEngine::addVideoEventStart() {
-	VoyeurEvent &e = _voy._events[_voy._evidence[19]];
-	e._computerNum = _gameHour;
-	e._computerBut[0] = _gameMinute;
-	e._computerBut[1] = _voy._isAM;
-	e._computerBut[2] = 1;
-	e._computerBut[3] = _eventsManager._videoComputerBut4;
+	VoyeurEvent &e = _voy._events[_voy._eventCount];
+	e._hour = _gameHour;
+	e._minute = _gameMinute;
+	e._isAM = _voy._isAM;
+	e._field6 = 1;
+	e._field8 = _eventsManager._videoComputerBut4;
 	e._dead = _eventsManager._videoDead;
 }
 


Commit: 2fe3902dc923ae7219c25e9988b25c0cae6dd4e4
    https://github.com/scummvm/scummvm/commit/2fe3902dc923ae7219c25e9988b25c0cae6dd4e4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-21T08:52:53-08:00

Commit Message:
VOYEUR: Fix to start doInterface after doApt

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 41a657f..b56f2c7 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -112,6 +112,8 @@ void VoyeurEngine::playStamp() {
 			} else {
 				threadP->chooseSTAMPButton(buttonId);
 			}
+
+			flag = true;
 			break;
 
 		case 6:


Commit: 4f9c900a039c2be64847720122382ef11090df2d
    https://github.com/scummvm/scummvm/commit/4f9c900a039c2be64847720122382ef11090df2d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-23T12:38:39-08:00

Commit Message:
VOYEUR: Fixes for video camera battery countdown

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index eb793d3..6d38dc4 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -104,7 +104,12 @@ void EventsManager::startMainClockInt() {
 }
 
 void EventsManager::mainVoyeurIntFunc() {
-	// TODO
+	if (!(_vm->_voy._field478 & 1)) {
+		++_vm->_voy._switchBGNum;
+		++_vm->_voy._RTVNum;
+		if (_vm->_voy._RTVNum >= _vm->_voy._field4F2)
+			_vm->_voy._field4F0 = 1;
+	}
 }
 
 void EventsManager::vStopCycle() {
@@ -147,6 +152,9 @@ void EventsManager::checkForNextFrameCounter() {
 		// Run the timer-based updates
 		voyeurTimer();
 
+		if ((_gameCounter % GAME_FRAME_RATE) == 0)
+			mainVoyeurIntFunc();
+
 		// Display the frame
 		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.getPixels(), 
 			SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -193,6 +201,7 @@ void EventsManager::voyeurTimer() {
 
 		(this->*node._intFunc)();
 	}
+
 }
 
 void EventsManager::videoTimer() {
@@ -423,6 +432,8 @@ void EventsManager::hideCursor() {
 }
 
 void EventsManager::getMouseInfo() {
+	pollEvents();
+
 	if (_vm->_voy._field478 & 0x10) {
 		if ((_gameCounter - _joe) > 8) {
 			_joe = _gameCounter;
@@ -454,7 +465,8 @@ void EventsManager::startCursorBlink() {
 }
 
 void EventsManager::incrementTime(int amt) {
-	error("TODO: incrementTime");
+	for (int i = 0; i < amt; ++i)
+		mainVoyeurIntFunc();
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index a48dbaa..61c910b 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -456,8 +456,20 @@ private:
 	void savePrevious();
 	void setButtonFlag(int idx, byte bits);
 	void clearButtonFlag(int idx, byte bits);
+
+	/**
+	 * Loads data needed for displaying the initial apartment screen
+	 */
 	void loadTheApt();
+
+	/**
+	 * Frees the apartment screen data
+	 */
 	void freeTheApt();
+
+	/**
+	 * Does any necessary animation at the start or end of showing the apartment.
+	 */
 	void doAptAnim(int mode);
 public:
 	VoyeurEngine *_vm;
@@ -495,7 +507,12 @@ public:
 	void parsePlayCommands();
 	int doInterface();
 	void doRoom();
+
+	/**
+	 * Shows the apartment screen
+	 */
 	int doApt();
+
 	void doTapePlaying();
 	void checkForMurder();
 	void checkForIncriminate();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 229d4c3..be35143 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1208,7 +1208,7 @@ void ThreadResource::doRoom() {
 	voy._field478 &= ~1;
 
 	bool breakFlag = false;
-	while (!breakFlag) {
+	while (!vm.shouldQuit() && !breakFlag) {
 		vm._graphicsManager.setColor(128, 0, 255, 0);
 		vm._eventsManager._intPtr.field38 = 1;
 		vm._eventsManager._intPtr._hasPalette = true;
@@ -1374,8 +1374,6 @@ void ThreadResource::doRoom() {
 }
 
 int ThreadResource::doInterface() {
-	int varA = -1;
-	int var8 = 0;
 	PictureResource *pic;
 	Common::Point pt;
 
@@ -1431,13 +1429,15 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager._intPtr._hasPalette = true;
 	_vm->_voy._field478 &= ~1;
 
+	int priorRegionIndex = -1;
+	int regionIndex = 0;
 	do {
 		_vm->doTimeBar(true);
 		_vm->_eventsManager.getMouseInfo();
 
 		pt = _vm->_eventsManager.getMousePos();
-		if (pt.x != _currentMouseX || pt.y != _currentMouseY || var8 != varA) {
-			varA = var8;
+		if (pt.x != _currentMouseX || pt.y != _currentMouseY || regionIndex != priorRegionIndex) {
+			priorRegionIndex = regionIndex;
 			_vm->_graphicsManager.doScroll(pt);
 
 			_currentMouseX = pt.x;
@@ -1451,6 +1451,7 @@ int ThreadResource::doInterface() {
 		}
 
 		pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75);
+		regionIndex = -1;
 
 		for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) {
 			if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x &&
@@ -1465,7 +1466,7 @@ int ThreadResource::doInterface() {
 						pic = _vm->_bVoy->boltEntry(276)._picResource;
 						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
 							Common::Point(178, 108));
-						var8 = idx;
+						regionIndex = idx;
 					}
 
 					if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum &&
@@ -1474,44 +1475,45 @@ int ThreadResource::doInterface() {
 						pic = _vm->_bVoy->boltEntry(277)._picResource;
 						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
 							Common::Point(178, 108));
-						var8 = idx;
+						regionIndex = idx;
 					}
 				}
 
-				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
+				for (int arrIndex = 0; arrIndex < 8; ++arrIndex) {
 					if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) {
 						// Draw the picture
 						pic = _vm->_bVoy->boltEntry(375)._picResource;
 						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
 							Common::Point(178, 108));
-						var8 = idx;
+						regionIndex = idx;
 					}
 				}
 			}
 		}
 
-		if (var8 == -1) {
-			// Draw the default picture
+		if (regionIndex == -1) {
+			// Draw the crosshairs cursor in the center of the screen
 			pic = _vm->_bVoy->boltEntry(274)._picResource;
 			_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
 				Common::Point(178, 108));
 		}
 
-		if (_vm->_voy._RTVNum & 2) {
+		// Regularly update the time display
+		if (_vm->_voy._RTANum & 2) {
 			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-				10 / _vm->_gameMinute, Common::Point(190, 25));
+				_vm->_gameMinute / 10, Common::Point(190, 25));
 			_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-				10 % _vm->_gameMinute, Common::Point(190, 25));
+				_vm->_gameMinute % 10, Common::Point(201, 25));
 
 			if (_vm->_voy._RTANum & 4) {
-				int v = 10 / _vm->_gameHour;
+				int v = _vm->_gameHour / 10;
 				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
-					v == 0 ? 10 : v, Common::Point(190, 25));
+					v == 0 ? 10 : v, Common::Point(161, 25));
 				_vm->_graphicsManager.drawANumber(*_vm->_graphicsManager._vPort, 
 					_vm->_gameHour % 10, Common::Point(172, 25));
 
-				pic = _vm->_bVoy->boltEntry(274)._picResource;
+				pic = _vm->_bVoy->boltEntry(_vm->_voy._isAM ? 272 : 273)._picResource;
 				_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
 					Common::Point(215, 27));
 			}
@@ -1528,7 +1530,7 @@ int ThreadResource::doInterface() {
 			_vm->_eventsManager.getMouseInfo();
 
 			if (_vm->_voy._transitionId == 15) {
-				var8 = 20;
+				regionIndex = 20;
 				_vm->_voy._transitionId = 17;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->checkTransition();
@@ -1556,14 +1558,14 @@ int ThreadResource::doInterface() {
 			}
 		}
 	} while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && 
-		(!_vm->_voy._mouseClicked || var8 == -1));
+		(!_vm->_voy._mouseClicked || regionIndex == -1));
 
 	_vm->_voy._field478 |= 1;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
 	if (_vm->_playStamp2 != -1)
 		_vm->_soundManager.stopVOCPlay();
 
-	return !_vm->_voy._fadeFunc ? var8 : -2;
+	return !_vm->_voy._fadeFunc ? regionIndex : -2;
 }
 
 void ThreadResource::addAudioEventStart() {
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 31f05fb..a48f9c2 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -155,7 +155,15 @@ public:
 	void checkTransition();
 	bool doComputerText(int v);
 	void getComputerBrush();
+
+	/**
+	 * Displays the time/charge remaining on the video camera screen
+	 */
 	void doTimeBar(bool force);
+
+	/**
+	 * If necessary, flashes the time remaining bar on the video camera screen
+	 */
 	void flashTimeBar();
 	void checkPhoneCall();
 	void doEvidDisplay(int v1, int v2);


Commit: 1af5a3b1b4174c2238b6d7ab81600eefe929dc9c
    https://github.com/scummvm/scummvm/commit/1af5a3b1b4174c2238b6d7ab81600eefe929dc9c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-23T14:50:42-08:00

Commit Message:
VOYEUR: Fix for setting up viewport clipping rect

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 6f44806..9dff1f0 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -916,7 +916,7 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRe
 		}
 		
 		xDiff = r.right - clipRect->right;
-		yDiff = r.right - clipRect->right;
+		yDiff = r.bottom - clipRect->bottom;
 
 		if (xDiff > 0)
 			r.setWidth(xDiff <= r.width() ? r.width() - xDiff : 0);


Commit: 156f78e7cdb4c49b437c378d7239806784bcee54
    https://github.com/scummvm/scummvm/commit/156f78e7cdb4c49b437c378d7239806784bcee54
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-23T15:32:41-08:00

Commit Message:
VOYEUR: Bugfixes and move for doScroll method

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 61c910b..aa03383 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -505,6 +505,10 @@ public:
 
 	bool chooseSTAMPButton(int buttonId);
 	void parsePlayCommands();
+
+	/**
+	 * Do the camera view looking at the mansion
+	 */
 	int doInterface();
 	void doRoom();
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index be35143..4432d7e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1438,7 +1438,7 @@ int ThreadResource::doInterface() {
 		pt = _vm->_eventsManager.getMousePos();
 		if (pt.x != _currentMouseX || pt.y != _currentMouseY || regionIndex != priorRegionIndex) {
 			priorRegionIndex = regionIndex;
-			_vm->_graphicsManager.doScroll(pt);
+			_vm->doScroll(pt);
 
 			_currentMouseX = pt.x;
 			_currentMouseY = pt.y;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 185f51b..a62a912 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -692,47 +692,6 @@ void GraphicsManager::screenReset() {
 	_vm->_eventsManager.sWaitFlip();
 }
 
-void GraphicsManager::doScroll(const Common::Point &pt) {
-	Common::Rect clipRect(72, 47, 240, 148);
-	(*_vm->_graphicsManager._vPort)->setupViewPort(NULL, &clipRect);
-
-	PictureResource *pic;
-	int base = 0;
-	switch (_vm->_voy._transitionId) {
-	case 0:
-		break;
-	case 1:
-	case 2:
-	case 5:
-	case 6:
-	case 7:
-	case 8:
-	case 9:
-		base = 0xB00;
-		break;
-	case 3:
-		base = 0xC00;
-		break;
-	default:
-		base = 0xD00;
-	}
-
-	if (base) {
-		pic = _vm->_bVoy->boltEntry(base + 3)._picResource;
-		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y - 104));
-		pic = _vm->_bVoy->boltEntry(base + 4)._picResource;
-		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y - 44));
-		pic = _vm->_bVoy->boltEntry(base + 5)._picResource;
-		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y + 16));
-		pic = _vm->_bVoy->boltEntry(base + 6)._picResource;
-		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y + 76));
-		pic = _vm->_bVoy->boltEntry(base + 7)._picResource;
-		sDrawPic(pic, *_vPort, Common::Point(784 - pt.x + 712, 150 - pt.y + 136));
-	}
-
-	(*_vPort)->setupViewPort();
-}
-
 void GraphicsManager::fadeDownICF1(int steps) {
 	if (steps > 0) {
 		int stepAmount = _vm->_voy._field4378 / steps;
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 1017726..3bfef0e 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -112,7 +112,6 @@ public:
 	void setColor(int idx, byte r, byte g, byte b);
 	void setOneColor(int idx, byte r, byte g, byte b);
 	void screenReset();
-	void doScroll(const Common::Point &pt);
 	void fadeDownICF1(int steps);
 	void fadeUpICF1(int steps);
 	void fadeDownICF(int steps);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index a48f9c2..0da5058 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -165,6 +165,12 @@ public:
 	 * If necessary, flashes the time remaining bar on the video camera screen
 	 */
 	void flashTimeBar();
+
+	/**
+	 * Handle scrolling of the mansion view in the camera sights
+	 */
+	void doScroll(const Common::Point &pt);
+
 	void checkPhoneCall();
 	void doEvidDisplay(int v1, int v2);
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index b56f2c7..1a6c2d1 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -356,7 +356,7 @@ void VoyeurEngine::initIFace(){
 	CMapResource *pal = _bVoy->boltEntry(_playStamp1 + 2)._cMapResource;
 	pal->startFade();
 
-	_graphicsManager.doScroll(_eventsManager.getMousePos());
+	doScroll(_eventsManager.getMousePos());
 	
 	_voy._field4386 = _bVoy->memberAddr(_playStamp1);
 
@@ -365,6 +365,47 @@ void VoyeurEngine::initIFace(){
 	// getting resources as needed will be fast enough.
 }
 
+void VoyeurEngine::doScroll(const Common::Point &pt) {
+	Common::Rect clipRect(72, 47, 72 + 240, 47 + 148);
+	(*_graphicsManager._vPort)->setupViewPort(NULL, &clipRect);
+
+	PictureResource *pic;
+	int base = 0;
+	switch (_voy._transitionId) {
+	case 0:
+		break;
+	case 1:
+	case 2:
+	case 5:
+	case 6:
+	case 7:
+	case 8:
+	case 9:
+		base = 0xB00;
+		break;
+	case 3:
+		base = 0xC00;
+		break;
+	default:
+		base = 0xD00;
+	}
+
+	if (base) {
+		pic = _bVoy->boltEntry(base + 3)._picResource;
+ 		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 104));
+		pic = _bVoy->boltEntry(base + 4)._picResource;
+		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 44));
+		pic = _bVoy->boltEntry(base + 5)._picResource;
+		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 16));
+		pic = _bVoy->boltEntry(base + 6)._picResource;
+		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 76));
+		pic = _bVoy->boltEntry(base + 7)._picResource;
+		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 136));
+	}
+
+	(*_graphicsManager._vPort)->setupViewPort();
+}
+
 void VoyeurEngine::checkTransition(){
 	Common::String time, day;
 


Commit: fa6eb76d6607608edc2415a827aac787915ca11f
    https://github.com/scummvm/scummvm/commit/fa6eb76d6607608edc2415a827aac787915ca11f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-23T21:32:50-08:00

Commit Message:
VOYEUR: Implemented further event methods, and miscellaneous

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 6d38dc4..1139b95 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -44,19 +44,6 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 
 /*------------------------------------------------------------------------*/
 
-VoyeurEvent::VoyeurEvent(int hour, int minute, bool isAM, int v4, int v5, int v6, int v7) {
-	_hour = hour;
-	_minute = minute;
-	_isAM = isAM;
-	_field6 = v4;
-	_field8 = v5;
-	_computerOn = v6;
-	_dead = v7;
-}
-
-
-/*------------------------------------------------------------------------*/
-
 IntData::IntData() {
 	_field9 = false;
 	_flipWait = false;
@@ -469,4 +456,76 @@ void EventsManager::incrementTime(int amt) {
 		mainVoyeurIntFunc();
 }
 
+void EventsManager::addVideoEventStart() {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _vm->_voy._isAM;
+	e._type = EVTYPE_VIDEO;
+	e._field8 = _vm->_eventsManager._videoComputerBut4;
+	e._computerOn = _vm->_voy._vocSecondsOffset;
+	e._dead = _vm->_eventsManager._videoDead;
+}
+
+void EventsManager::addVideoEventEnd() {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset;
+	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+		++_vm->_voy._eventCount;
+}
+
+void EventsManager::addAudioEventStart() {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _vm->_voy._isAM;
+	e._type = EVTYPE_AUDIO;
+	e._field8 = _vm->_eventsManager._videoComputerBut4;
+	e._computerOn = _vm->_voy._field47A;
+	e._dead = _vm->_eventsManager._videoDead;
+}
+
+void EventsManager::addAudioEventEnd() {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset;
+	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+		++_vm->_voy._eventCount;
+}
+
+void EventsManager::addEvidEventStart(int v) {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _vm->_voy._isAM;
+	e._type = EVTYPE_EVID;
+	e._field8 = _vm->_eventsManager._videoComputerBut4;
+	e._computerOn = _vm->_voy._vocSecondsOffset;
+	e._dead = _vm->_eventsManager._videoDead;
+
+}
+
+void EventsManager::addEvidEventEnd(int dead) {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._dead = dead;
+	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+		++_vm->_voy._eventCount;
+}
+
+void EventsManager::addComputerEventStart() {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _vm->_voy._isAM;
+	e._type = EVTYPE_COMPUTER;
+	e._field8 = _vm->_playStamp1;
+	e._computerOn = _vm->_voy._computerTextId;
+}
+
+void EventsManager::addComputerEventEnd(int v) {
+	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+	e._computerOff = v;
+	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+		++_vm->_voy._eventCount;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index c837748..c7d8910 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -36,6 +36,7 @@ class CMapResource;
 
 #define GAME_FRAME_RATE 50
 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
+#define TOTAL_EVENTS 1000
 
 typedef void (EventsManager::*EventMethodPtr)();
  
@@ -50,18 +51,18 @@ public:
 	IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
 };
 
-class VoyeurEvent {
-public:
+enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
+	EVTYPE_COMPUTER = 4 };
+
+struct VoyeurEvent {
 	int _hour;
 	int _minute;
 	bool _isAM;
-	int _field6;
+	VoyeurEventType _type;
 	int _field8;
 	int _computerOn;
 	int _computerOff;
 	int _dead;
-public:
-	VoyeurEvent(int hour, int minute, bool isAM, int v4, int v5, int v6, int v7);
 };
 
 class SVoy {
@@ -92,15 +93,14 @@ public:
 	int _field4AE[5];
 	int _field4B8;
 
-	int _field4E2;
+	int _computerTextId;
 	Common::Rect _rect4E4;
 	int _field4EC;
 	int _field4EE;
 	int _field4F0;
 	int _field4F2;
 	int _eventCount;
-	Common::Array<VoyeurEvent> _events;
-
+	VoyeurEvent _events[TOTAL_EVENTS];
 
 	int _timeStart;
 	int _duration;
@@ -231,6 +231,15 @@ public:
 	void checkForKey();
 	void startCursorBlink();
 	void incrementTime(int amt);
+
+	void addVideoEventStart();
+	void addVideoEventEnd();
+	void addAudioEventStart();
+	void addAudioEventEnd();
+	void addEvidEventStart(int v);
+	void addEvidEventEnd(int dead);
+	void addComputerEventStart();
+	void addComputerEventEnd(int v);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index aa03383..f15f066 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -446,9 +446,6 @@ private:
 	uint32 getSID(int sid);
 	void cardAction(const byte *p);
 	void doSTAMPCardAction();
-	void addAudioEventStart();
-	void addAudioEventEnd();
-	void addVideoEventEnd();
 	bool goToStateID(int stackId, int sceneId);
 	bool goToState(int stackId, int sceneId);
 	const byte *cardPerform(const byte *card);
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 4432d7e..38a5fab 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -344,7 +344,7 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._field468 = 0;
 	_vm->_voy._field46A = 0;
 	_vm->_voy._field47A = -1;
-	_vm->_voy._field4E2 = -1;
+	_vm->_voy._computerTextId = -1;
 	_vm->_voy._field478 &= ~8;
 	_vm->_eventsManager._videoDead = -1;
 
@@ -386,7 +386,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_eventsManager._videoComputerBut4 = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
-					addAudioEventStart();
+					_vm->_eventsManager.addAudioEventStart();
 
 					assert(_vm->_eventsManager._videoComputerBut4 < 38);
 					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
@@ -417,7 +417,7 @@ void ThreadResource::parsePlayCommands() {
 
 					_vm->_voy._field478 |= 1;
 					_vm->_soundManager.stopVOCPlay();
-					addAudioEventEnd();
+					_vm->_eventsManager.addAudioEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 					_vm->_eventsManager.incrementTime(1);
 
@@ -445,14 +445,14 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_eventsManager._videoComputerBut4 = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
-					addAudioEventStart();
+					_vm->_eventsManager.addAudioEventStart();
 					_vm->_voy._field478 &= ~1;
 					_vm->_voy._field478 |= 0x10;
 					_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
 
 					_vm->_voy._field478 &= ~0x10;
 					_vm->_voy._field478 |= 1;
-					addVideoEventEnd();
+					_vm->_eventsManager.addVideoEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 				
 					_vm->_eventsManager._videoComputerBut4 = -1;
@@ -669,14 +669,14 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_voy._field4E2 = READ_LE_UINT16(dataP + 2);
+				_vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._field4EC = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field4EE = READ_LE_UINT16(dataP + 6);
 
-				_vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4];
-				_vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 1];
-				_vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 2];
-				_vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 3];
+				_vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4];
+				_vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1];
+				_vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 2];
+				_vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 3];
 			}
 
 			dataP += 8;
@@ -1223,7 +1223,7 @@ void ThreadResource::doRoom() {
 			vm._eventsManager.getMouseInfo();
 			Common::Point pt = vm._eventsManager.getMousePos();
 			i4e4 = -1;
-			if (voy._field4E2 != -1 && voy._rect4E4.contains(pt))
+			if (voy._computerTextId != -1 && voy._rect4E4.contains(pt))
 				i4e4 = 999;
 
 			for (int idx = 0; idx < count; ++idx) {
@@ -1288,13 +1288,14 @@ void ThreadResource::doRoom() {
 				(*vm._graphicsManager._vPort)->_flags |= 8;
 				vm._graphicsManager.flipPage();
 				vm._eventsManager.sWaitFlip();
-				vm.addPlainEvent();
+				vm._eventsManager.addComputerEventStart();
 
 				voy._incriminate = false;
 				vm._eventsManager.startCursorBlink();
 
-				if (vm.doComputerText(9999))
-					vm.addComputerEventEnd();
+				int v = vm.doComputerText(9999); 
+				if (v)
+					vm._eventsManager.addComputerEventEnd(v);
 
 				vm._bVoy->freeBoltGroup(0x4900);
 			} else {
@@ -1568,21 +1569,6 @@ int ThreadResource::doInterface() {
 	return !_vm->_voy._fadeFunc ? regionIndex : -2;
 }
 
-void ThreadResource::addAudioEventStart() {
-	_vm->_voy._events.push_back(VoyeurEvent(_vm->_gameHour,
-		_vm->_gameMinute, _vm->_voy._isAM, 2, 
-		_vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset, 
-		_vm->_eventsManager._videoDead));
-}
-
-void ThreadResource::addAudioEventEnd() {
-	error("TODO: addAudioEventEnd");
-}
-
-void ThreadResource::addVideoEventEnd() {
-	error("TODO: addVideoEventEnd");
-}
-
 bool ThreadResource::goToStateID(int stackId, int sceneId) {
 	debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId);
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index a62a912..f07616b 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -137,7 +137,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	int var52;
 	int var20, var22;
 	int var26;
-	byte pixel;
+	byte pixel = 0;
 
 	byte *srcImgData, *destImgData;
 	byte *srcP, *destP;
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index b6f3730..6835ff0 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -111,4 +111,7 @@ const char *const MONDAY = "Monday Morning";
 const char *const AM = "am";
 const char *const PM = "pm";
 
+const char *const START_OF_MESSAGE = "*** Start of Message ***";
+const char *const END_OF_MESSAGE = "*** End of Message ***";
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 990e2cf..ab35ac2 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -47,6 +47,9 @@ extern const char *const MONDAY;
 extern const char *const AM;
 extern const char *const PM;
 
+extern const char *const START_OF_MESSAGE;
+extern const char *const END_OF_MESSAGE;
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 0da5058..7b065e6 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -153,7 +153,7 @@ public:
 	void makeViewFinderP();
 	void initIFace();
 	void checkTransition();
-	bool doComputerText(int v);
+	bool doComputerText(int maxLen);
 	void getComputerBrush();
 
 	/**
@@ -173,10 +173,6 @@ public:
 
 	void checkPhoneCall();
 	void doEvidDisplay(int v1, int v2);
-
-	void addVideoEventStart();
-	void addComputerEventEnd();
-	void addPlainEvent();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1a6c2d1..471fec9 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -25,24 +25,6 @@
 
 namespace Voyeur {
 
-void VoyeurEngine::addVideoEventStart() {
-	VoyeurEvent &e = _voy._events[_voy._eventCount];
-	e._hour = _gameHour;
-	e._minute = _gameMinute;
-	e._isAM = _voy._isAM;
-	e._field6 = 1;
-	e._field8 = _eventsManager._videoComputerBut4;
-	e._dead = _eventsManager._videoDead;
-}
-
-void VoyeurEngine::addComputerEventEnd() {
-	error("TODO: addComputerEventEnd");
-}
-
-void VoyeurEngine::addPlainEvent() {
-	error("TODO: addPlainEvent");
-}
-
 void VoyeurEngine::playStamp() {
 	_stampLibPtr = NULL;
 	_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
@@ -444,12 +426,107 @@ void VoyeurEngine::checkTransition(){
 	}
 }
 
-bool VoyeurEngine::doComputerText(int v) {
-	error("TODO: doComputerText");
+bool VoyeurEngine::doComputerText(int maxLen) {
+	FontInfoResource &font = *_graphicsManager._fontPtr;
+	int totalChars = 0;
+
+	font._curFont = _bVoy->boltEntry(0x4910)._fontResource;
+	font._foreColor = 129;
+	font._fontSaveBack = false;
+	font._fontFlags = 0;
+	if (_voy._vocSecondsOffset > 60)
+		_voy._vocSecondsOffset = 0;
+
+	if (_voy._RTVNum > _voy._field4EE && maxLen == 9999) {
+		if (_playStamp2 != -1)
+			_soundManager.startVOCPlay(_playStamp2);
+		font._justify = ALIGN_LEFT;
+		font._justifyWidth = 384;
+		font._justifyHeight = 100;
+		font._pos = Common::Point(128, 100);
+		(*_graphicsManager._vPort)->drawText(END_OF_MESSAGE);
+	} else if (_voy._RTVNum < _voy._field4EC && maxLen == 9999) {
+		if (_playStamp2 != -1)
+			_soundManager.startVOCPlay(_playStamp2);
+		font._justify = ALIGN_LEFT;
+		font._justifyWidth = 384;
+		font._justifyHeight = 100;
+		font._pos = Common::Point(120, 100);
+		(*_graphicsManager._vPort)->drawText(START_OF_MESSAGE);
+	} else {
+		char *msg = (char *)_bVoy->memberAddr(0x4900 + _voy._computerTextId);
+		font._pos = Common::Point(96, 60);
+
+		bool showEnd = true;
+		int yp = 60;
+		do {
+			if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+				if (_voy._vocSecondsOffset > 60)
+					_voy._vocSecondsOffset = 0;
+				_soundManager.startVOCPlay(_playStamp2);
+			}
+
+			char c = *msg++;
+			if (c == '\0') {
+				if (showEnd) {
+					_eventsManager.delay(90);
+					_graphicsManager._drawPtr->_pos = Common::Point(54, 96);
+					_graphicsManager._drawPtr->_penColor = 254;
+					(*_graphicsManager._vPort)->sFillBox(196, 124);
+					_graphicsManager._fontPtr->_justify = ALIGN_LEFT;
+					_graphicsManager._fontPtr->_justifyWidth = 384;
+					_graphicsManager._fontPtr->_justifyHeight = 100;
+					_graphicsManager._fontPtr->_pos = Common::Point(128, 100);
+					(*_graphicsManager._vPort)->drawText(END_OF_MESSAGE);
+				}
+				break;
+			}
+
+			if (c == '~' || c == '^') {
+				if (c == '^') {
+					yp += 10;
+				} else {
+					_eventsManager.delay(90);
+					_graphicsManager._drawPtr->_pos = Common::Point(54, 96);
+					_graphicsManager._drawPtr->_penColor = 255;
+					(*_graphicsManager._vPort)->sFillBox(196, 124);
+					yp = 60;
+				}
+
+				_graphicsManager._fontPtr->_pos = Common::Point(96, yp);
+			} else if (c == '_') {
+				showEnd = false;
+			} else {
+				_graphicsManager._fontPtr->_justify = ALIGN_LEFT;
+				_graphicsManager._fontPtr->_justifyWidth = 0;
+				_graphicsManager._fontPtr->_justifyHeight = 0;
+				(*_graphicsManager._vPort)->drawText(Common::String(c));
+				_eventsManager.delay(4);
+			}
+
+			(*_graphicsManager._vPort)->_flags |= 8;
+			_graphicsManager.flipPage();
+			_eventsManager.sWaitFlip();
+			_eventsManager.getMouseInfo();
+			++totalChars;
+
+		} while (!shouldQuit() && !_voy._incriminate && totalChars < maxLen);
+
+		_voy._field4EE = 0;
+	}
+
+	(*_graphicsManager._vPort)->_flags |= 8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
+	return totalChars;
 }
 
 void VoyeurEngine::getComputerBrush() {
 	error("TODO: getComputerBrush");
+//	if (_bVoy->getBoltGroup(0x4900)) {
+//	}
 }
 
 void VoyeurEngine::doTimeBar(bool force) {
@@ -518,6 +595,16 @@ void VoyeurEngine::checkPhoneCall() {
 }
 
 void VoyeurEngine::doEvidDisplay(int v1, int v2) {
+	_eventsManager.getMouseInfo();
+	(*_graphicsManager._vPort)->_flags |= 8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+
+	if (_playStamp2 != -1) {
+		_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+		_soundManager.stopVOCPlay();
+	}
+
 	error("TODO: doEvidDisplay");
 }
 


Commit: 2721c2e3ed3bf038bd5b835501db5bf1e4c6e3bb
    https://github.com/scummvm/scummvm/commit/2721c2e3ed3bf038bd5b835501db5bf1e4c6e3bb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-24T19:08:37-08:00

Commit Message:
VOYEUR: Implemented reviewTape and dependent code

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 1139b95..b781058 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/events.h"
 #include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
 #include "common/events.h"
 #include "graphics/cursorman.h"
 #include "graphics/palette.h"
@@ -359,12 +360,12 @@ void EventsManager::vDoFadeInt() {
 }
 
 void EventsManager::vDoCycleInt() {
-	// TODO: more
+	warning("TODO");
 }
 
 
 void EventsManager::fadeIntFunc() {
-	// TODO: more
+	warning("TODO");
 }
 
 void EventsManager::vInitColor() {
@@ -528,4 +529,11 @@ void EventsManager::addComputerEventEnd(int v) {
 		++_vm->_voy._eventCount;
 }
 
+Common::String EventsManager::getEvidString(int eventIndex) {
+	assert(eventIndex <= _vm->_voy._eventCount);
+	VoyeurEvent &e = _vm->_voy._events[eventIndex];
+	return Common::String::format("%03d %.2d:%.2d %s %s", eventIndex + 1,
+		e._hour, e._minute, e._isAM ? AM : PM, EVENT_TYPE_STRINGS[e._type - 1]);
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index c7d8910..3c7d202 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -240,6 +240,7 @@ public:
 	void addEvidEventEnd(int dead);
 	void addComputerEventStart();
 	void addComputerEventEnd(int v);
+	Common::String getEvidString(int eventIndex);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 6835ff0..0108dac 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -114,4 +114,6 @@ const char *const PM = "pm";
 const char *const START_OF_MESSAGE = "*** Start of Message ***";
 const char *const END_OF_MESSAGE = "*** End of Message ***";
 
+const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio" "Evidence", "Computer" };
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index ab35ac2..ae970b8 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -50,6 +50,8 @@ extern const char *const PM;
 extern const char *const START_OF_MESSAGE;
 extern const char *const END_OF_MESSAGE;
 
+extern const char *const EVENT_TYPE_STRINGS[4];
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 471fec9..d7cd7e8 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -221,7 +221,279 @@ void VoyeurEngine::closeStamp() {
 }
 
 void VoyeurEngine::reviewTape() {
-	warning("TODO: reviewTape");
+	int var22 = 0;
+	int si = 0;
+	int newX = -1;
+	int newY = -1;
+	int var20 = 7;
+	Common::Rect tempRect(58, 30, 58 + 223, 30 + 124);
+	Common::Point pt;
+	int evtIndex = 0;
+	int foundIndex;
+
+	_bVoy->getBoltGroup(0x900);
+	PictureResource *cursor = _bVoy->boltEntry(0x903)._picResource;
+
+	if ((_voy._eventCount - 8) != 0)
+		si = MAX(_voy._eventCount - 8, 0);
+
+	if ((si + _voy._eventCount) <= 7)
+		var20 = si + _voy._eventCount - 1;
+
+	bool breakFlag = false;
+	while (!shouldQuit() && !breakFlag) {
+		_voy._field4386 = _bVoy->memberAddr(0x907);
+		byte *dataP = _bVoy->memberAddr(0x906);
+		int varA = READ_LE_UINT16(dataP);
+		_graphicsManager._backColors = _bVoy->boltEntry(0x902)._cMapResource;
+		_graphicsManager._backgroundPage = _bVoy->boltEntry(0x901)._picResource;
+		(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
+		_graphicsManager._backColors->startFade();
+
+		(*_graphicsManager._vPort)->_flags |= 8;
+		_graphicsManager.flipPage();
+		_eventsManager.sWaitFlip();
+		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+			_eventsManager.delay(1);
+
+		_graphicsManager.setColor(1, 32, 32, 32);
+		_graphicsManager.setColor(2, 96, 96, 96);
+		_graphicsManager.setColor(3, 160, 160, 160);
+		_graphicsManager.setColor(4, 224, 224, 224);
+		_graphicsManager.setColor(9, 24, 64, 24);
+		_graphicsManager.setColor(10, 64, 132, 64);
+		_graphicsManager.setColor(11, 100, 192, 100);
+		_graphicsManager.setColor(12, 120, 248, 120);
+		_eventsManager.setCursorColor(128, 1);
+
+		_eventsManager._intPtr.field38 = 1;
+		_eventsManager._intPtr._hasPalette = true;
+		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
+		_graphicsManager._fontPtr->_fontSaveBack = false;
+		_graphicsManager._fontPtr->_fontFlags = 0;
+
+		_eventsManager.getMouseInfo();
+		if (newX == -1) {
+			_eventsManager.setMousePos(Common::Point((int16)READ_LE_UINT16(dataP + 10) + 12,
+				(int16)READ_LE_UINT16(dataP + 12) + 6));
+		} else {
+			_eventsManager.setMousePos(Common::Point(newX, newY));
+		}
+
+		_playStamp2 = 151;
+		_voy._vocSecondsOffset = 0;
+		bool var1E = true;
+		do {
+			if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+				_voy._field4AC = _voy._RTVNum;
+				_soundManager.startVOCPlay(_playStamp2);
+			}
+
+			if (var1E) {
+				var1E = false;
+				(*_graphicsManager._vPort)->_flags |= 8;
+				_graphicsManager.flipPage();
+				_eventsManager.sWaitFlip();
+
+				_graphicsManager._drawPtr->_penColor = 0;
+				_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
+				// TODO: Check - does drawText need to work on PictureResources?
+				((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height());
+
+				newX = si;
+				int yp = 45;
+				evtIndex = si;
+				for (int idx = 0; idx < 8 && evtIndex < _voy._eventCount; ++idx) {
+					_graphicsManager._fontPtr->_picFlags = 0;
+					_graphicsManager._fontPtr->_picSelect = 0xff;
+					_graphicsManager._fontPtr->_picPick = 7;
+					_graphicsManager._fontPtr->_picOnOff = (idx == var20) ? 8 : 0;
+					_graphicsManager._fontPtr->_pos = Common::Point(68, yp);
+					_graphicsManager._fontPtr->_justify = ALIGN_LEFT;
+					_graphicsManager._fontPtr->_justifyWidth = 0;
+					_graphicsManager._fontPtr->_justifyHeight = 0;
+
+					Common::String msg = _eventsManager.getEvidString(evtIndex);
+					// TODO: Does drawText need to work on picture resources?
+					((ViewPortResource *)_graphicsManager._backgroundPage)->drawText(msg);
+					
+					yp += 15;
+					++evtIndex;
+				}
+
+				(*_graphicsManager._vPort)->addSaveRect(
+					(*_graphicsManager._vPort)->_lastPage, tempRect);
+				(*_graphicsManager._vPort)->_flags |= 8;
+				_graphicsManager.flipPage();
+				_eventsManager.sWaitFlip();
+
+				(*_graphicsManager._vPort)->addSaveRect(
+					(*_graphicsManager._vPort)->_lastPage, tempRect);
+			}
+
+			_graphicsManager.sDrawPic(cursor, *_graphicsManager._vPort,
+				_eventsManager.getMousePos());
+			(*_graphicsManager._vPort)->_flags |= 8;
+			_graphicsManager.flipPage();
+			_eventsManager.sWaitFlip();
+
+			_eventsManager.getMouseInfo();
+			foundIndex = -1;
+			Common::Point tempPos = _eventsManager.getMousePos() + Common::Point(14, 7);
+			for (int idx = 0; idx < varA; ++idx) {
+				if (READ_LE_UINT16(dataP + idx * 8 + 2) <= tempPos.x &&
+					READ_LE_UINT16(dataP + idx * 8 + 6) >= tempPos.x &&
+					READ_LE_UINT16(dataP + idx * 8 + 4) <= tempPos.y &&
+					READ_LE_UINT16(dataP + idx * 8 + 4) <= tempPos.y) {
+					// Found hotspot area
+					foundIndex = idx;
+					break;
+				}
+			}
+			
+			pt = _eventsManager.getMousePos();
+			if (tempPos.x >= 68 && tempPos.x <= 277 && tempPos.y >= 31 && tempPos.y <= 154) {
+				tempPos.y -= 2;
+				foundIndex = (tempPos.y - 31) / 15;
+				if ((tempPos.y - 31) % 15 >= 12 || (si + foundIndex) >= _voy._eventCount) {
+					_eventsManager.setCursorColor(128, 0);
+					foundIndex = 999;
+				} else if (!_voy._mouseClicked) {
+					_eventsManager.setCursorColor(128, 2);
+					foundIndex = 999;
+				} else {
+					_eventsManager.setCursorColor(128, 2);
+					var20 = foundIndex;
+
+					(*_graphicsManager._vPort)->_flags |= 8;
+					_graphicsManager.flipPage();
+					_eventsManager.sWaitFlip();
+
+					_graphicsManager._drawPtr->_penColor = 0;
+					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
+					// TODO: Does sFillBox need to work on picture resources?
+					((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height());
+
+					evtIndex = si;
+					int yp = 45;
+					
+					for (int idx = 0; idx < 8 && evtIndex < _voy._eventCount; ++idx) {
+						_graphicsManager._fontPtr->_picFlags = 0;
+						_graphicsManager._fontPtr->_picSelect = 0xff;
+						_graphicsManager._fontPtr->_picPick = 7;
+						_graphicsManager._fontPtr->_picOnOff = (idx == var20) ? 8 : 0;
+						_graphicsManager._fontPtr->_pos = Common::Point(68, yp);
+						_graphicsManager._fontPtr->_justify = ALIGN_LEFT;
+						_graphicsManager._fontPtr->_justifyWidth = 0;
+						_graphicsManager._fontPtr->_justifyHeight = 0;
+
+						Common::String msg = _eventsManager.getEvidString(evtIndex);
+						// TODO: Does sFillBox need to work on picture resources?
+						((ViewPortResource *)_graphicsManager._backgroundPage)->drawText(msg);
+
+						yp += 115;
+						++evtIndex;
+					}
+
+					(*_graphicsManager._vPort)->addSaveRect(
+						(*_graphicsManager._vPort)->_lastPage, tempRect);
+					(*_graphicsManager._vPort)->_flags |= 8;
+					_graphicsManager.flipPage();
+					_eventsManager.sWaitFlip();
+
+					(*_graphicsManager._vPort)->addSaveRect(
+						(*_graphicsManager._vPort)->_lastPage, tempRect);
+					(*_graphicsManager._vPort)->_flags |= 8;
+					_graphicsManager.flipPage();
+					_eventsManager.sWaitFlip();
+
+					_eventsManager.getMouseInfo();
+					foundIndex = 999;
+				}
+			} else if ((_voy._field478 & 0x40) && READ_LE_UINT16(_voy._field4386) == pt.x &&
+					READ_LE_UINT16(_voy._field4386 + 6) == pt.y) {
+				foundIndex = 999;
+			} else if ((_voy._field478 & 0x40) && READ_LE_UINT16(_voy._field4386) == pt.x &&
+					READ_LE_UINT16(_voy._field4386 + 2) == pt.y) {
+				foundIndex = 998;
+			} else {
+				_eventsManager.setCursorColor(128, (foundIndex == -1) ? 0 : 1);
+			}
+
+			_eventsManager._intPtr.field38 = true;
+			_eventsManager._intPtr._hasPalette = true;
+
+			if (_voy._incriminate || _voy._fadeICF1) {
+				switch (foundIndex) {
+				case 2:
+					if (si > 0) {
+						--si;
+						var1E = true;
+					}
+					foundIndex = -1;
+					break;
+
+				case 3:
+					if (si > 0) {
+						si -= 8;
+						if (si < 0)
+							si = 0;
+						var1E = true;
+					}
+					foundIndex = -1;
+					break;
+
+				case 4:
+					if ((_voy._eventCount - 8) > si) {
+						++si;
+						var1E = true;
+					}
+					foundIndex = -1;
+					break;
+
+				case 5:
+					if (_voy._eventCount >= 8 && (_voy._eventCount - 8) != si) {
+						si += 8;
+						if ((_voy._eventCount - 8) < si)
+							si = _voy._eventCount - 8;
+						var1E = true;
+					}
+					foundIndex = -1;
+					break;
+
+				default:
+					break;
+				}
+
+				while (var20 > 0 && (var20 + si) >= _voy._eventCount)
+					--var20;
+			}
+
+			pt = _eventsManager.getMousePos();
+			if (_voy._incriminate && READ_LE_UINT16(_voy._field4386) == pt.x &&
+					(_voy._field478 & 0x40) && _voy._fadeFunc) {
+				WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
+				foundIndex = -1;
+				_voy._fadeFunc = 0;
+			}
+			
+			if (_voy._fadeFunc)
+				foundIndex = 0;
+
+		} while (!shouldQuit() && (!_voy._incriminate || foundIndex == -1));
+
+
+
+		warning("TODO");
+	}
+
+	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
+	_bVoy->freeBoltGroup(0x900);
+
+	(*_graphicsManager._vPort)->fillPic(0);
+	(*_graphicsManager._vPort)->_flags |= 8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
 }
 
 bool VoyeurEngine::doGossip() {


Commit: c5f9cf913440cfdaeb7d7798cc0c490a2ea0d067
    https://github.com/scummvm/scummvm/commit/c5f9cf913440cfdaeb7d7798cc0c490a2ea0d067
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-24T20:43:18-08:00

Commit Message:
VOYEUR: Implemented doGossip

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 38a5fab..f2b5955 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -513,12 +513,7 @@ void ThreadResource::parsePlayCommands() {
 					(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 					pal->startFade();
 
-					(*_vm->_graphicsManager._vPort)->_flags |= 8;
-					_vm->_graphicsManager.flipPage();
-					_vm->_eventsManager.sWaitFlip();
-
-					while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-						_vm->_eventsManager.delay(1);
+					_vm->flipPageAndWaitForFade();
 
 					if (i > 0) {
 						_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 53698b2..90ea873 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -613,4 +613,17 @@ void VoyeurEngine::saveLastInplay() {
 	lock.saveThePassword();
 }
 
+void VoyeurEngine::flipPageAndWait() {
+	(*_graphicsManager._vPort)->_flags |= 8;
+	_graphicsManager.flipPage();
+	_eventsManager.sWaitFlip();
+}
+
+void VoyeurEngine::flipPageAndWaitForFade() {
+	flipPageAndWait();
+
+	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+		_eventsManager.delay(1);
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 7b065e6..283352c 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -85,7 +85,7 @@ private:
 	void initStamp();
 	void closeStamp();
 	void reviewTape();
-	bool doGossip();
+	void doGossip();
 	void doTapePlaying();
 	bool checkForMurder();
 	void checkForIncriminate();
@@ -173,6 +173,16 @@ public:
 
 	void checkPhoneCall();
 	void doEvidDisplay(int v1, int v2);
+
+	/**
+	 * Flips the active page and waits until it's drawn
+	 */
+	void flipPageAndWait();
+
+	/**
+	 * Flips the active page and waits until it's drawn and faded in
+	 */
+	void flipPageAndWaitForFade();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index d7cd7e8..468d6b1 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/voyeur.h"
 #include "voyeur/staticres.h"
+#include "voyeur/animation.h"
 
 namespace Voyeur {
 
@@ -221,7 +222,7 @@ void VoyeurEngine::closeStamp() {
 }
 
 void VoyeurEngine::reviewTape() {
-	int var22 = 0;
+//	int var22 = 0;
 	int si = 0;
 	int newX = -1;
 	int newY = -1;
@@ -496,9 +497,78 @@ void VoyeurEngine::reviewTape() {
 	_eventsManager.sWaitFlip();
 }
 
-bool VoyeurEngine::doGossip() {
-	warning("TODO: doGossip");
-	return false;
+void VoyeurEngine::doGossip() {
+	_graphicsManager.resetPalette();
+	_graphicsManager.screenReset();
+
+	if (!_bVoy->getBoltGroup(0x300))
+		return;
+
+	PictureResource *pic = _bVoy->boltEntry(0x300)._picResource;
+	(*_graphicsManager._vPort)->setupViewPort(pic);
+	CMapResource *pal = _bVoy->boltEntry(0x301)._cMapResource;
+	pal->startFade();
+
+	flipPageAndWaitForFade();
+
+	// Load the gossip animation
+	::Video::RL2Decoder decoder;
+	decoder.loadFile("a2050100.rl2");
+
+	byte *frameNumsP = _bVoy->memberAddr(0x309);
+	byte *posP = _bVoy->memberAddr(0x30A);
+
+	// Main playback loop
+	int picCtr = 0;
+	decoder.start();
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+		if (decoder.hasDirtyPalette()) {
+			const byte *palette = decoder.getPalette();
+			_graphicsManager.setPalette(palette, 0, 256);
+		}
+		
+		if (decoder.needsUpdate()) {
+			const Graphics::Surface *frame = decoder.decodeNextFrame();
+
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+				(byte *)_graphicsManager._screenSurface.getPixels());
+
+			if (decoder.getCurFrame() >= READ_LE_UINT16(frameNumsP + picCtr * 4)) {
+				PictureResource *pic = _bVoy->boltEntry(0x302 + picCtr)._picResource;
+				Common::Point pt(READ_LE_UINT16(posP + 4 * picCtr + 2), 
+					READ_LE_UINT16(posP + 4 * picCtr));
+				_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, pt);
+			}
+
+			flipPageAndWait();
+		}
+
+		_eventsManager.pollEvents();
+		g_system->delayMillis(10);
+	}
+
+	decoder.loadFile("a2110100.rl2");
+	decoder.start();
+
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+		if (decoder.hasDirtyPalette()) {
+			const byte *palette = decoder.getPalette();
+			_graphicsManager.setPalette(palette, 0, 256);
+		}
+
+		if (decoder.needsUpdate()) {
+			const Graphics::Surface *frame = decoder.decodeNextFrame();
+
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+				(byte *)_graphicsManager._screenSurface.getPixels());
+		}
+
+		_eventsManager.pollEvents();
+		g_system->delayMillis(10);
+	}
+
+	_bVoy->freeBoltGroup(0x300);
+	_graphicsManager.screenReset();
 }
 
 void VoyeurEngine::doTapePlaying() {


Commit: 562df7ede10f8340faf92f9c47d0414467b03852
    https://github.com/scummvm/scummvm/commit/562df7ede10f8340faf92f9c47d0414467b03852
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-24T21:05:01-08:00

Commit Message:
VOYEUR: Implement doTapePlaying

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9dff1f0..69256aa 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1393,4 +1393,14 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 	}
 }
 
+/*------------------------------------------------------------------------*/
+
+void CycleResource::vStartCycle() {
+	error("TODO: vStartCycle");
+}
+
+void CycleResource::vStopCycle() {
+	error("TODO: vStopCycle");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index f15f066..7c004a5 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -418,6 +418,15 @@ public:
 	virtual ~ControlResource() {}
 };
 
+class CycleResource {
+public:
+	CycleResource(BoltFilesState &state, const byte *src) {}
+	virtual ~CycleResource() {}
+
+	void vStartCycle();
+	void vStopCycle();
+};
+
 class ThreadResource {
 public:
 	static int _stampFlags;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 468d6b1..2be982b 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -572,7 +572,28 @@ void VoyeurEngine::doGossip() {
 }
 
 void VoyeurEngine::doTapePlaying() {
-	warning("TODO");
+	if (!_bVoy->getBoltGroup(0xA00))
+		return;
+
+	_eventsManager.getMouseInfo();
+	_graphicsManager._backColors = _bVoy->boltEntry(0xA01)._cMapResource;
+	_graphicsManager._backgroundPage = _bVoy->boltEntry(0xA00)._picResource;
+	PictureResource *pic = _bVoy->boltEntry(0xA02)._picResource;
+
+	(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
+	_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(57, 30));
+	flipPageAndWaitForFade();
+
+	CycleResource *cycle = _bVoy->boltEntry(0xA05)._cycleResource;
+	cycle->vStartCycle();
+
+	_soundManager.startVOCPlay("vcr.voc");
+	while (!shouldQuit() && !_voy._incriminate && _soundManager.getVOCStatus()) {
+		_eventsManager.delay(2);
+	}
+
+	_soundManager.stopVOCPlay();
+	_bVoy->freeBoltGroup(0xA00);
 }
 
 bool VoyeurEngine::checkForMurder() {


Commit: 754601bbab9e08daca0f9bb43776a50cecc70520
    https://github.com/scummvm/scummvm/commit/754601bbab9e08daca0f9bb43776a50cecc70520
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-24T21:40:46-08:00

Commit Message:
VOYEUR: Better implementation of rect resources

Changed paths:
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 3c7d202..5a94434 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -127,7 +127,7 @@ public:
 	int _field4380;
 	int _field4382;
 	int _videoEventId;
-	byte *_field4386;
+	RectResource *_viewBounds;
 	int _curICF0;
 	int _curICF1;
 	int _fadeICF0;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 69256aa..3b90e52 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -453,6 +453,9 @@ BVoyBoltFile::BVoyBoltFile(BoltFilesState &state): BoltFile("bvoy.blt", state) {
 
 void BVoyBoltFile::initResource(int resType) {
 	switch (resType) {
+	case 2:
+		sInitRect();
+		break;
 	case 8:
 		sInitPic();
 		break;
@@ -521,6 +524,11 @@ void BVoyBoltFile::initSoundMap() {
 	initDefault();
 }
 
+void BVoyBoltFile::sInitRect() {
+	_state._curMemberPtr->_data = _state.decompress(NULL, 8, _state._curMemberPtr->_mode);
+	_state._curMemberPtr->_rectResource = new RectResource(_state, _state._curMemberPtr->_data);
+}
+
 void BVoyBoltFile::sInitPic() {
 	// Read in the header data
 	_state._curMemberPtr->_data = _state.decompress(NULL, 24, _state._curMemberPtr->_mode);
@@ -627,17 +635,20 @@ void BoltGroup::unload() {
 /*------------------------------------------------------------------------*/
 
 BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
-	_data = NULL;
-	_picResource = NULL;
-	_viewPortResource = NULL;
-	_viewPortListResource = NULL;
-	_fontResource = NULL;
-	_fontInfoResource = NULL;
-	_cMapResource = NULL;
-	_vInitCyclResource = NULL;
-	_ptrResource = NULL;
-	_controlResource = NULL;
-	_threadResource = NULL;
+	_data = nullptr;
+	_rectResource = nullptr;
+	_picResource = nullptr;
+	_viewPortResource = nullptr;
+	_viewPortListResource = nullptr;
+	_fontResource = nullptr;
+	_fontInfoResource = nullptr;
+	_cMapResource = nullptr;
+	_vInitCyclResource = nullptr;
+	_ptrResource = nullptr;
+	_controlResource = nullptr;
+	_vInitCyclResource = nullptr;
+	_cycleResource = nullptr;
+	_threadResource = nullptr;
 
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
@@ -651,6 +662,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 
 BoltEntry::~BoltEntry() {
 	delete[] _data;
+	delete _rectResource;
 	delete _picResource;
 	delete _viewPortResource;
 	delete _viewPortListResource;
@@ -658,6 +670,7 @@ BoltEntry::~BoltEntry() {
 	delete _fontInfoResource;
 	delete _cMapResource;
 	delete _vInitCyclResource;
+	delete _cycleResource;
 	delete _ptrResource;
 	delete _controlResource;
 }
@@ -671,10 +684,26 @@ void BoltEntry::load() {
  * Returns true if the given bolt entry has an attached resource
  */
 bool BoltEntry::hasResource() const {
-	return _picResource || _viewPortResource || _viewPortListResource
+	return _rectResource ||  _picResource || _viewPortResource || _viewPortListResource
 		|| _fontResource || _fontInfoResource || _cMapResource 
-		|| _vInitCyclResource || _ptrResource || _controlResource
-		|| _threadResource;
+		|| _vInitCyclResource || _cycleResource
+		|| _ptrResource || _controlResource || _threadResource;
+}
+
+/*------------------------------------------------------------------------*/
+
+RectResource::RectResource(BoltFilesState &state, const byte *src) {
+	left = READ_LE_UINT16(src);
+	top = READ_LE_UINT16(src + 2);
+	setWidth(READ_LE_UINT16(src + 4));
+	setHeight(READ_LE_UINT16(src + 6));
+}
+
+RectResource::RectResource(int x1, int y1, int x2, int y2) {
+	left = x1;
+	top = y1;
+	right = x2;
+	bottom = y2;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 7c004a5..4440490 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -35,6 +35,7 @@ class VoyeurEngine;
 class BoltFile;
 class BoltGroup;
 class BoltEntry;
+class RectResource;
 class PictureResource;
 class ViewPortResource;
 class ViewPortListResource;
@@ -43,6 +44,7 @@ class CMapResource;
 class VInitCyclResource;
 class PtrResource;
 class ControlResource;
+class CycleResource;
 class ThreadResource;
 
 #define DECOMPRESS_SIZE 0x7000
@@ -137,6 +139,7 @@ public:
 class BVoyBoltFile: public BoltFile {
 private:
 	// initType method table
+	void sInitRect();
 	void sInitPic();
 	void vInitCMap();
 	void vInitCycl();
@@ -195,6 +198,7 @@ public:
 	byte *_data;
 
 	// bvoy.blt resource types
+	RectResource *_rectResource;
 	PictureResource *_picResource;
 	ViewPortResource *_viewPortResource;
 	ViewPortListResource *_viewPortListResource;
@@ -202,6 +206,7 @@ public:
 	FontInfoResource *_fontInfoResource;
 	CMapResource *_cMapResource;
 	VInitCyclResource *_vInitCyclResource;
+	CycleResource *_cycleResource;	// TODO: Dup with VInit?
 
 	// stampblt.blt resource types
 	PtrResource *_ptrResource;
@@ -229,6 +234,13 @@ public:
 	byte *fload(const Common::String &filename, int *size = NULL);
 };
 
+class RectResource: public Common::Rect {
+public:
+	RectResource(BoltFilesState &state, const byte *src);
+	RectResource(int xp, int yp, int width, int height);
+	virtual ~RectResource() {}
+};
+
 enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 = 8, 
 	DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
 	DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400, 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index f2b5955..43bebf3 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1052,7 +1052,7 @@ int ThreadResource::doApt() {
 	loadTheApt();
 
 	_vm->_playStamp2 = 151;
-	_vm->_voy._field4386 = _vm->_bVoy->memberAddr(_vm->_playStamp1); 
+	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; 
 	byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1);
 	_vm->_eventsManager.getMouseInfo();
 
@@ -1188,9 +1188,8 @@ void ThreadResource::doRoom() {
 	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
 	PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
 
-	byte arr[10];
-	strcpy((char *)&arr[0], "0");
-	voy._field4386 = &arr[0];
+	RectResource viewBounds(48, 38, 336, 202);
+	voy._viewBounds = &viewBounds;
 
 	vm._eventsManager.getMouseInfo();
 	vm._eventsManager.setMousePos(Common::Point(192, 120));
@@ -1347,7 +1346,7 @@ void ThreadResource::doRoom() {
 
 	voy._field478 = 1;
 	vm._eventsManager.incrementTime(1);
-	voy._field4386 = 0;
+	voy._viewBounds = nullptr;
 	voy._field437E = 0;
 	vm.makeViewFinderP();
 
@@ -1707,7 +1706,7 @@ void ThreadResource::freeTheApt() {
 	(*_vm->_graphicsManager._vPort)->setupViewPort(nullptr);
 	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
 	_vm->_playStamp1 = -1;
-	_vm->_voy._field4386 = 0;
+	_vm->_voy._viewBounds = nullptr;
 }
 
 void ThreadResource::doAptAnim(int mode) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 90ea873..ab8f3cf 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -265,7 +265,7 @@ bool VoyeurEngine::doLock() {
 		lock.getThePassword();
 		
 		_voy._field4380 = lock.fieldC;
-		_voy._field4386 = _bVoy->memberAddr(0x704);
+		_voy._viewBounds = _bVoy->boltEntry(0x704)._rectResource;
 
 		Common::String password = lock._password;
 		cursorPic = _bVoy->getPictureResource(0x702);
@@ -422,7 +422,7 @@ bool VoyeurEngine::doLock() {
 			lock._password = displayString;
 		lock.saveThePassword();
 
-		_voy._field4386 = NULL;
+		_voy._viewBounds = nullptr;
 		_bVoy->freeBoltGroup(0x700);
 	}
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 2be982b..811f386 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -201,7 +201,7 @@ void VoyeurEngine::playStamp() {
 		} while (flag);
 	}
 
-	_voy._field4386 = 0;
+	_voy._viewBounds = nullptr;
 	closeStamp();
 	_stampLibPtr->freeBoltGroup(0);
 	delete _stampLibPtr;
@@ -243,7 +243,7 @@ void VoyeurEngine::reviewTape() {
 
 	bool breakFlag = false;
 	while (!shouldQuit() && !breakFlag) {
-		_voy._field4386 = _bVoy->memberAddr(0x907);
+		_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
 		byte *dataP = _bVoy->memberAddr(0x906);
 		int varA = READ_LE_UINT16(dataP);
 		_graphicsManager._backColors = _bVoy->boltEntry(0x902)._cMapResource;
@@ -411,11 +411,11 @@ void VoyeurEngine::reviewTape() {
 					_eventsManager.getMouseInfo();
 					foundIndex = 999;
 				}
-			} else if ((_voy._field478 & 0x40) && READ_LE_UINT16(_voy._field4386) == pt.x &&
-					READ_LE_UINT16(_voy._field4386 + 6) == pt.y) {
+			} else if ((_voy._field478 & 0x40) && _voy._viewBounds->left == pt.x &&
+					_voy._viewBounds->bottom == pt.y) {
 				foundIndex = 999;
-			} else if ((_voy._field478 & 0x40) && READ_LE_UINT16(_voy._field4386) == pt.x &&
-					READ_LE_UINT16(_voy._field4386 + 2) == pt.y) {
+			} else if ((_voy._field478 & 0x40) && _voy._viewBounds->left == pt.x &&
+					_voy._viewBounds->top == pt.y) {
 				foundIndex = 998;
 			} else {
 				_eventsManager.setCursorColor(128, (foundIndex == -1) ? 0 : 1);
@@ -471,7 +471,7 @@ void VoyeurEngine::reviewTape() {
 			}
 
 			pt = _eventsManager.getMousePos();
-			if (_voy._incriminate && READ_LE_UINT16(_voy._field4386) == pt.x &&
+			if (_voy._incriminate && _voy._viewBounds->left == pt.x &&
 					(_voy._field478 & 0x40) && _voy._fadeFunc) {
 				WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
 				foundIndex = -1;
@@ -703,7 +703,7 @@ void VoyeurEngine::initIFace(){
 
 	doScroll(_eventsManager.getMousePos());
 	
-	_voy._field4386 = _bVoy->memberAddr(_playStamp1);
+	_voy._viewBounds = _bVoy->boltEntry(_playStamp1)._rectResource;
 
 	// Note: the original did two loops to preload members here, which is
 	// redundant for ScummVM, since computers are faster these days, and


Commit: 6e801e246be36d8efa9003a316bbd1424d51d4ae
    https://github.com/scummvm/scummvm/commit/6e801e246be36d8efa9003a316bbd1424d51d4ae
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-24T22:07:05-08:00

Commit Message:
VOYEUR: Enhance RectResource to handle rect sets

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 3b90e52..1eefef4 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -525,8 +525,10 @@ void BVoyBoltFile::initSoundMap() {
 }
 
 void BVoyBoltFile::sInitRect() {
-	_state._curMemberPtr->_data = _state.decompress(NULL, 8, _state._curMemberPtr->_mode);
-	_state._curMemberPtr->_rectResource = new RectResource(_state, _state._curMemberPtr->_data);
+	_state._curMemberPtr->_data = _state.decompress(NULL, _state._curMemberPtr->_size, 
+		_state._curMemberPtr->_mode);
+	_state._curMemberPtr->_rectResource = new RectResource(_state._curMemberPtr->_data,
+		_state._curMemberPtr->_size);
 }
 
 void BVoyBoltFile::sInitPic() {
@@ -692,11 +694,22 @@ bool BoltEntry::hasResource() const {
 
 /*------------------------------------------------------------------------*/
 
-RectResource::RectResource(BoltFilesState &state, const byte *src) {
-	left = READ_LE_UINT16(src);
-	top = READ_LE_UINT16(src + 2);
-	setWidth(READ_LE_UINT16(src + 4));
-	setHeight(READ_LE_UINT16(src + 6));
+RectResource::RectResource(const byte *src, int size) {
+	int count = 1;
+	if (size != 8) {
+		count = READ_LE_UINT16(src);
+		src += 2;
+	}
+
+	for (int i = 0; i < count; ++i, src += 8) {
+		_entries.push_back(Common::Rect(READ_LE_UINT16(src), READ_LE_UINT16(src + 2),
+			READ_LE_UINT16(src + 4), READ_LE_UINT16(src + 6)));
+	}
+
+	left = _entries[0].left;
+	top = _entries[0].top;
+	right = _entries[0].right;
+	bottom = _entries[0].bottom;
 }
 
 RectResource::RectResource(int x1, int y1, int x2, int y2) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4440490..48592da 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -236,7 +236,9 @@ public:
 
 class RectResource: public Common::Rect {
 public:
-	RectResource(BoltFilesState &state, const byte *src);
+	Common::Array<Common::Rect> _entries;
+public:
+	RectResource(const byte *src, int size);
 	RectResource(int xp, int yp, int width, int height);
 	virtual ~RectResource() {}
 };
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 43bebf3..15f2e96 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1053,20 +1053,21 @@ int ThreadResource::doApt() {
 
 	_vm->_playStamp2 = 151;
 	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; 
-	byte *hotspotsP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1);
+	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
+		_vm->_playStamp1 + 1)._rectResource->_entries;
 	_vm->_eventsManager.getMouseInfo();
 
 	if (_doAptPosX == -1) {
-		_doAptPosX = READ_LE_UINT16(hotspotsP + 18) + 16;
-		_doAptPosY = READ_LE_UINT16(hotspotsP + 20) + 16;
+		_doAptPosX = hotspots[2].left;
+		_doAptPosY = hotspots[2].top;
 		_vm->_playStamp2 = 153;
 	}
 
 	if (_vm->_voy._field470 == 16) {
-		WRITE_LE_UINT16(hotspotsP + 2, 999);
-		WRITE_LE_UINT16(hotspotsP + 26, 999);
-		_doAptPosX = READ_LE_UINT16(hotspotsP + 34) + 28;
-		_doAptPosY = READ_LE_UINT16(hotspotsP + 36) + 28;
+		hotspots[0].left = 999;
+		hotspots[3].left = 999;
+		_doAptPosX = hotspots[4].left + 28;
+		_doAptPosY = hotspots[4].top + 28;
 	}
 
 	_vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY));
@@ -1097,11 +1098,9 @@ int ThreadResource::doApt() {
 		// Loop through the hotspot list
 		hotspotId = -1;
 		pt = _vm->_eventsManager.getMousePos();
-		for (int idx = 0; idx < READ_LE_UINT16(hotspotsP); ++idx) {
-			if (pt.x > READ_LE_UINT16(hotspotsP + idx * 8 + 2) &&
-				pt.x < READ_LE_UINT16(hotspotsP + idx * 8 + 6) &&
-				pt.y > READ_LE_UINT16(hotspotsP + idx * 8 + 4) &&
-				pt.y < READ_LE_UINT16(hotspotsP + idx * 8 + 8)) {
+		for (int idx = 0; idx < hotspots.size(); ++idx) {
+			if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right &&
+				pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) {
 				// Cursor is within hotspot area
 				hotspotId = idx;
 


Commit: 0c82fc1bafce8dc6e6a0852c4bd65e92005eaf39
    https://github.com/scummvm/scummvm/commit/0c82fc1bafce8dc6e6a0852c4bd65e92005eaf39
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-25T00:26:49-08:00

Commit Message:
VOYEUR: Implemented checkForMurder

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 811f386..617b48c 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -597,7 +597,54 @@ void VoyeurEngine::doTapePlaying() {
 }
 
 bool VoyeurEngine::checkForMurder() {
-	warning("TODO");
+	int v = READ_LE_UINT32(_controlPtr->_ptr + 12);
+
+	for (int idx = 0; idx < _voy._eventCount; ++idx) {
+		VoyeurEvent &evt = _voy._events[idx];
+
+		if (evt._type == EVTYPE_VIDEO) {
+			switch (READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+			case 1:
+				if (evt._field8 == 41 && evt._computerOn <= 15 &&
+						(evt._computerOff + evt._computerOn) >= 16) {
+					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 1);
+				}
+				break;
+
+			case 2:
+				if (evt._field8 == 53 && evt._computerOn <= 19 &&
+						(evt._computerOff + evt._computerOn) >= 21) {
+					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 2);
+				}
+				break;
+
+			case 3:
+				if (evt._field8 == 50 && evt._computerOn <= 28 &&
+						(evt._computerOff + evt._computerOn) >= 29) {
+					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 3);
+				}
+				break;
+
+			case 4:
+				if (evt._field8 == 43 && evt._computerOn <= 10 &&
+						(evt._computerOff + evt._computerOn) >= 14) {
+					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 4);
+				}
+				break;
+
+			default:
+				break;
+			}
+		}
+
+		if (READ_LE_UINT32(_controlPtr->_ptr + 12) == READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+			_voy._videoEventId = idx;
+			return true;
+		}
+	}
+
+	WRITE_LE_UINT32(_controlPtr->_ptr + 12, v);
+	_voy._videoEventId = -1;
 	return false;
 }
 


Commit: 6e1a7abeefea61b41ff7821030758941ec642665
    https://github.com/scummvm/scummvm/commit/6e1a7abeefea61b41ff7821030758941ec642665
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-25T00:38:32-08:00

Commit Message:
VOYEUR: Implemented checkForIncriminate

Changed paths:
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 283352c..e0a3549 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -88,7 +88,7 @@ private:
 	void doGossip();
 	void doTapePlaying();
 	bool checkForMurder();
-	void checkForIncriminate();
+	bool checkForIncriminate();
 	void playAVideoEvent(int eventId);
 	int getChooseButton();
 protected:
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 617b48c..cce07eb 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -648,8 +648,47 @@ bool VoyeurEngine::checkForMurder() {
 	return false;
 }
 
-void VoyeurEngine::checkForIncriminate() {
-	warning("TODO");
+bool VoyeurEngine::checkForIncriminate() {
+	_voy._field4382 = 0;
+
+	for (int idx = 0; idx < _voy._eventCount; ++idx) {
+		VoyeurEvent &evt = _voy._events[idx];
+		
+		if (evt._type == EVTYPE_VIDEO) {
+			if (evt._field8 == 44 && evt._computerOn <= 40 &&
+					(evt._computerOff + evt._computerOn) >= 70) {
+				_voy._field4382 = 1;
+			}
+
+			if (evt._field8 == 44 && evt._computerOn <= 79 &&
+					(evt._computerOff + evt._computerOn) >= 129) {
+				_voy._field4382 = 1;
+			}
+
+			if (evt._field8 == 20 && evt._computerOn <= 28 &&
+					(evt._computerOff + evt._computerOn) >= 45) {
+				_voy._field4382 = 2;
+			}
+
+			if (evt._field8 == 35 && evt._computerOn <= 17 &&
+					(evt._computerOff + evt._computerOn) >= 36) {
+				_voy._field4382 = 3;
+			}
+
+			if (evt._field8 == 30 && evt._computerOn <= 80 &&
+					(evt._computerOff + evt._computerOn) >= 139) {
+				_voy._field4382 = 4;
+			}
+		}
+
+		if (_voy._field4382) {
+			WRITE_LE_UINT32(_controlPtr->_ptr + 12, 88);
+			_voy._videoEventId = idx;
+			return true;
+		}
+	}
+
+	_voy._videoEventId = -1;
 }
 
 void VoyeurEngine::playAVideoEvent(int eventId) {


Commit: 88c9dac8c0695ad328bf354ad54e5bb3fa5ba1de
    https://github.com/scummvm/scummvm/commit/88c9dac8c0695ad328bf354ad54e5bb3fa5ba1de
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-25T12:30:46-08:00

Commit Message:
VOYEUR: Implemented playAVideoDuration

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/sound.cpp
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index c771f04..ce1fc9e 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "voyeur/animation.h"
+#include "voyeur/staticres.h"
 #include "common/memstream.h"
 #include "common/system.h"
 #include "audio/decoders/raw.h"
@@ -35,6 +36,11 @@ RL2Decoder::~RL2Decoder() {
 	close();
 }
 
+bool RL2Decoder::loadVideo(int videoId) {
+	Common::String filename = Common::String::format("%s.rl2", ::Voyeur::SZ_FILENAMES[videoId]);
+	return loadFile(filename);
+}
+
 bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	close();
 
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 53d24fc..b06e3cb 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -73,6 +73,7 @@ public:
 	virtual ~RL2Decoder();
 
 	bool loadStream(Common::SeekableReadStream *stream);
+	bool loadVideo(int videoId);
 
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 15f2e96..26e4b59 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1098,7 +1098,7 @@ int ThreadResource::doApt() {
 		// Loop through the hotspot list
 		hotspotId = -1;
 		pt = _vm->_eventsManager.getMousePos();
-		for (int idx = 0; idx < hotspots.size(); ++idx) {
+		for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
 			if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right &&
 				pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) {
 				// Cursor is within hotspot area
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index e53716a..bf6374f 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -61,7 +61,7 @@ void SoundManager::setVOCOffset(int offset) {
 }
 
 Common::String SoundManager::getVOCFileName(int idx) {
-	return Common::String::format("%s.voc", VOC_FILENAMES[idx]);
+	return Common::String::format("%s.voc", SZ_FILENAMES[idx]);
 }
 
 void SoundManager::startVOCPlay(const Common::String &filename) {
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 0108dac..294a167 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -74,7 +74,7 @@ const int COMP_BUT_TABLE[] = {
 	68, 79, 98, 102
 };
 
-const char *const VOC_FILENAMES[] = {
+const char *const SZ_FILENAMES[] = {
     "A2110100", nullptr, "A2300100", nullptr, "B1220100", nullptr, "C1220100", nullptr, 
 	"C1290100", nullptr, "D1220100", nullptr, "D1270100", nullptr, "E1210100", nullptr, 
 	"E1260100", nullptr, "E1280100", nullptr, "E1325100", nullptr, "F1200100", nullptr,
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index ae970b8..8c97af7 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -39,7 +39,7 @@ extern const int BLIND_TABLE[];
 
 extern const int COMP_BUT_TABLE[];
 
-extern const char *const VOC_FILENAMES[];
+extern const char *const SZ_FILENAMES[];
 
 extern const char *const SATURDAY;
 extern const char *const SUNDAY;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index ab8f3cf..1e09a8f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -560,6 +560,59 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	}
 }
 
+void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
+	byte *dataP = NULL;
+	int totalFrames = duration * 10;
+
+	if (videoId != -1)
+		return;
+
+	if (videoId != 42) {
+		_eventsManager._videoDead = 0;
+		dataP = _bVoy->memberAddr(0xE00);
+	}
+
+	::Video::RL2Decoder decoder;
+	decoder.loadVideo(videoId);
+
+	decoder.start();
+	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
+	int endFrame = decoder.getCurFrame() + totalFrames; 
+
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate &&
+			(decoder.getCurFrame() < endFrame)) {
+		if (decoder.hasDirtyPalette()) {
+			const byte *palette = decoder.getPalette();
+			_graphicsManager.setPalette(palette, 0, 256);
+		}
+
+		if (decoder.needsUpdate()) {
+			const Graphics::Surface *frame = decoder.decodeNextFrame();
+
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+				(byte *)_graphicsManager._screenSurface.getPixels());
+		}
+
+		_eventsManager.pollEvents();
+		g_system->delayMillis(10);
+	}
+
+	// RL2 finished
+	_graphicsManager.screenReset();
+	_voy._field478 &= ~0x10;
+
+	if (_voy._field478 & 8) {
+		// TODO: Figure out resource type for the data resource
+		/*
+		byte *imgData = (*_graphicsManager._vPort)->_currentPic->_imgData;
+		(*_graphicsManager._vPort)->_currentPic->_imgData = dataP[12 and 14];
+		imgData[12 and 14] = imgData;
+		_voy._field478 &= ~8;
+		*/
+		warning("TODO: playAVideoDuration - %x", dataP);
+	}
+}
+
 void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
 	_graphicsManager.setColor(128, 16, 16, 16);
 	_graphicsManager.setColor(224, 220, 220, 220);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index e0a3549..7f900df 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -89,7 +89,8 @@ private:
 	void doTapePlaying();
 	bool checkForMurder();
 	bool checkForIncriminate();
-	void playAVideoEvent(int eventId);
+	void playAVideoEvent(int eventIndex);
+	void playAVideoDuration(int v1, int v2);
 	int getChooseButton();
 protected:
 	// Engine APIs
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index cce07eb..fc0168d 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -691,8 +691,14 @@ bool VoyeurEngine::checkForIncriminate() {
 	_voy._videoEventId = -1;
 }
 
-void VoyeurEngine::playAVideoEvent(int eventId) {
-	warning("TODO");
+void VoyeurEngine::playAVideoEvent(int eventIndex) {
+	VoyeurEvent &evt = _voy._events[eventIndex];
+	_eventsManager._videoComputerBut4 = evt._field8;
+	_voy._vocSecondsOffset = evt._computerOn;
+	_eventsManager._videoDead = evt._dead;
+	_voy._field478 &= ~1;
+	
+	playAVideoDuration(_eventsManager._videoComputerBut4, evt._computerOff);
 }
 
 int VoyeurEngine::getChooseButton()  {


Commit: 906f2546b497b7662dc40d2b6628ca27d91b9178
    https://github.com/scummvm/scummvm/commit/906f2546b497b7662dc40d2b6628ca27d91b9178
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-25T14:35:27-08:00

Commit Message:
VOYEUR: Implemented getChooseButton

Changed paths:
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 7f900df..0d2ea7e 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -90,7 +90,6 @@ private:
 	bool checkForMurder();
 	bool checkForIncriminate();
 	void playAVideoEvent(int eventIndex);
-	void playAVideoDuration(int v1, int v2);
 	int getChooseButton();
 protected:
 	// Engine APIs
@@ -145,6 +144,7 @@ public:
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
 	void playAVideo(int id);
+	void playAVideoDuration(int v1, int v2);
 
 	/**
 	 * Saves the last time the game was played
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index fc0168d..9dec623 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -689,6 +689,7 @@ bool VoyeurEngine::checkForIncriminate() {
 	}
 
 	_voy._videoEventId = -1;
+	return false;
 }
 
 void VoyeurEngine::playAVideoEvent(int eventIndex) {
@@ -702,8 +703,58 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 }
 
 int VoyeurEngine::getChooseButton()  {
-	warning("TODO");
-	return 0;
+	int prevIndex = -2;
+	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(_playStamp1 
+		+ 6)._rectResource->_entries;
+	int selectedIndex = -1;
+
+	(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
+	_graphicsManager._backColors->_steps = 0;
+	_graphicsManager._backColors->startFade();
+	flipPageAndWait();
+
+	_voy._viewBounds = _bVoy->boltEntry(_playStamp1 + 7)._rectResource;
+	PictureResource *cursorPic = _bVoy->boltEntry(_playStamp1 + 2)._picResource;
+
+	do {
+		do {
+			if (_playStamp2 != -1 && !_soundManager.getVOCStatus())
+				_soundManager.startVOCPlay(_playStamp2);
+
+			_eventsManager.getMouseInfo();
+			selectedIndex = -1;
+			Common::Point pt = _eventsManager.getMousePos();
+			
+			for (uint idx = 0; idx < hotspots.size(); ++idx) {
+				if (hotspots[idx].contains(pt)) {
+					if (!_voy._field4F0 || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+						selectedIndex = idx;
+						if (selectedIndex != prevIndex) {
+							PictureResource *btnPic = _bVoy->boltEntry(_playStamp1 + 8 + idx)._picResource;
+							_graphicsManager.sDrawPic(btnPic, *_graphicsManager._vPort,
+								Common::Point(106, 200));
+
+							cursorPic = _bVoy->boltEntry(_playStamp1 + 4)._picResource;
+						}
+					}
+				}
+			}
+
+			if (selectedIndex == -1) {
+				cursorPic = _bVoy->boltEntry(_playStamp1 + 2)._picResource;
+				PictureResource *btnPic = _bVoy->boltEntry(_playStamp1 + 12)._picResource;
+				_graphicsManager.sDrawPic(btnPic, *_graphicsManager._vPort,
+					Common::Point(106, 200));
+			}
+
+			_graphicsManager.sDrawPic(cursorPic, *_graphicsManager._vPort,
+				Common::Point(pt.x + 13, pt.y - 12));
+
+			flipPageAndWait();
+		} while (!shouldQuit() && !_voy._incriminate);
+	} while (!shouldQuit() && selectedIndex == -1 && !_voy._fadeFunc);
+
+	return selectedIndex;
 }
 
 void VoyeurEngine::makeViewFinder() {


Commit: 554756f93fb77c8e15e697b2b4c3d2bf09c95232
    https://github.com/scummvm/scummvm/commit/554756f93fb77c8e15e697b2b4c3d2bf09c95232
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-25T14:36:27-08:00

Commit Message:
VOYEUR: Fix prototype for playAVideoDuration

Changed paths:
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 0d2ea7e..1690905 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -144,7 +144,7 @@ public:
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
 	void playAVideo(int id);
-	void playAVideoDuration(int v1, int v2);
+	void playAVideoDuration(int videoId, int duration);
 
 	/**
 	 * Saves the last time the game was played


Commit: 16cbccf09ac3f98e5dddfa866e35c5cd319f8f5d
    https://github.com/scummvm/scummvm/commit/16cbccf09ac3f98e5dddfa866e35c5cd319f8f5d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-25T20:47:27-08:00

Commit Message:
VOYEUR: Remove redundant method definition

Changed paths:
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 48592da..8ccfab8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -537,7 +537,6 @@ public:
 	 */
 	int doApt();
 
-	void doTapePlaying();
 	void checkForMurder();
 	void checkForIncriminate();
 


Commit: 8ed1171ca07e5857c1ab4862052bc7451f8728e7
    https://github.com/scummvm/scummvm/commit/8ed1171ca07e5857c1ab4862052bc7451f8728e7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T01:42:05-08:00

Commit Message:
VOYEUR: Convert doInterface to use new rects resource type

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 26e4b59..8d0ad00 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1409,7 +1409,8 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 	_vm->initIFace();
 
-	byte *dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1);
+	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
+		_vm->_playStamp1)._rectResource->_entries;
 	_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
 	_vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29);
 
@@ -1447,11 +1448,8 @@ int ThreadResource::doInterface() {
 		pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75);
 		regionIndex = -1;
 
-		for (int idx = 0; idx < READ_LE_UINT16(dataP); ++idx) {
-			if (READ_LE_UINT16(dataP + (idx * 8 + 2)) <= pt.x &&
-					READ_LE_UINT16(dataP + (idx * 8 + 6)) >= pt.x &&
-					READ_LE_UINT16(dataP + (idx * 8 + 4)) <= pt.y &&
-					READ_LE_UINT16(dataP + (idx * 8 + 8)) >= pt.y) {
+		for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
+			if (hotspots[idx].contains(pt)) {
 				// Rect check done
 				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
 					if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum &&
@@ -1542,7 +1540,7 @@ int ThreadResource::doInterface() {
 				_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 				_vm->initIFace();
 				
-				dataP = _vm->_bVoy->memberAddr(_vm->_playStamp1 + 1);
+				hotspots = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries;
 				_vm->_eventsManager.getMouseInfo();
 				_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 


Commit: 3b9cdf48eec9afc3664d04fa1ecbd71c94eb8cf5
    https://github.com/scummvm/scummvm/commit/3b9cdf48eec9afc3664d04fa1ecbd71c94eb8cf5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T18:30:51-08:00

Commit Message:
VOYEUR: Fix for doRoom start and looping

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index b781058..4d5c03c 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -233,6 +233,7 @@ void EventsManager::pollEvents() {
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButton = 1;
 			_vm->_voy._newMouseClicked = true;
+			_vm->_voy._newIncriminate = true;
 			return;
 		case Common::EVENT_RBUTTONDOWN:
 			_mouseButton = 2;
@@ -241,6 +242,7 @@ void EventsManager::pollEvents() {
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONUP:
 			_vm->_voy._newMouseClicked = false;
+			_vm->_voy._newIncriminate = false;
 			_mouseButton = 0;
 			return;
 		case Common::EVENT_MOUSEMOVE:
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 1eefef4..2602ace 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -527,6 +527,8 @@ void BVoyBoltFile::initSoundMap() {
 void BVoyBoltFile::sInitRect() {
 	_state._curMemberPtr->_data = _state.decompress(NULL, _state._curMemberPtr->_size, 
 		_state._curMemberPtr->_mode);
+
+	if ((_state._curMemberPtr->_size % 8) == 0 || (_state._curMemberPtr->_size % 8) == 2)
 	_state._curMemberPtr->_rectResource = new RectResource(_state._curMemberPtr->_data,
 		_state._curMemberPtr->_size);
 }
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 9dec623..badea59 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -891,7 +891,7 @@ void VoyeurEngine::doScroll(const Common::Point &pt) {
 		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 136));
 	}
 
-	(*_graphicsManager._vPort)->setupViewPort();
+	(*_graphicsManager._vPort)->setupViewPort(NULL);
 }
 
 void VoyeurEngine::checkTransition(){


Commit: 9eccf91aea8dc8f8ebbaa61c04152d0e1f70902e
    https://github.com/scummvm/scummvm/commit/9eccf91aea8dc8f8ebbaa61c04152d0e1f70902e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T19:01:06-08:00

Commit Message:
VOYEUR: Implemented startCursorBlink and drawDot

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 4d5c03c..d622a6d 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -451,7 +451,15 @@ void EventsManager::checkForKey() {
 }
 
 void EventsManager::startCursorBlink() {
-	error("TODO: startCursorBlink");
+	if (_vm->_voy._field478 & 0x10) {
+		_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
+		_vm->_graphicsManager.setColor(128, 220, 20, 20);
+		_intPtr.field38 = true;
+		_intPtr._hasPalette = true;
+
+		_vm->_graphicsManager.drawDot();
+		//copySection();
+	}
 }
 
 void EventsManager::incrementTime(int amt) {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index f07616b..47c7293 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/graphics.h"
 #include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
 #include "engines/util.h"
 #include "graphics/palette.h"
 #include "graphics/surface.h"
@@ -735,4 +736,11 @@ void GraphicsManager::fadeDownICF(int steps) {
 	_vm->_voy._field4378 = 0;
 }
 
+void GraphicsManager::drawDot() {
+	for (int y = 0; y < 9; ++y) {
+		byte *pDest = (byte *)_screenSurface.getPixels() + DOT_LINE_START[y] + DOT_LINE_OFFSET[y];
+		Common::fill(pDest, pDest + DOT_LINE_LENGTH[y], 0x80);
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 3bfef0e..92b3e51 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -115,6 +115,7 @@ public:
 	void fadeDownICF1(int steps);
 	void fadeUpICF1(int steps);
 	void fadeDownICF(int steps);
+	void drawDot();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 294a167..1ce8a74 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -116,4 +116,14 @@ const char *const END_OF_MESSAGE = "*** End of Message ***";
 
 const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio" "Evidence", "Computer" };
 
+int DOT_LINE_START[9] = {
+	0E880, 0xE9C0, 0xEB00, 0xEC40, 0xED80, 0xEEC0, 0xF000, 0xF140, 0xF280
+};
+int DOT_LINE_OFFSET[9] = {
+	144, 143, 142, 141, 141, 141, 142, 143, 144
+};
+int DOT_LINE_LENGTH[9] = {
+	5, 7, 9, 11, 11, 11, 9, 7, 5
+};
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 8c97af7..a6b81f0 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -52,6 +52,10 @@ extern const char *const END_OF_MESSAGE;
 
 extern const char *const EVENT_TYPE_STRINGS[4];
 
+extern int DOT_LINE_START[9];
+extern int DOT_LINE_OFFSET[9];
+extern int DOT_LINE_LENGTH[9];
+
 } // End of namespace Voyeur
 
 #endif


Commit: 19c208a05d47562181c64833f25ada59751e5c88
    https://github.com/scummvm/scummvm/commit/19c208a05d47562181c64833f25ada59751e5c88
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T20:02:54-08:00

Commit Message:
VOYEUR: Refactored code fragments to use flipPageAndWaitForFade method

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 8d0ad00..3a626d4 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -396,12 +396,7 @@ void ThreadResource::parsePlayCommands() {
 
 					(*_vm->_graphicsManager._vPort)->setupViewPort();
 					_vm->_graphicsManager._backColors->startFade();
-					(*_vm->_graphicsManager._vPort)->_flags |= 8;
-					_vm->_graphicsManager.flipPage();
-					_vm->_eventsManager.sWaitFlip();
-
-					while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-						_vm->_eventsManager.delay(1);
+					_vm->flipPageAndWaitForFade();
 
 					_vm->_voy._field478 = -2;
 					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
@@ -692,13 +687,8 @@ void ThreadResource::parsePlayCommands() {
 
 			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 			_cmd14Pal->startFade();
+			_vm->flipPageAndWaitForFade();
 
-			(*_vm->_graphicsManager._vPort)->_flags |= 8;
-			_vm->_graphicsManager.flipPage();
-			_vm->_eventsManager.sWaitFlip();
-
-			while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-				_vm->_eventsManager.delay(1);
 			_vm->_eventsManager.getMouseInfo();
 
 			for (int idx = 1; idx < 4; ++idx) {
@@ -712,13 +702,7 @@ void ThreadResource::parsePlayCommands() {
 
 				(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 				_cmd14Pal->startFade();
-
-				(*_vm->_graphicsManager._vPort)->_flags |= 8;
-				_vm->_graphicsManager.flipPage();
-				_vm->_eventsManager.sWaitFlip();
-
-				while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-					_vm->_eventsManager.delay(1);
+				_vm->flipPageAndWaitForFade();
 
 				_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2);
 				_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2 + 1);
@@ -1664,23 +1648,12 @@ void ThreadResource::loadTheApt() {
 	CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource;
 	pal->_steps = 1; 
 	pal->startFade();
-
-	(*_vm->_graphicsManager._vPort)->_flags |= 8;
-	_vm->_graphicsManager.flipPage();
-	_vm->_eventsManager.sWaitFlip();
-
-	while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-		_vm->_eventsManager.delay(1);
+	_vm->flipPageAndWaitForFade();
 }
 
 void ThreadResource::freeTheApt() {
 	_vm->_graphicsManager.fadeDownICF1(5);
-	(*_vm->_graphicsManager._vPort)->_flags |= 8;
-	_vm->_graphicsManager.flipPage();
-	_vm->_eventsManager.sWaitFlip();
-
-	while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
-		_vm->_eventsManager.delay(1);
+	_vm->flipPageAndWaitForFade();
 
 	_vm->_graphicsManager.fadeUpICF1(0);
 


Commit: 84752aa27227bc3dde6005f818d4b2a9b21b8b5b
    https://github.com/scummvm/scummvm/commit/84752aa27227bc3dde6005f818d4b2a9b21b8b5b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T20:09:44-08:00

Commit Message:
VOYEUR: Refactored code fragments to use flipPageAndWait

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 3a626d4..2d389c0 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -456,10 +456,7 @@ void ThreadResource::parsePlayCommands() {
 					if (_vm->_eventsManager._videoDead != -1) {
 						_vm->_bVoy->freeBoltGroup(0xE00);
 						_vm->_eventsManager._videoDead = -1;
-						(*_vm->_graphicsManager._vPort)->_flags |= 8;
-
-						_vm->_graphicsManager.flipPage();
-						_vm->_eventsManager.sWaitFlip();
+						_vm->flipPageAndWait();
 					}
 
 					_vm->_eventsManager._videoDead = -1;
@@ -1108,9 +1105,7 @@ int ThreadResource::doApt() {
 			_vm->_playStamp1 + 3)._picResource;
 		_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt);
 
-		(*_vm->_graphicsManager._vPort)->_flags |= 8;
-		_vm->_graphicsManager.flipPage();
-		_vm->_eventsManager.sWaitFlip();
+		_vm->flipPageAndWait();
 
 	} while (!_vm->shouldQuit() && (!_vm->_voy._mouseClicked || hotspotId == -1));
 
@@ -1250,9 +1245,7 @@ void ThreadResource::doRoom() {
 			vm._eventsManager.startCursorBlink();
 
 			if (i4e4 == 999) {
-				(*_vm->_graphicsManager._vPort)->_flags |= 8;
-				_vm->_graphicsManager.flipPage();
-				_vm->_eventsManager.sWaitFlip();
+				_vm->flipPageAndWait();
 
 				if (vm._playStamp2 != -1) {
 					voy._vocSecondsOffset = voy._RTVNum - 
@@ -1261,10 +1254,8 @@ void ThreadResource::doRoom() {
 				}
 
 				vm.getComputerBrush();
+				_vm->flipPageAndWait();
 
-				(*vm._graphicsManager._vPort)->_flags |= 8;
-				vm._graphicsManager.flipPage();
-				vm._eventsManager.sWaitFlip();
 				vm._eventsManager.addComputerEventStart();
 
 				voy._incriminate = false;
@@ -1294,9 +1285,7 @@ void ThreadResource::doRoom() {
 				vm._playStamp1)._picResource;
 
 			vm._graphicsManager._backColors->startFade();
-			(*vm._graphicsManager._vPort)->_flags |= 8;
-			vm._graphicsManager.flipPage();
-			vm._eventsManager.sWaitFlip();
+			_vm->flipPageAndWait();
 
 			while (!vm.shouldQuit() && (vm._eventsManager._fadeStatus & 1))
 				vm._eventsManager.delay(1);
@@ -1318,9 +1307,7 @@ void ThreadResource::doRoom() {
 				vm._eventsManager.delay(1);
 			}
 
-			(*vm._graphicsManager._vPort)->_flags |= 8;
-			vm._graphicsManager.flipPage();
-			vm._eventsManager.sWaitFlip();
+			_vm->flipPageAndWait();
 
 			vm._graphicsManager.fadeUpICF1(0);
 			voy._field478 &= 0x10;
@@ -1496,9 +1483,7 @@ int ThreadResource::doInterface() {
 		}
 
 		_vm->_voy._RTANum = 0;
-		(*_vm->_graphicsManager._vPort)->_flags |= 8;
-		_vm->_graphicsManager.flipPage();
-		_vm->_eventsManager.sWaitFlip();
+		_vm->flipPageAndWait();
 
 		pt = _vm->_eventsManager.getMousePos();
 		if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) &&
@@ -1736,10 +1721,7 @@ void ThreadResource::doAptAnim(int mode) {
 			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 			pal->startFade();
 
-			(*_vm->_graphicsManager._vPort)->_flags |= 8;
-			_vm->_graphicsManager.flipPage();
-			_vm->_eventsManager.sWaitFlip();
-
+			_vm->flipPageAndWait();
 			_vm->_eventsManager.delay(5);
 		}
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index badea59..8bb1bde 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -251,11 +251,7 @@ void VoyeurEngine::reviewTape() {
 		(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
 		_graphicsManager._backColors->startFade();
 
-		(*_graphicsManager._vPort)->_flags |= 8;
-		_graphicsManager.flipPage();
-		_eventsManager.sWaitFlip();
-		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
-			_eventsManager.delay(1);
+		flipPageAndWaitForFade();
 
 		_graphicsManager.setColor(1, 32, 32, 32);
 		_graphicsManager.setColor(2, 96, 96, 96);
@@ -292,9 +288,7 @@ void VoyeurEngine::reviewTape() {
 
 			if (var1E) {
 				var1E = false;
-				(*_graphicsManager._vPort)->_flags |= 8;
-				_graphicsManager.flipPage();
-				_eventsManager.sWaitFlip();
+				flipPageAndWait();
 
 				_graphicsManager._drawPtr->_penColor = 0;
 				_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
@@ -324,9 +318,7 @@ void VoyeurEngine::reviewTape() {
 
 				(*_graphicsManager._vPort)->addSaveRect(
 					(*_graphicsManager._vPort)->_lastPage, tempRect);
-				(*_graphicsManager._vPort)->_flags |= 8;
-				_graphicsManager.flipPage();
-				_eventsManager.sWaitFlip();
+				flipPageAndWait();
 
 				(*_graphicsManager._vPort)->addSaveRect(
 					(*_graphicsManager._vPort)->_lastPage, tempRect);
@@ -334,9 +326,7 @@ void VoyeurEngine::reviewTape() {
 
 			_graphicsManager.sDrawPic(cursor, *_graphicsManager._vPort,
 				_eventsManager.getMousePos());
-			(*_graphicsManager._vPort)->_flags |= 8;
-			_graphicsManager.flipPage();
-			_eventsManager.sWaitFlip();
+			flipPageAndWait();
 
 			_eventsManager.getMouseInfo();
 			foundIndex = -1;
@@ -366,9 +356,7 @@ void VoyeurEngine::reviewTape() {
 					_eventsManager.setCursorColor(128, 2);
 					var20 = foundIndex;
 
-					(*_graphicsManager._vPort)->_flags |= 8;
-					_graphicsManager.flipPage();
-					_eventsManager.sWaitFlip();
+					flipPageAndWait();
 
 					_graphicsManager._drawPtr->_penColor = 0;
 					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
@@ -398,15 +386,11 @@ void VoyeurEngine::reviewTape() {
 
 					(*_graphicsManager._vPort)->addSaveRect(
 						(*_graphicsManager._vPort)->_lastPage, tempRect);
-					(*_graphicsManager._vPort)->_flags |= 8;
-					_graphicsManager.flipPage();
-					_eventsManager.sWaitFlip();
+					flipPageAndWait();
 
 					(*_graphicsManager._vPort)->addSaveRect(
 						(*_graphicsManager._vPort)->_lastPage, tempRect);
-					(*_graphicsManager._vPort)->_flags |= 8;
-					_graphicsManager.flipPage();
-					_eventsManager.sWaitFlip();
+					flipPageAndWait();
 
 					_eventsManager.getMouseInfo();
 					foundIndex = 999;
@@ -492,9 +476,7 @@ void VoyeurEngine::reviewTape() {
 	_bVoy->freeBoltGroup(0x900);
 
 	(*_graphicsManager._vPort)->fillPic(0);
-	(*_graphicsManager._vPort)->_flags |= 8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 }
 
 void VoyeurEngine::doGossip() {
@@ -796,12 +778,7 @@ void VoyeurEngine::makeViewFinder() {
 	doTimeBar(true);
 	pal->startFade();
 
-	(*_graphicsManager._vPort)->_flags |= 8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
-
-	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
-		_eventsManager.delay(1);
+	flipPageAndWaitForFade();
 
 	_graphicsManager.setColor(241, 105, 105, 105);
 	_graphicsManager.setColor(242, 105, 105, 105);
@@ -1010,9 +987,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 				_eventsManager.delay(4);
 			}
 
-			(*_graphicsManager._vPort)->_flags |= 8;
-			_graphicsManager.flipPage();
-			_eventsManager.sWaitFlip();
+			flipPageAndWait();
 			_eventsManager.getMouseInfo();
 			++totalChars;
 
@@ -1021,9 +996,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 		_voy._field4EE = 0;
 	}
 
-	(*_graphicsManager._vPort)->_flags |= 8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 
 	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
 	return totalChars;
@@ -1102,9 +1075,7 @@ void VoyeurEngine::checkPhoneCall() {
 
 void VoyeurEngine::doEvidDisplay(int v1, int v2) {
 	_eventsManager.getMouseInfo();
-	(*_graphicsManager._vPort)->_flags |= 8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 
 	if (_playStamp2 != -1) {
 		_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;


Commit: b08e80cd6643b366774551360c7ba9ed611d48e6
    https://github.com/scummvm/scummvm/commit/b08e80cd6643b366774551360c7ba9ed611d48e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T23:37:37-08:00

Commit Message:
VOYEUR: Implemented evidence display code

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index d622a6d..b5643e4 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -213,6 +213,18 @@ void EventsManager::delay(int cycles) {
 	}
 }
 
+void EventsManager::delayClick(int cycles) {
+	uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE;
+	uint32 delayEnd = g_system->getMillis() + totalMilli;
+
+	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd 
+			&& !_vm->_voy._incriminate) {
+		g_system->delayMillis(10);
+
+		pollEvents();
+	}
+}
+
 void EventsManager::pollEvents() {
 	checkForNextFrameCounter();
 
@@ -370,6 +382,10 @@ void EventsManager::fadeIntFunc() {
 	warning("TODO");
 }
 
+void EventsManager::deleteIntNode(IntNode *node) {
+	_intNodes.remove(node);
+}
+
 void EventsManager::vInitColor() {
 	_fadeIntNode._intFunc = &EventsManager::vDoFadeInt;
 	_cycleIntNode._intFunc = &EventsManager::vDoCycleInt;
@@ -539,6 +555,10 @@ void EventsManager::addComputerEventEnd(int v) {
 		++_vm->_voy._eventCount;
 }
 
+void EventsManager::stopEvidDim() {
+	deleteIntNode(&_evIntNode);
+}
+
 Common::String EventsManager::getEvidString(int eventIndex) {
 	assert(eventIndex <= _vm->_voy._eventCount);
 	VoyeurEvent &e = _vm->_voy._events[eventIndex];
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 5a94434..1e4559c 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -89,6 +89,8 @@ public:
 	int _field476;
 	int _field478;
 	int _field47A;
+	PictureResource *_evPicPtrs[6];
+	CMapResource *_evCmPtrs[6];
 	int _field4AC;
 	int _field4AE[5];
 	int _field4B8;
@@ -105,15 +107,7 @@ public:
 	int _timeStart;
 	int _duration;
 	int _vidStart;
-	int _doApt;
-	int _function;
-	int _anim;
-	int _level;
-	int _levelDone;
-	int _flags;
-	int _evGroup;
-	byte *_evPicPtrs[6];
-	byte *_evCmPtrs[6];
+
 	int _audioTime;
 	int _phones[5];
 	int _numPhonesUsed;
@@ -187,13 +181,14 @@ private:
 	void vDoFadeInt();
 	void vDoCycleInt();
 	void fadeIntFunc();
+	void deleteIntNode(IntNode *node);
 public:
 	IntData _gameData;
 	IntData &_intPtr;
 	IntNode _fadeIntNode;
 	IntNode _fade2IntNode;
 	IntNode _cycleIntNode;
-	IntNode _evintnode;
+	IntNode _evIntNode;
 	IntNode _mainIntNode;
 	int _cycleStatus;
 	int _fadeFirstCol, _fadeLastCol;
@@ -215,6 +210,7 @@ public:
 	void vInitColor();
 
 	void delay(int cycles);
+	void delayClick(int cycles);
 	void pollEvents();
 	void startFade(CMapResource *cMap);
 	void addIntNode(IntNode *node);
@@ -240,6 +236,8 @@ public:
 	void addEvidEventEnd(int dead);
 	void addComputerEventStart();
 	void addComputerEventEnd(int v);
+	void stopEvidDim();
+
 	Common::String getEvidString(int eventIndex);
 };
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 2d389c0..944c9db 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -408,7 +408,7 @@ void ThreadResource::parsePlayCommands() {
 
 					while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
 							_vm->_soundManager.getVOCStatus())
-							_vm->_eventsManager.delay(1);
+						_vm->_eventsManager.delayClick(1);
 
 					_vm->_voy._field478 |= 1;
 					_vm->_soundManager.stopVOCPlay();
@@ -517,7 +517,7 @@ void ThreadResource::parsePlayCommands() {
 
 					while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
 							_vm->_soundManager.getVOCStatus()) {
-						_vm->_eventsManager.delay(1);
+						_vm->_eventsManager.delayClick(1);
 						_vm->_eventsManager.getMouseInfo();
 					}
 
@@ -1272,7 +1272,7 @@ void ThreadResource::doRoom() {
 
 			voy._field478 &= ~0x10;
 			if (!voy._incriminate)
-				vm._eventsManager.delay(18000);
+				vm._eventsManager.delayClick(18000);
 
 			vm._bVoy->freeBoltGroup(vm._playStamp1);
 			vm._bVoy->getBoltGroup(vm._playStamp1);
@@ -1722,7 +1722,7 @@ void ThreadResource::doAptAnim(int mode) {
 			pal->startFade();
 
 			_vm->flipPageAndWait();
-			_vm->_eventsManager.delay(5);
+			_vm->_eventsManager.delayClick(5);
 		}
 
 		_vm->_bVoy->freeBoltGroup(id);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1e09a8f..76aa8fe 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -187,7 +187,7 @@ bool VoyeurEngine::doHeadTitle() {
 	if (!_voy._incriminate) {
 //		doOpening();
 //		doTransitionCard("Saturday Afternoon", "Player's Apartment");
-		_eventsManager.delay(90);
+		_eventsManager.delayClick(90);
 	} else {
 		_voy._incriminate = false;
 	}
@@ -224,7 +224,7 @@ void VoyeurEngine::showConversionScreen() {
 	cMap->startFade();
 
 	// Wait briefly
-	_eventsManager.delay(150);
+	_eventsManager.delayClick(150);
 	if (shouldQuit())
 		return;
 
@@ -240,12 +240,10 @@ void VoyeurEngine::showConversionScreen() {
 	_eventsManager.sWaitFlip();
 
 	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
-		_eventsManager.delay(1);
+		_eventsManager.delayClick(1);
 
 	_graphicsManager.screenReset();
 	_bVoy->freeBoltGroup(0x500);
-
-
 }
 
 bool VoyeurEngine::doLock() {
@@ -450,7 +448,7 @@ void VoyeurEngine::showTitleScreen() {
 		cMap->startFade();
 
 		// Wait briefly
-		_eventsManager.delay(200);
+		_eventsManager.delayClick(200);
 		if (shouldQuit())
 			return;
 
@@ -469,7 +467,7 @@ void VoyeurEngine::showTitleScreen() {
 			return;
 
 		_graphicsManager.screenReset();
-		_eventsManager.delay(200);
+		_eventsManager.delayClick(200);
 
 		// Voyeur title
 		playRL2Video("a1100100.rl2");
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 1690905..f18ec4b 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -173,7 +173,7 @@ public:
 	void doScroll(const Common::Point &pt);
 
 	void checkPhoneCall();
-	void doEvidDisplay(int v1, int v2);
+	void doEvidDisplay(int evidId, int eventId);
 
 	/**
 	 * Flips the active page and waits until it's drawn
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 8bb1bde..f0e81e9 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -571,7 +571,7 @@ void VoyeurEngine::doTapePlaying() {
 
 	_soundManager.startVOCPlay("vcr.voc");
 	while (!shouldQuit() && !_voy._incriminate && _soundManager.getVOCStatus()) {
-		_eventsManager.delay(2);
+		_eventsManager.delayClick(2);
 	}
 
 	_soundManager.stopVOCPlay();
@@ -1073,7 +1073,7 @@ void VoyeurEngine::checkPhoneCall() {
 	}
 }
 
-void VoyeurEngine::doEvidDisplay(int v1, int v2) {
+void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	_eventsManager.getMouseInfo();
 	flipPageAndWait();
 
@@ -1082,7 +1082,81 @@ void VoyeurEngine::doEvidDisplay(int v1, int v2) {
 		_soundManager.stopVOCPlay();
 	}
 
-	error("TODO: doEvidDisplay");
+	_bVoy->getBoltGroup(_voy._field47A);
+	PictureResource *pic = _bVoy->boltEntry(_voy._field47A + evidId * 2)._picResource;
+	_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(
+		384 - pic->_bounds.width() / 2, 240 - pic->_bounds.height() / 2));
+	_bVoy->freeBoltMember(_voy._field47A + evidId * 2);
+
+	CMapResource *pal = _bVoy->boltEntry(_voy._field47A + evidId * 2 + 1)._cMapResource;
+	pal->startFade();
+
+	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+		_eventsManager.delay(1);
+	_bVoy->freeBoltMember(_voy._field47A + evidId * 2 + 1);
+
+	byte *dataP = _bVoy->memberAddr(_playStamp1 + 4);
+	int count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
+
+	if (count > 0) {
+		for (int idx = 1; idx <= count; ++idx) {
+			_voy._evPicPtrs[idx - 1] = _bVoy->boltEntry(_voy._field47A + 
+				(evidId + idx) * 2)._picResource;
+			_voy._evCmPtrs[idx - 1] = _bVoy->boltEntry(_voy._field47A + 
+				(evidId + idx) * 2 + 1)._cMapResource;
+		}
+	}
+
+	flipPageAndWait();
+	_eventsManager.stopEvidDim();
+
+	if (eventId == 999)
+		_eventsManager.addEvidEventStart(eventId);
+
+	_eventsManager.getMouseInfo();
+
+	int arrIndex = 0;
+	bool breakFlag = _voy._fadeFunc != NULL;
+	int evidIdx = evidId;
+
+	while (!shouldQuit() && !breakFlag) {
+		if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+			if (_voy._vocSecondsOffset > 60)
+				_voy._vocSecondsOffset = 0;
+
+			_soundManager.startVOCPlay(_playStamp2);
+		}
+
+		_eventsManager.delay(600);
+		if (_voy._fadeFunc)
+			break;
+		if (count == 0 || evidIdx >= eventId)
+			continue;
+		
+		PictureResource *pic = _voy._evPicPtrs[arrIndex];
+		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort,
+			Common::Point((384 - pic->_bounds.width()) / 2,
+			(240 - pic->_bounds.height()) / 2));
+		_voy._evCmPtrs[arrIndex]->startFade();
+		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+			_eventsManager.delay(1);
+
+		flipPageAndWait();
+		_eventsManager.delay(6);
+
+		++evidIdx;
+		++arrIndex;
+		--count;
+	}
+
+	if (eventId != 999)
+		_eventsManager.addEvidEventEnd(evidIdx);
+
+	count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
+	for (int idx = 1; idx <= count; ++idx) {
+		_bVoy->freeBoltGroup(_voy._field47A + (evidId + idx) * 2);
+		_bVoy->freeBoltGroup(_voy._field47A + (evidId + idx) * 2 + 1);
+	}
 }
 
 } // End of namespace Voyeur


Commit: f01ff9a938acbaaaf04b553b4b65b2a98eb0f684
    https://github.com/scummvm/scummvm/commit/f01ff9a938acbaaaf04b553b4b65b2a98eb0f684
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-27T23:45:32-08:00

Commit Message:
VOYEUR: Further replacement of page flip code with flipPageAndWait calls

Changed paths:
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 47c7293..f6829b4 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -686,11 +686,8 @@ void GraphicsManager::screenReset() {
 	_backgroundPage = NULL;
 	(*_vPort)->setupViewPort();
 	fillPic(*_vPort, 0);	
-	(*_vPort)->_parent->_flags |= DISPFLAG_8;
 
-	// Flip
-	flipPage();
-	_vm->_eventsManager.sWaitFlip();
+	_vm->flipPageAndWait();
 }
 
 void GraphicsManager::fadeDownICF1(int steps) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 76aa8fe..7778614 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -212,10 +212,7 @@ bool VoyeurEngine::doHeadTitle() {
 void VoyeurEngine::showConversionScreen() {
 	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x502)._picResource;
 	(*_graphicsManager._vPort)->setupViewPort();
-	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
-
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 
 	// Immediate palette load to show the initial screen
 	CMapResource *cMap = _bVoy->getCMapResource(0x503);
@@ -235,12 +232,7 @@ void VoyeurEngine::showConversionScreen() {
 	if (shouldQuit())
 		return;
 
-	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
-
-	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
-		_eventsManager.delayClick(1);
+	flipPageAndWaitForFade();
 
 	_graphicsManager.screenReset();
 	_bVoy->freeBoltGroup(0x500);
@@ -309,9 +301,7 @@ bool VoyeurEngine::doLock() {
 		bool breakFlag = false;
 		while (!breakFlag && !shouldQuit()) {
 			(*_graphicsManager._vPort)->setupViewPort();
-			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-			_graphicsManager.flipPage();
-			_eventsManager.sWaitFlip();
+			flipPageAndWait();
 
 			// Display the last play time
 			_graphicsManager._fontPtr->_pos = Common::Point(0, 97);
@@ -320,9 +310,7 @@ bool VoyeurEngine::doLock() {
 			_graphicsManager._fontPtr->_justifyHeight = 97;
 
 			(*_graphicsManager._vPort)->drawText(displayString);
-			(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-			_graphicsManager.flipPage();
-			_eventsManager.sWaitFlip();
+			flipPageAndWait();
 
 			if (firstLoop) {
 				firstLoop = false;
@@ -411,9 +399,7 @@ bool VoyeurEngine::doLock() {
 		}
 
 		_graphicsManager.fillPic(*_graphicsManager._vPort);
-		(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-		_graphicsManager.flipPage();
-		_eventsManager.sWaitFlip();
+		flipPageAndWait();
 		_graphicsManager.resetPalette();
 
 		if (flag && result)
@@ -437,9 +423,7 @@ void VoyeurEngine::showTitleScreen() {
 		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x500);
 
 		(*_graphicsManager._vPort)->setupViewPort();
-		(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
-		_graphicsManager.flipPage();
-		_eventsManager.sWaitFlip();
+		flipPageAndWait();
 
 		// Immediate palette load to show the initial screen
 		CMapResource *cMap = _bVoy->getCMapResource(0x501);
@@ -457,12 +441,7 @@ void VoyeurEngine::showTitleScreen() {
 		cMap->_steps = 30;
 		cMap->startFade();
 
-		(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
-		_graphicsManager.flipPage();
-		_eventsManager.sWaitFlip();
-
-		while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
-			_eventsManager.delay(1);
+		flipPageAndWaitForFade();
 		if (shouldQuit())
 			return;
 
@@ -508,9 +487,7 @@ void VoyeurEngine::doOpening() {
 	_eventsManager._intPtr.field38 = 1;
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort();
-	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 
 	::Video::RL2Decoder decoder;
 	decoder.loadFile("a2300100.rl2");
@@ -622,9 +599,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
 	_graphicsManager.flipPage();
 	_eventsManager.sWaitFlip();
 
-	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 	(*_graphicsManager._vPort)->fillPic(128);
 
 	FontInfoResource &fi = *_graphicsManager._fontPtr;
@@ -647,9 +622,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
 		(*_graphicsManager._vPort)->drawText(location);
 	}
 
-	(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
-	_graphicsManager.flipPage();
-	_eventsManager.sWaitFlip();
+	flipPageAndWait();
 }
 
 void VoyeurEngine::playAVideo(int id) {
@@ -665,7 +638,7 @@ void VoyeurEngine::saveLastInplay() {
 }
 
 void VoyeurEngine::flipPageAndWait() {
-	(*_graphicsManager._vPort)->_flags |= 8;
+	(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
 	_graphicsManager.flipPage();
 	_eventsManager.sWaitFlip();
 }


Commit: f88c4727781b6e6eea4a8a5a7dd09ae90e55ba68
    https://github.com/scummvm/scummvm/commit/f88c4727781b6e6eea4a8a5a7dd09ae90e55ba68
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T00:53:00-08:00

Commit Message:
VOYEUR: Fixed naming of mouse state flags

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index b5643e4..94f137e 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -218,7 +218,7 @@ void EventsManager::delayClick(int cycles) {
 	uint32 delayEnd = g_system->getMillis() + totalMilli;
 
 	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd 
-			&& !_vm->_voy._incriminate) {
+			&& !_vm->_voy._mouseClicked) {
 		g_system->delayMillis(10);
 
 		pollEvents();
@@ -244,17 +244,19 @@ void EventsManager::pollEvents() {
 			return;
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButton = 1;
+			_vm->_voy._newLeftClick = true;
 			_vm->_voy._newMouseClicked = true;
-			_vm->_voy._newIncriminate = true;
 			return;
 		case Common::EVENT_RBUTTONDOWN:
 			_mouseButton = 2;
+			_vm->_voy._newRightClick = true;
 			_vm->_voy._newMouseClicked = true;
 			return;
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONUP:
 			_vm->_voy._newMouseClicked = false;
-			_vm->_voy._newIncriminate = false;
+			_vm->_voy._newLeftClick = false;
+			_vm->_voy._newRightClick = false;
 			_mouseButton = 0;
 			return;
 		case Common::EVENT_MOUSEMOVE:
@@ -456,10 +458,10 @@ void EventsManager::getMouseInfo() {
 		}
 	}
 
-	_vm->_voy._incriminate = _vm->_voy._newIncriminate;
 	_vm->_voy._mouseClicked = _vm->_voy._newMouseClicked;
-	_vm->_voy._fadeFunc = _vm->_voy._newFadeFunc;
-	_vm->_voy._fadeICF1 = _vm->_voy._newFadeICF1;
+	_vm->_voy._leftClick = _vm->_voy._newLeftClick;
+	_vm->_voy._rightClick = _vm->_voy._newRightClick;
+	_vm->_voy._mouseUnk = _vm->_voy._newMouseUnk;
 }
 
 void EventsManager::checkForKey() {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 1e4559c..6b7d4e8 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -125,17 +125,15 @@ public:
 	int _curICF0;
 	int _curICF1;
 	int _fadeICF0;
-	int _fadeICF1;
-	void (*_fadeFunc)();
+	bool _leftClick, _rightClick;
 	bool _mouseClicked;
-	int _incriminate;
+	bool _mouseUnk;
 	int _policeEvent;
 
 	// Fields not originally in _voy, but I'm putting in for convenience
-	int _newIncriminate;
 	bool _newMouseClicked;
-	int _newFadeICF1;
-	void (*_newFadeFunc)();
+	bool _newLeftClick, _newRightClick;
+	bool _newMouseUnk;
 };
 
 class IntData {
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 944c9db..49b271e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -406,7 +406,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._field478 |= 16;
 					_vm->_eventsManager.startCursorBlink();
 
-					while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
+					while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && 
 							_vm->_soundManager.getVOCStatus())
 						_vm->_eventsManager.delayClick(1);
 
@@ -460,7 +460,7 @@ void ThreadResource::parsePlayCommands() {
 					}
 
 					_vm->_eventsManager._videoDead = -1;
-					if (_field42 == 2 && _vm->_voy._incriminate == 0) {
+					if (_field42 == 2 && _vm->_voy._mouseClicked == 0) {
 						_vm->_voy._field470 = 132;
 						parseIndex = 999;
 					} else {
@@ -515,7 +515,7 @@ void ThreadResource::parsePlayCommands() {
 					Common::String file = Common::String::format("news%d.voc", i + 1);
 					_vm->_soundManager.startVOCPlay(file);
 
-					while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
+					while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked &&
 							_vm->_soundManager.getVOCStatus()) {
 						_vm->_eventsManager.delayClick(1);
 						_vm->_eventsManager.getMouseInfo();
@@ -526,7 +526,7 @@ void ThreadResource::parsePlayCommands() {
 					if (i == (count - 1))
 						_vm->_eventsManager.delay(480);
 
-					if (_vm->shouldQuit() || _vm->_voy._incriminate)
+					if (_vm->shouldQuit() || _vm->_voy._mouseClicked)
 						break;
 				}
 
@@ -706,7 +706,7 @@ void ThreadResource::parsePlayCommands() {
 
 				Common::String fname = Common::String::format("news%d.voc", idx);
 
-				while (!_vm->shouldQuit() && !_vm->_voy._incriminate && 
+				while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && 
 						_vm->_soundManager.getVOCStatus())
 					_vm->_eventsManager.delay(1);
 
@@ -714,7 +714,7 @@ void ThreadResource::parsePlayCommands() {
 				if (idx == 3)
 					_vm->_eventsManager.delay(3);
 
-				if (_vm->shouldQuit() || _vm->_voy._incriminate)
+				if (_vm->shouldQuit() || _vm->_voy._mouseClicked)
 					break;
 			}
 
@@ -1107,7 +1107,7 @@ int ThreadResource::doApt() {
 
 		_vm->flipPageAndWait();
 
-	} while (!_vm->shouldQuit() && (!_vm->_voy._mouseClicked || hotspotId == -1));
+	} while (!_vm->shouldQuit() && (!_vm->_voy._leftClick || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();
 	_doAptPosX = pt.x;
@@ -1231,10 +1231,10 @@ void ThreadResource::doRoom() {
 			vm._eventsManager._intPtr._hasPalette = true;
 			vm._graphicsManager.flipPage();
 			vm._eventsManager.sWaitFlip();
-		} while (!vm.shouldQuit() && !voy._incriminate);
+		} while (!vm.shouldQuit() && !voy._mouseClicked);
 
-		if (!voy._mouseClicked || i4e4 == -1) {
-			if (voy._fadeFunc)
+		if (!voy._leftClick || i4e4 == -1) {
+			if (voy._rightClick)
 				breakFlag = true;
 
 			Common::Point pt = vm._eventsManager.getMousePos();
@@ -1258,7 +1258,7 @@ void ThreadResource::doRoom() {
 
 				vm._eventsManager.addComputerEventStart();
 
-				voy._incriminate = false;
+				voy._mouseClicked = false;
 				vm._eventsManager.startCursorBlink();
 
 				int v = vm.doComputerText(9999); 
@@ -1271,7 +1271,7 @@ void ThreadResource::doRoom() {
 			}
 
 			voy._field478 &= ~0x10;
-			if (!voy._incriminate)
+			if (!voy._mouseClicked)
 				vm._eventsManager.delayClick(18000);
 
 			vm._bVoy->freeBoltGroup(vm._playStamp1);
@@ -1487,7 +1487,7 @@ int ThreadResource::doInterface() {
 
 		pt = _vm->_eventsManager.getMousePos();
 		if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) &&
-				(_vm->_voy._fadeFunc != NULL) && (pt.x == 0))) {
+				(_vm->_voy._rightClick != NULL) && (pt.x == 0))) {
 			_vm->_eventsManager.getMouseInfo();
 
 			if (_vm->_voy._transitionId == 15) {
@@ -1495,7 +1495,7 @@ int ThreadResource::doInterface() {
 				_vm->_voy._transitionId = 17;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->checkTransition();
-				_vm->_voy._mouseClicked = true;
+				_vm->_voy._leftClick = true;
 			} else {
 				_vm->_voy._field478 = 1;
 				_currentMouseX = pt.x;
@@ -1518,15 +1518,15 @@ int ThreadResource::doInterface() {
 				_vm->_eventsManager._intPtr.field1A = 0;
 			}
 		}
-	} while (!_vm->_voy._fadeFunc && !_vm->shouldQuit() && 
-		(!_vm->_voy._mouseClicked || regionIndex == -1));
+	} while (!_vm->_voy._rightClick && !_vm->shouldQuit() && 
+		(!_vm->_voy._leftClick || regionIndex == -1));
 
 	_vm->_voy._field478 |= 1;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
 	if (_vm->_playStamp2 != -1)
 		_vm->_soundManager.stopVOCPlay();
 
-	return !_vm->_voy._fadeFunc ? regionIndex : -2;
+	return !_vm->_voy._rightClick ? regionIndex : -2;
 }
 
 bool ThreadResource::goToStateID(int stackId, int sceneId) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 7778614..966ce77 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -184,12 +184,12 @@ bool VoyeurEngine::doHeadTitle() {
 //	showTitleScreen();
 
 	// Opening
-	if (!_voy._incriminate) {
+	if (!_voy._mouseClicked) {
 //		doOpening();
 //		doTransitionCard("Saturday Afternoon", "Player's Apartment");
 		_eventsManager.delayClick(90);
 	} else {
-		_voy._incriminate = false;
+		_voy._mouseClicked = false;
 	}
 
 	if (_voy._field478 & 0x80) {
@@ -341,8 +341,8 @@ bool VoyeurEngine::doLock() {
 					_eventsManager._intPtr._hasPalette = true;
 
 					_eventsManager.delay(1);
-				} while (!shouldQuit() && !_voy._incriminate);
-				_voy._incriminate = false;
+				} while (!shouldQuit() && !_voy._mouseClicked);
+				_voy._mouseClicked = false;
 			} while (!shouldQuit() && key == -1);
 
 			_soundManager.abortVOCMap();
@@ -493,7 +493,7 @@ void VoyeurEngine::doOpening() {
 	decoder.loadFile("a2300100.rl2");
 	decoder.start();
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -517,7 +517,7 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	decoder.loadFile(filename);
 	decoder.start();
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -554,7 +554,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate &&
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked &&
 			(decoder.getCurFrame() < endFrame)) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index f0e81e9..a7fab19 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -143,7 +143,7 @@ void VoyeurEngine::playStamp() {
 				_graphicsManager._backColors = _bVoy->boltEntry(_playStamp1 + 1)._cMapResource;
 
 				buttonId = getChooseButton();
-				if (_voy._fadeFunc)
+				if (_voy._rightClick)
 					buttonId = 4;
 
 				_bVoy->freeBoltGroup(_playStamp1);
@@ -349,7 +349,7 @@ void VoyeurEngine::reviewTape() {
 				if ((tempPos.y - 31) % 15 >= 12 || (si + foundIndex) >= _voy._eventCount) {
 					_eventsManager.setCursorColor(128, 0);
 					foundIndex = 999;
-				} else if (!_voy._mouseClicked) {
+				} else if (!_voy._leftClick) {
 					_eventsManager.setCursorColor(128, 2);
 					foundIndex = 999;
 				} else {
@@ -408,7 +408,7 @@ void VoyeurEngine::reviewTape() {
 			_eventsManager._intPtr.field38 = true;
 			_eventsManager._intPtr._hasPalette = true;
 
-			if (_voy._incriminate || _voy._fadeICF1) {
+			if (_voy._mouseClicked || _voy._mouseUnk) {
 				switch (foundIndex) {
 				case 2:
 					if (si > 0) {
@@ -455,17 +455,17 @@ void VoyeurEngine::reviewTape() {
 			}
 
 			pt = _eventsManager.getMousePos();
-			if (_voy._incriminate && _voy._viewBounds->left == pt.x &&
-					(_voy._field478 & 0x40) && _voy._fadeFunc) {
+			if (_voy._mouseClicked && _voy._viewBounds->left == pt.x &&
+					(_voy._field478 & 0x40) && _voy._rightClick) {
 				WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
 				foundIndex = -1;
-				_voy._fadeFunc = 0;
+				_voy._rightClick = 0;
 			}
 			
-			if (_voy._fadeFunc)
+			if (_voy._rightClick)
 				foundIndex = 0;
 
-		} while (!shouldQuit() && (!_voy._incriminate || foundIndex == -1));
+		} while (!shouldQuit() && (!_voy._mouseClicked || foundIndex == -1));
 
 
 
@@ -503,7 +503,7 @@ void VoyeurEngine::doGossip() {
 	// Main playback loop
 	int picCtr = 0;
 	decoder.start();
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -532,7 +532,7 @@ void VoyeurEngine::doGossip() {
 	decoder.loadFile("a2110100.rl2");
 	decoder.start();
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -570,7 +570,7 @@ void VoyeurEngine::doTapePlaying() {
 	cycle->vStartCycle();
 
 	_soundManager.startVOCPlay("vcr.voc");
-	while (!shouldQuit() && !_voy._incriminate && _soundManager.getVOCStatus()) {
+	while (!shouldQuit() && !_voy._mouseClicked && _soundManager.getVOCStatus()) {
 		_eventsManager.delayClick(2);
 	}
 
@@ -733,8 +733,8 @@ int VoyeurEngine::getChooseButton()  {
 				Common::Point(pt.x + 13, pt.y - 12));
 
 			flipPageAndWait();
-		} while (!shouldQuit() && !_voy._incriminate);
-	} while (!shouldQuit() && selectedIndex == -1 && !_voy._fadeFunc);
+		} while (!shouldQuit() && !_voy._mouseClicked);
+	} while (!shouldQuit() && selectedIndex == -1 && !_voy._rightClick);
 
 	return selectedIndex;
 }
@@ -991,7 +991,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 			_eventsManager.getMouseInfo();
 			++totalChars;
 
-		} while (!shouldQuit() && !_voy._incriminate && totalChars < maxLen);
+		} while (!shouldQuit() && !_voy._mouseClicked && totalChars < maxLen);
 
 		_voy._field4EE = 0;
 	}
@@ -1116,10 +1116,9 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	_eventsManager.getMouseInfo();
 
 	int arrIndex = 0;
-	bool breakFlag = _voy._fadeFunc != NULL;
 	int evidIdx = evidId;
 
-	while (!shouldQuit() && !breakFlag) {
+	while (!shouldQuit() && !_voy._rightClick) {
 		if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
 			if (_voy._vocSecondsOffset > 60)
 				_voy._vocSecondsOffset = 0;
@@ -1128,7 +1127,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		}
 
 		_eventsManager.delay(600);
-		if (_voy._fadeFunc)
+		if (_voy._rightClick)
 			break;
 		if (count == 0 || evidIdx >= eventId)
 			continue;


Commit: 8fa75375d417ee8b52b6b0ca71d58771c5093e16
    https://github.com/scummvm/scummvm/commit/8fa75375d417ee8b52b6b0ca71d58771c5093e16
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T01:32:17-08:00

Commit Message:
VOYEUR: Bugfixes for doEvidDisplay

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 94f137e..6b2b496 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -217,12 +217,11 @@ void EventsManager::delayClick(int cycles) {
 	uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE;
 	uint32 delayEnd = g_system->getMillis() + totalMilli;
 
-	while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd 
-			&& !_vm->_voy._mouseClicked) {
+	do {
 		g_system->delayMillis(10);
-
-		pollEvents();
-	}
+		getMouseInfo();
+	} while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd 
+			&& !_vm->_voy._mouseClicked);
 }
 
 void EventsManager::pollEvents() {
@@ -462,6 +461,11 @@ void EventsManager::getMouseInfo() {
 	_vm->_voy._leftClick = _vm->_voy._newLeftClick;
 	_vm->_voy._rightClick = _vm->_voy._newRightClick;
 	_vm->_voy._mouseUnk = _vm->_voy._newMouseUnk;
+
+	_vm->_voy._newMouseClicked = false;
+	_vm->_voy._newLeftClick = false;
+	_vm->_voy._newRightClick = false;
+	_vm->_voy._mouseUnk = false;
 }
 
 void EventsManager::checkForKey() {
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index a7fab19..7ea1910 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1085,7 +1085,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	_bVoy->getBoltGroup(_voy._field47A);
 	PictureResource *pic = _bVoy->boltEntry(_voy._field47A + evidId * 2)._picResource;
 	_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(
-		384 - pic->_bounds.width() / 2, 240 - pic->_bounds.height() / 2));
+		(384 - pic->_bounds.width()) / 2, (240 - pic->_bounds.height()) / 2));
 	_bVoy->freeBoltMember(_voy._field47A + evidId * 2);
 
 	CMapResource *pal = _bVoy->boltEntry(_voy._field47A + evidId * 2 + 1)._cMapResource;
@@ -1126,7 +1126,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 			_soundManager.startVOCPlay(_playStamp2);
 		}
 
-		_eventsManager.delay(600);
+		_eventsManager.delayClick(600);
 		if (_voy._rightClick)
 			break;
 		if (count == 0 || evidIdx >= eventId)


Commit: aa42e7d2bdd9f368ca9941309a19027afe54a30f
    https://github.com/scummvm/scummvm/commit/aa42e7d2bdd9f368ca9941309a19027afe54a30f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T01:40:53-08:00

Commit Message:
VOYEUR: Fix data needed for drawDot

Changed paths:
    engines/voyeur/staticres.cpp



diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 1ce8a74..d0f590e 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -117,7 +117,7 @@ const char *const END_OF_MESSAGE = "*** End of Message ***";
 const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio" "Evidence", "Computer" };
 
 int DOT_LINE_START[9] = {
-	0E880, 0xE9C0, 0xEB00, 0xEC40, 0xED80, 0xEEC0, 0xF000, 0xF140, 0xF280
+	0xE880, 0xE9C0, 0xEB00, 0xEC40, 0xED80, 0xEEC0, 0xF000, 0xF140, 0xF280
 };
 int DOT_LINE_OFFSET[9] = {
 	144, 143, 142, 141, 141, 141, 142, 143, 144


Commit: d763f838622c010a4ebd8ecfc2be183b1eb5271f
    https://github.com/scummvm/scummvm/commit/d763f838622c010a4ebd8ecfc2be183b1eb5271f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T01:53:33-08:00

Commit Message:
VOYEUR: Fixes for mouse cursor calls

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 6b2b496..469d80c 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -426,16 +426,12 @@ void EventsManager::setCursorColor(int idx, int mode) {
 	}
 }
 
-void EventsManager::mouseOn() {
+void EventsManager::showCursor() {
 	CursorMan.showMouse(true);
 }
 
-void EventsManager::mouseOff() {
-	CursorMan.showMouse(false);
-}
-
 void EventsManager::hideCursor() {
-	error("TODO: hideCursor");
+	CursorMan.showMouse(false);
 }
 
 void EventsManager::getMouseInfo() {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 6b7d4e8..3d1c577 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -217,8 +217,7 @@ public:
 	void setCursor(PictureResource *pic);
 	void setCursor(byte *cursorData, int width, int height);
 	void setCursorColor(int idx, int mode);
-	void mouseOn();
-	void mouseOff();
+	void showCursor();
 	void hideCursor();
 	Common::Point getMousePos() { return _mousePos; }
 	void getMouseInfo();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 49b271e..6b2b268 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1280,7 +1280,7 @@ void ThreadResource::doRoom() {
 			pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
 			pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
 			vm._graphicsManager._backColors = vm._bVoy->boltEntry(
-				vm._playStamp1 + 2)._cMapResource;
+				vm._playStamp1 + 1)._cMapResource;
 			vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(
 				vm._playStamp1)._picResource;
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index f6829b4..f189d2b 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -718,7 +718,7 @@ void GraphicsManager::fadeUpICF1(int steps) {
 
 void GraphicsManager::fadeDownICF(int steps) {
 	if (steps > 0) {
-		_vm->_eventsManager.mouseOff();
+		_vm->_eventsManager.hideCursor();
 		int stepAmount1 = _vm->_voy._field4376 / steps;
 		int stepAmount2 = _vm->_voy._field4378 / steps;
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 966ce77..f4b83e5 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -285,7 +285,7 @@ bool VoyeurEngine::doLock() {
 		
 		// Set up the cursor
 		_eventsManager.setCursor(cursorPic);
-		_eventsManager.mouseOn();
+		_eventsManager.showCursor();
 
 		_eventsManager._intPtr. field38 = 1;
 		_eventsManager._intPtr._hasPalette = true;
@@ -410,7 +410,7 @@ bool VoyeurEngine::doLock() {
 		_bVoy->freeBoltGroup(0x700);
 	}
 
-	_eventsManager.mouseOff();
+	_eventsManager.hideCursor();
 
 	delete[] buttonVoc;
 	delete[] wrongVoc;


Commit: 2c0a94d174e38ec13b52622e0a79cd9566ac6e35
    https://github.com/scummvm/scummvm/commit/2c0a94d174e38ec13b52622e0a79cd9566ac6e35
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T02:17:57-08:00

Commit Message:
VOYEUR: Fix right click to exit room closeups

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 7ea1910..8a22887 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -101,6 +101,7 @@ void VoyeurEngine::playStamp() {
 
 		case 6:
 			threadP->doRoom();
+			flag = true;
 			break;
 
 		case 16:


Commit: 1256fb6b666a36fbbd8f3223d2c776bca9a3ca83
    https://github.com/scummvm/scummvm/commit/1256fb6b666a36fbbd8f3223d2c776bca9a3ca83
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T14:54:40-08:00

Commit Message:
VOYEUR: Add support for creating a PictureResource from a Graphics::Surface

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 2602ace..9d86c66 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -697,10 +697,12 @@ bool BoltEntry::hasResource() const {
 /*------------------------------------------------------------------------*/
 
 RectResource::RectResource(const byte *src, int size) {
-	int count = 1;
-	if (size != 8) {
+	int count;
+	if ((size % 8) == 2) {
 		count = READ_LE_UINT16(src);
 		src += 2;
+	} else {
+		count = size / 8;
 	}
 
 	for (int i = 0; i < count; ++i, src += 8) {
@@ -815,6 +817,19 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	}
 }
 
+PictureResource::PictureResource(Graphics::Surface *surface) {
+	_flags = 0;
+	_select = 0;
+	_pick = 0;
+	_onOff = 0;
+	_depth = 0;
+	_maskData = 0;
+	_planeSize = 0;
+	
+	_bounds = Common::Rect(0, 0, surface->w, surface->h);
+	_imgData = (byte *)surface->getPixels();
+}
+
 PictureResource::PictureResource() {
 	_flags = 0;
 	_select = 0;
@@ -967,7 +982,7 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRe
 		if (yDiff > 0)
 			r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
 	}
-// clip = (0x20, 0x14, width: 0x140, height: 0C8h
+
 	_activePage = page;
 	_field18 = 0;
 	_clipRect = r;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 8ccfab8..832e157 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -274,6 +274,7 @@ public:
 	PictureResource(BoltFilesState &state, const byte *src);
 	PictureResource(int flags, int select, int pick, int onOff, int depth, 
 		const Common::Rect &bounds, int maskData, byte *imgData, int planeSize);
+	PictureResource::PictureResource(Graphics::Surface *surface);
 	PictureResource();
 	virtual ~PictureResource();
 };


Commit: 10af04da6a9a01d2f1ff5febed86c4c5ca6cfb8d
    https://github.com/scummvm/scummvm/commit/10af04da6a9a01d2f1ff5febed86c4c5ca6cfb8d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-28T14:58:43-08:00

Commit Message:
VOYEUR: Mouse flags cleanup and in progress work on doGossip

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index ce1fc9e..4f8cca5 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -67,7 +67,7 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 }
 
 const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const {
-	const Track *track = getTrack(0);
+	const Track *track = getTrack(1);
 
 	if (track)
 		return ((const RL2VideoTrack *)track)->getDirtyRects();
@@ -76,19 +76,26 @@ const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const {
 }
 
 void RL2Decoder::clearDirtyRects() {
-	Track *track = getTrack(0);
+	Track *track = getTrack(1);
 
 	if (track)
 		((RL2VideoTrack *)track)->clearDirtyRects();
 }
 
 void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
-	Track *track = getTrack(0);
+	Track *track = getTrack(1);
 
 	if (track)
 		((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
 }
 
+Graphics::Surface *RL2Decoder::getVideoSurface() {
+	Track *track = getTrack(1);
+	assert(track);
+
+	return ((RL2VideoTrack *)track)->getSurface();
+}
+
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2FileHeader::RL2FileHeader() {
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index b06e3cb..feaaf21 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -78,7 +78,7 @@ public:
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
-
+	Graphics::Surface *getVideoSurface();
 private:
 	class RL2AudioTrack : public AudioTrack {
 	public:
@@ -112,6 +112,7 @@ private:
 
 		uint16 getWidth() const;
 		uint16 getHeight() const;
+		Graphics::Surface *getSurface() { return _surface; }
 		Graphics::PixelFormat getPixelFormat() const;
 		int getCurFrame() const { return _curFrame; }
 		int getFrameCount() const { return _header._numFrames; }
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 469d80c..890eaea 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -74,6 +74,11 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_priorFrameTime = g_system->getMillis();
 	_joe = 0;
 	Common::fill(&_keyState[0], &_keyState[256], false);
+	
+	_leftClick = _rightClick = false;
+	_mouseClicked = _mouseUnk = false;
+	_newLeftClick = _newRightClick = false;;
+	_newMouseClicked = _newMouseUnk = false;
 
 	_v2A0A2 = 0;
 	_videoComputerBut4 = 0;
@@ -106,11 +111,6 @@ void EventsManager::vStopCycle() {
 }
 
 void EventsManager::sWaitFlip() {
-	while (_gameData._flipWait && !_vm->shouldQuit()) {
-		pollEvents();
-		g_system->delayMillis(10);
-	}
-
 	Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries;
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
 		ViewPortResource &viewPort = *viewPorts[idx];
@@ -128,6 +128,11 @@ void EventsManager::sWaitFlip() {
 			viewPort._flags &= ~DISPFLAG_40;
 		}
 	}
+
+	while (_gameData._flipWait && !_vm->shouldQuit()) {
+		pollEvents();
+		g_system->delayMillis(10);
+	}
 }
 
 void EventsManager::checkForNextFrameCounter() {
@@ -221,7 +226,7 @@ void EventsManager::delayClick(int cycles) {
 		g_system->delayMillis(10);
 		getMouseInfo();
 	} while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd 
-			&& !_vm->_voy._mouseClicked);
+			&& !_vm->_eventsManager._mouseClicked);
 }
 
 void EventsManager::pollEvents() {
@@ -243,19 +248,19 @@ void EventsManager::pollEvents() {
 			return;
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButton = 1;
-			_vm->_voy._newLeftClick = true;
-			_vm->_voy._newMouseClicked = true;
+			_vm->_eventsManager._newLeftClick = true;
+			_vm->_eventsManager._newMouseClicked = true;
 			return;
 		case Common::EVENT_RBUTTONDOWN:
 			_mouseButton = 2;
-			_vm->_voy._newRightClick = true;
-			_vm->_voy._newMouseClicked = true;
+			_vm->_eventsManager._newRightClick = true;
+			_vm->_eventsManager._newMouseClicked = true;
 			return;
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONUP:
-			_vm->_voy._newMouseClicked = false;
-			_vm->_voy._newLeftClick = false;
-			_vm->_voy._newRightClick = false;
+			_vm->_eventsManager._newMouseClicked = false;
+			_vm->_eventsManager._newLeftClick = false;
+			_vm->_eventsManager._newRightClick = false;
 			_mouseButton = 0;
 			return;
 		case Common::EVENT_MOUSEMOVE:
@@ -453,15 +458,15 @@ void EventsManager::getMouseInfo() {
 		}
 	}
 
-	_vm->_voy._mouseClicked = _vm->_voy._newMouseClicked;
-	_vm->_voy._leftClick = _vm->_voy._newLeftClick;
-	_vm->_voy._rightClick = _vm->_voy._newRightClick;
-	_vm->_voy._mouseUnk = _vm->_voy._newMouseUnk;
+	_vm->_eventsManager._mouseClicked = _vm->_eventsManager._newMouseClicked;
+	_vm->_eventsManager._leftClick = _vm->_eventsManager._newLeftClick;
+	_vm->_eventsManager._rightClick = _vm->_eventsManager._newRightClick;
+	_vm->_eventsManager._mouseUnk = _vm->_eventsManager._newMouseUnk;
 
-	_vm->_voy._newMouseClicked = false;
-	_vm->_voy._newLeftClick = false;
-	_vm->_voy._newRightClick = false;
-	_vm->_voy._mouseUnk = false;
+	_vm->_eventsManager._newMouseClicked = false;
+	_vm->_eventsManager._newLeftClick = false;
+	_vm->_eventsManager._newRightClick = false;
+	_vm->_eventsManager._mouseUnk = false;
 }
 
 void EventsManager::checkForKey() {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 3d1c577..487d59e 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -125,15 +125,7 @@ public:
 	int _curICF0;
 	int _curICF1;
 	int _fadeICF0;
-	bool _leftClick, _rightClick;
-	bool _mouseClicked;
-	bool _mouseUnk;
 	int _policeEvent;
-
-	// Fields not originally in _voy, but I'm putting in for convenience
-	bool _newMouseClicked;
-	bool _newLeftClick, _newRightClick;
-	bool _newMouseUnk;
 };
 
 class IntData {
@@ -193,6 +185,13 @@ public:
 	int _fadeCount;
 	int _fadeStatus;
 
+	bool _leftClick, _rightClick;
+	bool _mouseClicked;
+	bool _mouseUnk;
+	bool _newMouseClicked;
+	bool _newLeftClick, _newRightClick;
+	bool _newMouseUnk;
+
 	int _v2A0A2;
 	int _videoComputerBut4;
 	int _videoDead;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 6b2b268..1d04ddc 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -406,7 +406,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._field478 |= 16;
 					_vm->_eventsManager.startCursorBlink();
 
-					while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && 
+					while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && 
 							_vm->_soundManager.getVOCStatus())
 						_vm->_eventsManager.delayClick(1);
 
@@ -460,7 +460,7 @@ void ThreadResource::parsePlayCommands() {
 					}
 
 					_vm->_eventsManager._videoDead = -1;
-					if (_field42 == 2 && _vm->_voy._mouseClicked == 0) {
+					if (_field42 == 2 && _vm->_eventsManager._mouseClicked == 0) {
 						_vm->_voy._field470 = 132;
 						parseIndex = 999;
 					} else {
@@ -515,7 +515,7 @@ void ThreadResource::parsePlayCommands() {
 					Common::String file = Common::String::format("news%d.voc", i + 1);
 					_vm->_soundManager.startVOCPlay(file);
 
-					while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked &&
+					while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked &&
 							_vm->_soundManager.getVOCStatus()) {
 						_vm->_eventsManager.delayClick(1);
 						_vm->_eventsManager.getMouseInfo();
@@ -526,7 +526,7 @@ void ThreadResource::parsePlayCommands() {
 					if (i == (count - 1))
 						_vm->_eventsManager.delay(480);
 
-					if (_vm->shouldQuit() || _vm->_voy._mouseClicked)
+					if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked)
 						break;
 				}
 
@@ -706,7 +706,7 @@ void ThreadResource::parsePlayCommands() {
 
 				Common::String fname = Common::String::format("news%d.voc", idx);
 
-				while (!_vm->shouldQuit() && !_vm->_voy._mouseClicked && 
+				while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && 
 						_vm->_soundManager.getVOCStatus())
 					_vm->_eventsManager.delay(1);
 
@@ -714,7 +714,7 @@ void ThreadResource::parsePlayCommands() {
 				if (idx == 3)
 					_vm->_eventsManager.delay(3);
 
-				if (_vm->shouldQuit() || _vm->_voy._mouseClicked)
+				if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked)
 					break;
 			}
 
@@ -1107,7 +1107,7 @@ int ThreadResource::doApt() {
 
 		_vm->flipPageAndWait();
 
-	} while (!_vm->shouldQuit() && (!_vm->_voy._leftClick || hotspotId == -1));
+	} while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();
 	_doAptPosX = pt.x;
@@ -1231,10 +1231,10 @@ void ThreadResource::doRoom() {
 			vm._eventsManager._intPtr._hasPalette = true;
 			vm._graphicsManager.flipPage();
 			vm._eventsManager.sWaitFlip();
-		} while (!vm.shouldQuit() && !voy._mouseClicked);
+		} while (!vm.shouldQuit() && !vm._eventsManager._mouseClicked);
 
-		if (!voy._leftClick || i4e4 == -1) {
-			if (voy._rightClick)
+		if (!vm._eventsManager._leftClick || i4e4 == -1) {
+			if (vm._eventsManager._rightClick)
 				breakFlag = true;
 
 			Common::Point pt = vm._eventsManager.getMousePos();
@@ -1258,7 +1258,7 @@ void ThreadResource::doRoom() {
 
 				vm._eventsManager.addComputerEventStart();
 
-				voy._mouseClicked = false;
+				vm._eventsManager._mouseClicked = false;
 				vm._eventsManager.startCursorBlink();
 
 				int v = vm.doComputerText(9999); 
@@ -1271,7 +1271,7 @@ void ThreadResource::doRoom() {
 			}
 
 			voy._field478 &= ~0x10;
-			if (!voy._mouseClicked)
+			if (!vm._eventsManager._mouseClicked)
 				vm._eventsManager.delayClick(18000);
 
 			vm._bVoy->freeBoltGroup(vm._playStamp1);
@@ -1487,7 +1487,7 @@ int ThreadResource::doInterface() {
 
 		pt = _vm->_eventsManager.getMousePos();
 		if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) &&
-				(_vm->_voy._rightClick != NULL) && (pt.x == 0))) {
+				(_vm->_eventsManager._rightClick != NULL) && (pt.x == 0))) {
 			_vm->_eventsManager.getMouseInfo();
 
 			if (_vm->_voy._transitionId == 15) {
@@ -1495,7 +1495,7 @@ int ThreadResource::doInterface() {
 				_vm->_voy._transitionId = 17;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->checkTransition();
-				_vm->_voy._leftClick = true;
+				_vm->_eventsManager._leftClick = true;
 			} else {
 				_vm->_voy._field478 = 1;
 				_currentMouseX = pt.x;
@@ -1518,15 +1518,15 @@ int ThreadResource::doInterface() {
 				_vm->_eventsManager._intPtr.field1A = 0;
 			}
 		}
-	} while (!_vm->_voy._rightClick && !_vm->shouldQuit() && 
-		(!_vm->_voy._leftClick || regionIndex == -1));
+	} while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && 
+		(!_vm->_eventsManager._leftClick || regionIndex == -1));
 
 	_vm->_voy._field478 |= 1;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
 	if (_vm->_playStamp2 != -1)
 		_vm->_soundManager.stopVOCPlay();
 
-	return !_vm->_voy._rightClick ? regionIndex : -2;
+	return !_vm->_eventsManager._rightClick ? regionIndex : -2;
 }
 
 bool ThreadResource::goToStateID(int stackId, int sceneId) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index f4b83e5..b2256f0 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -184,12 +184,12 @@ bool VoyeurEngine::doHeadTitle() {
 //	showTitleScreen();
 
 	// Opening
-	if (!_voy._mouseClicked) {
+	if (!_eventsManager._mouseClicked) {
 //		doOpening();
 //		doTransitionCard("Saturday Afternoon", "Player's Apartment");
 		_eventsManager.delayClick(90);
 	} else {
-		_voy._mouseClicked = false;
+		_eventsManager._mouseClicked = false;
 	}
 
 	if (_voy._field478 & 0x80) {
@@ -341,8 +341,8 @@ bool VoyeurEngine::doLock() {
 					_eventsManager._intPtr._hasPalette = true;
 
 					_eventsManager.delay(1);
-				} while (!shouldQuit() && !_voy._mouseClicked);
-				_voy._mouseClicked = false;
+				} while (!shouldQuit() && !_eventsManager._mouseClicked);
+				_eventsManager._mouseClicked = false;
 			} while (!shouldQuit() && key == -1);
 
 			_soundManager.abortVOCMap();
@@ -493,7 +493,7 @@ void VoyeurEngine::doOpening() {
 	decoder.loadFile("a2300100.rl2");
 	decoder.start();
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -517,7 +517,7 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	decoder.loadFile(filename);
 	decoder.start();
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -554,7 +554,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked &&
+	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked &&
 			(decoder.getCurFrame() < endFrame)) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 8a22887..8f49680 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -144,7 +144,7 @@ void VoyeurEngine::playStamp() {
 				_graphicsManager._backColors = _bVoy->boltEntry(_playStamp1 + 1)._cMapResource;
 
 				buttonId = getChooseButton();
-				if (_voy._rightClick)
+				if (_eventsManager._rightClick)
 					buttonId = 4;
 
 				_bVoy->freeBoltGroup(_playStamp1);
@@ -350,7 +350,7 @@ void VoyeurEngine::reviewTape() {
 				if ((tempPos.y - 31) % 15 >= 12 || (si + foundIndex) >= _voy._eventCount) {
 					_eventsManager.setCursorColor(128, 0);
 					foundIndex = 999;
-				} else if (!_voy._leftClick) {
+				} else if (!_eventsManager._leftClick) {
 					_eventsManager.setCursorColor(128, 2);
 					foundIndex = 999;
 				} else {
@@ -409,7 +409,7 @@ void VoyeurEngine::reviewTape() {
 			_eventsManager._intPtr.field38 = true;
 			_eventsManager._intPtr._hasPalette = true;
 
-			if (_voy._mouseClicked || _voy._mouseUnk) {
+			if (_eventsManager._mouseClicked || _eventsManager._mouseUnk) {
 				switch (foundIndex) {
 				case 2:
 					if (si > 0) {
@@ -456,17 +456,17 @@ void VoyeurEngine::reviewTape() {
 			}
 
 			pt = _eventsManager.getMousePos();
-			if (_voy._mouseClicked && _voy._viewBounds->left == pt.x &&
-					(_voy._field478 & 0x40) && _voy._rightClick) {
+			if (_eventsManager._mouseClicked && _voy._viewBounds->left == pt.x &&
+					(_voy._field478 & 0x40) && _eventsManager._rightClick) {
 				WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
 				foundIndex = -1;
-				_voy._rightClick = 0;
+				_eventsManager._rightClick = 0;
 			}
 			
-			if (_voy._rightClick)
+			if (_eventsManager._rightClick)
 				foundIndex = 0;
 
-		} while (!shouldQuit() && (!_voy._mouseClicked || foundIndex == -1));
+		} while (!shouldQuit() && (!_eventsManager._mouseClicked || foundIndex == -1));
 
 
 
@@ -487,42 +487,50 @@ void VoyeurEngine::doGossip() {
 	if (!_bVoy->getBoltGroup(0x300))
 		return;
 
-	PictureResource *pic = _bVoy->boltEntry(0x300)._picResource;
-	(*_graphicsManager._vPort)->setupViewPort(pic);
-	CMapResource *pal = _bVoy->boltEntry(0x301)._cMapResource;
-	pal->startFade();
-
-	flipPageAndWaitForFade();
-
 	// Load the gossip animation
 	::Video::RL2Decoder decoder;
 	decoder.loadFile("a2050100.rl2");
+	decoder.start();
+
+	PictureResource *bgPic = _bVoy->boltEntry(0x300)._picResource;
+	CMapResource *pal = _bVoy->boltEntry(0x301)._cMapResource;
+	pal->startFade();
+
+	// Transfer initial background to video decoder
+	PictureResource videoFrame(decoder.getVideoSurface());
+	_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20)); 
 
 	byte *frameNumsP = _bVoy->memberAddr(0x309);
-	byte *posP = _bVoy->memberAddr(0x30A);
+	byte *posP = _bVoy->boltEntry(0x30A)._data;
 
 	// Main playback loop
+
 	int picCtr = 0;
 	decoder.start();
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
 		}
 		
 		if (decoder.needsUpdate()) {
-			const Graphics::Surface *frame = decoder.decodeNextFrame();
-
-			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
-				(byte *)_graphicsManager._screenSurface.getPixels());
-
+			// If reached a point where a new background is needed, load it
+			// and copy over to the video decoder
 			if (decoder.getCurFrame() >= READ_LE_UINT16(frameNumsP + picCtr * 4)) {
-				PictureResource *pic = _bVoy->boltEntry(0x302 + picCtr)._picResource;
+				PictureResource *newBgPic = _bVoy->boltEntry(0x302 + picCtr)._picResource;
 				Common::Point pt(READ_LE_UINT16(posP + 4 * picCtr + 2), 
 					READ_LE_UINT16(posP + 4 * picCtr));
-				_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, pt);
+
+				_graphicsManager.sDrawPic(newBgPic, &videoFrame, pt);
+				++picCtr;
 			}
 
+			// Decode the next frame and display
+			const Graphics::Surface *frame = decoder.decodeNextFrame();
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+				(byte *)_graphicsManager._screenSurface.getPixels());
+
+
 			flipPageAndWait();
 		}
 
@@ -533,7 +541,7 @@ void VoyeurEngine::doGossip() {
 	decoder.loadFile("a2110100.rl2");
 	decoder.start();
 
-	while (!shouldQuit() && !decoder.endOfVideo() && !_voy._mouseClicked) {
+	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
 			_graphicsManager.setPalette(palette, 0, 256);
@@ -571,7 +579,7 @@ void VoyeurEngine::doTapePlaying() {
 	cycle->vStartCycle();
 
 	_soundManager.startVOCPlay("vcr.voc");
-	while (!shouldQuit() && !_voy._mouseClicked && _soundManager.getVOCStatus()) {
+	while (!shouldQuit() && !_eventsManager._mouseClicked && _soundManager.getVOCStatus()) {
 		_eventsManager.delayClick(2);
 	}
 
@@ -734,8 +742,8 @@ int VoyeurEngine::getChooseButton()  {
 				Common::Point(pt.x + 13, pt.y - 12));
 
 			flipPageAndWait();
-		} while (!shouldQuit() && !_voy._mouseClicked);
-	} while (!shouldQuit() && selectedIndex == -1 && !_voy._rightClick);
+		} while (!shouldQuit() && !_eventsManager._mouseClicked);
+	} while (!shouldQuit() && selectedIndex == -1 && !_eventsManager._rightClick);
 
 	return selectedIndex;
 }
@@ -992,7 +1000,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 			_eventsManager.getMouseInfo();
 			++totalChars;
 
-		} while (!shouldQuit() && !_voy._mouseClicked && totalChars < maxLen);
+		} while (!shouldQuit() && !_eventsManager._mouseClicked && totalChars < maxLen);
 
 		_voy._field4EE = 0;
 	}
@@ -1119,7 +1127,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	int arrIndex = 0;
 	int evidIdx = evidId;
 
-	while (!shouldQuit() && !_voy._rightClick) {
+	while (!shouldQuit() && !_eventsManager._rightClick) {
 		if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
 			if (_voy._vocSecondsOffset > 60)
 				_voy._vocSecondsOffset = 0;
@@ -1128,7 +1136,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		}
 
 		_eventsManager.delayClick(600);
-		if (_voy._rightClick)
+		if (_eventsManager._rightClick)
 			break;
 		if (count == 0 || evidIdx >= eventId)
 			continue;


Commit: 3fd1abbe324a5386608fea083b15d2bd9c02e3c7
    https://github.com/scummvm/scummvm/commit/3fd1abbe324a5386608fea083b15d2bd9c02e3c7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T02:12:03-08:00

Commit Message:
VOYEUR: Implemented playAVideo code, and support for RLV3 videos

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 4f8cca5..4099ea8 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -37,7 +37,8 @@ RL2Decoder::~RL2Decoder() {
 }
 
 bool RL2Decoder::loadVideo(int videoId) {
-	Common::String filename = Common::String::format("%s.rl2", ::Voyeur::SZ_FILENAMES[videoId]);
+	Common::String filename = Common::String::format("%s.rl2", 
+		::Voyeur::SZ_FILENAMES[videoId * 2]);
 	return loadFile(filename);
 }
 
@@ -161,7 +162,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
-	if (header._backSize == 0) {
+	if (header._backSize == 0 || !strncmp((char *)&header._signature, "RLV3", 4)) {
 		_backSurface = NULL;
 	} else {
 		_backSurface = new Graphics::Surface();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index b2256f0..dbd48f7 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -535,14 +535,18 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 	}
 }
 
+void VoyeurEngine::playAVideo(int videoId) {
+	playAVideoDuration(videoId, 9999);
+}
+
 void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	byte *dataP = NULL;
 	int totalFrames = duration * 10;
 
-	if (videoId != -1)
+	if (videoId == -1)
 		return;
 
-	if (videoId != 42) {
+	if (videoId == 42) {
 		_eventsManager._videoDead = 0;
 		dataP = _bVoy->memberAddr(0xE00);
 	}
@@ -625,10 +629,6 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
 	flipPageAndWait();
 }
 
-void VoyeurEngine::playAVideo(int id) {
-	warning("TODO: playAVideo");
-}
-
 void VoyeurEngine::saveLastInplay() {
 	LockClass lock;
 	lock.getThePassword();
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index f18ec4b..2dde65c 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -143,7 +143,7 @@ public:
 
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
-	void playAVideo(int id);
+	void playAVideo(int videoId);
 	void playAVideoDuration(int videoId, int duration);
 
 	/**
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 8f49680..46b4ef6 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -498,8 +498,11 @@ void VoyeurEngine::doGossip() {
 
 	// Transfer initial background to video decoder
 	PictureResource videoFrame(decoder.getVideoSurface());
-	_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20)); 
+	_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20));
 
+	flipPageAndWait();
+
+	/*
 	byte *frameNumsP = _bVoy->memberAddr(0x309);
 	byte *posP = _bVoy->boltEntry(0x30A)._data;
 
@@ -557,7 +560,7 @@ void VoyeurEngine::doGossip() {
 		_eventsManager.pollEvents();
 		g_system->delayMillis(10);
 	}
-
+	*/
 	_bVoy->freeBoltGroup(0x300);
 	_graphicsManager.screenReset();
 }


Commit: beb64fe5278c7a97bb52499446a868ad2ec81d77
    https://github.com/scummvm/scummvm/commit/beb64fe5278c7a97bb52499446a868ad2ec81d77
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T12:33:36-08:00

Commit Message:
VOYEUR: Adding support for manually set backgrounds to RL2 playback

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 4099ea8..0fce36d 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -90,11 +90,11 @@ void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
 		((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
 }
 
-Graphics::Surface *RL2Decoder::getVideoSurface() {
+RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
 	Track *track = getTrack(1);
 	assert(track);
 
-	return ((RL2VideoTrack *)track)->getSurface();
+	return (RL2VideoTrack *)track;
 }
 
 /*------------------------------------------------------------------------*/
@@ -162,12 +162,11 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
-	if (header._backSize == 0 || !strncmp((char *)&header._signature, "RLV3", 4)) {
-		_backSurface = NULL;
-	} else {
-		_backSurface = new Graphics::Surface();
-		_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
-	}
+
+	_backSurface = NULL;
+	_hasBackFrame = header._backSize != 0 && strncmp((char *)&header._signature, "RLV3", 4);
+	if (_hasBackFrame)
+		initBackSurface();
 
 	_videoBase = header._videoBase;
 	_dirtyPalette = true;
@@ -187,6 +186,11 @@ RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
 	}
 }
 
+void RL2Decoder::RL2VideoTrack::initBackSurface() {
+	_backSurface = new Graphics::Surface();
+	_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+}
+
 bool RL2Decoder::RL2VideoTrack::endOfTrack() const {
 	return getCurFrame() >= getFrameCount();
 }
@@ -211,7 +215,7 @@ Graphics::PixelFormat RL2Decoder::RL2VideoTrack::getPixelFormat() const {
 }
 
 const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
-	if (_curFrame == 0 && _backSurface) {
+	if (_curFrame == 0 && _hasBackFrame) {
 		// Read in the background frame
 		_fileStream->seek(0x324);
 		rl2DecodeFrameWithoutBackground(0);
@@ -228,7 +232,7 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 	_fileStream->seek(_header._frameSoundSizes[_curFrame], SEEK_CUR);
 
 	// Decode the graphic data
-	if (_backSurface) {
+	if (_hasBackFrame) {
 		if (_curFrame > 0)
 			Common::copy((byte *)_backSurface->getPixels(), (byte *)_backSurface->getPixels() + (320 * 200), 
 				(byte *)_surface->getPixels());
@@ -266,22 +270,38 @@ void RL2Decoder::RL2VideoTrack::copyFrame(uint8 *data) {
 void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutBackground(int screenOffset) {
 	if (screenOffset == -1)
 		screenOffset = _videoBase;
-	byte *destP = (byte *)_surface->getPixels() + screenOffset;
+	const byte *srcP = !_backSurface ? NULL : (const byte *)_backSurface->getPixels();
+	byte *destP = (byte *)_surface->getPixels();
 	int frameSize = _surface->w * _surface->h - screenOffset;
 
+	// If a background was manually set, copy over the initial part remaining unchanged
+	if (srcP && screenOffset > 0) {
+		Common::copy(srcP, srcP + screenOffset, destP);
+		srcP += screenOffset;
+	}
+	destP += screenOffset;
+
+	// Main frame decode loop
 	while (frameSize > 0) {
 		byte nextByte = _fileStream->readByte();
 
 		if (nextByte < 0x80) {
 			*destP++ = nextByte;
 			--frameSize;
+			if (srcP)
+				++srcP;
 		} else if (nextByte == 0x80) {
 			int runLength = _fileStream->readByte();
 			if (runLength == 0)
 				return;
 
 			runLength = MIN(runLength, frameSize);
-			Common::fill(destP, destP + runLength, 0);
+			if (srcP) {
+				Common::copy(srcP, srcP + runLength, destP);
+				srcP += runLength;
+			} else {
+				Common::fill(destP, destP + runLength, 0);
+			}
 			destP += runLength;
 			frameSize -= runLength;
 		} else {
@@ -291,6 +311,8 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutBackground(int screenOffset
 			Common::fill(destP, destP + runLength, nextByte & 0x7f);
 			destP += runLength;
 			frameSize -= runLength;
+			if (srcP)
+				srcP += runLength;
 		}
 	}
 }
@@ -332,6 +354,16 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
 	}
 }
 
+void RL2Decoder::RL2VideoTrack::setupBackSurface(Graphics::Surface *surface) {
+	if (!_backSurface)
+		initBackSurface();
+
+	assert(surface->w == _backSurface->w && surface->h == _backSurface->h);
+	const byte *srcP = (const byte *)surface->getPixels();
+	byte *destP = (byte *)_backSurface->getPixels();
+	Common::copy(srcP, srcP + surface->w * surface->h, destP);
+}
+
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType): 
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index feaaf21..bb3f34a 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -39,7 +39,7 @@ namespace Video {
  *  - voyeur
  */
 class RL2Decoder : public VideoDecoder {
-
+private:
 	class RL2FileHeader {
 	public:
 		uint32 _form;
@@ -65,21 +65,6 @@ class RL2Decoder : public VideoDecoder {
 		bool isValid() const;
 	};
 
-private:
-	Audio::Mixer::SoundType _soundType;
-	RL2FileHeader _header;
-public:
-	RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
-	virtual ~RL2Decoder();
-
-	bool loadStream(Common::SeekableReadStream *stream);
-	bool loadVideo(int videoId);
-
-	const Common::List<Common::Rect> *getDirtyRects() const;
-	void clearDirtyRects();
-	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
-	Graphics::Surface *getVideoSurface();
-private:
 	class RL2AudioTrack : public AudioTrack {
 	public:
 		RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream,
@@ -120,10 +105,10 @@ private:
 		const Graphics::Surface *decodeNextFrame();
 		const byte *getPalette() const { _dirtyPalette = false; return _header._palette; }
 		bool hasDirtyPalette() const { return _dirtyPalette; }
-
 		const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
 		void clearDirtyRects() { _dirtyRects.clear(); }
 		void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
+		void setupBackSurface(Graphics::Surface *surface);
 
 	private:
 		Common::SeekableReadStream *_fileStream;
@@ -131,6 +116,7 @@ private:
 		RL2AudioTrack *_audioTrack;
 		Graphics::Surface *_surface;
 		Graphics::Surface *_backSurface;
+		bool _hasBackFrame;
 
 		mutable bool _dirtyPalette;
 
@@ -145,7 +131,23 @@ private:
 		void copyFrame(uint8 *data);
 		void rl2DecodeFrameWithBackground();
 		void rl2DecodeFrameWithoutBackground(int screenOffset = -1);
+		void initBackSurface();
 	};
+
+private:
+	Audio::Mixer::SoundType _soundType;
+	RL2FileHeader _header;
+public:
+	RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+	virtual ~RL2Decoder();
+
+	bool loadStream(Common::SeekableReadStream *stream);
+	bool loadVideo(int videoId);
+
+	const Common::List<Common::Rect> *getDirtyRects() const;
+	void clearDirtyRects();
+	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
+	RL2VideoTrack *getVideoTrack();
 };
 
 } // End of namespace Video
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index dbd48f7..62544ea 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -555,6 +555,8 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	decoder.loadVideo(videoId);
 
 	decoder.start();
+	decoder.getVideoTrack()->setupBackSurface(&_graphicsManager._screenSurface);
+
 	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 46b4ef6..ef7a708 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -497,8 +497,8 @@ void VoyeurEngine::doGossip() {
 	pal->startFade();
 
 	// Transfer initial background to video decoder
-	PictureResource videoFrame(decoder.getVideoSurface());
-	_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20));
+	//PictureResource videoFrame(decoder.getVideoSurface());
+	//_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20));
 
 	flipPageAndWait();
 


Commit: c4197b4e30a321c36488494d66a3fb99e0002780
    https://github.com/scummvm/scummvm/commit/c4197b4e30a321c36488494d66a3fb99e0002780
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T12:45:44-08:00

Commit Message:
VOYEUR: Move _isRLV3 flag to animation header class

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 0fce36d..2f8c71b 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -115,6 +115,7 @@ void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
 	_form = stream->readUint32LE();
 	_backSize = stream->readUint32LE();
 	_signature = stream->readUint32LE();
+	_isRLV3 = !strncmp((const char *)&_signature, "RLV3", 4);
 
 	if (!isValid())
 		return;
@@ -163,8 +164,9 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 
+	_hasBackFrame = header._backSize != 0 && !header._isRLV3;
+
 	_backSurface = NULL;
-	_hasBackFrame = header._backSize != 0 && strncmp((char *)&header._signature, "RLV3", 4);
 	if (_hasBackFrame)
 		initBackSurface();
 
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index bb3f34a..60d4830 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -58,6 +58,7 @@ private:
 
 		uint32 *_frameOffsets;
 		int *_frameSoundSizes;
+		bool _isRLV3;
 	public:
 		RL2FileHeader();
 		~RL2FileHeader();


Commit: c78e83d7848940db511f53a4ed5ccad56b498bec
    https://github.com/scummvm/scummvm/commit/c78e83d7848940db511f53a4ed5ccad56b498bec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T13:05:45-08:00

Commit Message:
VOYEUR: Implemented remainder of playAVideoDuration

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 62544ea..edb7f4a 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -546,9 +546,11 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	if (videoId == -1)
 		return;
 
+	PictureResource *pic = NULL;
 	if (videoId == 42) {
 		_eventsManager._videoDead = 0;
-		dataP = _bVoy->memberAddr(0xE00);
+		pic = _bVoy->boltEntry(0xE00 + _eventsManager._videoDead)._picResource;
+		warning("%xh", pic);
 	}
 
 	::Video::RL2Decoder decoder;
@@ -583,14 +585,11 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	_voy._field478 &= ~0x10;
 
 	if (_voy._field478 & 8) {
-		// TODO: Figure out resource type for the data resource
-		/*
+		assert(pic);
 		byte *imgData = (*_graphicsManager._vPort)->_currentPic->_imgData;
-		(*_graphicsManager._vPort)->_currentPic->_imgData = dataP[12 and 14];
-		imgData[12 and 14] = imgData;
+		(*_graphicsManager._vPort)->_currentPic->_imgData = pic->_imgData;
+		pic->_imgData = imgData;
 		_voy._field478 &= ~8;
-		*/
-		warning("TODO: playAVideoDuration - %x", dataP);
 	}
 }
 


Commit: f1686fcf16de1ed3303369f6f3b4c29daeb25d44
    https://github.com/scummvm/scummvm/commit/f1686fcf16de1ed3303369f6f3b4c29daeb25d44
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T15:00:26-08:00

Commit Message:
VOYEUR: Fix bugs in police arriving playback

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 1d04ddc..ecf564c 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -489,7 +489,7 @@ void ThreadResource::parsePlayCommands() {
 			_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
 			_vm->_voy._field478 |= 1;
 
-			if (id != 2) {
+			if (id != 22) {
 				_vm->_eventsManager._videoComputerBut4 = -1;
 				parseIndex = 999;
 			} else {
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ef7a708..ba5123e 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -65,19 +65,19 @@ void VoyeurEngine::playStamp() {
 					_voy._field472 = 140;
 					break;
 				case 1:
-					_voy._field478 = -2;
+					_voy._field478 &= ~1;
 					_voy._field46E = 1;
 					threadP->chooseSTAMPButton(22);
 					_voy._field472 = 143;
 					break;
 				case 2:
-					_voy._field478 = -2;
+					_voy._field478 &= ~1;
 					reviewTape();
 					_voy._field46E = 1;
 					_voy._field472 = 142;
 					break;
 				case 3:
-					_voy._field478 = -2;
+					_voy._field478 &= ~1;
 					threadP->chooseSTAMPButton(21);
 					break;
 				case 4:


Commit: 485c19b569bce6b69dd8b90c5304dca334f9ddc5
    https://github.com/scummvm/scummvm/commit/485c19b569bce6b69dd8b90c5304dca334f9ddc5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T15:25:46-08:00

Commit Message:
VOYEUR: Clean up playAVideoDuration

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 890eaea..61c37a6 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -74,6 +74,9 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_priorFrameTime = g_system->getMillis();
 	_joe = 0;
 	Common::fill(&_keyState[0], &_keyState[256], false);
+	Common::fill(&_cycleTime[0], &_cycleTime[4], 0);
+	Common::fill(&_cycleNext[0], &_cycleNext[4], 0);
+	_cyclePtr = NULL;
 	
 	_leftClick = _rightClick = false;
 	_mouseClicked = _mouseUnk = false;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 487d59e..99f583a 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -162,6 +162,9 @@ private:
 	int _mouseButton;
 	Common::List<IntNode *> _intNodes;
 	Common::Point _mousePos;
+	int _cycleTime[4];
+	int _cycleNext[4];
+	VInitCycleResource *_cyclePtr;
 
 	void mainVoyeurIntFunc();
 private:
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9d86c66..d02c5ce 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -549,7 +549,7 @@ void BVoyBoltFile::vInitCMap() {
 void BVoyBoltFile::vInitCycl() {
 	initDefault();
 	_state._vm->_eventsManager.vStopCycle();
-	_state._curMemberPtr->_vInitCyclResource = new VInitCyclResource(
+	_state._curMemberPtr->_vInitCycleResource = new VInitCycleResource(
 		_state, _state._curMemberPtr->_data);
 }
 
@@ -647,11 +647,10 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_fontResource = nullptr;
 	_fontInfoResource = nullptr;
 	_cMapResource = nullptr;
-	_vInitCyclResource = nullptr;
+	_vInitCycleResource = nullptr;
 	_ptrResource = nullptr;
 	_controlResource = nullptr;
-	_vInitCyclResource = nullptr;
-	_cycleResource = nullptr;
+	_vInitCycleResource = nullptr;
 	_threadResource = nullptr;
 
 	byte buffer[16];
@@ -673,8 +672,7 @@ BoltEntry::~BoltEntry() {
 	delete _fontResource;
 	delete _fontInfoResource;
 	delete _cMapResource;
-	delete _vInitCyclResource;
-	delete _cycleResource;
+	delete _vInitCycleResource;
 	delete _ptrResource;
 	delete _controlResource;
 }
@@ -690,7 +688,7 @@ void BoltEntry::load() {
 bool BoltEntry::hasResource() const {
 	return _rectResource ||  _picResource || _viewPortResource || _viewPortListResource
 		|| _fontResource || _fontInfoResource || _cMapResource 
-		|| _vInitCyclResource || _cycleResource
+		|| _vInitCycleResource 
 		|| _ptrResource || _controlResource || _threadResource;
 }
 
@@ -1410,12 +1408,20 @@ void CMapResource::startFade() {
 
 /*------------------------------------------------------------------------*/
 
-VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
+VInitCycleResource::VInitCycleResource(BoltFilesState &state, const byte *src) {
 	for (int i = 0; i < 4; ++i) {
 		state._curLibPtr->resolveIt(READ_LE_UINT32(src + 8 + i * 4), &_ptr[i]);
 	}
 }
 
+void VInitCycleResource::vStartCycle() {
+	error("TODO");
+}
+
+void VInitCycleResource::vStopCycle() {
+	error("TODO: vStopCycle");
+}
+
 /*------------------------------------------------------------------------*/
 
 PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
@@ -1454,12 +1460,4 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
-void CycleResource::vStartCycle() {
-	error("TODO: vStartCycle");
-}
-
-void CycleResource::vStopCycle() {
-	error("TODO: vStopCycle");
-}
-
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 832e157..47a6df5 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -41,10 +41,9 @@ class ViewPortResource;
 class ViewPortListResource;
 class FontResource;
 class CMapResource;
-class VInitCyclResource;
+class VInitCycleResource;
 class PtrResource;
 class ControlResource;
-class CycleResource;
 class ThreadResource;
 
 #define DECOMPRESS_SIZE 0x7000
@@ -205,8 +204,7 @@ public:
 	FontResource *_fontResource;
 	FontInfoResource *_fontInfoResource;
 	CMapResource *_cMapResource;
-	VInitCyclResource *_vInitCyclResource;
-	CycleResource *_cycleResource;	// TODO: Dup with VInit?
+	VInitCycleResource *_vInitCycleResource;
 
 	// stampblt.blt resource types
 	PtrResource *_ptrResource;
@@ -405,12 +403,15 @@ public:
 	void startFade();
 };
 
-class VInitCyclResource {
+class VInitCycleResource {
 public:
 	byte *_ptr[4];
 public:
-	VInitCyclResource(BoltFilesState &state, const byte *src);
-	virtual ~VInitCyclResource() {}
+	VInitCycleResource(BoltFilesState &state, const byte *src);
+	virtual ~VInitCycleResource() {}
+
+	void vStartCycle();
+	void vStopCycle();
 };
 
 /* stampblt.blt resources */
@@ -433,15 +434,6 @@ public:
 	virtual ~ControlResource() {}
 };
 
-class CycleResource {
-public:
-	CycleResource(BoltFilesState &state, const byte *src) {}
-	virtual ~CycleResource() {}
-
-	void vStartCycle();
-	void vStopCycle();
-};
-
 class ThreadResource {
 public:
 	static int _stampFlags;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index edb7f4a..4a51d89 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -540,7 +540,6 @@ void VoyeurEngine::playAVideo(int videoId) {
 }
 
 void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
-	byte *dataP = NULL;
 	int totalFrames = duration * 10;
 
 	if (videoId == -1)
@@ -550,7 +549,6 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	if (videoId == 42) {
 		_eventsManager._videoDead = 0;
 		pic = _bVoy->boltEntry(0xE00 + _eventsManager._videoDead)._picResource;
-		warning("%xh", pic);
 	}
 
 	::Video::RL2Decoder decoder;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ba5123e..89e48af 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -578,7 +578,7 @@ void VoyeurEngine::doTapePlaying() {
 	_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(57, 30));
 	flipPageAndWaitForFade();
 
-	CycleResource *cycle = _bVoy->boltEntry(0xA05)._cycleResource;
+	VInitCycleResource *cycle = _bVoy->boltEntry(0xA05)._vInitCycleResource;
 	cycle->vStartCycle();
 
 	_soundManager.startVOCPlay("vcr.voc");


Commit: 60743fc8c90a9d35bde1e632ed2ae5b55fb8168d
    https://github.com/scummvm/scummvm/commit/60743fc8c90a9d35bde1e632ed2ae5b55fb8168d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T21:52:50-08:00

Commit Message:
VOYEUR: Implemented vDoCycleInt

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 61c37a6..115482e 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -75,7 +75,7 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_joe = 0;
 	Common::fill(&_keyState[0], &_keyState[256], false);
 	Common::fill(&_cycleTime[0], &_cycleTime[4], 0);
-	Common::fill(&_cycleNext[0], &_cycleNext[4], 0);
+	Common::fill(&_cycleNext[0], &_cycleNext[4], (byte *)nullptr);
 	_cyclePtr = NULL;
 	
 	_leftClick = _rightClick = false;
@@ -383,7 +383,83 @@ void EventsManager::vDoFadeInt() {
 }
 
 void EventsManager::vDoCycleInt() {
-	warning("TODO");
+	for (int idx = 3; idx >= 0; --idx) {
+		if (_cyclePtr->_v[idx] && --_cycleTime[idx] <= 0) {
+			byte *pSrc = _cycleNext[idx];
+			byte *pPal = _vm->_graphicsManager._VGAColors;
+
+			if (_cyclePtr->_v[idx] == 1) {
+				do {
+					int palIndex = READ_LE_UINT16(pSrc);
+					pPal[palIndex * 3] = pSrc[3];
+					pPal[palIndex * 3 + 1] = pSrc[4];
+					pPal[palIndex * 3 + 1] = pSrc[5];
+					pSrc += 6;
+
+					if ((int16)READ_LE_UINT16(pSrc) >= 0) {
+						// Resetting back to start of cycle data
+						pSrc = _cycleNext[idx];
+						break;
+					}
+				} while (*(pSrc + 2) == 0);
+
+				_cycleNext[idx] = pSrc;
+				_cycleTime[idx] = pSrc[2];
+			} else {
+				_cycleTime[idx] = pSrc[4];
+
+				if (pSrc[5] == 1) {
+					// Move palette entry to end of range
+					int start = READ_LE_UINT16(pSrc);
+					int end = READ_LE_UINT16(&pSrc[2]);
+					int len = end - start;
+
+					// Store the RGB of the first entry to be moved
+					byte r = pSrc[start * 3];
+					byte g = pSrc[start * 3 + 1];
+					byte b = pSrc[start * 3 + 2];
+
+					// Move the remainder of the range backwards one entry
+					// TODO: Is this allowing for overlap properly?
+					Common::copy(&pSrc[start * 3 + 3], &pSrc[end * 3], &pSrc[start * 3]);
+					
+					// Place the original saved entry at the end of the range
+					pSrc[end * 3 - 3] = r;
+					pSrc[end * 3 - 2] = g;
+					pSrc[end * 3 - 1] = b;
+					
+					if (_fadeStatus & 1) {
+						//dx = start, di = end
+						warning("TODO: Adjustment of ViewPortListResource");
+					}
+				} else {
+					// Move palette entry to end of range
+					int start = READ_LE_UINT16(pSrc);
+					int end = READ_LE_UINT16(&pSrc[2]);
+					int len = end - start;
+
+					// Store the RGB of the entry to be moved
+					byte r = pSrc[end * 3 - 3];
+					byte g = pSrc[end * 3 - 2];
+					byte b = pSrc[end * 3 - 1];
+
+					// Move the remainder of the range forwards one entry
+					// TODO: Does this allow for overlap range correctly?
+					Common::copy_backward(&pSrc[start * 3 + 3], &pSrc[end * 3], &pSrc[start * 3]);
+					
+					// Place the original saved entry at the end of the range
+					pSrc[start * 3] = r;
+					pSrc[start * 3] = g;
+					pSrc[start * 3] = b;
+					
+					if (_fadeStatus & 1) {
+						//dx = start, di = end
+						warning("TODO: Adjustment of ViewPortListResource");
+					}
+				}
+			}
+		}
+	}
 }
 
 
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 99f583a..c346426 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -162,9 +162,6 @@ private:
 	int _mouseButton;
 	Common::List<IntNode *> _intNodes;
 	Common::Point _mousePos;
-	int _cycleTime[4];
-	int _cycleNext[4];
-	VInitCycleResource *_cyclePtr;
 
 	void mainVoyeurIntFunc();
 private:
@@ -198,6 +195,9 @@ public:
 	int _v2A0A2;
 	int _videoComputerBut4;
 	int _videoDead;
+	int _cycleTime[4];
+	byte *_cycleNext[4];
+	VInitCycleResource *_cyclePtr;
 public:
 	EventsManager();
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index d02c5ce..b486788 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1408,18 +1408,33 @@ void CMapResource::startFade() {
 
 /*------------------------------------------------------------------------*/
 
-VInitCycleResource::VInitCycleResource(BoltFilesState &state, const byte *src) {
+VInitCycleResource::VInitCycleResource(BoltFilesState &state, const byte *src):
+		_state(state) {
+	// Set up arrays
 	for (int i = 0; i < 4; ++i) {
+		_v[i] = READ_LE_UINT16(src + i * 2);
 		state._curLibPtr->resolveIt(READ_LE_UINT32(src + 8 + i * 4), &_ptr[i]);
 	}
 }
 
-void VInitCycleResource::vStartCycle() {
-	error("TODO");
+void VInitCycleResource::vStartCycle(int flags) {
+	EventsManager &evt = _state._vm->_eventsManager;
+	evt._cycleIntNode._flags |= 1;
+	evt._cyclePtr = this;
+
+	for (int i = 0; i < 4; ++i) {
+		evt._cycleNext[i] = _ptr[i];
+		evt._cycleTime[i] = 0;
+	}
+
+	evt._cycleStatus = flags | 1;
+	evt._cycleIntNode._flags &= ~1;
 }
 
 void VInitCycleResource::vStopCycle() {
-	error("TODO: vStopCycle");
+	EventsManager &evt = _state._vm->_eventsManager;
+	evt._cycleIntNode._flags |= 1;
+	evt._cycleStatus &= ~1;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 47a6df5..dd79891 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -404,13 +404,16 @@ public:
 };
 
 class VInitCycleResource {
+private:
+	BoltFilesState &_state;
 public:
+	int _v[4];
 	byte *_ptr[4];
 public:
 	VInitCycleResource(BoltFilesState &state, const byte *src);
 	virtual ~VInitCycleResource() {}
 
-	void vStartCycle();
+	void vStartCycle(int flags = 0);
 	void vStopCycle();
 };
 


Commit: cb15e2863f397d6906cb509ee5ec00102fe38baf
    https://github.com/scummvm/scummvm/commit/cb15e2863f397d6906cb509ee5ec00102fe38baf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-29T22:31:32-08:00

Commit Message:
VOYEUR: Fix to doTapePlaying to show tape image

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 89e48af..2c33d33 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -573,12 +573,13 @@ void VoyeurEngine::doTapePlaying() {
 	_graphicsManager._backColors = _bVoy->boltEntry(0xA01)._cMapResource;
 	_graphicsManager._backgroundPage = _bVoy->boltEntry(0xA00)._picResource;
 	PictureResource *pic = _bVoy->boltEntry(0xA02)._picResource;
+	VInitCycleResource *cycle = _bVoy->boltEntry(0xA05)._vInitCycleResource;
 
 	(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
 	_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(57, 30));
+	_graphicsManager._backColors->startFade();
 	flipPageAndWaitForFade();
 
-	VInitCycleResource *cycle = _bVoy->boltEntry(0xA05)._vInitCycleResource;
 	cycle->vStartCycle();
 
 	_soundManager.startVOCPlay("vcr.voc");


Commit: f08231939f626f4acafb899fc8780b73260f1ada
    https://github.com/scummvm/scummvm/commit/f08231939f626f4acafb899fc8780b73260f1ada
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-30T01:28:29-08:00

Commit Message:
VOYEUR: Removed duplicate vStopCycle method

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 115482e..514d983 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -108,11 +108,6 @@ void EventsManager::mainVoyeurIntFunc() {
 	}
 }
 
-void EventsManager::vStopCycle() {
-	_cycleIntNode._flags = 1;
-	_cycleStatus &= 2;
-}
-
 void EventsManager::sWaitFlip() {
 	Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries;
 	for (uint idx = 0; idx < viewPorts.size(); ++idx) {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index c346426..4734e54 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -205,7 +205,6 @@ public:
 	void resetMouse();
 	void setMousePos(const Common::Point &p) { _mousePos = p; }
 	void startMainClockInt();
-	void vStopCycle();
 	void sWaitFlip();
 	void vInitColor();
 
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index b486788..0b4e567 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -548,9 +548,9 @@ void BVoyBoltFile::vInitCMap() {
 
 void BVoyBoltFile::vInitCycl() {
 	initDefault();
-	_state._vm->_eventsManager.vStopCycle();
 	_state._curMemberPtr->_vInitCycleResource = new VInitCycleResource(
 		_state, _state._curMemberPtr->_data);
+	_state._curMemberPtr->_vInitCycleResource->vStopCycle();
 }
 
 /*------------------------------------------------------------------------*/


Commit: 87a6e72fc55c776796cfe8337d4add5988c9c595
    https://github.com/scummvm/scummvm/commit/87a6e72fc55c776796cfe8337d4add5988c9c595
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-30T03:00:15-08:00

Commit Message:
VOYEUR: Fixes to vDoCycleInt for tape playback palette animation

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 514d983..74d8eee 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -379,11 +379,12 @@ void EventsManager::vDoFadeInt() {
 
 void EventsManager::vDoCycleInt() {
 	for (int idx = 3; idx >= 0; --idx) {
-		if (_cyclePtr->_v[idx] && --_cycleTime[idx] <= 0) {
+		if (_cyclePtr->_type[idx] && --_cycleTime[idx] <= 0) {
 			byte *pSrc = _cycleNext[idx];
 			byte *pPal = _vm->_graphicsManager._VGAColors;
 
-			if (_cyclePtr->_v[idx] == 1) {
+			if (_cyclePtr->_type[idx] != 1) {
+				// New palette data being specified - loop to set entries
 				do {
 					int palIndex = READ_LE_UINT16(pSrc);
 					pPal[palIndex * 3] = pSrc[3];
@@ -401,51 +402,52 @@ void EventsManager::vDoCycleInt() {
 				_cycleNext[idx] = pSrc;
 				_cycleTime[idx] = pSrc[2];
 			} else {
+				// Palette rotation to be done
 				_cycleTime[idx] = pSrc[4];
 
 				if (pSrc[5] == 1) {
 					// Move palette entry to end of range
 					int start = READ_LE_UINT16(pSrc);
 					int end = READ_LE_UINT16(&pSrc[2]);
-					int len = end - start;
+					assert(start < 0x100 && end <= 0x100);
 
 					// Store the RGB of the first entry to be moved
-					byte r = pSrc[start * 3];
-					byte g = pSrc[start * 3 + 1];
-					byte b = pSrc[start * 3 + 2];
+					byte r = pPal[start * 3];
+					byte g = pPal[start * 3 + 1];
+					byte b = pPal[start * 3 + 2];
 
 					// Move the remainder of the range backwards one entry
 					// TODO: Is this allowing for overlap properly?
-					Common::copy(&pSrc[start * 3 + 3], &pSrc[end * 3], &pSrc[start * 3]);
+					Common::copy(&pPal[start * 3 + 3], &pPal[end * 3 + 3], &pPal[start * 3]);
 					
 					// Place the original saved entry at the end of the range
-					pSrc[end * 3 - 3] = r;
-					pSrc[end * 3 - 2] = g;
-					pSrc[end * 3 - 1] = b;
+					pPal[end * 3] = r;
+					pPal[end * 3 + 1] = g;
+					pPal[end * 3 + 2] = b;
 					
 					if (_fadeStatus & 1) {
 						//dx = start, di = end
 						warning("TODO: Adjustment of ViewPortListResource");
 					}
 				} else {
-					// Move palette entry to end of range
+					// Move palette entry to start of range
 					int start = READ_LE_UINT16(pSrc);
 					int end = READ_LE_UINT16(&pSrc[2]);
-					int len = end - start;
+					assert(start < 0x100 && end <= 0x100);
 
 					// Store the RGB of the entry to be moved
-					byte r = pSrc[end * 3 - 3];
-					byte g = pSrc[end * 3 - 2];
-					byte b = pSrc[end * 3 - 1];
+					byte r = pPal[end * 3];
+					byte g = pPal[end * 3 + 1];
+					byte b = pPal[end * 3 + 2];
 
 					// Move the remainder of the range forwards one entry
 					// TODO: Does this allow for overlap range correctly?
-					Common::copy_backward(&pSrc[start * 3 + 3], &pSrc[end * 3], &pSrc[start * 3]);
+					Common::copy_backward(&pPal[start * 3], &pPal[end * 3], &pPal[end * 3 + 3]);
 					
 					// Place the original saved entry at the end of the range
-					pSrc[start * 3] = r;
-					pSrc[start * 3] = g;
-					pSrc[start * 3] = b;
+					pPal[start * 3] = r;
+					pPal[start * 3 + 1] = g;
+					pPal[start * 3 + 2] = b;
 					
 					if (_fadeStatus & 1) {
 						//dx = start, di = end
@@ -453,6 +455,9 @@ void EventsManager::vDoCycleInt() {
 					}
 				}
 			}
+
+			_intPtr._hasPalette = true;
+			_intPtr.field38 = true;
 		}
 	}
 }
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 0b4e567..1b33c5f 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1412,7 +1412,7 @@ VInitCycleResource::VInitCycleResource(BoltFilesState &state, const byte *src):
 		_state(state) {
 	// Set up arrays
 	for (int i = 0; i < 4; ++i) {
-		_v[i] = READ_LE_UINT16(src + i * 2);
+		_type[i] = READ_LE_UINT16(src + i * 2);
 		state._curLibPtr->resolveIt(READ_LE_UINT32(src + 8 + i * 4), &_ptr[i]);
 	}
 }
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index dd79891..2d1aa9d 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -407,7 +407,7 @@ class VInitCycleResource {
 private:
 	BoltFilesState &_state;
 public:
-	int _v[4];
+	int _type[4];
 	byte *_ptr[4];
 public:
 	VInitCycleResource(BoltFilesState &state, const byte *src);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 2c33d33..963caab 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -588,6 +588,7 @@ void VoyeurEngine::doTapePlaying() {
 	}
 
 	_soundManager.stopVOCPlay();
+	cycle->vStopCycle();
 	_bVoy->freeBoltGroup(0xA00);
 }
 


Commit: 2d71a0594d10ede390312cf87903da914c2db8c7
    https://github.com/scummvm/scummvm/commit/2d71a0594d10ede390312cf87903da914c2db8c7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-30T23:39:38-08:00

Commit Message:
VOYEUR: Fix guilt check post doTapePlaying call

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 74d8eee..6ac36dd 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -409,7 +409,7 @@ void EventsManager::vDoCycleInt() {
 					// Move palette entry to end of range
 					int start = READ_LE_UINT16(pSrc);
 					int end = READ_LE_UINT16(&pSrc[2]);
-					assert(start < 0x100 && end <= 0x100);
+					assert(start < 0x100 && end < 0x100);
 
 					// Store the RGB of the first entry to be moved
 					byte r = pPal[start * 3];
@@ -433,7 +433,7 @@ void EventsManager::vDoCycleInt() {
 					// Move palette entry to start of range
 					int start = READ_LE_UINT16(pSrc);
 					int end = READ_LE_UINT16(&pSrc[2]);
-					assert(start < 0x100 && end <= 0x100);
+					assert(start < 0x100 && end < 0x100);
 
 					// Store the RGB of the entry to be moved
 					byte r = pPal[end * 3];
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 963caab..740bf17 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -131,10 +131,13 @@ void VoyeurEngine::playStamp() {
 			if (!checkForMurder() && _voy._transitionId <= 15)
 				checkForIncriminate();
 
-			if (_voy._videoEventId != -1)
+			if (_voy._videoEventId != -1) {
 				playAVideoEvent(_voy._videoEventId);
-			_voy._field478 &= 0x10;
+				_voy._field478 &= ~0x10;
+			}
+
 			threadP->chooseSTAMPButton(0);
+			flag = true;
 			break;
 
 		case 130: {


Commit: 577b7cefa0112cf33940e70b33e0cc91a0987f26
    https://github.com/scummvm/scummvm/commit/577b7cefa0112cf33940e70b33e0cc91a0987f26
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T12:00:36-08:00

Commit Message:
VOYEUR: Animation improvements to better handle Voyeur RL2 videos

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 2f8c71b..db800ad 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -164,7 +164,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 
-	_hasBackFrame = header._backSize != 0 && !header._isRLV3;
+	_hasBackFrame = header._backSize != 0;
 
 	_backSurface = NULL;
 	if (_hasBackFrame)
@@ -218,10 +218,11 @@ Graphics::PixelFormat RL2Decoder::RL2VideoTrack::getPixelFormat() const {
 
 const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 	if (_curFrame == 0 && _hasBackFrame) {
-		// Read in the background frame
+		// Read in the initial background frame
 		_fileStream->seek(0x324);
-		rl2DecodeFrameWithoutBackground(0);
+		rl2DecodeFrameWithoutTransparency(0);
 
+		initBackSurface();
 		Common::copy((byte *)_surface->getPixels(), (byte *)_surface->getPixels() + (320 * 200), 
 			(byte *)_backSurface->getPixels());
 		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
@@ -233,15 +234,12 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 	// If there's any sound data, pass it to the audio track
 	_fileStream->seek(_header._frameSoundSizes[_curFrame], SEEK_CUR);
 
-	// Decode the graphic data
+	// Decode the graphic data using the appropriate method depending on whether the animation
+	// has a background or just raw frames without any background transparency
 	if (_hasBackFrame) {
-		if (_curFrame > 0)
-			Common::copy((byte *)_backSurface->getPixels(), (byte *)_backSurface->getPixels() + (320 * 200), 
-				(byte *)_surface->getPixels());
-
-		rl2DecodeFrameWithBackground();
+		rl2DecodeFrameWithTransparency(_videoBase);
 	} else {
-		rl2DecodeFrameWithoutBackground();
+		rl2DecodeFrameWithoutTransparency(_videoBase);
 	}
 
 	_curFrame++;
@@ -269,71 +267,71 @@ void RL2Decoder::RL2VideoTrack::copyFrame(uint8 *data) {
 	_dirtyRects.push_back(Common::Rect(0, 0, getWidth(), getHeight()));
 }
 
-void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutBackground(int screenOffset) {
+void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutTransparency(int screenOffset) {
 	if (screenOffset == -1)
 		screenOffset = _videoBase;
-	const byte *srcP = !_backSurface ? NULL : (const byte *)_backSurface->getPixels();
-	byte *destP = (byte *)_surface->getPixels();
 	int frameSize = _surface->w * _surface->h - screenOffset;
-
-	// If a background was manually set, copy over the initial part remaining unchanged
-	if (srcP && screenOffset > 0) {
-		Common::copy(srcP, srcP + screenOffset, destP);
-		srcP += screenOffset;
-	}
-	destP += screenOffset;
+	byte *destP = (byte *)_surface->getPixels();
 
 	// Main frame decode loop
-	while (frameSize > 0) {
-		byte nextByte = _fileStream->readByte();
+	byte nextByte;
+	for (;;) {
+		nextByte = _fileStream->readByte();
 
 		if (nextByte < 0x80) {
+			// Simple byte to copy to output
+			assert(frameSize > 0);
 			*destP++ = nextByte;
 			--frameSize;
-			if (srcP)
-				++srcP;
-		} else if (nextByte == 0x80) {
-			int runLength = _fileStream->readByte();
-			if (runLength == 0)
-				return;
-
-			runLength = MIN(runLength, frameSize);
-			if (srcP) {
-				Common::copy(srcP, srcP + runLength, destP);
-				srcP += runLength;
-			} else {
-				Common::fill(destP, destP + runLength, 0);
-			}
+		} else if (nextByte > 0x80) {
+			// Lower 7 bits a run length for the following byte
+			byte runLength = _fileStream->readByte();
+			assert(frameSize >= runLength);
+			Common::fill(destP, destP + runLength, nextByte & 0x7f);
 			destP += runLength;
 			frameSize -= runLength;
 		} else {
-			int runLength = _fileStream->readByte();
-			
-			runLength = MIN(runLength, frameSize);
-			Common::fill(destP, destP + runLength, nextByte & 0x7f);
+			// Follow byte run length for zeroes. If zero, indicates end of image
+			byte runLength = _fileStream->readByte();
+			if (runLength == 0)
+				break;
+
+			assert(frameSize >= runLength);
+			Common::fill(destP, destP + runLength, 0);
 			destP += runLength;
 			frameSize -= runLength;
-			if (srcP)
-				srcP += runLength;
 		}
 	}
+
+	// If there's any remaining screen area, zero it out
+	byte *endP = (byte *)_surface->getPixels() + _surface->w * _surface->h;
+	if (destP != endP)
+		Common::fill(destP, endP, 0);
 }
 
-void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
-	int screenOffset = _videoBase;
-	int frameSize = _surface->w * _surface->h - _videoBase;
-	byte *src = (byte *)_backSurface->getPixels();
-	byte *dest = (byte *)_surface->getPixels();
+void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset) {
+	int frameSize = _surface->w * _surface->h;
+	byte *refP = (byte *)_backSurface->getPixels();
+	byte *destP = (byte *)_surface->getPixels();
+
+	// If there's a screen offset, copy unchanged initial pixels from reference surface
+	if (screenOffset > 0)
+		Common::copy(refP, refP + screenOffset, destP);
 
-	while (frameSize > 0) {
+	// Main decode loop
+	for (;;) {
 		byte nextByte = _fileStream->readByte();
 
 		if (nextByte == 0) {
-			dest[screenOffset] = src[screenOffset];
+			// Move one single byte from reference surface
+			assert(frameSize > 0);
+			destP[screenOffset] = refP[screenOffset];
 			++screenOffset;
 			--frameSize;
 		} else if (nextByte < 0x80) {
-			dest[screenOffset] = nextByte | 0x80;
+			// Raw byte to copy to output
+			assert(frameSize > 0);
+			destP[screenOffset] = nextByte;
 			++screenOffset;
 			--frameSize;
 		} else if (nextByte == 0x80) {
@@ -341,19 +339,25 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithBackground() {
 			if (runLength == 0)
 				return;
 
-			assert(runLength <= frameSize);
-			Common::copy(src + screenOffset, src + screenOffset + runLength, dest);
+			assert(frameSize >= runLength);
+			Common::copy(refP + screenOffset, refP + screenOffset + runLength, destP + screenOffset);
 			screenOffset += runLength;
 			frameSize -= runLength;
 		} else {
+			// Run length of a single pixel value
 			byte runLength = _fileStream->readByte();
-			
-			assert(runLength <= frameSize);
-			Common::fill(dest + screenOffset, dest + screenOffset + runLength, nextByte & 0x7f);
+			nextByte &= 0x7f;
+
+			assert(frameSize >= runLength);
+			Common::fill(destP + screenOffset, destP + screenOffset + runLength, nextByte);
 			screenOffset += runLength;
 			frameSize -= runLength;
 		}
 	}
+
+	// If there's a remaining section of the screen not covered, copy it from reference surface
+	if (screenOffset < (_surface->w * _surface->h))
+		Common::copy(refP + screenOffset, refP + (_surface->w * _surface->h), destP + screenOffset);
 }
 
 void RL2Decoder::RL2VideoTrack::setupBackSurface(Graphics::Surface *surface) {
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 60d4830..9f1a2ab 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -130,8 +130,8 @@ private:
 		Common::List<Common::Rect> _dirtyRects;
 
 		void copyFrame(uint8 *data);
-		void rl2DecodeFrameWithBackground();
-		void rl2DecodeFrameWithoutBackground(int screenOffset = -1);
+		void rl2DecodeFrameWithTransparency(int screenOffset);
+		void rl2DecodeFrameWithoutTransparency(int screenOffset = -1);
 		void initBackSurface();
 	};
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 4a51d89..051c8b9 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -555,8 +555,6 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	decoder.loadVideo(videoId);
 
 	decoder.start();
-	decoder.getVideoTrack()->setupBackSurface(&_graphicsManager._screenSurface);
-
 	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 


Commit: 1cdca7cd7f4108418c0b9077a51b491755770fdb
    https://github.com/scummvm/scummvm/commit/1cdca7cd7f4108418c0b9077a51b491755770fdb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T12:15:52-08:00

Commit Message:
VOYEUR: Fix memory leak in animation header class

Changed paths:
    engines/voyeur/animation.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index db800ad..393cd70 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -100,8 +100,8 @@ RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2FileHeader::RL2FileHeader() {
-	_frameOffsets = NULL;
-	_frameSoundSizes = NULL;
+	_frameOffsets = nullptr;
+	_frameSoundSizes = nullptr;
 }
 
 RL2Decoder::RL2FileHeader::~RL2FileHeader() {
@@ -137,11 +137,13 @@ void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
 	stream->skip(_backSize + 4 * _numFrames);
 
 	// Load frame offsets
+	delete[] _frameOffsets;
 	_frameOffsets = new uint32[_numFrames];
 	for (int i = 0; i < _numFrames; ++i)
 		_frameOffsets[i] = stream->readUint32LE();
 
 	// Load the size of the sound portion of each frame
+	delete[] _frameSoundSizes;
 	_frameSoundSizes = new int[_numFrames];
 	for (int i = 0; i < _numFrames; ++i)
 		_frameSoundSizes[i] = stream->readUint32LE() & 0xffff;


Commit: f153ef4b462c73a6d072b4d82c7e8e673c2183fc
    https://github.com/scummvm/scummvm/commit/f153ef4b462c73a6d072b4d82c7e8e673c2183fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T12:17:29-08:00

Commit Message:
VOYEUR: Fix compiler warning

Changed paths:
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 2d1aa9d..0532b7c 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -272,7 +272,7 @@ public:
 	PictureResource(BoltFilesState &state, const byte *src);
 	PictureResource(int flags, int select, int pick, int onOff, int depth, 
 		const Common::Rect &bounds, int maskData, byte *imgData, int planeSize);
-	PictureResource::PictureResource(Graphics::Surface *surface);
+	PictureResource(Graphics::Surface *surface);
 	PictureResource();
 	virtual ~PictureResource();
 };


Commit: 9f103cb8fb4ffa0851206a11aa51b42571c4605d
    https://github.com/scummvm/scummvm/commit/9f103cb8fb4ffa0851206a11aa51b42571c4605d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T13:09:05-08:00

Commit Message:
VOYEUR: Workaround for original intrepreter frame overruns

Changed paths:
    engines/voyeur/animation.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 393cd70..b862f3a 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -180,8 +180,10 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 }
 
 RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
+	// Free the file stream
 	delete _fileStream;
 
+	// Free surfaces
 	_surface->free();
 	delete _surface;
 	if (_backSurface) {
@@ -224,7 +226,6 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 		_fileStream->seek(0x324);
 		rl2DecodeFrameWithoutTransparency(0);
 
-		initBackSurface();
 		Common::copy((byte *)_surface->getPixels(), (byte *)_surface->getPixels() + (320 * 200), 
 			(byte *)_backSurface->getPixels());
 		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
@@ -312,7 +313,7 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutTransparency(int screenOffs
 }
 
 void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset) {
-	int frameSize = _surface->w * _surface->h;
+	int frameSize = _surface->w * _surface->h - screenOffset;
 	byte *refP = (byte *)_backSurface->getPixels();
 	byte *destP = (byte *)_surface->getPixels();
 
@@ -321,12 +322,11 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 		Common::copy(refP, refP + screenOffset, destP);
 
 	// Main decode loop
-	for (;;) {
+	while (frameSize > 0) {
 		byte nextByte = _fileStream->readByte();
 
 		if (nextByte == 0) {
 			// Move one single byte from reference surface
-			assert(frameSize > 0);
 			destP[screenOffset] = refP[screenOffset];
 			++screenOffset;
 			--frameSize;
@@ -337,20 +337,21 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 			++screenOffset;
 			--frameSize;
 		} else if (nextByte == 0x80) {
-			byte runLength = _fileStream->readByte();
+			int runLength = _fileStream->readByte();
 			if (runLength == 0)
 				return;
 
-			assert(frameSize >= runLength);
+			// Run length of transparency (i.e. pixels to copy from reference frame)
+			runLength = MIN(runLength, frameSize);
 			Common::copy(refP + screenOffset, refP + screenOffset + runLength, destP + screenOffset);
 			screenOffset += runLength;
 			frameSize -= runLength;
 		} else {
 			// Run length of a single pixel value
-			byte runLength = _fileStream->readByte();
+			int runLength = _fileStream->readByte();
 			nextByte &= 0x7f;
 
-			assert(frameSize >= runLength);
+			runLength = MIN(runLength, frameSize);
 			Common::fill(destP + screenOffset, destP + screenOffset + runLength, nextByte);
 			screenOffset += runLength;
 			frameSize -= runLength;


Commit: 3e268ca4e0963b95e36d84e506d1d2397fa84ecb
    https://github.com/scummvm/scummvm/commit/3e268ca4e0963b95e36d84e506d1d2397fa84ecb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T15:43:47-08:00

Commit Message:
VOYEUR: Fix to cardPerform switch cases

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index ecf564c..df6ad3a 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -787,6 +787,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 	int v3;
 	byte bVal;
 	uint32 idx1, idx2;
+	debugC(DEBUG_BASIC, kDebugScripts, "cardPerform - %d", id);
 
 	switch (id) {
 	case 1:
@@ -888,17 +889,17 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		card += 2;
 		break;
 
-	case 22:
 	case 23:
-	case 26:
+	case 24:
 	case 27:
+	case 28:
 		varD -= 3;	
 		// Deliberate fall-through
 
-	case 20:
 	case 21:
-	case 24:
+	case 22:
 	case 25:
+	case 26:
 		bVal = card[varD];
 		if (bVal == 61) {
 			if (cardPerform2(card, id)) {


Commit: 5c20b3c331178129f6c9dcacce9b36b0a1133dd8
    https://github.com/scummvm/scummvm/commit/5c20b3c331178129f6c9dcacce9b36b0a1133dd8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T18:08:00-08:00

Commit Message:
VOYEUR: Implementing game end methods

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/files.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index b862f3a..0fc5669 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -22,6 +22,7 @@
 
 #include "voyeur/animation.h"
 #include "voyeur/staticres.h"
+#include "voyeur/voyeur.h"
 #include "common/memstream.h"
 #include "common/system.h"
 #include "audio/decoders/raw.h"
@@ -97,6 +98,27 @@ RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
 	return (RL2VideoTrack *)track;
 }
 
+void RL2Decoder::play(::Voyeur::VoyeurEngine *vm) {
+	vm->_eventsManager.getMouseInfo();
+
+	while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager._mouseClicked) {
+		if (hasDirtyPalette()) {
+			const byte *palette = getPalette();
+			vm->_graphicsManager.setPalette(palette, 0, 256);
+		}
+
+		if (needsUpdate()) {
+			const Graphics::Surface *frame = decodeNextFrame();
+
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+				(byte *)vm->_graphicsManager._screenSurface.getPixels());
+		}
+
+		vm->_eventsManager.getMouseInfo();
+		g_system->delayMillis(10);
+	}
+}
+
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2FileHeader::RL2FileHeader() {
@@ -288,18 +310,19 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithoutTransparency(int screenOffs
 			--frameSize;
 		} else if (nextByte > 0x80) {
 			// Lower 7 bits a run length for the following byte
-			byte runLength = _fileStream->readByte();
-			assert(frameSize >= runLength);
+			int runLength = _fileStream->readByte();
+			runLength = MIN(runLength, frameSize);
+
 			Common::fill(destP, destP + runLength, nextByte & 0x7f);
 			destP += runLength;
 			frameSize -= runLength;
 		} else {
 			// Follow byte run length for zeroes. If zero, indicates end of image
-			byte runLength = _fileStream->readByte();
+			int runLength = _fileStream->readByte();
 			if (runLength == 0)
 				break;
 
-			assert(frameSize >= runLength);
+			runLength = MIN(runLength, frameSize);
 			Common::fill(destP, destP + runLength, 0);
 			destP += runLength;
 			frameSize -= runLength;
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 9f1a2ab..c68c670 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -30,6 +30,12 @@
 #include "common/rect.h"
 #include "common/stream.h"
 
+namespace Voyeur {
+
+class VoyeurEngine;
+
+}
+
 namespace Video {
 
 /**
@@ -149,6 +155,7 @@ public:
 	void clearDirtyRects();
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 	RL2VideoTrack *getVideoTrack();
+	void play(::Voyeur::VoyeurEngine *vm);
 };
 
 } // End of namespace Video
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 1b33c5f..1e08acb 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -454,6 +454,7 @@ BVoyBoltFile::BVoyBoltFile(BoltFilesState &state): BoltFile("bvoy.blt", state) {
 void BVoyBoltFile::initResource(int resType) {
 	switch (resType) {
 	case 2:
+		// Also used for point list, and ending credits credit data
 		sInitRect();
 		break;
 	case 8:
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 051c8b9..fa9b12e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -102,6 +102,8 @@ Common::Error VoyeurEngine::run() {
 			_voy._field478 |= 0x80;
 
 		playStamp();
+		if (!shouldQuit())
+			doTailTitle();
 	}
 
 	//doHeadTitle();
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 2dde65c..8cf1325 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,11 +84,44 @@ private:
 	void playStamp();
 	void initStamp();
 	void closeStamp();
+
+	/**
+	 * Shows the game ending title animation
+	 */
+	void doTailTitle();
+
+	/**
+	 * Shows the game ending credits
+	 */
+	void doClosingCredits();
+
+	/**
+	 * Shows the final anti-piracy message before exiting the game
+	 */
+	void doPiracy();
+
 	void reviewTape();
+
+	/**
+	 * Shows the TV gossip animation
+	 */
 	void doGossip();
+
+	/**
+	 * Shows the animation of the VCR tape during the 'Call the Police' sequence
+	 */
 	void doTapePlaying();
+
+	/**
+	 * Does a check as to whether a murder has been witnessed
+	 */
 	bool checkForMurder();
+
+	/**
+	 * Does a check for whether incriminating evidence has been revealed
+	 */
 	bool checkForIncriminate();
+
 	void playAVideoEvent(int eventIndex);
 	int getChooseButton();
 protected:
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 740bf17..c0989e2 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -225,6 +225,166 @@ void VoyeurEngine::closeStamp() {
 	ThreadResource::unloadAllStacks(this);
 }
 
+void VoyeurEngine::doTailTitle() {
+	_bVoy->freeBoltGroup(0x100);
+	(*_graphicsManager._vPort)->setupViewPort(NULL);
+	_graphicsManager.screenReset();
+	
+	if (_bVoy->getBoltGroup(0x600)) {
+		::Video::RL2Decoder decoder;
+		decoder.loadFile("a1100200.rl2");
+		decoder.start();
+		decoder.play(this);
+		
+		if (!shouldQuit() && !_eventsManager._mouseClicked) {
+			doClosingCredits();
+
+			if (!shouldQuit() && !_eventsManager._mouseClicked) {
+				_graphicsManager.screenReset();
+				
+				PictureResource *pic = _bVoy->boltEntry(0x602)._picResource;
+				CMapResource *pal = _bVoy->boltEntry(0x603)._cMapResource;
+
+				(*_graphicsManager._vPort)->setupViewPort(pic);
+				pal->startFade();
+				flipPageAndWaitForFade();
+				_eventsManager.delayClick(300);
+
+				pic = _bVoy->boltEntry(0x604)._picResource;
+				pal = _bVoy->boltEntry(0x605)._cMapResource;
+
+				(*_graphicsManager._vPort)->setupViewPort(pic);
+				pal->startFade();
+				flipPageAndWaitForFade();
+				_eventsManager.delayClick(120);
+
+				_soundManager.stopVOCPlay();
+			}
+		}
+
+		_bVoy->freeBoltGroup(0x600);
+	}
+
+	if (!shouldQuit()) {
+		_bVoy->getBoltGroup(0x100);
+		doPiracy();
+	}
+}
+
+void VoyeurEngine::doClosingCredits() {
+	if (!_bVoy->getBoltGroup(0x400))
+		return;
+
+	const char *msg = (const char *)_bVoy->memberAddr(0x404);
+	const byte *yList = (const byte *)_bVoy->memberAddr(0x405);
+
+	(*_graphicsManager._vPort)->setupViewPort(NULL);
+	_graphicsManager.setColor(1, 180, 180, 180);
+	_graphicsManager.setColor(2, 200, 200, 200);
+	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._hasPalette = true;
+
+	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x402)._fontResource;
+	_graphicsManager._fontPtr->_foreColor = 2;
+	_graphicsManager._fontPtr->_backColor = 2;
+	_graphicsManager._fontPtr->_fontSaveBack = false;
+	_graphicsManager._fontPtr->_fontFlags = 0;
+
+	_soundManager.startVOCPlay(152);
+	FontInfoResource &fi = *_graphicsManager._fontPtr;
+
+	for (int idx = 0; idx < 78; ++idx) {
+		byte *entry = yList + idx * 6;
+		int flags = READ_LE_UINT16(entry + 4);
+
+		if (flags & 0x10)
+			(*_graphicsManager->_vPort)->sFillPic();
+
+		if (flags & 1) {
+			fi._foreColor = 1;
+			fi._curFont = _bVoy->boltEntry(0x402)._fontResource;
+			fi.justify = true;
+			fi.justifyWidth = 384;
+			fi._justifyHeight = 240;
+			fi._pos = Common::Point(0, READ_LE_UINT16(entry));
+
+			(*_graphicsManager._vPort)->drawText(msg);
+			msg += strlen(msg) + 1;
+		}
+		
+		if (flags & 0x40) {
+			fi._foreColor = 2;
+			fi._curFont = _bVoy->boltEntry(0x400)._fontResource;
+			fi.justify = true;
+			fi.justifyWidth = 384;
+			fi._justifyHeight = 240;
+			fi._pos = Common::Point(0, READ_LE_UINT16(entry));
+
+			(*_graphicsManager._vPort)->drawText(msg);
+			msg += strlen(msg) + 1;
+		}
+
+		if (flags & 2) {
+			fi._foreColor = 1;
+			fi._curFont = _bVoy->boltEntry(0x400)._fontResource;
+			fi.justify = false;
+			fi.justifyWidth = 384;
+			fi._justifyHeight = 240;
+			fi._pos = Common::Point(38, READ_LE_UINT16(entry));
+
+			(*_graphicsManager._vPort)->drawText(msg);
+			msg += strlen(msg) + 1;
+
+			fi._foreColor = 2;
+			fi.justify = false;
+			fi.justifyWidth = 384;
+			fi._justifyHeight = 240;
+			fi._pos = Common::Point(198, READ_LE_UINT16(entry));
+
+			(*_graphicsManager._vPort)->drawText(msg);			
+			msg += strlen(msg) + 1;
+		}
+
+		if (flags & 4) {
+			fi._foreColor = 1;
+			fi._curFont = _bVoy->boltEntry(0x402)._fontResource;
+			fi.justify = true;
+			fi.justifyWidth = 384;
+			fi._justifyHeight = 240;
+			fi._pos = Common::Point(0, READ_LE_UINT16(entry));
+
+			(*_graphicsManager._vPort)->drawText(msg);
+			msg += strlen(msg) + 1;
+
+			fi._foreColor = 2;
+			fi._curFont = _bVoy->boltEntry(0x400)._fontResource;
+			fi.justify = true;
+			fi.justifyWidth = 384;
+			fi._justifyHeight = 240;
+			fi._pos = Common::Point(0, READ_LE_UINT16(entry) + 13);
+
+			(*_graphicsManager._vPort)->drawText(msg);
+			msg += strlen(msg) + 1;
+		}
+
+		if (flags & 0x20) {
+			flipPageAndWait();
+			_eventsManager.delayClick(READ_LE_UINT16(entry + 2) * 60);
+		}
+
+		if (shouldQuit() || _eventsManager._mouseClicked)
+			break;
+	}
+
+	_soundManager.stopVOCPlay();
+	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
+	_bVoy->freeBoltGroup(0x400);
+}
+
+void VoyeurEngine::doPiracy() {
+
+}
+
 void VoyeurEngine::reviewTape() {
 //	int var22 = 0;
 	int si = 0;


Commit: 86a0d366e4f1234ea2f40c770efb2fffe292c9a9
    https://github.com/scummvm/scummvm/commit/86a0d366e4f1234ea2f40c770efb2fffe292c9a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-12-31T18:36:28-08:00

Commit Message:
VOYEUR: Implemented game ending title and credits

Changed paths:
    engines/voyeur/staticres.cpp
    engines/voyeur/staticres.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index d0f590e..7bba651 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -126,4 +126,17 @@ int DOT_LINE_LENGTH[9] = {
 	5, 7, 9, 11, 11, 11, 9, 7, 5
 };
 
+const char *const PIRACY_MESSAGE[] = {
+	"It is illegal to make",
+	"unauthorized copies of",
+	"this software. Duplication",
+	"of this software for any",
+	"reason including sale,",
+	"loan, rental, or gift is a",
+	"crime. Penalties include",
+	"fines of up to $50,000",
+	"and jail terms up to",
+	"5 years."
+};
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index a6b81f0..20bffe0 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -56,6 +56,8 @@ extern int DOT_LINE_START[9];
 extern int DOT_LINE_OFFSET[9];
 extern int DOT_LINE_LENGTH[9];
 
+extern const char *const PIRACY_MESSAGE[];
+
 } // End of namespace Voyeur
 
 #endif
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index c0989e2..c57de37 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -226,7 +226,6 @@ void VoyeurEngine::closeStamp() {
 }
 
 void VoyeurEngine::doTailTitle() {
-	_bVoy->freeBoltGroup(0x100);
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	_graphicsManager.screenReset();
 	
@@ -276,7 +275,7 @@ void VoyeurEngine::doClosingCredits() {
 		return;
 
 	const char *msg = (const char *)_bVoy->memberAddr(0x404);
-	const byte *yList = (const byte *)_bVoy->memberAddr(0x405);
+	const byte *creditList = (const byte *)_bVoy->memberAddr(0x405);
 
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	_graphicsManager.setColor(1, 180, 180, 180);
@@ -294,17 +293,17 @@ void VoyeurEngine::doClosingCredits() {
 	FontInfoResource &fi = *_graphicsManager._fontPtr;
 
 	for (int idx = 0; idx < 78; ++idx) {
-		byte *entry = yList + idx * 6;
+		const byte *entry = creditList + idx * 6;
 		int flags = READ_LE_UINT16(entry + 4);
 
 		if (flags & 0x10)
-			(*_graphicsManager->_vPort)->sFillPic();
+			(*_graphicsManager._vPort)->fillPic();
 
 		if (flags & 1) {
 			fi._foreColor = 1;
 			fi._curFont = _bVoy->boltEntry(0x402)._fontResource;
-			fi.justify = true;
-			fi.justifyWidth = 384;
+			fi._justify = ALIGN_CENTRE;
+			fi._justifyWidth = 384;
 			fi._justifyHeight = 240;
 			fi._pos = Common::Point(0, READ_LE_UINT16(entry));
 
@@ -315,8 +314,8 @@ void VoyeurEngine::doClosingCredits() {
 		if (flags & 0x40) {
 			fi._foreColor = 2;
 			fi._curFont = _bVoy->boltEntry(0x400)._fontResource;
-			fi.justify = true;
-			fi.justifyWidth = 384;
+			fi._justify = ALIGN_CENTRE;
+			fi._justifyWidth = 384;
 			fi._justifyHeight = 240;
 			fi._pos = Common::Point(0, READ_LE_UINT16(entry));
 
@@ -327,8 +326,8 @@ void VoyeurEngine::doClosingCredits() {
 		if (flags & 2) {
 			fi._foreColor = 1;
 			fi._curFont = _bVoy->boltEntry(0x400)._fontResource;
-			fi.justify = false;
-			fi.justifyWidth = 384;
+			fi._justify = ALIGN_LEFT;
+			fi._justifyWidth = 384;
 			fi._justifyHeight = 240;
 			fi._pos = Common::Point(38, READ_LE_UINT16(entry));
 
@@ -336,8 +335,8 @@ void VoyeurEngine::doClosingCredits() {
 			msg += strlen(msg) + 1;
 
 			fi._foreColor = 2;
-			fi.justify = false;
-			fi.justifyWidth = 384;
+			fi._justify = ALIGN_LEFT;
+			fi._justifyWidth = 384;
 			fi._justifyHeight = 240;
 			fi._pos = Common::Point(198, READ_LE_UINT16(entry));
 
@@ -348,8 +347,8 @@ void VoyeurEngine::doClosingCredits() {
 		if (flags & 4) {
 			fi._foreColor = 1;
 			fi._curFont = _bVoy->boltEntry(0x402)._fontResource;
-			fi.justify = true;
-			fi.justifyWidth = 384;
+			fi._justify = ALIGN_CENTRE;
+			fi._justifyWidth = 384;
 			fi._justifyHeight = 240;
 			fi._pos = Common::Point(0, READ_LE_UINT16(entry));
 
@@ -358,8 +357,8 @@ void VoyeurEngine::doClosingCredits() {
 
 			fi._foreColor = 2;
 			fi._curFont = _bVoy->boltEntry(0x400)._fontResource;
-			fi.justify = true;
-			fi.justifyWidth = 384;
+			fi._justify = ALIGN_CENTRE;
+			fi._justifyWidth = 384;
 			fi._justifyHeight = 240;
 			fi._pos = Common::Point(0, READ_LE_UINT16(entry) + 13);
 
@@ -382,7 +381,36 @@ void VoyeurEngine::doClosingCredits() {
 }
 
 void VoyeurEngine::doPiracy() {
+	_graphicsManager.screenReset();
+	_graphicsManager.setColor(1, 0, 0, 0);
+	_graphicsManager.setColor(2, 255, 255, 255);
+	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._hasPalette = true;
+	(*_graphicsManager._vPort)->setupViewPort(NULL);
+	(*_graphicsManager._vPort)->fillPic(1);
 
+	FontInfoResource &fi = *_graphicsManager._fontPtr;
+	fi._curFont = _bVoy->boltEntry(0x101)._fontResource;
+	fi._foreColor = 2;
+	fi._backColor = 2;
+	fi._fontSaveBack = false;
+	fi._fontFlags = 0;
+	fi._justify = ALIGN_CENTRE;
+	fi._justifyWidth = 384;
+	fi._justifyHeight = 230;
+
+	// Loop through the piracy message array to draw each line
+	int yp, idx;
+	for (idx = 0, yp = 33; idx < 10; ++idx) {
+		fi._pos = Common::Point(0, yp);
+		(*_graphicsManager._vPort)->drawText(PIRACY_MESSAGE[idx]);
+
+		yp += fi._curFont->_fontHeight + 4;
+	}
+
+	flipPageAndWait();
+	_eventsManager.getMouseInfo();
+	_eventsManager.delayClick(720);
 }
 
 void VoyeurEngine::reviewTape() {


Commit: 76f7d974f6f0fe97033e07481f0b9d8f2cc2b42b
    https://github.com/scummvm/scummvm/commit/76f7d974f6f0fe97033e07481f0b9d8f2cc2b42b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-02T16:28:31-08:00

Commit Message:
VOYEUR: In progress work trying to fix doGossip

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 0fc5669..5bda66e 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -195,7 +195,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 		initBackSurface();
 
 	_videoBase = header._videoBase;
-	_dirtyPalette = true;
+	_dirtyPalette = header._colorCount > 0;
 
 	_curFrame = 0;
 	_nextFrameStartTime = 0;
@@ -261,7 +261,7 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 
 	// Decode the graphic data using the appropriate method depending on whether the animation
 	// has a background or just raw frames without any background transparency
-	if (_hasBackFrame) {
+	if (_backSurface) {
 		rl2DecodeFrameWithTransparency(_videoBase);
 	} else {
 		rl2DecodeFrameWithoutTransparency(_videoBase);
@@ -350,6 +350,7 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 
 		if (nextByte == 0) {
 			// Move one single byte from reference surface
+			assert(frameSize > 0);
 			destP[screenOffset] = refP[screenOffset];
 			++screenOffset;
 			--frameSize;
@@ -366,6 +367,7 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 
 			// Run length of transparency (i.e. pixels to copy from reference frame)
 			runLength = MIN(runLength, frameSize);
+
 			Common::copy(refP + screenOffset, refP + screenOffset + runLength, destP + screenOffset);
 			screenOffset += runLength;
 			frameSize -= runLength;
@@ -373,8 +375,8 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 			// Run length of a single pixel value
 			int runLength = _fileStream->readByte();
 			nextByte &= 0x7f;
-
 			runLength = MIN(runLength, frameSize);
+
 			Common::fill(destP + screenOffset, destP + screenOffset + runLength, nextByte);
 			screenOffset += runLength;
 			frameSize -= runLength;
@@ -386,14 +388,11 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 		Common::copy(refP + screenOffset, refP + (_surface->w * _surface->h), destP + screenOffset);
 }
 
-void RL2Decoder::RL2VideoTrack::setupBackSurface(Graphics::Surface *surface) {
+Graphics::Surface *RL2Decoder::RL2VideoTrack::getBackSurface() {
 	if (!_backSurface)
 		initBackSurface();
 
-	assert(surface->w == _backSurface->w && surface->h == _backSurface->h);
-	const byte *srcP = (const byte *)surface->getPixels();
-	byte *destP = (byte *)_backSurface->getPixels();
-	Common::copy(srcP, srcP + surface->w * surface->h, destP);
+	return _backSurface;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index c68c670..ed23777 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -105,17 +105,18 @@ private:
 		uint16 getWidth() const;
 		uint16 getHeight() const;
 		Graphics::Surface *getSurface() { return _surface; }
+		Graphics::Surface *getBackSurface();
 		Graphics::PixelFormat getPixelFormat() const;
 		int getCurFrame() const { return _curFrame; }
 		int getFrameCount() const { return _header._numFrames; }
 		uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
 		const Graphics::Surface *decodeNextFrame();
 		const byte *getPalette() const { _dirtyPalette = false; return _header._palette; }
+		int getPaletteCount() const { return _header._colorCount; }
 		bool hasDirtyPalette() const { return _dirtyPalette; }
 		const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
 		void clearDirtyRects() { _dirtyRects.clear(); }
 		void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
-		void setupBackSurface(Graphics::Surface *surface);
 
 	private:
 		Common::SeekableReadStream *_fileStream;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index f189d2b..e4b30b1 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -680,6 +680,18 @@ void GraphicsManager::setOneColor(int idx, byte r, byte g, byte b) {
 	g_system->getPaletteManager()->setPalette(&palEntry[0], idx, 1);
 }
 
+void GraphicsManager::setColors(int start, int count, const byte *pal) {
+	for (int i = 0; i < count; ++i) {
+		if ((i + start) != 128) {
+			const byte *rgb = pal + i * 3;
+			setColor(i + start, rgb[0], rgb[1], rgb[2]);
+		}
+	}
+
+	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._hasPalette = true;
+}
+
 void GraphicsManager::screenReset() {
 	resetPalette();
 
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 92b3e51..970e814 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -111,6 +111,7 @@ public:
 	void resetPalette();
 	void setColor(int idx, byte r, byte g, byte b);
 	void setOneColor(int idx, byte r, byte g, byte b);
+	void setColors(int start, int count, const byte *pal);	
 	void screenReset();
 	void fadeDownICF1(int steps);
 	void fadeUpICF1(int steps);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index c57de37..dab7149 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -688,23 +688,21 @@ void VoyeurEngine::doGossip() {
 	pal->startFade();
 
 	// Transfer initial background to video decoder
-	//PictureResource videoFrame(decoder.getVideoSurface());
-	//_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20));
+	PictureResource videoFrame(decoder.getVideoTrack()->getBackSurface());
+	bgPic->_bounds.moveTo(0, 0);
+	_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(0, 0));
 
 	flipPageAndWait();
 
-	/*
 	byte *frameNumsP = _bVoy->memberAddr(0x309);
 	byte *posP = _bVoy->boltEntry(0x30A)._data;
 
 	// Main playback loop
-
 	int picCtr = 0;
-	decoder.start();
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
-			_graphicsManager.setPalette(palette, 0, 256);
+			_graphicsManager.setPalette(palette, 128, 128);
 		}
 		
 		if (decoder.needsUpdate()) {
@@ -723,15 +721,12 @@ void VoyeurEngine::doGossip() {
 			const Graphics::Surface *frame = decoder.decodeNextFrame();
 			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
-
-
-			flipPageAndWait();
 		}
-
-		_eventsManager.pollEvents();
+		
+		_eventsManager.getMouseInfo();
 		g_system->delayMillis(10);
 	}
-
+	/*
 	decoder.loadFile("a2110100.rl2");
 	decoder.start();
 


Commit: 1c3708630bd4e2698704883e1b1aeea94ef8379b
    https://github.com/scummvm/scummvm/commit/1c3708630bd4e2698704883e1b1aeea94ef8379b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T11:20:53-08:00

Commit Message:
VOYEUR: Replaced original game mansion scrolling with a more effective one

The original had the cursor fixed in the middle of the screen, and
scrolled the mansion view as the mouse moves. Since this doesn't really
work for windowed mode nor tablets, I've replaced it with a new version
that scrolls when the mouse cursor is near any edge of the screen

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 6ac36dd..e7f7916 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -488,7 +488,7 @@ void EventsManager::setCursor(PictureResource *pic) {
 }
 
 void EventsManager::setCursor(byte *cursorData, int width, int height) {
-	CursorMan.replaceCursor(cursorData, width, height, 0, 0, 0);
+	CursorMan.replaceCursor(cursorData, width, height, width / 2, height / 2, 0);
 }
 
 void EventsManager::setCursorColor(int idx, int mode) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 0532b7c..17f5ccc 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -445,8 +445,6 @@ public:
 	static CMapResource *_cmd14Pal;
 	static void initUseCount();
 	static void unloadAllStacks(VoyeurEngine *vm);
-	static int _currentMouseX;
-	static int _currentMouseY;
 	static int _doAptPosX;
 	static int _doAptPosY;
 
@@ -487,6 +485,12 @@ private:
 	 * Does any necessary animation at the start or end of showing the apartment.
 	 */
 	void doAptAnim(int mode);
+
+	/**
+	 * Updates the mansion scroll position if ncessary, and returns true if it
+	 * has been changed.
+	 */
+	bool checkMansionScroll();
 public:
 	VoyeurEngine *_vm;
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index df6ad3a..2d9ae81 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -31,8 +31,6 @@ int ThreadResource::_stampFlags;
 int ThreadResource::_useCount[8];
 byte *ThreadResource::_threadDataPtr;
 CMapResource *ThreadResource::_cmd14Pal;
-int ThreadResource::_currentMouseX;
-int ThreadResource::_currentMouseY;
 int ThreadResource::_doAptPosX;
 int ThreadResource::_doAptPosY;
 
@@ -41,8 +39,6 @@ void ThreadResource::init() {
 	Common::fill(&_useCount[0], &_useCount[8], 0);
 	_threadDataPtr = nullptr;
 	_cmd14Pal = nullptr;
-	_currentMouseX = 392;
-	_currentMouseY = 57;
 	_doAptPosX = -1;
 	_doAptPosY = -1;
 }
@@ -1361,7 +1357,6 @@ int ThreadResource::doInterface() {
 		_vm->_voy._RTVNum = _vm->_voy._field476;
 		_vm->makeViewFinder();
 
-		_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 		_vm->initIFace();
 		_vm->_voy._RTVNum = _vm->_voy._field476 - 4;
 		_vm->_voy._field478 &= ~1;
@@ -1378,7 +1373,6 @@ int ThreadResource::doInterface() {
 	_vm->checkTransition();
 	_vm->makeViewFinder();
 	_vm->_eventsManager.getMouseInfo();
-	_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 	_vm->initIFace();
 
 	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
@@ -1389,26 +1383,34 @@ int ThreadResource::doInterface() {
 	Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_playStamp2);
 	_vm->_soundManager.startVOCPlay(fname);
 	_vm->_eventsManager.getMouseInfo();
-	_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 	
 	_vm->_graphicsManager.setColor(240, 220, 220, 220);
 	_vm->_eventsManager._intPtr.field38 = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 	_vm->_voy._field478 &= ~1;
 
+	// Set the cusor 
+	PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource;
+	PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x114)._picResource;
+	PictureResource *unk1Cursor = _vm->_bVoy->boltEntry(0x115)._picResource;
+	PictureResource *unk2Cursor = _vm->_bVoy->boltEntry(0x113)._picResource;
+
+	_vm->_eventsManager.setCursor(crosshairsCursor);
+	_vm->_eventsManager.showCursor();
+
+	// Main loop
 	int priorRegionIndex = -1;
 	int regionIndex = 0;
+	Common::Rect mansionViewBounds(MANSION_VIEW_X, MANSION_VIEW_Y,
+		MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT);
+
 	do {
 		_vm->doTimeBar(true);
 		_vm->_eventsManager.getMouseInfo();
 
-		pt = _vm->_eventsManager.getMousePos();
-		if (pt.x != _currentMouseX || pt.y != _currentMouseY || regionIndex != priorRegionIndex) {
+		if (checkMansionScroll()) {
 			priorRegionIndex = regionIndex;
-			_vm->doScroll(pt);
-
-			_currentMouseX = pt.x;
-			_currentMouseY = pt.y;
+			_vm->doScroll(_vm->_mansionViewPos);
 		}
 
 		_vm->checkPhoneCall();
@@ -1417,7 +1419,13 @@ int ThreadResource::doInterface() {
 			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
 		}
 
-		pt = _vm->_eventsManager.getMousePos() + Common::Point(120, 75);
+		// Calculate the mouse position within the entire mansion
+		pt = _vm->_eventsManager.getMousePos();
+		if (!mansionViewBounds.contains(pt))
+			pt = Common::Point(-1, -1);
+		else
+			pt = _vm->_mansionViewPos + 
+				Common::Point(pt.x - MANSION_VIEW_X, pt.y - MANSION_VIEW_Y);
 		regionIndex = -1;
 
 		for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
@@ -1426,19 +1434,15 @@ int ThreadResource::doInterface() {
 				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
 					if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) {
-						// Draw the picture
-						pic = _vm->_bVoy->boltEntry(276)._picResource;
-						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
-							Common::Point(178, 108));
+						// Found a hotspot - switch to the magnifying glass cursor
+						_vm->_eventsManager.setCursor(mangifyCursor);
 						regionIndex = idx;
 					}
 
 					if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) {
-						// Draw the picture
-						pic = _vm->_bVoy->boltEntry(277)._picResource;
-						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
-							Common::Point(178, 108));
+						// Set unk? cursor 
+						_vm->_eventsManager.setCursor(unk1Cursor);
 						regionIndex = idx;
 					}
 				}
@@ -1447,9 +1451,7 @@ int ThreadResource::doInterface() {
 					if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) {
 						// Draw the picture
-						pic = _vm->_bVoy->boltEntry(375)._picResource;
-						_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
-							Common::Point(178, 108));
+						_vm->_eventsManager.setCursor(unk2Cursor);
 						regionIndex = idx;
 					}
 				}
@@ -1457,10 +1459,8 @@ int ThreadResource::doInterface() {
 		}
 
 		if (regionIndex == -1) {
-			// Draw the crosshairs cursor in the center of the screen
-			pic = _vm->_bVoy->boltEntry(274)._picResource;
-			_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, 
-				Common::Point(178, 108));
+			// Reset back to the crosshairs cursor
+			_vm->_eventsManager.setCursor(crosshairsCursor);
 		}
 
 		// Regularly update the time display
@@ -1499,20 +1499,16 @@ int ThreadResource::doInterface() {
 				_vm->_eventsManager._leftClick = true;
 			} else {
 				_vm->_voy._field478 = 1;
-				_currentMouseX = pt.x;
-				_currentMouseY = pt.y;
 
 				chooseSTAMPButton(20);
 				parsePlayCommands();
 				_vm->checkTransition();
 				_vm->makeViewFinder();
 
-				_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 				_vm->initIFace();
 				
 				hotspots = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries;
 				_vm->_eventsManager.getMouseInfo();
-				_vm->_eventsManager.setMousePos(Common::Point(_currentMouseX, _currentMouseY));
 
 				_vm->_voy._field478 &= ~2;
 				_vm->_eventsManager._intPtr.field1E = 1;
@@ -1522,6 +1518,7 @@ int ThreadResource::doInterface() {
 	} while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && 
 		(!_vm->_eventsManager._leftClick || regionIndex == -1));
 
+	_vm->_eventsManager.hideCursor();
 	_vm->_voy._field478 |= 1;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
 	if (_vm->_playStamp2 != -1)
@@ -1530,6 +1527,36 @@ int ThreadResource::doInterface() {
 	return !_vm->_eventsManager._rightClick ? regionIndex : -2;
 }
 
+bool ThreadResource::checkMansionScroll() {
+	Common::Point pt = _vm->_eventsManager.getMousePos() -
+		Common::Point(MANSION_VIEW_X, MANSION_VIEW_Y);
+	Common::Point &viewPos = _vm->_mansionViewPos;
+	bool result = false;
+
+	// Scroll mansion view if close to any of the mansion edges
+	if (pt.x >= 0 && pt.x < MANSION_SCROLL_AREA_X && viewPos.x > 0) {
+		viewPos.x = MAX(viewPos.x - MANSION_SCROLL_INC_X, 0);
+		result = true;
+	}
+	if  (pt.x >= (MANSION_VIEW_WIDTH - MANSION_SCROLL_AREA_X) &&
+			pt.x < MANSION_VIEW_WIDTH && viewPos.x < MANSION_MAX_X) {
+		viewPos.x = MIN(viewPos.x + MANSION_SCROLL_INC_X, MANSION_MAX_X);
+		result = true;
+	}
+	if (pt.y >= 0 && pt.y < MANSION_SCROLL_AREA_Y && viewPos.y > 0) {
+		viewPos.y = MAX(viewPos.y - MANSION_SCROLL_INC_Y, 0);
+		result = true;
+	}
+	if  (pt.y >= (MANSION_VIEW_HEIGHT - MANSION_SCROLL_AREA_Y) &&
+			pt.y < MANSION_VIEW_HEIGHT && viewPos.y < MANSION_MAX_Y) {
+		viewPos.y = MIN(viewPos.y + MANSION_SCROLL_INC_Y, MANSION_MAX_Y);
+		result = true;
+	}
+
+	// Return whether mansion view area has changed
+	return result;
+}
+
 bool ThreadResource::goToStateID(int stackId, int sceneId) {
 	debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId);
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index fa9b12e..cf4a135 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -51,6 +51,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_flashTimeFlag = false;
 	_timeBarVal = -1;
 	_checkPhoneVal = 0;
+	_mansionScrollCountdown = 0;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 8cf1325..209f5ec 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -52,6 +52,18 @@ namespace Voyeur {
 
 #define MAX_RESOLVE 1000
 
+// Maximum scroll x, y for viewing the mansion
+#define MANSION_MAX_X 784
+#define MANSION_MAX_Y 150
+#define MANSION_VIEW_X 40
+#define MANSION_VIEW_Y 27
+#define MANSION_VIEW_WIDTH 240
+#define MANSION_VIEW_HEIGHT 148
+#define MANSION_SCROLL_AREA_X 20
+#define MANSION_SCROLL_AREA_Y 10
+#define MANSION_SCROLL_INC_X 4
+#define MANSION_SCROLL_INC_Y 2
+
 enum VoyeurDebugChannels {
 	kDebugPath      = 1 << 0,
 	kDebugScripts	= 1 << 1
@@ -156,6 +168,8 @@ public:
 	bool _flashTimeFlag;
 	int _timeBarVal;
 	int _checkPhoneVal;
+	Common::Point _mansionViewPos;
+	int _mansionScrollCountdown;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index dab7149..73484d7 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1021,7 +1021,10 @@ void VoyeurEngine::initIFace(){
 	CMapResource *pal = _bVoy->boltEntry(_playStamp1 + 2)._cMapResource;
 	pal->startFade();
 
-	doScroll(_eventsManager.getMousePos());
+	// Start the mansion off centered
+	_mansionViewPos = Common::Point((MANSION_MAX_X - MANSION_VIEW_WIDTH) / 2,
+		(MANSION_MAX_Y - MANSION_VIEW_HEIGHT) / 2);
+	doScroll(_mansionViewPos);
 	
 	_voy._viewBounds = _bVoy->boltEntry(_playStamp1)._rectResource;
 


Commit: 5b2ad8515e45642bc2829d4f62aaa571b73b1bf1
    https://github.com/scummvm/scummvm/commit/5b2ad8515e45642bc2829d4f62aaa571b73b1bf1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T11:28:40-08:00

Commit Message:
VOYEUR: Fix names of cursor variables in doInterface

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 2d9ae81..87a8249 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1391,9 +1391,9 @@ int ThreadResource::doInterface() {
 
 	// Set the cusor 
 	PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource;
-	PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x114)._picResource;
-	PictureResource *unk1Cursor = _vm->_bVoy->boltEntry(0x115)._picResource;
-	PictureResource *unk2Cursor = _vm->_bVoy->boltEntry(0x113)._picResource;
+	PictureResource *eyeCursor = _vm->_bVoy->boltEntry(0x113)._picResource;
+	PictureResource *listenCursor = _vm->_bVoy->boltEntry(0x114)._picResource;
+	PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x115)._picResource;
 
 	_vm->_eventsManager.setCursor(crosshairsCursor);
 	_vm->_eventsManager.showCursor();
@@ -1435,14 +1435,14 @@ int ThreadResource::doInterface() {
 					if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) {
 						// Found a hotspot - switch to the magnifying glass cursor
-						_vm->_eventsManager.setCursor(mangifyCursor);
+						_vm->_eventsManager.setCursor(listenCursor);
 						regionIndex = idx;
 					}
 
 					if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) {
 						// Set unk? cursor 
-						_vm->_eventsManager.setCursor(unk1Cursor);
+						_vm->_eventsManager.setCursor(mangifyCursor);
 						regionIndex = idx;
 					}
 				}
@@ -1451,7 +1451,7 @@ int ThreadResource::doInterface() {
 					if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum &&
 							_vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) {
 						// Draw the picture
-						_vm->_eventsManager.setCursor(unk2Cursor);
+						_vm->_eventsManager.setCursor(eyeCursor);
 						regionIndex = idx;
 					}
 				}


Commit: 795422bb2909bbcc84d259021257cad2ed323522
    https://github.com/scummvm/scummvm/commit/795422bb2909bbcc84d259021257cad2ed323522
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T11:35:17-08:00

Commit Message:
VOYEUR: Fix loading of correct hotspot list in doInterface

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 87a8249..0a11f47 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1376,7 +1376,7 @@ int ThreadResource::doInterface() {
 	_vm->initIFace();
 
 	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
-		_vm->_playStamp1)._rectResource->_entries;
+		_vm->_playStamp1 + 1)._rectResource->_entries;
 	_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
 	_vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29);
 


Commit: ac157b7bc740a1878f22c659fc20a49cf75e9d1f
    https://github.com/scummvm/scummvm/commit/ac157b7bc740a1878f22c659fc20a49cf75e9d1f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T12:17:40-08:00

Commit Message:
VOYEUR: Workaround for original code causing crash after calling doEvidDisplay

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 0a11f47..4a4ec61 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1271,8 +1271,11 @@ void ThreadResource::doRoom() {
 			if (!vm._eventsManager._mouseClicked)
 				vm._eventsManager.delayClick(18000);
 
-			vm._bVoy->freeBoltGroup(vm._playStamp1);
-			vm._bVoy->getBoltGroup(vm._playStamp1);
+			// WORKAROUND: Done in original, but not now, since freeing and reloading
+			// the group would invalidate the _backgroundPage picture resource
+			//vm._bVoy->freeBoltGroup(vm._playStamp1);
+			//vm._bVoy->getBoltGroup(vm._playStamp1);
+
 			dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4);
 			pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
 			pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 73484d7..0a4537f 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1356,8 +1356,8 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 
 	count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
 	for (int idx = 1; idx <= count; ++idx) {
-		_bVoy->freeBoltGroup(_voy._field47A + (evidId + idx) * 2);
-		_bVoy->freeBoltGroup(_voy._field47A + (evidId + idx) * 2 + 1);
+		_bVoy->freeBoltMember(_voy._field47A + (evidId + idx) * 2);
+		_bVoy->freeBoltMember(_voy._field47A + (evidId + idx) * 2 + 1);
 	}
 }
 


Commit: 2db6d543a0e893d2a6827353810c73f72dd54201
    https://github.com/scummvm/scummvm/commit/2db6d543a0e893d2a6827353810c73f72dd54201
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T12:20:44-08:00

Commit Message:
VOYEUR: Tweaked vertical scroll area/rate for viewing mansion

Changed paths:
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 209f5ec..302f2b4 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -52,7 +52,7 @@ namespace Voyeur {
 
 #define MAX_RESOLVE 1000
 
-// Maximum scroll x, y for viewing the mansion
+// Constants used for doInterface display of the mansion
 #define MANSION_MAX_X 784
 #define MANSION_MAX_Y 150
 #define MANSION_VIEW_X 40
@@ -60,9 +60,9 @@ namespace Voyeur {
 #define MANSION_VIEW_WIDTH 240
 #define MANSION_VIEW_HEIGHT 148
 #define MANSION_SCROLL_AREA_X 20
-#define MANSION_SCROLL_AREA_Y 10
+#define MANSION_SCROLL_AREA_Y 20
 #define MANSION_SCROLL_INC_X 4
-#define MANSION_SCROLL_INC_Y 2
+#define MANSION_SCROLL_INC_Y 4
 
 enum VoyeurDebugChannels {
 	kDebugPath      = 1 << 0,


Commit: bbecd20818f96b0128dfb0a5fb539fe3bcc4d2d5
    https://github.com/scummvm/scummvm/commit/bbecd20818f96b0128dfb0a5fb539fe3bcc4d2d5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T13:00:12-08:00

Commit Message:
VOYEUR: Variable renaming for Video Id

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index e7f7916..5053b38 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -84,7 +84,6 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_newMouseClicked = _newMouseUnk = false;
 
 	_v2A0A2 = 0;
-	_videoComputerBut4 = 0;
 	_videoDead = 0;
 }
 
@@ -575,7 +574,7 @@ void EventsManager::addVideoEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _vm->_voy._isAM;
 	e._type = EVTYPE_VIDEO;
-	e._field8 = _vm->_eventsManager._videoComputerBut4;
+	e._videoId = _vm->_videoId;
 	e._computerOn = _vm->_voy._vocSecondsOffset;
 	e._dead = _vm->_eventsManager._videoDead;
 }
@@ -593,7 +592,7 @@ void EventsManager::addAudioEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _vm->_voy._isAM;
 	e._type = EVTYPE_AUDIO;
-	e._field8 = _vm->_eventsManager._videoComputerBut4;
+	e._videoId = _vm->_videoId;
 	e._computerOn = _vm->_voy._field47A;
 	e._dead = _vm->_eventsManager._videoDead;
 }
@@ -611,7 +610,7 @@ void EventsManager::addEvidEventStart(int v) {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _vm->_voy._isAM;
 	e._type = EVTYPE_EVID;
-	e._field8 = _vm->_eventsManager._videoComputerBut4;
+	e._videoId = _vm->_videoId;
 	e._computerOn = _vm->_voy._vocSecondsOffset;
 	e._dead = _vm->_eventsManager._videoDead;
 
@@ -630,7 +629,7 @@ void EventsManager::addComputerEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _vm->_voy._isAM;
 	e._type = EVTYPE_COMPUTER;
-	e._field8 = _vm->_playStamp1;
+	e._videoId = _vm->_playStamp1;
 	e._computerOn = _vm->_voy._computerTextId;
 }
 
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 4734e54..1e884c6 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -59,7 +59,7 @@ struct VoyeurEvent {
 	int _minute;
 	bool _isAM;
 	VoyeurEventType _type;
-	int _field8;
+	int _videoId;
 	int _computerOn;
 	int _computerOff;
 	int _dead;
@@ -193,7 +193,6 @@ public:
 	bool _newMouseUnk;
 
 	int _v2A0A2;
-	int _videoComputerBut4;
 	int _videoDead;
 	int _cycleTime[4];
 	byte *_cycleNext[4];
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 4a4ec61..4adf4d7 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -373,22 +373,22 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2);
+				_vm->_videoId = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
 				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
 						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
-					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_videoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_eventsManager.addAudioEventStart();
 
-					assert(_vm->_eventsManager._videoComputerBut4 < 38);
+					assert(_vm->_videoId < 38);
 					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
-						0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource;
+						0x7F00 + BLIND_TABLE[_vm->_videoId])._picResource;
 					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 
-						BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource;
+						BLIND_TABLE[_vm->_videoId])._cMapResource;
 
 					(*_vm->_graphicsManager._vPort)->setupViewPort();
 					_vm->_graphicsManager._backColors->startFade();
@@ -397,7 +397,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._field478 = -2;
 					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
 					Common::String filename = _vm->_soundManager.getVOCFileName(
-						_vm->_eventsManager._videoComputerBut4 + 159);
+						_vm->_videoId + 159);
 					_vm->_soundManager.startVOCPlay(filename);
 					_vm->_voy._field478 |= 16;
 					_vm->_eventsManager.startCursorBlink();
@@ -414,7 +414,7 @@ void ThreadResource::parsePlayCommands() {
 
 					_vm->_bVoy->freeBoltGroup(0x7F00);
 					_vm->_voy._field478 = -17;
-					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_videoId = -1;
 					_vm->_voy._field470 = 129;
 					parseIndex = 999;
 				}				
@@ -427,26 +427,26 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP + 2);
+				_vm->_videoId = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
 				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
 						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
-					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_videoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_eventsManager.addAudioEventStart();
 					_vm->_voy._field478 &= ~1;
 					_vm->_voy._field478 |= 0x10;
-					_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
+					_vm->playAVideo(_vm->_videoId);
 
 					_vm->_voy._field478 &= ~0x10;
 					_vm->_voy._field478 |= 1;
 					_vm->_eventsManager.addVideoEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 				
-					_vm->_eventsManager._videoComputerBut4 = -1;
+					_vm->_videoId = -1;
 					_vm->_playStamp1 = -1;
 
 					if (_vm->_eventsManager._videoDead != -1) {
@@ -470,7 +470,7 @@ void ThreadResource::parsePlayCommands() {
 
 		case 4:
 		case 22:
-			_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
+			_vm->_videoId = READ_LE_UINT16(dataP) - 1;
 			dataP += 2;
 
 			if (id == 22) {
@@ -482,11 +482,11 @@ void ThreadResource::parsePlayCommands() {
 			_vm->_voy._vocSecondsOffset = 0;
 			_vm->_voy._field468 = _vm->_voy._RTVNum;
 			_vm->_voy._field478 &= ~0x11;
-			_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
+			_vm->playAVideo(_vm->_videoId);
 			_vm->_voy._field478 |= 1;
 
 			if (id != 22) {
-				_vm->_eventsManager._videoComputerBut4 = -1;
+				_vm->_videoId = -1;
 				parseIndex = 999;
 			} else {
 				// TODO: Double-check this
@@ -528,7 +528,7 @@ void ThreadResource::parsePlayCommands() {
 
 				_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
 				_vm->_playStamp1 = -1;
-				_vm->_eventsManager._videoComputerBut4 = -1;
+				_vm->_videoId = -1;
 				parseIndex = 999;
 			}
 			break;			
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index cf4a135..24738fa 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -44,6 +44,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_controlPtr = NULL;
 	_bob = false;
 	_playStamp1 = _playStamp2 = 0;
+	_videoId = -1;
 	_checkTransitionId = -1;
 	_gameHour = 0;
 	_gameMinute = 0;
@@ -478,7 +479,7 @@ void VoyeurEngine::doOpening() {
 	_voy._field478 = 16;
 	_eventsManager._gameHour = 4;
 	_eventsManager._gameMinute  = 0;
-	_eventsManager._videoComputerBut4 = 1;
+	_videoId = 1;
 	_eventsManager._videoDead = -1;
 	addVideoEventStart();
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 302f2b4..f146ee2 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -159,6 +159,7 @@ public:
 	bool _bob;
 	int _playStamp1;
 	int _playStamp2;
+	int _videoId;
 	const int *_resolvePtr;
 	int _iForceDeath;
 	int _checkTransitionId;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 0a4537f..5f6b7b3 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -49,7 +49,7 @@ void VoyeurEngine::playStamp() {
 	while (!breakFlag && !shouldQuit()) {
 		_eventsManager.getMouseInfo();
 		_playStamp1 = _playStamp2 = -1;
-		_eventsManager._videoComputerBut4 = -1;
+		_videoId = -1;
 
 		threadP->parsePlayCommands();
 
@@ -179,7 +179,7 @@ void VoyeurEngine::playStamp() {
 					_playStamp2 = -1;
 				}
 
-				_eventsManager._videoComputerBut4 = -1;
+				_videoId = -1;
 
 				if (_voy._field47A != -1) {
 					_bVoy->freeBoltGroup(_voy._field47A);
@@ -787,28 +787,28 @@ bool VoyeurEngine::checkForMurder() {
 		if (evt._type == EVTYPE_VIDEO) {
 			switch (READ_LE_UINT32(_controlPtr->_ptr + 4)) {
 			case 1:
-				if (evt._field8 == 41 && evt._computerOn <= 15 &&
+				if (evt._videoId == 41 && evt._computerOn <= 15 &&
 						(evt._computerOff + evt._computerOn) >= 16) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 1);
 				}
 				break;
 
 			case 2:
-				if (evt._field8 == 53 && evt._computerOn <= 19 &&
+				if (evt._videoId == 53 && evt._computerOn <= 19 &&
 						(evt._computerOff + evt._computerOn) >= 21) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 2);
 				}
 				break;
 
 			case 3:
-				if (evt._field8 == 50 && evt._computerOn <= 28 &&
+				if (evt._videoId == 50 && evt._computerOn <= 28 &&
 						(evt._computerOff + evt._computerOn) >= 29) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 3);
 				}
 				break;
 
 			case 4:
-				if (evt._field8 == 43 && evt._computerOn <= 10 &&
+				if (evt._videoId == 43 && evt._computerOn <= 10 &&
 						(evt._computerOff + evt._computerOn) >= 14) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 4);
 				}
@@ -837,27 +837,27 @@ bool VoyeurEngine::checkForIncriminate() {
 		VoyeurEvent &evt = _voy._events[idx];
 		
 		if (evt._type == EVTYPE_VIDEO) {
-			if (evt._field8 == 44 && evt._computerOn <= 40 &&
+			if (evt._videoId == 44 && evt._computerOn <= 40 &&
 					(evt._computerOff + evt._computerOn) >= 70) {
 				_voy._field4382 = 1;
 			}
 
-			if (evt._field8 == 44 && evt._computerOn <= 79 &&
+			if (evt._videoId == 44 && evt._computerOn <= 79 &&
 					(evt._computerOff + evt._computerOn) >= 129) {
 				_voy._field4382 = 1;
 			}
 
-			if (evt._field8 == 20 && evt._computerOn <= 28 &&
+			if (evt._videoId == 20 && evt._computerOn <= 28 &&
 					(evt._computerOff + evt._computerOn) >= 45) {
 				_voy._field4382 = 2;
 			}
 
-			if (evt._field8 == 35 && evt._computerOn <= 17 &&
+			if (evt._videoId == 35 && evt._computerOn <= 17 &&
 					(evt._computerOff + evt._computerOn) >= 36) {
 				_voy._field4382 = 3;
 			}
 
-			if (evt._field8 == 30 && evt._computerOn <= 80 &&
+			if (evt._videoId == 30 && evt._computerOn <= 80 &&
 					(evt._computerOff + evt._computerOn) >= 139) {
 				_voy._field4382 = 4;
 			}
@@ -876,12 +876,12 @@ bool VoyeurEngine::checkForIncriminate() {
 
 void VoyeurEngine::playAVideoEvent(int eventIndex) {
 	VoyeurEvent &evt = _voy._events[eventIndex];
-	_eventsManager._videoComputerBut4 = evt._field8;
+	_videoId = evt._videoId;
 	_voy._vocSecondsOffset = evt._computerOn;
 	_eventsManager._videoDead = evt._dead;
 	_voy._field478 &= ~1;
 	
-	playAVideoDuration(_eventsManager._videoComputerBut4, evt._computerOff);
+	playAVideoDuration(_videoId, evt._computerOff);
 }
 
 int VoyeurEngine::getChooseButton()  {


Commit: 3672e3fa16c976c048e5221790e4e8e7e3627808
    https://github.com/scummvm/scummvm/commit/3672e3fa16c976c048e5221790e4e8e7e3627808
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T16:40:14-08:00

Commit Message:
VOYEUR: Fix parsePlayCommands case 3 setting Video Id correctly

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 4adf4d7..2b791c4 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -427,7 +427,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_videoId = READ_LE_UINT16(dataP + 2);
+				_vm->_videoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 


Commit: 7d9680058ac51042524f17d2ead7b3a43fa66b35
    https://github.com/scummvm/scummvm/commit/7d9680058ac51042524f17d2ead7b3a43fa66b35
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T20:09:19-08:00

Commit Message:
VOYEUR: Fixes for decoding RL2 videos with transparency

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 5bda66e..42172b7 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -355,9 +355,9 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 			++screenOffset;
 			--frameSize;
 		} else if (nextByte < 0x80) {
-			// Raw byte to copy to output
+			// Single 7-bit pixel to output (128-255)
 			assert(frameSize > 0);
-			destP[screenOffset] = nextByte;
+			destP[screenOffset] = nextByte | 0x80;
 			++screenOffset;
 			--frameSize;
 		} else if (nextByte == 0x80) {
@@ -374,7 +374,6 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
 		} else {
 			// Run length of a single pixel value
 			int runLength = _fileStream->readByte();
-			nextByte &= 0x7f;
 			runLength = MIN(runLength, frameSize);
 
 			Common::fill(destP + screenOffset, destP + screenOffset + runLength, nextByte);
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index ed23777..34cc9ee 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -157,6 +157,7 @@ public:
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 	RL2VideoTrack *getVideoTrack();
 	void play(::Voyeur::VoyeurEngine *vm);
+	int getPaletteCount() const { return _header._colorCount; }
 };
 
 } // End of namespace Video
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 24738fa..52bcd05 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -564,11 +564,6 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked &&
 			(decoder.getCurFrame() < endFrame)) {
-		if (decoder.hasDirtyPalette()) {
-			const byte *palette = decoder.getPalette();
-			_graphicsManager.setPalette(palette, 0, 256);
-		}
-
 		if (decoder.needsUpdate()) {
 			const Graphics::Surface *frame = decoder.decodeNextFrame();
 
@@ -576,7 +571,13 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 				(byte *)_graphicsManager._screenSurface.getPixels());
 		}
 
-		_eventsManager.pollEvents();
+		if (decoder.hasDirtyPalette()) {
+			const byte *palette = decoder.getPalette();
+			_graphicsManager.setPalette(palette, 0, decoder.getPaletteCount());
+			_graphicsManager.setOneColor(128, 220, 20, 20);
+		}
+
+		_eventsManager.getMouseInfo();
 		g_system->delayMillis(10);
 	}
 


Commit: ce5b8c54a92accf12d43fe1f681d277166b72fb9
    https://github.com/scummvm/scummvm/commit/ce5b8c54a92accf12d43fe1f681d277166b72fb9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-03T22:11:00-08:00

Commit Message:
VOYEUR: Hooked up debugger, and added a 'time' command

Changed paths:
    engines/voyeur/debugger.cpp
    engines/voyeur/debugger.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index 8407ead..04fdff2 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -21,14 +21,65 @@
  */
 
 #include "voyeur/debugger.h"
-
 #include "voyeur/graphics.h"
 #include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
 
 namespace Voyeur {
 
 Debugger::Debugger() : GUI::Debugger() {
+	// Register methods
 	DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
+	DCmd_Register("exit", WRAP_METHOD(Debugger, Cmd_Exit));
+	DCmd_Register("time", WRAP_METHOD(Debugger, Cmd_Time));
+
+	// Set fields
+	_isTimeActive = true;
+}
+
+bool Debugger::Cmd_Time(int argc, const char **argv) {
+	if (argc < 2) {
+		// Get the current day and time of day 
+		Common::String dtString = _vm->getDayName();
+		Common::String timeString = _vm->getTimeOfDay();
+		if (!timeString.empty())
+			dtString += " " + timeString;
+
+		DebugPrintf("Current date/time is: %s, time is %s\n", 
+			dtString.c_str(), _isTimeActive ? "on" : "off");
+		DebugPrintf("Format: %s [on | off | 1..17]\n\n", argv[0]);
+	} else {
+		if (!strcmp(argv[1], "on")) {
+			_isTimeActive = true;
+			DebugPrintf("Time is now on\n\n");
+		} else if (!strcmp(argv[1], "off")) {
+			_isTimeActive = false;
+			DebugPrintf("Time is now off\n\n");
+		} else {
+			int timeId = atoi(argv[1]);
+			if (timeId >= 1 && timeId <= 17) {
+				_vm->_voy._transitionId = timeId;
+				_vm->_gameHour = LEVEL_H[timeId - 1];
+				_vm->_gameMinute = LEVEL_M[timeId - 1];
+				_vm->_voy._isAM = timeId == 6;
+
+				_vm->_voy._RTVNum = 0;
+				_vm->_voy._RTANum = 255;
+
+				// Get the new current day and time of day 
+				Common::String dtString = _vm->getDayName();
+				Common::String timeString = _vm->getTimeOfDay();
+				if (!timeString.empty())
+					dtString += " " + timeString;
+
+				DebugPrintf("Current date/time is now: %s\n\n", dtString.c_str());
+			} else {
+				DebugPrintf("Unknown parameter\n\n");
+			}
+		}
+	}
+
+	return true;
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/debugger.h b/engines/voyeur/debugger.h
index 3020087..0391fad 100644
--- a/engines/voyeur/debugger.h
+++ b/engines/voyeur/debugger.h
@@ -33,11 +33,20 @@ class VoyeurEngine;
 class Debugger : public GUI::Debugger {
 private:
 	VoyeurEngine *_vm;
+public:
+	/**
+	 * Specifies whether time should pass, and the video camera's batteries go down
+	 * @default true
+	 */
+	bool _isTimeActive;
+protected:
+	bool Cmd_Time(int argc, const char **argv);
 
 public:
 	Debugger();
 	virtual ~Debugger() {}
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
+
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 5053b38..a46de47 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -101,9 +101,14 @@ void EventsManager::startMainClockInt() {
 void EventsManager::mainVoyeurIntFunc() {
 	if (!(_vm->_voy._field478 & 1)) {
 		++_vm->_voy._switchBGNum;
-		++_vm->_voy._RTVNum;
-		if (_vm->_voy._RTVNum >= _vm->_voy._field4F2)
-			_vm->_voy._field4F0 = 1;
+
+		if (_vm->_debugger._isTimeActive) {
+			// Increase camera discharge
+			++_vm->_voy._RTVNum;
+
+			if (_vm->_voy._RTVNum >= _vm->_voy._field4F2)
+				_vm->_voy._field4F0 = 1;
+		}
 	}
 }
 
@@ -145,6 +150,9 @@ void EventsManager::checkForNextFrameCounter() {
 		if ((_gameCounter % GAME_FRAME_RATE) == 0)
 			mainVoyeurIntFunc();
 
+		// Give time to the debugger
+		_vm->_debugger.onFrame();
+
 		// Display the frame
 		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.getPixels(), 
 			SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -238,7 +246,14 @@ void EventsManager::pollEvents() {
 			return;
 
 		case Common::EVENT_KEYDOWN:
-			_keyState[(byte)toupper(event.kbd.ascii)] = true;
+			// Check for debugger
+			if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) {
+				// Attach to the debugger
+				_vm->_debugger.attach();
+				_vm->_debugger.onFrame();
+			} else {
+				_keyState[(byte)toupper(event.kbd.ascii)] = true;
+			}
 			return;
 		case Common::EVENT_KEYUP:
 			_keyState[(byte)toupper(event.kbd.ascii)] = false;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 1e884c6..e7aedd5 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -86,7 +86,7 @@ public:
 	int _field470;
 	int _field472;
 	int _transitionId;
-	int _field476;
+	int _RTVLimit;
 	int _field478;
 	int _field47A;
 	PictureResource *_evPicPtrs[6];
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 2b791c4..b7d1402 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -538,7 +538,7 @@ void ThreadResource::parsePlayCommands() {
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				_vm->_voy._field470 = 5;
 				int count = READ_LE_UINT16(dataP + 2);
-				_vm->_voy._field476 = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4);
 
 				if (_vm->_voy._transitionId != count) {
 					if (_vm->_voy._transitionId > 1)
@@ -552,7 +552,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._RTANum = 255;
 				}
 
-				_vm->_voy._isAM = (_vm->_voy._transitionId == 6) ? 1 : 0;
+				_vm->_voy._isAM = _vm->_voy._transitionId == 6;
 			}
 
 			dataP += 6;
@@ -1353,18 +1353,18 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager._intPtr.field1E = 1;
 	_vm->_eventsManager._intPtr.field1A = 0;
 
-	if (_vm->_voy._RTVNum >= _vm->_voy._field476 || _vm->_voy._RTVNum < 0)
-		_vm->_voy._RTVNum = _vm->_voy._field476 - 1;
+	if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0)
+		_vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1;
 
-	if (_vm->_voy._transitionId < 15 && (_vm->_voy._field476 - 3) < _vm->_voy._RTVNum) {
-		_vm->_voy._RTVNum = _vm->_voy._field476;
+	if (_vm->_voy._transitionId < 15 && (_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) {
+		_vm->_voy._RTVNum = _vm->_voy._RTVLimit;
 		_vm->makeViewFinder();
 
 		_vm->initIFace();
-		_vm->_voy._RTVNum = _vm->_voy._field476 - 4;
+		_vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4;
 		_vm->_voy._field478 &= ~1;
 
-		while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._field476) {
+		while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) {
 			_vm->flashTimeBar();
 		}
 
@@ -1490,8 +1490,9 @@ int ThreadResource::doInterface() {
 		_vm->flipPageAndWait();
 
 		pt = _vm->_eventsManager.getMousePos();
-		if ((_vm->_voy._field476 <= _vm->_voy._RTVNum) || ((_vm->_voy._field478 & 0x80) &&
-				(_vm->_eventsManager._rightClick != NULL) && (pt.x == 0))) {
+		if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._field478 & 0x80) &&
+				_vm->_eventsManager._rightClick && (pt.x == 0))) {
+			// Time to transition to the next time period
 			_vm->_eventsManager.getMouseInfo();
 
 			if (_vm->_voy._transitionId == 15) {
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index f146ee2..c0bc1d9 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -232,6 +232,16 @@ public:
 	 * Flips the active page and waits until it's drawn and faded in
 	 */
 	void flipPageAndWaitForFade();
+
+	/**
+	 * Returns the string for the current in-game day of the week
+	 */
+	Common::String getDayName();
+
+	/**
+	 * Returns the string for the current in-game time of day
+	 */
+	Common::String getTimeOfDay();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 5f6b7b3..9364247 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1078,40 +1078,49 @@ void VoyeurEngine::checkTransition(){
 	Common::String time, day;
 
 	if (_voy._transitionId != _checkTransitionId) {
-		switch (_voy._transitionId) {
-		case 0:
-			break;
-		case 1:
-		case 2:
-		case 3:
-		case 4:
-			day = SATURDAY;
-			break;
-		case 17: 
-			day = MONDAY;
-			break;
-		default:
-			day = SUNDAY;
-			break;
-		}
+		// Get the day
+		day = getDayName();
 
+		// Only proceed if a valid day string was returned
 		if (!day.empty()) {
 			_graphicsManager.fadeDownICF(6);
 
-			if (_voy._transitionId != 17) {
-				const char *amPm = _voy._isAM ? AM : PM;
-				time = Common::String::format("%d:%02d%s",
-					_gameHour, _gameMinute, amPm);
-			}
+			// Get the time of day string
+			time = getTimeOfDay();
 
+			// Show a transition card with the day and time, and wait
 			doTransitionCard(day, time);
-			_eventsManager.delay(180);
+			_eventsManager.delayClick(180);
 		}
 
 		_checkTransitionId = _voy._transitionId;
 	}
 }
 
+Common::String VoyeurEngine::getDayName() {
+	switch (_voy._transitionId) {
+	case 0:
+		return "";
+	case 1:
+	case 2:
+	case 3:
+	case 4:
+		return SATURDAY;
+	case 17: 
+		return MONDAY;
+	default:
+		return SUNDAY;
+	}
+}
+
+Common::String VoyeurEngine::getTimeOfDay() {
+	if (_voy._transitionId == 17)
+		return "";
+
+	const char *amPm = _voy._isAM ? AM : PM;
+	return Common::String::format("%d:%02d%s", _gameHour, _gameMinute, amPm);
+}
+
 bool VoyeurEngine::doComputerText(int maxLen) {
 	FontInfoResource &font = *_graphicsManager._fontPtr;
 	int totalChars = 0;
@@ -1214,12 +1223,12 @@ void VoyeurEngine::getComputerBrush() {
 void VoyeurEngine::doTimeBar(bool force) {
 	flashTimeBar();
 
-	if ((force || _timeBarVal != _voy._RTVNum) && _voy._field476 > 0) {
-		if (_voy._RTVNum > _voy._field476 || _voy._RTVNum < 0)
-			_voy._RTVNum = _voy._field476 - 1;
+	if ((force || _timeBarVal != _voy._RTVNum) && _voy._RTVLimit > 0) {
+		if (_voy._RTVNum > _voy._RTVLimit || _voy._RTVNum < 0)
+			_voy._RTVNum = _voy._RTVLimit - 1;
 		
 		_timeBarVal = _voy._RTVNum;
-		int height = ((_voy._field476 - _voy._RTVNum) * 59) / _voy._field476;
+		int height = ((_voy._RTVLimit - _voy._RTVNum) * 59) / _voy._RTVLimit;
 		int fullHeight = MAX(151 - height, 93);
 
 		_graphicsManager._drawPtr->_penColor = 134;
@@ -1239,10 +1248,10 @@ void VoyeurEngine::doTimeBar(bool force) {
 }
 
 void VoyeurEngine::flashTimeBar(){
-	if (_voy._RTVNum >= 0 && (_voy._field476 - _voy._RTVNum) < 11 &&
+	if (_voy._RTVNum >= 0 && (_voy._RTVLimit - _voy._RTVNum) < 11 &&
 		(_eventsManager._intPtr.field1A >= (_flashTimeVal + 15) ||
 		_eventsManager._intPtr.field1A < _flashTimeVal)) {
-		// Within time range
+		// Within camera low power range
 		_flashTimeVal = _eventsManager._intPtr.field1A;
 
 		if (_flashTimeFlag)
@@ -1257,7 +1266,7 @@ void VoyeurEngine::flashTimeBar(){
 }
 
 void VoyeurEngine::checkPhoneCall() {
-	if ((_voy._field476 - _voy._RTVNum) >= 36 && _voy._field4B8 < 5 && 
+	if ((_voy._RTVLimit - _voy._RTVNum) >= 36 && _voy._field4B8 < 5 && 
 			_playStamp2 <= 151 && _playStamp2 > 146) {
 		if ((_voy._switchBGNum < _checkPhoneVal || _checkPhoneVal > 180) &&
 				!_soundManager.getVOCStatus()) {


Commit: 99dc594cb9391fefe4650610c531df44563bf20c
    https://github.com/scummvm/scummvm/commit/99dc594cb9391fefe4650610c531df44563bf20c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-05T08:29:03-08:00

Commit Message:
VOYEUR: Fix for crash when changing time period

Changed paths:
    engines/voyeur/debugger.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index 04fdff2..f97e73a 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -63,6 +63,7 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 				_vm->_gameMinute = LEVEL_M[timeId - 1];
 				_vm->_voy._isAM = timeId == 6;
 
+				// Camera back to full charge
 				_vm->_voy._RTVNum = 0;
 				_vm->_voy._RTANum = 255;
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index b7d1402..48eee99 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1378,7 +1378,7 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager.getMouseInfo();
 	_vm->initIFace();
 
-	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
+	Common::Array<Common::Rect> *hotspots = &_vm->_bVoy->boltEntry(
 		_vm->_playStamp1 + 1)._rectResource->_entries;
 	_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
 	_vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29);
@@ -1399,7 +1399,6 @@ int ThreadResource::doInterface() {
 	PictureResource *mangifyCursor = _vm->_bVoy->boltEntry(0x115)._picResource;
 
 	_vm->_eventsManager.setCursor(crosshairsCursor);
-	_vm->_eventsManager.showCursor();
 
 	// Main loop
 	int priorRegionIndex = -1;
@@ -1431,8 +1430,8 @@ int ThreadResource::doInterface() {
 				Common::Point(pt.x - MANSION_VIEW_X, pt.y - MANSION_VIEW_Y);
 		regionIndex = -1;
 
-		for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
-			if (hotspots[idx].contains(pt)) {
+		for (int idx = 0; idx < (int)hotspots->size(); ++idx) {
+			if ((*hotspots)[idx].contains(pt)) {
 				// Rect check done
 				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
 					if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum &&
@@ -1511,7 +1510,7 @@ int ThreadResource::doInterface() {
 
 				_vm->initIFace();
 				
-				hotspots = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries;
+				hotspots = &_vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries;
 				_vm->_eventsManager.getMouseInfo();
 
 				_vm->_voy._field478 &= ~2;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 9364247..25ad331 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1028,6 +1028,9 @@ void VoyeurEngine::initIFace(){
 	
 	_voy._viewBounds = _bVoy->boltEntry(_playStamp1)._rectResource;
 
+	// Show the cursor using ScummVM functionality
+	_eventsManager.showCursor();
+
 	// Note: the original did two loops to preload members here, which is
 	// redundant for ScummVM, since computers are faster these days, and
 	// getting resources as needed will be fast enough.


Commit: 7c256c491a71feb3dd608e0351072939cb7ac796
    https://github.com/scummvm/scummvm/commit/7c256c491a71feb3dd608e0351072939cb7ac796
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-05T11:15:53-08:00

Commit Message:
VOYEUR: Refactored doAptPosX/Y into a local variable

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 17f5ccc..69bbb78 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -445,8 +445,6 @@ public:
 	static CMapResource *_cmd14Pal;
 	static void initUseCount();
 	static void unloadAllStacks(VoyeurEngine *vm);
-	static int _doAptPosX;
-	static int _doAptPosY;
 
 	static void init();
 private:
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 48eee99..637b8ff 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -31,16 +31,12 @@ int ThreadResource::_stampFlags;
 int ThreadResource::_useCount[8];
 byte *ThreadResource::_threadDataPtr;
 CMapResource *ThreadResource::_cmd14Pal;
-int ThreadResource::_doAptPosX;
-int ThreadResource::_doAptPosY;
 
 void ThreadResource::init() {
 	_stampFlags = 0;
 	Common::fill(&_useCount[0], &_useCount[8], 0);
 	_threadDataPtr = nullptr;
 	_cmd14Pal = nullptr;
-	_doAptPosX = -1;
-	_doAptPosY = -1;
 }
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
@@ -1029,26 +1025,27 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
 int ThreadResource::doApt() {
 	loadTheApt();
 
+	Common::Point aptPos(-1, -1);
 	_vm->_playStamp2 = 151;
 	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; 
 	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
 		_vm->_playStamp1 + 1)._rectResource->_entries;
 	_vm->_eventsManager.getMouseInfo();
 
-	if (_doAptPosX == -1) {
-		_doAptPosX = hotspots[2].left;
-		_doAptPosY = hotspots[2].top;
+	if (aptPos.x == -1) {
+		aptPos.x = hotspots[2].left;
+		aptPos.y = hotspots[2].top;
 		_vm->_playStamp2 = 153;
 	}
 
 	if (_vm->_voy._field470 == 16) {
 		hotspots[0].left = 999;
 		hotspots[3].left = 999;
-		_doAptPosX = hotspots[4].left + 28;
-		_doAptPosY = hotspots[4].top + 28;
+		aptPos.x = hotspots[4].left + 28;
+		aptPos.y = hotspots[4].top + 28;
 	}
 
-	_vm->_eventsManager.setMousePos(Common::Point(_doAptPosX, _doAptPosY));
+	_vm->_eventsManager.setMousePos(Common::Point(aptPos.x, aptPos.y));
 	_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
 	_vm->_playStamp2 = 151;
 
@@ -1107,8 +1104,8 @@ int ThreadResource::doApt() {
 	} while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();
-	_doAptPosX = pt.x;
-	_doAptPosY = pt.y;
+	aptPos.x = pt.x;
+	aptPos.y = pt.y;
 
 	switch (hotspotId) {
 	case 0:


Commit: 1690ffb2bfc3ddcbbebe755a33f94f62b7ba81a0
    https://github.com/scummvm/scummvm/commit/1690ffb2bfc3ddcbbebe755a33f94f62b7ba81a0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-05T11:41:09-08:00

Commit Message:
VOYEUR: Moved _stampFlags to VoyeurEngine

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 69bbb78..b1eef58 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -439,7 +439,6 @@ public:
 
 class ThreadResource {
 public:
-	static int _stampFlags;
 	static int _useCount[8];
 	static byte *_threadDataPtr;
 	static CMapResource *_cmd14Pal;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 637b8ff..1e4fdb1 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -27,13 +27,11 @@
 
 namespace Voyeur {
 
-int ThreadResource::_stampFlags;
 int ThreadResource::_useCount[8];
 byte *ThreadResource::_threadDataPtr;
 CMapResource *ThreadResource::_cmd14Pal;
 
 void ThreadResource::init() {
-	_stampFlags = 0;
 	Common::fill(&_useCount[0], &_useCount[8], 0);
 	_threadDataPtr = nullptr;
 	_cmd14Pal = nullptr;
@@ -58,7 +56,7 @@ void ThreadResource::initThreadStruct(int idx, int id) {
 }
 
 bool ThreadResource::loadAStack(int idx) {
-	if (_stampFlags & 1) {
+	if (_vm->_stampFlags & 1) {
 		unloadAStack(_controlIndex);
 		if  (!_useCount[idx]) {
 			BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]);
@@ -76,7 +74,7 @@ bool ThreadResource::loadAStack(int idx) {
 }
 
 void ThreadResource::unloadAStack(int idx) {
-	if ((_stampFlags & 1) && _useCount[idx]) {
+	if ((_vm->_stampFlags & 1) && _useCount[idx]) {
 		if (--_useCount[idx] == 0) {
 			_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]);
 		}
@@ -186,7 +184,7 @@ void ThreadResource::getField1CE() {
 }
 
 void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
-	if (_stampFlags & 1) {
+	if (vm->_stampFlags & 1) {
 		for (int i = 0; i < 8; ++i) {
 			if (_useCount[i])
 				vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 52bcd05..dce4cf8 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -43,6 +43,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_iForceDeath = -1;
 	_controlPtr = NULL;
 	_bob = false;
+	_stampFlags = 0;
 	_playStamp1 = _playStamp2 = 0;
 	_videoId = -1;
 	_checkTransitionId = -1;
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index c0bc1d9..ed78917 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -157,6 +157,7 @@ public:
 	int _glGoScene;
 	int _glGoStack;
 	bool _bob;
+	int _stampFlags;
 	int _playStamp1;
 	int _playStamp2;
 	int _videoId;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 25ad331..762b988 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -212,7 +212,7 @@ void VoyeurEngine::playStamp() {
 }
 
 void VoyeurEngine::initStamp() {
-	ThreadResource::_stampFlags &= ~1;
+	_stampFlags &= ~1;
 	_stackGroupPtr = _controlGroupPtr;
 
 	if (!_controlPtr->_entries[0])


Commit: 9c2b761b310fecc098c721676163fa34b96b6666
    https://github.com/scummvm/scummvm/commit/9c2b761b310fecc098c721676163fa34b96b6666
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-05T11:54:55-08:00

Commit Message:
VOYEUR: Rename the old _playStamp1/2 variables to have better names

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index a46de47..95e3047 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -644,7 +644,7 @@ void EventsManager::addComputerEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _vm->_voy._isAM;
 	e._type = EVTYPE_COMPUTER;
-	e._videoId = _vm->_playStamp1;
+	e._videoId = _vm->_playStampGroupId;
 	e._computerOn = _vm->_voy._computerTextId;
 }
 
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 1e4fdb1..d412e11 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -359,7 +359,7 @@ void ThreadResource::parsePlayCommands() {
 
 		switch (id) {
 		case 1:
-			_vm->_playStamp2 = READ_LE_UINT16(dataP);
+			_vm->_currentVocId = READ_LE_UINT16(dataP);
 			dataP += 2;
 			break;
 
@@ -441,7 +441,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_eventsManager.incrementTime(1);
 				
 					_vm->_videoId = -1;
-					_vm->_playStamp1 = -1;
+					_vm->_playStampGroupId = -1;
 
 					if (_vm->_eventsManager._videoDead != -1) {
 						_vm->_bVoy->freeBoltGroup(0xE00);
@@ -470,7 +470,7 @@ void ThreadResource::parsePlayCommands() {
 			if (id == 22) {
 				int resolveIndex = READ_LE_UINT16(dataP);
 				dataP += 2;
-				_vm->_playStamp1 = _vm->_resolvePtr[resolveIndex];
+				_vm->_playStampGroupId = _vm->_resolvePtr[resolveIndex];
 			}
 
 			_vm->_voy._vocSecondsOffset = 0;
@@ -484,13 +484,13 @@ void ThreadResource::parsePlayCommands() {
 				parseIndex = 999;
 			} else {
 				// TODO: Double-check this
-				int count = _vm->_bVoy->getBoltGroup(_vm->_playStamp1)->_entries.size();
+				int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size();
 				_vm->_soundManager.stopVOCPlay();
 				_vm->_eventsManager.getMouseInfo();
 
 				for (int i = 0; i < count; ++i) {
-					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource;
-					pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource;
+					pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2)._picResource;
+					pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2 + 1)._cMapResource;
 
 					(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 					pal->startFade();
@@ -498,8 +498,8 @@ void ThreadResource::parsePlayCommands() {
 					_vm->flipPageAndWaitForFade();
 
 					if (i > 0) {
-						_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2);
-						_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2 + 1);
+						_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + i * 2);
+						_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + i * 2 + 1);
 					}
 
 					Common::String file = Common::String::format("news%d.voc", i + 1);
@@ -520,8 +520,8 @@ void ThreadResource::parsePlayCommands() {
 						break;
 				}
 
-				_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
-				_vm->_playStamp1 = -1;
+				_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
+				_vm->_playStampGroupId = -1;
 				_vm->_videoId = -1;
 				parseIndex = 999;
 			}
@@ -555,7 +555,7 @@ void ThreadResource::parsePlayCommands() {
 		case 6:
 			_vm->_voy._field470 = 6;
 			v2 = READ_LE_UINT16(dataP);
-			_vm->_playStamp1 = _vm->_resolvePtr[v2];
+			_vm->_playStampGroupId = _vm->_resolvePtr[v2];
 			dataP += 2;
 			break;
 
@@ -660,17 +660,17 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 14:
-			_vm->_playStamp1 = 2048;
+			_vm->_playStampGroupId = 2048;
 			_vm->_voy._field470 = 130;
 			break;
 
 		case 15:
-			_vm->_playStamp1 = (_vm->_voy._field4382 - 1) * 8 + 0x7700;
+			_vm->_playStampGroupId = (_vm->_voy._field4382 - 1) * 8 + 0x7700;
 			_vm->_voy._field47A = ((READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) 
 				- 1) << 8) + 0x7B00;
 
-			pic = _vm->_bVoy->boltEntry(_vm->_playStamp1)._picResource;
-			_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._cMapResource;
+			pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
+			_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
 
 			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 			_cmd14Pal->startFade();
@@ -683,16 +683,16 @@ void ThreadResource::parsePlayCommands() {
 					pic = _vm->_bVoy->boltEntry(_vm->_voy._field47A)._picResource;
 					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_voy._field47A + 1)._cMapResource;
 				} else {
-					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2)._picResource;
-					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + idx * 2 + 1)._cMapResource;
+					pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + idx * 2)._picResource;
+					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + idx * 2 + 1)._cMapResource;
 				}
 
 				(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
 				_cmd14Pal->startFade();
 				_vm->flipPageAndWaitForFade();
 
-				_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2);
-				_vm->_bVoy->freeBoltMember(_vm->_playStamp1 + (idx - 1) * 2 + 1);
+				_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + (idx - 1) * 2);
+				_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + (idx - 1) * 2 + 1);
 
 				Common::String fname = Common::String::format("news%d.voc", idx);
 
@@ -708,9 +708,9 @@ void ThreadResource::parsePlayCommands() {
 					break;
 			}
 
-			_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
+			_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
 			_vm->_bVoy->freeBoltGroup(_vm->_voy._field47A);
-			_vm->_playStamp1 = -1;
+			_vm->_playStampGroupId = -1;
 			_vm->_voy._field47A = -1;
 			break;
 
@@ -1024,16 +1024,16 @@ int ThreadResource::doApt() {
 	loadTheApt();
 
 	Common::Point aptPos(-1, -1);
-	_vm->_playStamp2 = 151;
-	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStamp1)._rectResource; 
+	_vm->_currentVocId = 151;
+	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; 
 	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
-		_vm->_playStamp1 + 1)._rectResource->_entries;
+		_vm->_playStampGroupId + 1)._rectResource->_entries;
 	_vm->_eventsManager.getMouseInfo();
 
 	if (aptPos.x == -1) {
 		aptPos.x = hotspots[2].left;
 		aptPos.y = hotspots[2].top;
-		_vm->_playStamp2 = 153;
+		_vm->_currentVocId = 153;
 	}
 
 	if (_vm->_voy._field470 == 16) {
@@ -1044,8 +1044,8 @@ int ThreadResource::doApt() {
 	}
 
 	_vm->_eventsManager.setMousePos(Common::Point(aptPos.x, aptPos.y));
-	_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
-	_vm->_playStamp2 = 151;
+	_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId));
+	_vm->_currentVocId = 151;
 
 	_vm->_graphicsManager.setColor(129, 82, 82, 82);
 	_vm->_graphicsManager.setColor(130, 112, 112, 112);
@@ -1064,8 +1064,8 @@ int ThreadResource::doApt() {
 		_vm->_eventsManager.getMouseInfo();
 		if (!_vm->_soundManager.getVOCStatus()) {
 			// Previous sound ended, so start up a new one
-			_vm->_playStamp2 = _vm->getRandomNumber(4) + 151;
-			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
+			_vm->_currentVocId = _vm->getRandomNumber(4) + 151;
+			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId));
 		}
 
 		// Loop through the hotspot list
@@ -1082,7 +1082,7 @@ int ThreadResource::doApt() {
 						hotspotId = 5;
 
 					// Draw the text description for the highlighted hotspot
-					pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 
+					pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 
 						hotspotId + 6)._picResource;
 					_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort,
 						Common::Point(106, 200));
@@ -1093,8 +1093,8 @@ int ThreadResource::doApt() {
 		}
 
 		// Draw either standard or highlighted eye cursor
-		pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStamp1 + 2 :
-			_vm->_playStamp1 + 3)._picResource;
+		pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStampGroupId + 2 :
+			_vm->_playStampGroupId + 3)._picResource;
 		_vm->_graphicsManager.sDrawPic(pic, *_vm->_graphicsManager._vPort, pt);
 
 		_vm->flipPageAndWait();
@@ -1139,11 +1139,11 @@ void ThreadResource::doRoom() {
 	vm.makeViewFinderP();
 	voy._field437E = 0;
 	
-	if (!vm._bVoy->getBoltGroup(vm._playStamp1, true))
+	if (!vm._bVoy->getBoltGroup(vm._playStampGroupId, true))
 		return;
 
-	vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStamp1 + 1)._cMapResource;
-	vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStamp1)._picResource;
+	vm._graphicsManager._backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource;
+	vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource;
 	(*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage);
 	vm._graphicsManager._backColors->startFade();
 
@@ -1151,12 +1151,12 @@ void ThreadResource::doRoom() {
 	voy._field437C = 0;
 	voy._field437E = 1;
 	
-	byte *dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4);
+	byte *dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4);
 	int count = READ_LE_UINT16(dataP);
 	int i4e4 = -1;
 
-	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
-	PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
+	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
+	PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
 
 	RectResource viewBounds(48, 38, 336, 202);
 	voy._viewBounds = &viewBounds;
@@ -1164,11 +1164,11 @@ void ThreadResource::doRoom() {
 	vm._eventsManager.getMouseInfo();
 	vm._eventsManager.setMousePos(Common::Point(192, 120));
 	voy._field437E = 0;
-	vm._playStamp2 = 146;
+	vm._currentVocId = 146;
 	voy._field4AC = voy._RTVNum;
 
 	voy._vocSecondsOffset = 0;
-	vm._soundManager.startVOCPlay(vm._playStamp2);
+	vm._soundManager.startVOCPlay(vm._currentVocId);
 	voy._field478 &= ~1;
 
 	bool breakFlag = false;
@@ -1178,10 +1178,10 @@ void ThreadResource::doRoom() {
 		vm._eventsManager._intPtr._hasPalette = true;
 
 		do {
-			if (vm._playStamp2 != -1 && !vm._soundManager.getVOCStatus()) {
+			if (vm._currentVocId != -1 && !vm._soundManager.getVOCStatus()) {
 				voy._field4AC = voy._RTVNum;
 				voy._vocSecondsOffset = 0;
-				vm._soundManager.startVOCPlay(vm._playStamp2);
+				vm._soundManager.startVOCPlay(vm._currentVocId);
 			}
 
 			vm._eventsManager.getMouseInfo();
@@ -1239,7 +1239,7 @@ void ThreadResource::doRoom() {
 			if (i4e4 == 999) {
 				_vm->flipPageAndWait();
 
-				if (vm._playStamp2 != -1) {
+				if (vm._currentVocId != -1) {
 					voy._vocSecondsOffset = voy._RTVNum - 
 						voy._field4AC;
 					vm._soundManager.stopVOCPlay();
@@ -1268,16 +1268,16 @@ void ThreadResource::doRoom() {
 
 			// WORKAROUND: Done in original, but not now, since freeing and reloading
 			// the group would invalidate the _backgroundPage picture resource
-			//vm._bVoy->freeBoltGroup(vm._playStamp1);
-			//vm._bVoy->getBoltGroup(vm._playStamp1);
+			//vm._bVoy->freeBoltGroup(vm._playStampGroupId);
+			//vm._bVoy->getBoltGroup(vm._playStampGroupId);
 
-			dataP = vm._bVoy->memberAddr(vm._playStamp1 + 4);
-			pic1 = vm._bVoy->boltEntry(vm._playStamp1 + 2)._picResource;
-			pic2 = vm._bVoy->boltEntry(vm._playStamp1 + 3)._picResource;
+			dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4);
+			pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
+			pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
 			vm._graphicsManager._backColors = vm._bVoy->boltEntry(
-				vm._playStamp1 + 1)._cMapResource;
+				vm._playStampGroupId + 1)._cMapResource;
 			vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(
-				vm._playStamp1)._picResource;
+				vm._playStampGroupId)._picResource;
 
 			vm._graphicsManager._backColors->startFade();
 			_vm->flipPageAndWait();
@@ -1320,14 +1320,14 @@ void ThreadResource::doRoom() {
 		voy._field47A = -1;
 	}
 
-	if (vm._playStamp1 != -1) {
-		vm._bVoy->freeBoltGroup(vm._playStamp1);
-		vm._playStamp1 = -1;
+	if (vm._playStampGroupId != -1) {
+		vm._bVoy->freeBoltGroup(vm._playStampGroupId);
+		vm._playStampGroupId = -1;
 	}
 
-	if (vm._playStamp2 != -1) {
+	if (vm._currentVocId != -1) {
 		vm._soundManager.stopVOCPlay();
-		vm._playStamp2 = -1;
+		vm._currentVocId = -1;
 	}
 
 	chooseSTAMPButton(0);
@@ -1344,7 +1344,7 @@ int ThreadResource::doInterface() {
 	}
 
 	_vm->_voy._field478 &= ~0x100;
-	_vm->_playStamp1 = -1;
+	_vm->_playStampGroupId = -1;
 	_vm->_eventsManager._intPtr.field1E = 1;
 	_vm->_eventsManager._intPtr.field1A = 0;
 
@@ -1374,11 +1374,11 @@ int ThreadResource::doInterface() {
 	_vm->initIFace();
 
 	Common::Array<Common::Rect> *hotspots = &_vm->_bVoy->boltEntry(
-		_vm->_playStamp1 + 1)._rectResource->_entries;
-	_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
+		_vm->_playStampGroupId + 1)._rectResource->_entries;
+	_vm->_currentVocId = 151 - _vm->getRandomNumber(5);
 	_vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29);
 
-	Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_playStamp2);
+	Common::String fname = _vm->_soundManager.getVOCFileName(_vm->_currentVocId);
 	_vm->_soundManager.startVOCPlay(fname);
 	_vm->_eventsManager.getMouseInfo();
 	
@@ -1412,8 +1412,8 @@ int ThreadResource::doInterface() {
 
 		_vm->checkPhoneCall();
 		if (!_vm->_soundManager.getVOCStatus()) {
-			_vm->_playStamp2 = 151 - _vm->getRandomNumber(5);
-			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_playStamp2));
+			_vm->_currentVocId = 151 - _vm->getRandomNumber(5);
+			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId));
 		}
 
 		// Calculate the mouse position within the entire mansion
@@ -1505,7 +1505,7 @@ int ThreadResource::doInterface() {
 
 				_vm->initIFace();
 				
-				hotspots = &_vm->_bVoy->boltEntry(_vm->_playStamp1 + 1)._rectResource->_entries;
+				hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries;
 				_vm->_eventsManager.getMouseInfo();
 
 				_vm->_voy._field478 &= ~2;
@@ -1518,8 +1518,8 @@ int ThreadResource::doInterface() {
 
 	_vm->_eventsManager.hideCursor();
 	_vm->_voy._field478 |= 1;
-	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
-	if (_vm->_playStamp2 != -1)
+	_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
+	if (_vm->_currentVocId != -1)
 		_vm->_soundManager.stopVOCPlay();
 
 	return !_vm->_eventsManager._rightClick ? regionIndex : -2;
@@ -1618,10 +1618,10 @@ void ThreadResource::loadTheApt() {
 	case 8:
 	case 9:
 	case 17:
-		_vm->_playStamp1 = 0x5700;
+		_vm->_playStampGroupId = 0x5700;
 		break;
 	case 3:
-		_vm->_playStamp1 = 0x5800;
+		_vm->_playStampGroupId = 0x5800;
 		break;
 	case 4:
 	case 10:
@@ -1631,7 +1631,7 @@ void ThreadResource::loadTheApt() {
 	case 14:
 	case 15:
 	case 16:
-		_vm->_playStamp1 = 0x5900;
+		_vm->_playStampGroupId = 0x5900;
 		break;
 	default:
 		break;
@@ -1642,21 +1642,21 @@ void ThreadResource::loadTheApt() {
 
 	if (_vm->_voy._field472  != -1) {
 		doAptAnim(1);
-		_vm->_bVoy->getBoltGroup(_vm->_playStamp1);
+		_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId);
 		_vm->_voy._field472 = -1;
 		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
-			_vm->_playStamp1 + 5)._picResource;
+			_vm->_playStampGroupId + 5)._picResource;
 		(*_vm->_graphicsManager._vPort)->setupViewPort(
 			_vm->_graphicsManager._backgroundPage);
 	} else {
-		_vm->_bVoy->getBoltGroup(_vm->_playStamp1);
+		_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId);
 		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
-			_vm->_playStamp1 + 5)._picResource;
+			_vm->_playStampGroupId + 5)._picResource;
 		(*_vm->_graphicsManager._vPort)->setupViewPort(
 			_vm->_graphicsManager._backgroundPage);
 	}
 
-	CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + 4)._cMapResource;
+	CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 4)._cMapResource;
 	pal->_steps = 1; 
 	pal->startFade();
 	_vm->flipPageAndWaitForFade();
@@ -1668,9 +1668,9 @@ void ThreadResource::freeTheApt() {
 
 	_vm->_graphicsManager.fadeUpICF1(0);
 
-	if (_vm->_playStamp2 != -1) {
+	if (_vm->_currentVocId != -1) {
 		_vm->_soundManager.stopVOCPlay();
-		_vm->_playStamp2 = -1;
+		_vm->_currentVocId = -1;
 	}
 
 	if (_vm->_voy._field472 == -1) {
@@ -1685,8 +1685,8 @@ void ThreadResource::freeTheApt() {
 	}
 
 	(*_vm->_graphicsManager._vPort)->setupViewPort(nullptr);
-	_vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
-	_vm->_playStamp1 = -1;
+	_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
+	_vm->_playStampGroupId = -1;
 	_vm->_voy._viewBounds = nullptr;
 }
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index dce4cf8..37ed0be 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -44,7 +44,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_controlPtr = NULL;
 	_bob = false;
 	_stampFlags = 0;
-	_playStamp1 = _playStamp2 = 0;
+	_playStampGroupId = _currentVocId = 0;
 	_videoId = -1;
 	_checkTransitionId = -1;
 	_gameHour = 0;
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index ed78917..6905549 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -158,8 +158,8 @@ public:
 	int _glGoStack;
 	bool _bob;
 	int _stampFlags;
-	int _playStamp1;
-	int _playStamp2;
+	int _playStampGroupId;
+	int _currentVocId;
 	int _videoId;
 	const int *_resolvePtr;
 	int _iForceDeath;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 762b988..9f70d74 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -48,7 +48,7 @@ void VoyeurEngine::playStamp() {
 	bool breakFlag = false;
 	while (!breakFlag && !shouldQuit()) {
 		_eventsManager.getMouseInfo();
-		_playStamp1 = _playStamp2 = -1;
+		_playStampGroupId = _currentVocId = -1;
 		_videoId = -1;
 
 		threadP->parsePlayCommands();
@@ -142,17 +142,17 @@ void VoyeurEngine::playStamp() {
 
 		case 130: {
 			//_tmflag = 1;
-			if (_bVoy->getBoltGroup(_playStamp1)) {
-				_graphicsManager._backgroundPage = _bVoy->boltEntry(_playStamp1)._picResource;
-				_graphicsManager._backColors = _bVoy->boltEntry(_playStamp1 + 1)._cMapResource;
+			if (_bVoy->getBoltGroup(_playStampGroupId)) {
+				_graphicsManager._backgroundPage = _bVoy->boltEntry(_playStampGroupId)._picResource;
+				_graphicsManager._backColors = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
 
 				buttonId = getChooseButton();
 				if (_eventsManager._rightClick)
 					buttonId = 4;
 
-				_bVoy->freeBoltGroup(_playStamp1);
+				_bVoy->freeBoltGroup(_playStampGroupId);
 				_graphicsManager.screenReset();
-				_playStamp1 = -1;
+				_playStampGroupId = -1;
 				flag = true;
 
 				if (buttonId == 4) {
@@ -174,9 +174,9 @@ void VoyeurEngine::playStamp() {
 
 		do {
 			if (flag) {
-				if (_playStamp2 != -1) {
+				if (_currentVocId != -1) {
 					_soundManager.stopVOCPlay();
-					_playStamp2 = -1;
+					_currentVocId = -1;
 				}
 
 				_videoId = -1;
@@ -186,9 +186,9 @@ void VoyeurEngine::playStamp() {
 					_voy._field47A = -1;
 				}
 
-				if (_playStamp1 != -1) {
-					_bVoy->freeBoltGroup(_playStamp1);
-					_playStamp1 = -1;
+				if (_playStampGroupId != -1) {
+					_bVoy->freeBoltGroup(_playStampGroupId);
+					_playStampGroupId = -1;
 				}
 
 				// Break out of loop
@@ -469,13 +469,13 @@ void VoyeurEngine::reviewTape() {
 			_eventsManager.setMousePos(Common::Point(newX, newY));
 		}
 
-		_playStamp2 = 151;
+		_currentVocId = 151;
 		_voy._vocSecondsOffset = 0;
 		bool var1E = true;
 		do {
-			if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+			if (_currentVocId != -1 && !_soundManager.getVOCStatus()) {
 				_voy._field4AC = _voy._RTVNum;
-				_soundManager.startVOCPlay(_playStamp2);
+				_soundManager.startVOCPlay(_currentVocId);
 			}
 
 			if (var1E) {
@@ -886,7 +886,7 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 
 int VoyeurEngine::getChooseButton()  {
 	int prevIndex = -2;
-	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(_playStamp1 
+	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(_playStampGroupId 
 		+ 6)._rectResource->_entries;
 	int selectedIndex = -1;
 
@@ -895,13 +895,13 @@ int VoyeurEngine::getChooseButton()  {
 	_graphicsManager._backColors->startFade();
 	flipPageAndWait();
 
-	_voy._viewBounds = _bVoy->boltEntry(_playStamp1 + 7)._rectResource;
-	PictureResource *cursorPic = _bVoy->boltEntry(_playStamp1 + 2)._picResource;
+	_voy._viewBounds = _bVoy->boltEntry(_playStampGroupId + 7)._rectResource;
+	PictureResource *cursorPic = _bVoy->boltEntry(_playStampGroupId + 2)._picResource;
 
 	do {
 		do {
-			if (_playStamp2 != -1 && !_soundManager.getVOCStatus())
-				_soundManager.startVOCPlay(_playStamp2);
+			if (_currentVocId != -1 && !_soundManager.getVOCStatus())
+				_soundManager.startVOCPlay(_currentVocId);
 
 			_eventsManager.getMouseInfo();
 			selectedIndex = -1;
@@ -912,19 +912,19 @@ int VoyeurEngine::getChooseButton()  {
 					if (!_voy._field4F0 || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
 						selectedIndex = idx;
 						if (selectedIndex != prevIndex) {
-							PictureResource *btnPic = _bVoy->boltEntry(_playStamp1 + 8 + idx)._picResource;
+							PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;
 							_graphicsManager.sDrawPic(btnPic, *_graphicsManager._vPort,
 								Common::Point(106, 200));
 
-							cursorPic = _bVoy->boltEntry(_playStamp1 + 4)._picResource;
+							cursorPic = _bVoy->boltEntry(_playStampGroupId + 4)._picResource;
 						}
 					}
 				}
 			}
 
 			if (selectedIndex == -1) {
-				cursorPic = _bVoy->boltEntry(_playStamp1 + 2)._picResource;
-				PictureResource *btnPic = _bVoy->boltEntry(_playStamp1 + 12)._picResource;
+				cursorPic = _bVoy->boltEntry(_playStampGroupId + 2)._picResource;
+				PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 12)._picResource;
 				_graphicsManager.sDrawPic(btnPic, *_graphicsManager._vPort,
 					Common::Point(106, 200));
 			}
@@ -994,7 +994,7 @@ void VoyeurEngine::makeViewFinderP() {
 }
 
 void VoyeurEngine::initIFace(){
-	int playStamp1 = _playStamp1;
+	int playStamp1 = _playStampGroupId;
 	switch (_voy._transitionId) {
 	case 0:
 		break;
@@ -1005,20 +1005,20 @@ void VoyeurEngine::initIFace(){
 	case 7:
 	case 8:
 	case 9:
-		_playStamp1 = 0xB00;
+		_playStampGroupId = 0xB00;
 		break;
 	case 3:
-		_playStamp1 = 0xC00;
+		_playStampGroupId = 0xC00;
 		break;
 	default:
-		_playStamp1 = 0xD00;
+		_playStampGroupId = 0xD00;
 		break;
 	}
 	if (playStamp1 != -1)
 		_bVoy->freeBoltGroup(playStamp1, true);
 
-	_bVoy->getBoltGroup(_playStamp1);
-	CMapResource *pal = _bVoy->boltEntry(_playStamp1 + 2)._cMapResource;
+	_bVoy->getBoltGroup(_playStampGroupId);
+	CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 2)._cMapResource;
 	pal->startFade();
 
 	// Start the mansion off centered
@@ -1026,7 +1026,7 @@ void VoyeurEngine::initIFace(){
 		(MANSION_MAX_Y - MANSION_VIEW_HEIGHT) / 2);
 	doScroll(_mansionViewPos);
 	
-	_voy._viewBounds = _bVoy->boltEntry(_playStamp1)._rectResource;
+	_voy._viewBounds = _bVoy->boltEntry(_playStampGroupId)._rectResource;
 
 	// Show the cursor using ScummVM functionality
 	_eventsManager.showCursor();
@@ -1136,16 +1136,16 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 		_voy._vocSecondsOffset = 0;
 
 	if (_voy._RTVNum > _voy._field4EE && maxLen == 9999) {
-		if (_playStamp2 != -1)
-			_soundManager.startVOCPlay(_playStamp2);
+		if (_currentVocId != -1)
+			_soundManager.startVOCPlay(_currentVocId);
 		font._justify = ALIGN_LEFT;
 		font._justifyWidth = 384;
 		font._justifyHeight = 100;
 		font._pos = Common::Point(128, 100);
 		(*_graphicsManager._vPort)->drawText(END_OF_MESSAGE);
 	} else if (_voy._RTVNum < _voy._field4EC && maxLen == 9999) {
-		if (_playStamp2 != -1)
-			_soundManager.startVOCPlay(_playStamp2);
+		if (_currentVocId != -1)
+			_soundManager.startVOCPlay(_currentVocId);
 		font._justify = ALIGN_LEFT;
 		font._justifyWidth = 384;
 		font._justifyHeight = 100;
@@ -1158,10 +1158,10 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 		bool showEnd = true;
 		int yp = 60;
 		do {
-			if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+			if (_currentVocId != -1 && !_soundManager.getVOCStatus()) {
 				if (_voy._vocSecondsOffset > 60)
 					_voy._vocSecondsOffset = 0;
-				_soundManager.startVOCPlay(_playStamp2);
+				_soundManager.startVOCPlay(_currentVocId);
 			}
 
 			char c = *msg++;
@@ -1270,17 +1270,17 @@ void VoyeurEngine::flashTimeBar(){
 
 void VoyeurEngine::checkPhoneCall() {
 	if ((_voy._RTVLimit - _voy._RTVNum) >= 36 && _voy._field4B8 < 5 && 
-			_playStamp2 <= 151 && _playStamp2 > 146) {
+			_currentVocId <= 151 && _currentVocId > 146) {
 		if ((_voy._switchBGNum < _checkPhoneVal || _checkPhoneVal > 180) &&
 				!_soundManager.getVOCStatus()) {
 			int soundIndex;
 			do {
 				soundIndex = getRandomNumber(4);
 			} while (_voy._field4AE[soundIndex]);
-			_playStamp2 = 154 + soundIndex;
+			_currentVocId = 154 + soundIndex;
 
 			_soundManager.stopVOCPlay();
-			_soundManager.startVOCPlay(_playStamp2);
+			_soundManager.startVOCPlay(_currentVocId);
 			_checkPhoneVal = _voy._switchBGNum;
 			++_voy._field4AE[soundIndex];
 			++_voy._field4B8;
@@ -1292,7 +1292,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	_eventsManager.getMouseInfo();
 	flipPageAndWait();
 
-	if (_playStamp2 != -1) {
+	if (_currentVocId != -1) {
 		_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
 		_soundManager.stopVOCPlay();
 	}
@@ -1310,7 +1310,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		_eventsManager.delay(1);
 	_bVoy->freeBoltMember(_voy._field47A + evidId * 2 + 1);
 
-	byte *dataP = _bVoy->memberAddr(_playStamp1 + 4);
+	byte *dataP = _bVoy->memberAddr(_playStampGroupId + 4);
 	int count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
 
 	if (count > 0) {
@@ -1334,11 +1334,11 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	int evidIdx = evidId;
 
 	while (!shouldQuit() && !_eventsManager._rightClick) {
-		if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+		if (_currentVocId != -1 && !_soundManager.getVOCStatus()) {
 			if (_voy._vocSecondsOffset > 60)
 				_voy._vocSecondsOffset = 0;
 
-			_soundManager.startVOCPlay(_playStamp2);
+			_soundManager.startVOCPlay(_currentVocId);
 		}
 
 		_eventsManager.delayClick(600);


Commit: c884d5bf1488db9d05b0afb0088768a97f6b1b52
    https://github.com/scummvm/scummvm/commit/c884d5bf1488db9d05b0afb0088768a97f6b1b52
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-05T13:47:03-08:00

Commit Message:
VOYEUR: Added a state field for current game area

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 1e08acb..2403898 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -286,8 +286,8 @@ void BoltFile::freeBoltGroup(uint16 id, bool freeEntries) {
 }
 
 void BoltFile::freeBoltMember(uint32 id) {
-	// TODO: Determine whether this is needed
-	warning("TODO: BoltFile::freeBoltMember");
+	// TODO: Determine whether this is needed, given all group entries are automatically loaded
+//	warning("TODO: BoltFile::freeBoltMember");
 }
 
 BoltEntry &BoltFile::getBoltEntryFromLong(uint32 id) {
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index d412e11..20d7814 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1061,6 +1061,7 @@ int ThreadResource::doApt() {
 	Common::Point pt;
 	PictureResource *pic;
 	do {
+		_vm->_voyeurArea = AREA_APARTMENT;
 		_vm->_eventsManager.getMouseInfo();
 		if (!_vm->_soundManager.getVOCStatus()) {
 			// Previous sound ended, so start up a new one
@@ -1173,6 +1174,7 @@ void ThreadResource::doRoom() {
 
 	bool breakFlag = false;
 	while (!vm.shouldQuit() && !breakFlag) {
+		_vm->_voyeurArea = AREA_ROOM;
 		vm._graphicsManager.setColor(128, 0, 255, 0);
 		vm._eventsManager._intPtr.field38 = 1;
 		vm._eventsManager._intPtr._hasPalette = true;
@@ -1402,6 +1404,7 @@ int ThreadResource::doInterface() {
 		MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT);
 
 	do {
+		_vm->_voyeurArea = AREA_INTERFACE;
 		_vm->doTimeBar(true);
 		_vm->_eventsManager.getMouseInfo();
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 37ed0be..a6ad25f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -53,7 +53,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_flashTimeFlag = false;
 	_timeBarVal = -1;
 	_checkPhoneVal = 0;
-	_mansionScrollCountdown = 0;
+	_voyeurArea = AREA_NONE;
 
 	initialiseManagers();
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 6905549..53f1708 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -69,6 +69,7 @@ enum VoyeurDebugChannels {
 	kDebugScripts	= 1 << 1
 };
 
+enum VoyeurArea { AREA_NONE, AREA_APARTMENT, AREA_INTERFACE, AREA_ROOM, AREA_EVIDENCE };
 
 struct VoyeurGameDescription;
 
@@ -171,7 +172,7 @@ public:
 	int _timeBarVal;
 	int _checkPhoneVal;
 	Common::Point _mansionViewPos;
-	int _mansionScrollCountdown;
+	VoyeurArea _voyeurArea;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 9f70d74..e6f8d61 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -47,6 +47,7 @@ void VoyeurEngine::playStamp() {
 	int buttonId;
 	bool breakFlag = false;
 	while (!breakFlag && !shouldQuit()) {
+		_voyeurArea = AREA_NONE;
 		_eventsManager.getMouseInfo();
 		_playStampGroupId = _currentVocId = -1;
 		_videoId = -1;
@@ -1334,6 +1335,8 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	int evidIdx = evidId;
 
 	while (!shouldQuit() && !_eventsManager._rightClick) {
+		_voyeurArea = AREA_EVIDENCE;
+
 		if (_currentVocId != -1 && !_soundManager.getVOCStatus()) {
 			if (_voy._vocSecondsOffset > 60)
 				_voy._vocSecondsOffset = 0;


Commit: 1fb73446e3358a2fe045647c8cb5d1b621d43ce7
    https://github.com/scummvm/scummvm/commit/1fb73446e3358a2fe045647c8cb5d1b621d43ce7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-05T17:56:14-08:00

Commit Message:
VOYEUR: Clean up of some of the startup code

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 95e3047..b96ce67 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -66,6 +66,21 @@ IntData::IntData() {
 
 /*------------------------------------------------------------------------*/
 
+void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int videoId, 
+		int on, int off, int dead) {
+	VoyeurEvent &e = _events[_eventCount++];
+
+	e._hour = hour;
+	e._minute = minute;
+	e._isAM = hour < 12;
+	e._videoId = videoId;
+	e._computerOn = on;
+	e._computerOff = off;
+	e._dead = dead;
+}
+
+/*------------------------------------------------------------------------*/
+
 EventsManager::EventsManager(): _intPtr(_gameData),
 		_fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) {
 	_cycleStatus = 0;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index e7aedd5..bd119f2 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -101,7 +101,15 @@ public:
 	int _field4EE;
 	int _field4F0;
 	int _field4F2;
+
+	/**
+	 * Total number of game events that have occurred
+	 */
 	int _eventCount;
+
+	/**
+	 * List of game events that have occurred
+	 */
 	VoyeurEvent _events[TOTAL_EVENTS];
 
 	int _timeStart;
@@ -126,6 +134,12 @@ public:
 	int _curICF1;
 	int _fadeICF0;
 	int _policeEvent;
+public:
+	/**
+	 * Add an event to the list of game events that have occurred
+	 */
+	void addEvent(int hour, int minute, VoyeurEventType type, int videoId, int on,
+		int off, int dead);
 };
 
 class IntData {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index a6ad25f..0238651 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -171,44 +171,60 @@ void VoyeurEngine::initInput() {
 
 bool VoyeurEngine::doHeadTitle() {
 //	char dest[144];
-
+	
 	_eventsManager.startMainClockInt();
-
+	/*
 	// Show starting screen
-//	if (_bVoy->getBoltGroup(0x500))
-//		showConversionScreen();
-	if (shouldQuit())
-		return false;
+	if (_bVoy->getBoltGroup(0x500)) {
+		showConversionScreen();
+		_bVoy->freeBoltGroup(0x500);
+
+		if (shouldQuit())
+			return false;
+	}
 
 	if (ConfMan.getBool("copy_protection")) {
+		// Display lock screen
 		bool result = doLock();
 		if (!result || shouldQuit())
 			return false;
 	}
 
-//	showTitleScreen();
+	// Show the title screen
+	showTitleScreen();
+	if (shouldQuit())
+		return false;
 
 	// Opening
 	if (!_eventsManager._mouseClicked) {
-//		doOpening();
-//		doTransitionCard("Saturday Afternoon", "Player's Apartment");
+		doOpening();
+		doTransitionCard("Saturday Afternoon", "Player's Apartment");
 		_eventsManager.delayClick(90);
 	} else {
 		_eventsManager._mouseClicked = false;
 	}
-
+	*/
 	if (_voy._field478 & 0x80) {
-		// TODO: Check when these are called, and the two different loops.
-		// Also, comptuerNu isn't an array in IDB?
-		/*
-		if (_voy._evidence[19] == 0) {
-			Common::copy(&COMPUTER_DEFAULTS[0], &COMPUTER_DEFAULTS[9 * 8], &_voy._computerNum[0]);
-			_voy._evidence[19] = 9;
-		} else {
-			error("_computerNum loaded with uninitialized list here");
-		}
-		*/
-	}
+		// Add initial game event set
+		if (_voy._eventCount <= 1)
+			_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
+		if (_voy._eventCount <= 2)
+			_voy.addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1);
+		if (_voy._eventCount <= 3)
+			_voy.addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1);
+		if (_voy._eventCount <= 4)
+			_voy.addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1);
+		if (_voy._eventCount <= 5)
+			_voy.addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1);
+		if (_voy._eventCount <= 6)
+			_voy.addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1);
+		if (_voy._eventCount <= 7)
+			_voy.addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1);
+		if (_voy._eventCount <= 8)
+			_voy.addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1);
+		if (_voy._eventCount <= 9)
+			_voy.addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1);
+	} 
 
 	_voy._field472 = 140;
 	return true;
@@ -240,7 +256,6 @@ void VoyeurEngine::showConversionScreen() {
 	flipPageAndWaitForFade();
 
 	_graphicsManager.screenReset();
-	_bVoy->freeBoltGroup(0x500);
 }
 
 bool VoyeurEngine::doLock() {
@@ -462,7 +477,7 @@ void VoyeurEngine::showTitleScreen() {
 }
 
 void VoyeurEngine::doOpening() {
-/*
+	/*
 	_graphicsManager.screenReset();
 
 	if (!_bVoy->getBoltGroup(0x200, true))
@@ -478,11 +493,11 @@ void VoyeurEngine::doOpening() {
 	_voy._RTVNum = 0;
 	_voy._field468 = _voy._RTVNum;
 	_voy._field478 = 16;
-	_eventsManager._gameHour = 4;
-	_eventsManager._gameMinute  = 0;
+	_gameHour = 4;
+	_gameMinute  = 0;
 	_videoId = 1;
 	_eventsManager._videoDead = -1;
-	addVideoEventStart();
+	_eventsManager.addVideoEventStart();
 
 	_voy._field478 &= ~1;
 
@@ -497,7 +512,7 @@ void VoyeurEngine::doOpening() {
 	::Video::RL2Decoder decoder;
 	decoder.loadFile("a2300100.rl2");
 	decoder.start();
-
+	decoder.play(this);
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
@@ -514,6 +529,15 @@ void VoyeurEngine::doOpening() {
 		_eventsManager.pollEvents();
 		g_system->delayMillis(10);
 	}
+
+	if ((_voy._RTVNum - _voy._field468) < 2)
+		_eventsManager.delay(60);
+
+	_voy._field478 |= 1;
+	_eventsManager.addVideoEventEnd();
+	_voy._field478 &= 0x10;
+
+	_bVoy->freeBoltGroup(0x200);
 	*/
 }
 
@@ -535,7 +559,7 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
 				(byte *)_graphicsManager._screenSurface.getPixels());
 		}
 
-		_eventsManager.pollEvents();
+		_eventsManager.getMouseInfo();
 		g_system->delayMillis(10);
 	}
 }


Commit: 996b2aa43ca5615001d5aa0004a71612cc677eac
    https://github.com/scummvm/scummvm/commit/996b2aa43ca5615001d5aa0004a71612cc677eac
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-01-05T22:47:47-08:00

Commit Message:
VOYEUR: Use boolean for _isAM instead of int

Changed paths:
    engines/voyeur/debugger.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index f97e73a..c437bff 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -61,7 +61,7 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 				_vm->_voy._transitionId = timeId;
 				_vm->_gameHour = LEVEL_H[timeId - 1];
 				_vm->_gameMinute = LEVEL_M[timeId - 1];
-				_vm->_voy._isAM = timeId == 6;
+				_vm->_voy._isAM = (timeId == 6);
 
 				// Camera back to full charge
 				_vm->_voy._RTVNum = 0;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index bd119f2..a8ef89a 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -67,7 +67,7 @@ struct VoyeurEvent {
 
 class SVoy {
 public:
-	int _isAM;
+	bool _isAM;
 	int _RTANum;
 	int _RTVNum;
 	int _switchBGNum;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 20d7814..dc46b78 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -546,7 +546,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._RTANum = 255;
 				}
 
-				_vm->_voy._isAM = _vm->_voy._transitionId == 6;
+				_vm->_voy._isAM = (_vm->_voy._transitionId == 6);
 			}
 
 			dataP += 6;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index e6f8d61..251772e 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -38,7 +38,7 @@ void VoyeurEngine::playStamp() {
 	ThreadResource *threadP = threadsList->_entries[0]->_threadResource;
 	threadP->initThreadStruct(0, 0);
 
-	_voy._isAM = 0;
+	_voy._isAM = false;
 	_gameHour = 9;
 	_gameMinute = 0;
 	_eventsManager._v2A0A2 = 0;
@@ -1121,8 +1121,7 @@ Common::String VoyeurEngine::getTimeOfDay() {
 	if (_voy._transitionId == 17)
 		return "";
 
-	const char *amPm = _voy._isAM ? AM : PM;
-	return Common::String::format("%d:%02d%s", _gameHour, _gameMinute, amPm);
+	return Common::String::format("%d:%02d%s", _gameHour, _gameMinute, _voy._isAM ? AM : PM);
 }
 
 bool VoyeurEngine::doComputerText(int maxLen) {


Commit: 12386de64b3b3fbb779d4262a0edfcb4fa5ee463
    https://github.com/scummvm/scummvm/commit/12386de64b3b3fbb779d4262a0edfcb4fa5ee463
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-01-05T23:03:09-08:00

Commit Message:
VOYEUR: Remove an unused variable and constant

Changed paths:
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 53f1708..b114c52 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -50,8 +50,6 @@ namespace Voyeur {
 #define DEBUG_INTERMEDIATE 2
 #define DEBUG_DETAILED 3
 
-#define MAX_RESOLVE 1000
-
 // Constants used for doInterface display of the mansion
 #define MANSION_MAX_X 784
 #define MANSION_MAX_Y 150
@@ -73,12 +71,10 @@ enum VoyeurArea { AREA_NONE, AREA_APARTMENT, AREA_INTERFACE, AREA_ROOM, AREA_EVI
 
 struct VoyeurGameDescription;
 
-
 class VoyeurEngine : public Engine {
 private:
 	const VoyeurGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
-	Common::Array<int> _resolves;
 	FontInfoResource _defaultFontInfo;
 
 	void ESP_Init();


Commit: 6dff1574590c60eab526b7dcc4061ec9f15c0821
    https://github.com/scummvm/scummvm/commit/6dff1574590c60eab526b7dcc4061ec9f15c0821
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-01-06T15:06:16-08:00

Commit Message:
VOYEUR: Remove a couple of useless variables, change type of some other to use booleans, add CHECKME

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index b96ce67..f9e150c 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -56,7 +56,7 @@ IntData::IntData() {
 	field24 = 0;
 	field26 = 0;
 	field2A = 0;
-	field38 = 0;
+	field38 = false;
 	field3B = 0;
 	field3D = 0;
 	_palStartIndex = 0;
@@ -98,7 +98,6 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_newLeftClick = _newRightClick = false;;
 	_newMouseClicked = _newMouseUnk = false;
 
-	_v2A0A2 = 0;
 	_videoDead = 0;
 }
 
@@ -188,7 +187,7 @@ void EventsManager::voyeurTimer() {
 
 	if (--_gameData.field26 <= 0) {
 		if (_gameData._flipWait) {
-			_gameData.field38 = 1;
+			_gameData.field38 = true;
 			_gameData._flipWait = false;
 			_gameData.field3B = 0;
 		}
@@ -353,7 +352,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 
 		_intPtr._hasPalette = true;
 		if (!(cMap->_fadeStatus & 2))
-			_intPtr.field38 = 1;
+			_intPtr.field38 = true;
 	}
 
 	if (_cycleStatus & 1)
@@ -403,7 +402,7 @@ void EventsManager::vDoFadeInt() {
 		_intPtr._palEndIndex = _fadeLastCol;
 
 	_intPtr._hasPalette = true;
-	_intPtr.field38 = 1;
+	_intPtr.field38 = true;
 }
 
 void EventsManager::vDoCycleInt() {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index a8ef89a..a51b669 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -82,7 +82,7 @@ public:
 	int _field468;
 	int _field46A;
 	int _vocSecondsOffset;
-	int _field46E;
+	bool _field46E;
 	int _field470;
 	int _field472;
 	int _transitionId;
@@ -154,7 +154,7 @@ public:
 	int field26;
 	int field2A;
 	bool _hasPalette;
-	int field38;
+	bool field38;
 	int field3B;
 	int field3D;
 	int _palStartIndex;
@@ -206,7 +206,6 @@ public:
 	bool _newLeftClick, _newRightClick;
 	bool _newMouseUnk;
 
-	int _v2A0A2;
 	int _videoDead;
 	int _cycleTime[4];
 	byte *_cycleNext[4];
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index dc46b78..9f694ec 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1176,7 +1176,7 @@ void ThreadResource::doRoom() {
 	while (!vm.shouldQuit() && !breakFlag) {
 		_vm->_voyeurArea = AREA_ROOM;
 		vm._graphicsManager.setColor(128, 0, 255, 0);
-		vm._eventsManager._intPtr.field38 = 1;
+		vm._eventsManager._intPtr.field38 = true;
 		vm._eventsManager._intPtr._hasPalette = true;
 
 		do {
@@ -1221,7 +1221,7 @@ void ThreadResource::doRoom() {
 				vm._eventsManager.setCursorColor(128, 2);
 			}
 
-			vm._eventsManager._intPtr.field38 = 1;
+			vm._eventsManager._intPtr.field38 = true;
 			vm._eventsManager._intPtr._hasPalette = true;
 			vm._graphicsManager.flipPage();
 			vm._eventsManager.sWaitFlip();
@@ -1341,7 +1341,7 @@ int ThreadResource::doInterface() {
 
 	_vm->_voy._field478 |= 1;
 	if (_vm->_voy._field46E) {
-		_vm->_voy._field46E = 0;
+		_vm->_voy._field46E = false;
 		return -2;
 	}
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index e4b30b1..c4080e7 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -658,7 +658,7 @@ void GraphicsManager::resetPalette() {
 	for (int i = 0; i < 256; ++i)
 		setColor(i, 0, 0, 0);
 
-	_vm->_eventsManager._intPtr.field38 = 1;
+	_vm->_eventsManager._intPtr.field38 = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 }
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 0238651..af17460 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -307,7 +307,7 @@ bool VoyeurEngine::doLock() {
 		_eventsManager.setCursor(cursorPic);
 		_eventsManager.showCursor();
 
-		_eventsManager._intPtr. field38 = 1;
+		_eventsManager._intPtr. field38 = true;
 		_eventsManager._intPtr._hasPalette = true;
 
 		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
@@ -357,7 +357,7 @@ bool VoyeurEngine::doLock() {
 					}
 
 					_eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
-					_eventsManager._intPtr.field38 = 1;
+					_eventsManager._intPtr.field38 = true;
 					_eventsManager._intPtr._hasPalette = true;
 
 					_eventsManager.delay(1);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index b114c52..552b9d0 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -159,7 +159,7 @@ public:
 	int _currentVocId;
 	int _videoId;
 	const int *_resolvePtr;
-	int _iForceDeath;
+	int _iForceDeath; // CHECKME: The original initializes it in ESP_init()
 	int _checkTransitionId;
 	int _gameHour;
 	int _gameMinute;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 251772e..e943af6 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -41,8 +41,7 @@ void VoyeurEngine::playStamp() {
 	_voy._isAM = false;
 	_gameHour = 9;
 	_gameMinute = 0;
-	_eventsManager._v2A0A2 = 0;
-	_voy._field46E = 1;
+	_voy._field46E = true;
 
 	int buttonId;
 	bool breakFlag = false;
@@ -67,14 +66,14 @@ void VoyeurEngine::playStamp() {
 					break;
 				case 1:
 					_voy._field478 &= ~1;
-					_voy._field46E = 1;
+					_voy._field46E = true;
 					threadP->chooseSTAMPButton(22);
 					_voy._field472 = 143;
 					break;
 				case 2:
 					_voy._field478 &= ~1;
 					reviewTape();
-					_voy._field46E = 1;
+					_voy._field46E = true;
 					_voy._field472 = 142;
 					break;
 				case 3:
@@ -86,7 +85,7 @@ void VoyeurEngine::playStamp() {
 					break;
 				case 5:
 					doGossip();
-					_voy._field46E = 1;
+					_voy._field46E = true;
 					_voy._field472 = 141;
 					_voy._field478 = -1;
 					break;
@@ -116,7 +115,7 @@ void VoyeurEngine::playStamp() {
 				break;
 			case 2:
 				reviewTape();
-				_voy._field46E = 1;
+				_voy._field46E = true;
 				break;
 			case 4:
 				flag = true;
@@ -163,7 +162,7 @@ void VoyeurEngine::playStamp() {
 					flag = true;
 				} else {
 					threadP->chooseSTAMPButton(buttonId);
-					_voy._field46E = 1;
+					_voy._field46E = true;
 				}
 			}
 			break;
@@ -456,7 +455,7 @@ void VoyeurEngine::reviewTape() {
 		_graphicsManager.setColor(12, 120, 248, 120);
 		_eventsManager.setCursorColor(128, 1);
 
-		_eventsManager._intPtr.field38 = 1;
+		_eventsManager._intPtr.field38 = true;
 		_eventsManager._intPtr._hasPalette = true;
 		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
 		_graphicsManager._fontPtr->_fontSaveBack = false;
@@ -986,7 +985,7 @@ void VoyeurEngine::makeViewFinder() {
 	_graphicsManager.setColor(243, 105, 105, 105);
 	_graphicsManager.setColor(palOffset + 241, 219, 235, 235);
 
-	_eventsManager._intPtr.field38 = 1;
+	_eventsManager._intPtr.field38 = true;
 	_eventsManager._intPtr._hasPalette = true;
 }
 
@@ -1240,7 +1239,7 @@ void VoyeurEngine::doTimeBar(bool force) {
 		(*_graphicsManager._vPort)->sFillBox(6, fullHeight - 92);
 		if (height > 0) {
 			_graphicsManager.setColor(215, 238, 238, 238);
-			_eventsManager._intPtr.field38 = 1;
+			_eventsManager._intPtr.field38 = true;
 			_eventsManager._intPtr._hasPalette = true;
 
 			_graphicsManager._drawPtr->_penColor = 215;
@@ -1262,7 +1261,7 @@ void VoyeurEngine::flashTimeBar(){
 		else
 			_graphicsManager.setColor(240, 220, 220, 220);
 		
-		_eventsManager._intPtr.field38 = 1;
+		_eventsManager._intPtr.field38 = true;
 		_eventsManager._intPtr._hasPalette = true;
 		_flashTimeFlag = !_flashTimeFlag;
 	}


Commit: 2a206ebd7f84b41ba93518a2c003ba67bedf72df
    https://github.com/scummvm/scummvm/commit/2a206ebd7f84b41ba93518a2c003ba67bedf72df
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-06T19:01:36-08:00

Commit Message:
VOYEUR: Moved SVoy and game events to their own file

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index f9e150c..ba86ba8 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -66,21 +66,6 @@ IntData::IntData() {
 
 /*------------------------------------------------------------------------*/
 
-void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int videoId, 
-		int on, int off, int dead) {
-	VoyeurEvent &e = _events[_eventCount++];
-
-	e._hour = hour;
-	e._minute = minute;
-	e._isAM = hour < 12;
-	e._videoId = videoId;
-	e._computerOn = on;
-	e._computerOff = off;
-	e._dead = dead;
-}
-
-/*------------------------------------------------------------------------*/
-
 EventsManager::EventsManager(): _intPtr(_gameData),
 		_fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) {
 	_cycleStatus = 0;
@@ -597,78 +582,6 @@ void EventsManager::incrementTime(int amt) {
 		mainVoyeurIntFunc();
 }
 
-void EventsManager::addVideoEventStart() {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._hour = _vm->_gameHour;
-	e._minute = _vm->_gameMinute;
-	e._isAM = _vm->_voy._isAM;
-	e._type = EVTYPE_VIDEO;
-	e._videoId = _vm->_videoId;
-	e._computerOn = _vm->_voy._vocSecondsOffset;
-	e._dead = _vm->_eventsManager._videoDead;
-}
-
-void EventsManager::addVideoEventEnd() {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset;
-	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
-		++_vm->_voy._eventCount;
-}
-
-void EventsManager::addAudioEventStart() {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._hour = _vm->_gameHour;
-	e._minute = _vm->_gameMinute;
-	e._isAM = _vm->_voy._isAM;
-	e._type = EVTYPE_AUDIO;
-	e._videoId = _vm->_videoId;
-	e._computerOn = _vm->_voy._field47A;
-	e._dead = _vm->_eventsManager._videoDead;
-}
-
-void EventsManager::addAudioEventEnd() {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset;
-	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
-		++_vm->_voy._eventCount;
-}
-
-void EventsManager::addEvidEventStart(int v) {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._hour = _vm->_gameHour;
-	e._minute = _vm->_gameMinute;
-	e._isAM = _vm->_voy._isAM;
-	e._type = EVTYPE_EVID;
-	e._videoId = _vm->_videoId;
-	e._computerOn = _vm->_voy._vocSecondsOffset;
-	e._dead = _vm->_eventsManager._videoDead;
-
-}
-
-void EventsManager::addEvidEventEnd(int dead) {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._dead = dead;
-	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
-		++_vm->_voy._eventCount;
-}
-
-void EventsManager::addComputerEventStart() {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._hour = _vm->_gameHour;
-	e._minute = _vm->_gameMinute;
-	e._isAM = _vm->_voy._isAM;
-	e._type = EVTYPE_COMPUTER;
-	e._videoId = _vm->_playStampGroupId;
-	e._computerOn = _vm->_voy._computerTextId;
-}
-
-void EventsManager::addComputerEventEnd(int v) {
-	VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
-	e._computerOff = v;
-	if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
-		++_vm->_voy._eventCount;
-}
-
 void EventsManager::stopEvidDim() {
 	deleteIntNode(&_evIntNode);
 }
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index a51b669..d290954 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -36,7 +36,6 @@ class CMapResource;
 
 #define GAME_FRAME_RATE 50
 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
-#define TOTAL_EVENTS 1000
 
 typedef void (EventsManager::*EventMethodPtr)();
  
@@ -51,97 +50,6 @@ public:
 	IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
 };
 
-enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
-	EVTYPE_COMPUTER = 4 };
-
-struct VoyeurEvent {
-	int _hour;
-	int _minute;
-	bool _isAM;
-	VoyeurEventType _type;
-	int _videoId;
-	int _computerOn;
-	int _computerOff;
-	int _dead;
-};
-
-class SVoy {
-public:
-	bool _isAM;
-	int _RTANum;
-	int _RTVNum;
-	int _switchBGNum;
-	int _arr1[8][20];
-	int _arr2[8][20];
-	int _arr3[3][20];
-	int _arr4[3][20];
-	int _arr5[3][20];
-	int _arr6[3][20];
-	int _arr7[20];
-
-	int _field468;
-	int _field46A;
-	int _vocSecondsOffset;
-	bool _field46E;
-	int _field470;
-	int _field472;
-	int _transitionId;
-	int _RTVLimit;
-	int _field478;
-	int _field47A;
-	PictureResource *_evPicPtrs[6];
-	CMapResource *_evCmPtrs[6];
-	int _field4AC;
-	int _field4AE[5];
-	int _field4B8;
-
-	int _computerTextId;
-	Common::Rect _rect4E4;
-	int _field4EC;
-	int _field4EE;
-	int _field4F0;
-	int _field4F2;
-
-	/**
-	 * Total number of game events that have occurred
-	 */
-	int _eventCount;
-
-	/**
-	 * List of game events that have occurred
-	 */
-	VoyeurEvent _events[TOTAL_EVENTS];
-
-	int _timeStart;
-	int _duration;
-	int _vidStart;
-
-	int _audioTime;
-	int _phones[5];
-	int _numPhonesUsed;
-	int _evidence[20];
-	
-	int _field4376;
-	int _field4378;
-	int _field437A;
-	int _field437C;
-	int _field437E;
-	int _field4380;
-	int _field4382;
-	int _videoEventId;
-	RectResource *_viewBounds;
-	int _curICF0;
-	int _curICF1;
-	int _fadeICF0;
-	int _policeEvent;
-public:
-	/**
-	 * Add an event to the list of game events that have occurred
-	 */
-	void addEvent(int hour, int minute, VoyeurEventType type, int videoId, int on,
-		int off, int dead);
-};
-
 class IntData {
 public:
 	bool _field9;
@@ -238,14 +146,6 @@ public:
 	void startCursorBlink();
 	void incrementTime(int amt);
 
-	void addVideoEventStart();
-	void addVideoEventEnd();
-	void addAudioEventStart();
-	void addAudioEventEnd();
-	void addEvidEventStart(int v);
-	void addEvidEventEnd(int dead);
-	void addComputerEventStart();
-	void addComputerEventEnd(int v);
 	void stopEvidDim();
 
 	Common::String getEvidString(int eventIndex);
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 9f694ec..1764c22 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -376,7 +376,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_videoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
-					_vm->_eventsManager.addAudioEventStart();
+					_vm->_voy.addAudioEventStart();
 
 					assert(_vm->_videoId < 38);
 					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
@@ -402,7 +402,7 @@ void ThreadResource::parsePlayCommands() {
 
 					_vm->_voy._field478 |= 1;
 					_vm->_soundManager.stopVOCPlay();
-					_vm->_eventsManager.addAudioEventEnd();
+					_vm->_voy.addAudioEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 					_vm->_eventsManager.incrementTime(1);
 
@@ -430,14 +430,14 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_videoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
-					_vm->_eventsManager.addAudioEventStart();
+					_vm->_voy.addAudioEventStart();
 					_vm->_voy._field478 &= ~1;
 					_vm->_voy._field478 |= 0x10;
 					_vm->playAVideo(_vm->_videoId);
 
 					_vm->_voy._field478 &= ~0x10;
 					_vm->_voy._field478 |= 1;
-					_vm->_eventsManager.addVideoEventEnd();
+					_vm->_voy.addVideoEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 				
 					_vm->_videoId = -1;
@@ -1250,14 +1250,14 @@ void ThreadResource::doRoom() {
 				vm.getComputerBrush();
 				_vm->flipPageAndWait();
 
-				vm._eventsManager.addComputerEventStart();
+				vm._voy.addComputerEventStart();
 
 				vm._eventsManager._mouseClicked = false;
 				vm._eventsManager.startCursorBlink();
 
 				int v = vm.doComputerText(9999); 
 				if (v)
-					vm._eventsManager.addComputerEventEnd(v);
+					vm._voy.addComputerEventEnd(v);
 
 				vm._bVoy->freeBoltGroup(0x4900);
 			} else {
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index c52502d..f2a69df 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/voyeur
 
 MODULE_OBJS := \
 	animation.o \
+	data.o \
 	debugger.o \
 	detection.o \
 	events.o \
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index af17460..bc2a30b 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -125,7 +125,7 @@ void VoyeurEngine::initialiseManagers() {
 	_filesManager.setVm(this);
 	_graphicsManager.setVm(this);
 	_soundManager.setVm(this);
-
+	_voy.setVm(this);
 }
 
 void VoyeurEngine::ESP_Init() {
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 552b9d0..4ee5f84 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -24,6 +24,7 @@
 #define VOYEUR_VOYEUR_H
 
 #include "voyeur/debugger.h"
+#include "voyeur/data.h"
 #include "voyeur/events.h"
 #include "voyeur/files.h"
 #include "voyeur/graphics.h"
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index e943af6..a8330c0 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1325,7 +1325,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	_eventsManager.stopEvidDim();
 
 	if (eventId == 999)
-		_eventsManager.addEvidEventStart(eventId);
+		_voy.addEvidEventStart(eventId);
 
 	_eventsManager.getMouseInfo();
 
@@ -1365,7 +1365,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	}
 
 	if (eventId != 999)
-		_eventsManager.addEvidEventEnd(evidIdx);
+		_voy.addEvidEventEnd(evidIdx);
 
 	count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
 	for (int idx = 1; idx <= count; ++idx) {


Commit: 3eff4af3c514f75eaa6e91ab94fd644d69557341
    https://github.com/scummvm/scummvm/commit/3eff4af3c514f75eaa6e91ab94fd644d69557341
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-06T19:54:46-08:00

Commit Message:
VOYEUR: Added new data source file

Changed paths:
  A engines/voyeur/data.cpp
  A engines/voyeur/data.h



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
new file mode 100644
index 0000000..f98478b
--- /dev/null
+++ b/engines/voyeur/data.cpp
@@ -0,0 +1,192 @@
+/* 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 "voyeur/data.h"
+#include "voyeur/voyeur.h"
+
+namespace Voyeur {
+
+void VoyeurEvent::synchronize(Common::Serializer &s) {
+	s.syncAsByte(_hour);
+	s.syncAsByte(_minute);
+	s.syncAsByte(_isAM);
+	s.syncAsByte(_type);
+	s.syncAsSint16LE(_videoId);
+	s.syncAsSint16LE(_computerOn);
+	s.syncAsSint16LE(_computerOff);
+	s.syncAsSint16LE(_dead);
+}
+
+/*------------------------------------------------------------------------*/
+
+void SVoy::setVm(VoyeurEngine *vm) {
+	_vm = vm;
+}
+
+void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int videoId, 
+		int on, int off, int dead) {
+	VoyeurEvent &e = _events[_eventCount++];
+
+	e._hour = hour;
+	e._minute = minute;
+	e._isAM = hour < 12;
+	e._videoId = videoId;
+	e._computerOn = on;
+	e._computerOff = off;
+	e._dead = dead;
+}
+
+void SVoy::synchronize(Common::Serializer &s) {
+	s.syncAsByte(_isAM);
+	s.syncAsSint16LE(_RTANum);
+	s.syncAsSint16LE(_RTVNum);
+	s.syncAsSint16LE(_switchBGNum);
+
+	for (int v1 = 0; v1 < 8; ++v1) {
+		for (int v2 = 0; v2 < 20; ++v2) {
+			s.syncAsSint16LE(_arr1[v1][v2]);
+			s.syncAsSint16LE(_arr2[v1][v2]);
+		}
+	}
+	for (int v1 = 0; v1 < 4; ++v1) {
+		for (int v2 = 0; v2 < 20; ++v2) {
+			s.syncAsSint16LE(_arr3[v1][v2]);
+			s.syncAsSint16LE(_arr4[v1][v2]);
+		}
+	}
+	for (int v1 = 0; v1 < 4; ++v1) {
+		for (int v2 = 0; v2 < 20; ++v2) {
+			s.syncAsSint16LE(_arr5[v1][v2]);
+			s.syncAsSint16LE(_arr6[v1][v2]);
+		}
+	}
+	for (int v1 = 0; v1 < 20; ++v1) {
+		s.syncAsSint16LE(_arr7[20]);
+	}
+
+	s.syncAsSint16LE(_field468);
+	s.syncAsSint16LE(_field46A);
+	s.syncAsSint16LE(_vocSecondsOffset);
+	s.syncAsSint16LE(_field46E);
+	s.syncAsSint16LE(_field470);
+	s.syncAsSint16LE(_field472);
+	s.syncAsSint16LE(_transitionId);
+	s.syncAsSint16LE(_RTVLimit);
+	s.syncAsSint16LE(_field478);
+	s.syncAsSint16LE(_field47A);
+
+	s.syncAsSint16LE(_field4AC);
+	s.syncAsSint16LE(_field4B8);
+	s.syncAsSint16LE(_computerTextId);
+	s.syncAsSint16LE(_field4EC);
+	s.syncAsSint16LE(_field4EE);
+	s.syncAsSint16LE(_field4F0);
+	s.syncAsSint16LE(_field4F2);
+
+	// Events
+	s.syncAsUint16LE(_eventCount);
+	for (int idx = 0; idx < _eventCount; ++idx)
+		_events[idx].synchronize(s);
+
+	s.syncAsSint16LE(_field4376);
+	s.syncAsSint16LE(_field4378);
+	s.syncAsSint16LE(_field437A);
+	s.syncAsSint16LE(_field437C);
+	s.syncAsSint16LE(_field437E);
+	s.syncAsSint16LE(_field4380);
+	s.syncAsSint16LE(_field4382);
+	s.syncAsSint16LE(_videoEventId);
+}
+
+void SVoy::addVideoEventStart() {
+	VoyeurEvent &e = _events[_eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _isAM;
+	e._type = EVTYPE_VIDEO;
+	e._videoId = _vm->_videoId;
+	e._computerOn = _vocSecondsOffset;
+	e._dead = _vm->_eventsManager._videoDead;
+}
+
+void SVoy::addVideoEventEnd() {
+	VoyeurEvent &e = _events[_eventCount];
+	e._computerOff = _RTVNum - _field468 - _vocSecondsOffset;
+	if (_eventCount < (TOTAL_EVENTS - 1))
+		++_eventCount;
+}
+
+void SVoy::addAudioEventStart() {
+	VoyeurEvent &e = _events[_eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _isAM;
+	e._type = EVTYPE_AUDIO;
+	e._videoId = _vm->_videoId;
+	e._computerOn = _field47A;
+	e._dead = _vm->_eventsManager._videoDead;
+}
+
+void SVoy::addAudioEventEnd() {
+	VoyeurEvent &e = _events[_eventCount];
+	e._computerOff = _RTVNum - _field468 - _vocSecondsOffset;
+	if (_eventCount < (TOTAL_EVENTS - 1))
+		++_eventCount;
+}
+
+void SVoy::addEvidEventStart(int v) {
+	VoyeurEvent &e = _events[_eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _isAM;
+	e._type = EVTYPE_EVID;
+	e._videoId = _vm->_videoId;
+	e._computerOn = _vocSecondsOffset;
+	e._dead = _vm->_eventsManager._videoDead;
+
+}
+
+void SVoy::addEvidEventEnd(int dead) {
+	VoyeurEvent &e = _events[_eventCount];
+	e._dead = dead;
+	if (_eventCount < (TOTAL_EVENTS - 1))
+		++_eventCount;
+}
+
+void SVoy::addComputerEventStart() {
+	VoyeurEvent &e = _events[_eventCount];
+	e._hour = _vm->_gameHour;
+	e._minute = _vm->_gameMinute;
+	e._isAM = _isAM;
+	e._type = EVTYPE_COMPUTER;
+	e._videoId = _vm->_playStampGroupId;
+	e._computerOn = _computerTextId;
+}
+
+void SVoy::addComputerEventEnd(int v) {
+	VoyeurEvent &e = _events[_eventCount];
+	e._computerOff = v;
+	if (_eventCount < (TOTAL_EVENTS - 1))
+		++_eventCount;
+}
+
+} // End of namespace Voyeur
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
new file mode 100644
index 0000000..03545ad
--- /dev/null
+++ b/engines/voyeur/data.h
@@ -0,0 +1,140 @@
+/* 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.
+ *
+ */
+
+#ifndef VOYEUR_DATA_H
+#define VOYEUR_DATA_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+#include "voyeur/files.h"
+
+namespace Voyeur {
+
+#define TOTAL_EVENTS 1000
+
+enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
+	EVTYPE_COMPUTER = 4 };
+
+struct VoyeurEvent {
+	int _hour;
+	int _minute;
+	bool _isAM;
+	VoyeurEventType _type;
+	int _videoId;
+	int _computerOn;
+	int _computerOff;
+	int _dead;
+
+	void synchronize(Common::Serializer &s);
+};
+
+class VoyeurEngne;
+
+class SVoy {
+private:
+	VoyeurEngine *_vm;
+public:
+	bool _isAM;
+	int _RTANum;
+	int _RTVNum;
+	int _switchBGNum;
+	int _arr1[8][20];
+	int _arr2[8][20];
+	int _arr3[3][20];
+	int _arr4[3][20];
+	int _arr5[3][20];
+	int _arr6[3][20];
+	int _arr7[20];
+
+	int _field468;
+	int _field46A;
+	int _vocSecondsOffset;
+	bool _field46E;
+	int _field470;
+	int _field472;
+	int _transitionId;
+	int _RTVLimit;
+	int _field478;
+	int _field47A;
+	PictureResource *_evPicPtrs[6];
+	CMapResource *_evCmPtrs[6];
+	int _field4AC;
+	int _field4AE[5];
+	int _field4B8;
+
+	int _computerTextId;
+	Common::Rect _rect4E4;
+	int _field4EC;
+	int _field4EE;
+	int _field4F0;
+	int _field4F2;
+
+	/**
+	 * Total number of game events that have occurred
+	 */
+	int _eventCount;
+
+	/**
+	 * List of game events that have occurred
+	 */
+	VoyeurEvent _events[TOTAL_EVENTS];
+
+	int _field4376;
+	int _field4378;
+	int _field437A;
+	int _field437C;
+	int _field437E;
+	int _field4380;
+	int _field4382;
+	int _videoEventId;
+	RectResource *_viewBounds;
+	int _curICF0;
+	int _curICF1;
+	int _fadeICF0;
+	int _policeEvent;
+public:
+	void setVm(VoyeurEngine *vm);
+
+	/**
+	 * Synchronise the data
+	 */
+	void synchronize(Common::Serializer &s);
+
+	/**
+	 * Add an event to the list of game events that have occurred
+	 */
+	void addEvent(int hour, int minute, VoyeurEventType type, int videoId, int on,
+		int off, int dead);
+
+	void addVideoEventStart();
+	void addVideoEventEnd();
+	void addAudioEventStart();
+	void addAudioEventEnd();
+	void addEvidEventStart(int v);
+	void addEvidEventEnd(int dead);
+	void addComputerEventStart();
+	void addComputerEventEnd(int v);
+};
+
+} // End of namespace Voyeur
+
+#endif /* VOYEUR_DATA_H */


Commit: e6e8008e67224f4a45f9965d1e00cb3da5f9652a
    https://github.com/scummvm/scummvm/commit/e6e8008e67224f4a45f9965d1e00cb3da5f9652a
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-01-06T22:27:29-08:00

Commit Message:
VOYEUR: Change some more types, add comments about unused variables

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index ba86ba8..deaa978 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -57,8 +57,8 @@ IntData::IntData() {
 	field26 = 0;
 	field2A = 0;
 	field38 = false;
-	field3B = 0;
-	field3D = 0;
+	field3B = false;
+	field3D = false;
 	_palStartIndex = 0;
 	_palEndIndex = 0;
 	_palette = NULL;
@@ -168,13 +168,13 @@ void EventsManager::voyeurTimer() {
 	// _gameData.field1C += _gameData._timerFn; *** WHY INC field by a function pointer?!
 
 	_gameData.field16 = 0;
-	_gameData.field3D = 1;
+	_gameData.field3D = true;
 
 	if (--_gameData.field26 <= 0) {
 		if (_gameData._flipWait) {
 			_gameData.field38 = true;
 			_gameData._flipWait = false;
-			_gameData.field3B = 0;
+			_gameData.field3B = false;
 		}
 
 		_gameData.field26 >>= 8;
@@ -317,7 +317,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 		}
 
 		if (cMap->_fadeStatus & 2)
-			_intPtr.field3B = 1;
+			_intPtr.field3B = true;
 		_fadeIntNode._flags &= ~1;
 	} else {
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
@@ -359,7 +359,7 @@ void EventsManager::addFadeInt() {
 }
 
 void EventsManager::vDoFadeInt() {
-	if (_intPtr.field3B & 1)
+	if (_intPtr.field3B)
 		return;
 	if (--_fadeCount == 0) {
 		_fadeIntNode._flags |= 1;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index d290954..3c474aa 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -52,19 +52,19 @@ public:
 
 class IntData {
 public:
-	bool _field9;
+	bool _field9;  // CHECKME: Useless variable
 	bool _flipWait;
-	int field16;
+	int field16;   // CHECKME: Useless variable
 	int field1A;
 	int field1E;
-	int field22;
-	int field24;
+	int field22;   // CHECKME: Useless variable
+	int field24;   // CHECKME: Useless variable
 	int field26;
-	int field2A;
+	int field2A;   // CHECKME: Useless variable
 	bool _hasPalette;
-	bool field38;
-	int field3B;
-	int field3D;
+	bool field38;  // CHECKME: Useless variable
+	bool field3B;  // Skip fading
+	bool field3D;  // CHECKME: Useless variable
 	int _palStartIndex;
 	int _palEndIndex;
 	byte *_palette;


Commit: 7e5dea4f5efefca7d59ab092be30fc3ef2af9ef8
    https://github.com/scummvm/scummvm/commit/7e5dea4f5efefca7d59ab092be30fc3ef2af9ef8
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-01-06T22:46:14-08:00

Commit Message:
VOYEUR: Silent 2 CppCheck warnings by differencing if/else branches

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 2403898..4c0ae1b 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -743,9 +743,9 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	int nbytes = _bounds.width() * _bounds.height();
 	if (_flags & PICFLAG_20) {
 		if (_flags & (PICFLAG_80 | PICFLAG_40)) {
-			error("TODO: sInitPic");
+			error("TODO: sInitPic - Case 40 | 80");
 		} else {
-			error("TODO: sInitPic");
+			error("TODO: sInitPic - Case !(40 | 80)");
 		}
 	} else if (_flags & PICFLAG_8) {
 		int mode = 0;
@@ -781,8 +781,10 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 		if (_flags & PICFLAG_10) {
 			// TODO: Figure out what it's doing. Looks like a direct clearing
 			// of the screen directly
+			error("TODO: sInitPic - Case 10");
 		} else {
 			// TODO: Figure out direct screen loading
+			error("TODO: sInitPic - Case !10");
 		}
 	} else {
 		if (_flags & PICFLAG_1000) {


Commit: d0703467b42d3636f3d81683efc3e336ab33052f
    https://github.com/scummvm/scummvm/commit/d0703467b42d3636f3d81683efc3e336ab33052f
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-01-06T23:17:06-08:00

Commit Message:
VOYEUR: Fix some more CppCheck warnings

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 1764c22..4348a14 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1398,11 +1398,11 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager.setCursor(crosshairsCursor);
 
 	// Main loop
-	int priorRegionIndex = -1;
 	int regionIndex = 0;
 	Common::Rect mansionViewBounds(MANSION_VIEW_X, MANSION_VIEW_Y,
 		MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT);
 
+	int priorRegionIndex = -1;
 	do {
 		_vm->_voyeurArea = AREA_INTERFACE;
 		_vm->doTimeBar(true);
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index c4080e7..ec26017 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -135,8 +135,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	Common::Rect backBounds;
 	int var24;
 	bool isClipped = false;
-	int var52;
-	int var20, var22;
+	int var22;
 	int var26;
 	byte pixel = 0;
 
@@ -182,8 +181,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 
 		var24 = offset.y - newBounds.top;
 		if (var24 < 0) {
-			var52 = width2;
-			srcOffset -= var24 * var52;
+			srcOffset -= var24 * width2;
 			height1 += var24;
 			offset.y = newBounds.top;
 			
@@ -193,7 +191,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 			isClipped = true;
 		}
 
-		var20 = newBounds.bottom - (offset.y + height1);
+		int var20 = newBounds.bottom - (offset.y + height1);
 		if (var20 < 0) {
 			height1 += var20;
 			if (height1 <= 0)
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index bc2a30b..d6b9531 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -265,10 +265,6 @@ bool VoyeurEngine::doLock() {
 	byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
 	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
 	LockClass lock;
-	PictureResource *cursorPic;
-	byte *keyData;
-	int keyCount;
-	int key;
 
 	if (_bVoy->getBoltGroup(0x700)) {
 		lock.getSysDate();
@@ -278,12 +274,12 @@ bool VoyeurEngine::doLock() {
 		_voy._viewBounds = _bVoy->boltEntry(0x704)._rectResource;
 
 		Common::String password = lock._password;
-		cursorPic = _bVoy->getPictureResource(0x702);
+		PictureResource *cursorPic = _bVoy->getPictureResource(0x702);
 		assert(cursorPic);
 
 		// Get the mappings of keys on the keypad
-		keyData = _bVoy->memberAddr(0x705);
-		keyCount = READ_LE_UINT16(keyData);
+		byte *keyData = _bVoy->memberAddr(0x705);
+		int keyCount = READ_LE_UINT16(keyData);
 
 		_graphicsManager._backColors = _bVoy->getCMapResource(0x7010000);
 		_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x700);
@@ -338,6 +334,7 @@ bool VoyeurEngine::doLock() {
 			}
 
 			// Loop for getting key presses
+			int key;
 			do {
 				do {
 					// Scan through the list of key rects to check if a keypad key is highlighted
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index a8330c0..2212453 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1040,7 +1040,6 @@ void VoyeurEngine::doScroll(const Common::Point &pt) {
 	Common::Rect clipRect(72, 47, 72 + 240, 47 + 148);
 	(*_graphicsManager._vPort)->setupViewPort(NULL, &clipRect);
 
-	PictureResource *pic;
 	int base = 0;
 	switch (_voy._transitionId) {
 	case 0:
@@ -1062,7 +1061,7 @@ void VoyeurEngine::doScroll(const Common::Point &pt) {
 	}
 
 	if (base) {
-		pic = _bVoy->boltEntry(base + 3)._picResource;
+		PictureResource *pic = _bVoy->boltEntry(base + 3)._picResource;
  		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 104));
 		pic = _bVoy->boltEntry(base + 4)._picResource;
 		_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 44));


Commit: dfe3d8b4ceab85f3831ad4fe7fb0fa587c1e67fa
    https://github.com/scummvm/scummvm/commit/dfe3d8b4ceab85f3831ad4fe7fb0fa587c1e67fa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-08T20:31:34-08:00

Commit Message:
VOYEUR: Preliminary savegame functionality

Changed paths:
    engines/voyeur/detection.cpp
    engines/voyeur/events.h
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp
index e9a5b8d..10f9604 100644
--- a/engines/voyeur/detection.cpp
+++ b/engines/voyeur/detection.cpp
@@ -121,6 +121,8 @@ SaveStateList VoyeurMetaEngine::listSaves(const char *target) const {
 	sort(filenames.begin(), filenames.end());   // Sort to get the files in numerical order
 
 	SaveStateList saveList;
+	Voyeur::VoyeurSavegameHeader header;
+
 	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
 		const char *ext = strrchr(file->c_str(), '.');
 		int slot = ext ? atoi(ext + 1) : -1;
@@ -129,6 +131,10 @@ SaveStateList VoyeurMetaEngine::listSaves(const char *target) const {
 			Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
 
 			if (in) {
+				if (header.read(in)) {
+					saveList.push_back(SaveStateDescriptor(slot, header._saveName));
+					header._thumbnail->free();
+				}
 				delete in;
 			}
 		}
@@ -151,10 +157,16 @@ SaveStateDescriptor VoyeurMetaEngine::querySaveMetaInfos(const char *target, int
 	Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename);
 
 	if (f) {
+		Voyeur::VoyeurSavegameHeader header;
+		header.read(f);
 		delete f;
 
 		// Create the return descriptor
-		SaveStateDescriptor desc(slot, "");
+		SaveStateDescriptor desc(slot, header._saveName);
+		desc.setThumbnail(header._thumbnail);
+		desc.setSaveDate(header._saveYear, header._saveMonth, header._saveDay);
+		desc.setSaveTime(header._saveHour, header._saveMinutes);
+		desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME);
 
 		return desc;
 	}
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 3c474aa..753139b 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -141,6 +141,7 @@ public:
 	void showCursor();
 	void hideCursor();
 	Common::Point getMousePos() { return _mousePos; }
+	uint32 getGameCounter() const { return _gameCounter; }
 	void getMouseInfo();
 	void checkForKey();
 	void startCursorBlink();
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index b1eef58..f14b744 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -537,6 +537,10 @@ public:
 	void checkForMurder();
 	void checkForIncriminate();
 
+	/**
+	 * Synchronizes the game data
+	 */
+	void synchronize(Common::Serializer &s);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 4348a14..cee4e46 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1062,6 +1062,13 @@ int ThreadResource::doApt() {
 	PictureResource *pic;
 	do {
 		_vm->_voyeurArea = AREA_APARTMENT;
+
+		if (_vm->_loadGameSlot != -1) {
+			// Load a savegame
+			_vm->loadGame(_vm->_loadGameSlot);
+			_vm->_loadGameSlot = -1;
+		}
+
 		_vm->_eventsManager.getMouseInfo();
 		if (!_vm->_soundManager.getVOCStatus()) {
 			// Previous sound ended, so start up a new one
@@ -1760,4 +1767,8 @@ void ThreadResource::doAptAnim(int mode) {
 	_vm->_bVoy->getBoltGroup(0x100);
 }
 
+void ThreadResource::synchronize(Common::Serializer &s) {
+	warning("TODO: ThreadResource::synchronize");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index ec26017..1e21818 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -750,4 +750,8 @@ void GraphicsManager::drawDot() {
 	}
 }
 
+void GraphicsManager::synchronize(Common::Serializer &s) {
+	warning("TODO: GraphicsManager::synchronize");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 970e814..ccc20e5 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -26,6 +26,7 @@
 #include "common/scummsys.h"
 #include "common/array.h"
 #include "common/rect.h"
+#include "common/serializer.h"
 #include "graphics/surface.h"
 
 namespace Voyeur {
@@ -117,6 +118,11 @@ public:
 	void fadeUpICF1(int steps);
 	void fadeDownICF(int steps);
 	void drawDot();
+
+	/**
+	 * Synchronizes the game data
+	 */
+	void synchronize(Common::Serializer &s);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index d6b9531..72678fa 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -28,6 +28,9 @@
 #include "common/scummsys.h"
 #include "common/config-manager.h"
 #include "common/debug-channels.h"
+#include "graphics/palette.h"
+#include "graphics/scaler.h"
+#include "graphics/thumbnail.h"
 
 namespace Voyeur {
 
@@ -37,8 +40,6 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 		_gameDescription(gameDesc), _randomSource("Voyeur"), _soundManager(_mixer),
 		_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, 
 			Common::Point(1, 1), 1, 0, 0) {
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
 	_bVoy = NULL;
 	_iForceDeath = -1;
 	_controlPtr = NULL;
@@ -54,6 +55,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_timeBarVal = -1;
 	_checkPhoneVal = 0;
 	_voyeurArea = AREA_NONE;
+	_loadGameSlot = -1;
 
 	initialiseManagers();
 }
@@ -62,39 +64,6 @@ VoyeurEngine::~VoyeurEngine() {
 	delete _bVoy;
 }
 
-Common::String VoyeurEngine::generateSaveName(int slot) {
-	return Common::String::format("%s.%03d", _targetName.c_str(), slot);
-}
-
-/**
- * Returns true if it is currently okay to restore a game
- */
-bool VoyeurEngine::canLoadGameStateCurrently() {
-	return true;
-}
-
-/**
- * Returns true if it is currently okay to save the game
- */
-bool VoyeurEngine::canSaveGameStateCurrently() {
-	return true;
-}
-
-/**
- * Load the savegame at the specified slot index
- */
-Common::Error VoyeurEngine::loadGameState(int slot) {
-	return Common::kNoError;
-}
-
-/**
- * Save the game to the given slot index, and with the given name
- */
-Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc) {
-	//TODO
-	return Common::kNoError;
-}
-
 Common::Error VoyeurEngine::run() {
 	ESP_Init();
 	globalInitBolt();
@@ -130,6 +99,12 @@ void VoyeurEngine::initialiseManagers() {
 
 void VoyeurEngine::ESP_Init() {
 	ThreadResource::init();
+
+	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
+
+	if (ConfMan.hasKey("save_slot"))
+		_loadGameSlot = ConfMan.getInt("save_slot");
 }
 
 void VoyeurEngine::globalInitBolt() {
@@ -173,58 +148,61 @@ bool VoyeurEngine::doHeadTitle() {
 //	char dest[144];
 	
 	_eventsManager.startMainClockInt();
+
+	if (_loadGameSlot == -1) {
 	/*
-	// Show starting screen
-	if (_bVoy->getBoltGroup(0x500)) {
-		showConversionScreen();
-		_bVoy->freeBoltGroup(0x500);
+		// Show starting screen
+		if (_bVoy->getBoltGroup(0x500)) {
+			showConversionScreen();
+			_bVoy->freeBoltGroup(0x500);
 
-		if (shouldQuit())
-			return false;
-	}
+			if (shouldQuit())
+				return false;
+		}
 
-	if (ConfMan.getBool("copy_protection")) {
-		// Display lock screen
-		bool result = doLock();
-		if (!result || shouldQuit())
-			return false;
-	}
+		if (ConfMan.getBool("copy_protection")) {
+			// Display lock screen
+			bool result = doLock();
+			if (!result || shouldQuit())
+				return false;
+		}
 
-	// Show the title screen
-	showTitleScreen();
-	if (shouldQuit())
-		return false;
+		// Show the title screen
+		showTitleScreen();
+		if (shouldQuit())
+			return false;
 
-	// Opening
-	if (!_eventsManager._mouseClicked) {
-		doOpening();
-		doTransitionCard("Saturday Afternoon", "Player's Apartment");
-		_eventsManager.delayClick(90);
-	} else {
-		_eventsManager._mouseClicked = false;
-	}
+		// Opening
+		if (!_eventsManager._mouseClicked) {
+			doOpening();
+			doTransitionCard("Saturday Afternoon", "Player's Apartment");
+			_eventsManager.delayClick(90);
+		} else {
+			_eventsManager._mouseClicked = false;
+		}
 	*/
-	if (_voy._field478 & 0x80) {
-		// Add initial game event set
-		if (_voy._eventCount <= 1)
-			_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
-		if (_voy._eventCount <= 2)
-			_voy.addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1);
-		if (_voy._eventCount <= 3)
-			_voy.addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1);
-		if (_voy._eventCount <= 4)
-			_voy.addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1);
-		if (_voy._eventCount <= 5)
-			_voy.addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1);
-		if (_voy._eventCount <= 6)
-			_voy.addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1);
-		if (_voy._eventCount <= 7)
-			_voy.addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1);
-		if (_voy._eventCount <= 8)
-			_voy.addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1);
-		if (_voy._eventCount <= 9)
-			_voy.addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1);
-	} 
+		if (_voy._field478 & 0x80) {
+			// Add initial game event set
+			if (_voy._eventCount <= 1)
+				_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
+			if (_voy._eventCount <= 2)
+				_voy.addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1);
+			if (_voy._eventCount <= 3)
+				_voy.addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1);
+			if (_voy._eventCount <= 4)
+				_voy.addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1);
+			if (_voy._eventCount <= 5)
+				_voy.addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1);
+			if (_voy._eventCount <= 6)
+				_voy.addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1);
+			if (_voy._eventCount <= 7)
+				_voy.addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1);
+			if (_voy._eventCount <= 8)
+				_voy.addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1);
+			if (_voy._eventCount <= 9)
+				_voy.addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1);
+		} 
+	}
 
 	_voy._field472 = 140;
 	return true;
@@ -674,4 +652,169 @@ void VoyeurEngine::flipPageAndWaitForFade() {
 		_eventsManager.delay(1);
 }
 
+/*------------------------------------------------------------------------*/
+
+Common::String VoyeurEngine::generateSaveName(int slot) {
+	return Common::String::format("%s.%03d", _targetName.c_str(), slot);
+}
+
+/**
+ * Returns true if it is currently okay to restore a game
+ */
+bool VoyeurEngine::canLoadGameStateCurrently() {
+	return _voyeurArea == AREA_APARTMENT;
+}
+
+/**
+ * Returns true if it is currently okay to save the game
+ */
+bool VoyeurEngine::canSaveGameStateCurrently() {
+	return _voyeurArea == AREA_APARTMENT;
+}
+
+/**
+ * Load the savegame at the specified slot index
+ */
+Common::Error VoyeurEngine::loadGameState(int slot) {
+	_loadGameSlot = slot;
+	return Common::kNoError;
+}
+
+void VoyeurEngine::loadGame(int slot) {
+	// Open up the save file
+	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
+	if (!saveFile)
+		return;
+
+	Common::Serializer serializer(saveFile, NULL);
+
+	// Read in the savegame header
+	VoyeurSavegameHeader header;
+	if (!header.read(saveFile))
+		return;
+	if (header._thumbnail)
+		header._thumbnail->free();
+	delete header._thumbnail;
+
+	serializer.syncVersion(header._version);
+	synchronize(serializer);
+
+	delete saveFile;
+}
+
+/**
+ * Save the game to the given slot index, and with the given name
+ */
+Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc) {
+	// Open the save file for writing
+	Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(generateSaveName(slot));
+	if (!saveFile)
+		return Common::kCreatingFileFailed;
+
+	// Write out the header
+	VoyeurSavegameHeader header;
+	header.write(saveFile, this, desc);
+
+	// Set up a serializer
+	Common::Serializer serializer(NULL, saveFile);
+
+	// Synchronise the data
+	synchronize(serializer);
+
+	saveFile->finalize();
+	delete saveFile;
+
+	return Common::kNoError;
+}
+
+void VoyeurEngine::synchronize(Common::Serializer &s) {
+	s.syncAsSint16LE(_glGoScene);
+	s.syncAsSint16LE(_glGoStack);
+	s.syncAsSint16LE(_bob);
+	s.syncAsSint16LE(_stampFlags);
+	s.syncAsSint16LE(_playStampGroupId);
+	s.syncAsSint16LE(_currentVocId);
+	s.syncAsSint16LE(_videoId);
+
+	s.syncAsSint16LE(_iForceDeath);
+	s.syncAsSint16LE(_checkTransitionId);
+	s.syncAsSint16LE(_gameHour);
+	s.syncAsSint16LE(_gameMinute);
+	s.syncAsSint16LE(_flashTimeVal);
+	s.syncAsSint16LE(_flashTimeFlag);
+	s.syncAsSint16LE(_timeBarVal);
+	s.syncAsSint16LE(_checkPhoneVal);
+
+	// Sub-systems
+	_voy.synchronize(s);
+	_graphicsManager.synchronize(s);
+	_mainThread->synchronize(s);
+}
+
+/*------------------------------------------------------------------------*/
+
+bool VoyeurSavegameHeader::read(Common::InSaveFile *f) {
+	char id[4];
+	_thumbnail = NULL;
+
+	f->read(&id[0], 4);
+	if (strncmp(id, "VOYR", 4)) {
+		warning("Invalid savegame");
+		return false;
+	}
+
+	_version = f->readByte();
+	if (_version > VOYEUR_SAVEGAME_VERSION)
+		return false;
+
+	char c;
+	while ((c = f->readByte()) != 0)
+		_saveName += c;
+
+	// Get the thumbnail
+	_thumbnail = Graphics::loadThumbnail(*f);
+	if (!_thumbnail)
+		return false;
+
+	// Read in the save datet/ime
+	_saveYear = f->readSint16LE();
+	_saveMonth = f->readSint16LE();
+	_saveDay = f->readSint16LE();
+	_saveHour = f->readSint16LE();
+	_saveMinutes = f->readSint16LE();
+	_totalFrames = f->readUint32LE();
+
+	return true;
+}
+
+void VoyeurSavegameHeader::write(Common::OutSaveFile *f, VoyeurEngine *vm, const Common::String &saveName) {
+	// Write ident string
+	f->write("VOYR", 4);
+
+	// Write out savegame version
+	f->writeByte(VOYEUR_SAVEGAME_VERSION);
+
+	// Write out savegame name
+	f->write(saveName.c_str(), saveName.size());
+	f->writeByte(0);
+
+	// Create a thumbnail and save it
+	Graphics::Surface *thumb = new Graphics::Surface();
+	::createThumbnail(thumb, (byte *)vm->_graphicsManager._screenSurface.getPixels(), 
+		SCREEN_WIDTH, SCREEN_HEIGHT, vm->_graphicsManager._VGAColors);
+	Graphics::saveThumbnail(*f, *thumb);
+	thumb->free();
+	delete thumb;
+
+	// Write the save datet/ime
+	TimeDate td;
+	g_system->getTimeAndDate(td);
+	f->writeSint16LE(td.tm_year + 1900);
+	f->writeSint16LE(td.tm_mon + 1);
+	f->writeSint16LE(td.tm_mday);
+	f->writeSint16LE(td.tm_hour);
+	f->writeSint16LE(td.tm_min);
+	f->writeUint32LE(vm->_eventsManager.getGameCounter());
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 4ee5f84..1622524 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -33,6 +33,8 @@
 #include "common/system.h"
 #include "common/error.h"
 #include "common/random.h"
+#include "common/savefile.h"
+#include "common/serializer.h"
 #include "common/util.h"
 #include "engines/engine.h"
 #include "graphics/surface.h"
@@ -134,6 +136,11 @@ private:
 
 	void playAVideoEvent(int eventIndex);
 	int getChooseButton();
+
+	/**
+	 * Synchronizes the game data
+	 */
+	void synchronize(Common::Serializer &s);
 protected:
 	// Engine APIs
 	virtual Common::Error run();
@@ -169,7 +176,9 @@ public:
 	int _timeBarVal;
 	int _checkPhoneVal;
 	Common::Point _mansionViewPos;
+	ThreadResource *_mainThread;
 	VoyeurArea _voyeurArea;
+	int _loadGameSlot;
 public:
 	VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
 	virtual ~VoyeurEngine();
@@ -187,6 +196,7 @@ public:
 	virtual bool canSaveGameStateCurrently();
 	virtual Common::Error loadGameState(int slot);
 	virtual Common::Error saveGameState(int slot, const Common::String &desc);
+	void loadGame(int slot);
 
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
@@ -243,6 +253,20 @@ public:
 	Common::String getTimeOfDay();
 };
 
+#define VOYEUR_SAVEGAME_VERSION 1
+
+struct VoyeurSavegameHeader {
+	uint8 _version;
+	Common::String _saveName;
+	Graphics::Surface *_thumbnail;
+	int _saveYear, _saveMonth, _saveDay;
+	int _saveHour, _saveMinutes;
+	int _totalFrames;
+
+	bool read(Common::InSaveFile *f);
+	void write(Common::OutSaveFile *f, VoyeurEngine *vm, const Common::String &saveName);
+};
+
 } // End of namespace Voyeur
 
 #endif /* VOYEUR_VOYEUR_H */
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 2212453..64af538 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -35,8 +35,8 @@ void VoyeurEngine::playStamp() {
 	initStamp();
 
 	PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource;
-	ThreadResource *threadP = threadsList->_entries[0]->_threadResource;
-	threadP->initThreadStruct(0, 0);
+	_mainThread = threadsList->_entries[0]->_threadResource;
+	_mainThread->initThreadStruct(0, 0);
 
 	_voy._isAM = false;
 	_gameHour = 9;
@@ -51,23 +51,23 @@ void VoyeurEngine::playStamp() {
 		_playStampGroupId = _currentVocId = -1;
 		_videoId = -1;
 
-		threadP->parsePlayCommands();
+		_mainThread->parsePlayCommands();
 
 		bool flag = breakFlag = (_voy._field478 & 2) != 0;
 		 
 		switch (_voy._field470) {
 		case 5:
-			buttonId = threadP->doInterface();
+			buttonId = _mainThread->doInterface();
 			
 			if (buttonId == -2) {
-				switch (threadP->doApt()) {
+				switch (_mainThread->doApt()) {
 				case 0:
 					_voy._field472 = 140;
 					break;
 				case 1:
 					_voy._field478 &= ~1;
 					_voy._field46E = true;
-					threadP->chooseSTAMPButton(22);
+					_mainThread->chooseSTAMPButton(22);
 					_voy._field472 = 143;
 					break;
 				case 2:
@@ -78,7 +78,7 @@ void VoyeurEngine::playStamp() {
 					break;
 				case 3:
 					_voy._field478 &= ~1;
-					threadP->chooseSTAMPButton(21);
+					_mainThread->chooseSTAMPButton(21);
 					break;
 				case 4:
 					breakFlag = true;
@@ -93,24 +93,24 @@ void VoyeurEngine::playStamp() {
 					break;
 				}
 			} else {
-				threadP->chooseSTAMPButton(buttonId);
+				_mainThread->chooseSTAMPButton(buttonId);
 			}
 
 			flag = true;
 			break;
 
 		case 6:
-			threadP->doRoom();
+			_mainThread->doRoom();
 			flag = true;
 			break;
 
 		case 16:
 			_voy._transitionId = 17;
-			buttonId = threadP->doApt();
+			buttonId = _mainThread->doApt();
 			
 			switch (buttonId) {
 			case 1:
-				threadP->chooseSTAMPButton(22);
+				_mainThread->chooseSTAMPButton(22);
 				flag = true;
 				break;
 			case 2:
@@ -136,7 +136,7 @@ void VoyeurEngine::playStamp() {
 				_voy._field478 &= ~0x10;
 			}
 
-			threadP->chooseSTAMPButton(0);
+			_mainThread->chooseSTAMPButton(0);
 			flag = true;
 			break;
 
@@ -158,10 +158,10 @@ void VoyeurEngine::playStamp() {
 				if (buttonId == 4) {
 					_voy._field470 = 131;
 					_eventsManager.checkForKey();
-					threadP->chooseSTAMPButton(buttonId);
+					_mainThread->chooseSTAMPButton(buttonId);
 					flag = true;
 				} else {
-					threadP->chooseSTAMPButton(buttonId);
+					_mainThread->chooseSTAMPButton(buttonId);
 					_voy._field46E = true;
 				}
 			}
@@ -194,12 +194,12 @@ void VoyeurEngine::playStamp() {
 				// Break out of loop
 				flag = false;
 
-			} else if (threadP->_field40 & 2) {
+			} else if (_mainThread->_field40 & 2) {
 				_eventsManager.getMouseInfo();
-				threadP->chooseSTAMPButton(0);
+				_mainThread->chooseSTAMPButton(0);
 				flag = true;
 			} else {
-				threadP->chooseSTAMPButton(0);
+				_mainThread->chooseSTAMPButton(0);
 				flag = true;
 			}
 		} while (flag);


Commit: 5774ce53df3d6603416cb31bdb570ce19ae9d9b4
    https://github.com/scummvm/scummvm/commit/5774ce53df3d6603416cb31bdb570ce19ae9d9b4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-14T18:49:26-08:00

Commit Message:
VOYEUR: Further saving logic

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index f14b744..6fc7ad7 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -469,11 +469,6 @@ private:
 	void clearButtonFlag(int idx, byte bits);
 
 	/**
-	 * Loads data needed for displaying the initial apartment screen
-	 */
-	void loadTheApt();
-
-	/**
 	 * Frees the apartment screen data
 	 */
 	void freeTheApt();
@@ -534,6 +529,11 @@ public:
 	 */
 	int doApt();
 
+	/**
+	 * Loads data needed for displaying the initial apartment screen
+	 */
+	void loadTheApt();
+
 	void checkForMurder();
 	void checkForIncriminate();
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 1e21818..6c62c6f 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -751,7 +751,7 @@ void GraphicsManager::drawDot() {
 }
 
 void GraphicsManager::synchronize(Common::Serializer &s) {
-	warning("TODO: GraphicsManager::synchronize");
+	s.syncBytes(&_VGAColors[0], PALETTE_SIZE);
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 72678fa..c70bb20 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -687,6 +687,7 @@ void VoyeurEngine::loadGame(int slot) {
 		return;
 
 	Common::Serializer serializer(saveFile, NULL);
+	_checkTransitionId = _voy._transitionId;
 
 	// Read in the savegame header
 	VoyeurSavegameHeader header;
@@ -700,6 +701,12 @@ void VoyeurEngine::loadGame(int slot) {
 	synchronize(serializer);
 
 	delete saveFile;
+
+	// Show a transition card if the time index has changed
+	checkTransition();
+
+	// Load the apartment
+	_mainThread->loadTheApt();
 }
 
 /**


Commit: 0985cc51c259aa81ad8583b1dda82e071d7f367b
    https://github.com/scummvm/scummvm/commit/0985cc51c259aa81ad8583b1dda82e071d7f367b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-14T20:19:24-08:00

Commit Message:
VOYEUR: Implement pictures with horizontal or vertical flip

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 4c0ae1b..02cdda0 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -742,8 +742,17 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 
 	int nbytes = _bounds.width() * _bounds.height();
 	if (_flags & PICFLAG_20) {
-		if (_flags & (PICFLAG_80 | PICFLAG_40)) {
-			error("TODO: sInitPic - Case 40 | 80");
+		if (_flags & (PICFLAG_VFLIP | PICFLAG_HFLIP)) {
+			// Get the raw data for the picture from another resource
+			uint32 id = READ_LE_UINT32(&src[18]);
+			const byte *srcData = state._curLibPtr->boltEntry(id)._data;
+			_imgData = new byte[nbytes];
+
+			// Flip the image data either horizontally or vertically
+			if (_flags & PICFLAG_HFLIP)
+				flipHorizontal(srcData);
+			else
+				flipVertical(srcData);
 		} else {
 			error("TODO: sInitPic - Case !(40 | 80)");
 		}
@@ -861,6 +870,30 @@ PictureResource::~PictureResource() {
 	delete[] _imgData;
 }
 
+void PictureResource::flipHorizontal(const byte *data) {
+	const byte *srcP = data + 18;
+	byte *destP = _imgData + _bounds.width() - 1;
+
+	for (int y = 0; y < _bounds.height(); ++y) {
+		for (int x = 0; x < _bounds.width(); ++x, ++srcP, --destP)
+			*destP = *srcP;
+
+		srcP += _bounds.width();
+		destP += _bounds.width();
+	}
+}
+
+void PictureResource::flipVertical(const byte *data) {
+	const byte *srcP = data + 18;
+	byte *destP = _imgData + _bounds.width() * (_bounds.height() - 1);
+
+	for (int y = 0; y < _bounds.height(); ++y) {
+		Common::copy(srcP, srcP + _bounds.width(), destP);
+		srcP += _bounds.width();
+		destP -= _bounds.width();	
+	}
+}
+
 /*------------------------------------------------------------------------*/
 
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 6fc7ad7..105eba5 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -255,9 +255,19 @@ public:
 /* bvoy.blt resource types */
 
 enum PictureFlag { PICFLAG_8 = 8, PICFLAG_10 = 0x10, PICFLAG_20 = 0x20, 
-	PICFLAG_40 = 0x40, PICFLAG_80 = 0x80, PICFLAG_1000 = 0x1000 };
+	PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_1000 = 0x1000 };
 
 class PictureResource: public DisplayResource {
+private:
+	/**
+	 * Flip the image data horizontally
+	 */
+	void flipHorizontal(const byte *data);
+
+	/**
+	 * Flip the image data vertically
+	 */
+	void flipVertical(const byte *data);
 public:
 	byte _select;
 	byte _pick;


Commit: b0e397551c2e6dc9b3e7f5ce726b00ac6a460398
    https://github.com/scummvm/scummvm/commit/b0e397551c2e6dc9b3e7f5ce726b00ac6a460398
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-16T06:25:31-08:00

Commit Message:
VOYEUR: Implemented remaining initialisations in sInitPic

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 02cdda0..e728696 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -739,6 +739,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 	_planeSize = READ_LE_UINT16(&src[22]);
 
 	_imgData = NULL;
+	_freeImgData = DisposeAfterUse::YES;
 
 	int nbytes = _bounds.width() * _bounds.height();
 	if (_flags & PICFLAG_20) {
@@ -754,9 +755,18 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 			else
 				flipVertical(srcData);
 		} else {
-			error("TODO: sInitPic - Case !(40 | 80)");
+			uint32 id = READ_LE_UINT32(&src[18]) >> 16;
+			byte *imgData = state._curLibPtr->boltEntry(id)._picResource->_imgData;
+			_freeImgData = DisposeAfterUse::NO;
+
+			if (_flags & PICFLAG_PIC_OFFSET) {
+				_imgData = imgData + (READ_LE_UINT32(&src[18]) & 0xffff);
+			} else {
+				warning("TODO: Double-check if this is correct");
+				_imgData = imgData + (READ_LE_UINT32(&src[18]) & 0xffff);
+			}
 		}
-	} else if (_flags & PICFLAG_8) {
+	} else if (_flags & PICFLAG_PIC_OFFSET) {
 		int mode = 0;
 		if (_bounds.width() == 320) {
 			mode = 147;
@@ -786,18 +796,23 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 			state._vm->_graphicsManager.clearPalette();			
 		}
 
-//		byte *imgData = _imgData;
-		if (_flags & PICFLAG_10) {
-			// TODO: Figure out what it's doing. Looks like a direct clearing
-			// of the screen directly
-			error("TODO: sInitPic - Case 10");
+		int screenOffset = READ_LE_UINT32(&src[18]) & 0xffff;
+		assert(screenOffset == 0);
+
+		if (_flags & PICFLAG_CLEAR_SCREEN) {
+			// Clear screen picture. That's right. This game actually has a picture
+			// resource flag to clear the screen! Bizarre.
+			Graphics::Surface &s = state._vm->_graphicsManager._screenSurface;
+			s.fillRect(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
 		} else {
-			// TODO: Figure out direct screen loading
-			error("TODO: sInitPic - Case !10");
+			// Direct sceren loading picture. In this case, the raw data of the resource
+			// is directly decompressed into the screen surface. Again, bizarre.
+			byte *pDest = (byte *)state._vm->_graphicsManager._screenSurface.getPixels();
+			state.decompress(pDest, SCREEN_WIDTH * SCREEN_HEIGHT, state._curMemberPtr->_mode);
 		}
 	} else {
-		if (_flags & PICFLAG_1000) {
-			if (!(_flags & PICFLAG_10))
+		if (_flags & PICFLAG_CLEAR_SCREEN00) {
+			if (!(_flags & PICFLAG_CLEAR_SCREEN))
 				nbytes = state._curMemberPtr->_size - 24;
 
 			int mask = (nbytes + 0x3FFF) >> 14;
@@ -818,7 +833,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
 			}
 		}
 
-		if (_flags & PICFLAG_10) {
+		if (_flags & PICFLAG_CLEAR_SCREEN) {
 			_imgData = new byte[nbytes];
 			Common::fill(_imgData, _imgData + nbytes, 0);
 		} else {
@@ -838,6 +853,7 @@ PictureResource::PictureResource(Graphics::Surface *surface) {
 	
 	_bounds = Common::Rect(0, 0, surface->w, surface->h);
 	_imgData = (byte *)surface->getPixels();
+	_freeImgData = DisposeAfterUse::NO;
 }
 
 PictureResource::PictureResource() {
@@ -850,6 +866,7 @@ PictureResource::PictureResource() {
 	_planeSize = 0;
 
 	_imgData = NULL;
+	_freeImgData = DisposeAfterUse::NO;
 }
 
 PictureResource::PictureResource(int flags, int select, int pick, int onOff, 
@@ -867,7 +884,8 @@ PictureResource::PictureResource(int flags, int select, int pick, int onOff,
 }
 
 PictureResource::~PictureResource() {
-	delete[] _imgData;
+	if (_freeImgData == DisposeAfterUse::YES)
+		delete[] _imgData;
 }
 
 void PictureResource::flipHorizontal(const byte *data) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 105eba5..e2a6380 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -254,8 +254,8 @@ public:
 
 /* bvoy.blt resource types */
 
-enum PictureFlag { PICFLAG_8 = 8, PICFLAG_10 = 0x10, PICFLAG_20 = 0x20, 
-	PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_1000 = 0x1000 };
+enum PictureFlag { PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10, PICFLAG_20 = 0x20, 
+	PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_CLEAR_SCREEN00 = 0x1000 };
 
 class PictureResource: public DisplayResource {
 private:
@@ -277,7 +277,15 @@ public:
 	uint32 _maskData;
 	uint _planeSize;
 
+	/**
+	 * Image data for the picture
+	 */
 	byte *_imgData;
+
+	/**
+	 * Flag to indicate whether to free the image data
+	 */
+	DisposeAfterUse::Flag _freeImgData;
 public:
 	PictureResource(BoltFilesState &state, const byte *src);
 	PictureResource(int flags, int select, int pick, int onOff, int depth, 


Commit: c1657dc2789cf5fd680248850ca9f51c85698498
    https://github.com/scummvm/scummvm/commit/c1657dc2789cf5fd680248850ca9f51c85698498
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-16T19:11:41-08:00

Commit Message:
VOYEUR: Fix selection of apartment music after initial phone call ends

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index cee4e46..8fa2ec7 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1072,7 +1072,7 @@ int ThreadResource::doApt() {
 		_vm->_eventsManager.getMouseInfo();
 		if (!_vm->_soundManager.getVOCStatus()) {
 			// Previous sound ended, so start up a new one
-			_vm->_currentVocId = _vm->getRandomNumber(4) + 151;
+			_vm->_currentVocId = 151 - _vm->getRandomNumber(4);
 			_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId));
 		}
 


Commit: 6b059631ce8a54556bb27891438f65cd1fed59dc
    https://github.com/scummvm/scummvm/commit/6b059631ce8a54556bb27891438f65cd1fed59dc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-17T18:57:33-08:00

Commit Message:
VOYEUR: Cleanup of doGossip, and better generic video playback code

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 42172b7..02dc8c2 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -23,6 +23,7 @@
 #include "voyeur/animation.h"
 #include "voyeur/staticres.h"
 #include "voyeur/voyeur.h"
+#include "common/endian.h"
 #include "common/memstream.h"
 #include "common/system.h"
 #include "audio/decoders/raw.h"
@@ -98,27 +99,6 @@ RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
 	return (RL2VideoTrack *)track;
 }
 
-void RL2Decoder::play(::Voyeur::VoyeurEngine *vm) {
-	vm->_eventsManager.getMouseInfo();
-
-	while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager._mouseClicked) {
-		if (hasDirtyPalette()) {
-			const byte *palette = getPalette();
-			vm->_graphicsManager.setPalette(palette, 0, 256);
-		}
-
-		if (needsUpdate()) {
-			const Graphics::Surface *frame = decodeNextFrame();
-
-			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
-				(byte *)vm->_graphicsManager._screenSurface.getPixels());
-		}
-
-		vm->_eventsManager.getMouseInfo();
-		g_system->delayMillis(10);
-	}
-}
-
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2FileHeader::RL2FileHeader() {
@@ -446,3 +426,45 @@ Audio::QueuingAudioStream *RL2Decoder::RL2AudioTrack::createAudioStream() {
 }
 
 } // End of namespace Video
+
+/*------------------------------------------------------------------------*/
+
+namespace Voyeur {
+
+void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset, byte *frames, byte *imgPos) {
+	vm->flipPageAndWait();
+
+	PictureResource videoFrame(getVideoTrack()->getBackSurface());
+	int picCtr = 0;
+	while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager._mouseClicked) {
+		if (hasDirtyPalette()) {
+			const byte *palette = getPalette();
+			vm->_graphicsManager.setPalette(palette, 128, 128);
+		}
+		
+		if (needsUpdate()) {
+			if (frames) {
+				// If reached a point where a new background is needed, load it
+				// and copy over to the video decoder
+				if (getCurFrame() >= READ_LE_UINT16(frames + picCtr * 4)) {
+					PictureResource *newPic = vm->_bVoy->boltEntry(0x302 + picCtr)._picResource;
+					Common::Point pt(READ_LE_UINT16(imgPos + 4 * picCtr) - 32, 
+						READ_LE_UINT16(imgPos + 4 * picCtr + 2) - 20);
+
+					vm->_graphicsManager.sDrawPic(newPic, &videoFrame, pt);
+					++picCtr;
+				}
+
+				// Decode the next frame and display
+				const Graphics::Surface *frame = decodeNextFrame();
+				Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+					(byte *)vm->_graphicsManager._screenSurface.getPixels());
+			}
+		}
+		
+		vm->_eventsManager.getMouseInfo();
+		g_system->delayMillis(10);
+	}
+}
+
+} // End of namespace Video
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 34cc9ee..b164888 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -29,6 +29,7 @@
 #include "common/list.h"
 #include "common/rect.h"
 #include "common/stream.h"
+#include "voyeur/files.h"
 
 namespace Voyeur {
 
@@ -156,10 +157,25 @@ public:
 	void clearDirtyRects();
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 	RL2VideoTrack *getVideoTrack();
-	void play(::Voyeur::VoyeurEngine *vm);
 	int getPaletteCount() const { return _header._colorCount; }
 };
 
 } // End of namespace Video
 
+namespace Voyeur {
+
+class VoyeurRL2Decoder: public Video::RL2Decoder {
+public:
+	/**
+	 * Play back a given Voyeur RL2 video
+	 * @param vm			Engine reference
+	 * @param resourceOffset Starting resource to use for frame pictures
+	 * @param frames		Optional frame numbers resource for when to apply image data
+	 * @param imgPos		Position to draw image data
+	 */
+	void play(VoyeurEngine *vm, int resourceOffset = 0, byte *frames = NULL, byte *imgPos = NULL);
+};
+
+}
+
 #endif /* VOYEUR_ANIMATION_H */
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 64af538..2e59b77 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -230,7 +230,7 @@ void VoyeurEngine::doTailTitle() {
 	_graphicsManager.screenReset();
 	
 	if (_bVoy->getBoltGroup(0x600)) {
-		::Video::RL2Decoder decoder;
+		VoyeurRL2Decoder decoder;
 		decoder.loadFile("a1100200.rl2");
 		decoder.start();
 		decoder.play(this);
@@ -679,10 +679,11 @@ void VoyeurEngine::doGossip() {
 		return;
 
 	// Load the gossip animation
-	::Video::RL2Decoder decoder;
+	VoyeurRL2Decoder decoder;
 	decoder.loadFile("a2050100.rl2");
 	decoder.start();
 
+	// Get the resource data for the first gossip video
 	PictureResource *bgPic = _bVoy->boltEntry(0x300)._picResource;
 	CMapResource *pal = _bVoy->boltEntry(0x301)._cMapResource;
 	pal->startFade();
@@ -692,61 +693,20 @@ void VoyeurEngine::doGossip() {
 	bgPic->_bounds.moveTo(0, 0);
 	_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(0, 0));
 
-	flipPageAndWait();
-
 	byte *frameNumsP = _bVoy->memberAddr(0x309);
 	byte *posP = _bVoy->boltEntry(0x30A)._data;
 
-	// Main playback loop
-	int picCtr = 0;
-	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
-		if (decoder.hasDirtyPalette()) {
-			const byte *palette = decoder.getPalette();
-			_graphicsManager.setPalette(palette, 128, 128);
-		}
-		
-		if (decoder.needsUpdate()) {
-			// If reached a point where a new background is needed, load it
-			// and copy over to the video decoder
-			if (decoder.getCurFrame() >= READ_LE_UINT16(frameNumsP + picCtr * 4)) {
-				PictureResource *newBgPic = _bVoy->boltEntry(0x302 + picCtr)._picResource;
-				Common::Point pt(READ_LE_UINT16(posP + 4 * picCtr + 2), 
-					READ_LE_UINT16(posP + 4 * picCtr));
-
-				_graphicsManager.sDrawPic(newBgPic, &videoFrame, pt);
-				++picCtr;
-			}
-
-			// Decode the next frame and display
-			const Graphics::Surface *frame = decoder.decodeNextFrame();
-			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
-				(byte *)_graphicsManager._screenSurface.getPixels());
-		}
-		
-		_eventsManager.getMouseInfo();
-		g_system->delayMillis(10);
-	}
-	/*
-	decoder.loadFile("a2110100.rl2");
-	decoder.start();
-
-	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
-		if (decoder.hasDirtyPalette()) {
-			const byte *palette = decoder.getPalette();
-			_graphicsManager.setPalette(palette, 0, 256);
-		}
-
-		if (decoder.needsUpdate()) {
-			const Graphics::Surface *frame = decoder.decodeNextFrame();
+	// Play the initial gossip video
+	decoder.play(this, 0x302, frameNumsP, posP);
 
-			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
-				(byte *)_graphicsManager._screenSurface.getPixels());
-		}
+	if (!_eventsManager._mouseClicked) {
+		// Play further interview
+		decoder.loadFile("a2110100.rl2");
+		decoder.start();
 
-		_eventsManager.pollEvents();
-		g_system->delayMillis(10);
+		decoder.play(this);
 	}
-	*/
+
 	_bVoy->freeBoltGroup(0x300);
 	_graphicsManager.screenReset();
 }


Commit: 829de693ef90fd6381ab6525158d1a38d9df6d3d
    https://github.com/scummvm/scummvm/commit/829de693ef90fd6381ab6525158d1a38d9df6d3d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-17T20:01:41-08:00

Commit Message:
VOYEUR: Fix for video playback when no custom pic list needs to be applied

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 02dc8c2..0d4d842 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -454,12 +454,12 @@ void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset, byte *frames,
 					vm->_graphicsManager.sDrawPic(newPic, &videoFrame, pt);
 					++picCtr;
 				}
-
-				// Decode the next frame and display
-				const Graphics::Surface *frame = decodeNextFrame();
-				Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
-					(byte *)vm->_graphicsManager._screenSurface.getPixels());
 			}
+
+			// Decode the next frame and display
+			const Graphics::Surface *frame = decodeNextFrame();
+			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+				(byte *)vm->_graphicsManager._screenSurface.getPixels());
 		}
 		
 		vm->_eventsManager.getMouseInfo();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 8fa2ec7..4b07472 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1086,6 +1086,8 @@ int ThreadResource::doApt() {
 				hotspotId = idx;
 
 				if (idx != prevHotspotId) {
+					// Check for whether to replace hotspot Id for "Watch TV" for
+					// "Review the Tape" if player has already watched the TV
 					if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2))
 						hotspotId = 5;
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 2e59b77..57a08b7 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -699,13 +699,12 @@ void VoyeurEngine::doGossip() {
 	// Play the initial gossip video
 	decoder.play(this, 0x302, frameNumsP, posP);
 
-	if (!_eventsManager._mouseClicked) {
-		// Play further interview
-		decoder.loadFile("a2110100.rl2");
-		decoder.start();
+	// Play interview video
+	decoder.loadFile("a2110100.rl2");
+	decoder.start();
 
-		decoder.play(this);
-	}
+	_eventsManager.getMouseInfo();
+	decoder.play(this);
 
 	_bVoy->freeBoltGroup(0x300);
 	_graphicsManager.screenReset();


Commit: 7ad8dfa0a720ea5b7db502424ba73fb7059824b6
    https://github.com/scummvm/scummvm/commit/7ad8dfa0a720ea5b7db502424ba73fb7059824b6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-17T20:19:54-08:00

Commit Message:
VOYEUR: Fix switching TV watch gossip to reviewing the tape

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 4b07472..850e6df 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -388,7 +388,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_graphicsManager._backColors->startFade();
 					_vm->flipPageAndWaitForFade();
 
-					_vm->_voy._field478 = -2;
+					_vm->_voy._field478 &= ~1;
 					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
 					Common::String filename = _vm->_soundManager.getVOCFileName(
 						_vm->_videoId + 159);
@@ -407,7 +407,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_eventsManager.incrementTime(1);
 
 					_vm->_bVoy->freeBoltGroup(0x7F00);
-					_vm->_voy._field478 = -17;
+					_vm->_voy._field478 &= ~0x10;
 					_vm->_videoId = -1;
 					_vm->_voy._field470 = 129;
 					parseIndex = 999;
@@ -628,7 +628,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 11:
-			_vm->_voy._field478 = 2;
+			_vm->_voy._field478 |= 2;
 			break;
 
 		case 12:
@@ -1085,7 +1085,7 @@ int ThreadResource::doApt() {
 				// Cursor is within hotspot area
 				hotspotId = idx;
 
-				if (idx != prevHotspotId) {
+				if (hotspotId != prevHotspotId) {
 					// Check for whether to replace hotspot Id for "Watch TV" for
 					// "Review the Tape" if player has already watched the TV
 					if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2))
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 57a08b7..ca87373 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -87,7 +87,7 @@ void VoyeurEngine::playStamp() {
 					doGossip();
 					_voy._field46E = true;
 					_voy._field472 = 141;
-					_voy._field478 = -1;
+					_voy._field478 &= ~0x100;
 					break;
 				default:
 					break;


Commit: 8792e4f97b7ad3cb1863dd0ccf15adaac7f6a061
    https://github.com/scummvm/scummvm/commit/8792e4f97b7ad3cb1863dd0ccf15adaac7f6a061
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T04:58:16-08:00

Commit Message:
VOYEUR: Fix anonymous resource in reviewTape to a hotspot list

Changed paths:
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 1622524..33e924a 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -112,6 +112,9 @@ private:
 	 */
 	void doPiracy();
 
+	/**
+	 * Review previous tape recordings on the TV
+	 */
 	void reviewTape();
 
 	/**
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ca87373..f31e67b 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -433,11 +433,11 @@ void VoyeurEngine::reviewTape() {
 	if ((si + _voy._eventCount) <= 7)
 		var20 = si + _voy._eventCount - 1;
 
+	_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
+	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
+
 	bool breakFlag = false;
 	while (!shouldQuit() && !breakFlag) {
-		_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
-		byte *dataP = _bVoy->memberAddr(0x906);
-		int varA = READ_LE_UINT16(dataP);
 		_graphicsManager._backColors = _bVoy->boltEntry(0x902)._cMapResource;
 		_graphicsManager._backgroundPage = _bVoy->boltEntry(0x901)._picResource;
 		(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
@@ -463,8 +463,7 @@ void VoyeurEngine::reviewTape() {
 
 		_eventsManager.getMouseInfo();
 		if (newX == -1) {
-			_eventsManager.setMousePos(Common::Point((int16)READ_LE_UINT16(dataP + 10) + 12,
-				(int16)READ_LE_UINT16(dataP + 12) + 6));
+			_eventsManager.setMousePos(Common::Point(hotspots[1].left + 12, hotspots[1].top + 6));
 		} else {
 			_eventsManager.setMousePos(Common::Point(newX, newY));
 		}
@@ -523,11 +522,8 @@ void VoyeurEngine::reviewTape() {
 			_eventsManager.getMouseInfo();
 			foundIndex = -1;
 			Common::Point tempPos = _eventsManager.getMousePos() + Common::Point(14, 7);
-			for (int idx = 0; idx < varA; ++idx) {
-				if (READ_LE_UINT16(dataP + idx * 8 + 2) <= tempPos.x &&
-					READ_LE_UINT16(dataP + idx * 8 + 6) >= tempPos.x &&
-					READ_LE_UINT16(dataP + idx * 8 + 4) <= tempPos.y &&
-					READ_LE_UINT16(dataP + idx * 8 + 4) <= tempPos.y) {
+			for (uint idx = 0; idx < hotspots.size(); ++idx) {
+				if (hotspots[idx].contains(tempPos)) {
 					// Found hotspot area
 					foundIndex = idx;
 					break;
@@ -552,6 +548,7 @@ void VoyeurEngine::reviewTape() {
 
 					_graphicsManager._drawPtr->_penColor = 0;
 					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
+					
 					// TODO: Does sFillBox need to work on picture resources?
 					((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height());
 


Commit: cbbdf4db47cc6efeef5d9fa2630445e64aa3e444
    https://github.com/scummvm/scummvm/commit/cbbdf4db47cc6efeef5d9fa2630445e64aa3e444
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T05:09:38-08:00

Commit Message:
VOYEUR: Fix sFillBox to work for PictureResource as well

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index e728696..67488e4 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -724,7 +724,34 @@ RectResource::RectResource(int x1, int y1, int x2, int y2) {
 
 /*------------------------------------------------------------------------*/
 
-PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
+DisplayResource::DisplayResource() {
+	_vm = NULL;
+}
+
+DisplayResource::DisplayResource(VoyeurEngine *vm) {
+	_vm = vm;
+}
+
+void DisplayResource::sFillBox(int width, int height) {
+	assert(_vm);
+	bool saveBack = _vm->_graphicsManager._saveBack;
+	_vm->_graphicsManager._saveBack = false;
+
+	PictureResource pr;
+	pr._flags = 1;
+	pr._select = 0xff;
+	pr._pick = 0;
+	pr._onOff = _vm->_graphicsManager._drawPtr->_penColor;
+	pr._bounds = Common::Rect(0, 0, width, height);
+
+	_vm->_graphicsManager.sDrawPic(&pr, this, _vm->_graphicsManager._drawPtr->_pos);
+	_vm->_graphicsManager._saveBack = saveBack;
+}
+
+/*------------------------------------------------------------------------*/
+
+PictureResource::PictureResource(BoltFilesState &state, const byte *src):
+		DisplayResource(state._vm) {
 	_flags = READ_LE_UINT16(src);
 	_select = src[2];
 	_pick = src[3];
@@ -915,7 +942,8 @@ void PictureResource::flipVertical(const byte *data) {
 /*------------------------------------------------------------------------*/
 
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
-		_fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), _state(state) {
+		_fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), 
+		_state(state), DisplayResource(state._vm) {
 	_flags = READ_LE_UINT16(src);
 	_parent = NULL;
 	_pageCount = READ_LE_UINT16(src + 6);
@@ -1271,23 +1299,7 @@ int ViewPortResource::textWidth(const Common::String &msg) {
 
 void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
 	// TODO
-	warning("TODO: addSaveRect");
-}
-
-void ViewPortResource::sFillBox(int width, int height) {
-	bool saveBack = _state._vm->_graphicsManager._saveBack;
-	_state._vm->_graphicsManager._saveBack = false;
-
-	PictureResource pr;
-	pr._flags = 1;
-	pr._select = 0xff;
-	pr._pick = 0;
-	pr._onOff = _state._vm->_graphicsManager._drawPtr->_penColor;
-	pr._bounds = Common::Rect(0, 0, width, height);
-
-	_state._vm->_graphicsManager.sDrawPic(&pr, this, 
-		_state._vm->_graphicsManager._drawPtr->_pos);
-	_state._vm->_graphicsManager._saveBack = saveBack;
+	error("TODO: addSaveRect");
 }
 
 void ViewPortResource::fillPic(byte onOff) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index e2a6380..cbbf35e 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -248,8 +248,15 @@ enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 =
 	DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000 };
 
 class DisplayResource {
+private:
+	VoyeurEngine *_vm;
 public:
 	uint32 _flags;
+public:
+	DisplayResource();
+	DisplayResource(VoyeurEngine *vm);
+
+	void sFillBox(int width, int height);
 };
 
 /* bvoy.blt resource types */
@@ -338,7 +345,6 @@ public:
 	int drawText(const Common::String &msg);
 	int textWidth(const Common::String &msg);
 	void addSaveRect(int pageIndex, const Common::Rect &r);
-	void sFillBox(int width, int height);
 	void fillPic(byte onOff = 0);
 	void drawIfaceTime();
 };
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index f31e67b..d55a972 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -483,8 +483,7 @@ void VoyeurEngine::reviewTape() {
 
 				_graphicsManager._drawPtr->_penColor = 0;
 				_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
-				// TODO: Check - does drawText need to work on PictureResources?
-				((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height());
+				_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
 				newX = si;
 				int yp = 45;
@@ -549,8 +548,7 @@ void VoyeurEngine::reviewTape() {
 					_graphicsManager._drawPtr->_penColor = 0;
 					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
 					
-					// TODO: Does sFillBox need to work on picture resources?
-					((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height());
+					_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
 					evtIndex = si;
 					int yp = 45;


Commit: e387b016c02fcec0e5f4446f1a1064e6b0171e08
    https://github.com/scummvm/scummvm/commit/e387b016c02fcec0e5f4446f1a1064e6b0171e08
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T07:16:27-08:00

Commit Message:
VOYEUR: Implemented addSaveRect and clipRect

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 67488e4..b776483 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -748,6 +748,43 @@ void DisplayResource::sFillBox(int width, int height) {
 	_vm->_graphicsManager._saveBack = saveBack;
 }
 
+bool DisplayResource::clipRect(Common::Rect &rect) {
+	Common::Rect clipRect;
+	if (_vm->_graphicsManager._clipPtr) {
+		clipRect = *_vm->_graphicsManager._clipPtr;
+	} else if (_flags & DISPFLAG_VIEWPORT) {
+		clipRect = ((ViewPortResource *)this)->_clipRect;
+	} else {
+		clipRect = ((PictureResource *)this)->_bounds;
+	}
+
+	Common::Rect r = rect;
+	if (r.left < clipRect.left) {
+		if (r.right <= clipRect.left)
+			return false;
+		r.setWidth(r.right - clipRect.left);
+	}
+	if (r.right >= clipRect.right) {
+		if (r.left >= clipRect.left)
+			return false;
+		r.setWidth(clipRect.right - r.left);
+	}
+
+	if (r.top < clipRect.top) {
+		if (r.bottom <= clipRect.top)
+			return false;
+		r.setHeight(r.bottom - clipRect.top);
+	}
+	if (r.bottom >= clipRect.bottom) {
+		if (r.top >= clipRect.top)
+			return false;
+		r.setWidth(clipRect.bottom - r.top);
+	}
+
+	rect = r;
+	return true;
+}
+
 /*------------------------------------------------------------------------*/
 
 PictureResource::PictureResource(BoltFilesState &state, const byte *src):
@@ -1299,7 +1336,15 @@ int ViewPortResource::textWidth(const Common::String &msg) {
 
 void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
 	// TODO
-	error("TODO: addSaveRect");
+	Common::Rect rect = r;
+	
+	if (clipRect(rect)) {
+		if (_addFn) {
+			(_state._vm->_graphicsManager.*_addFn)(this, pageIndex, rect);
+		} else if (_rectListCount[pageIndex] != -1) {
+			_rectListPtr[pageIndex]->push_back(rect);
+		}
+	}
 }
 
 void ViewPortResource::fillPic(byte onOff) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index cbbf35e..b22aae4 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -256,7 +256,12 @@ public:
 	DisplayResource();
 	DisplayResource(VoyeurEngine *vm);
 
+	/** 
+	 * Fill a box of the given size at the current _drawPtr location
+	 */
 	void sFillBox(int width, int height);
+
+	bool clipRect(Common::Rect &rect);
 };
 
 /* bvoy.blt resource types */
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index d55a972..3178ccd 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -546,8 +546,7 @@ void VoyeurEngine::reviewTape() {
 					flipPageAndWait();
 
 					_graphicsManager._drawPtr->_penColor = 0;
-					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
-					
+					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);				
 					_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
 					evtIndex = si;


Commit: f084539957e461cd74179008f81791fd29f0d311
    https://github.com/scummvm/scummvm/commit/f084539957e461cd74179008f81791fd29f0d311
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T11:38:33-08:00

Commit Message:
VOYEUR: Converted drawText and textWidth to work on PictureResource

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index b776483..3de0d88 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -785,6 +785,221 @@ bool DisplayResource::clipRect(Common::Rect &rect) {
 	return true;
 }
 
+int DisplayResource::drawText(const Common::String &msg) {
+	GraphicsManager &gfxManager = _vm->_graphicsManager;
+	assert(gfxManager._fontPtr);
+	assert(gfxManager._fontPtr->_curFont);
+	FontInfoResource &fontInfo = *gfxManager._fontPtr;
+	PictureResource &fontChar = *_vm->_graphicsManager._fontChar;
+	FontResource &fontData = *fontInfo._curFont;
+	int xShadows[9] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };
+	int yShadows[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
+
+	Common::Rect *clipPtr = gfxManager._clipPtr;
+	if (!(fontInfo._picFlags & DISPFLAG_1))
+		gfxManager._clipPtr = NULL;
+
+	int minChar = fontData._minChar;
+	int padding = fontData._padding;
+	int fontHeight = fontData._fontHeight;
+	int totalChars = fontData._maxChar - fontData._minChar;
+	int msgWidth = 0;
+	int xp = 0, yp = 0;
+
+	Common::Point pos = Common::Point(fontInfo._pos.x, fontInfo._pos.y + fontData._topPadding);
+
+	fontChar._flags = fontInfo._picFlags | DISPFLAG_2;
+	fontChar._select = fontInfo._picSelect;
+	fontChar._bounds.setHeight(fontHeight);
+
+	ViewPortResource *viewPort = !(_flags & DISPFLAG_VIEWPORT) ? NULL :
+		(ViewPortResource *)this;
+
+	if (gfxManager._drawTextPermFlag || (fontInfo._fontFlags & DISPFLAG_1) || fontInfo._justify ||
+			(gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT))) {
+		msgWidth = viewPort->textWidth(msg);
+		yp = pos.y;
+		xp = pos.x;
+
+		switch (fontInfo._justify) {
+		case 1:
+			xp = pos.x + (fontInfo._justifyWidth / 2) - (msgWidth / 2);
+			break;
+		case 2:
+			xp = pos.x + fontInfo._justifyWidth - msgWidth;
+			break;
+		default:
+			break;
+		}
+
+		if (!(fontInfo._fontFlags & 3)) {
+			viewPort->_fontRect.left = xp;
+			viewPort->_fontRect.top = yp;
+			viewPort->_fontRect.setWidth(msgWidth);
+			viewPort->_fontRect.setHeight(fontHeight);
+		} else {
+			viewPort->_fontRect.left = pos.x;
+			viewPort->_fontRect.top = pos.y;
+			viewPort->_fontRect.setWidth(fontInfo._justifyWidth);
+			viewPort->_fontRect.setHeight(fontInfo._justifyHeight);
+		}
+
+		pos.x = xp;
+		pos.y = yp;
+
+		if (fontInfo._fontFlags & 4) {
+			if (fontInfo._shadow.x <= 0) {
+				viewPort->_fontRect.left += fontInfo._shadow.x;
+				viewPort->_fontRect.right -= fontInfo._shadow.x * 2;
+			} else {
+				viewPort->_fontRect.right += fontInfo._shadow.x;
+			}
+
+			if (fontInfo._shadow.y <= 0) {
+				viewPort->_fontRect.top += fontInfo._shadow.y;
+				viewPort->_fontRect.bottom -= fontInfo._shadow.y * 2;
+			} else {
+				viewPort->_fontRect.bottom += fontInfo._shadow.y;
+			}
+		} else if (fontInfo._fontFlags & 8) {
+			if (fontInfo._shadow.x <= 0) {
+				viewPort->_fontRect.left += fontInfo._shadow.x;
+				viewPort->_fontRect.right -= fontInfo._shadow.x * 3;
+			} else {
+				viewPort->_fontRect.right += fontInfo._shadow.x * 3;
+				viewPort->_fontRect.left -= fontInfo._shadow.x;
+			}
+
+			if (fontInfo._shadow.y <= 0) {
+				viewPort->_fontRect.top += fontInfo._shadow.y;
+				viewPort->_fontRect.bottom -= fontInfo._shadow.y * 3;
+			} else {
+				viewPort->_fontRect.bottom += fontInfo._shadow.y * 3;
+				viewPort->_fontRect.top -= fontInfo._shadow.y;
+			}
+		}
+	} 
+
+	if (gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT)) {
+		viewPort->addSaveRect(viewPort->_pageIndex, viewPort->_fontRect);
+	}
+
+	if (fontInfo._fontFlags & DISPFLAG_1) {
+		gfxManager._drawPtr->_pos = Common::Point(viewPort->_fontRect.left, viewPort->_fontRect.top);
+		gfxManager._drawPtr->_penColor = fontInfo._backColor;
+		sFillBox(viewPort->_fontRect.width(), viewPort->_fontRect.height());
+	}
+
+	bool saveBack = gfxManager._saveBack;
+	gfxManager._saveBack = false;
+
+	int count = 0;
+	if (fontInfo._fontFlags & DISPFLAG_4)
+		count = 1;
+	else if (fontInfo._fontFlags & DISPFLAG_8)
+		count = 8;
+
+	for (int i = count; i >= 0; --i) {
+		xp = pos.x;
+		yp = pos.y;
+
+		switch (xShadows[i]) {
+		case -1:
+			xp -= fontInfo._shadow.x;
+			break;
+		case 1:
+			xp += fontInfo._shadow.x;
+			break;
+		default:
+			break;
+		}
+
+		switch (yShadows[i]) {
+		case -1:
+			yp -= fontInfo._shadow.y;
+			break;
+		case 1:
+			yp += fontInfo._shadow.y;
+			break;
+		default:
+			break;
+		}
+
+		if (i != 0) {
+			fontChar._pick = 0;
+			fontChar._onOff = fontInfo._shadowColor;
+		} else if (fontData.field2 == 1 || (fontInfo._fontFlags & 0x10)) {
+			fontChar._pick = 0;
+			fontChar._onOff = fontInfo._foreColor;
+		} else {
+			fontChar._pick = fontInfo._picPick;
+			fontChar._onOff = fontInfo._picOnOff;
+			fontChar._depth = fontData.field2;
+		}
+
+		// Loop to draw each character in turn
+		msgWidth = -padding;
+		const char *msgP = msg.c_str();
+		char ch;
+
+		while ((ch = *msgP++) != '\0') {
+			int charValue = (int)ch - minChar;
+			if (charValue < 0 || charValue >= totalChars || fontData._charWidth[charValue] == 0)
+				charValue = fontData._maxChar - minChar;
+
+			int charWidth = fontData._charWidth[charValue];
+			fontChar._bounds.setWidth(charWidth);
+
+			uint16 offset = READ_LE_UINT16(fontData._charOffsets + charValue * 2);
+			fontChar._imgData = fontData._charImages + offset * 2;
+
+			gfxManager.sDrawPic(&fontChar, this, Common::Point(xp, yp));
+			
+			fontChar._imgData = NULL;
+			xp += charWidth + padding;
+			msgWidth += charWidth + padding;
+		}
+	}
+
+	msgWidth = MAX(msgWidth, 0);
+	if (fontInfo._justify == ALIGN_LEFT)
+		fontInfo._pos.x = xp;
+
+	gfxManager._saveBack = saveBack;
+	gfxManager._clipPtr = clipPtr;
+
+	return msgWidth;
+}
+
+int DisplayResource::textWidth(const Common::String &msg) {
+	if (msg.size() == 0)
+		return 0;
+
+	const char *msgP = msg.c_str();
+	FontResource &fontData = *_vm->_graphicsManager._fontPtr->_curFont;
+	int minChar = fontData._minChar;
+	int maxChar = fontData._maxChar;
+	int padding = fontData._padding;
+	int totalWidth = -padding;
+	char ch;
+
+	// Loop through the characters
+	while ((ch = *msgP++) != '\0') {
+		int charValue = (int)ch;
+		if (charValue < minChar || charValue > maxChar)
+			charValue = maxChar;
+
+		if (!fontData._charWidth[charValue - minChar])
+			charValue = maxChar;
+
+		totalWidth += fontData._charWidth[charValue - minChar] + padding;
+	}
+
+	if (totalWidth < 0)
+		totalWidth = 0;
+	return totalWidth;
+}
+
 /*------------------------------------------------------------------------*/
 
 PictureResource::PictureResource(BoltFilesState &state, const byte *src):
@@ -979,7 +1194,6 @@ void PictureResource::flipVertical(const byte *data) {
 /*------------------------------------------------------------------------*/
 
 ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
-		_fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), 
 		_state(state), DisplayResource(state._vm) {
 	_flags = READ_LE_UINT16(src);
 	_parent = NULL;
@@ -1123,217 +1337,6 @@ void ViewPortResource::setupViewPort(PictureResource *pic, Common::Rect *clipRec
 		&GraphicsManager::restoreMCGASaveRect);
 }
 
-int ViewPortResource::drawText(const Common::String &msg) {
-	GraphicsManager &gfxManager = _state._vm->_graphicsManager;
-	assert(gfxManager._fontPtr);
-	assert(gfxManager._fontPtr->_curFont);
-	FontInfoResource &fontInfo = *gfxManager._fontPtr;
-	FontResource &fontData = *fontInfo._curFont;
-	int xShadows[9] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };
-	int yShadows[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
-
-	Common::Rect *clipPtr = gfxManager._clipPtr;
-	if (!(fontInfo._picFlags & DISPFLAG_1))
-		gfxManager._clipPtr = NULL;
-
-	int minChar = fontData._minChar;
-	int padding = fontData._padding;
-	int fontHeight = fontData._fontHeight;
-	int totalChars = fontData._maxChar - fontData._minChar;
-	int msgWidth = 0;
-	int xp = 0, yp = 0;
-
-	Common::Point pos = Common::Point(fontInfo._pos.x, fontInfo._pos.y + fontData._topPadding);
-
-	_fontChar._flags = fontInfo._picFlags | DISPFLAG_2;
-	_fontChar._select = fontInfo._picSelect;
-	_fontChar._bounds.setHeight(fontHeight);
-
-	if (gfxManager._drawTextPermFlag || (fontInfo._fontFlags & DISPFLAG_1) || fontInfo._justify ||
-			(gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT))) {
-		msgWidth = textWidth(msg);
-		yp = pos.y;
-		xp = pos.x;
-
-		switch (fontInfo._justify) {
-		case 1:
-			xp = pos.x + (fontInfo._justifyWidth / 2) - (msgWidth / 2);
-			break;
-		case 2:
-			xp = pos.x + fontInfo._justifyWidth - msgWidth;
-			break;
-		default:
-			break;
-		}
-
-		if (!(fontInfo._fontFlags & 3)) {
-			_fontRect.left = xp;
-			_fontRect.top = yp;
-			_fontRect.setWidth(msgWidth);
-			_fontRect.setHeight(fontHeight);
-		} else {
-			_fontRect.left = pos.x;
-			_fontRect.top = pos.y;
-			_fontRect.setWidth(fontInfo._justifyWidth);
-			_fontRect.setHeight(fontInfo._justifyHeight);
-		}
-
-		pos.x = xp;
-		pos.y = yp;
-
-		if (fontInfo._fontFlags & 4) {
-			if (fontInfo._shadow.x <= 0) {
-				_fontRect.left += fontInfo._shadow.x;
-				_fontRect.right -= fontInfo._shadow.x * 2;
-			} else {
-				_fontRect.right += fontInfo._shadow.x;
-			}
-
-			if (fontInfo._shadow.y <= 0) {
-				_fontRect.top += fontInfo._shadow.y;
-				_fontRect.bottom -= fontInfo._shadow.y * 2;
-			} else {
-				_fontRect.bottom += fontInfo._shadow.y;
-			}
-		} else if (fontInfo._fontFlags & 8) {
-			if (fontInfo._shadow.x <= 0) {
-				_fontRect.left += fontInfo._shadow.x;
-				_fontRect.right -= fontInfo._shadow.x * 3;
-			} else {
-				_fontRect.right += fontInfo._shadow.x * 3;
-				_fontRect.left -= fontInfo._shadow.x;
-			}
-
-			if (fontInfo._shadow.y <= 0) {
-				_fontRect.top += fontInfo._shadow.y;
-				_fontRect.bottom -= fontInfo._shadow.y * 3;
-			} else {
-				_fontRect.bottom += fontInfo._shadow.y * 3;
-				_fontRect.top -= fontInfo._shadow.y;
-			}
-		}
-	} 
-
-	if (gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT)) {
-		addSaveRect(_pageIndex, _fontRect);
-	}
-
-	if (fontInfo._fontFlags & DISPFLAG_1) {
-		gfxManager._drawPtr->_pos = Common::Point(_fontRect.left, _fontRect.top);
-		gfxManager._drawPtr->_penColor = fontInfo._backColor;
-		sFillBox(_fontRect.width(), _fontRect.height());
-	}
-
-	bool saveBack = gfxManager._saveBack;
-	gfxManager._saveBack = false;
-
-	int count = 0;
-	if (fontInfo._fontFlags & DISPFLAG_4)
-		count = 1;
-	else if (fontInfo._fontFlags & DISPFLAG_8)
-		count = 8;
-
-	for (int i = count; i >= 0; --i) {
-		xp = pos.x;
-		yp = pos.y;
-
-		switch (xShadows[i]) {
-		case -1:
-			xp -= fontInfo._shadow.x;
-			break;
-		case 1:
-			xp += fontInfo._shadow.x;
-			break;
-		default:
-			break;
-		}
-
-		switch (yShadows[i]) {
-		case -1:
-			yp -= fontInfo._shadow.y;
-			break;
-		case 1:
-			yp += fontInfo._shadow.y;
-			break;
-		default:
-			break;
-		}
-
-		if (i != 0) {
-			_fontChar._pick = 0;
-			_fontChar._onOff = fontInfo._shadowColor;
-		} else if (fontData.field2 == 1 || (fontInfo._fontFlags & 0x10)) {
-			_fontChar._pick = 0;
-			_fontChar._onOff = fontInfo._foreColor;
-		} else {
-			_fontChar._pick = fontInfo._picPick;
-			_fontChar._onOff = fontInfo._picOnOff;
-			_fontChar._depth = fontData.field2;
-		}
-
-		// Loop to draw each character in turn
-		msgWidth = -padding;
-		const char *msgP = msg.c_str();
-		char ch;
-
-		while ((ch = *msgP++) != '\0') {
-			int charValue = (int)ch - minChar;
-			if (charValue < 0 || charValue >= totalChars || fontData._charWidth[charValue] == 0)
-				charValue = fontData._maxChar - minChar;
-
-			int charWidth = fontData._charWidth[charValue];
-			_fontChar._bounds.setWidth(charWidth);
-
-			uint16 offset = READ_LE_UINT16(fontData._charOffsets + charValue * 2);
-			_fontChar._imgData = fontData._charImages + offset * 2;
-
-			gfxManager.sDrawPic(&_fontChar, this, Common::Point(xp, yp));
-			
-			_fontChar._imgData = NULL;
-			xp += charWidth + padding;
-			msgWidth += charWidth + padding;
-		}
-	}
-
-	msgWidth = MAX(msgWidth, 0);
-	if (fontInfo._justify == ALIGN_LEFT)
-		fontInfo._pos.x = xp;
-
-	gfxManager._saveBack = saveBack;
-	gfxManager._clipPtr = clipPtr;
-
-	return msgWidth;
-}
-
-int ViewPortResource::textWidth(const Common::String &msg) {
-	if (msg.size() == 0)
-		return 0;
-
-	const char *msgP = msg.c_str();
-	FontResource &fontData = *_state._vm->_graphicsManager._fontPtr->_curFont;
-	int minChar = fontData._minChar;
-	int maxChar = fontData._maxChar;
-	int padding = fontData._padding;
-	int totalWidth = -padding;
-	char ch;
-
-	// Loop through the characters
-	while ((ch = *msgP++) != '\0') {
-		int charValue = (int)ch;
-		if (charValue < minChar || charValue > maxChar)
-			charValue = maxChar;
-
-		if (!fontData._charWidth[charValue - minChar])
-			charValue = maxChar;
-
-		totalWidth += fontData._charWidth[charValue - minChar] + padding;
-	}
-
-	if (totalWidth < 0)
-		totalWidth = 0;
-	return totalWidth;
-}
-
 void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
 	// TODO
 	Common::Rect rect = r;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index b22aae4..6cc747d 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -261,6 +261,19 @@ public:
 	 */
 	void sFillBox(int width, int height);
 
+	/**
+	 * Draw text at the current pen position
+	 */
+	int drawText(const Common::String &msg);
+
+	/**
+	 * Return the width of a given text in the current font
+	 */
+	int textWidth(const Common::String &msg);
+
+	/**
+	 * Clip the given rectangle by the currently viewable area
+	 */
 	bool clipRect(Common::Rect &rect);
 };
 
@@ -339,7 +352,6 @@ public:
 	ViewPortSetupPtr _setupFn;
 	ViewPortAddPtr _addFn;
 	ViewPortRestorePtr _restoreFn;
-	PictureResource _fontChar;
 	Common::Rect _fontRect;
 public:
 	ViewPortResource(BoltFilesState &state, const byte *src);
@@ -347,8 +359,6 @@ public:
 
 	void setupViewPort();
 	void setupViewPort(PictureResource *pic, Common::Rect *clipRect = NULL);
-	int drawText(const Common::String &msg);
-	int textWidth(const Common::String &msg);
 	void addSaveRect(int pageIndex, const Common::Rect &r);
 	void fillPic(byte onOff = 0);
 	void drawIfaceTime();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 6c62c6f..4dd4c67 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -58,6 +58,7 @@ GraphicsManager::GraphicsManager():
 	_vPort = NULL;
 	_fontPtr = NULL;
 	Common::fill(&_VGAColors[0], &_VGAColors[PALETTE_SIZE], 0);
+	_fontChar = new PictureResource(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0);
 }
 
 void GraphicsManager::sInitGraphics() {
@@ -70,6 +71,7 @@ void GraphicsManager::sInitGraphics() {
 
 GraphicsManager::~GraphicsManager() {
 	_screenSurface.free();
+	delete _fontChar;
 }
 
 void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index ccc20e5..6205499 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -81,6 +81,7 @@ public:
 	Graphics::Surface _screenSurface;
 	CMapResource *_backColors;
 	FontInfoResource *_fontPtr;
+	PictureResource *_fontChar;
 	DrawInfo *_drawPtr;
 	DrawInfo _defaultDrawInfo;
 	bool _drawTextPermFlag;


Commit: 3f50f14698193dc3f9c6904bc5d8f304d97a8b86
    https://github.com/scummvm/scummvm/commit/3f50f14698193dc3f9c6904bc5d8f304d97a8b86
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T14:32:59-08:00

Commit Message:
VOYEUR: Implemented remainder of reviewTape and dependent methods

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index f98478b..1e40ff7 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -189,4 +189,49 @@ void SVoy::addComputerEventEnd(int v) {
 		++_eventCount;
 }
 
+void SVoy::reviewAnEvidEvent(int eventIndex) {
+	VoyeurEvent &e = _events[eventIndex];
+	_vm->_playStampGroupId = e._videoId;
+	_field47A = e._computerOn;
+	int frameOff = e._computerOff;
+
+	if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
+		_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
+		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
+		(*_vm->_graphicsManager._vPort)->setupViewPort(_vm->_graphicsManager._backgroundPage);
+		_vm->_graphicsManager._backColors->startFade();
+
+		_vm->doEvidDisplay(frameOff, e._dead);
+		_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
+		_vm->_playStampGroupId = -1;
+
+		if (_field47A != -1) {
+			_vm->_bVoy->freeBoltGroup(_field47A);
+			_field47A = -1;
+		}
+	}
+}
+
+void SVoy::reviewComputerEvent(int eventIndex) {
+	VoyeurEvent &e = _events[eventIndex];
+	_vm->_playStampGroupId = e._videoId;
+	_computerTextId = e._computerOn;
+
+	if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
+		_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
+		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
+		(*_vm->_graphicsManager._vPort)->setupViewPort(_vm->_graphicsManager._backgroundPage);
+		_vm->_graphicsManager._backColors->startFade();
+		_vm->flipPageAndWaitForFade();
+
+		_vm->getComputerBrush();
+		_vm->flipPageAndWait();
+		_vm->doComputerText(e._computerOff);
+
+		_vm->_bVoy->freeBoltGroup(0x4900);
+		_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
+		_vm->_playStampGroupId = -1;
+	}
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 03545ad..4fadf5b 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -133,6 +133,8 @@ public:
 	void addEvidEventEnd(int dead);
 	void addComputerEventStart();
 	void addComputerEventEnd(int v);
+	void reviewAnEvidEvent(int eventIndex);
+	void reviewComputerEvent(int eventIndex);
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index bf6374f..7305121 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -83,4 +83,8 @@ int SoundManager::getVOCStatus() {
 	return _mixer->isSoundHandleActive(_soundHandle);
 }
 
+uint32 SoundManager::getVOCFrame() {
+	error("TODO: getVOCFrame");
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index a73bd4a..729a7d9 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -50,6 +50,7 @@ public:
 	void startVOCPlay(const Common::String &filename);
 	void startVOCPlay(int soundId);
 	int getVOCStatus();
+	uint32 getVOCFrame();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index c70bb20..b4e8f94 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -452,7 +452,6 @@ void VoyeurEngine::showTitleScreen() {
 }
 
 void VoyeurEngine::doOpening() {
-	/*
 	_graphicsManager.screenReset();
 
 	if (!_bVoy->getBoltGroup(0x200, true))
@@ -461,8 +460,9 @@ void VoyeurEngine::doOpening() {
 	byte *frameTable = _bVoy->memberAddr(0x215);
 	byte *xyTable = _bVoy->memberAddr(0x216);
 	byte *whTable = _bVoy->memberAddr(0x217);
-	int frmaeIndex = 0;
+	int frameIndex = 0;
 	int creditShow = 1;
+	warning("TODO: %x %x %x %d %d", frameTable, xyTable, whTable, creditShow, frameIndex);
 
 	_voy._vocSecondsOffset = 0;
 	_voy._RTVNum = 0;
@@ -472,7 +472,7 @@ void VoyeurEngine::doOpening() {
 	_gameMinute  = 0;
 	_videoId = 1;
 	_eventsManager._videoDead = -1;
-	_eventsManager.addVideoEventStart();
+	_voy.addVideoEventStart();
 
 	_voy._field478 &= ~1;
 
@@ -483,7 +483,7 @@ void VoyeurEngine::doOpening() {
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort();
 	flipPageAndWait();
-
+	/*
 	::Video::RL2Decoder decoder;
 	decoder.loadFile("a2300100.rl2");
 	decoder.start();
@@ -504,16 +504,16 @@ void VoyeurEngine::doOpening() {
 		_eventsManager.pollEvents();
 		g_system->delayMillis(10);
 	}
+	*/
 
 	if ((_voy._RTVNum - _voy._field468) < 2)
 		_eventsManager.delay(60);
 
 	_voy._field478 |= 1;
-	_eventsManager.addVideoEventEnd();
+	_voy.addVideoEventEnd();
 	_voy._field478 &= 0x10;
 
 	_bVoy->freeBoltGroup(0x200);
-	*/
 }
 
 void VoyeurEngine::playRL2Video(const Common::String &filename) {
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 3178ccd..d57f9a6 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -415,10 +415,10 @@ void VoyeurEngine::doPiracy() {
 
 void VoyeurEngine::reviewTape() {
 //	int var22 = 0;
-	int si = 0;
+	int eventStart = 0;
 	int newX = -1;
 	int newY = -1;
-	int var20 = 7;
+	int eventLine = 7;
 	Common::Rect tempRect(58, 30, 58 + 223, 30 + 124);
 	Common::Point pt;
 	int evtIndex = 0;
@@ -428,10 +428,10 @@ void VoyeurEngine::reviewTape() {
 	PictureResource *cursor = _bVoy->boltEntry(0x903)._picResource;
 
 	if ((_voy._eventCount - 8) != 0)
-		si = MAX(_voy._eventCount - 8, 0);
+		eventStart = MAX(_voy._eventCount - 8, 0);
 
-	if ((si + _voy._eventCount) <= 7)
-		var20 = si + _voy._eventCount - 1;
+	if ((eventStart + _voy._eventCount) <= 7)
+		eventLine = eventStart + _voy._eventCount - 1;
 
 	_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
 	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
@@ -485,22 +485,20 @@ void VoyeurEngine::reviewTape() {
 				_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
 				_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
-				newX = si;
 				int yp = 45;
-				evtIndex = si;
-				for (int idx = 0; idx < 8 && evtIndex < _voy._eventCount; ++idx) {
+				evtIndex = eventStart;
+				for (int lineNum = 0; lineNum < 8 && evtIndex < _voy._eventCount; ++lineNum) {
 					_graphicsManager._fontPtr->_picFlags = 0;
 					_graphicsManager._fontPtr->_picSelect = 0xff;
 					_graphicsManager._fontPtr->_picPick = 7;
-					_graphicsManager._fontPtr->_picOnOff = (idx == var20) ? 8 : 0;
+					_graphicsManager._fontPtr->_picOnOff = (lineNum == eventLine) ? 8 : 0;
 					_graphicsManager._fontPtr->_pos = Common::Point(68, yp);
 					_graphicsManager._fontPtr->_justify = ALIGN_LEFT;
 					_graphicsManager._fontPtr->_justifyWidth = 0;
 					_graphicsManager._fontPtr->_justifyHeight = 0;
 
 					Common::String msg = _eventsManager.getEvidString(evtIndex);
-					// TODO: Does drawText need to work on picture resources?
-					((ViewPortResource *)_graphicsManager._backgroundPage)->drawText(msg);
+					_graphicsManager._backgroundPage->drawText(msg);
 					
 					yp += 15;
 					++evtIndex;
@@ -533,7 +531,7 @@ void VoyeurEngine::reviewTape() {
 			if (tempPos.x >= 68 && tempPos.x <= 277 && tempPos.y >= 31 && tempPos.y <= 154) {
 				tempPos.y -= 2;
 				foundIndex = (tempPos.y - 31) / 15;
-				if ((tempPos.y - 31) % 15 >= 12 || (si + foundIndex) >= _voy._eventCount) {
+				if ((tempPos.y - 31) % 15 >= 12 || (eventStart + foundIndex) >= _voy._eventCount) {
 					_eventsManager.setCursorColor(128, 0);
 					foundIndex = 999;
 				} else if (!_eventsManager._leftClick) {
@@ -541,7 +539,7 @@ void VoyeurEngine::reviewTape() {
 					foundIndex = 999;
 				} else {
 					_eventsManager.setCursorColor(128, 2);
-					var20 = foundIndex;
+					eventLine = foundIndex;
 
 					flipPageAndWait();
 
@@ -549,22 +547,21 @@ void VoyeurEngine::reviewTape() {
 					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);				
 					_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
-					evtIndex = si;
+					evtIndex = eventStart;
 					int yp = 45;
 					
 					for (int idx = 0; idx < 8 && evtIndex < _voy._eventCount; ++idx) {
 						_graphicsManager._fontPtr->_picFlags = 0;
 						_graphicsManager._fontPtr->_picSelect = 0xff;
 						_graphicsManager._fontPtr->_picPick = 7;
-						_graphicsManager._fontPtr->_picOnOff = (idx == var20) ? 8 : 0;
+						_graphicsManager._fontPtr->_picOnOff = (idx == eventLine) ? 8 : 0;
 						_graphicsManager._fontPtr->_pos = Common::Point(68, yp);
 						_graphicsManager._fontPtr->_justify = ALIGN_LEFT;
 						_graphicsManager._fontPtr->_justifyWidth = 0;
 						_graphicsManager._fontPtr->_justifyHeight = 0;
 
 						Common::String msg = _eventsManager.getEvidString(evtIndex);
-						// TODO: Does sFillBox need to work on picture resources?
-						((ViewPortResource *)_graphicsManager._backgroundPage)->drawText(msg);
+						_graphicsManager._backgroundPage->drawText(msg);
 
 						yp += 115;
 						++evtIndex;
@@ -597,36 +594,36 @@ void VoyeurEngine::reviewTape() {
 			if (_eventsManager._mouseClicked || _eventsManager._mouseUnk) {
 				switch (foundIndex) {
 				case 2:
-					if (si > 0) {
-						--si;
+					if (eventStart > 0) {
+						--eventStart;
 						var1E = true;
 					}
 					foundIndex = -1;
 					break;
 
 				case 3:
-					if (si > 0) {
-						si -= 8;
-						if (si < 0)
-							si = 0;
+					if (eventStart > 0) {
+						eventStart -= 8;
+						if (eventStart < 0)
+							eventStart = 0;
 						var1E = true;
 					}
 					foundIndex = -1;
 					break;
 
 				case 4:
-					if ((_voy._eventCount - 8) > si) {
-						++si;
+					if ((_voy._eventCount - 8) > eventStart) {
+						++eventStart;
 						var1E = true;
 					}
 					foundIndex = -1;
 					break;
 
 				case 5:
-					if (_voy._eventCount >= 8 && (_voy._eventCount - 8) != si) {
-						si += 8;
-						if ((_voy._eventCount - 8) < si)
-							si = _voy._eventCount - 8;
+					if (_voy._eventCount >= 8 && (_voy._eventCount - 8) != eventStart) {
+						eventStart += 8;
+						if ((_voy._eventCount - 8) < eventStart)
+							eventStart = _voy._eventCount - 8;
 						var1E = true;
 					}
 					foundIndex = -1;
@@ -636,8 +633,8 @@ void VoyeurEngine::reviewTape() {
 					break;
 				}
 
-				while (var20 > 0 && (var20 + si) >= _voy._eventCount)
-					--var20;
+				while (eventLine > 0 && (eventLine + eventStart) >= _voy._eventCount)
+					--eventLine;
 			}
 
 			pt = _eventsManager.getMousePos();
@@ -653,16 +650,88 @@ void VoyeurEngine::reviewTape() {
 
 		} while (!shouldQuit() && (!_eventsManager._mouseClicked || foundIndex == -1));
 
+		newY = _eventsManager.getMousePos().y;
+		_voy._field437E = 0;
+		_voy._viewBounds = nullptr;
+		(*_graphicsManager._vPort)->setupViewPort(NULL);
+			
+		if (_currentVocId != -1) {
+			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+			_soundManager.stopVOCPlay();
+		}
+
+		// Break out if the exit button was pressed
+		if (!foundIndex)
+			break;
+
+		int eventIndex = eventStart + eventLine;
+		VoyeurEvent &e = _voy._events[eventIndex];
+		switch (e._type) {
+		case EVTYPE_VIDEO:
+			playAVideoEvent(eventIndex);
+			break;
+
+		case EVTYPE_AUDIO: {
+			_videoId = e._videoId;
+			_voy._vocSecondsOffset = e._computerOn;
+			_graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 +
+				BLIND_TABLE[_videoId])._picResource;
+			_graphicsManager._backColors = _bVoy->boltEntry(0x7F01 +
+				BLIND_TABLE[_videoId])._cMapResource;
+
+			(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
+			_graphicsManager._backColors->startFade();
+			flipPageAndWaitForFade();
+
+			_eventsManager._intPtr.field1E = 1;
+			_eventsManager._intPtr.field1A = 0;
+			_voy._field478 &= ~1;
+
+			// Play suond for the given duration
+			_soundManager.setVOCOffset(_voy._vocSecondsOffset * 11025);
+			_soundManager.startVOCPlay(_videoId + 159);
+			uint32 offFrame = e._computerOff;
+
+			while (!_eventsManager._mouseClicked && _soundManager.getVOCStatus() && 
+					_soundManager.getVOCFrame() < offFrame) {
+				_eventsManager.getMouseInfo();
+				_eventsManager.delay(10);
+			}
+
+			_voy._field478 |= 1;
+			_soundManager.stopVOCPlay();
+			_bVoy->freeBoltGroup(0x7F00);
+			break;
+		}
+
+		case EVTYPE_EVID:
+			_bVoy->freeBoltGroup(0x900);
+			_voy.reviewAnEvidEvent(evtIndex);
+			
+			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+			_soundManager.stopVOCPlay();
+			_bVoy->getBoltGroup(0x900);
+			break;
 
+		case EVTYPE_COMPUTER:
+			_bVoy->freeBoltGroup(0x900);
+			_voy.reviewComputerEvent(evtIndex);
+			
+			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+			_soundManager.stopVOCPlay();
+			_bVoy->getBoltGroup(0x900);
+			break;
 
-		warning("TODO");
+		default:
+			break;
+		}
 	}
 
 	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
-	_bVoy->freeBoltGroup(0x900);
 
 	(*_graphicsManager._vPort)->fillPic(0);
 	flipPageAndWait();
+	_bVoy->freeBoltGroup(0x900);
 }
 
 void VoyeurEngine::doGossip() {
@@ -835,6 +904,21 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 	_voy._field478 &= ~1;
 	
 	playAVideoDuration(_videoId, evt._computerOff);
+
+	_voy._field478 |= 1;
+	if (_eventsManager._videoDead != -1) {
+		_bVoy->freeBoltGroup(0xE00);
+		_eventsManager._videoDead = -1;
+		flipPageAndWait();
+		_eventsManager._videoDead = -1;
+	}
+
+	_videoId = -1;
+	if (_eventsManager._videoDead != -1) {
+		_bVoy->freeBoltGroup(0xE00);
+		_eventsManager._videoDead = -1;
+		flipPageAndWait();
+	}
 }
 
 int VoyeurEngine::getChooseButton()  {


Commit: 7f236696c960493469669ac0c02cab324ad2dd64
    https://github.com/scummvm/scummvm/commit/7f236696c960493469669ac0c02cab324ad2dd64
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T14:57:40-08:00

Commit Message:
VOYEUR: Minor fixes to reviewTape

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index deaa978..d79b6a0 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -72,6 +72,7 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_mouseButton = 0;
 	_fadeStatus = 0;
 	_priorFrameTime = g_system->getMillis();
+	_gameCounter = 0;
 	_joe = 0;
 	Common::fill(&_keyState[0], &_keyState[256], false);
 	Common::fill(&_cycleTime[0], &_cycleTime[4], 0);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index d57f9a6..fe53e26 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -433,11 +433,11 @@ void VoyeurEngine::reviewTape() {
 	if ((eventStart + _voy._eventCount) <= 7)
 		eventLine = eventStart + _voy._eventCount - 1;
 
-	_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
-	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
-
 	bool breakFlag = false;
 	while (!shouldQuit() && !breakFlag) {
+		_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
+		Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
+
 		_graphicsManager._backColors = _bVoy->boltEntry(0x902)._cMapResource;
 		_graphicsManager._backgroundPage = _bVoy->boltEntry(0x901)._picResource;
 		(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);


Commit: 00873d3124bb2011dda6bfc177ad38585ca9cebf
    https://github.com/scummvm/scummvm/commit/00873d3124bb2011dda6bfc177ad38585ca9cebf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-18T20:47:04-08:00

Commit Message:
VOYEUR: Fix for phone message playing every time apartment was shown

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 6cc747d..0b98a34 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -486,6 +486,9 @@ public:
 
 	static void init();
 private:
+	VoyeurEngine *_vm;
+	Common::Point _aptPos;
+private:
 	bool getStateInfo();
 	byte *getDataOffset();
 	void getButtonsText();
@@ -523,8 +526,6 @@ private:
 	 */
 	bool checkMansionScroll();
 public:
-	VoyeurEngine *_vm;
-
 	int _threadId;
 	int _controlIndex;
 	int _field4, _field6;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 850e6df..58ce373 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -41,6 +41,7 @@ ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
 	_flags = src[8];
 	_ctlPtr = nullptr;
+	_aptPos = Common::Point(-1, -1);
 }
 
 void ThreadResource::initThreadStruct(int idx, int id) {
@@ -1023,27 +1024,27 @@ bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
 int ThreadResource::doApt() {
 	loadTheApt();
 
-	Common::Point aptPos(-1, -1);
 	_vm->_currentVocId = 151;
 	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; 
 	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
 		_vm->_playStampGroupId + 1)._rectResource->_entries;
 	_vm->_eventsManager.getMouseInfo();
 
-	if (aptPos.x == -1) {
-		aptPos.x = hotspots[2].left;
-		aptPos.y = hotspots[2].top;
+	// Very first time apartment is shown, start the phone message
+	if (_aptPos.x == -1) {
+		_aptPos.x = hotspots[2].left;
+		_aptPos.y = hotspots[2].top;
 		_vm->_currentVocId = 153;
 	}
 
 	if (_vm->_voy._field470 == 16) {
 		hotspots[0].left = 999;
 		hotspots[3].left = 999;
-		aptPos.x = hotspots[4].left + 28;
-		aptPos.y = hotspots[4].top + 28;
+		_aptPos.x = hotspots[4].left + 28;
+		_aptPos.y = hotspots[4].top + 28;
 	}
 
-	_vm->_eventsManager.setMousePos(Common::Point(aptPos.x, aptPos.y));
+	_vm->_eventsManager.setMousePos(Common::Point(_aptPos.x, _aptPos.y));
 	_vm->_soundManager.startVOCPlay(_vm->_soundManager.getVOCFileName(_vm->_currentVocId));
 	_vm->_currentVocId = 151;
 
@@ -1112,8 +1113,8 @@ int ThreadResource::doApt() {
 	} while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();
-	aptPos.x = pt.x;
-	aptPos.y = pt.y;
+	_aptPos.x = pt.x;
+	_aptPos.y = pt.y;
 
 	switch (hotspotId) {
 	case 0:
@@ -1770,7 +1771,8 @@ void ThreadResource::doAptAnim(int mode) {
 }
 
 void ThreadResource::synchronize(Common::Serializer &s) {
-	warning("TODO: ThreadResource::synchronize");
+	s.syncAsSint16LE(_aptPos.x);
+	s.syncAsSint16LE(_aptPos.y);
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index b4e8f94..889b6fd 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -682,7 +682,7 @@ Common::Error VoyeurEngine::loadGameState(int slot) {
 
 void VoyeurEngine::loadGame(int slot) {
 	// Open up the save file
-	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
+	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(generateSaveName(slot));
 	if (!saveFile)
 		return;
 


Commit: f49a0e3a06822a0cc77d73f3cbd62de86dddca2d
    https://github.com/scummvm/scummvm/commit/f49a0e3a06822a0cc77d73f3cbd62de86dddca2d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-19T18:58:55-08:00

Commit Message:
VOYEUR: Some fixes for savegame loading

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 1e40ff7..77e3337 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -88,7 +88,12 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_vocSecondsOffset);
 	s.syncAsSint16LE(_field46E);
 	s.syncAsSint16LE(_field470);
-	s.syncAsSint16LE(_field472);
+	
+	s.syncAsSint16LE(_aptLoadMode);
+	if (s.isLoading())
+		// Reset apartment loading mode to initial game value
+		_aptLoadMode = 140;
+
 	s.syncAsSint16LE(_transitionId);
 	s.syncAsSint16LE(_RTVLimit);
 	s.syncAsSint16LE(_field478);
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 4fadf5b..53c6ebe 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -70,7 +70,7 @@ public:
 	int _vocSecondsOffset;
 	bool _field46E;
 	int _field470;
-	int _field472;
+	int _aptLoadMode;
 	int _transitionId;
 	int _RTVLimit;
 	int _field478;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 58ce373..fac44c7 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -734,31 +734,31 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 19:
-			_vm->_voy._field472 = 140;
+			_vm->_voy._aptLoadMode = 140;
 			loadTheApt();
-			_vm->_voy._field472 = 141;
+			_vm->_voy._aptLoadMode = 141;
 			freeTheApt();
 			break;
 
 		case 20:
-			_vm->_voy._field472 = -1;
+			_vm->_voy._aptLoadMode = -1;
 			loadTheApt();
-			_vm->_voy._field472 = 141;
+			_vm->_voy._aptLoadMode = 141;
 			freeTheApt();
 			break;
 
 		case 21:
-			_vm->_voy._field472 = -1;
+			_vm->_voy._aptLoadMode = -1;
 			loadTheApt();
-			_vm->_voy._field472 = 140;
+			_vm->_voy._aptLoadMode = 140;
 			freeTheApt();
 			break;
 
 		case 23:
 			_vm->_voy._transitionId = 17;
-			_vm->_voy._field472 = -1;
+			_vm->_voy._aptLoadMode = -1;
 			loadTheApt();
-			_vm->_voy._field472 = 144;
+			_vm->_voy._aptLoadMode = 144;
 			freeTheApt();
 			break;
 
@@ -1118,18 +1118,18 @@ int ThreadResource::doApt() {
 
 	switch (hotspotId) {
 	case 0:
-		_vm->_voy._field472 = 140;
+		_vm->_voy._aptLoadMode = 140;
 		break;
 	case 1:
-		_vm->_voy._field472 = 143;
+		_vm->_voy._aptLoadMode = 143;
 		break;
 	case 2:
-		_vm->_voy._field472 = 142;
+		_vm->_voy._aptLoadMode = 142;
 	case 5:
-		_vm->_voy._field472 = 141;
+		_vm->_voy._aptLoadMode = 141;
 		break;
 	default:
-		_vm->_voy._field472 = -1;
+		_vm->_voy._aptLoadMode = -1;
 		break;
 	}
 
@@ -1650,13 +1650,13 @@ void ThreadResource::loadTheApt() {
 		break;
 	}
 
-	if (_vm->_voy._field472 == 143)
-		_vm->_voy._field472 = -1;
+	if (_vm->_voy._aptLoadMode == 143)
+		_vm->_voy._aptLoadMode = -1;
 
-	if (_vm->_voy._field472  != -1) {
+	if (_vm->_voy._aptLoadMode  != -1) {
 		doAptAnim(1);
 		_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId);
-		_vm->_voy._field472 = -1;
+		_vm->_voy._aptLoadMode = -1;
 		_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
 			_vm->_playStampGroupId + 5)._picResource;
 		(*_vm->_graphicsManager._vPort)->setupViewPort(
@@ -1686,13 +1686,13 @@ void ThreadResource::freeTheApt() {
 		_vm->_currentVocId = -1;
 	}
 
-	if (_vm->_voy._field472 == -1) {
+	if (_vm->_voy._aptLoadMode == -1) {
 		_vm->_graphicsManager.fadeDownICF(6);
 	} else {
 		doAptAnim(2);
 	}
 
-	if (_vm->_voy._field472 == 140) {
+	if (_vm->_voy._aptLoadMode == 140) {
 		_vm->_graphicsManager.screenReset();
 		_vm->_graphicsManager.resetPalette();
 	}
@@ -1708,7 +1708,7 @@ void ThreadResource::doAptAnim(int mode) {
 
 	// Figure out the resource to use
 	int id = 0;
-	switch (_vm->_voy._field472) {
+	switch (_vm->_voy._aptLoadMode) {
 	case 140:
 		id = 0x5A00;
 		break;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 889b6fd..06617be 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -123,7 +123,7 @@ void VoyeurEngine::globalInitBolt() {
 	_voy._field478 = 1;
 	_voy._field4376 = _voy._field4378 = 127;
 	_voy._field4F2 = 9999;
-	_voy._field472 = -1;
+	_voy._aptLoadMode = -1;
 	_voy._field478 = 256;
 	
 	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
@@ -204,7 +204,7 @@ bool VoyeurEngine::doHeadTitle() {
 		} 
 	}
 
-	_voy._field472 = 140;
+	_voy._aptLoadMode = 140;
 	return true;
 }
 
@@ -687,8 +687,13 @@ void VoyeurEngine::loadGame(int slot) {
 		return;
 
 	Common::Serializer serializer(saveFile, NULL);
+
+	// Store the current time index before the game is loaded
 	_checkTransitionId = _voy._transitionId;
 
+	// Stop any playing sound
+	_soundManager.stopVOCPlay();
+
 	// Read in the savegame header
 	VoyeurSavegameHeader header;
 	if (!header.read(saveFile))
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index fe53e26..9863695 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -62,19 +62,19 @@ void VoyeurEngine::playStamp() {
 			if (buttonId == -2) {
 				switch (_mainThread->doApt()) {
 				case 0:
-					_voy._field472 = 140;
+					_voy._aptLoadMode = 140;
 					break;
 				case 1:
 					_voy._field478 &= ~1;
 					_voy._field46E = true;
 					_mainThread->chooseSTAMPButton(22);
-					_voy._field472 = 143;
+					_voy._aptLoadMode = 143;
 					break;
 				case 2:
 					_voy._field478 &= ~1;
 					reviewTape();
 					_voy._field46E = true;
-					_voy._field472 = 142;
+					_voy._aptLoadMode = 142;
 					break;
 				case 3:
 					_voy._field478 &= ~1;
@@ -86,7 +86,7 @@ void VoyeurEngine::playStamp() {
 				case 5:
 					doGossip();
 					_voy._field46E = true;
-					_voy._field472 = 141;
+					_voy._aptLoadMode = 141;
 					_voy._field478 &= ~0x100;
 					break;
 				default:


Commit: 758e35e79bf1c2a70bc0b17b06573e5a776285a2
    https://github.com/scummvm/scummvm/commit/758e35e79bf1c2a70bc0b17b06573e5a776285a2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-19T19:46:33-08:00

Commit Message:
VOYEUR: Further savegame loading fixes

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 77e3337..3227e3c 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -88,12 +88,7 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_vocSecondsOffset);
 	s.syncAsSint16LE(_field46E);
 	s.syncAsSint16LE(_field470);
-	
 	s.syncAsSint16LE(_aptLoadMode);
-	if (s.isLoading())
-		// Reset apartment loading mode to initial game value
-		_aptLoadMode = 140;
-
 	s.syncAsSint16LE(_transitionId);
 	s.syncAsSint16LE(_RTVLimit);
 	s.syncAsSint16LE(_field478);
@@ -120,6 +115,12 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_field4380);
 	s.syncAsSint16LE(_field4382);
 	s.syncAsSint16LE(_videoEventId);
+
+	if (s.isLoading()) {
+		// Reset apartment loading mode to initial game value
+		_aptLoadMode = 140;
+		_viewBounds = nullptr;
+	}
 }
 
 void SVoy::addVideoEventStart() {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 06617be..d5de47d 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -702,7 +702,6 @@ void VoyeurEngine::loadGame(int slot) {
 		header._thumbnail->free();
 	delete header._thumbnail;
 
-	serializer.syncVersion(header._version);
 	synchronize(serializer);
 
 	delete saveFile;
@@ -749,7 +748,6 @@ void VoyeurEngine::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_videoId);
 
 	s.syncAsSint16LE(_iForceDeath);
-	s.syncAsSint16LE(_checkTransitionId);
 	s.syncAsSint16LE(_gameHour);
 	s.syncAsSint16LE(_gameMinute);
 	s.syncAsSint16LE(_flashTimeVal);


Commit: 0e68c9ac5985e640be1ada6ce8c11ee0b9f6c57e
    https://github.com/scummvm/scummvm/commit/0e68c9ac5985e640be1ada6ce8c11ee0b9f6c57e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-19T20:00:18-08:00

Commit Message:
VOYEUR: Fix for SVoy data initialization

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 3227e3c..9104d5f 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -38,6 +38,11 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {
 
 /*------------------------------------------------------------------------*/
 
+SVoy::SVoy() {
+	// Initialise all the data fields of SVoy to empty values
+	Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0);
+}
+
 void SVoy::setVm(VoyeurEngine *vm) {
 	_vm = vm;
 }
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 53c6ebe..e33c3c7 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -112,6 +112,7 @@ public:
 	int _fadeICF0;
 	int _policeEvent;
 public:
+	SVoy();
 	void setVm(VoyeurEngine *vm);
 
 	/**
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index d5de47d..72f568b 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -119,7 +119,6 @@ void VoyeurEngine::globalInitBolt() {
 	assert(_graphicsManager._fontPtr->_curFont);
 
 	// Setup default flags
-	Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
 	_voy._field478 = 1;
 	_voy._field4376 = _voy._field4378 = 127;
 	_voy._field4F2 = 9999;


Commit: a662be53699ee7b8ee91fde4682986b95063ba90
    https://github.com/scummvm/scummvm/commit/a662be53699ee7b8ee91fde4682986b95063ba90
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-20T14:11:23-08:00

Commit Message:
VOYEUR: Fix palette issues in first half of doGossip

Changed paths:
    engines/voyeur/animation.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 0d4d842..3278e4f 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -439,7 +439,7 @@ void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset, byte *frames,
 	while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager._mouseClicked) {
 		if (hasDirtyPalette()) {
 			const byte *palette = getPalette();
-			vm->_graphicsManager.setPalette(palette, 128, 128);
+			vm->_graphicsManager.setPalette(palette + 3, 129, 127);
 		}
 		
 		if (needsUpdate()) {


Commit: 3fc2a80be61717e4a40bdd9f7623ecb6d70293d7
    https://github.com/scummvm/scummvm/commit/3fc2a80be61717e4a40bdd9f7623ecb6d70293d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-20T15:31:50-08:00

Commit Message:
VOYEUR: Fix palette issues in second half of doGossip

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 3278e4f..7c0d21a 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -32,6 +32,7 @@
 namespace Video {
 
 RL2Decoder::RL2Decoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
+	_paletteStart = 0;
 }
 
 RL2Decoder::~RL2Decoder() {
@@ -44,11 +45,18 @@ bool RL2Decoder::loadVideo(int videoId) {
 	return loadFile(filename);
 }
 
+bool RL2Decoder::loadFile(const Common::String &file, bool palFlag) {
+	bool result = VideoDecoder::loadFile(file);
+	_paletteStart = palFlag ? 0 : 128;
+	return result;
+}
+
 bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	close();
 
 	// Load basic file information
 	_header.load(stream);
+	_paletteStart = 0;
 
 	// Check RL2 magic number
 	if (!_header.isValid()) {
@@ -431,15 +439,19 @@ Audio::QueuingAudioStream *RL2Decoder::RL2AudioTrack::createAudioStream() {
 
 namespace Voyeur {
 
-void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset, byte *frames, byte *imgPos) {
+void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset, 
+		byte *frames, byte *imgPos) {
 	vm->flipPageAndWait();
+	int paletteStart = getPaletteStart();
+	int paletteCount = getPaletteCount();
 
 	PictureResource videoFrame(getVideoTrack()->getBackSurface());
 	int picCtr = 0;
 	while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager._mouseClicked) {
 		if (hasDirtyPalette()) {
 			const byte *palette = getPalette();
-			vm->_graphicsManager.setPalette(palette + 3, 129, 127);
+
+			vm->_graphicsManager.setPalette128(palette, paletteStart, paletteCount);
 		}
 		
 		if (needsUpdate()) {
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index b164888..d5e1f9f 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -146,17 +146,20 @@ private:
 private:
 	Audio::Mixer::SoundType _soundType;
 	RL2FileHeader _header;
+	int _paletteStart;
 public:
 	RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
 	virtual ~RL2Decoder();
 
 	bool loadStream(Common::SeekableReadStream *stream);
+	bool loadFile(const Common::String &file, bool palFlag = false);
 	bool loadVideo(int videoId);
 
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 	RL2VideoTrack *getVideoTrack();
+	int getPaletteStart() const { return _paletteStart; }
 	int getPaletteCount() const { return _header._colorCount; }
 };
 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 4dd4c67..bea3227 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -654,6 +654,14 @@ void GraphicsManager::setPalette(const byte *palette, int start, int count) {
 	g_system->getPaletteManager()->setPalette(palette, start, count);
 }
 
+void GraphicsManager::setPalette128(const byte *palette, int start, int count) {
+	byte rgb[3];
+	g_system->getPaletteManager()->grabPalette(&rgb[0], 128, 1);
+	g_system->getPaletteManager()->setPalette(palette, start, count);
+	g_system->getPaletteManager()->setPalette(&rgb[0], 128, 1);
+}
+
+
 void GraphicsManager::resetPalette() {
 	for (int i = 0; i < 256; ++i)
 		setColor(i, 0, 0, 0);
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 6205499..5ba08ed 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -110,6 +110,7 @@ public:
 	void flipPage();
 	void clearPalette();
 	void setPalette(const byte *palette, int start, int count);
+	void setPalette128(const byte *palette, int start, int count);
 	void resetPalette();
 	void setColor(int idx, byte r, byte g, byte b);
 	void setOneColor(int idx, byte r, byte g, byte b);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 9863695..030835c 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -743,7 +743,7 @@ void VoyeurEngine::doGossip() {
 
 	// Load the gossip animation
 	VoyeurRL2Decoder decoder;
-	decoder.loadFile("a2050100.rl2");
+	decoder.loadFile("a2050100.rl2", false);
 	decoder.start();
 
 	// Get the resource data for the first gossip video
@@ -762,8 +762,12 @@ void VoyeurEngine::doGossip() {
 	// Play the initial gossip video
 	decoder.play(this, 0x302, frameNumsP, posP);
 
+	// Reset the palette and clear the screen
+	_graphicsManager.resetPalette();
+	_graphicsManager.screenReset();
+
 	// Play interview video
-	decoder.loadFile("a2110100.rl2");
+	decoder.loadFile("a2110100.rl2", true);
 	decoder.start();
 
 	_eventsManager.getMouseInfo();


Commit: b247d8d0a739232820b10d4cf625f2c4b68116ca
    https://github.com/scummvm/scummvm/commit/b247d8d0a739232820b10d4cf625f2c4b68116ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-20T19:59:13-08:00

Commit Message:
VOYEUR: Fix for aborting out of sending someoneo the tape

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index fac44c7..7cd5e6e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -39,6 +39,10 @@ void ThreadResource::init() {
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
+	_threadId = READ_LE_UINT16(&src[0]);
+	_controlIndex = READ_LE_UINT16(&src[0]);
+	_field4 = READ_LE_UINT16(&src[0]);
+	_field6 = READ_LE_UINT16(&src[0]);
 	_flags = src[8];
 	_ctlPtr = nullptr;
 	_aptPos = Common::Point(-1, -1);
@@ -71,6 +75,7 @@ bool ThreadResource::loadAStack(int idx) {
 	}
 
 	_ctlPtr = _vm->_controlPtr->_entries[idx];
+	_controlIndex = idx;
 	return true;
 }
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 33e924a..bdbf3c1 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -138,6 +138,11 @@ private:
 	bool checkForIncriminate();
 
 	void playAVideoEvent(int eventIndex);
+
+	/**
+	 * Shows the user a screen to select one of four characters to send the
+	 * video tape to
+	 */
 	int getChooseButton();
 
 	/**
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 030835c..e523917 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -155,11 +155,10 @@ void VoyeurEngine::playStamp() {
 				_playStampGroupId = -1;
 				flag = true;
 
-				if (buttonId == 4) {
+				if (buttonId != 4) {
 					_voy._field470 = 131;
 					_eventsManager.checkForKey();
 					_mainThread->chooseSTAMPButton(buttonId);
-					flag = true;
 				} else {
 					_mainThread->chooseSTAMPButton(buttonId);
 					_voy._field46E = true;


Commit: 3e12562654d1b94365c695bbf6585af63ad71a4c
    https://github.com/scummvm/scummvm/commit/3e12562654d1b94365c695bbf6585af63ad71a4c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-21T18:04:13-08:00

Commit Message:
VOYEUR: Renaming of thread data pointers

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 0b98a34..edc5ee5 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -533,19 +533,19 @@ public:
 	int _field9;
 	int _fieldA[8];
 	int _field2A[8];
-	int _field3A;
-	int _field3E;
-	int _field40;
-	int _field42;
+	int _newSceneId;
+	int _newStackId;
+	int _stateFlags;
+	int _stateCount;
 	int _parseCount;
 	uint32 _field46;
-	byte *_field4A;
+	byte *_threadInfoPtr;
 	byte _buttonFlags[64];
 	const byte *_field8E[64];
 	byte _field18E[64];
 	const byte *_field1CE[48];
 	byte *_ctlPtr;
-	byte *_field28E;
+	byte *_playCommandsPtr;
 public:
 	ThreadResource(BoltFilesState &state, const byte *src);
 	virtual ~ThreadResource() {}
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 7cd5e6e..6ce7729 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -53,8 +53,8 @@ void ThreadResource::initThreadStruct(int idx, int id) {
 	if (loadAStack(idx)) {
 		_field4 = _field6 = -1;
 		_threadId = id;
-		_field3A = -1;
-		_field3E = -1;
+		_newSceneId = -1;
+		_newStackId = -1;
 
 		doState();
 	}
@@ -100,8 +100,8 @@ bool ThreadResource::doState() {
 	_vm->_glGoStack = -1;
 
 	performOpenCard();
-	if (_field40 & 1) {
-		return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1));
+	if (_stateFlags & 1) {
+		return chooseSTAMPButton(_vm->getRandomNumber(_stateCount - 1));
 	} else {
 		return true;
 	}
@@ -121,14 +121,14 @@ bool ThreadResource::getStateInfo() {
 		
 		fld = READ_LE_UINT32(_ctlPtr + fld);
 		byte *baseP = _ctlPtr + fld;
-		_field42 = READ_LE_UINT16(baseP);
-		_field40 = READ_LE_UINT16(baseP + 2);
+		_stateCount = READ_LE_UINT16(baseP);
+		_stateFlags = READ_LE_UINT16(baseP + 2);
 		_parseCount = READ_LE_UINT16(baseP + 4);
 
-		_field28E = getDataOffset();
-		_field28E += (READ_LE_UINT32(baseP + 6) / 2) << 1;
+		_playCommandsPtr = getDataOffset();
+		_playCommandsPtr += (READ_LE_UINT32(baseP + 6) / 2) << 1;
 
-		_field4A = baseP + 10;
+		_threadInfoPtr = baseP + 10;
 		
 		getButtonsText();
 		return true;
@@ -144,7 +144,7 @@ byte *ThreadResource::getDataOffset() {
 void ThreadResource::getButtonsText() {
 	int idx = 0;
 	
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) {
 		if (*p == 0xC0) {
 			++p;
 			if (*p++ & 0x80) {
@@ -162,10 +162,10 @@ void ThreadResource::getButtonsText() {
 void ThreadResource::getButtonsFlags() {
 	int idx = 0;
 	
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) {
 		if (*p == 0xC0) {
 			if (*++p & 0x20)
-				_field40 |= 2;
+				_stateFlags |= 2;
 
 			_buttonFlags[idx] = *p++;
 			_field18E[idx] = *p++;
@@ -181,7 +181,7 @@ void ThreadResource::getButtonsFlags() {
 void ThreadResource::getField1CE() {
 	int idx = 0;
 	
-	for (const byte *p = _field4A; *p++ != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _threadInfoPtr; *p++ != 0x49; p = getNextRecord(p)) {
 		assert(idx < 47);
 		_field1CE[idx++] = getRecordOffset(p);
 		_field1CE[idx] = NULL;
@@ -199,7 +199,7 @@ void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
 }
 
 void ThreadResource::performOpenCard() {
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) {
 		if (*p == 0x47) {
 			cardAction(p + 1);
 			return;
@@ -265,7 +265,7 @@ const byte *ThreadResource::getSTAMPCard(int cardId) {
 	const byte *p;
 	int count = 0;
 
-	for (p = _field4A; count <= cardId && *p != 0x49; p = getNextRecord(p)) {
+	for (p = _threadInfoPtr; count <= cardId && *p != 0x49; p = getNextRecord(p)) {
 		if (*p == 0xC0)
 			++count;
 	}
@@ -291,7 +291,7 @@ uint32 ThreadResource::getSID(int sid) {
 }
 
 void ThreadResource::doSTAMPCardAction() {
-	for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _threadInfoPtr; *p != 0x49; p = getNextRecord(p)) {
 		if (*p == 0x48) {
 			cardAction(p + 1);
 			return;
@@ -312,7 +312,7 @@ void ThreadResource::cardAction(const byte *card) {
 bool ThreadResource::chooseSTAMPButton(int buttonId) {
 	_flags &= ~1;
 
-	for (int idx = 0; idx < _field42; ++idx) {
+	for (int idx = 0; idx < _stateCount; ++idx) {
 		if (_field18E[idx] == buttonId) {
 			const byte *card = getSTAMPCard(idx);
 			cardAction(card);
@@ -352,7 +352,7 @@ void ThreadResource::parsePlayCommands() {
 	Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0);
 	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
 
-	byte *dataP = _field28E;
+	byte *dataP = _playCommandsPtr;
 	int v2, v3;
 	PictureResource *pic;
 	CMapResource *pal;
@@ -456,7 +456,7 @@ void ThreadResource::parsePlayCommands() {
 					}
 
 					_vm->_eventsManager._videoDead = -1;
-					if (_field42 == 2 && _vm->_eventsManager._mouseClicked == 0) {
+					if (_stateCount == 2 && _vm->_eventsManager._mouseClicked == 0) {
 						_vm->_voy._field470 = 132;
 						parseIndex = 999;
 					} else {
@@ -953,15 +953,15 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		card += 2;
 	
 	case 45:
-		_field3A = _field46;
-		_field3E = _controlIndex;
+		_newSceneId = _field46;
+		_newStackId = _controlIndex;
 		break;
 
 	case 46:
-		_vm->_glGoScene = _field3A;
-		_vm->_glGoStack = _field3E;
-		_field3A = -1;
-		_field3E = -1;
+		_vm->_glGoScene = _newSceneId;
+		_vm->_glGoStack = _newStackId;
+		_newSceneId = -1;
+		_newStackId = -1;
 		break;
 
 	case 51:
@@ -1257,8 +1257,7 @@ void ThreadResource::doRoom() {
 				_vm->flipPageAndWait();
 
 				if (vm._currentVocId != -1) {
-					voy._vocSecondsOffset = voy._RTVNum - 
-						voy._field4AC;
+					voy._vocSecondsOffset = voy._RTVNum - voy._field4AC;
 					vm._soundManager.stopVOCPlay();
 				}
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index e523917..95c6deb 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -193,7 +193,7 @@ void VoyeurEngine::playStamp() {
 				// Break out of loop
 				flag = false;
 
-			} else if (_mainThread->_field40 & 2) {
+			} else if (_mainThread->_stateFlags & 2) {
 				_eventsManager.getMouseInfo();
 				_mainThread->chooseSTAMPButton(0);
 				flag = true;


Commit: 0f9cfc373f8d6e0097a9558abed25be8dcd938fc
    https://github.com/scummvm/scummvm/commit/0f9cfc373f8d6e0097a9558abed25be8dcd938fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-25T11:31:06-08:00

Commit Message:
VOYEUR: Refactored RL2 decoder to better load audio on the fly

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 7c0d21a..af4c989 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -31,8 +31,13 @@
 
 namespace Video {
 
+// Number of audio frames to keep audio track topped up when playing back video
+#define SOUND_FRAMES_READAHEAD 3
+
 RL2Decoder::RL2Decoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
 	_paletteStart = 0;
+	_fileStream = nullptr;
+	_soundFrameNumber = -1;
 }
 
 RL2Decoder::~RL2Decoder() {
@@ -55,6 +60,7 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	close();
 
 	// Load basic file information
+	_fileStream = stream;
 	_header.load(stream);
 	_paletteStart = 0;
 
@@ -74,6 +80,15 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	// Create a video track
 	addTrack(new RL2VideoTrack(_header, audioTrack, stream));
 
+	// Load the offset/sizes of the video's audio data
+	//_soundFrames.reserve(header._numFrames);
+	for (int frameNumber = 0; frameNumber < _header._numFrames; ++frameNumber) {
+		int offset = _header._frameOffsets[frameNumber];
+		int size = _header._frameSoundSizes[frameNumber];
+
+		_soundFrames.push_back(SoundFrame(offset, size));
+	}
+
 	return true;
 }
 
@@ -107,6 +122,43 @@ RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
 	return (RL2VideoTrack *)track;
 }
 
+RL2Decoder::RL2AudioTrack *RL2Decoder::getAudioTrack() {
+	Track *track = getTrack(0);
+	assert(track);
+
+	return (RL2AudioTrack *)track;
+}
+
+void RL2Decoder::readNextPacket() {
+	int frameNumber = getCurFrame();
+	RL2AudioTrack *audioTrack = getAudioTrack();
+
+	// Handle queueing sound data
+	if (_soundFrameNumber == -1)
+		_soundFrameNumber = frameNumber;
+
+	while (audioTrack->numQueuedStreams() < SOUND_FRAMES_READAHEAD && 
+			(_soundFrameNumber < (int)_soundFrames.size())) {
+		_fileStream->seek(_soundFrames[_soundFrameNumber]._offset);
+		audioTrack->queueSound(_fileStream, _soundFrames[_soundFrameNumber]._size);
+		++_soundFrameNumber;
+	}
+}
+
+void RL2Decoder::close() {
+	VideoDecoder::close();
+	delete _fileStream;
+	_fileStream = nullptr;
+	_soundFrameNumber = -1;
+}
+
+/*------------------------------------------------------------------------*/
+
+RL2Decoder::SoundFrame::SoundFrame(int offset, int size) {
+	_offset = offset;
+	_size = size;
+}
+
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2FileHeader::RL2FileHeader() {
@@ -173,6 +225,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 	int fps = (header._soundRate > 0) ? header._rate / header._defSoundSize : 11025 / 1103;
 	_frameDelay = 1000 / fps;
 
+	// Set up surfaces
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 
@@ -190,9 +243,6 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 }
 
 RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
-	// Free the file stream
-	delete _fileStream;
-
 	// Free surfaces
 	_surface->free();
 	delete _surface;
@@ -386,22 +436,8 @@ Graphics::Surface *RL2Decoder::RL2VideoTrack::getBackSurface() {
 
 RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType): 
 		_header(header), _soundType(soundType) {
-	_audStream = createAudioStream();
-
-	// Add all the sound data for all the frames at once to avoid stuttering
-	for (int frameNumber = 0; frameNumber < header._numFrames; ++frameNumber) {
-		int offset = _header._frameOffsets[frameNumber];
-		int size = _header._frameSoundSizes[frameNumber];
-
-		byte *data = (byte *)malloc(size);
-		stream->seek(offset);
-		stream->read(data, size);
-		Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
-			DisposeAfterUse::YES);
-
-		_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
-			Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
-	}
+	// Create audio straem for the audio track
+	_audStream = Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2);
 }
 
 RL2Decoder::RL2AudioTrack::~RL2AudioTrack() {
@@ -409,30 +445,20 @@ RL2Decoder::RL2AudioTrack::~RL2AudioTrack() {
 }
 
 void RL2Decoder::RL2AudioTrack::queueSound(Common::SeekableReadStream *stream, int size) {
-	if (_audStream) {
-		// Queue the sound data
-		byte *data = (byte *)malloc(size);
-		stream->read(data, size);
-		Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
-			DisposeAfterUse::YES);
-
-		_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
-			Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
-		//		_audioTrack->queueSound(_fileStream, _header._frameSoundSizes[_curFrame]);
+	// Queue the sound data
+	byte *data = (byte *)malloc(size);
+	stream->read(data, size);
+	Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size,
+		DisposeAfterUse::YES);
 
-	} else {
-		delete stream;
-	}
+	_audStream->queueAudioStream(Audio::makeRawStream(memoryStream, _header._rate, 
+		Audio::FLAG_UNSIGNED, DisposeAfterUse::YES), DisposeAfterUse::YES);
 }
 
 Audio::AudioStream *RL2Decoder::RL2AudioTrack::getAudioStream() const {
 	return _audStream;
 }
 
-Audio::QueuingAudioStream *RL2Decoder::RL2AudioTrack::createAudioStream() {
-	return Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2);
-}
-
 } // End of namespace Video
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index d5e1f9f..0caac9f 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -26,6 +26,7 @@
 #include "video/video_decoder.h"
 #include "audio/audiostream.h"
 #include "audio/mixer.h"
+#include "common/array.h"
 #include "common/list.h"
 #include "common/rect.h"
 #include "common/stream.h"
@@ -73,24 +74,30 @@ private:
 		bool isValid() const;
 	};
 
+	class SoundFrame {
+	public:
+		int _offset;
+		int _size;
+
+		SoundFrame(int  offset, int size);
+	};
+
 	class RL2AudioTrack : public AudioTrack {
+	private:
+		Audio::Mixer::SoundType _soundType;
+		const RL2FileHeader &_header;
+		Audio::QueuingAudioStream *_audStream;
+	protected:
+		Audio::AudioStream *getAudioStream() const;
 	public:
 		RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream,
 			Audio::Mixer::SoundType soundType);
 		~RL2AudioTrack();
 
-		void queueSound(Common::SeekableReadStream *stream, int size);
 		Audio::Mixer::SoundType getSoundType() const { return _soundType; }
+		int numQueuedStreams() const { return _audStream->numQueuedStreams(); }
 
-	protected:
-		Audio::AudioStream *getAudioStream() const;
-
-	private:
-		Audio::Mixer::SoundType _soundType;
-		const RL2FileHeader &_header;
-
-		Audio::QueuingAudioStream *_audStream;
-		Audio::QueuingAudioStream *createAudioStream();
+		void queueSound(Common::SeekableReadStream *stream, int size);
 	};
 
 	class RL2VideoTrack : public VideoTrack {
@@ -144,9 +151,12 @@ private:
 	};
 
 private:
+	Common::SeekableReadStream *_fileStream;
 	Audio::Mixer::SoundType _soundType;
 	RL2FileHeader _header;
 	int _paletteStart;
+	Common::Array<SoundFrame> _soundFrames;
+	int _soundFrameNumber;
 public:
 	RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
 	virtual ~RL2Decoder();
@@ -155,10 +165,14 @@ public:
 	bool loadFile(const Common::String &file, bool palFlag = false);
 	bool loadVideo(int videoId);
 
+	virtual void readNextPacket();
+	virtual void close();
+
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 	RL2VideoTrack *getVideoTrack();
+	RL2AudioTrack *getAudioTrack();
 	int getPaletteStart() const { return _paletteStart; }
 	int getPaletteCount() const { return _header._colorCount; }
 };


Commit: ee26919e9074b46155e5a8013f623c6b892779df
    https://github.com/scummvm/scummvm/commit/ee26919e9074b46155e5a8013f623c6b892779df
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-25T15:46:26-08:00

Commit Message:
VOYEUR: Simply RL2 video decoder, and add proper seeking support

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index af4c989..f1126e5 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -81,7 +81,7 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	addTrack(new RL2VideoTrack(_header, audioTrack, stream));
 
 	// Load the offset/sizes of the video's audio data
-	//_soundFrames.reserve(header._numFrames);
+	_soundFrames.reserve(_header._numFrames);
 	for (int frameNumber = 0; frameNumber < _header._numFrames; ++frameNumber) {
 		int offset = _header._frameOffsets[frameNumber];
 		int size = _header._frameSoundSizes[frameNumber];
@@ -145,6 +145,15 @@ void RL2Decoder::readNextPacket() {
 	}
 }
 
+bool RL2Decoder::seek(const Audio::Timestamp &where) {
+	// TODO: Ideally, I need a way to clear the audio track's QueuingAudioStream when
+	// a seek is done. Otherwise, as current, seeking can only be done correctly when
+	// the video is first loaded.
+
+	_soundFrameNumber = -1;
+	return VideoDecoder::seek(where);
+}
+
 void RL2Decoder::close() {
 	VideoDecoder::close();
 	delete _fileStream;
@@ -215,16 +224,16 @@ bool RL2Decoder::RL2FileHeader::isValid() const {
 	return _signature == MKTAG('R','L','V','2') || _signature != MKTAG('R','L','V','3');
 }
 
+double RL2Decoder::RL2FileHeader::getFrameRate() const {
+	return (_soundRate > 0) ? _rate / _defSoundSize : 11025 / 1103;
+}
+
 /*------------------------------------------------------------------------*/
 
 RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack, 
 		Common::SeekableReadStream *stream): 
 		_header(header), _audioTrack(audioTrack), _fileStream(stream) {
 
-	// Calculate the frame rate
-	int fps = (header._soundRate > 0) ? header._rate / header._defSoundSize : 11025 / 1103;
-	_frameDelay = 1000 / fps;
-
 	// Set up surfaces
 	_surface = new Graphics::Surface();
 	_surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
@@ -239,7 +248,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 	_dirtyPalette = header._colorCount > 0;
 
 	_curFrame = 0;
-	_nextFrameStartTime = 0;
+	_initialFrame = true;
 }
 
 RL2Decoder::RL2VideoTrack::~RL2VideoTrack() {
@@ -261,10 +270,13 @@ bool RL2Decoder::RL2VideoTrack::endOfTrack() const {
 	return getCurFrame() >= getFrameCount();
 }
 
-bool RL2Decoder::RL2VideoTrack::rewind() {
-	_curFrame = 0;
-	_nextFrameStartTime = 0;
+bool RL2Decoder::RL2VideoTrack::seek(const Audio::Timestamp &time) {
+	int frame = time.totalNumberOfFrames();
+
+	if (frame < 0 || frame >= _header._numFrames)
+		return false;
 
+	_curFrame = frame;
 	return true;
 }
 
@@ -281,7 +293,7 @@ Graphics::PixelFormat RL2Decoder::RL2VideoTrack::getPixelFormat() const {
 }
 
 const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
-	if (_curFrame == 0 && _hasBackFrame) {
+	if (_initialFrame && _hasBackFrame) {
 		// Read in the initial background frame
 		_fileStream->seek(0x324);
 		rl2DecodeFrameWithoutTransparency(0);
@@ -289,6 +301,7 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 		Common::copy((byte *)_surface->getPixels(), (byte *)_surface->getPixels() + (320 * 200), 
 			(byte *)_backSurface->getPixels());
 		_dirtyRects.push_back(Common::Rect(0, 0, _surface->w, _surface->h));
+		_initialFrame = false;
 	}
 
 	// Move to the next frame data
@@ -306,7 +319,6 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 	}
 
 	_curFrame++;
-	_nextFrameStartTime += _frameDelay;
 
 	return _surface;
 }
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 0caac9f..bfa9c8c 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -26,6 +26,7 @@
 #include "video/video_decoder.h"
 #include "audio/audiostream.h"
 #include "audio/mixer.h"
+#include "audio/timestamp.h"
 #include "common/array.h"
 #include "common/list.h"
 #include "common/rect.h"
@@ -72,6 +73,7 @@ private:
 		~RL2FileHeader();
 		void load(Common::SeekableReadStream *stream);
 		bool isValid() const;
+		double getFrameRate() const;
 	};
 
 	class SoundFrame {
@@ -96,19 +98,19 @@ private:
 
 		Audio::Mixer::SoundType getSoundType() const { return _soundType; }
 		int numQueuedStreams() const { return _audStream->numQueuedStreams(); }
+		virtual bool isSeekable() const { return true; }
+		virtual bool seek(const Audio::Timestamp &time) { return true; }
 
 		void queueSound(Common::SeekableReadStream *stream, int size);
 	};
 
-	class RL2VideoTrack : public VideoTrack {
+	class RL2VideoTrack : public FixedRateVideoTrack {
 	public:
 		RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack, 
 			Common::SeekableReadStream *stream);
 		~RL2VideoTrack();
 
 		bool endOfTrack() const;
-		bool isRewindable() const { return true; }
-		bool rewind();
 
 		uint16 getWidth() const;
 		uint16 getHeight() const;
@@ -117,7 +119,6 @@ private:
 		Graphics::PixelFormat getPixelFormat() const;
 		int getCurFrame() const { return _curFrame; }
 		int getFrameCount() const { return _header._numFrames; }
-		uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
 		const Graphics::Surface *decodeNextFrame();
 		const byte *getPalette() const { _dirtyPalette = false; return _header._palette; }
 		int getPaletteCount() const { return _header._colorCount; }
@@ -126,6 +127,9 @@ private:
 		void clearDirtyRects() { _dirtyRects.clear(); }
 		void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
 
+		virtual Common::Rational getFrameRate() const { return _header.getFrameRate(); }
+		virtual bool isSeekable() const { return true; }
+		virtual bool seek(const Audio::Timestamp &time);
 	private:
 		Common::SeekableReadStream *_fileStream;
 		const RL2FileHeader &_header;
@@ -136,11 +140,10 @@ private:
 
 		mutable bool _dirtyPalette;
 
+		bool _initialFrame;
 		int _curFrame;
 		uint32 _videoBase;
 		uint32 *_frameOffsets;
-		uint32 _frameDelay;
-		uint32 _nextFrameStartTime;
 
 		Common::List<Common::Rect> _dirtyRects;
 
@@ -167,6 +170,7 @@ public:
 
 	virtual void readNextPacket();
 	virtual void close();
+	virtual bool seek(const Audio::Timestamp &where);
 
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();
@@ -175,6 +179,7 @@ public:
 	RL2AudioTrack *getAudioTrack();
 	int getPaletteStart() const { return _paletteStart; }
 	int getPaletteCount() const { return _header._colorCount; }
+	const RL2FileHeader &getHeader() { return _header; }
 };
 
 } // End of namespace Video
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 72f568b..490d35e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -558,7 +558,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	decoder.loadVideo(videoId);
 
 	decoder.start();
-	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
+	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000, decoder.getHeader().getFrameRate()));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked &&


Commit: d2e8a6bed53c58ac3c9100dee399585c781fe9fb
    https://github.com/scummvm/scummvm/commit/d2e8a6bed53c58ac3c9100dee399585c781fe9fb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-26T15:13:44-08:00

Commit Message:
VOYEUR: Implemented lots more sDrawPic logic

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/staticres.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index edc5ee5..cc30d0a 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -279,8 +279,10 @@ public:
 
 /* bvoy.blt resource types */
 
-enum PictureFlag { PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10, PICFLAG_20 = 0x20, 
-	PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_CLEAR_SCREEN00 = 0x1000 };
+enum PictureFlag { PICFLAG_2 = 2, PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10, 
+	PICFLAG_20 = 0x20, PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_100 = 0x100,
+	PICFLAG_CLEAR_SCREEN00 = 0x1000 
+};
 
 class PictureResource: public DisplayResource {
 private:
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index bea3227..387be4e 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -135,9 +135,9 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	ViewPortResource *destViewPort = NULL;
 	Common::Rect newBounds;
 	Common::Rect backBounds;
-	int var24;
+	int var22 = 0;
+	int var24 = 0;
 	bool isClipped = false;
-	int var22;
 	int var26;
 	byte pixel = 0;
 
@@ -544,7 +544,299 @@ error("TODO: var22/var24/var2C not initialised before use?");
 
 		} else {
 			// loc_26673
-			// TODO
+			int pick = srcPic->_pick;
+			int onOff = srcPic->_onOff;
+
+			if (!(srcFlags & PICFLAG_PIC_OFFSET)) {
+				srcP = srcImgData += srcOffset;
+				int pixel = 0;
+
+				if (destFlags & PICFLAG_PIC_OFFSET) {
+					destP = destImgData + screenOffset;
+					if (srcFlags & PICFLAG_2) {
+						if (srcFlags & PICFLAG_100) {
+							if (isClipped) {
+								// loc_266E3
+								destP = (byte *)_screenSurface.getPixels() + screenOffset;
+								var22 = (var22 < 0) ? -var22 : 0;
+								var26 = var22 + width2;
+								var24 = (var24 < 0) ? -var24 : 0;
+								pick = 0x7F;
+								width2 = srcPic->_bounds.width();
+								height1 = var24 + height1;
+
+								for (int yp = 0; yp < height1; ++yp) {
+									int byteVal2 = 0;
+									for (int xp = 0; xp < width2; ++xp, --byteVal2) {
+										if (byteVal2 <= 0) {
+											pixel = *srcP++;
+											if (pixel & 0x80) {
+												pixel &= 0x7F;
+												byteVal2 = *srcP++;
+												if (!byteVal2)
+													byteVal2 = width2;
+											}
+										}
+
+										if (yp >= var24 && xp >= var22 && xp < var26) {
+											if (pixel) {
+												*destP = (pixel & pick) ^ onOff;
+											}
+											++destP;
+										}
+									}
+									if (yp >= var24)
+										destP += widthDiff2;
+								}
+							} else {
+								// loc_26815
+								destP = (byte *)_screenSurface.getPixels() + screenOffset;
+
+								for (int yp = 0; yp < height1; ++yp) {
+									for (int xp = 0; xp < width2; ++xp, ++destP) {
+										byteVal2 = 0;
+										for (int xp = 0; xp < width2; ++xp, ++destP, --byteVal2) {
+											if (!byteVal2) {
+												pixel = *srcP++;
+												if (pixel & 0x80) {
+													pixel &= 0x7F;
+													byteVal2 = *srcP++;
+													if (!byteVal2) {
+														byteVal2 = width2;
+													}
+												}
+											}
+
+											if (pixel)
+												*destP = (pixel & pick) ^ onOff;
+										}
+									}
+
+									destP += widthDiff2;
+								}
+							}
+						} else {
+							// Direct screen write
+							destP = (byte *)_screenSurface.getPixels() + screenOffset;
+
+							for (int yp = 0; yp < height1; ++yp) {
+								for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
+									if (*srcP)
+										*destP = (*srcP & pick) ^ onOff;
+								}
+								destP += widthDiff2;
+								srcP += widthDiff;
+							}
+						}
+					} else if (srcFlags & PICFLAG_100) {
+						srcP = srcImgData;
+						if (isClipped) {
+							// loc_269FD
+							var22 = (var22 < 0) ? -var22 : 0;
+							var26 = var22 + width2;
+							var24 = (var24 < 0) ? -var24 : 0;
+							width2 = srcPic->_bounds.width();
+							height1 = var24 + height1;
+
+							for (int yp = 0; yp < height1; ++yp) {
+								byteVal2 = 0;
+								for (int xp = 0; xp < width2; ++xp) {
+									if (!byteVal2) {
+										pixel = *srcP++;
+										if (pixel & 0x80) {
+											pixel = 0x7F;
+											byteVal2 = *srcP++;
+
+											if (!byteVal2)
+												byteVal2 = width2;
+										}
+									}
+
+									if (yp >= var24 && xp >= var22 && xp < var26) {
+										*destP++ = (pixel & 0x80) ^ onOff;
+									}
+								}
+							}
+						} else {
+							// loc_26BD5
+							destP = (byte *)_screenSurface.getPixels() + screenOffset;
+
+							for (int yp = 0; yp < height1; ++yp) {
+								byteVal2 = 0;
+
+								for (int xp = 0; xp < width2; ++xp, ++destP) {
+									if (!byteVal2) {
+										pixel = *srcP++;
+										if (pixel & 0x80) {
+											pixel &= 0x7F;
+											byteVal2 = *srcP++;
+											if (!byteVal2)
+												byteVal2 = width2;
+										}
+									}
+
+									*destP = (pixel & pick) ^ onOff;
+								}
+
+								destP += widthDiff2;
+							}
+						}
+					} else {
+						// loc_26C9A
+						destP = (byte *)_screenSurface.getPixels() + screenOffset;
+
+						for (int yp = 0; yp < height1; ++yp) {
+							for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
+								*destP = (*srcP & pick) ^ onOff;
+							}
+							destP += widthDiff2;
+							srcP += widthDiff;
+						}
+					}
+				} else {
+					// loc_26D2F
+					destP = destImgData + screenOffset;
+
+					if (srcFlags & PICFLAG_2) {
+						// loc_26D4F
+						if (srcFlags & PICFLAG_100) {
+							srcP = srcImgData;
+
+							if (isClipped) {
+								// loc_26D6A
+								var22 = (var22 < 0) ? -var22 : 0;
+								var26 = var22 + width2;
+								var24 = (var24 < 0) ? -var24 : 0;
+								width2 = srcPic->_bounds.width();
+								height1 = var24 + height1;
+
+								for (int yp = 0; yp < height1; ++yp) {
+									byteVal2 = 0;
+
+									for (int xp = 0; xp < width2; ++xp, --byteVal2) {
+										if (!byteVal2) {
+											pixel = *srcP++;
+											if (pixel & 0x80) {
+												pixel &= 0x7F;
+												byteVal2 = *srcP++;
+												if (!byteVal2)
+													byteVal2 = width2;
+											}
+										}
+
+										if (yp >= var24 && xp >= var22 && xp < var26) {
+											if (pixel)
+												*destP = (pixel & pick) ^ onOff;
+
+											++destP;
+										}
+									}
+
+									if (yp >= var24)
+										destP += widthDiff2;
+								}
+							} else {
+								// loc_26E95
+								for (int yp = 0; yp < height1; ++yp) {
+									byteVal2 = 0;
+									for (int xp = 0; xp < width2; ++xp, ++destP, --byteVal2) {
+										if (!byteVal2) {
+											pixel = *srcP++;
+											if (pixel & 0x80) {
+												pixel &= 0x7F;
+												byteVal2 = *srcP++;
+												if (!byteVal2)
+													byteVal2 = width2;
+											}
+										}
+
+										if (pixel)
+											*destP = (pixel & pick) ^ onOff;
+									}
+
+									destP += widthDiff2;
+								}
+							}
+						} else {
+							// loc_26F5D
+							for (int yp = 0; yp < height1; ++yp) {
+								for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
+									if (*srcP)
+										*destP = (*srcP & pick) ^ onOff;
+								}
+								destP += widthDiff2;
+								srcP += widthDiff;
+							}
+						}
+					} else {
+						// loc_26FEF
+						if (srcFlags & PICFLAG_100) {
+							// loc_26FF9
+							for (int yp = 0; yp < height1; ++yp) {
+								for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
+									*destP = (*srcP & pick) ^ onOff;
+								}
+								destP += widthDiff2;
+								srcP += widthDiff;
+							}
+						} else {
+							// loc_271F0
+							srcP = srcImgData;
+							
+							if (isClipped) {
+								// loc_2700A
+								var22 = (var22 < 0) ? -var22 : 0;
+								var26 = var22 + width2;
+								var24 = (var24 < 0) ? -var24 : 0;
+								width2 = srcPic->_bounds.width();
+								height1 = var24 + height1;
+
+								for (int yp = 0; yp < height1; ++yp) {
+									byteVal2 = 0;
+
+									for (int xp = 0; xp < width2; ++xp, --byteVal2) {
+										if (!byteVal2) {
+											pixel = *srcP++;
+											if (pixel & 0x80) {
+												pixel &= 0x7F;
+												byteVal2 = *srcP++;
+												if (!byteVal2)
+													byteVal2 = width2;
+											}
+										}
+
+										if (yp >= var24 && xp >= var22 && xp < var26) {
+											*destP++ = (pixel & pick) ^ onOff;
+										}
+									}
+
+									if (yp >= var24)
+										destP += widthDiff2;
+								}
+							} else {
+								// loc_2712F
+								for (int yp = 0; yp < height1; ++yp) {
+									byteVal2 = 0;
+									for (int xp = 0; xp < width2; ++xp, ++destP, --byteVal2) {
+										if (!byteVal2) {
+											pixel = *srcP++;
+											if (pixel & 0x80) {
+												pixel &= 0x7F;
+												byteVal2 = *srcP++;
+												if (!byteVal2)
+													byteVal2 = width2;
+											}
+										}
+
+										*destP = (*srcP & pick) ^ onOff;
+									}
+									destP += widthDiff2;
+								}
+							}
+						}
+					}
+				}
+			}
 		}
 	}
 
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 7bba651..078731e 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -114,7 +114,7 @@ const char *const PM = "pm";
 const char *const START_OF_MESSAGE = "*** Start of Message ***";
 const char *const END_OF_MESSAGE = "*** End of Message ***";
 
-const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio" "Evidence", "Computer" };
+const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio", "Evidence", "Computer" };
 
 int DOT_LINE_START[9] = {
 	0xE880, 0xE9C0, 0xEB00, 0xEC40, 0xED80, 0xEEC0, 0xF000, 0xF140, 0xF280


Commit: 336a02047b1b52f7a052712bcce2b3608958f8b6
    https://github.com/scummvm/scummvm/commit/336a02047b1b52f7a052712bcce2b3608958f8b6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-28T20:22:41-08:00

Commit Message:
VOYEUR: Fixes for flagging video events, and reviewing them in reviewTape

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 6ce7729..a7e69c9 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -436,7 +436,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_videoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
-					_vm->_voy.addAudioEventStart();
+					_vm->_voy.addVideoEventStart();
 					_vm->_voy._field478 &= ~1;
 					_vm->_voy._field478 |= 0x10;
 					_vm->playAVideo(_vm->_videoId);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 490d35e..12d627d 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -561,6 +561,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000, decoder.getHeader().getFrameRate()));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
+	_eventsManager.getMouseInfo();
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked &&
 			(decoder.getCurFrame() < endFrame)) {
 		if (decoder.needsUpdate()) {
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 95c6deb..ed04c87 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -535,10 +535,10 @@ void VoyeurEngine::reviewTape() {
 					foundIndex = 999;
 				} else if (!_eventsManager._leftClick) {
 					_eventsManager.setCursorColor(128, 2);
-					foundIndex = 999;
+					foundIndex = -1;
 				} else {
 					_eventsManager.setCursorColor(128, 2);
-					eventLine = foundIndex;
+					eventLine =  foundIndex;
 
 					flipPageAndWait();
 
@@ -562,7 +562,7 @@ void VoyeurEngine::reviewTape() {
 						Common::String msg = _eventsManager.getEvidString(evtIndex);
 						_graphicsManager._backgroundPage->drawText(msg);
 
-						yp += 115;
+						yp += 15;
 						++evtIndex;
 					}
 
@@ -575,7 +575,7 @@ void VoyeurEngine::reviewTape() {
 					flipPageAndWait();
 
 					_eventsManager.getMouseInfo();
-					foundIndex = 999;
+					foundIndex = -1;
 				}
 			} else if ((_voy._field478 & 0x40) && _voy._viewBounds->left == pt.x &&
 					_voy._viewBounds->bottom == pt.y) {


Commit: dacdca192df99e4a29c32bf275f529be3959a11b
    https://github.com/scummvm/scummvm/commit/dacdca192df99e4a29c32bf275f529be3959a11b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-29T18:08:52-08:00

Commit Message:
VOYEUR: Fixes for evidence viewing and review tape playback

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 9104d5f..be22a58 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -170,15 +170,14 @@ void SVoy::addEvidEventStart(int v) {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _isAM;
 	e._type = EVTYPE_EVID;
-	e._videoId = _vm->_videoId;
-	e._computerOn = _vocSecondsOffset;
-	e._dead = _vm->_eventsManager._videoDead;
-
+	e._videoId = _vm->_playStampGroupId;
+	e._computerOn = _field47A;
+	e._computerOff = v;
 }
 
-void SVoy::addEvidEventEnd(int dead) {
+void SVoy::addEvidEventEnd(int totalPages) {
 	VoyeurEvent &e = _events[_eventCount];
-	e._dead = dead;
+	e._dead = totalPages;
 	if (_eventCount < (TOTAL_EVENTS - 1))
 		++_eventCount;
 }
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index e33c3c7..15df79d 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -131,7 +131,7 @@ public:
 	void addAudioEventStart();
 	void addAudioEventEnd();
 	void addEvidEventStart(int v);
-	void addEvidEventEnd(int dead);
+	void addEvidEventEnd(int totalPages);
 	void addComputerEventStart();
 	void addComputerEventEnd(int v);
 	void reviewAnEvidEvent(int eventIndex);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ed04c87..ded40ce 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -413,15 +413,14 @@ void VoyeurEngine::doPiracy() {
 }
 
 void VoyeurEngine::reviewTape() {
-//	int var22 = 0;
 	int eventStart = 0;
 	int newX = -1;
 	int newY = -1;
 	int eventLine = 7;
 	Common::Rect tempRect(58, 30, 58 + 223, 30 + 124);
 	Common::Point pt;
-	int evtIndex = 0;
 	int foundIndex;
+	int eventNum;
 
 	_bVoy->getBoltGroup(0x900);
 	PictureResource *cursor = _bVoy->boltEntry(0x903)._picResource;
@@ -485,8 +484,8 @@ void VoyeurEngine::reviewTape() {
 				_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
 				int yp = 45;
-				evtIndex = eventStart;
-				for (int lineNum = 0; lineNum < 8 && evtIndex < _voy._eventCount; ++lineNum) {
+				int eventNum = eventStart;
+				for (int lineNum = 0; lineNum < 8 && eventNum < _voy._eventCount; ++lineNum, ++eventNum) {
 					_graphicsManager._fontPtr->_picFlags = 0;
 					_graphicsManager._fontPtr->_picSelect = 0xff;
 					_graphicsManager._fontPtr->_picPick = 7;
@@ -496,11 +495,10 @@ void VoyeurEngine::reviewTape() {
 					_graphicsManager._fontPtr->_justifyWidth = 0;
 					_graphicsManager._fontPtr->_justifyHeight = 0;
 
-					Common::String msg = _eventsManager.getEvidString(evtIndex);
+					Common::String msg = _eventsManager.getEvidString(eventNum);
 					_graphicsManager._backgroundPage->drawText(msg);
 					
 					yp += 15;
-					++evtIndex;
 				}
 
 				(*_graphicsManager._vPort)->addSaveRect(
@@ -517,6 +515,7 @@ void VoyeurEngine::reviewTape() {
 
 			_eventsManager.getMouseInfo();
 			foundIndex = -1;
+
 			Common::Point tempPos = _eventsManager.getMousePos() + Common::Point(14, 7);
 			for (uint idx = 0; idx < hotspots.size(); ++idx) {
 				if (hotspots[idx].contains(tempPos)) {
@@ -546,10 +545,9 @@ void VoyeurEngine::reviewTape() {
 					_graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);				
 					_graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height());
 
-					evtIndex = eventStart;
 					int yp = 45;
-					
-					for (int idx = 0; idx < 8 && evtIndex < _voy._eventCount; ++idx) {
+					eventNum = eventStart;
+					for (int idx = 0; idx < 8 && eventNum < _voy._eventCount; ++idx, ++eventNum) {
 						_graphicsManager._fontPtr->_picFlags = 0;
 						_graphicsManager._fontPtr->_picSelect = 0xff;
 						_graphicsManager._fontPtr->_picPick = 7;
@@ -559,11 +557,10 @@ void VoyeurEngine::reviewTape() {
 						_graphicsManager._fontPtr->_justifyWidth = 0;
 						_graphicsManager._fontPtr->_justifyHeight = 0;
 
-						Common::String msg = _eventsManager.getEvidString(evtIndex);
+						Common::String msg = _eventsManager.getEvidString(eventNum);
 						_graphicsManager._backgroundPage->drawText(msg);
 
 						yp += 15;
-						++evtIndex;
 					}
 
 					(*_graphicsManager._vPort)->addSaveRect(
@@ -667,7 +664,7 @@ void VoyeurEngine::reviewTape() {
 		VoyeurEvent &e = _voy._events[eventIndex];
 		switch (e._type) {
 		case EVTYPE_VIDEO:
-			playAVideoEvent(eventIndex);
+			playAVideoEvent(eventLine);
 			break;
 
 		case EVTYPE_AUDIO: {
@@ -705,7 +702,7 @@ void VoyeurEngine::reviewTape() {
 
 		case EVTYPE_EVID:
 			_bVoy->freeBoltGroup(0x900);
-			_voy.reviewAnEvidEvent(evtIndex);
+			_voy.reviewAnEvidEvent(eventLine);
 			
 			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
 			_soundManager.stopVOCPlay();
@@ -714,7 +711,7 @@ void VoyeurEngine::reviewTape() {
 
 		case EVTYPE_COMPUTER:
 			_bVoy->freeBoltGroup(0x900);
-			_voy.reviewComputerEvent(evtIndex);
+			_voy.reviewComputerEvent(eventLine);
 			
 			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
 			_soundManager.stopVOCPlay();
@@ -1364,7 +1361,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	_eventsManager.stopEvidDim();
 
 	if (eventId == 999)
-		_voy.addEvidEventStart(eventId);
+		_voy.addEvidEventStart(evidId);
 
 	_eventsManager.getMouseInfo();
 
@@ -1403,7 +1400,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		--count;
 	}
 
-	if (eventId != 999)
+	if (eventId == 999)
 		_voy.addEvidEventEnd(evidIdx);
 
 	count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);


Commit: f2af864c6b76d2d2348bb2d70d7ce738487a3033
    https://github.com/scummvm/scummvm/commit/f2af864c6b76d2d2348bb2d70d7ce738487a3033
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-29T19:02:00-08:00

Commit Message:
VOYEUR: Bugfixes for initializing audio events

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index a7e69c9..5920ca0 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -373,7 +373,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_videoId = READ_LE_UINT16(dataP + 2);
+				_vm->_videoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
@@ -385,6 +385,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy.addAudioEventStart();
 
 					assert(_vm->_videoId < 38);
+					_vm->_bVoy->getBoltGroup(0x7F00);
 					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
 						0x7F00 + BLIND_TABLE[_vm->_videoId])._picResource;
 					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 


Commit: 55f2b4ea527d93b2f202da0f76838af879fe4eb7
    https://github.com/scummvm/scummvm/commit/55f2b4ea527d93b2f202da0f76838af879fe4eb7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-29T19:40:00-08:00

Commit Message:
VOYEUR: Fixes for observing audio events

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 5920ca0..92b0191 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -396,7 +396,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->flipPageAndWaitForFade();
 
 					_vm->_voy._field478 &= ~1;
-					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
+					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset);
 					Common::String filename = _vm->_soundManager.getVOCFileName(
 						_vm->_videoId + 159);
 					_vm->_soundManager.startVOCPlay(filename);
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index 7305121..22751da 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -30,6 +30,7 @@ namespace Voyeur {
 
 SoundManager::SoundManager(Audio::Mixer *mixer) {
 	_mixer = mixer;
+	_vocOffset = 0;
 }
 
 void SoundManager::playVOCMap(byte *voc, int vocSize) {
@@ -40,7 +41,7 @@ void SoundManager::playVOCMap(byte *voc, int vocSize) {
 }
 
 bool SoundManager::vocMapStatus() {
-	// TODO
+	error("TODO: vocMapStatus");
 	return false;
 }
 
@@ -54,10 +55,11 @@ void SoundManager::abortVOCMap() {
 
 void SoundManager::stopVOCPlay() {
 	_mixer->stopHandle(_soundHandle);
+	_vocOffset = 0;
 }
 
 void SoundManager::setVOCOffset(int offset) {
-	error("TODO: setVOCOffset");
+	_vocOffset = offset;
 }
 
 Common::String SoundManager::getVOCFileName(int idx) {
@@ -69,10 +71,11 @@ void SoundManager::startVOCPlay(const Common::String &filename) {
 	if (!f.open(filename))
 		error("Could not find voc file - %s", filename.c_str());
 
-	Audio::AudioStream *audioStream = Audio::makeVOCStream(f.readStream(f.size()), 
+	Audio::SeekableAudioStream *audioStream = Audio::makeVOCStream(f.readStream(f.size()), 
 		Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
 
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream);
+	audioStream->seek(Audio::Timestamp(_vocOffset * 1000, 11025));
 }
 
 void SoundManager::startVOCPlay(int soundId) {
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 729a7d9..8b4feaa 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -36,6 +36,7 @@ private:
 	VoyeurEngine *_vm;
 	Audio::Mixer *_mixer;
 	Audio::SoundHandle _soundHandle;
+	int _vocOffset;
 public:
 	SoundManager(Audio::Mixer *mixer);
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index ded40ce..1d7daef 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -670,6 +670,8 @@ void VoyeurEngine::reviewTape() {
 		case EVTYPE_AUDIO: {
 			_videoId = e._videoId;
 			_voy._vocSecondsOffset = e._computerOn;
+
+			_bVoy->getBoltGroup(0x7F00);
 			_graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 +
 				BLIND_TABLE[_videoId])._picResource;
 			_graphicsManager._backColors = _bVoy->boltEntry(0x7F01 +
@@ -684,7 +686,7 @@ void VoyeurEngine::reviewTape() {
 			_voy._field478 &= ~1;
 
 			// Play suond for the given duration
-			_soundManager.setVOCOffset(_voy._vocSecondsOffset * 11025);
+			_soundManager.setVOCOffset(_voy._vocSecondsOffset);
 			_soundManager.startVOCPlay(_videoId + 159);
 			uint32 offFrame = e._computerOff;
 


Commit: 1e9bce479dd2c8fe3965fc68155b906e6906a988
    https://github.com/scummvm/scummvm/commit/1e9bce479dd2c8fe3965fc68155b906e6906a988
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-29T20:08:59-08:00

Commit Message:
VOYEUR: Fixes for reviewing audio events in review tape

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/sound.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index be22a58..64b15f7 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -153,7 +153,7 @@ void SVoy::addAudioEventStart() {
 	e._isAM = _isAM;
 	e._type = EVTYPE_AUDIO;
 	e._videoId = _vm->_videoId;
-	e._computerOn = _field47A;
+	e._computerOn = _vocSecondsOffset;
 	e._dead = _vm->_eventsManager._videoDead;
 }
 
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index 22751da..aab49be 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -87,7 +87,8 @@ int SoundManager::getVOCStatus() {
 }
 
 uint32 SoundManager::getVOCFrame() {
-	error("TODO: getVOCFrame");
+	Audio::Timestamp timestamp = _mixer->getElapsedTime(_soundHandle);
+	return timestamp.secs();
 }
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1d7daef..c645643 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -688,10 +688,11 @@ void VoyeurEngine::reviewTape() {
 			// Play suond for the given duration
 			_soundManager.setVOCOffset(_voy._vocSecondsOffset);
 			_soundManager.startVOCPlay(_videoId + 159);
-			uint32 offFrame = e._computerOff;
+			uint32 secondsDuration = e._computerOff;
 
+			_eventsManager.getMouseInfo();
 			while (!_eventsManager._mouseClicked && _soundManager.getVOCStatus() && 
-					_soundManager.getVOCFrame() < offFrame) {
+					_soundManager.getVOCFrame() < secondsDuration) {
 				_eventsManager.getMouseInfo();
 				_eventsManager.delay(10);
 			}


Commit: dbc8e6bb31fbb01c88403cfe712a7ecadbcd83b5
    https://github.com/scummvm/scummvm/commit/dbc8e6bb31fbb01c88403cfe712a7ecadbcd83b5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-30T18:31:20-08:00

Commit Message:
VOYEUR: Fix for low battery charge leaving scene when time is turned off

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 92b0191..0179894 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1368,7 +1368,8 @@ int ThreadResource::doInterface() {
 	if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0)
 		_vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1;
 
-	if (_vm->_voy._transitionId < 15 && (_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) {
+	if (_vm->_voy._transitionId < 15 && _vm->_debugger._isTimeActive &&
+			(_vm->_voy._RTVLimit - 3) < _vm->_voy._RTVNum) {
 		_vm->_voy._RTVNum = _vm->_voy._RTVLimit;
 		_vm->makeViewFinder();
 


Commit: 77e86b3d4805603166330c47f47789d7e4d09398
    https://github.com/scummvm/scummvm/commit/77e86b3d4805603166330c47f47789d7e4d09398
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-30T19:10:59-08:00

Commit Message:
VOYEUR: Renaming of _videoId to _audioVideoId and extra comments

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 64b15f7..5d311a8 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -30,7 +30,7 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_minute);
 	s.syncAsByte(_isAM);
 	s.syncAsByte(_type);
-	s.syncAsSint16LE(_videoId);
+	s.syncAsSint16LE(_audioVideoId);
 	s.syncAsSint16LE(_computerOn);
 	s.syncAsSint16LE(_computerOff);
 	s.syncAsSint16LE(_dead);
@@ -47,14 +47,14 @@ void SVoy::setVm(VoyeurEngine *vm) {
 	_vm = vm;
 }
 
-void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int videoId, 
+void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int audioVideoId, 
 		int on, int off, int dead) {
 	VoyeurEvent &e = _events[_eventCount++];
 
 	e._hour = hour;
 	e._minute = minute;
 	e._isAM = hour < 12;
-	e._videoId = videoId;
+	e._audioVideoId = audioVideoId;
 	e._computerOn = on;
 	e._computerOff = off;
 	e._dead = dead;
@@ -134,7 +134,7 @@ void SVoy::addVideoEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _isAM;
 	e._type = EVTYPE_VIDEO;
-	e._videoId = _vm->_videoId;
+	e._audioVideoId = _vm->_audioVideoId;
 	e._computerOn = _vocSecondsOffset;
 	e._dead = _vm->_eventsManager._videoDead;
 }
@@ -152,7 +152,7 @@ void SVoy::addAudioEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _isAM;
 	e._type = EVTYPE_AUDIO;
-	e._videoId = _vm->_videoId;
+	e._audioVideoId = _vm->_audioVideoId;
 	e._computerOn = _vocSecondsOffset;
 	e._dead = _vm->_eventsManager._videoDead;
 }
@@ -170,7 +170,7 @@ void SVoy::addEvidEventStart(int v) {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _isAM;
 	e._type = EVTYPE_EVID;
-	e._videoId = _vm->_playStampGroupId;
+	e._audioVideoId = _vm->_playStampGroupId;
 	e._computerOn = _field47A;
 	e._computerOff = v;
 }
@@ -188,7 +188,7 @@ void SVoy::addComputerEventStart() {
 	e._minute = _vm->_gameMinute;
 	e._isAM = _isAM;
 	e._type = EVTYPE_COMPUTER;
-	e._videoId = _vm->_playStampGroupId;
+	e._audioVideoId = _vm->_playStampGroupId;
 	e._computerOn = _computerTextId;
 }
 
@@ -201,7 +201,7 @@ void SVoy::addComputerEventEnd(int v) {
 
 void SVoy::reviewAnEvidEvent(int eventIndex) {
 	VoyeurEvent &e = _events[eventIndex];
-	_vm->_playStampGroupId = e._videoId;
+	_vm->_playStampGroupId = e._audioVideoId;
 	_field47A = e._computerOn;
 	int frameOff = e._computerOff;
 
@@ -224,7 +224,7 @@ void SVoy::reviewAnEvidEvent(int eventIndex) {
 
 void SVoy::reviewComputerEvent(int eventIndex) {
 	VoyeurEvent &e = _events[eventIndex];
-	_vm->_playStampGroupId = e._videoId;
+	_vm->_playStampGroupId = e._audioVideoId;
 	_computerTextId = e._computerOn;
 
 	if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 15df79d..37b2671 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -39,7 +39,7 @@ struct VoyeurEvent {
 	int _minute;
 	bool _isAM;
 	VoyeurEventType _type;
-	int _videoId;
+	int _audioVideoId;
 	int _computerOn;
 	int _computerOff;
 	int _dead;
@@ -123,8 +123,8 @@ public:
 	/**
 	 * Add an event to the list of game events that have occurred
 	 */
-	void addEvent(int hour, int minute, VoyeurEventType type, int videoId, int on,
-		int off, int dead);
+	void addEvent(int hour, int minute, VoyeurEventType type, int audioVideoId, 
+		int on, int off, int dead);
 
 	void addVideoEventStart();
 	void addVideoEventEnd();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 0179894..3746a89 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -373,23 +373,23 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_videoId = READ_LE_UINT16(dataP + 2) - 1;
+				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
 				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
 						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
-					_vm->_videoId = -1;
+					_vm->_audioVideoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_voy.addAudioEventStart();
 
-					assert(_vm->_videoId < 38);
+					assert(_vm->_audioVideoId < 38);
 					_vm->_bVoy->getBoltGroup(0x7F00);
 					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
-						0x7F00 + BLIND_TABLE[_vm->_videoId])._picResource;
+						0x7F00 + BLIND_TABLE[_vm->_audioVideoId])._picResource;
 					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 
-						BLIND_TABLE[_vm->_videoId])._cMapResource;
+						BLIND_TABLE[_vm->_audioVideoId])._cMapResource;
 
 					(*_vm->_graphicsManager._vPort)->setupViewPort();
 					_vm->_graphicsManager._backColors->startFade();
@@ -398,7 +398,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._field478 &= ~1;
 					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset);
 					Common::String filename = _vm->_soundManager.getVOCFileName(
-						_vm->_videoId + 159);
+						_vm->_audioVideoId + 159);
 					_vm->_soundManager.startVOCPlay(filename);
 					_vm->_voy._field478 |= 16;
 					_vm->_eventsManager.startCursorBlink();
@@ -415,7 +415,7 @@ void ThreadResource::parsePlayCommands() {
 
 					_vm->_bVoy->freeBoltGroup(0x7F00);
 					_vm->_voy._field478 &= ~0x10;
-					_vm->_videoId = -1;
+					_vm->_audioVideoId = -1;
 					_vm->_voy._field470 = 129;
 					parseIndex = 999;
 				}				
@@ -428,26 +428,26 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_videoId = READ_LE_UINT16(dataP + 2) - 1;
+				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
 
 				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
 						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
-					_vm->_videoId = -1;
+					_vm->_audioVideoId = -1;
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_voy.addVideoEventStart();
 					_vm->_voy._field478 &= ~1;
 					_vm->_voy._field478 |= 0x10;
-					_vm->playAVideo(_vm->_videoId);
+					_vm->playAVideo(_vm->_audioVideoId);
 
 					_vm->_voy._field478 &= ~0x10;
 					_vm->_voy._field478 |= 1;
 					_vm->_voy.addVideoEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 				
-					_vm->_videoId = -1;
+					_vm->_audioVideoId = -1;
 					_vm->_playStampGroupId = -1;
 
 					if (_vm->_eventsManager._videoDead != -1) {
@@ -471,7 +471,7 @@ void ThreadResource::parsePlayCommands() {
 
 		case 4:
 		case 22:
-			_vm->_videoId = READ_LE_UINT16(dataP) - 1;
+			_vm->_audioVideoId = READ_LE_UINT16(dataP) - 1;
 			dataP += 2;
 
 			if (id == 22) {
@@ -483,11 +483,11 @@ void ThreadResource::parsePlayCommands() {
 			_vm->_voy._vocSecondsOffset = 0;
 			_vm->_voy._field468 = _vm->_voy._RTVNum;
 			_vm->_voy._field478 &= ~0x11;
-			_vm->playAVideo(_vm->_videoId);
+			_vm->playAVideo(_vm->_audioVideoId);
 			_vm->_voy._field478 |= 1;
 
 			if (id != 22) {
-				_vm->_videoId = -1;
+				_vm->_audioVideoId = -1;
 				parseIndex = 999;
 			} else {
 				// TODO: Double-check this
@@ -529,7 +529,7 @@ void ThreadResource::parsePlayCommands() {
 
 				_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
 				_vm->_playStampGroupId = -1;
-				_vm->_videoId = -1;
+				_vm->_audioVideoId = -1;
 				parseIndex = 999;
 			}
 			break;			
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 12d627d..cfd0576 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -46,7 +46,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_bob = false;
 	_stampFlags = 0;
 	_playStampGroupId = _currentVocId = 0;
-	_videoId = -1;
+	_audioVideoId = -1;
 	_checkTransitionId = -1;
 	_gameHour = 0;
 	_gameMinute = 0;
@@ -469,7 +469,7 @@ void VoyeurEngine::doOpening() {
 	_voy._field478 = 16;
 	_gameHour = 4;
 	_gameMinute  = 0;
-	_videoId = 1;
+	_audioVideoId = 1;
 	_eventsManager._videoDead = -1;
 	_voy.addVideoEventStart();
 
@@ -745,7 +745,7 @@ void VoyeurEngine::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_stampFlags);
 	s.syncAsSint16LE(_playStampGroupId);
 	s.syncAsSint16LE(_currentVocId);
-	s.syncAsSint16LE(_videoId);
+	s.syncAsSint16LE(_audioVideoId);
 
 	s.syncAsSint16LE(_iForceDeath);
 	s.syncAsSint16LE(_gameHour);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index bdbf3c1..5d729fd 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -173,7 +173,11 @@ public:
 	int _stampFlags;
 	int _playStampGroupId;
 	int _currentVocId;
-	int _videoId;
+
+	/**
+	 * Id for the current video, audio, or evidence scene being viewed
+	 */
+	int _audioVideoId;
 	const int *_resolvePtr;
 	int _iForceDeath; // CHECKME: The original initializes it in ESP_init()
 	int _checkTransitionId;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index c645643..6844fad 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -49,7 +49,7 @@ void VoyeurEngine::playStamp() {
 		_voyeurArea = AREA_NONE;
 		_eventsManager.getMouseInfo();
 		_playStampGroupId = _currentVocId = -1;
-		_videoId = -1;
+		_audioVideoId = -1;
 
 		_mainThread->parsePlayCommands();
 
@@ -178,7 +178,7 @@ void VoyeurEngine::playStamp() {
 					_currentVocId = -1;
 				}
 
-				_videoId = -1;
+				_audioVideoId = -1;
 
 				if (_voy._field47A != -1) {
 					_bVoy->freeBoltGroup(_voy._field47A);
@@ -668,14 +668,14 @@ void VoyeurEngine::reviewTape() {
 			break;
 
 		case EVTYPE_AUDIO: {
-			_videoId = e._videoId;
+			_audioVideoId = e._audioVideoId;
 			_voy._vocSecondsOffset = e._computerOn;
 
 			_bVoy->getBoltGroup(0x7F00);
 			_graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 +
-				BLIND_TABLE[_videoId])._picResource;
+				BLIND_TABLE[_audioVideoId])._picResource;
 			_graphicsManager._backColors = _bVoy->boltEntry(0x7F01 +
-				BLIND_TABLE[_videoId])._cMapResource;
+				BLIND_TABLE[_audioVideoId])._cMapResource;
 
 			(*_graphicsManager._vPort)->setupViewPort(_graphicsManager._backgroundPage);
 			_graphicsManager._backColors->startFade();
@@ -687,7 +687,7 @@ void VoyeurEngine::reviewTape() {
 
 			// Play suond for the given duration
 			_soundManager.setVOCOffset(_voy._vocSecondsOffset);
-			_soundManager.startVOCPlay(_videoId + 159);
+			_soundManager.startVOCPlay(_audioVideoId + 159);
 			uint32 secondsDuration = e._computerOff;
 
 			_eventsManager.getMouseInfo();
@@ -812,28 +812,28 @@ bool VoyeurEngine::checkForMurder() {
 		if (evt._type == EVTYPE_VIDEO) {
 			switch (READ_LE_UINT32(_controlPtr->_ptr + 4)) {
 			case 1:
-				if (evt._videoId == 41 && evt._computerOn <= 15 &&
+				if (evt._audioVideoId == 41 && evt._computerOn <= 15 &&
 						(evt._computerOff + evt._computerOn) >= 16) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 1);
 				}
 				break;
 
 			case 2:
-				if (evt._videoId == 53 && evt._computerOn <= 19 &&
+				if (evt._audioVideoId == 53 && evt._computerOn <= 19 &&
 						(evt._computerOff + evt._computerOn) >= 21) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 2);
 				}
 				break;
 
 			case 3:
-				if (evt._videoId == 50 && evt._computerOn <= 28 &&
+				if (evt._audioVideoId == 50 && evt._computerOn <= 28 &&
 						(evt._computerOff + evt._computerOn) >= 29) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 3);
 				}
 				break;
 
 			case 4:
-				if (evt._videoId == 43 && evt._computerOn <= 10 &&
+				if (evt._audioVideoId == 43 && evt._computerOn <= 10 &&
 						(evt._computerOff + evt._computerOn) >= 14) {
 					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 4);
 				}
@@ -862,27 +862,27 @@ bool VoyeurEngine::checkForIncriminate() {
 		VoyeurEvent &evt = _voy._events[idx];
 		
 		if (evt._type == EVTYPE_VIDEO) {
-			if (evt._videoId == 44 && evt._computerOn <= 40 &&
+			if (evt._audioVideoId == 44 && evt._computerOn <= 40 &&
 					(evt._computerOff + evt._computerOn) >= 70) {
 				_voy._field4382 = 1;
 			}
 
-			if (evt._videoId == 44 && evt._computerOn <= 79 &&
+			if (evt._audioVideoId == 44 && evt._computerOn <= 79 &&
 					(evt._computerOff + evt._computerOn) >= 129) {
 				_voy._field4382 = 1;
 			}
 
-			if (evt._videoId == 20 && evt._computerOn <= 28 &&
+			if (evt._audioVideoId == 20 && evt._computerOn <= 28 &&
 					(evt._computerOff + evt._computerOn) >= 45) {
 				_voy._field4382 = 2;
 			}
 
-			if (evt._videoId == 35 && evt._computerOn <= 17 &&
+			if (evt._audioVideoId == 35 && evt._computerOn <= 17 &&
 					(evt._computerOff + evt._computerOn) >= 36) {
 				_voy._field4382 = 3;
 			}
 
-			if (evt._videoId == 30 && evt._computerOn <= 80 &&
+			if (evt._audioVideoId == 30 && evt._computerOn <= 80 &&
 					(evt._computerOff + evt._computerOn) >= 139) {
 				_voy._field4382 = 4;
 			}
@@ -901,12 +901,12 @@ bool VoyeurEngine::checkForIncriminate() {
 
 void VoyeurEngine::playAVideoEvent(int eventIndex) {
 	VoyeurEvent &evt = _voy._events[eventIndex];
-	_videoId = evt._videoId;
+	_audioVideoId = evt._audioVideoId;
 	_voy._vocSecondsOffset = evt._computerOn;
 	_eventsManager._videoDead = evt._dead;
 	_voy._field478 &= ~1;
 	
-	playAVideoDuration(_videoId, evt._computerOff);
+	playAVideoDuration(_audioVideoId, evt._computerOff);
 
 	_voy._field478 |= 1;
 	if (_eventsManager._videoDead != -1) {
@@ -916,7 +916,7 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 		_eventsManager._videoDead = -1;
 	}
 
-	_videoId = -1;
+	_audioVideoId = -1;
 	if (_eventsManager._videoDead != -1) {
 		_bVoy->freeBoltGroup(0xE00);
 		_eventsManager._videoDead = -1;


Commit: 4174c4a2be34242dc7003b4f4a7363caf743bdb5
    https://github.com/scummvm/scummvm/commit/4174c4a2be34242dc7003b4f4a7363caf743bdb5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-31T05:57:12-08:00

Commit Message:
VOYEUR: Fix hotspot hightlighting in doInterface

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 3746a89..da4ae55 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -601,6 +601,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 9:
+			// Load up initial timeframese for third set of hotspots
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
@@ -1456,7 +1457,7 @@ int ThreadResource::doInterface() {
 					}
 
 					if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum &&
-							_vm->_voy._arr6[idx][idx] > _vm->_voy._RTVNum) {
+							_vm->_voy._arr6[arrIndex][idx] > _vm->_voy._RTVNum) {
 						// Set unk? cursor 
 						_vm->_eventsManager.setCursor(mangifyCursor);
 						regionIndex = idx;


Commit: b4ab7c33578dfe35d2d19ea06c2b0d290aa49f59
    https://github.com/scummvm/scummvm/commit/b4ab7c33578dfe35d2d19ea06c2b0d290aa49f59
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-31T17:22:49-08:00

Commit Message:
VOYEUR: Fix for loading rect resources with invalid rects

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 3de0d88..a217723 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -705,8 +705,15 @@ RectResource::RectResource(const byte *src, int size) {
 	}
 
 	for (int i = 0; i < count; ++i, src += 8) {
-		_entries.push_back(Common::Rect(READ_LE_UINT16(src), READ_LE_UINT16(src + 2),
-			READ_LE_UINT16(src + 4), READ_LE_UINT16(src + 6)));
+		int x1 = READ_LE_UINT16(src);
+		int y1 = READ_LE_UINT16(src + 2);
+		int x2 = READ_LE_UINT16(src + 4); 
+		int y2 = READ_LE_UINT16(src + 6);
+
+		if (x2 >= x1 && y2 >= y1)
+			_entries.push_back(Common::Rect(x1, y1, x2, y2));
+		else
+			_entries.push_back(Common::Rect());
 	}
 
 	left = _entries[0].left;


Commit: f31a422ddfb97efbdec5d0f69b4c4e81b571b5f7
    https://github.com/scummvm/scummvm/commit/f31a422ddfb97efbdec5d0f69b4c4e81b571b5f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-31T18:58:03-08:00

Commit Message:
VOYEUR: Add support for the extended rects used by room displays

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index a217723..fe77d2f 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -251,7 +251,7 @@ BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) {
 
 	if (!_state._curGroupPtr->_loaded) {
 		// Load the group index
-		_state._curGroupPtr->load();
+		_state._curGroupPtr->load(id & 0xff00);
 	}
 
 	if (_state._curGroupPtr->_callInitGro)
@@ -266,7 +266,7 @@ BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) {
 		}
 	} else if (!_state._curGroupPtr->_processed) {
 		_state._curGroupPtr->_processed = true;
-		_state._curGroupPtr->load();
+		_state._curGroupPtr->load(id & 0xff00);
 	}
 
 	resolveAll();
@@ -397,7 +397,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
 	// Get the group, and load it's entry list if not already loaded
 	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
 	if (!_state._curGroupPtr->_loaded)
-		_state._curGroupPtr->load();
+		_state._curGroupPtr->load(id & 0xff00);
 
 	// Get the entry
 	_state._curMemberPtr = &_state._curGroupPtr->_entries[id & 0xff];
@@ -529,9 +529,15 @@ void BVoyBoltFile::sInitRect() {
 	_state._curMemberPtr->_data = _state.decompress(NULL, _state._curMemberPtr->_size, 
 		_state._curMemberPtr->_mode);
 
-	if ((_state._curMemberPtr->_size % 8) == 0 || (_state._curMemberPtr->_size % 8) == 2)
-	_state._curMemberPtr->_rectResource = new RectResource(_state._curMemberPtr->_data,
-		_state._curMemberPtr->_size);
+	// Check whether the resouce Id is in the list of extended rects
+	bool isExtendedRects = false;
+	for (int i = 0; i < 49 && !isExtendedRects; ++i)
+		isExtendedRects = RESOLVE_TABLE[i] == (_state._curMemberPtr->_id & 0xff00);
+
+	int rectSize = isExtendedRects ? 12 : 8;
+	if ((_state._curMemberPtr->_size % rectSize) == 0 || (_state._curMemberPtr->_size % rectSize) == 2)
+		_state._curMemberPtr->_rectResource = new RectResource(_state._curMemberPtr->_data,
+			_state._curMemberPtr->_size, isExtendedRects);
 }
 
 void BVoyBoltFile::sInitPic() {
@@ -619,12 +625,12 @@ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 BoltGroup::~BoltGroup() {
 }
 
-void BoltGroup::load() {
+void BoltGroup::load(uint16 groupId) {
 	_file->seek(_fileOffset);
 
 	// Read the entries
 	for (int i = 0; i < _count; ++i)
-		_entries.push_back(BoltEntry(_file));
+		_entries.push_back(BoltEntry(_file, groupId + i));
 
 	_loaded = true;
 }
@@ -639,7 +645,7 @@ void BoltGroup::unload() {
 
 /*------------------------------------------------------------------------*/
 
-BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
+BoltEntry::BoltEntry(Common::SeekableReadStream *f, uint16 id): _file(f), _id(id) {
 	_data = nullptr;
 	_rectResource = nullptr;
 	_picResource = nullptr;
@@ -660,7 +666,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
 	_field1 = buffer[1];
 	_initMethod = buffer[3];
 	_xorMask = buffer[4] & 0xff;	// TODO: Is this right??
-	_size = READ_LE_UINT32(&buffer[4]);
+	_size = READ_LE_UINT32(&buffer[4]) & 0xffffff;
 	_fileOffset = READ_LE_UINT32(&buffer[8]); 
 }
 
@@ -695,25 +701,36 @@ bool BoltEntry::hasResource() const {
 
 /*------------------------------------------------------------------------*/
 
-RectResource::RectResource(const byte *src, int size) {
+RectEntry::RectEntry(int x1, int y1, int x2, int y2, int arrIndex, int count):
+		Common::Rect(x1, y1, x2, y2), _arrIndex(arrIndex), _count(count) {
+}
+
+/*------------------------------------------------------------------------*/
+
+RectResource::RectResource(const byte *src, int size, bool isExtendedRects) {
 	int count;
-	if ((size % 8) == 2) {
+	int rectSize = isExtendedRects ? 12 : 8;
+	if ((size % rectSize) == 2) {
 		count = READ_LE_UINT16(src);
 		src += 2;
 	} else {
-		count = size / 8;
+		count = size / rectSize;
 	}
 
 	for (int i = 0; i < count; ++i, src += 8) {
+		int arrIndex = 0, count = 0;
+		if (isExtendedRects) {
+			arrIndex = READ_LE_UINT16(src);
+			count = READ_LE_UINT16(src + 2);
+			src += 4;
+		}
+
 		int x1 = READ_LE_UINT16(src);
 		int y1 = READ_LE_UINT16(src + 2);
 		int x2 = READ_LE_UINT16(src + 4); 
 		int y2 = READ_LE_UINT16(src + 6);
 
-		if (x2 >= x1 && y2 >= y1)
-			_entries.push_back(Common::Rect(x1, y1, x2, y2));
-		else
-			_entries.push_back(Common::Rect());
+		_entries.push_back(RectEntry(x1, y1, x2, y2, arrIndex, count));
 	}
 
 	left = _entries[0].left;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index cc30d0a..97ade46 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -179,7 +179,7 @@ public:
 	BoltGroup(Common::SeekableReadStream *f); 
 	virtual ~BoltGroup();
 
-	void load();
+	void load(uint16 groupId);
 	void unload();
 };
 
@@ -188,6 +188,7 @@ class BoltEntry {
 private:
 	Common::SeekableReadStream *_file;
 public:
+	uint16 _id;
 	byte _mode;
 	byte _field1;
 	byte _initMethod;
@@ -211,7 +212,7 @@ public:
 	ControlResource *_controlResource;
 	ThreadResource *_threadResource;
 public:
-	BoltEntry(Common::SeekableReadStream *f);
+	BoltEntry(Common::SeekableReadStream *f, uint16 id);
 	virtual ~BoltEntry();
 
 	void load();
@@ -232,11 +233,19 @@ public:
 	byte *fload(const Common::String &filename, int *size = NULL);
 };
 
+class RectEntry: public Common::Rect {
+public:
+	int _arrIndex;
+	int _count;
+
+	RectEntry(int x1, int y1, int x2, int y2, int arrIndex, int count);
+};
+
 class RectResource: public Common::Rect {
 public:
-	Common::Array<Common::Rect> _entries;
+	Common::Array<RectEntry> _entries;
 public:
-	RectResource(const byte *src, int size);
+	RectResource(const byte *src, int size, bool isExtendedRects);
 	RectResource(int xp, int yp, int width, int height);
 	virtual ~RectResource() {}
 };
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index da4ae55..03e3939 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1033,7 +1033,7 @@ int ThreadResource::doApt() {
 
 	_vm->_currentVocId = 151;
 	_vm->_voy._viewBounds = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._rectResource; 
-	Common::Array<Common::Rect> &hotspots = _vm->_bVoy->boltEntry(
+	Common::Array<RectEntry> &hotspots = _vm->_bVoy->boltEntry(
 		_vm->_playStampGroupId + 1)._rectResource->_entries;
 	_vm->_eventsManager.getMouseInfo();
 
@@ -1169,8 +1169,7 @@ void ThreadResource::doRoom() {
 	voy._field437C = 0;
 	voy._field437E = 1;
 	
-	byte *dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4);
-	int count = READ_LE_UINT16(dataP);
+	Common::Array<RectEntry> &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries;
 	int i4e4 = -1;
 
 	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
@@ -1209,12 +1208,9 @@ void ThreadResource::doRoom() {
 			if (voy._computerTextId != -1 && voy._rect4E4.contains(pt))
 				i4e4 = 999;
 
-			for (int idx = 0; idx < count; ++idx) {
-				if (pt.x > READ_LE_UINT16(dataP + idx * 12 + 6) &&
-						pt.x < READ_LE_UINT16(dataP + idx * 12 + 10) &&
-						pt.y > READ_LE_UINT16(dataP + idx * 12 + 8) &&
-						pt.y < READ_LE_UINT16(dataP + idx * 12 + 12)) {
-					int arrIndex = READ_LE_UINT16(dataP + idx * 12 + 2);
+			for (uint idx = 0; idx < hotspots.size(); ++idx) {
+				if (hotspots[idx].contains(pt)) {
+					int arrIndex = hotspots[idx]._arrIndex;
 					if (voy._arr7[arrIndex - 1] == 1) {
 						i4e4 = idx;
 						break;
@@ -1289,7 +1285,7 @@ void ThreadResource::doRoom() {
 			//vm._bVoy->freeBoltGroup(vm._playStampGroupId);
 			//vm._bVoy->getBoltGroup(vm._playStampGroupId);
 
-			dataP = vm._bVoy->memberAddr(vm._playStampGroupId + 4);
+			hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries;
 			pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
 			pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
 			vm._graphicsManager._backColors = vm._bVoy->boltEntry(
@@ -1392,7 +1388,7 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager.getMouseInfo();
 	_vm->initIFace();
 
-	Common::Array<Common::Rect> *hotspots = &_vm->_bVoy->boltEntry(
+	Common::Array<RectEntry> *hotspots = &_vm->_bVoy->boltEntry(
 		_vm->_playStampGroupId + 1)._rectResource->_entries;
 	_vm->_currentVocId = 151 - _vm->getRandomNumber(5);
 	_vm->_voy._vocSecondsOffset = _vm->getRandomNumber(29);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 6844fad..939bc35 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -434,7 +434,7 @@ void VoyeurEngine::reviewTape() {
 	bool breakFlag = false;
 	while (!shouldQuit() && !breakFlag) {
 		_voy._viewBounds = _bVoy->boltEntry(0x907)._rectResource;
-		Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
+		Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
 
 		_graphicsManager._backColors = _bVoy->boltEntry(0x902)._cMapResource;
 		_graphicsManager._backgroundPage = _bVoy->boltEntry(0x901)._picResource;
@@ -926,7 +926,7 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 
 int VoyeurEngine::getChooseButton()  {
 	int prevIndex = -2;
-	Common::Array<Common::Rect> &hotspots = _bVoy->boltEntry(_playStampGroupId 
+	Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(_playStampGroupId 
 		+ 6)._rectResource->_entries;
 	int selectedIndex = -1;
 
@@ -1348,8 +1348,8 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		_eventsManager.delay(1);
 	_bVoy->freeBoltMember(_voy._field47A + evidId * 2 + 1);
 
-	byte *dataP = _bVoy->memberAddr(_playStampGroupId + 4);
-	int count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
+	Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(_playStampGroupId + 4)._rectResource->_entries;
+	int count = hotspots[evidId]._count;
 
 	if (count > 0) {
 		for (int idx = 1; idx <= count; ++idx) {
@@ -1406,8 +1406,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	if (eventId == 999)
 		_voy.addEvidEventEnd(evidIdx);
 
-	count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
-	for (int idx = 1; idx <= count; ++idx) {
+	for (int idx = 1; idx <= hotspots[evidId]._count; ++idx) {
 		_bVoy->freeBoltMember(_voy._field47A + (evidId + idx) * 2);
 		_bVoy->freeBoltMember(_voy._field47A + (evidId + idx) * 2 + 1);
 	}


Commit: da977f05f6743c56f44783c46a753a8abe306f58
    https://github.com/scummvm/scummvm/commit/da977f05f6743c56f44783c46a753a8abe306f58
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-31T19:07:44-08:00

Commit Message:
VOYEUR: Fix review tape entries when more than a page is available

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 939bc35..2d80dae 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -664,7 +664,7 @@ void VoyeurEngine::reviewTape() {
 		VoyeurEvent &e = _voy._events[eventIndex];
 		switch (e._type) {
 		case EVTYPE_VIDEO:
-			playAVideoEvent(eventLine);
+			playAVideoEvent(eventIndex);
 			break;
 
 		case EVTYPE_AUDIO: {
@@ -705,7 +705,7 @@ void VoyeurEngine::reviewTape() {
 
 		case EVTYPE_EVID:
 			_bVoy->freeBoltGroup(0x900);
-			_voy.reviewAnEvidEvent(eventLine);
+			_voy.reviewAnEvidEvent(eventIndex);
 			
 			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
 			_soundManager.stopVOCPlay();
@@ -714,7 +714,7 @@ void VoyeurEngine::reviewTape() {
 
 		case EVTYPE_COMPUTER:
 			_bVoy->freeBoltGroup(0x900);
-			_voy.reviewComputerEvent(eventLine);
+			_voy.reviewComputerEvent(eventIndex);
 			
 			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
 			_soundManager.stopVOCPlay();


Commit: f6477270b031d8ab9f4c506d8cf8a335514cefa5
    https://github.com/scummvm/scummvm/commit/f6477270b031d8ab9f4c506d8cf8a335514cefa5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-01-31T19:45:28-08:00

Commit Message:
VOYEUR: Fix for cursor error in reviewTape after viewing evidence

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 2d80dae..b6390c5 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -704,7 +704,6 @@ void VoyeurEngine::reviewTape() {
 		}
 
 		case EVTYPE_EVID:
-			_bVoy->freeBoltGroup(0x900);
 			_voy.reviewAnEvidEvent(eventIndex);
 			
 			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
@@ -713,7 +712,6 @@ void VoyeurEngine::reviewTape() {
 			break;
 
 		case EVTYPE_COMPUTER:
-			_bVoy->freeBoltGroup(0x900);
 			_voy.reviewComputerEvent(eventIndex);
 			
 			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;


Commit: cbebf203d673d68112b9bcee5dea8bee0b755a70
    https://github.com/scummvm/scummvm/commit/cbebf203d673d68112b9bcee5dea8bee0b755a70
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T08:26:25-08:00

Commit Message:
VOYEUR: Add debugger command for setting the time remaining

Changed paths:
    engines/voyeur/debugger.cpp



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index c437bff..d114e83 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -47,7 +47,7 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 
 		DebugPrintf("Current date/time is: %s, time is %s\n", 
 			dtString.c_str(), _isTimeActive ? "on" : "off");
-		DebugPrintf("Format: %s [on | off | 1..17]\n\n", argv[0]);
+		DebugPrintf("Format: %s [on | off | 1..17 | val <amount>]\n\n", argv[0]);
 	} else {
 		if (!strcmp(argv[1], "on")) {
 			_isTimeActive = true;
@@ -55,6 +55,13 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 		} else if (!strcmp(argv[1], "off")) {
 			_isTimeActive = false;
 			DebugPrintf("Time is now off\n\n");
+		} else if (!strcmp(argv[1], "val")) {
+			if (argc < 3) {
+				DebugPrintf("Time remaining is currently %d.\n", _vm->_voy._RTVNum);
+			} else {
+				_vm->_voy._RTVNum = atoi(argv[2]);
+				DebugPrintf("Time remaining is now %d.\n", _vm->_voy._RTVNum);
+			}
 		} else {
 			int timeId = atoi(argv[1]);
 			if (timeId >= 1 && timeId <= 17) {


Commit: 37402e06e5f55896f3bd8a7bf8a62bca16d1c7b1
    https://github.com/scummvm/scummvm/commit/37402e06e5f55896f3bd8a7bf8a62bca16d1c7b1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T08:29:49-08:00

Commit Message:
VOYEUR: Correct mistake in debugger command.. it's time expired, not remaining

Changed paths:
    engines/voyeur/debugger.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index d114e83..546691b 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -57,10 +57,10 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 			DebugPrintf("Time is now off\n\n");
 		} else if (!strcmp(argv[1], "val")) {
 			if (argc < 3) {
-				DebugPrintf("Time remaining is currently %d.\n", _vm->_voy._RTVNum);
+				DebugPrintf("Time expired is currently %d.\n", _vm->_voy._RTVNum);
 			} else {
 				_vm->_voy._RTVNum = atoi(argv[2]);
-				DebugPrintf("Time remaining is now %d.\n", _vm->_voy._RTVNum);
+				DebugPrintf("Time expired is now %d.\n", _vm->_voy._RTVNum);
 			}
 		} else {
 			int timeId = atoi(argv[1]);
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 03e3939..3e2fa6f 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -384,39 +384,13 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_voy.addAudioEventStart();
 
+					// Play the audio
 					assert(_vm->_audioVideoId < 38);
-					_vm->_bVoy->getBoltGroup(0x7F00);
-					_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
-						0x7F00 + BLIND_TABLE[_vm->_audioVideoId])._picResource;
-					_vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 + 
-						BLIND_TABLE[_vm->_audioVideoId])._cMapResource;
-
-					(*_vm->_graphicsManager._vPort)->setupViewPort();
-					_vm->_graphicsManager._backColors->startFade();
-					_vm->flipPageAndWaitForFade();
+					_vm->playAudio(_vm->_audioVideoId);
 
-					_vm->_voy._field478 &= ~1;
-					_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset);
-					Common::String filename = _vm->_soundManager.getVOCFileName(
-						_vm->_audioVideoId + 159);
-					_vm->_soundManager.startVOCPlay(filename);
-					_vm->_voy._field478 |= 16;
-					_vm->_eventsManager.startCursorBlink();
-
-					while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && 
-							_vm->_soundManager.getVOCStatus())
-						_vm->_eventsManager.delayClick(1);
-
-					_vm->_voy._field478 |= 1;
-					_vm->_soundManager.stopVOCPlay();
 					_vm->_voy.addAudioEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 					_vm->_eventsManager.incrementTime(1);
-
-					_vm->_bVoy->freeBoltGroup(0x7F00);
-					_vm->_voy._field478 &= ~0x10;
-					_vm->_audioVideoId = -1;
-					_vm->_voy._field470 = 129;
 					parseIndex = 999;
 				}				
 			} 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index cfd0576..932a38e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -594,6 +594,40 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	}
 }
 
+void VoyeurEngine::playAudio(int audioId) {
+	_bVoy->getBoltGroup(0x7F00);
+	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 + 
+		BLIND_TABLE[audioId])._picResource;
+	_graphicsManager._backColors = _bVoy->boltEntry(0x7F01 + 
+		BLIND_TABLE[audioId])._cMapResource;
+
+	(*_graphicsManager._vPort)->setupViewPort();
+	_graphicsManager._backColors->startFade();
+	flipPageAndWaitForFade();
+
+	_voy._field478 &= ~1;
+	_soundManager.setVOCOffset(_voy._vocSecondsOffset);
+	Common::String filename = _soundManager.getVOCFileName(
+		audioId + 159);
+	_soundManager.startVOCPlay(filename);
+	_voy._field478 |= 16;
+	_eventsManager.startCursorBlink();
+
+	while (!shouldQuit() && !_eventsManager._mouseClicked && 
+			_soundManager.getVOCStatus())
+		_eventsManager.delayClick(1);
+
+	_voy._field478 |= 1;
+	_soundManager.stopVOCPlay();
+
+	_bVoy->freeBoltGroup(0x7F00);
+	flipPageAndWait();
+
+	_voy._field478 &= ~0x10;
+	audioId = -1;
+	_voy._field470 = 129;
+}
+
 void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
 	_graphicsManager.setColor(128, 16, 16, 16);
 	_graphicsManager.setColor(224, 220, 220, 220);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 5d729fd..e4b950d 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -137,6 +137,9 @@ private:
 	 */
 	bool checkForIncriminate();
 
+	/**
+	 * Plays a video event previously witnessed
+	 */
 	void playAVideoEvent(int eventIndex);
 
 	/**
@@ -212,10 +215,25 @@ public:
 
 	void playRL2Video(const Common::String &filename);
 	void doTransitionCard(const Common::String &time, const Common::String &location);
+
+	/**
+	 * Play a given video
+	 */
 	void playAVideo(int videoId);
+
+	/**
+	 * Play a given video for a given amount of time. This is particularly used
+	 * for later tape playback, where it will only play back as much of the video
+	 * as the user originally watched (since they can break out of watching a video).
+	 */
 	void playAVideoDuration(int videoId, int duration);
 
 	/**
+	 * Play an audio sequence
+	 */
+	void playAudio(int audioId);
+
+	/**
 	 * Saves the last time the game was played
 	 */
 	void saveLastInplay();


Commit: 256bf62ee4d9822458a721c059fe4abbef8ca1df
    https://github.com/scummvm/scummvm/commit/256bf62ee4d9822458a721c059fe4abbef8ca1df
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T08:54:33-08:00

Commit Message:
VOYEUR: Refactored audio scene playback, and fixed a crash at the end

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 3e2fa6f..8359cf8 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -391,6 +391,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_voy.addAudioEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 					_vm->_eventsManager.incrementTime(1);
+					_vm->_audioVideoId = -1;
 					parseIndex = 999;
 				}				
 			} 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 932a38e..2898c16 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -621,10 +621,9 @@ void VoyeurEngine::playAudio(int audioId) {
 	_soundManager.stopVOCPlay();
 
 	_bVoy->freeBoltGroup(0x7F00);
-	flipPageAndWait();
+	(*_graphicsManager._vPort)->setupViewPort(NULL);
 
 	_voy._field478 &= ~0x10;
-	audioId = -1;
 	_voy._field470 = 129;
 }
 


Commit: 3b414f10ba9e79fca6a920240435c1531ec6db1b
    https://github.com/scummvm/scummvm/commit/3b414f10ba9e79fca6a920240435c1531ec6db1b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T08:56:51-08:00

Commit Message:
VOYEUR: Fix hang when viewing scene is finished with very little time remaining

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 8359cf8..0892de1 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1351,6 +1351,7 @@ int ThreadResource::doInterface() {
 
 		while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) {
 			_vm->flashTimeBar();
+			_vm->_eventsManager.delayClick(1);
 		}
 
 		_vm->_voy._field478 = 1;


Commit: 517df376a2d96b68e3a7b9f5c078be48cb12a211
    https://github.com/scummvm/scummvm/commit/517df376a2d96b68e3a7b9f5c078be48cb12a211
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T12:04:18-08:00

Commit Message:
VOYEUR: Refactored hotspot time arrays into a cleaner template

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 5d311a8..800d9d1 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -66,24 +66,10 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_RTVNum);
 	s.syncAsSint16LE(_switchBGNum);
 
-	for (int v1 = 0; v1 < 8; ++v1) {
-		for (int v2 = 0; v2 < 20; ++v2) {
-			s.syncAsSint16LE(_arr1[v1][v2]);
-			s.syncAsSint16LE(_arr2[v1][v2]);
-		}
-	}
-	for (int v1 = 0; v1 < 4; ++v1) {
-		for (int v2 = 0; v2 < 20; ++v2) {
-			s.syncAsSint16LE(_arr3[v1][v2]);
-			s.syncAsSint16LE(_arr4[v1][v2]);
-		}
-	}
-	for (int v1 = 0; v1 < 4; ++v1) {
-		for (int v2 = 0; v2 < 20; ++v2) {
-			s.syncAsSint16LE(_arr5[v1][v2]);
-			s.syncAsSint16LE(_arr6[v1][v2]);
-		}
-	}
+	_videoHotspotTimes.synchronize(s);
+	_audioHotspotTimes.synchronize(s);
+	_evidenceHotspotTimes.synchronize(s);
+
 	for (int v1 = 0; v1 < 20; ++v1) {
 		s.syncAsSint16LE(_arr7[20]);
 	}
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 37b2671..4e592d8 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -49,6 +49,50 @@ struct VoyeurEvent {
 
 class VoyeurEngne;
 
+/**
+ * Encapsulates a list of the time expired ranges that hotspots in the mansion
+ * view are enabled for in a given time period.
+ */
+template<int SLOTS>
+class HotspotTimes {
+public:
+	int _min[SLOTS][20];	// Min time expired
+	int _max[SLOTS][20];	// Max time expired
+
+	HotspotTimes() {
+		reset();
+	}
+
+	/**
+	 * Resets the data to an initial state
+	 */
+	void reset() {
+		Common::fill(&_min[0][0], &_min[SLOTS][20], 9999);
+		Common::fill(&_max[0][0], &_max[SLOTS][20], 0);
+	}
+
+	/**
+	 * Synchronise the data
+	 */
+	void synchronize(Common::Serializer &s) {
+		for (int slotIndex = 0; slotIndex < SLOTS; ++slotIndex) {
+			for (int hotspotIndex = 0; hotspotIndex < 20; ++hotspotIndex) {
+				s.syncAsSint16LE(_min[slotIndex][hotspotIndex]);
+				s.syncAsSint16LE(_max[slotIndex][hotspotIndex]);
+			}
+		}
+	}
+
+	/**
+	 * Returns true if the given value is in the range specified by the
+	 * min and max at the given hotspot and slot indexes
+	 */
+	bool isInRange(int slotIndex, int hotspotIndex, int v) const {
+		return _min[slotIndex][hotspotIndex] <= v &&
+			v < _max[slotIndex][hotspotIndex];				
+	}
+};
+
 class SVoy {
 private:
 	VoyeurEngine *_vm;
@@ -57,12 +101,9 @@ public:
 	int _RTANum;
 	int _RTVNum;
 	int _switchBGNum;
-	int _arr1[8][20];
-	int _arr2[8][20];
-	int _arr3[3][20];
-	int _arr4[3][20];
-	int _arr5[3][20];
-	int _arr6[3][20];
+	HotspotTimes<8> _videoHotspotTimes;
+	HotspotTimes<3> _audioHotspotTimes;
+	HotspotTimes<3> _evidenceHotspotTimes;
 	int _arr7[20];
 
 	int _field468;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 0892de1..134a064 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -344,12 +344,10 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._field478 &= ~8;
 	_vm->_eventsManager._videoDead = -1;
 
-	Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 9999);
-	Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
-	Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
-	Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0);
-	Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999);
-	Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0);
+	// Reset hotspot times data
+	_vm->_voy._videoHotspotTimes.reset();
+	_vm->_voy._audioHotspotTimes.reset();
+	_vm->_voy._evidenceHotspotTimes.reset();
 	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
 
 	byte *dataP = _playCommandsPtr;
@@ -542,52 +540,54 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 7:
+			// Load the video event scene hotspot times data
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				int idx = 0;
-				while (_vm->_voy._arr1[idx][v3] != 9999)
+				while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999)
 					++idx;
 
 				v2 = READ_LE_UINT16(dataP + 4);
-				_vm->_voy._arr1[idx][v3] = v2;
-				_vm->_voy._arr2[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
+				_vm->_voy._videoHotspotTimes._min[idx][v3] = v2;
+				_vm->_voy._videoHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
 			}
 
 			dataP += 8;
 			break;
 
 		case 8:
+			// Load the audio event scene hotspot times data
  			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				int idx = 0;
-				while (_vm->_voy._arr3[idx][v3] != 9999)
+				while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999)
 					++idx;
 
 				v2 = READ_LE_UINT16(dataP + 4);
-				_vm->_voy._arr3[idx][v3] = v2;
-				_vm->_voy._arr4[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
+				_vm->_voy._audioHotspotTimes._min[idx][v3] = v2;
+				_vm->_voy._audioHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
 			}
 
 			dataP += 8;
 			break;
 
 		case 9:
-			// Load up initial timeframese for third set of hotspots
+			// Load up evidence event scene hotspot times data
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				int idx = 0;
-				while (_vm->_voy._arr5[idx][v3] != 9999)
+				while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999)
 					++idx;
 
 				v2 = READ_LE_UINT16(dataP + 4);
-				_vm->_voy._arr5[idx][v3] = v2;
-				_vm->_voy._arr6[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
+				_vm->_voy._evidenceHotspotTimes._min[idx][v3] = v2;
+				_vm->_voy._evidenceHotspotTimes._max[idx][v3] = v2 + READ_LE_UINT16(dataP + 6) - 2;
 			}
 
 			dataP += 8;
@@ -1417,31 +1417,28 @@ int ThreadResource::doInterface() {
 				Common::Point(pt.x - MANSION_VIEW_X, pt.y - MANSION_VIEW_Y);
 		regionIndex = -1;
 
-		for (int idx = 0; idx < (int)hotspots->size(); ++idx) {
-			if ((*hotspots)[idx].contains(pt)) {
+		for (int hotspotIdx = 0; hotspotIdx < (int)hotspots->size(); ++hotspotIdx) {
+			if ((*hotspots)[hotspotIdx].contains(pt)) {
 				// Rect check done
 				for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
-					if (_vm->_voy._arr3[arrIndex][idx] <= _vm->_voy._RTVNum &&
-							_vm->_voy._arr4[arrIndex][idx] > _vm->_voy._RTVNum) {
-						// Found a hotspot - switch to the magnifying glass cursor
+					if (_vm->_voy._audioHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) {
+						// Set the ear cursor for an audio event
 						_vm->_eventsManager.setCursor(listenCursor);
-						regionIndex = idx;
+						regionIndex = hotspotIdx;
 					}
 
-					if (_vm->_voy._arr5[arrIndex][idx] <= _vm->_voy._RTVNum &&
-							_vm->_voy._arr6[arrIndex][idx] > _vm->_voy._RTVNum) {
-						// Set unk? cursor 
+					if (_vm->_voy._evidenceHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) {
+						// Set the magnifier cursor for an evidence event
 						_vm->_eventsManager.setCursor(mangifyCursor);
-						regionIndex = idx;
+						regionIndex = hotspotIdx;
 					}
 				}
 
 				for (int arrIndex = 0; arrIndex < 8; ++arrIndex) {
-					if (_vm->_voy._arr1[arrIndex][idx] <= _vm->_voy._RTVNum &&
-							_vm->_voy._arr2[arrIndex][idx] > _vm->_voy._RTVNum) {
-						// Draw the picture
+					if (_vm->_voy._videoHotspotTimes.isInRange(arrIndex, hotspotIdx, _vm->_voy._RTVNum)) {
+						// Set the eye cursor for a video event
 						_vm->_eventsManager.setCursor(eyeCursor);
-						regionIndex = idx;
+						regionIndex = hotspotIdx;
 					}
 				}
 			}


Commit: 971fd6304fca2b31c8f92f8a3bf2606b1f0a4e0f
    https://github.com/scummvm/scummvm/commit/971fd6304fca2b31c8f92f8a3bf2606b1f0a4e0f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T12:09:52-08:00

Commit Message:
VOYEUR: Renamed SVoy._arr7 to _roomHotspotsEnabled

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 800d9d1..0f11c7b 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -70,8 +70,8 @@ void SVoy::synchronize(Common::Serializer &s) {
 	_audioHotspotTimes.synchronize(s);
 	_evidenceHotspotTimes.synchronize(s);
 
-	for (int v1 = 0; v1 < 20; ++v1) {
-		s.syncAsSint16LE(_arr7[20]);
+	for (int idx = 0; idx < 20; ++idx) {
+		s.syncAsByte(_roomHotspotsEnabled[idx]);
 	}
 
 	s.syncAsSint16LE(_field468);
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 4e592d8..db6ec98 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -104,7 +104,7 @@ public:
 	HotspotTimes<8> _videoHotspotTimes;
 	HotspotTimes<3> _audioHotspotTimes;
 	HotspotTimes<3> _evidenceHotspotTimes;
-	int _arr7[20];
+	bool _roomHotspotsEnabled[20];
 
 	int _field468;
 	int _field46A;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 134a064..0b4cdd2 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -344,11 +344,11 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._field478 &= ~8;
 	_vm->_eventsManager._videoDead = -1;
 
-	// Reset hotspot times data
+	// Reset hotspot data
 	_vm->_voy._videoHotspotTimes.reset();
 	_vm->_voy._audioHotspotTimes.reset();
 	_vm->_voy._evidenceHotspotTimes.reset();
-	Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
+	Common::fill(&_vm->_voy._roomHotspotsEnabled[0], &_vm->_voy._roomHotspotsEnabled[20], false);
 
 	byte *dataP = _playCommandsPtr;
 	int v2, v3;
@@ -619,7 +619,7 @@ void ThreadResource::parsePlayCommands() {
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				_vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
-				_vm->_voy._arr7[READ_LE_UINT16(dataP + 4) - 1] = 1;
+				_vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true;
 			}
 
 			dataP += 6;
@@ -1145,7 +1145,7 @@ void ThreadResource::doRoom() {
 	voy._field437E = 1;
 	
 	Common::Array<RectEntry> &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries;
-	int i4e4 = -1;
+	int hotspotId = -1;
 
 	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
 	PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
@@ -1179,25 +1179,25 @@ void ThreadResource::doRoom() {
 
 			vm._eventsManager.getMouseInfo();
 			Common::Point pt = vm._eventsManager.getMousePos();
-			i4e4 = -1;
+			hotspotId = -1;
 			if (voy._computerTextId != -1 && voy._rect4E4.contains(pt))
-				i4e4 = 999;
+				hotspotId = 999;
 
 			for (uint idx = 0; idx < hotspots.size(); ++idx) {
 				if (hotspots[idx].contains(pt)) {
 					int arrIndex = hotspots[idx]._arrIndex;
-					if (voy._arr7[arrIndex - 1] == 1) {
-						i4e4 = idx;
+					if (voy._roomHotspotsEnabled[arrIndex - 1]) {
+						hotspotId = idx;
 						break;
 					}
 				}
 			}
 
-			if (i4e4 == -1) {
+			if (hotspotId == -1) {
 				vm._graphicsManager.sDrawPic(pic1, *vm._graphicsManager._vPort,
 					Common::Point(pt.x - 9, pt.y - 9));
 				vm._eventsManager.setCursorColor(128, 0);
-			} else if (i4e4 != 999 || voy._RTVNum < voy._field4EC ||
+			} else if (hotspotId != 999 || voy._RTVNum < voy._field4EC ||
 					(voy._field4EE - 2) < voy._RTVNum) {
 				vm._graphicsManager.sDrawPic(pic2, *vm._graphicsManager._vPort,
 					Common::Point(pt.x - 12, pt.y - 9));
@@ -1215,7 +1215,7 @@ void ThreadResource::doRoom() {
 			vm._eventsManager.sWaitFlip();
 		} while (!vm.shouldQuit() && !vm._eventsManager._mouseClicked);
 
-		if (!vm._eventsManager._leftClick || i4e4 == -1) {
+		if (!vm._eventsManager._leftClick || hotspotId == -1) {
 			if (vm._eventsManager._rightClick)
 				breakFlag = true;
 
@@ -1226,7 +1226,7 @@ void ThreadResource::doRoom() {
 			voy._field478 |= 16;
 			vm._eventsManager.startCursorBlink();
 
-			if (i4e4 == 999) {
+			if (hotspotId == 999) {
 				_vm->flipPageAndWait();
 
 				if (vm._currentVocId != -1) {
@@ -1248,7 +1248,7 @@ void ThreadResource::doRoom() {
 
 				vm._bVoy->freeBoltGroup(0x4900);
 			} else {
-				vm.doEvidDisplay(i4e4, 999);
+				vm.doEvidDisplay(hotspotId, 999);
 			}
 
 			voy._field478 &= ~0x10;


Commit: 10f9c2fb039a901b938229ca77eded3a3ef4fa75
    https://github.com/scummvm/scummvm/commit/10f9c2fb039a901b938229ca77eded3a3ef4fa75
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T12:18:27-08:00

Commit Message:
VOYEUR: Added method comments for SVoy and some of VoyeurEngine class methods

Changed paths:
    engines/voyeur/data.h
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index db6ec98..b798e38 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -129,16 +129,6 @@ public:
 	int _field4F0;
 	int _field4F2;
 
-	/**
-	 * Total number of game events that have occurred
-	 */
-	int _eventCount;
-
-	/**
-	 * List of game events that have occurred
-	 */
-	VoyeurEvent _events[TOTAL_EVENTS];
-
 	int _field4376;
 	int _field4378;
 	int _field437A;
@@ -152,6 +142,9 @@ public:
 	int _curICF1;
 	int _fadeICF0;
 	int _policeEvent;
+	
+	int _eventCount;
+	VoyeurEvent _events[TOTAL_EVENTS];
 public:
 	SVoy();
 	void setVm(VoyeurEngine *vm);
@@ -167,15 +160,54 @@ public:
 	void addEvent(int hour, int minute, VoyeurEventType type, int audioVideoId, 
 		int on, int off, int dead);
 
+	/**
+	 * Adds the start of a video event happening
+	 */
 	void addVideoEventStart();
+
+	/**
+	 * Adds the finish of a video event happening
+	 */
 	void addVideoEventEnd();
+
+	/**
+	 * Adds the start of an audio event happening
+	 */
 	void addAudioEventStart();
+	
+	/**
+	 * Adsd the finish of an audio event happening
+	 */
 	void addAudioEventEnd();
+
+	/**
+	 * Adds the start of an evidence event happening
+	 */
 	void addEvidEventStart(int v);
+	
+	/**
+	 * Adds the finish of an evidence event happening
+	 */
 	void addEvidEventEnd(int totalPages);
+	
+	/**
+	 * Adds the start of a computer event happening
+	 */
 	void addComputerEventStart();
+	
+	/**
+	 * Adds the finish of a computer event happening
+	 */
 	void addComputerEventEnd(int v);
+
+	/**
+	 * Review a previously recorded evidence event
+	 */
 	void reviewAnEvidEvent(int eventIndex);
+
+	/**
+	 * Review a previously recorded computer event
+	 */
 	void reviewComputerEvent(int eventIndex);
 };
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index e4b950d..f39c4a2 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -177,9 +177,6 @@ public:
 	int _playStampGroupId;
 	int _currentVocId;
 
-	/**
-	 * Id for the current video, audio, or evidence scene being viewed
-	 */
 	int _audioVideoId;
 	const int *_resolvePtr;
 	int _iForceDeath; // CHECKME: The original initializes it in ESP_init()
@@ -259,7 +256,16 @@ public:
 	 */
 	void doScroll(const Common::Point &pt);
 
+	/**
+	 * Check for phone call
+	 */
 	void checkPhoneCall();
+
+	/**
+	 * Display evidence sequence from within a room
+	 * Suspension of disbelief needed to believe that recording from a distance,
+	 * you could still flip through the often pages of evidence for a single hotspot.
+	 */
 	void doEvidDisplay(int evidId, int eventId);
 
 	/**
@@ -285,6 +291,9 @@ public:
 
 #define VOYEUR_SAVEGAME_VERSION 1
 
+/**
+ * Header for Voyeur savegame files
+ */
 struct VoyeurSavegameHeader {
 	uint8 _version;
 	Common::String _saveName;
@@ -293,7 +302,14 @@ struct VoyeurSavegameHeader {
 	int _saveHour, _saveMinutes;
 	int _totalFrames;
 
+	/**
+	 * Read in the header from the specified file
+	 */
 	bool read(Common::InSaveFile *f);
+
+	/**
+	 * Write out header information to the specified file
+	 */
 	void write(Common::OutSaveFile *f, VoyeurEngine *vm, const Common::String &saveName);
 };
 


Commit: e1eddb5ecb541a9ea57734b379616e5fa61fe64b
    https://github.com/scummvm/scummvm/commit/e1eddb5ecb541a9ea57734b379616e5fa61fe64b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T13:27:58-08:00

Commit Message:
VOYEUR: Initialization bugfixes

Changed paths:
    engines/voyeur/data.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index b798e38..b243b15 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -67,8 +67,12 @@ public:
 	 * Resets the data to an initial state
 	 */
 	void reset() {
-		Common::fill(&_min[0][0], &_min[SLOTS][20], 9999);
-		Common::fill(&_max[0][0], &_max[SLOTS][20], 0);
+		for (int hotspotIdx = 0; hotspotIdx < 20; ++hotspotIdx) {
+			for (int slotIdx = 0; slotIdx < SLOTS; ++slotIdx) {
+				_min[slotIdx][hotspotIdx] = 9999;
+				_max[slotIdx][hotspotIdx] = 0;
+			}
+		}
 	}
 
 	/**
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 387be4e..11a8ef5 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -996,7 +996,7 @@ void GraphicsManager::screenReset() {
 	resetPalette();
 
 	_backgroundPage = NULL;
-	(*_vPort)->setupViewPort();
+	(*_vPort)->setupViewPort(NULL);
 	fillPic(*_vPort, 0);	
 
 	_vm->flipPageAndWait();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 2898c16..8e597bb 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -633,7 +633,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
 	_eventsManager._intPtr.field38 = true;
 	_eventsManager._intPtr._hasPalette = true;
 
-	(*_graphicsManager._vPort)->setupViewPort();
+	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	(*_graphicsManager._vPort)->fillPic(128);
 	_graphicsManager.flipPage();
 	_eventsManager.sWaitFlip();


Commit: 24e40281742877f88b235838a25e6a1e2ba70f33
    https://github.com/scummvm/scummvm/commit/24e40281742877f88b235838a25e6a1e2ba70f33
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T15:08:07-08:00

Commit Message:
VOYEUR: Improvements for savegame support

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 0b4cdd2..94ef0f6 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -349,7 +349,6 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._audioHotspotTimes.reset();
 	_vm->_voy._evidenceHotspotTimes.reset();
 	Common::fill(&_vm->_voy._roomHotspotsEnabled[0], &_vm->_voy._roomHotspotsEnabled[20], false);
-
 	byte *dataP = _playCommandsPtr;
 	int v2, v3;
 	PictureResource *pic;
@@ -1749,6 +1748,14 @@ void ThreadResource::doAptAnim(int mode) {
 void ThreadResource::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_aptPos.x);
 	s.syncAsSint16LE(_aptPos.y);
+	
+	int sceneId = _threadId;
+	int stackId = _controlIndex;
+	s.syncAsSint16LE(sceneId);
+	s.syncAsSint16LE(stackId);
+
+	if (s.isLoading() && (sceneId != _threadId || stackId != _controlIndex))
+		goToState(stackId, sceneId);
 }
 
 } // End of namespace Voyeur


Commit: d215fae7212bd4063437c02a7dfdc0fc16110798
    https://github.com/scummvm/scummvm/commit/d215fae7212bd4063437c02a7dfdc0fc16110798
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T15:35:08-08:00

Commit Message:
VOYEUR: Renaming to standardize on stateId/stackId variable names

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 97ade46..ba3195b 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -513,8 +513,8 @@ private:
 	uint32 getSID(int sid);
 	void cardAction(const byte *p);
 	void doSTAMPCardAction();
-	bool goToStateID(int stackId, int sceneId);
-	bool goToState(int stackId, int sceneId);
+	bool goToStateID(int stackId, int id);
+	bool goToState(int stackId, int stateId);
 	const byte *cardPerform(const byte *card);
 	bool cardPerform2(const byte *p, int cardCmdId);
 	void savePrevious();
@@ -537,9 +537,9 @@ private:
 	 */
 	bool checkMansionScroll();
 public:
-	int _threadId;
-	int _controlIndex;
-	int _field4, _field6;
+	int _stateId;
+	int _stackId;
+	int _savedStateId, _savedStackId;
 	byte _flags;
 	int _field9;
 	int _fieldA[8];
@@ -562,8 +562,8 @@ public:
 	virtual ~ThreadResource() {}
 
 	void initThreadStruct(int idx, int id);
-	bool loadAStack(int idx);
-	void unloadAStack(int idx);
+	bool loadAStack(int stackId);
+	void unloadAStack(int stackId);
 	bool doState();
 
 	bool chooseSTAMPButton(int buttonId);
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 94ef0f6..deb2e5b 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -39,20 +39,20 @@ void ThreadResource::init() {
 
 ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
 		_vm(state._vm) {
-	_threadId = READ_LE_UINT16(&src[0]);
-	_controlIndex = READ_LE_UINT16(&src[0]);
-	_field4 = READ_LE_UINT16(&src[0]);
-	_field6 = READ_LE_UINT16(&src[0]);
+	_stateId = READ_LE_UINT16(&src[0]);
+	_stackId = READ_LE_UINT16(&src[0]);
+	_savedStateId = READ_LE_UINT16(&src[0]);
+	_savedStackId = READ_LE_UINT16(&src[0]);
 	_flags = src[8];
 	_ctlPtr = nullptr;
 	_aptPos = Common::Point(-1, -1);
 }
 
 void ThreadResource::initThreadStruct(int idx, int id) {
-	_controlIndex = -1;
+	_stackId = -1;
 	if (loadAStack(idx)) {
-		_field4 = _field6 = -1;
-		_threadId = id;
+		_savedStateId = _savedStackId = -1;
+		_stateId = id;
 		_newSceneId = -1;
 		_newStackId = -1;
 
@@ -60,29 +60,29 @@ void ThreadResource::initThreadStruct(int idx, int id) {
 	}
 }
 
-bool ThreadResource::loadAStack(int idx) {
+bool ThreadResource::loadAStack(int stackId) {
 	if (_vm->_stampFlags & 1) {
-		unloadAStack(_controlIndex);
-		if  (!_useCount[idx]) {
-			BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]);
+		unloadAStack(_stackId);
+		if  (!_useCount[stackId]) {
+			BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[stackId]);
 			if (!boltEntry._data)
 				return false;
 
-			_vm->_controlPtr->_entries[idx] = boltEntry._data;
+			_vm->_controlPtr->_entries[stackId] = boltEntry._data;
 		}
 
-		++_useCount[idx];
+		++_useCount[stackId];
 	}
 
-	_ctlPtr = _vm->_controlPtr->_entries[idx];
-	_controlIndex = idx;
+	_ctlPtr = _vm->_controlPtr->_entries[stackId];
+	_stackId = stackId;
 	return true;
 }
 
-void ThreadResource::unloadAStack(int idx) {
-	if ((_vm->_stampFlags & 1) && _useCount[idx]) {
-		if (--_useCount[idx] == 0) {
-			_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]);
+void ThreadResource::unloadAStack(int stackId) {
+	if ((_vm->_stampFlags & 1) && _useCount[stackId]) {
+		if (--_useCount[stackId] == 0) {
+			_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[stackId]);
 		}
 	}
 }
@@ -111,12 +111,12 @@ bool ThreadResource::getStateInfo() {
 	_field9 = 0;
 	int id = READ_LE_UINT16(_ctlPtr);
 
-	if (id <= _threadId) {
+	if (id <= _stateId) {
 		_field9 |= 0x80;
 		return false;
 	} else {
 		uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
-		fld += _threadId << 3;
+		fld += _stateId << 3;
 		_field46 = READ_LE_UINT32(_ctlPtr + fld + 4);
 		
 		fld = READ_LE_UINT32(_ctlPtr + fld);
@@ -930,7 +930,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 	
 	case 45:
 		_newSceneId = _field46;
-		_newStackId = _controlIndex;
+		_newStackId = _stackId;
 		break;
 
 	case 46:
@@ -1543,34 +1543,34 @@ bool ThreadResource::checkMansionScroll() {
 	return result;
 }
 
-bool ThreadResource::goToStateID(int stackId, int sceneId) {
-	debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId);
+bool ThreadResource::goToStateID(int stackId, int id) {
+	debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, id);
 
 	// Save current stack
 	savePrevious();
 
-	if (_controlIndex == stackId || stackId == -1 || loadAStack(stackId)) {
+	if (_stackId == stackId || stackId == -1 || loadAStack(stackId)) {
 		// Now in the correct state
-		_threadId = getStateFromID(sceneId);
+		_stateId = getStateFromID(id);
 
-		if (_threadId != -1) {
+		if (_stateId != -1) {
 			return doState();
 		} else {
-			_threadId = _field4;
-			_controlIndex = _field6;
+			_stateId = _savedStateId;
+			_stackId = _savedStackId;
 		}
 	}
 
 	return false;
 }
 
-bool ThreadResource::goToState(int stackId, int sceneId) {
-	debugC(DEBUG_BASIC, kDebugScripts, "goToState - %d, %d", stackId, sceneId);
+bool ThreadResource::goToState(int stackId, int stateId) {
+	debugC(DEBUG_BASIC, kDebugScripts, "goToState - %d, %d", stackId, stateId);
 
 	savePrevious();
 	if (stackId == -1 || loadAStack(stackId)) {
-		if (sceneId != -1)
-			_threadId = sceneId;
+		if (stateId != -1)
+			_stateId = stateId;
 
 		return doState();
 	} else {
@@ -1579,12 +1579,12 @@ bool ThreadResource::goToState(int stackId, int sceneId) {
 }
 
 void ThreadResource::savePrevious() {
-	if (_field4 == _threadId && _controlIndex == _field6) {
+	if (_savedStateId == _stateId && _stackId == _savedStackId) {
 		_flags &= ~1;
 	} else {
 		_flags |= 1;
-		_field4 = _threadId;
-		_field6 = _controlIndex;
+		_savedStateId = _stateId;
+		_savedStackId = _stackId;
 	}
 }
 
@@ -1749,12 +1749,12 @@ void ThreadResource::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_aptPos.x);
 	s.syncAsSint16LE(_aptPos.y);
 	
-	int sceneId = _threadId;
-	int stackId = _controlIndex;
+	int sceneId = _stateId;
+	int stackId = _stackId;
 	s.syncAsSint16LE(sceneId);
 	s.syncAsSint16LE(stackId);
 
-	if (s.isLoading() && (sceneId != _threadId || stackId != _controlIndex))
+	if (s.isLoading() && (sceneId != _stateId || stackId != _stackId))
 		goToState(stackId, sceneId);
 }
 


Commit: 8af390ab9f6db6bf623b609fd424832f1acd6826
    https://github.com/scummvm/scummvm/commit/8af390ab9f6db6bf623b609fd424832f1acd6826
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T15:55:18-08:00

Commit Message:
VOYEUR: Further renaming of state Id, and merging of flag bytes

Changed paths:
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index ba3195b..1ea8428fc 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -539,13 +539,13 @@ private:
 public:
 	int _stateId;
 	int _stackId;
-	int _savedStateId, _savedStackId;
-	byte _flags;
-	int _field9;
+	int _savedStateId;
+	int _savedStackId;
+	int _newStateId;
+	int _newStackId;
+	int _flags;
 	int _fieldA[8];
 	int _field2A[8];
-	int _newSceneId;
-	int _newStackId;
 	int _stateFlags;
 	int _stateCount;
 	int _parseCount;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index deb2e5b..41fc17a 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -53,7 +53,7 @@ void ThreadResource::initThreadStruct(int idx, int id) {
 	if (loadAStack(idx)) {
 		_savedStateId = _savedStackId = -1;
 		_stateId = id;
-		_newSceneId = -1;
+		_newStateId = -1;
 		_newStackId = -1;
 
 		doState();
@@ -108,11 +108,11 @@ bool ThreadResource::doState() {
 }
 
 bool ThreadResource::getStateInfo() {
-	_field9 = 0;
+	_flags &= 0xff;
 	int id = READ_LE_UINT16(_ctlPtr);
 
 	if (id <= _stateId) {
-		_field9 |= 0x80;
+		_flags |= 0x8000;
 		return false;
 	} else {
 		uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
@@ -929,14 +929,14 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		card += 2;
 	
 	case 45:
-		_newSceneId = _field46;
+		_newStateId = _field46;
 		_newStackId = _stackId;
 		break;
 
 	case 46:
-		_vm->_glGoScene = _newSceneId;
+		_vm->_glGoScene = _newStateId;
 		_vm->_glGoStack = _newStackId;
-		_newSceneId = -1;
+		_newStateId = -1;
 		_newStackId = -1;
 		break;
 


Commit: 28fc97cbe7c5c17c5bf6f50cf99e55a67757a829
    https://github.com/scummvm/scummvm/commit/28fc97cbe7c5c17c5bf6f50cf99e55a67757a829
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T17:51:53-08:00

Commit Message:
VOYEUR: Fix for occasional palette corruption when reviewing a video event

Changed paths:
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 11a8ef5..ebe8a50 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -944,6 +944,7 @@ void GraphicsManager::clearPalette() {
 
 void GraphicsManager::setPalette(const byte *palette, int start, int count) {
 	g_system->getPaletteManager()->setPalette(palette, start, count);
+	_vm->_eventsManager._gameData._hasPalette = false;
 }
 
 void GraphicsManager::setPalette128(const byte *palette, int start, int count) {


Commit: f450b7947623c933040eb6b541387bc652f6c5de
    https://github.com/scummvm/scummvm/commit/f450b7947623c933040eb6b541387bc652f6c5de
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T18:38:08-08:00

Commit Message:
VOYEUR: Converted doRoom to use ScummVM cursors

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 41fc17a..f18d84e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1146,8 +1146,9 @@ void ThreadResource::doRoom() {
 	Common::Array<RectEntry> &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries;
 	int hotspotId = -1;
 
-	PictureResource *pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
-	PictureResource *pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
+	PictureResource *crosshairsCursor = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
+	PictureResource *magnifierCursor = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
+	vm._eventsManager.showCursor();
 
 	RectResource viewBounds(48, 38, 336, 202);
 	voy._viewBounds = &viewBounds;
@@ -1178,6 +1179,8 @@ void ThreadResource::doRoom() {
 
 			vm._eventsManager.getMouseInfo();
 			Common::Point pt = vm._eventsManager.getMousePos();
+			pt += Common::Point(30, 15);
+
 			hotspotId = -1;
 			if (voy._computerTextId != -1 && voy._rect4E4.contains(pt))
 				hotspotId = 999;
@@ -1193,19 +1196,15 @@ void ThreadResource::doRoom() {
 			}
 
 			if (hotspotId == -1) {
-				vm._graphicsManager.sDrawPic(pic1, *vm._graphicsManager._vPort,
-					Common::Point(pt.x - 9, pt.y - 9));
 				vm._eventsManager.setCursorColor(128, 0);
+				vm._eventsManager.setCursor(crosshairsCursor);
 			} else if (hotspotId != 999 || voy._RTVNum < voy._field4EC ||
 					(voy._field4EE - 2) < voy._RTVNum) {
-				vm._graphicsManager.sDrawPic(pic2, *vm._graphicsManager._vPort,
-					Common::Point(pt.x - 12, pt.y - 9));
 				vm._eventsManager.setCursorColor(128, 1);
+				vm._eventsManager.setCursor(magnifierCursor);
 			} else {
-				vm._graphicsManager.sDrawPic(pic2, 
-					*vm._graphicsManager._vPort,
-					Common::Point(pt.x - 12, pt.y - 9));
 				vm._eventsManager.setCursorColor(128, 2);
+				vm._eventsManager.setCursor(magnifierCursor);
 			}
 
 			vm._eventsManager._intPtr.field38 = true;
@@ -1223,6 +1222,7 @@ void ThreadResource::doRoom() {
 			vm._eventsManager.setMousePos(pt);
 		} else {
 			voy._field478 |= 16;
+			vm._eventsManager.hideCursor();
 			vm._eventsManager.startCursorBlink();
 
 			if (hotspotId == 999) {
@@ -1254,14 +1254,9 @@ void ThreadResource::doRoom() {
 			if (!vm._eventsManager._mouseClicked)
 				vm._eventsManager.delayClick(18000);
 
-			// WORKAROUND: Done in original, but not now, since freeing and reloading
-			// the group would invalidate the _backgroundPage picture resource
-			//vm._bVoy->freeBoltGroup(vm._playStampGroupId);
-			//vm._bVoy->getBoltGroup(vm._playStampGroupId);
+			// WORKAROUND: Skipped code from the original, that freed the group,
+			// reloaded it, and reloaded the cursors
 
-			hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries;
-			pic1 = vm._bVoy->boltEntry(vm._playStampGroupId + 2)._picResource;
-			pic2 = vm._bVoy->boltEntry(vm._playStampGroupId + 3)._picResource;
 			vm._graphicsManager._backColors = vm._bVoy->boltEntry(
 				vm._playStampGroupId + 1)._cMapResource;
 			vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(
@@ -1294,6 +1289,7 @@ void ThreadResource::doRoom() {
 
 			vm._graphicsManager.fadeUpICF1(0);
 			voy._field478 &= 0x10;
+			vm._eventsManager.showCursor();
 		}
 	}
 
@@ -1318,6 +1314,7 @@ void ThreadResource::doRoom() {
 		vm._currentVocId = -1;
 	}
 
+	vm._eventsManager.hideCursor();
 	chooseSTAMPButton(0);
 }
 
@@ -1749,13 +1746,16 @@ void ThreadResource::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_aptPos.x);
 	s.syncAsSint16LE(_aptPos.y);
 	
-	int sceneId = _stateId;
+	int stateId = _stateId;
 	int stackId = _stackId;
-	s.syncAsSint16LE(sceneId);
+	s.syncAsSint16LE(stateId);
 	s.syncAsSint16LE(stackId);
 
-	if (s.isLoading() && (sceneId != _stateId || stackId != _stackId))
-		goToState(stackId, sceneId);
+	if (s.isLoading() && (stateId != _stateId || stackId != _stackId))
+		goToState(stackId, stateId);
+
+	s.syncAsSint16LE(_savedStateId);
+	s.syncAsSint16LE(_savedStackId);
 }
 
 } // End of namespace Voyeur


Commit: 7cd966bc80666523cd6d4ec754415a3312b93888
    https://github.com/scummvm/scummvm/commit/7cd966bc80666523cd6d4ec754415a3312b93888
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T18:45:15-08:00

Commit Message:
VOYEUR: Removed redundant LockClass class

Changed paths:
  R engines/voyeur/utils.cpp
  R engines/voyeur/utils.h
    engines/voyeur/module.mk
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index f2a69df..aab254c 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -11,7 +11,6 @@ MODULE_OBJS := \
 	graphics.o \
 	sound.o \
 	staticres.o \
-	utils.o \
 	voyeur.o \
 	voyeur_game.o
 
diff --git a/engines/voyeur/utils.cpp b/engines/voyeur/utils.cpp
deleted file mode 100644
index 74470dc..0000000
--- a/engines/voyeur/utils.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 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 "voyeur/utils.h"
-#include "common/savefile.h"
-
-namespace Voyeur {
-
-LockTime::LockTime() { 
-	field0 = field1 = field2 = field3 = 0; 
-}
-
-void LockClass::getSysDate() {
-	// May not be needed for ScummVM
-}
-
-void LockClass::getThePassword() {
-	field0 = 26;
-	_password = "3333";
-	fieldE = field16;
-	field12 = field1A;
-	fieldC = -1;
-
-	// TODO: Original loaded 'VOYEUR.DAT' here to get most recent game's password.
-	// but since we allow seperate savegames in ScummVM, this is somewhat deprecated.
-}
-
-void LockClass::saveThePassword() {
-	// May not be needed for ScummVM
-}
-
-Common::String LockClass::getDateString() {
-	return Common::String("ScummVM");
-}
-
-} // End of namespace Voyeur
diff --git a/engines/voyeur/utils.h b/engines/voyeur/utils.h
deleted file mode 100644
index b926678..0000000
--- a/engines/voyeur/utils.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* 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.
- *
- */
-
-#ifndef VOYEUR_UTILS_H
-#define VOYEUR_UTILS_H
-
-#include "common/scummsys.h"
-#include "common/str.h"
-
-namespace Voyeur {
-
-class LockTime {
-public:
-	int field0;
-	int field1;
-	int field2;
-	int field3;
-
-	LockTime();
-};
-
-class LockClass {
-public:
-	int field0;
-	Common::String _password;
-	int fieldC;
-	LockTime fieldE;
-	int field12;
-	LockTime field16;
-	int field1A;
-public:
-	void getSysDate();
-	void getThePassword();
-	void saveThePassword();
-	Common::String getDateString();
-};
-
-} // End of namespace Voyeur
-
-#endif /* VOYEUR_UTILS_H */
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 8e597bb..4d3f235 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -24,7 +24,6 @@
 #include "voyeur/animation.h"
 #include "voyeur/graphics.h"
 #include "voyeur/staticres.h"
-#include "voyeur/utils.h"
 #include "common/scummsys.h"
 #include "common/config-manager.h"
 #include "common/debug-channels.h"
@@ -241,16 +240,12 @@ bool VoyeurEngine::doLock() {
 	int buttonVocSize, wrongVocSize;
 	byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
 	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
-	LockClass lock;
 
 	if (_bVoy->getBoltGroup(0x700)) {
-		lock.getSysDate();
-		lock.getThePassword();
-		
-		_voy._field4380 = lock.fieldC;
+		_voy._field4380 = 0;
 		_voy._viewBounds = _bVoy->boltEntry(0x704)._rectResource;
 
-		Common::String password = lock._password;
+		Common::String password = "3333";
 		PictureResource *cursorPic = _bVoy->getPictureResource(0x702);
 		assert(cursorPic);
 
@@ -287,7 +282,7 @@ bool VoyeurEngine::doLock() {
 		_graphicsManager._fontPtr->_fontSaveBack = 0;
 		_graphicsManager._fontPtr->_fontFlags = 0;
 
-		Common::String dateString = lock.getDateString();
+		Common::String dateString = "ScummVM";
  		Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
 
 		bool firstLoop = true;
@@ -396,10 +391,6 @@ bool VoyeurEngine::doLock() {
 		flipPageAndWait();
 		_graphicsManager.resetPalette();
 
-		if (flag && result)
-			lock._password = displayString;
-		lock.saveThePassword();
-
 		_voy._viewBounds = nullptr;
 		_bVoy->freeBoltGroup(0x700);
 	}
@@ -665,11 +656,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
 }
 
 void VoyeurEngine::saveLastInplay() {
-	LockClass lock;
-	lock.getThePassword();
-	lock.fieldC = _voy._field4380;
-	lock.getSysDate();
-	lock.saveThePassword();
+	// No implementation in ScummVM version
 }
 
 void VoyeurEngine::flipPageAndWait() {


Commit: 54c479c3d9e7cf47e00d2b2d2c6bd16989eeb510
    https://github.com/scummvm/scummvm/commit/54c479c3d9e7cf47e00d2b2d2c6bd16989eeb510
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T19:22:34-08:00

Commit Message:
VOYEUR: Bugfixes for computer event display

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 0f11c7b..e3791d2 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -88,8 +88,8 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_field4AC);
 	s.syncAsSint16LE(_field4B8);
 	s.syncAsSint16LE(_computerTextId);
-	s.syncAsSint16LE(_field4EC);
-	s.syncAsSint16LE(_field4EE);
+	s.syncAsSint16LE(_computerTimeMin);
+	s.syncAsSint16LE(_computerTimeMax);
 	s.syncAsSint16LE(_field4F0);
 	s.syncAsSint16LE(_field4F2);
 
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index b243b15..bdd583b 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -128,8 +128,8 @@ public:
 
 	int _computerTextId;
 	Common::Rect _rect4E4;
-	int _field4EC;
-	int _field4EE;
+	int _computerTimeMin;
+	int _computerTimeMax;
 	int _field4F0;
 	int _field4F2;
 
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index fe77d2f..b5f6fb9 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1398,6 +1398,23 @@ void ViewPortResource::drawIfaceTime() {
 		Common::Point(215, 27));
 }
 
+void ViewPortResource::drawPicPerm(PictureResource *pic, const Common::Point &pt) {
+	Common::Rect bounds = pic->_bounds;
+	bounds.translate(pt.x, pt.y);
+
+	bool saveBack = _state._vm->_graphicsManager._saveBack;
+	_state._vm->_graphicsManager._saveBack = false;
+	_state._vm->_graphicsManager.sDrawPic(pic, this, pt);
+	clipRect(bounds);
+
+	for (int pageIndex = 0; pageIndex < _pageCount; ++pageIndex) {
+		if (_pageIndex != pageIndex) {
+			addSaveRect(pageIndex, bounds);
+		}
+	}
+
+	_state._vm->_graphicsManager._saveBack = saveBack;
+}
 /*------------------------------------------------------------------------*/
 
 ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 1ea8428fc..604b303 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -373,6 +373,7 @@ public:
 	void addSaveRect(int pageIndex, const Common::Rect &r);
 	void fillPic(byte onOff = 0);
 	void drawIfaceTime();
+	void drawPicPerm(PictureResource *pic, const Common::Point &pt);
 };
 
 class ViewPortPalEntry  {
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index f18d84e..7955cfd 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -629,8 +629,8 @@ void ThreadResource::parsePlayCommands() {
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				_vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2);
-				_vm->_voy._field4EC = READ_LE_UINT16(dataP + 4);
-				_vm->_voy._field4EE = READ_LE_UINT16(dataP + 6);
+				_vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6);
 
 				_vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4];
 				_vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1];
@@ -1198,8 +1198,8 @@ void ThreadResource::doRoom() {
 			if (hotspotId == -1) {
 				vm._eventsManager.setCursorColor(128, 0);
 				vm._eventsManager.setCursor(crosshairsCursor);
-			} else if (hotspotId != 999 || voy._RTVNum < voy._field4EC ||
-					(voy._field4EE - 2) < voy._RTVNum) {
+			} else if (hotspotId != 999 || voy._RTVNum < voy._computerTimeMin ||
+					(voy._computerTimeMax - 2) < voy._RTVNum) {
 				vm._eventsManager.setCursorColor(128, 1);
 				vm._eventsManager.setCursor(magnifierCursor);
 			} else {
@@ -1241,9 +1241,9 @@ void ThreadResource::doRoom() {
 				vm._eventsManager._mouseClicked = false;
 				vm._eventsManager.startCursorBlink();
 
-				int v = vm.doComputerText(9999); 
-				if (v)
-					vm._voy.addComputerEventEnd(v);
+				int totalChars = vm.doComputerText(9999); 
+				if (totalChars)
+					vm._voy.addComputerEventEnd(totalChars);
 
 				vm._bVoy->freeBoltGroup(0x4900);
 			} else {
@@ -1262,6 +1262,7 @@ void ThreadResource::doRoom() {
 			vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry(
 				vm._playStampGroupId)._picResource;
 
+			(*vm._graphicsManager._vPort)->setupViewPort();
 			vm._graphicsManager._backColors->startFade();
 			_vm->flipPageAndWait();
 
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index f39c4a2..a79ec5b 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -238,7 +238,7 @@ public:
 	void makeViewFinderP();
 	void initIFace();
 	void checkTransition();
-	bool doComputerText(int maxLen);
+	int doComputerText(int maxLen);
 	void getComputerBrush();
 
 	/**
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index b6390c5..a95355e 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1160,7 +1160,7 @@ Common::String VoyeurEngine::getTimeOfDay() {
 	return Common::String::format("%d:%02d%s", _gameHour, _gameMinute, _voy._isAM ? AM : PM);
 }
 
-bool VoyeurEngine::doComputerText(int maxLen) {
+int VoyeurEngine::doComputerText(int maxLen) {
 	FontInfoResource &font = *_graphicsManager._fontPtr;
 	int totalChars = 0;
 
@@ -1171,7 +1171,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 	if (_voy._vocSecondsOffset > 60)
 		_voy._vocSecondsOffset = 0;
 
-	if (_voy._RTVNum > _voy._field4EE && maxLen == 9999) {
+	if (_voy._RTVNum > _voy._computerTimeMax && maxLen == 9999) {
 		if (_currentVocId != -1)
 			_soundManager.startVOCPlay(_currentVocId);
 		font._justify = ALIGN_LEFT;
@@ -1179,7 +1179,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 		font._justifyHeight = 100;
 		font._pos = Common::Point(128, 100);
 		(*_graphicsManager._vPort)->drawText(END_OF_MESSAGE);
-	} else if (_voy._RTVNum < _voy._field4EC && maxLen == 9999) {
+	} else if (_voy._RTVNum < _voy._computerTimeMin && maxLen == 9999) {
 		if (_currentVocId != -1)
 			_soundManager.startVOCPlay(_currentVocId);
 		font._justify = ALIGN_LEFT;
@@ -1244,7 +1244,7 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 
 		} while (!shouldQuit() && !_eventsManager._mouseClicked && totalChars < maxLen);
 
-		_voy._field4EE = 0;
+		_voy._computerTimeMax = 0;
 	}
 
 	flipPageAndWait();
@@ -1254,9 +1254,16 @@ bool VoyeurEngine::doComputerText(int maxLen) {
 }
 
 void VoyeurEngine::getComputerBrush() {
-	error("TODO: getComputerBrush");
-//	if (_bVoy->getBoltGroup(0x4900)) {
-//	}
+	if (_bVoy->getBoltGroup(0x4900)) {
+		PictureResource *pic = _bVoy->boltEntry(0x490E)._picResource;
+		int xp = (384 - pic->_bounds.width()) / 2;
+		int yp = (240 - pic->_bounds.height()) / 2 - 4;
+
+		(*_graphicsManager._vPort)->drawPicPerm(pic, Common::Point(xp, yp));
+
+		CMapResource *pal = _bVoy->boltEntry(0x490F)._cMapResource;
+		pal->startFade();
+	}
 }
 
 void VoyeurEngine::doTimeBar(bool force) {


Commit: 647a2ded958a295f0ca3fc74e6e0cdc452efe83e
    https://github.com/scummvm/scummvm/commit/647a2ded958a295f0ca3fc74e6e0cdc452efe83e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-01T20:33:30-08:00

Commit Message:
VOYEUR: Set up enum for event flags, and improved blinking record indicator

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index e3791d2..8bcf32f 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -82,7 +82,7 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_aptLoadMode);
 	s.syncAsSint16LE(_transitionId);
 	s.syncAsSint16LE(_RTVLimit);
-	s.syncAsSint16LE(_field478);
+	s.syncAsSint16LE(_eventFlags);
 	s.syncAsSint16LE(_field47A);
 
 	s.syncAsSint16LE(_field4AC);
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index bdd583b..8b561e9 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -34,6 +34,9 @@ namespace Voyeur {
 enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
 	EVTYPE_COMPUTER = 4 };
 
+enum EventFlag { EVTFLAG_1 = 1, EVTFLAG_2 = 2, EVTFLAG_8 = 8, EVTFLAG_RECORDING = 0x10,
+	EVTFLAG_40 = 0x40, EVTFLAG_100 = 0x100 };
+
 struct VoyeurEvent {
 	int _hour;
 	int _minute;
@@ -118,7 +121,7 @@ public:
 	int _aptLoadMode;
 	int _transitionId;
 	int _RTVLimit;
-	int _field478;
+	int _eventFlags;
 	int _field47A;
 	PictureResource *_evPicPtrs[6];
 	CMapResource *_evCmPtrs[6];
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index d79b6a0..3fe37ca 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -56,7 +56,7 @@ IntData::IntData() {
 	field24 = 0;
 	field26 = 0;
 	field2A = 0;
-	field38 = false;
+	_palChanged = false;
 	field3B = false;
 	field3D = false;
 	_palStartIndex = 0;
@@ -73,7 +73,10 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_fadeStatus = 0;
 	_priorFrameTime = g_system->getMillis();
 	_gameCounter = 0;
-	_joe = 0;
+	_counterFlag = false;
+	_recordBlinkCounter = 0;
+	_cursorBlinked = false;
+
 	Common::fill(&_keyState[0], &_keyState[256], false);
 	Common::fill(&_cycleTime[0], &_cycleTime[4], 0);
 	Common::fill(&_cycleNext[0], &_cycleNext[4], (byte *)nullptr);
@@ -99,7 +102,7 @@ void EventsManager::startMainClockInt() {
 }
 
 void EventsManager::mainVoyeurIntFunc() {
-	if (!(_vm->_voy._field478 & 1)) {
+	if (!(_vm->_voy._eventFlags & EVTFLAG_1)) {
 		++_vm->_voy._switchBGNum;
 
 		if (_vm->_debugger._isTimeActive) {
@@ -141,7 +144,9 @@ void EventsManager::checkForNextFrameCounter() {
 	// Check for next game frame
 	uint32 milli = g_system->getMillis();
 	if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
-		++_gameCounter;
+		_counterFlag = !_counterFlag;
+		if (_counterFlag)
+			++_gameCounter;
 		_priorFrameTime = milli;
 
 		// Run the timer-based updates
@@ -173,7 +178,7 @@ void EventsManager::voyeurTimer() {
 
 	if (--_gameData.field26 <= 0) {
 		if (_gameData._flipWait) {
-			_gameData.field38 = true;
+			_gameData._palChanged = true;
 			_gameData._flipWait = false;
 			_gameData.field3B = false;
 		}
@@ -338,7 +343,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 
 		_intPtr._hasPalette = true;
 		if (!(cMap->_fadeStatus & 2))
-			_intPtr.field38 = true;
+			_intPtr._palChanged = true;
 	}
 
 	if (_cycleStatus & 1)
@@ -388,7 +393,7 @@ void EventsManager::vDoFadeInt() {
 		_intPtr._palEndIndex = _fadeLastCol;
 
 	_intPtr._hasPalette = true;
-	_intPtr.field38 = true;
+	_intPtr._palChanged = true;
 }
 
 void EventsManager::vDoCycleInt() {
@@ -471,7 +476,7 @@ void EventsManager::vDoCycleInt() {
 			}
 
 			_intPtr._hasPalette = true;
-			_intPtr.field38 = true;
+			_intPtr._palChanged = true;
 		}
 	}
 }
@@ -535,18 +540,18 @@ void EventsManager::hideCursor() {
 void EventsManager::getMouseInfo() {
 	pollEvents();
 
-	if (_vm->_voy._field478 & 0x10) {
-		if ((_gameCounter - _joe) > 8) {
-			_joe = _gameCounter;
+	if (_vm->_voy._eventFlags & EVTFLAG_RECORDING) {
+		if ((_gameCounter - _recordBlinkCounter) > 8) {
+			_recordBlinkCounter = _gameCounter;
 
-			if (_vm->_bob) {
-				_vm->_bob = false;
-				_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
+			if (_cursorBlinked) {
+				_cursorBlinked = false;
+				_vm->_graphicsManager.setOneColor(128, 220, 20, 20);
 				_vm->_graphicsManager.setColor(128, 220, 20, 20);
 			} else {
-				_vm->_bob = true;
-				_vm->_graphicsManager.setOneColor(128, 55, 55, 55);
-				_vm->_graphicsManager.setColor(128, 220, 20, 20);
+				_cursorBlinked = true;
+				_vm->_graphicsManager.setOneColor(128, 220, 220, 220);
+				_vm->_graphicsManager.setColor(128, 220, 220, 220);
 			}
 		}
 	}
@@ -567,10 +572,10 @@ void EventsManager::checkForKey() {
 }
 
 void EventsManager::startCursorBlink() {
-	if (_vm->_voy._field478 & 0x10) {
+	if (_vm->_voy._eventFlags & EVTFLAG_RECORDING) {
 		_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
 		_vm->_graphicsManager.setColor(128, 220, 20, 20);
-		_intPtr.field38 = true;
+		_intPtr._palChanged = true;
 		_intPtr._hasPalette = true;
 
 		_vm->_graphicsManager.drawDot();
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 753139b..6e2d297 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -62,7 +62,7 @@ public:
 	int field26;
 	int field2A;   // CHECKME: Useless variable
 	bool _hasPalette;
-	bool field38;  // CHECKME: Useless variable
+	bool _palChanged;  // CHECKME: Useless variable
 	bool field3B;  // Skip fading
 	bool field3D;  // CHECKME: Useless variable
 	int _palStartIndex;
@@ -78,12 +78,14 @@ class EventsManager {
 private:
 	VoyeurEngine *_vm;
 	uint32 _priorFrameTime;
+	bool _counterFlag;
 	uint32 _gameCounter;
-	uint32 _joe;
+	uint32 _recordBlinkCounter;	// Original field was called _joe :)
 	bool _keyState[256];
 	int _mouseButton;
 	Common::List<IntNode *> _intNodes;
 	Common::Point _mousePos;
+	bool _cursorBlinked;
 
 	void mainVoyeurIntFunc();
 private:
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 7955cfd..5ea450e 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -341,7 +341,7 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._field46A = 0;
 	_vm->_voy._field47A = -1;
 	_vm->_voy._computerTextId = -1;
-	_vm->_voy._field478 &= ~8;
+	_vm->_voy._eventFlags &= ~EVTFLAG_8;
 	_vm->_eventsManager._videoDead = -1;
 
 	// Reset hotspot data
@@ -410,12 +410,12 @@ void ThreadResource::parsePlayCommands() {
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_voy.addVideoEventStart();
-					_vm->_voy._field478 &= ~1;
-					_vm->_voy._field478 |= 0x10;
+					_vm->_voy._eventFlags &= ~EVTFLAG_1;
+					_vm->_voy._eventFlags |= EVTFLAG_RECORDING;
 					_vm->playAVideo(_vm->_audioVideoId);
 
-					_vm->_voy._field478 &= ~0x10;
-					_vm->_voy._field478 |= 1;
+					_vm->_voy._eventFlags &= ~EVTFLAG_RECORDING;
+					_vm->_voy._eventFlags |= EVTFLAG_1;
 					_vm->_voy.addVideoEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 				
@@ -454,9 +454,9 @@ void ThreadResource::parsePlayCommands() {
 
 			_vm->_voy._vocSecondsOffset = 0;
 			_vm->_voy._field468 = _vm->_voy._RTVNum;
-			_vm->_voy._field478 &= ~0x11;
+			_vm->_voy._eventFlags &= ~(EVTFLAG_1 | EVTFLAG_RECORDING);
 			_vm->playAVideo(_vm->_audioVideoId);
-			_vm->_voy._field478 |= 1;
+			_vm->_voy._eventFlags |= EVTFLAG_1;
 
 			if (id != 22) {
 				_vm->_audioVideoId = -1;
@@ -515,7 +515,7 @@ void ThreadResource::parsePlayCommands() {
 
 				if (_vm->_voy._transitionId != count) {
 					if (_vm->_voy._transitionId > 1)
-						_vm->_voy._field478 &= ~0x100;
+						_vm->_voy._eventFlags &= ~EVTFLAG_100;
 
 					_vm->_voy._transitionId = count;
 					_vm->_gameMinute = LEVEL_M[count - 1];
@@ -610,7 +610,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 11:
-			_vm->_voy._field478 |= 2;
+			_vm->_voy._eventFlags |= EVTFLAG_2;
 			break;
 
 		case 12:
@@ -1034,7 +1034,7 @@ int ThreadResource::doApt() {
 	_vm->_graphicsManager.setColor(131, 215, 215, 215);
 	_vm->_graphicsManager.setColor(132, 235, 235, 235);
 
-	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 
 	// Main loop to allow users to move the cursor and select hotspots
@@ -1070,7 +1070,7 @@ int ThreadResource::doApt() {
 				if (hotspotId != prevHotspotId) {
 					// Check for whether to replace hotspot Id for "Watch TV" for
 					// "Review the Tape" if player has already watched the TV
-					if ((_vm->_voy._field478 & 0x100) && (hotspotId == 2))
+					if ((_vm->_voy._eventFlags & 0x100) && (hotspotId == 2))
 						hotspotId = 5;
 
 					// Draw the text description for the highlighted hotspot
@@ -1161,13 +1161,13 @@ void ThreadResource::doRoom() {
 
 	voy._vocSecondsOffset = 0;
 	vm._soundManager.startVOCPlay(vm._currentVocId);
-	voy._field478 &= ~1;
+	voy._eventFlags &= ~EVTFLAG_1;
 
 	bool breakFlag = false;
 	while (!vm.shouldQuit() && !breakFlag) {
 		_vm->_voyeurArea = AREA_ROOM;
 		vm._graphicsManager.setColor(128, 0, 255, 0);
-		vm._eventsManager._intPtr.field38 = true;
+		vm._eventsManager._intPtr._palChanged = true;
 		vm._eventsManager._intPtr._hasPalette = true;
 
 		do {
@@ -1207,7 +1207,7 @@ void ThreadResource::doRoom() {
 				vm._eventsManager.setCursor(magnifierCursor);
 			}
 
-			vm._eventsManager._intPtr.field38 = true;
+			vm._eventsManager._intPtr._palChanged = true;
 			vm._eventsManager._intPtr._hasPalette = true;
 			vm._graphicsManager.flipPage();
 			vm._eventsManager.sWaitFlip();
@@ -1221,7 +1221,7 @@ void ThreadResource::doRoom() {
 			vm._eventsManager.getMouseInfo();
 			vm._eventsManager.setMousePos(pt);
 		} else {
-			voy._field478 |= 16;
+			voy._eventFlags |= EVTFLAG_RECORDING;
 			vm._eventsManager.hideCursor();
 			vm._eventsManager.startCursorBlink();
 
@@ -1250,7 +1250,7 @@ void ThreadResource::doRoom() {
 				vm.doEvidDisplay(hotspotId, 999);
 			}
 
-			voy._field478 &= ~0x10;
+			voy._eventFlags &= ~EVTFLAG_RECORDING;
 			if (!vm._eventsManager._mouseClicked)
 				vm._eventsManager.delayClick(18000);
 
@@ -1289,12 +1289,12 @@ void ThreadResource::doRoom() {
 			_vm->flipPageAndWait();
 
 			vm._graphicsManager.fadeUpICF1(0);
-			voy._field478 &= 0x10;
+			voy._eventFlags &= EVTFLAG_RECORDING;
 			vm._eventsManager.showCursor();
 		}
 	}
 
-	voy._field478 = 1;
+	voy._eventFlags = EVTFLAG_1;
 	vm._eventsManager.incrementTime(1);
 	voy._viewBounds = nullptr;
 	voy._field437E = 0;
@@ -1323,13 +1323,13 @@ int ThreadResource::doInterface() {
 	PictureResource *pic;
 	Common::Point pt;
 
-	_vm->_voy._field478 |= 1;
+	_vm->_voy._eventFlags |= EVTFLAG_1;
 	if (_vm->_voy._field46E) {
 		_vm->_voy._field46E = false;
 		return -2;
 	}
 
-	_vm->_voy._field478 &= ~0x100;
+	_vm->_voy._eventFlags &= ~EVTFLAG_100;
 	_vm->_playStampGroupId = -1;
 	_vm->_eventsManager._intPtr.field1E = 1;
 	_vm->_eventsManager._intPtr.field1A = 0;
@@ -1344,14 +1344,14 @@ int ThreadResource::doInterface() {
 
 		_vm->initIFace();
 		_vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4;
-		_vm->_voy._field478 &= ~1;
+		_vm->_voy._eventFlags &= ~EVTFLAG_1;
 
 		while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) {
 			_vm->flashTimeBar();
 			_vm->_eventsManager.delayClick(1);
 		}
 
-		_vm->_voy._field478 = 1;
+		_vm->_voy._eventFlags |= EVTFLAG_1;
 		chooseSTAMPButton(20);
 		parsePlayCommands();
 	}
@@ -1371,9 +1371,9 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager.getMouseInfo();
 	
 	_vm->_graphicsManager.setColor(240, 220, 220, 220);
-	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
-	_vm->_voy._field478 &= ~1;
+	_vm->_voy._eventFlags &= ~EVTFLAG_1;
 
 	// Set the cusor 
 	PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource;
@@ -1470,7 +1470,7 @@ int ThreadResource::doInterface() {
 		_vm->flipPageAndWait();
 
 		pt = _vm->_eventsManager.getMousePos();
-		if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._field478 & 0x80) &&
+		if ((_vm->_voy._RTVNum >= _vm->_voy._RTVLimit) || ((_vm->_voy._eventFlags & 0x80) &&
 				_vm->_eventsManager._rightClick && (pt.x == 0))) {
 			// Time to transition to the next time period
 			_vm->_eventsManager.getMouseInfo();
@@ -1482,7 +1482,7 @@ int ThreadResource::doInterface() {
 				_vm->checkTransition();
 				_vm->_eventsManager._leftClick = true;
 			} else {
-				_vm->_voy._field478 = 1;
+				_vm->_voy._eventFlags |= EVTFLAG_1;
 
 				chooseSTAMPButton(20);
 				parsePlayCommands();
@@ -1494,7 +1494,7 @@ int ThreadResource::doInterface() {
 				hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries;
 				_vm->_eventsManager.getMouseInfo();
 
-				_vm->_voy._field478 &= ~2;
+				_vm->_voy._eventFlags &= ~2;
 				_vm->_eventsManager._intPtr.field1E = 1;
 				_vm->_eventsManager._intPtr.field1A = 0;
 			}
@@ -1503,7 +1503,7 @@ int ThreadResource::doInterface() {
 		(!_vm->_eventsManager._leftClick || regionIndex == -1));
 
 	_vm->_eventsManager.hideCursor();
-	_vm->_voy._field478 |= 1;
+	_vm->_voy._eventFlags |= EVTFLAG_1;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
 	if (_vm->_currentVocId != -1)
 		_vm->_soundManager.stopVOCPlay();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index ebe8a50..bf73822 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -959,7 +959,7 @@ void GraphicsManager::resetPalette() {
 	for (int i = 0; i < 256; ++i)
 		setColor(i, 0, 0, 0);
 
-	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 }
 
@@ -989,7 +989,7 @@ void GraphicsManager::setColors(int start, int count, const byte *pal) {
 		}
 	}
 
-	_vm->_eventsManager._intPtr.field38 = true;
+	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 }
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 4d3f235..9f941bc 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -42,7 +42,6 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_bVoy = NULL;
 	_iForceDeath = -1;
 	_controlPtr = NULL;
-	_bob = false;
 	_stampFlags = 0;
 	_playStampGroupId = _currentVocId = 0;
 	_audioVideoId = -1;
@@ -70,7 +69,7 @@ Common::Error VoyeurEngine::run() {
 	_eventsManager.resetMouse();
 	if (doHeadTitle()) {
 		if (_iForceDeath >= 1 && _iForceDeath <= 4)
-			_voy._field478 |= 0x80;
+			_voy._eventFlags |= 0x80;
 
 		playStamp();
 		if (!shouldQuit())
@@ -118,11 +117,11 @@ void VoyeurEngine::globalInitBolt() {
 	assert(_graphicsManager._fontPtr->_curFont);
 
 	// Setup default flags
-	_voy._field478 = 1;
+	_voy._eventFlags = EVTFLAG_1;
 	_voy._field4376 = _voy._field4378 = 127;
 	_voy._field4F2 = 9999;
 	_voy._aptLoadMode = -1;
-	_voy._field478 = 256;
+	_voy._eventFlags |= EVTFLAG_100;
 	
 	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
 	_eventsManager.addFadeInt();
@@ -179,7 +178,7 @@ bool VoyeurEngine::doHeadTitle() {
 			_eventsManager._mouseClicked = false;
 		}
 	*/
-		if (_voy._field478 & 0x80) {
+		if (_voy._eventFlags & 0x80) {
 			// Add initial game event set
 			if (_voy._eventCount <= 1)
 				_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
@@ -275,7 +274,7 @@ bool VoyeurEngine::doLock() {
 		_eventsManager.setCursor(cursorPic);
 		_eventsManager.showCursor();
 
-		_eventsManager._intPtr. field38 = true;
+		_eventsManager._intPtr. _palChanged = true;
 		_eventsManager._intPtr._hasPalette = true;
 
 		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
@@ -326,7 +325,7 @@ bool VoyeurEngine::doLock() {
 					}
 
 					_eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
-					_eventsManager._intPtr.field38 = true;
+					_eventsManager._intPtr._palChanged = true;
 					_eventsManager._intPtr._hasPalette = true;
 
 					_eventsManager.delay(1);
@@ -457,19 +456,19 @@ void VoyeurEngine::doOpening() {
 	_voy._vocSecondsOffset = 0;
 	_voy._RTVNum = 0;
 	_voy._field468 = _voy._RTVNum;
-	_voy._field478 = 16;
+	_voy._eventFlags = 16;
 	_gameHour = 4;
 	_gameMinute  = 0;
 	_audioVideoId = 1;
 	_eventsManager._videoDead = -1;
 	_voy.addVideoEventStart();
 
-	_voy._field478 &= ~1;
+	_voy._eventFlags &= ~EVTFLAG_1;
 
 	for (int i = 0; i < 256; ++i)
 		_graphicsManager.setColor(i, 8, 8, 8);
 
-	_eventsManager._intPtr.field38 = 1;
+	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort();
 	flipPageAndWait();
@@ -499,9 +498,9 @@ void VoyeurEngine::doOpening() {
 	if ((_voy._RTVNum - _voy._field468) < 2)
 		_eventsManager.delay(60);
 
-	_voy._field478 |= 1;
+	_voy._eventFlags |= EVTFLAG_1;
 	_voy.addVideoEventEnd();
-	_voy._field478 &= 0x10;
+	_voy._eventFlags &= EVTFLAG_RECORDING;
 
 	_bVoy->freeBoltGroup(0x200);
 }
@@ -553,6 +552,9 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
 	_eventsManager.getMouseInfo();
+	if (!_voy._fadeICF0)
+		_eventsManager.startCursorBlink();
+
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked &&
 			(decoder.getCurFrame() < endFrame)) {
 		if (decoder.needsUpdate()) {
@@ -560,6 +562,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 
 			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
+			_graphicsManager.drawDot();
 		}
 
 		if (decoder.hasDirtyPalette()) {
@@ -574,14 +577,14 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 
 	// RL2 finished
 	_graphicsManager.screenReset();
-	_voy._field478 &= ~0x10;
+	_voy._eventFlags &= ~EVTFLAG_RECORDING;
 
-	if (_voy._field478 & 8) {
+	if (_voy._eventFlags & EVTFLAG_8) {
 		assert(pic);
 		byte *imgData = (*_graphicsManager._vPort)->_currentPic->_imgData;
 		(*_graphicsManager._vPort)->_currentPic->_imgData = pic->_imgData;
 		pic->_imgData = imgData;
-		_voy._field478 &= ~8;
+		_voy._eventFlags &= ~EVTFLAG_8;
 	}
 }
 
@@ -596,32 +599,32 @@ void VoyeurEngine::playAudio(int audioId) {
 	_graphicsManager._backColors->startFade();
 	flipPageAndWaitForFade();
 
-	_voy._field478 &= ~1;
+	_voy._eventFlags &= ~EVTFLAG_1;
 	_soundManager.setVOCOffset(_voy._vocSecondsOffset);
 	Common::String filename = _soundManager.getVOCFileName(
 		audioId + 159);
 	_soundManager.startVOCPlay(filename);
-	_voy._field478 |= 16;
+	_voy._eventFlags |= EVTFLAG_RECORDING;
 	_eventsManager.startCursorBlink();
 
 	while (!shouldQuit() && !_eventsManager._mouseClicked && 
 			_soundManager.getVOCStatus())
 		_eventsManager.delayClick(1);
 
-	_voy._field478 |= 1;
+	_voy._eventFlags |= EVTFLAG_1;
 	_soundManager.stopVOCPlay();
 
 	_bVoy->freeBoltGroup(0x7F00);
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 
-	_voy._field478 &= ~0x10;
+	_voy._eventFlags &= ~EVTFLAG_RECORDING;
 	_voy._field470 = 129;
 }
 
 void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
 	_graphicsManager.setColor(128, 16, 16, 16);
 	_graphicsManager.setColor(224, 220, 220, 220);
-	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
@@ -761,7 +764,6 @@ Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc)
 void VoyeurEngine::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_glGoScene);
 	s.syncAsSint16LE(_glGoStack);
-	s.syncAsSint16LE(_bob);
 	s.syncAsSint16LE(_stampFlags);
 	s.syncAsSint16LE(_playStampGroupId);
 	s.syncAsSint16LE(_currentVocId);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index a79ec5b..907ebcf 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -172,7 +172,6 @@ public:
 	BoltGroup *_stackGroupPtr;
 	int _glGoScene;
 	int _glGoStack;
-	bool _bob;
 	int _stampFlags;
 	int _playStampGroupId;
 	int _currentVocId;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index a95355e..4256869 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -53,7 +53,7 @@ void VoyeurEngine::playStamp() {
 
 		_mainThread->parsePlayCommands();
 
-		bool flag = breakFlag = (_voy._field478 & 2) != 0;
+		bool flag = breakFlag = (_voy._eventFlags & EVTFLAG_2) != 0;
 		 
 		switch (_voy._field470) {
 		case 5:
@@ -65,19 +65,19 @@ void VoyeurEngine::playStamp() {
 					_voy._aptLoadMode = 140;
 					break;
 				case 1:
-					_voy._field478 &= ~1;
+					_voy._eventFlags &= ~EVTFLAG_1;
 					_voy._field46E = true;
 					_mainThread->chooseSTAMPButton(22);
 					_voy._aptLoadMode = 143;
 					break;
 				case 2:
-					_voy._field478 &= ~1;
+					_voy._eventFlags &= ~EVTFLAG_1;
 					reviewTape();
 					_voy._field46E = true;
 					_voy._aptLoadMode = 142;
 					break;
 				case 3:
-					_voy._field478 &= ~1;
+					_voy._eventFlags &= ~EVTFLAG_1;
 					_mainThread->chooseSTAMPButton(21);
 					break;
 				case 4:
@@ -87,7 +87,7 @@ void VoyeurEngine::playStamp() {
 					doGossip();
 					_voy._field46E = true;
 					_voy._aptLoadMode = 141;
-					_voy._field478 &= ~0x100;
+					_voy._eventFlags &= ~EVTFLAG_100;
 					break;
 				default:
 					break;
@@ -133,7 +133,7 @@ void VoyeurEngine::playStamp() {
 
 			if (_voy._videoEventId != -1) {
 				playAVideoEvent(_voy._videoEventId);
-				_voy._field478 &= ~0x10;
+				_voy._eventFlags &= ~EVTFLAG_RECORDING;
 			}
 
 			_mainThread->chooseSTAMPButton(0);
@@ -279,7 +279,7 @@ void VoyeurEngine::doClosingCredits() {
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	_graphicsManager.setColor(1, 180, 180, 180);
 	_graphicsManager.setColor(2, 200, 200, 200);
-	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 
 	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x402)._fontResource;
@@ -383,7 +383,7 @@ void VoyeurEngine::doPiracy() {
 	_graphicsManager.screenReset();
 	_graphicsManager.setColor(1, 0, 0, 0);
 	_graphicsManager.setColor(2, 255, 255, 255);
-	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	(*_graphicsManager._vPort)->fillPic(1);
@@ -453,7 +453,7 @@ void VoyeurEngine::reviewTape() {
 		_graphicsManager.setColor(12, 120, 248, 120);
 		_eventsManager.setCursorColor(128, 1);
 
-		_eventsManager._intPtr.field38 = true;
+		_eventsManager._intPtr._palChanged = true;
 		_eventsManager._intPtr._hasPalette = true;
 		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
 		_graphicsManager._fontPtr->_fontSaveBack = false;
@@ -574,17 +574,17 @@ void VoyeurEngine::reviewTape() {
 					_eventsManager.getMouseInfo();
 					foundIndex = -1;
 				}
-			} else if ((_voy._field478 & 0x40) && _voy._viewBounds->left == pt.x &&
+			} else if ((_voy._eventFlags & EVTFLAG_40) && _voy._viewBounds->left == pt.x &&
 					_voy._viewBounds->bottom == pt.y) {
 				foundIndex = 999;
-			} else if ((_voy._field478 & 0x40) && _voy._viewBounds->left == pt.x &&
+			} else if ((_voy._eventFlags & EVTFLAG_40) && _voy._viewBounds->left == pt.x &&
 					_voy._viewBounds->top == pt.y) {
 				foundIndex = 998;
 			} else {
 				_eventsManager.setCursorColor(128, (foundIndex == -1) ? 0 : 1);
 			}
 
-			_eventsManager._intPtr.field38 = true;
+			_eventsManager._intPtr._palChanged = true;
 			_eventsManager._intPtr._hasPalette = true;
 
 			if (_eventsManager._mouseClicked || _eventsManager._mouseUnk) {
@@ -635,7 +635,7 @@ void VoyeurEngine::reviewTape() {
 
 			pt = _eventsManager.getMousePos();
 			if (_eventsManager._mouseClicked && _voy._viewBounds->left == pt.x &&
-					(_voy._field478 & 0x40) && _eventsManager._rightClick) {
+					(_voy._eventFlags & EVTFLAG_40) && _eventsManager._rightClick) {
 				WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
 				foundIndex = -1;
 				_eventsManager._rightClick = 0;
@@ -683,7 +683,7 @@ void VoyeurEngine::reviewTape() {
 
 			_eventsManager._intPtr.field1E = 1;
 			_eventsManager._intPtr.field1A = 0;
-			_voy._field478 &= ~1;
+			_voy._eventFlags &= ~EVTFLAG_1;
 
 			// Play suond for the given duration
 			_soundManager.setVOCOffset(_voy._vocSecondsOffset);
@@ -697,7 +697,7 @@ void VoyeurEngine::reviewTape() {
 				_eventsManager.delay(10);
 			}
 
-			_voy._field478 |= 1;
+			_voy._eventFlags |= EVTFLAG_1;
 			_soundManager.stopVOCPlay();
 			_bVoy->freeBoltGroup(0x7F00);
 			break;
@@ -902,11 +902,11 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 	_audioVideoId = evt._audioVideoId;
 	_voy._vocSecondsOffset = evt._computerOn;
 	_eventsManager._videoDead = evt._dead;
-	_voy._field478 &= ~1;
+	_voy._eventFlags &= ~EVTFLAG_1;
 	
 	playAVideoDuration(_audioVideoId, evt._computerOff);
 
-	_voy._field478 |= 1;
+	_voy._eventFlags |= EVTFLAG_1;
 	if (_eventsManager._videoDead != -1) {
 		_bVoy->freeBoltGroup(0xE00);
 		_eventsManager._videoDead = -1;
@@ -1023,7 +1023,7 @@ void VoyeurEngine::makeViewFinder() {
 	_graphicsManager.setColor(243, 105, 105, 105);
 	_graphicsManager.setColor(palOffset + 241, 219, 235, 235);
 
-	_eventsManager._intPtr.field38 = true;
+	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 }
 
@@ -1283,7 +1283,7 @@ void VoyeurEngine::doTimeBar(bool force) {
 		(*_graphicsManager._vPort)->sFillBox(6, fullHeight - 92);
 		if (height > 0) {
 			_graphicsManager.setColor(215, 238, 238, 238);
-			_eventsManager._intPtr.field38 = true;
+			_eventsManager._intPtr._palChanged = true;
 			_eventsManager._intPtr._hasPalette = true;
 
 			_graphicsManager._drawPtr->_penColor = 215;
@@ -1305,7 +1305,7 @@ void VoyeurEngine::flashTimeBar(){
 		else
 			_graphicsManager.setColor(240, 220, 220, 220);
 		
-		_eventsManager._intPtr.field38 = true;
+		_eventsManager._intPtr._palChanged = true;
 		_eventsManager._intPtr._hasPalette = true;
 		_flashTimeFlag = !_flashTimeFlag;
 	}


Commit: a2b77b665e7af8c5b18494ccc7af2522cbac6380
    https://github.com/scummvm/scummvm/commit/a2b77b665e7af8c5b18494ccc7af2522cbac6380
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T09:48:46-08:00

Commit Message:
VOYEUR: Fix for loading in blocks from file correctly when decompressing data

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index b5f6fb9..05e3fee 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -163,14 +163,14 @@ byte *BoltFilesState::decompress(byte *buf, int size, int mode) {
 #undef NEXT_BYTE
 
 void BoltFilesState::nextBlock() {
-	if (&_curLibPtr->_file != _curFd || _curFilePosition != _bufferEnd)
+	if (&_curLibPtr->_file != _curFd || _curFd->pos() != _bufferEnd)
 		_curLibPtr->_file.seek(_bufferEnd);
 
 	_curFd = &_curLibPtr->_file;
 	_bufferBegin = _bufferEnd;
 	int bytesRead = _curFd->read(_bufStart, _bufSize);
 
-	_bufferEnd = _curFilePosition = _bufferBegin + bytesRead;
+	_bufferEnd = _curFilePosition = _curFd->pos();
 	_bytesLeft = bytesRead - 1;
 	_bufPos = _bufStart;
 }


Commit: a518102b21c7704c5d67a764b20973188e881932
    https://github.com/scummvm/scummvm/commit/a518102b21c7704c5d67a764b20973188e881932
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T11:15:59-08:00

Commit Message:
VOYEUR: Fix for crash in playAudio

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 9f941bc..2c6e5eb 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -591,9 +591,9 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 void VoyeurEngine::playAudio(int audioId) {
 	_bVoy->getBoltGroup(0x7F00);
 	_graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 + 
-		BLIND_TABLE[audioId])._picResource;
+		BLIND_TABLE[audioId] * 2)._picResource;
 	_graphicsManager._backColors = _bVoy->boltEntry(0x7F01 + 
-		BLIND_TABLE[audioId])._cMapResource;
+		BLIND_TABLE[audioId] * 2)._cMapResource;
 
 	(*_graphicsManager._vPort)->setupViewPort();
 	_graphicsManager._backColors->startFade();


Commit: d545b5cb75b31fc72ea14e508c04a60499c4cc4d
    https://github.com/scummvm/scummvm/commit/d545b5cb75b31fc72ea14e508c04a60499c4cc4d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T11:41:18-08:00

Commit Message:
VOYEUR: Fix incorrect loop terminator in room data load loop

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 5ea450e..409031d 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -181,7 +181,7 @@ void ThreadResource::getButtonsFlags() {
 void ThreadResource::getField1CE() {
 	int idx = 0;
 	
-	for (const byte *p = _threadInfoPtr; *p++ != 0x49; p = getNextRecord(p)) {
+	for (const byte *p = _threadInfoPtr; *p++ != 0x4A; p = getNextRecord(p)) {
 		assert(idx < 47);
 		_field1CE[idx++] = getRecordOffset(p);
 		_field1CE[idx] = NULL;


Commit: 3fab3ebdcf992e505be4cdd7b60fdea57754049a
    https://github.com/scummvm/scummvm/commit/3fab3ebdcf992e505be4cdd7b60fdea57754049a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T12:06:53-08:00

Commit Message:
VOYEUR: Fix clearing computer screen when viewing a computer event

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 4256869..1e81920 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1221,7 +1221,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
 					yp += 10;
 				} else {
 					_eventsManager.delay(90);
-					_graphicsManager._drawPtr->_pos = Common::Point(54, 96);
+					_graphicsManager._drawPtr->_pos = Common::Point(96, 54);
 					_graphicsManager._drawPtr->_penColor = 255;
 					(*_graphicsManager._vPort)->sFillBox(196, 124);
 					yp = 60;


Commit: d536c0afb2e09e106b94554d484e2930e421d472
    https://github.com/scummvm/scummvm/commit/d536c0afb2e09e106b94554d484e2930e421d472
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T12:15:30-08:00

Commit Message:
VOYEUR: Fix another incorrect rectangle fill when viewing computer text

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1e81920..e986118 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1204,7 +1204,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
 			if (c == '\0') {
 				if (showEnd) {
 					_eventsManager.delay(90);
-					_graphicsManager._drawPtr->_pos = Common::Point(54, 96);
+					_graphicsManager._drawPtr->_pos = Common::Point(96, 54);
 					_graphicsManager._drawPtr->_penColor = 254;
 					(*_graphicsManager._vPort)->sFillBox(196, 124);
 					_graphicsManager._fontPtr->_justify = ALIGN_LEFT;


Commit: 63a06bc3f74f4951d7a0c12601a54367f15af36f
    https://github.com/scummvm/scummvm/commit/63a06bc3f74f4951d7a0c12601a54367f15af36f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T14:33:42-08:00

Commit Message:
VOYEUR: Refactored code for showing ending news into separate method

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 409031d..36b3376 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -647,53 +647,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 15:
-			_vm->_playStampGroupId = (_vm->_voy._field4382 - 1) * 8 + 0x7700;
-			_vm->_voy._field47A = ((READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) 
-				- 1) << 8) + 0x7B00;
-
-			pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
-			_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
-
-			(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
-			_cmd14Pal->startFade();
-			_vm->flipPageAndWaitForFade();
-
-			_vm->_eventsManager.getMouseInfo();
-
-			for (int idx = 1; idx < 4; ++idx) {
-				if (idx == 3) {
-					pic = _vm->_bVoy->boltEntry(_vm->_voy._field47A)._picResource;
-					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_voy._field47A + 1)._cMapResource;
-				} else {
-					pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + idx * 2)._picResource;
-					_cmd14Pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + idx * 2 + 1)._cMapResource;
-				}
-
-				(*_vm->_graphicsManager._vPort)->setupViewPort(pic);
-				_cmd14Pal->startFade();
-				_vm->flipPageAndWaitForFade();
-
-				_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + (idx - 1) * 2);
-				_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + (idx - 1) * 2 + 1);
-
-				Common::String fname = Common::String::format("news%d.voc", idx);
-
-				while (!_vm->shouldQuit() && !_vm->_eventsManager._mouseClicked && 
-						_vm->_soundManager.getVOCStatus())
-					_vm->_eventsManager.delay(1);
-
-				_vm->_soundManager.stopVOCPlay();
-				if (idx == 3)
-					_vm->_eventsManager.delay(3);
-
-				if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked)
-					break;
-			}
-
-			_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
-			_vm->_bVoy->freeBoltGroup(_vm->_voy._field47A);
-			_vm->_playStampGroupId = -1;
-			_vm->_voy._field47A = -1;
+			_vm->showEndingNews();
 			break;
 
 		case 16:
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index bf73822..958eb31 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -460,9 +460,34 @@ error("TODO: var22/var24/var2C not initialised before use?");
 						srcP = srcImgData;
 
 						if (isClipped) {
-							// loc_26424
-							error("TODO: sDrawPic");
+							var22 = (var22 < 0) ? -var22 : 0;
+							var26 = var22 + width2;
+							var24 = (var24 < 0) ? -var24 : 0;
+							width2 = srcPic->_bounds.width();
+							height1 = var24 + height1;
+
+							for (int yp = 0; yp < height1; ++yp) {
+								byteVal2 = 0;
+								for (int xp = 0; xp < width2; ++xp) {
+									if (!byteVal2) {
+										pixel = *srcP++;
+										if (pixel & 0x80) {
+											pixel = 0x7F;
+											byteVal2 = *srcP++;
 
+											if (!byteVal2)
+												byteVal2 = width2;
+										}
+									}
+
+									if (yp >= var24 && xp >= var22 && xp < var26) {
+										*destP++ = pixel;
+									}
+								}
+
+								if (yp >= var24)
+									destP += widthDiff2;
+							}
 						} else {
 							// loc_26543
 							for (int yp = 0; yp < height1; ++yp) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 2c6e5eb..d4a9475 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -562,7 +562,8 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 
 			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
-			_graphicsManager.drawDot();
+			if (_voy._eventFlags & EVTFLAG_RECORDING)
+				_graphicsManager.drawDot();
 		}
 
 		if (decoder.hasDirtyPalette()) {
@@ -675,6 +676,63 @@ void VoyeurEngine::flipPageAndWaitForFade() {
 		_eventsManager.delay(1);
 }
 
+void VoyeurEngine::showEndingNews() {
+	_playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700;
+	_voy._field47A = (READ_LE_UINT16(_controlPtr->_ptr + 4) 
+		- 1) * 256 + 0x7B00;
+
+	_bVoy->getBoltGroup(_playStampGroupId);
+	_bVoy->getBoltGroup(_voy._field47A);
+
+	PictureResource *pic = _bVoy->boltEntry(_playStampGroupId)._picResource;
+	CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
+
+	(*_graphicsManager._vPort)->setupViewPort(pic);
+	pal->startFade();
+	flipPageAndWaitForFade();
+
+	_eventsManager.getMouseInfo();
+
+	for (int idx = 1; idx < 4; ++idx) {
+		if (idx == 3) {
+			pic = _bVoy->boltEntry(_voy._field47A)._picResource;
+			pal = _bVoy->boltEntry(_voy._field47A + 1)._cMapResource;
+		} else {
+			pic = _bVoy->boltEntry(_playStampGroupId + idx * 2)._picResource;
+			pal = _bVoy->boltEntry(_playStampGroupId + idx * 2 + 1)._cMapResource;
+		}
+
+		(*_graphicsManager._vPort)->setupViewPort(pic);
+		pal->startFade();
+		flipPageAndWaitForFade();
+
+		_bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2);
+		_bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2 + 1);
+
+		Common::String fname = Common::String::format("news%d.voc", idx);
+		_soundManager.startVOCPlay(fname);
+
+		_eventsManager.getMouseInfo();
+		while (!shouldQuit() && !_eventsManager._mouseClicked && 
+				_soundManager.getVOCStatus()) {
+			_eventsManager.delay(1);
+			_eventsManager.getMouseInfo();
+		}
+
+		_soundManager.stopVOCPlay();
+		if (idx == 3)
+			_eventsManager.delay(3);
+
+		if (shouldQuit() || _eventsManager._mouseClicked)
+			break;
+	}
+
+	_bVoy->freeBoltGroup(_playStampGroupId);
+	_bVoy->freeBoltGroup(_voy._field47A);
+	_playStampGroupId = -1;
+	_voy._field47A = -1;
+}
+
 /*------------------------------------------------------------------------*/
 
 Common::String VoyeurEngine::generateSaveName(int slot) {
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 907ebcf..a0d2e95 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -286,6 +286,11 @@ public:
 	 * Returns the string for the current in-game time of day
 	 */
 	Common::String getTimeOfDay();
+
+	/**
+	 * Show the ending sequence of the arrest
+	 */
+	void showEndingNews();
 };
 
 #define VOYEUR_SAVEGAME_VERSION 1


Commit: 9c3216c301503c1fc42d020b293d36781d6d20a4
    https://github.com/scummvm/scummvm/commit/9c3216c301503c1fc42d020b293d36781d6d20a4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T15:22:34-08:00

Commit Message:
VOYEUR: Graphical fixes for clipped variations within sDrawPic

Changed paths:
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 958eb31..af83dbf 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -140,6 +140,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	bool isClipped = false;
 	int var26;
 	byte pixel = 0;
+	int runLength;
 
 	byte *srcImgData, *destImgData;
 	byte *srcP, *destP;
@@ -375,38 +376,30 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 						srcP = srcImgData;
 						if (isClipped) {
 							// loc_26199
-error("TODO: var22/var24/var2C not initialised before use?");
-							if (var22 < 0) {
-								var22 = -var22;
-							} else {
-								var22 = 0;
-							}
+							var22 = (var22 < 0) ? -var22 : 0;
 							var26 = var22 + width2;
-							if (var24 < 0) {
-								var24 = -var24;
-							} else {
-								var24 = 0;
-							}
+							var24 = (var24 < 0) ? -var24 : 0;
 
 							width2 = srcPic->_bounds.width();
 							height1 = var24 + height1;
-							byteVal = 0;
 							
 							for (int yp = 0; yp < height1; ++yp) {
-								for (int xp = 0; xp < width2; ++xp) {
-									if (byteVal2 <= 0) {
-										byteVal = *srcP++;
-										if (byteVal & 0x80) {
-											byteVal &= 0x7f;
-											byteVal2 = *srcP++;
-											if (!byteVal2)
-												byteVal2 = width2;
+								runLength = 0;
+
+								for (int xp = 0; xp < width2; ++xp, --runLength) {
+									if (runLength <= 0) {
+										pixel = *srcP++;
+										if (pixel & 0x80) {
+											pixel &= 0x7f;
+											runLength = *srcP++;
+											if (!runLength)
+												runLength = width2;
 										}
 									}
 
 									if (yp >= var24 && xp >= var22 && xp < var26) {
-										if (byteVal > 0)
-											*destP = byteVal;
+										if (pixel > 0)
+											*destP = pixel;
 										++destP;
 									}
 								}
@@ -460,6 +453,7 @@ error("TODO: var22/var24/var2C not initialised before use?");
 						srcP = srcImgData;
 
 						if (isClipped) {
+							// loc_26424
 							var22 = (var22 < 0) ? -var22 : 0;
 							var26 = var22 + width2;
 							var24 = (var24 < 0) ? -var24 : 0;
@@ -467,16 +461,16 @@ error("TODO: var22/var24/var2C not initialised before use?");
 							height1 = var24 + height1;
 
 							for (int yp = 0; yp < height1; ++yp) {
-								byteVal2 = 0;
-								for (int xp = 0; xp < width2; ++xp) {
-									if (!byteVal2) {
+								runLength = 0;
+								for (int xp = 0; xp < width2; ++xp, --runLength) {
+									if (runLength <= 0) {
 										pixel = *srcP++;
 										if (pixel & 0x80) {
-											pixel = 0x7F;
-											byteVal2 = *srcP++;
+											pixel &= 0x7F;
+											runLength = *srcP++;
 
-											if (!byteVal2)
-												byteVal2 = width2;
+											if (!runLength)
+												runLength = width2;
 										}
 									}
 
@@ -591,15 +585,15 @@ error("TODO: var22/var24/var2C not initialised before use?");
 								height1 = var24 + height1;
 
 								for (int yp = 0; yp < height1; ++yp) {
-									int byteVal2 = 0;
-									for (int xp = 0; xp < width2; ++xp, --byteVal2) {
-										if (byteVal2 <= 0) {
+									int runLength = 0;
+									for (int xp = 0; xp < width2; ++xp, --runLength) {
+										if (runLength <= 0) {
 											pixel = *srcP++;
 											if (pixel & 0x80) {
 												pixel &= 0x7F;
-												byteVal2 = *srcP++;
-												if (!byteVal2)
-													byteVal2 = width2;
+												runLength = *srcP++;
+												if (!runLength)
+													runLength = width2;
 											}
 										}
 
@@ -664,16 +658,16 @@ error("TODO: var22/var24/var2C not initialised before use?");
 							height1 = var24 + height1;
 
 							for (int yp = 0; yp < height1; ++yp) {
-								byteVal2 = 0;
-								for (int xp = 0; xp < width2; ++xp) {
-									if (!byteVal2) {
+								runLength = 0;
+								for (int xp = 0; xp < width2; ++xp, --runLength) {
+									if (runLength <= 0) {
 										pixel = *srcP++;
 										if (pixel & 0x80) {
-											pixel = 0x7F;
-											byteVal2 = *srcP++;
+											pixel &= 0x7F;
+											runLength = *srcP++;
 
-											if (!byteVal2)
-												byteVal2 = width2;
+											if (!runLength)
+												runLength = width2;
 										}
 									}
 
@@ -736,16 +730,16 @@ error("TODO: var22/var24/var2C not initialised before use?");
 								height1 = var24 + height1;
 
 								for (int yp = 0; yp < height1; ++yp) {
-									byteVal2 = 0;
+									runLength = 0;
 
-									for (int xp = 0; xp < width2; ++xp, --byteVal2) {
-										if (!byteVal2) {
+									for (int xp = 0; xp < width2; ++xp, --runLength) {
+										if (runLength <= 0) {
 											pixel = *srcP++;
 											if (pixel & 0x80) {
 												pixel &= 0x7F;
-												byteVal2 = *srcP++;
-												if (!byteVal2)
-													byteVal2 = width2;
+												runLength = *srcP++;
+												if (!runLength)
+													runLength = width2;
 											}
 										}
 
@@ -817,16 +811,16 @@ error("TODO: var22/var24/var2C not initialised before use?");
 								height1 = var24 + height1;
 
 								for (int yp = 0; yp < height1; ++yp) {
-									byteVal2 = 0;
+									runLength = 0;
 
-									for (int xp = 0; xp < width2; ++xp, --byteVal2) {
-										if (!byteVal2) {
+									for (int xp = 0; xp < width2; ++xp, --runLength) {
+										if (runLength <= 0) {
 											pixel = *srcP++;
 											if (pixel & 0x80) {
 												pixel &= 0x7F;
-												byteVal2 = *srcP++;
-												if (!byteVal2)
-													byteVal2 = width2;
+												runLength = *srcP++;
+												if (!runLength)
+													runLength = width2;
 											}
 										}
 


Commit: 2b69c5d07cb72b97690517cdf1f9d3d40f172029
    https://github.com/scummvm/scummvm/commit/2b69c5d07cb72b97690517cdf1f9d3d40f172029
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T15:42:45-08:00

Commit Message:
VOYEUR: Fix issue with time not progressing, and renamed associated enum member

Changed paths:
    engines/voyeur/data.h
    engines/voyeur/events.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 8b561e9..2dc1221 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -34,7 +34,7 @@ namespace Voyeur {
 enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
 	EVTYPE_COMPUTER = 4 };
 
-enum EventFlag { EVTFLAG_1 = 1, EVTFLAG_2 = 2, EVTFLAG_8 = 8, EVTFLAG_RECORDING = 0x10,
+enum EventFlag { EVTFLAG_TIME_DISABLED = 1, EVTFLAG_2 = 2, EVTFLAG_8 = 8, EVTFLAG_RECORDING = 0x10,
 	EVTFLAG_40 = 0x40, EVTFLAG_100 = 0x100 };
 
 struct VoyeurEvent {
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 3fe37ca..4734b1e 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -102,7 +102,7 @@ void EventsManager::startMainClockInt() {
 }
 
 void EventsManager::mainVoyeurIntFunc() {
-	if (!(_vm->_voy._eventFlags & EVTFLAG_1)) {
+	if (!(_vm->_voy._eventFlags & EVTFLAG_TIME_DISABLED)) {
 		++_vm->_voy._switchBGNum;
 
 		if (_vm->_debugger._isTimeActive) {
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 36b3376..6c39a97 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -410,12 +410,12 @@ void ThreadResource::parsePlayCommands() {
 				} else {
 					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
 					_vm->_voy.addVideoEventStart();
-					_vm->_voy._eventFlags &= ~EVTFLAG_1;
+					_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 					_vm->_voy._eventFlags |= EVTFLAG_RECORDING;
 					_vm->playAVideo(_vm->_audioVideoId);
 
 					_vm->_voy._eventFlags &= ~EVTFLAG_RECORDING;
-					_vm->_voy._eventFlags |= EVTFLAG_1;
+					_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 					_vm->_voy.addVideoEventEnd();
 					_vm->_eventsManager.incrementTime(1);
 				
@@ -454,9 +454,9 @@ void ThreadResource::parsePlayCommands() {
 
 			_vm->_voy._vocSecondsOffset = 0;
 			_vm->_voy._field468 = _vm->_voy._RTVNum;
-			_vm->_voy._eventFlags &= ~(EVTFLAG_1 | EVTFLAG_RECORDING);
+			_vm->_voy._eventFlags &= ~(EVTFLAG_TIME_DISABLED | EVTFLAG_RECORDING);
 			_vm->playAVideo(_vm->_audioVideoId);
-			_vm->_voy._eventFlags |= EVTFLAG_1;
+			_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 
 			if (id != 22) {
 				_vm->_audioVideoId = -1;
@@ -1115,7 +1115,7 @@ void ThreadResource::doRoom() {
 
 	voy._vocSecondsOffset = 0;
 	vm._soundManager.startVOCPlay(vm._currentVocId);
-	voy._eventFlags &= ~EVTFLAG_1;
+	voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
 	bool breakFlag = false;
 	while (!vm.shouldQuit() && !breakFlag) {
@@ -1248,7 +1248,7 @@ void ThreadResource::doRoom() {
 		}
 	}
 
-	voy._eventFlags = EVTFLAG_1;
+	voy._eventFlags = EVTFLAG_TIME_DISABLED;
 	vm._eventsManager.incrementTime(1);
 	voy._viewBounds = nullptr;
 	voy._field437E = 0;
@@ -1277,7 +1277,7 @@ int ThreadResource::doInterface() {
 	PictureResource *pic;
 	Common::Point pt;
 
-	_vm->_voy._eventFlags |= EVTFLAG_1;
+	_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 	if (_vm->_voy._field46E) {
 		_vm->_voy._field46E = false;
 		return -2;
@@ -1298,14 +1298,14 @@ int ThreadResource::doInterface() {
 
 		_vm->initIFace();
 		_vm->_voy._RTVNum = _vm->_voy._RTVLimit - 4;
-		_vm->_voy._eventFlags &= ~EVTFLAG_1;
+		_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
 		while (!_vm->shouldQuit() && _vm->_voy._RTVNum < _vm->_voy._RTVLimit) {
 			_vm->flashTimeBar();
 			_vm->_eventsManager.delayClick(1);
 		}
 
-		_vm->_voy._eventFlags |= EVTFLAG_1;
+		_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 		chooseSTAMPButton(20);
 		parsePlayCommands();
 	}
@@ -1327,7 +1327,7 @@ int ThreadResource::doInterface() {
 	_vm->_graphicsManager.setColor(240, 220, 220, 220);
 	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
-	_vm->_voy._eventFlags &= ~EVTFLAG_1;
+	_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
 	// Set the cusor 
 	PictureResource *crosshairsCursor = _vm->_bVoy->boltEntry(0x112)._picResource;
@@ -1436,7 +1436,7 @@ int ThreadResource::doInterface() {
 				_vm->checkTransition();
 				_vm->_eventsManager._leftClick = true;
 			} else {
-				_vm->_voy._eventFlags |= EVTFLAG_1;
+				_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 
 				chooseSTAMPButton(20);
 				parsePlayCommands();
@@ -1448,7 +1448,7 @@ int ThreadResource::doInterface() {
 				hotspots = &_vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._rectResource->_entries;
 				_vm->_eventsManager.getMouseInfo();
 
-				_vm->_voy._eventFlags &= ~2;
+				_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 				_vm->_eventsManager._intPtr.field1E = 1;
 				_vm->_eventsManager._intPtr.field1A = 0;
 			}
@@ -1457,7 +1457,7 @@ int ThreadResource::doInterface() {
 		(!_vm->_eventsManager._leftClick || regionIndex == -1));
 
 	_vm->_eventsManager.hideCursor();
-	_vm->_voy._eventFlags |= EVTFLAG_1;
+	_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 	_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
 	if (_vm->_currentVocId != -1)
 		_vm->_soundManager.stopVOCPlay();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index d4a9475..27a45d8 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -117,7 +117,7 @@ void VoyeurEngine::globalInitBolt() {
 	assert(_graphicsManager._fontPtr->_curFont);
 
 	// Setup default flags
-	_voy._eventFlags = EVTFLAG_1;
+	_voy._eventFlags = EVTFLAG_TIME_DISABLED;
 	_voy._field4376 = _voy._field4378 = 127;
 	_voy._field4F2 = 9999;
 	_voy._aptLoadMode = -1;
@@ -463,7 +463,7 @@ void VoyeurEngine::doOpening() {
 	_eventsManager._videoDead = -1;
 	_voy.addVideoEventStart();
 
-	_voy._eventFlags &= ~EVTFLAG_1;
+	_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
 	for (int i = 0; i < 256; ++i)
 		_graphicsManager.setColor(i, 8, 8, 8);
@@ -498,7 +498,7 @@ void VoyeurEngine::doOpening() {
 	if ((_voy._RTVNum - _voy._field468) < 2)
 		_eventsManager.delay(60);
 
-	_voy._eventFlags |= EVTFLAG_1;
+	_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 	_voy.addVideoEventEnd();
 	_voy._eventFlags &= EVTFLAG_RECORDING;
 
@@ -600,7 +600,7 @@ void VoyeurEngine::playAudio(int audioId) {
 	_graphicsManager._backColors->startFade();
 	flipPageAndWaitForFade();
 
-	_voy._eventFlags &= ~EVTFLAG_1;
+	_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 	_soundManager.setVOCOffset(_voy._vocSecondsOffset);
 	Common::String filename = _soundManager.getVOCFileName(
 		audioId + 159);
@@ -612,7 +612,7 @@ void VoyeurEngine::playAudio(int audioId) {
 			_soundManager.getVOCStatus())
 		_eventsManager.delayClick(1);
 
-	_voy._eventFlags |= EVTFLAG_1;
+	_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 	_soundManager.stopVOCPlay();
 
 	_bVoy->freeBoltGroup(0x7F00);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index e986118..473224b 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -65,19 +65,19 @@ void VoyeurEngine::playStamp() {
 					_voy._aptLoadMode = 140;
 					break;
 				case 1:
-					_voy._eventFlags &= ~EVTFLAG_1;
+					_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 					_voy._field46E = true;
 					_mainThread->chooseSTAMPButton(22);
 					_voy._aptLoadMode = 143;
 					break;
 				case 2:
-					_voy._eventFlags &= ~EVTFLAG_1;
+					_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 					reviewTape();
 					_voy._field46E = true;
 					_voy._aptLoadMode = 142;
 					break;
 				case 3:
-					_voy._eventFlags &= ~EVTFLAG_1;
+					_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 					_mainThread->chooseSTAMPButton(21);
 					break;
 				case 4:
@@ -683,7 +683,7 @@ void VoyeurEngine::reviewTape() {
 
 			_eventsManager._intPtr.field1E = 1;
 			_eventsManager._intPtr.field1A = 0;
-			_voy._eventFlags &= ~EVTFLAG_1;
+			_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
 			// Play suond for the given duration
 			_soundManager.setVOCOffset(_voy._vocSecondsOffset);
@@ -697,7 +697,7 @@ void VoyeurEngine::reviewTape() {
 				_eventsManager.delay(10);
 			}
 
-			_voy._eventFlags |= EVTFLAG_1;
+			_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 			_soundManager.stopVOCPlay();
 			_bVoy->freeBoltGroup(0x7F00);
 			break;
@@ -902,11 +902,11 @@ void VoyeurEngine::playAVideoEvent(int eventIndex) {
 	_audioVideoId = evt._audioVideoId;
 	_voy._vocSecondsOffset = evt._computerOn;
 	_eventsManager._videoDead = evt._dead;
-	_voy._eventFlags &= ~EVTFLAG_1;
+	_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 	
 	playAVideoDuration(_audioVideoId, evt._computerOff);
 
-	_voy._eventFlags |= EVTFLAG_1;
+	_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 	if (_eventsManager._videoDead != -1) {
 		_bVoy->freeBoltGroup(0xE00);
 		_eventsManager._videoDead = -1;


Commit: 569fa63a3a00cdba1d2e3c87941f300e4bfb1a4d
    https://github.com/scummvm/scummvm/commit/569fa63a3a00cdba1d2e3c87941f300e4bfb1a4d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T16:01:01-08:00

Commit Message:
VOYEUR: Fix for not highlighting camera on Monday morning after loading savegame

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 6c39a97..e99a19f 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1016,15 +1016,20 @@ int ThreadResource::doApt() {
 		hotspotId = -1;
 		pt = _vm->_eventsManager.getMousePos();
 		for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
-			if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right &&
-				pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) {
+			if (hotspots[idx].contains(pt)) {
 				// Cursor is within hotspot area
+
+				// Don't allow the camera to be highlighted on Monday morning.
+				if (idx == 0 && _vm->_voy._transitionId == 17)
+					continue;
+
+				// Set the highlighted hotspot Id
 				hotspotId = idx;
 
 				if (hotspotId != prevHotspotId) {
 					// Check for whether to replace hotspot Id for "Watch TV" for
 					// "Review the Tape" if player has already watched the TV
-					if ((_vm->_voy._eventFlags & 0x100) && (hotspotId == 2))
+					if ((_vm->_voy._eventFlags & EVTFLAG_100) && (hotspotId == 2))
 						hotspotId = 5;
 
 					// Draw the text description for the highlighted hotspot


Commit: ff68d8f89a8d992e51f52549673d4943e0fb998e
    https://github.com/scummvm/scummvm/commit/ff68d8f89a8d992e51f52549673d4943e0fb998e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T16:17:15-08:00

Commit Message:
VOYEUR: Added some comments

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 473224b..634e79c 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -127,27 +127,31 @@ void VoyeurEngine::playStamp() {
 			break;
 
 		case 17:
+			// Called the police, showing the tape
 			doTapePlaying();
 			if (!checkForMurder() && _voy._transitionId <= 15)
 				checkForIncriminate();
 
 			if (_voy._videoEventId != -1) {
+				// Show the found video that is of interest to the police
 				playAVideoEvent(_voy._videoEventId);
 				_voy._eventFlags &= ~EVTFLAG_RECORDING;
 			}
 
+			// Handle response
 			_mainThread->chooseSTAMPButton(0);
 			flag = true;
 			break;
 
 		case 130: {
-			//_tmflag = 1;
+			// user selected to send the tape
 			if (_bVoy->getBoltGroup(_playStampGroupId)) {
 				_graphicsManager._backgroundPage = _bVoy->boltEntry(_playStampGroupId)._picResource;
 				_graphicsManager._backColors = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
 
 				buttonId = getChooseButton();
 				if (_eventsManager._rightClick)
+					// Aborted out of selecting a recipient
 					buttonId = 4;
 
 				_bVoy->freeBoltGroup(_playStampGroupId);


Commit: f88985dc649b81e13490d7f3f949838a9b6680c9
    https://github.com/scummvm/scummvm/commit/f88985dc649b81e13490d7f3f949838a9b6680c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T17:28:24-08:00

Commit Message:
VOYEUR: Added debugger command to show mouse position

Changed paths:
    engines/voyeur/debugger.cpp
    engines/voyeur/debugger.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index 546691b..8fdcf20 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -32,9 +32,12 @@ Debugger::Debugger() : GUI::Debugger() {
 	DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
 	DCmd_Register("exit", WRAP_METHOD(Debugger, Cmd_Exit));
 	DCmd_Register("time", WRAP_METHOD(Debugger, Cmd_Time));
+	DCmd_Register("hotspots", WRAP_METHOD(Debugger, Cmd_Hotspots));
+	DCmd_Register("mouse", WRAP_METHOD(Debugger, Cmd_Mouse));
 
 	// Set fields
 	_isTimeActive = true;
+	_showMousePosition = false;
 }
 
 bool Debugger::Cmd_Time(int argc, const char **argv) {
@@ -90,4 +93,58 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
+	BoltEntry &boltEntry = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1);
+	if (!boltEntry._rectResource) {
+		DebugPrintf("No hotspots available\n");
+	} else {
+		Common::Array<RectEntry> &hotspots = boltEntry._rectResource->_entries;
+
+		for (uint hotspotIdx = 0; hotspotIdx < hotspots.size(); ++hotspotIdx) {
+			Common::String pos = Common::String::format("(%d,%d->%d,%d)",
+				hotspots[hotspotIdx].left, hotspots[hotspotIdx].top,
+				hotspots[hotspotIdx].right, hotspots[hotspotIdx].bottom);
+
+			for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
+				if (_vm->_voy._audioHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
+					DebugPrintf("Hotspot %d %s Audio slot %d, time: %d to %d\n", 
+						hotspotIdx, pos.c_str(), arrIndex,
+						_vm->_voy._audioHotspotTimes._min[arrIndex][hotspotIdx],
+						_vm->_voy._audioHotspotTimes._max[arrIndex][hotspotIdx]);
+				}
+
+				if (_vm->_voy._evidenceHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
+					DebugPrintf("Hotspot %d %s Evidence slot %d, time: %d to %d\n", 
+						hotspotIdx, pos.c_str(), arrIndex,
+						_vm->_voy._evidenceHotspotTimes._min[arrIndex][hotspotIdx],
+						_vm->_voy._evidenceHotspotTimes._max[arrIndex][hotspotIdx]);
+				}
+			}
+
+			for (int arrIndex = 0; arrIndex < 8; ++arrIndex) {
+				if (_vm->_voy._videoHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
+					DebugPrintf("Hotspot %d %s Video slot %d, time: %d to %d\n", 
+						hotspotIdx, pos.c_str(), arrIndex,
+						_vm->_voy._videoHotspotTimes._min[arrIndex][hotspotIdx],
+						_vm->_voy._videoHotspotTimes._max[arrIndex][hotspotIdx]);
+				}
+			}
+		}
+	}
+
+	DebugPrintf("\n");
+	return true;
+}
+
+bool Debugger::Cmd_Mouse(int argc, const char **argv) {
+	if (argc < 2) {
+		DebugPrintf("mouse [ on | off ]\n");
+	} else {
+		_showMousePosition = !strcmp(argv[1], "on");
+		DebugPrintf("Mouse position is now %s\n", _showMousePosition ? "on" : "off");
+	}
+
+	return true;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/debugger.h b/engines/voyeur/debugger.h
index 0391fad..43eaa5f 100644
--- a/engines/voyeur/debugger.h
+++ b/engines/voyeur/debugger.h
@@ -39,9 +39,27 @@ public:
 	 * @default true
 	 */
 	bool _isTimeActive;
+
+	/*
+	 * Specifies whether to show the current mouse position on the screen
+	 */
+	bool _showMousePosition;
 protected:
+	/**
+	 * Turn time on or off, set the current time period, or the camera delay
+	 * within the current time period.
+	 */
 	bool Cmd_Time(int argc, const char **argv);
 
+	/**
+	 * List the active hotspots during the current time period
+	 */
+	bool Cmd_Hotspots(int argc, const char **argv);
+
+	/**
+	 * Toggle showing the mouse on the screen
+	 */
+	bool Cmd_Mouse(int argc, const char **argv);
 public:
 	Debugger();
 	virtual ~Debugger() {}
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 4734b1e..ded81f7 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -25,6 +25,8 @@
 #include "voyeur/staticres.h"
 #include "common/events.h"
 #include "graphics/cursorman.h"
+#include "graphics/font.h"
+#include "graphics/fontman.h"
 #include "graphics/palette.h"
 
 namespace Voyeur {
@@ -158,6 +160,10 @@ void EventsManager::checkForNextFrameCounter() {
 		// Give time to the debugger
 		_vm->_debugger.onFrame();
 
+		// If mouse position display is on, display the position
+		if (_vm->_debugger._showMousePosition)
+			showMousePosition();
+
 		// Display the frame
 		g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.getPixels(), 
 			SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -168,6 +174,23 @@ void EventsManager::checkForNextFrameCounter() {
 	}
 }
 
+void EventsManager::showMousePosition() {
+	const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont));
+	Common::String mousePos = Common::String::format("(%d,%d)", _mousePos.x, _mousePos.y);
+	if (_vm->_voyeurArea == AREA_INTERFACE) {
+		Common::Point pt = _mousePos + _vm->_mansionViewPos - Common::Point(40, 27);
+		if (pt.x < 0) pt.x = 0;
+		if (pt.y < 0) pt.y = 0;
+
+		mousePos += Common::String::format(" - (%d,%d)", pt.x, pt.y);
+	}
+
+	_vm->_graphicsManager._screenSurface.fillRect(
+		Common::Rect(0, 0, 110, font.getFontHeight()), 0);
+	font.drawString(&_vm->_graphicsManager._screenSurface, mousePos,
+		0, 0, 110, 63);
+}
+
 void EventsManager::voyeurTimer() {
 	_gameData.field22 += _gameData.field24;
 	_gameData.field1A += _gameData.field1E;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 6e2d297..ec9c12e 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -96,6 +96,11 @@ private:
 	void vDoCycleInt();
 	void fadeIntFunc();
 	void deleteIntNode(IntNode *node);
+
+	/**
+	 * Debugger support method to show the mouse position
+	 */
+	void showMousePosition();
 public:
 	IntData _gameData;
 	IntData &_intPtr;


Commit: 4ef57db61a7730d0ff1fc19658cb8726ee35b9ca
    https://github.com/scummvm/scummvm/commit/4ef57db61a7730d0ff1fc19658cb8726ee35b9ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T19:38:27-08:00

Commit Message:
VOYEUR: General field renaming and comments

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 8bcf32f..3d91b7d 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -77,13 +77,13 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_field468);
 	s.syncAsSint16LE(_field46A);
 	s.syncAsSint16LE(_vocSecondsOffset);
-	s.syncAsSint16LE(_field46E);
+	s.syncAsSint16LE(_abortInterface);
 	s.syncAsSint16LE(_field470);
 	s.syncAsSint16LE(_aptLoadMode);
 	s.syncAsSint16LE(_transitionId);
 	s.syncAsSint16LE(_RTVLimit);
 	s.syncAsSint16LE(_eventFlags);
-	s.syncAsSint16LE(_field47A);
+	s.syncAsSint16LE(_boltGroupId2);
 
 	s.syncAsSint16LE(_field4AC);
 	s.syncAsSint16LE(_field4B8);
@@ -157,7 +157,7 @@ void SVoy::addEvidEventStart(int v) {
 	e._isAM = _isAM;
 	e._type = EVTYPE_EVID;
 	e._audioVideoId = _vm->_playStampGroupId;
-	e._computerOn = _field47A;
+	e._computerOn = _boltGroupId2;
 	e._computerOff = v;
 }
 
@@ -188,7 +188,7 @@ void SVoy::addComputerEventEnd(int v) {
 void SVoy::reviewAnEvidEvent(int eventIndex) {
 	VoyeurEvent &e = _events[eventIndex];
 	_vm->_playStampGroupId = e._audioVideoId;
-	_field47A = e._computerOn;
+	_boltGroupId2 = e._computerOn;
 	int frameOff = e._computerOff;
 
 	if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
@@ -201,9 +201,9 @@ void SVoy::reviewAnEvidEvent(int eventIndex) {
 		_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
 		_vm->_playStampGroupId = -1;
 
-		if (_field47A != -1) {
-			_vm->_bVoy->freeBoltGroup(_field47A);
-			_field47A = -1;
+		if (_boltGroupId2 != -1) {
+			_vm->_bVoy->freeBoltGroup(_boltGroupId2);
+			_boltGroupId2 = -1;
 		}
 	}
 }
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 2dc1221..a829d7c 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -116,13 +116,13 @@ public:
 	int _field468;
 	int _field46A;
 	int _vocSecondsOffset;
-	bool _field46E;
+	bool _abortInterface;
 	int _field470;
 	int _aptLoadMode;
 	int _transitionId;
 	int _RTVLimit;
 	int _eventFlags;
-	int _field47A;
+	int _boltGroupId2;
 	PictureResource *_evPicPtrs[6];
 	CMapResource *_evCmPtrs[6];
 	int _field4AC;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 604b303..358d162 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -505,7 +505,7 @@ private:
 	byte *getDataOffset();
 	void getButtonsText();
 	void getButtonsFlags();
-	void getField1CE();
+	void getButtonsUnused();
 	void performOpenCard();
 	const byte *getRecordOffset(const byte *p);
 	const byte *getNextRecord(const byte *p);
@@ -554,26 +554,50 @@ public:
 	byte *_threadInfoPtr;
 	byte _buttonFlags[64];
 	const byte *_field8E[64];
-	byte _field18E[64];
-	const byte *_field1CE[48];
+	byte _buttonIds[64];
+	const byte *_buttonUnused[48];
 	byte *_ctlPtr;
 	byte *_playCommandsPtr;
 public:
 	ThreadResource(BoltFilesState &state, const byte *src);
 	virtual ~ThreadResource() {}
 
+	/**
+	 * Initialise the thread
+	 */
 	void initThreadStruct(int idx, int id);
+
+	/**
+	 * Loads the specified stack
+	 */
 	bool loadAStack(int stackId);
+
+	/**
+	 * Unloads the specified stack
+	 */
 	void unloadAStack(int stackId);
+
+	/**
+	 * Initialises data for the thread based on the current state
+	 */
 	bool doState();
 
 	bool chooseSTAMPButton(int buttonId);
+
+	/**
+	 * Parses the script commands from the currently active stack
+	 */
 	void parsePlayCommands();
 
 	/**
 	 * Do the camera view looking at the mansion
 	 */
 	int doInterface();
+
+	/**
+	 * Do the display of a room that has one or more evidence hotspots
+	 * available for display
+	 */
 	void doRoom();
 
 	/**
@@ -586,7 +610,14 @@ public:
 	 */
 	void loadTheApt();
 
+	/**
+	 * Check for whether a murder has been recorded
+	 */
 	void checkForMurder();
+
+	/**
+	 * Check for whether incriminating evidence has been recorded
+	 */
 	void checkForIncriminate();
 
 	/**
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index e99a19f..1d66483 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -94,9 +94,9 @@ bool ThreadResource::doState() {
 		return false;
 
 	getButtonsFlags();
-	getField1CE();
+	getButtonsUnused();
 
-	_vm->_glGoScene = -1;
+	_vm->_glGoState = -1;
 	_vm->_glGoStack = -1;
 
 	performOpenCard();
@@ -168,7 +168,7 @@ void ThreadResource::getButtonsFlags() {
 				_stateFlags |= 2;
 
 			_buttonFlags[idx] = *p++;
-			_field18E[idx] = *p++;
+			_buttonIds[idx] = *p++;
 
 			if (_buttonFlags[idx] & 0x80)
 				p += 4;
@@ -178,13 +178,13 @@ void ThreadResource::getButtonsFlags() {
 	}
 }
 
-void ThreadResource::getField1CE() {
+void ThreadResource::getButtonsUnused() {
 	int idx = 0;
 	
 	for (const byte *p = _threadInfoPtr; *p++ != 0x4A; p = getNextRecord(p)) {
 		assert(idx < 47);
-		_field1CE[idx++] = getRecordOffset(p);
-		_field1CE[idx] = NULL;
+		_buttonUnused[idx++] = getRecordOffset(p);
+		_buttonUnused[idx] = nullptr;
 		p += 4;
 	}
 }
@@ -300,11 +300,11 @@ void ThreadResource::doSTAMPCardAction() {
 }
 
 void ThreadResource::cardAction(const byte *card) {
-	_vm->_glGoScene = -1;
+	_vm->_glGoState = -1;
 	_vm->_glGoStack = -1;
 
 	// Loop to perform card commands
-	while (!_vm->shouldQuit() && *card < 70 && _vm->_glGoScene == -1) {
+	while (!_vm->shouldQuit() && *card < 70 && _vm->_glGoState == -1) {
 		card = cardPerform(card);
 	}
 }
@@ -313,19 +313,19 @@ bool ThreadResource::chooseSTAMPButton(int buttonId) {
 	_flags &= ~1;
 
 	for (int idx = 0; idx < _stateCount; ++idx) {
-		if (_field18E[idx] == buttonId) {
+		if (_buttonIds[idx] == buttonId) {
 			const byte *card = getSTAMPCard(idx);
 			cardAction(card);
 
 			bool flag = true;
 			while (!_vm->shouldQuit() && _vm->_glGoStack != -1 && flag) {
 				doSTAMPCardAction();
-				flag = goToStateID(_vm->_glGoStack, _vm->_glGoScene);
+				flag = goToStateID(_vm->_glGoStack, _vm->_glGoState);
 			}
 
-			while (!_vm->shouldQuit() && _vm->_glGoScene != -1 && flag) {
+			while (!_vm->shouldQuit() && _vm->_glGoState != -1 && flag) {
 				doSTAMPCardAction();
-				flag = goToState(-1, _vm->_glGoScene);
+				flag = goToState(-1, _vm->_glGoState);
 			}
 
 			return flag;
@@ -339,7 +339,7 @@ void ThreadResource::parsePlayCommands() {
 	_vm->_voy._field470 = -1;
 	_vm->_voy._field468 = 0;
 	_vm->_voy._field46A = 0;
-	_vm->_voy._field47A = -1;
+	_vm->_voy._boltGroupId2 = -1;
 	_vm->_voy._computerTextId = -1;
 	_vm->_voy._eventFlags &= ~EVTFLAG_8;
 	_vm->_eventsManager._videoDead = -1;
@@ -507,6 +507,7 @@ void ThreadResource::parsePlayCommands() {
 			break;			
 
 		case 5:
+			// Load the time information for the new time period
 			v2 = READ_LE_UINT16(dataP);
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
 				_vm->_voy._field470 = 5;
@@ -617,7 +618,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
-				_vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
+				_vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
 				_vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true;
 			}
 
@@ -798,18 +799,18 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		break;
 
 	case 17:
-		_vm->_glGoScene = READ_LE_UINT16(card);
+		_vm->_glGoState = READ_LE_UINT16(card);
 		card += 2;
 		_vm->_glGoStack = -1;
 		break;
 
 	case 18:
 		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
-		_vm->_glGoScene = getStateFromID(v2);
+		_vm->_glGoState = getStateFromID(v2);
 		break;
 
 	case 19:
-		_vm->_glGoScene = READ_LE_UINT32(card);
+		_vm->_glGoState = READ_LE_UINT32(card);
 		card += 4;
 		_vm->_glGoStack = READ_LE_UINT16(card);
 		card += 2;
@@ -888,7 +889,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		break;
 
 	case 46:
-		_vm->_glGoScene = _newStateId;
+		_vm->_glGoState = _newStateId;
 		_vm->_glGoStack = _newStackId;
 		_newStateId = -1;
 		_newStackId = -1;
@@ -1259,9 +1260,9 @@ void ThreadResource::doRoom() {
 	voy._field437E = 0;
 	vm.makeViewFinderP();
 
-	if (voy._field47A != -1) {
-		vm._bVoy->freeBoltGroup(voy._field47A, 1);
-		voy._field47A = -1;
+	if (voy._boltGroupId2 != -1) {
+		vm._bVoy->freeBoltGroup(voy._boltGroupId2, 1);
+		voy._boltGroupId2 = -1;
 	}
 
 	if (vm._playStampGroupId != -1) {
@@ -1283,8 +1284,8 @@ int ThreadResource::doInterface() {
 	Common::Point pt;
 
 	_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
-	if (_vm->_voy._field46E) {
-		_vm->_voy._field46E = false;
+	if (_vm->_voy._abortInterface) {
+		_vm->_voy._abortInterface = false;
 		return -2;
 	}
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 27a45d8..74f03ff 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -678,11 +678,11 @@ void VoyeurEngine::flipPageAndWaitForFade() {
 
 void VoyeurEngine::showEndingNews() {
 	_playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700;
-	_voy._field47A = (READ_LE_UINT16(_controlPtr->_ptr + 4) 
+	_voy._boltGroupId2 = (READ_LE_UINT16(_controlPtr->_ptr + 4) 
 		- 1) * 256 + 0x7B00;
 
 	_bVoy->getBoltGroup(_playStampGroupId);
-	_bVoy->getBoltGroup(_voy._field47A);
+	_bVoy->getBoltGroup(_voy._boltGroupId2);
 
 	PictureResource *pic = _bVoy->boltEntry(_playStampGroupId)._picResource;
 	CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
@@ -695,8 +695,8 @@ void VoyeurEngine::showEndingNews() {
 
 	for (int idx = 1; idx < 4; ++idx) {
 		if (idx == 3) {
-			pic = _bVoy->boltEntry(_voy._field47A)._picResource;
-			pal = _bVoy->boltEntry(_voy._field47A + 1)._cMapResource;
+			pic = _bVoy->boltEntry(_voy._boltGroupId2)._picResource;
+			pal = _bVoy->boltEntry(_voy._boltGroupId2 + 1)._cMapResource;
 		} else {
 			pic = _bVoy->boltEntry(_playStampGroupId + idx * 2)._picResource;
 			pal = _bVoy->boltEntry(_playStampGroupId + idx * 2 + 1)._cMapResource;
@@ -728,9 +728,9 @@ void VoyeurEngine::showEndingNews() {
 	}
 
 	_bVoy->freeBoltGroup(_playStampGroupId);
-	_bVoy->freeBoltGroup(_voy._field47A);
+	_bVoy->freeBoltGroup(_voy._boltGroupId2);
 	_playStampGroupId = -1;
-	_voy._field47A = -1;
+	_voy._boltGroupId2 = -1;
 }
 
 /*------------------------------------------------------------------------*/
@@ -820,7 +820,7 @@ Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc)
 }
 
 void VoyeurEngine::synchronize(Common::Serializer &s) {
-	s.syncAsSint16LE(_glGoScene);
+	s.syncAsSint16LE(_glGoState);
 	s.syncAsSint16LE(_glGoStack);
 	s.syncAsSint16LE(_stampFlags);
 	s.syncAsSint16LE(_playStampGroupId);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index a0d2e95..bc63d56 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -170,7 +170,7 @@ public:
 	ControlResource *_controlPtr;
 	byte *_stampData;
 	BoltGroup *_stackGroupPtr;
-	int _glGoScene;
+	int _glGoState;
 	int _glGoStack;
 	int _stampFlags;
 	int _playStampGroupId;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 634e79c..1ebfdff 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -41,7 +41,7 @@ void VoyeurEngine::playStamp() {
 	_voy._isAM = false;
 	_gameHour = 9;
 	_gameMinute = 0;
-	_voy._field46E = true;
+	_voy._abortInterface = true;
 
 	int buttonId;
 	bool breakFlag = false;
@@ -66,14 +66,14 @@ void VoyeurEngine::playStamp() {
 					break;
 				case 1:
 					_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
-					_voy._field46E = true;
+					_voy._abortInterface = true;
 					_mainThread->chooseSTAMPButton(22);
 					_voy._aptLoadMode = 143;
 					break;
 				case 2:
 					_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 					reviewTape();
-					_voy._field46E = true;
+					_voy._abortInterface = true;
 					_voy._aptLoadMode = 142;
 					break;
 				case 3:
@@ -85,7 +85,7 @@ void VoyeurEngine::playStamp() {
 					break;
 				case 5:
 					doGossip();
-					_voy._field46E = true;
+					_voy._abortInterface = true;
 					_voy._aptLoadMode = 141;
 					_voy._eventFlags &= ~EVTFLAG_100;
 					break;
@@ -115,7 +115,7 @@ void VoyeurEngine::playStamp() {
 				break;
 			case 2:
 				reviewTape();
-				_voy._field46E = true;
+				_voy._abortInterface = true;
 				break;
 			case 4:
 				flag = true;
@@ -165,7 +165,7 @@ void VoyeurEngine::playStamp() {
 					_mainThread->chooseSTAMPButton(buttonId);
 				} else {
 					_mainThread->chooseSTAMPButton(buttonId);
-					_voy._field46E = true;
+					_voy._abortInterface = true;
 				}
 			}
 			break;
@@ -184,9 +184,9 @@ void VoyeurEngine::playStamp() {
 
 				_audioVideoId = -1;
 
-				if (_voy._field47A != -1) {
-					_bVoy->freeBoltGroup(_voy._field47A);
-					_voy._field47A = -1;
+				if (_voy._boltGroupId2 != -1) {
+					_bVoy->freeBoltGroup(_voy._boltGroupId2);
+					_voy._boltGroupId2 = -1;
 				}
 
 				if (_playStampGroupId != -1) {
@@ -1344,27 +1344,27 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		_soundManager.stopVOCPlay();
 	}
 
-	_bVoy->getBoltGroup(_voy._field47A);
-	PictureResource *pic = _bVoy->boltEntry(_voy._field47A + evidId * 2)._picResource;
+	_bVoy->getBoltGroup(_voy._boltGroupId2);
+	PictureResource *pic = _bVoy->boltEntry(_voy._boltGroupId2 + evidId * 2)._picResource;
 	_graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(
 		(384 - pic->_bounds.width()) / 2, (240 - pic->_bounds.height()) / 2));
-	_bVoy->freeBoltMember(_voy._field47A + evidId * 2);
+	_bVoy->freeBoltMember(_voy._boltGroupId2 + evidId * 2);
 
-	CMapResource *pal = _bVoy->boltEntry(_voy._field47A + evidId * 2 + 1)._cMapResource;
+	CMapResource *pal = _bVoy->boltEntry(_voy._boltGroupId2 + evidId * 2 + 1)._cMapResource;
 	pal->startFade();
 
 	while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
 		_eventsManager.delay(1);
-	_bVoy->freeBoltMember(_voy._field47A + evidId * 2 + 1);
+	_bVoy->freeBoltMember(_voy._boltGroupId2 + evidId * 2 + 1);
 
 	Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(_playStampGroupId + 4)._rectResource->_entries;
 	int count = hotspots[evidId]._count;
 
 	if (count > 0) {
 		for (int idx = 1; idx <= count; ++idx) {
-			_voy._evPicPtrs[idx - 1] = _bVoy->boltEntry(_voy._field47A + 
+			_voy._evPicPtrs[idx - 1] = _bVoy->boltEntry(_voy._boltGroupId2 + 
 				(evidId + idx) * 2)._picResource;
-			_voy._evCmPtrs[idx - 1] = _bVoy->boltEntry(_voy._field47A + 
+			_voy._evCmPtrs[idx - 1] = _bVoy->boltEntry(_voy._boltGroupId2 + 
 				(evidId + idx) * 2 + 1)._cMapResource;
 		}
 	}
@@ -1416,8 +1416,8 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 		_voy.addEvidEventEnd(evidIdx);
 
 	for (int idx = 1; idx <= hotspots[evidId]._count; ++idx) {
-		_bVoy->freeBoltMember(_voy._field47A + (evidId + idx) * 2);
-		_bVoy->freeBoltMember(_voy._field47A + (evidId + idx) * 2 + 1);
+		_bVoy->freeBoltMember(_voy._boltGroupId2 + (evidId + idx) * 2);
+		_bVoy->freeBoltMember(_voy._boltGroupId2 + (evidId + idx) * 2 + 1);
 	}
 }
 


Commit: d13b529c4718d01c045c3af7b83c6f6793d92077
    https://github.com/scummvm/scummvm/commit/d13b529c4718d01c045c3af7b83c6f6793d92077
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T20:59:45-08:00

Commit Message:
VOYEUR: Improvements to debugger command for changing time period

Changed paths:
    engines/voyeur/debugger.cpp
    engines/voyeur/files.h



diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index 8fdcf20..b1bc263 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -40,6 +40,10 @@ Debugger::Debugger() : GUI::Debugger() {
 	_showMousePosition = false;
 }
 
+static const int TIME_STATES[] = {
+	0, 31, 0, 43, 59, 0, 67, 75, 85, 93, 0, 0, 111, 121, 0, 0
+};
+
 bool Debugger::Cmd_Time(int argc, const char **argv) {
 	if (argc < 2) {
 		// Get the current day and time of day 
@@ -48,8 +52,8 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 		if (!timeString.empty())
 			dtString += " " + timeString;
 
-		DebugPrintf("Current date/time is: %s, time is %s\n", 
-			dtString.c_str(), _isTimeActive ? "on" : "off");
+		DebugPrintf("Time period = %d, date/time is: %s, time is %s\n", 
+			_vm->_voy._transitionId, dtString.c_str(), _isTimeActive ? "on" : "off");
 		DebugPrintf("Format: %s [on | off | 1..17 | val <amount>]\n\n", argv[0]);
 	} else {
 		if (!strcmp(argv[1], "on")) {
@@ -68,22 +72,16 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
 		} else {
 			int timeId = atoi(argv[1]);
 			if (timeId >= 1 && timeId <= 17) {
-				_vm->_voy._transitionId = timeId;
-				_vm->_gameHour = LEVEL_H[timeId - 1];
-				_vm->_gameMinute = LEVEL_M[timeId - 1];
-				_vm->_voy._isAM = (timeId == 6);
-
-				// Camera back to full charge
-				_vm->_voy._RTVNum = 0;
-				_vm->_voy._RTANum = 255;
-
-				// Get the new current day and time of day 
-				Common::String dtString = _vm->getDayName();
-				Common::String timeString = _vm->getTimeOfDay();
-				if (!timeString.empty())
-					dtString += " " + timeString;
-
-				DebugPrintf("Current date/time is now: %s\n\n", dtString.c_str());
+				int stateId = TIME_STATES[timeId - 1];
+				if (!stateId) {
+					DebugPrintf("Given time period is not used in-game\n");
+				} else {
+					DebugPrintf("Changing to time period: %d\n", timeId);
+					if (_vm->_mainThread->goToState(-1, stateId))
+						_vm->_mainThread->parsePlayCommands();
+
+					return false;
+				}
 			} else {
 				DebugPrintf("Unknown parameter\n\n");
 			}
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 358d162..d05cba4 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -515,7 +515,6 @@ private:
 	void cardAction(const byte *p);
 	void doSTAMPCardAction();
 	bool goToStateID(int stackId, int id);
-	bool goToState(int stackId, int stateId);
 	const byte *cardPerform(const byte *card);
 	bool cardPerform2(const byte *p, int cardCmdId);
 	void savePrevious();
@@ -578,6 +577,11 @@ public:
 	void unloadAStack(int stackId);
 
 	/**
+	 * Go to a new state and/or stack
+	 */
+	bool goToState(int stackId, int stateId);
+
+	/**
 	 * Initialises data for the thread based on the current state
 	 */
 	bool doState();


Commit: 2234724891dc9df1e04f76e1c80090224794e9c0
    https://github.com/scummvm/scummvm/commit/2234724891dc9df1e04f76e1c80090224794e9c0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T21:07:29-08:00

Commit Message:
VOYEUR: Clean up debug channels

Changed paths:
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 74f03ff..1ee06e1 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -55,6 +55,8 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_voyeurArea = AREA_NONE;
 	_loadGameSlot = -1;
 
+	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
+
 	initialiseManagers();
 }
 
@@ -98,9 +100,6 @@ void VoyeurEngine::initialiseManagers() {
 void VoyeurEngine::ESP_Init() {
 	ThreadResource::init();
 
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-
 	if (ConfMan.hasKey("save_slot"))
 		_loadGameSlot = ConfMan.getInt("save_slot");
 }
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index bc63d56..08c0a27 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,8 +66,7 @@ namespace Voyeur {
 #define MANSION_SCROLL_INC_Y 4
 
 enum VoyeurDebugChannels {
-	kDebugPath      = 1 << 0,
-	kDebugScripts	= 1 << 1
+	kDebugScripts	= 1 << 0
 };
 
 enum VoyeurArea { AREA_NONE, AREA_APARTMENT, AREA_INTERFACE, AREA_ROOM, AREA_EVIDENCE };


Commit: fcaf2af6169f0da8aaf8b8b6eabc5d94a401cfd6
    https://github.com/scummvm/scummvm/commit/fcaf2af6169f0da8aaf8b8b6eabc5d94a401cfd6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T21:25:58-08:00

Commit Message:
VOYEUR: Add a hotspot to the aprtment for the ScummVM GMM

The original game doesn't have any savegame support, so this
will provide users with a more obvious hint than knowing to
explicitly show the GMM when in the apartment.

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 1d66483..40f4fe6 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -507,9 +507,10 @@ void ThreadResource::parsePlayCommands() {
 			break;			
 
 		case 5:
-			// Load the time information for the new time period
+			// Check whether transition to a given time period is allowed, and
+			// if so, load the time information for the new time period
 			v2 = READ_LE_UINT16(dataP);
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				_vm->_voy._field470 = 5;
 				int count = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4);
@@ -997,6 +998,8 @@ int ThreadResource::doApt() {
 	int prevHotspotId = -1;
 	Common::Point pt;
 	PictureResource *pic;
+	Common::Rect gmmHotspot(75, 125, 130, 140);
+
 	do {
 		_vm->_voyeurArea = AREA_APARTMENT;
 
@@ -1044,6 +1047,10 @@ int ThreadResource::doApt() {
 			}
 		}
 
+		// Check for presence in ScummVM GMM
+		if (gmmHotspot.contains(pt))
+			hotspotId = 42;
+
 		// Draw either standard or highlighted eye cursor
 		pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStampGroupId + 2 :
 			_vm->_playStampGroupId + 3)._picResource;
@@ -1051,6 +1058,12 @@ int ThreadResource::doApt() {
 
 		_vm->flipPageAndWait();
 
+		if (hotspotId == 42 && _vm->_eventsManager._leftClick) {
+			// Show the ScummVM GMM
+			_vm->_eventsManager.getMouseInfo();
+			_vm->openMainMenuDialog();
+		}
+
 	} while (!_vm->shouldQuit() && (!_vm->_eventsManager._leftClick || hotspotId == -1));
 
 	pt = _vm->_eventsManager.getMousePos();


Commit: e0a142ed4caed07fd5a9bdc9468f4702d6f79339
    https://github.com/scummvm/scummvm/commit/e0a142ed4caed07fd5a9bdc9468f4702d6f79339
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T21:38:10-08:00

Commit Message:
VOYEUR: Fix loading of savegame descriptions

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1ee06e1..2bdf8c1 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -857,6 +857,7 @@ bool VoyeurSavegameHeader::read(Common::InSaveFile *f) {
 		return false;
 
 	char c;
+	_saveName = "";
 	while ((c = f->readByte()) != 0)
 		_saveName += c;
 


Commit: 8385a0ef8e77903d48f0ff443d3a5feb8536c2fa
    https://github.com/scummvm/scummvm/commit/8385a0ef8e77903d48f0ff443d3a5feb8536c2fa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-02T22:23:27-08:00

Commit Message:
VOYEUR: Implemented checkForKey

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 3d91b7d..ef072e8 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -230,4 +230,92 @@ void SVoy::reviewComputerEvent(int eventIndex) {
 	}
 }
 
+bool SVoy::checkForKey() {
+	WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 0);
+	if (_vm->_voy._field4F0)
+		return false;
+
+	for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) {
+		VoyeurEvent &e = _events[eventIdx];
+		int v1;
+
+		switch (e._type) {
+		case EVTYPE_VIDEO:
+			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			case 1:
+				if (e._audioVideoId == 33 && e._computerOn < 1 && e._computerOff > 40)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
+				break;
+
+			case 2:
+				if (e._audioVideoId == 47 && e._computerOn < 1 && e._computerOff > 11)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
+				break;
+
+			case 3:
+				if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+				break;
+
+			case 4:
+				if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 7)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
+				break;
+			
+			default:
+				break;
+			}
+			break;
+
+		case EVTYPE_AUDIO:
+			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			case 1:
+				if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 28)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
+				break;
+	
+			case 3:
+				if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 30)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+				if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 20)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+				break;
+
+			default:
+				break;
+			}
+			break;
+
+		case EVTYPE_EVID:
+			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			case 4:
+				if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
+
+			default:
+				break;
+			}
+			break;
+
+		case EVTYPE_COMPUTER:
+			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			case 2:
+				if (e._computerOn == 13 && e._computerOff > 76)
+					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
+				break;
+
+			default:
+				break;
+			}
+			break;
+		}
+
+		if (READ_LE_UINT32(_vm->_controlPtr->_ptr + 8) == 
+				READ_LE_UINT32(_vm->_controlPtr->_ptr + 4))
+			return true;
+	}
+
+	return false;
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index a829d7c..c21fcf0 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -216,6 +216,12 @@ public:
 	 * Review a previously recorded computer event
 	 */
 	void reviewComputerEvent(int eventIndex);
+
+	/**
+	 * Checks for key information in determining what kind of murder
+	 * should take place
+	 */
+	bool checkForKey();
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index ded81f7..9904c9e 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -590,10 +590,6 @@ void EventsManager::getMouseInfo() {
 	_vm->_eventsManager._mouseUnk = false;
 }
 
-void EventsManager::checkForKey() {
-	warning("TODO: checkForKey");
-}
-
 void EventsManager::startCursorBlink() {
 	if (_vm->_voy._eventFlags & EVTFLAG_RECORDING) {
 		_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index ec9c12e..a7f9641 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -150,7 +150,6 @@ public:
 	Common::Point getMousePos() { return _mousePos; }
 	uint32 getGameCounter() const { return _gameCounter; }
 	void getMouseInfo();
-	void checkForKey();
 	void startCursorBlink();
 	void incrementTime(int amt);
 
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1ebfdff..826c4d1 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -161,7 +161,7 @@ void VoyeurEngine::playStamp() {
 
 				if (buttonId != 4) {
 					_voy._field470 = 131;
-					_eventsManager.checkForKey();
+					_voy.checkForKey();
 					_mainThread->chooseSTAMPButton(buttonId);
 				} else {
 					_mainThread->chooseSTAMPButton(buttonId);


Commit: ae9bca6bdf747e8ec1daa75b043a5a546eec21f7
    https://github.com/scummvm/scummvm/commit/ae9bca6bdf747e8ec1daa75b043a5a546eec21f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T17:16:13-08:00

Commit Message:
VOYEUR: Remove a lot of outdated TODO's and clean up of stubbed methods

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/events.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/graphics.h
    engines/voyeur/sound.cpp
    engines/voyeur/sound.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index f1126e5..855536b 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -146,10 +146,6 @@ void RL2Decoder::readNextPacket() {
 }
 
 bool RL2Decoder::seek(const Audio::Timestamp &where) {
-	// TODO: Ideally, I need a way to clear the audio track's QueuingAudioStream when
-	// a seek is done. Otherwise, as current, seeking can only be done correctly when
-	// the video is first loaded.
-
 	_soundFrameNumber = -1;
 	return VideoDecoder::seek(where);
 }
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 9904c9e..c0f0eb5 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -458,8 +458,6 @@ void EventsManager::vDoCycleInt() {
 					byte g = pPal[start * 3 + 1];
 					byte b = pPal[start * 3 + 2];
 
-					// Move the remainder of the range backwards one entry
-					// TODO: Is this allowing for overlap properly?
 					Common::copy(&pPal[start * 3 + 3], &pPal[end * 3 + 3], &pPal[start * 3]);
 					
 					// Place the original saved entry at the end of the range
@@ -483,7 +481,6 @@ void EventsManager::vDoCycleInt() {
 					byte b = pPal[end * 3 + 2];
 
 					// Move the remainder of the range forwards one entry
-					// TODO: Does this allow for overlap range correctly?
 					Common::copy_backward(&pPal[start * 3], &pPal[end * 3], &pPal[end * 3 + 3]);
 					
 					// Place the original saved entry at the end of the range
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 05e3fee..ce2ebc5 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -276,8 +276,6 @@ BoltGroup *BoltFile::getBoltGroup(uint16 id, bool process) {
 }
 
 void BoltFile::freeBoltGroup(uint16 id, bool freeEntries) {
-	// TODO: I currently ignore freeEntries flag, in favour of always
-	// freeing. Need to check whether this can really ever be false.
 	_state._curLibPtr = this;
 	_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
 
@@ -286,8 +284,7 @@ void BoltFile::freeBoltGroup(uint16 id, bool freeEntries) {
 }
 
 void BoltFile::freeBoltMember(uint32 id) {
-	// TODO: Determine whether this is needed, given all group entries are automatically loaded
-//	warning("TODO: BoltFile::freeBoltMember");
+	// No implementation in ScummVM
 }
 
 BoltEntry &BoltFile::getBoltEntryFromLong(uint32 id) {
@@ -412,9 +409,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
 	_state._encrypt = (_state._curMemberPtr->_mode & 0x10) != 0;
 
 	if (_state._curGroupPtr->_processed) {
-		// TODO: Figure out weird access type. Uncompressed read perhaps?
-		//int fileDiff = _state._curGroupPtr->_fileOffset - _state._curMemberPtr->_fileOffset;
-		error("TODO: processed bolt flag");
+		error("Processed resources are not supported");
 	} else {
 		_state._bufStart = _state._decompressBuf;
 		_state._bufSize = DECOMPRESS_SIZE;
@@ -618,7 +613,7 @@ BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
 	_processed = buffer[0] != 0;
 	_callInitGro = buffer[1] != 0;
 	_termGroIndex = buffer[2];
-	_count = buffer[3] ? buffer[3] : 256;	// TODO: Added this in. Check it's okay
+	_count = buffer[3] ? buffer[3] : 256;
 	_fileOffset = READ_LE_UINT32(&buffer[8]);
 }
 
@@ -665,7 +660,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f, uint16 id): _file(f), _id(id
 	_mode = buffer[0];
 	_field1 = buffer[1];
 	_initMethod = buffer[3];
-	_xorMask = buffer[4] & 0xff;	// TODO: Is this right??
+	_xorMask = buffer[4] & 0xff;
 	_size = READ_LE_UINT32(&buffer[4]) & 0xffffff;
 	_fileOffset = READ_LE_UINT32(&buffer[8]); 
 }
@@ -685,8 +680,7 @@ BoltEntry::~BoltEntry() {
 }
 
 void BoltEntry::load() {
-	// TODO: Currently, all entry loading and decompression is done in BoltFile::memberAddr.
-	// Ideally, a lot of the code should be moved here
+	// Currently, all entry loading and decompression is done in BoltFile::memberAddr.
 }
 
 /**
@@ -1062,10 +1056,11 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src):
 			byte *imgData = state._curLibPtr->boltEntry(id)._picResource->_imgData;
 			_freeImgData = DisposeAfterUse::NO;
 
+			// TODO: Double check code below. Despite different coding in the 
+			// original, both looked like they do the same formula
 			if (_flags & PICFLAG_PIC_OFFSET) {
 				_imgData = imgData + (READ_LE_UINT32(&src[18]) & 0xffff);
 			} else {
-				warning("TODO: Double-check if this is correct");
 				_imgData = imgData + (READ_LE_UINT32(&src[18]) & 0xffff);
 			}
 		}
@@ -1362,7 +1357,6 @@ void ViewPortResource::setupViewPort(PictureResource *pic, Common::Rect *clipRec
 }
 
 void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
-	// TODO
 	Common::Rect rect = r;
 	
 	if (clipRect(rect)) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index d05cba4..ff09bbe 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -93,9 +93,10 @@ public:
 	byte *decompress(byte *buf, int size, int mode);
 	void nextBlock();
 
-	void EMSGetFrameAddr(byte **pageFrame) {} // TODO: Maybe?
-	bool EMSAllocatePages(uint *planeSize) { return false; } // TODO: Maybe?
-	void EMSMapPageHandle(int planeSize, int idx1, int idx2) {} // TODO: Maybe?
+	// Methods in the original stubbed under ScummVM
+	void EMSGetFrameAddr(byte **pageFrame) {} 
+	bool EMSAllocatePages(uint *planeSize) { return false; }
+	void EMSMapPageHandle(int planeSize, int idx1, int idx2) {}
 };
 
 class BoltFile {
@@ -110,11 +111,12 @@ private:
 	void resolveAll();
 	byte *getBoltMember(uint32 id);
 
-	void termType() {}	// TODO
-	void initMem(int id) {}	// TODO
-	void termMem() {}	// TODO
-	void initGro() {}	// TODO
-	void termGro() {}	// TODO
+	// Methods in the original that are stubbed in ScummVM
+	void termType() {}
+	void initMem(int id) {}
+	void termMem() {}
+	void initGro() {}
+	void termGro() {}
 public:
 	Common::File _file;
 public:
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 40f4fe6..e03e272 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -462,7 +462,6 @@ void ThreadResource::parsePlayCommands() {
 				_vm->_audioVideoId = -1;
 				parseIndex = 999;
 			} else {
-				// TODO: Double-check this
 				int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size();
 				_vm->_soundManager.stopVOCPlay();
 				_vm->_eventsManager.getMouseInfo();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index af83dbf..3dee779 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -120,7 +120,7 @@ void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
 }
 
 void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
-	// TODO: more
+	// Stubbed/dummy method in the original.
 }
 
 void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
@@ -290,7 +290,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 
 	if (srcPic->_pick == 0xff) {
 		if (srcFlags & DISPFLAG_8) {
-			error("TODO: sDrawPic");
+			error("TODO: sDrawPic variation");
 		} else {
 			// loc_258B8
 			srcP = srcImgData + srcOffset;
@@ -353,7 +353,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 					// loc_25D40
 					if (srcFlags & DISPFLAG_100) {
 						// loc_25D4A
-						error("TODO: sDrawPic");
+						error("TODO: sDrawPic variation");
 					} else {
 						// loc_2606D
 						destP = (byte *)_screenSurface.getPixels() + screenOffset;
@@ -527,7 +527,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 					
 					if (destFlags & DISPFLAG_8) {
 						// loc_272C3
-						error("TODO");
+						error("TODO: sDrawPic variation");
 					} else {
 						destP = destImgData + screenOffset;
 						for (int yp = 0; yp < height1; ++yp) {
@@ -899,10 +899,6 @@ void GraphicsManager::sDisplayPic(PictureResource *pic) {
 	_vm->_eventsManager._intPtr._flipWait = true;
 }
 
-void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
-	// TODO
-}
-
 void GraphicsManager::flipPage() {
 	Common::Array<ViewPortResource *> &viewPorts = _viewPortListPtr->_entries;
 	bool flipFlag = false;
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 5ba08ed..322b909 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -102,7 +102,6 @@ public:
 	void restoreMCGASaveRect(ViewPortResource *viewPort);
 	void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
 
-	void EMSMapPageHandle(int v1, int v2, int v3);
 	void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &initialOffset);
 	void fillPic(DisplayResource *display, byte onOff = 0);
 	void sDisplayPic(PictureResource *pic);
@@ -125,6 +124,9 @@ public:
 	 * Synchronizes the game data
 	 */
 	void synchronize(Common::Serializer &s);
+
+	// Methods in the original that are stubbed in ScummVM
+	void EMSMapPageHandle(int v1, int v2, int v3) {}
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index aab49be..e81d289 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -40,15 +40,6 @@ void SoundManager::playVOCMap(byte *voc, int vocSize) {
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream);
 }
 
-bool SoundManager::vocMapStatus() {
-	error("TODO: vocMapStatus");
-	return false;
-}
-
-void SoundManager::continueVocMap() {
-	// No implementation needed in ScummVM
-}
-
 void SoundManager::abortVOCMap() {
 	_mixer->stopHandle(_soundHandle);
 }
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 8b4feaa..ca05b0b 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -42,8 +42,6 @@ public:
 	void setVm(VoyeurEngine *vm) { _vm = vm; }
 
 	void playVOCMap(byte *voc, int vocSize);
-	bool vocMapStatus();
-	void continueVocMap();
 	void stopVOCPlay();
 	void abortVOCMap();
 	void setVOCOffset(int offset);
@@ -52,6 +50,9 @@ public:
 	void startVOCPlay(int soundId);
 	int getVOCStatus();
 	uint32 getVOCFrame();
+
+	// Methods in the original that are stubbed in ScummVM
+	void continueVocMap() {}
 };
 
 } // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 2bdf8c1..b3b920c 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -335,7 +335,7 @@ bool VoyeurEngine::doLock() {
 			_soundManager.abortVOCMap();
 			_soundManager.playVOCMap(buttonVoc, buttonVocSize);
 
-			while (_soundManager.vocMapStatus()) {
+			while (_soundManager.getVOCStatus()) {
 				if (shouldQuit())
 					break;
 


Commit: be296c58dd3624add1e60fb99e4d1f9ef2dacc48
    https://github.com/scummvm/scummvm/commit/be296c58dd3624add1e60fb99e4d1f9ef2dacc48
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T17:29:11-08:00

Commit Message:
VOYEUR: Removed some method declarations that are no longer in the given class

Changed paths:
    engines/voyeur/files.h



diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index ff09bbe..7cdb61f 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -617,16 +617,6 @@ public:
 	void loadTheApt();
 
 	/**
-	 * Check for whether a murder has been recorded
-	 */
-	void checkForMurder();
-
-	/**
-	 * Check for whether incriminating evidence has been recorded
-	 */
-	void checkForIncriminate();
-
-	/**
 	 * Synchronizes the game data
 	 */
 	void synchronize(Common::Serializer &s);


Commit: 683ef9d50f49c989c6bb4df15e16bcb7c33e1980
    https://github.com/scummvm/scummvm/commit/683ef9d50f49c989c6bb4df15e16bcb7c33e1980
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T18:27:26-08:00

Commit Message:
VOYEUR: Fix for control data comparisons in parsePlayCommands

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index e03e272..c77cdd4 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -369,7 +369,7 @@ void ThreadResource::parsePlayCommands() {
 		case 2:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -399,7 +399,7 @@ void ThreadResource::parsePlayCommands() {
 		case 3:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -544,7 +544,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				int idx = 0;
 				while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -562,7 +562,7 @@ void ThreadResource::parsePlayCommands() {
  			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				int idx = 0;
 				while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -580,7 +580,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				int idx = 0;
 				while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -617,7 +617,7 @@ void ThreadResource::parsePlayCommands() {
 		case 12:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				_vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
 				_vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true;
 			}
@@ -628,7 +628,7 @@ void ThreadResource::parsePlayCommands() {
 		case 13:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
 				_vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6);
@@ -663,7 +663,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0)
+			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2)
 				_vm->_voy._field4F2 = v3;
 			
 			dataP += 4;


Commit: d3f4156e6a7c4aac33224bbfc8e0f859401b51ed
    https://github.com/scummvm/scummvm/commit/d3f4156e6a7c4aac33224bbfc8e0f859401b51ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T19:02:28-08:00

Commit Message:
VOYEUR: Clean up, commenting, and bugfixes for checking for murder

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/events.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index ef072e8..ed308f4 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -41,6 +41,12 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {
 SVoy::SVoy() {
 	// Initialise all the data fields of SVoy to empty values
 	Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0);
+
+	_eventFlags = EVTFLAG_TIME_DISABLED;
+	_field4376 = _field4378 = 127;
+	_murderThreshold = 9999;
+	_aptLoadMode = -1;
+	_eventFlags |= EVTFLAG_100;
 }
 
 void SVoy::setVm(VoyeurEngine *vm) {
@@ -90,8 +96,8 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_computerTextId);
 	s.syncAsSint16LE(_computerTimeMin);
 	s.syncAsSint16LE(_computerTimeMax);
-	s.syncAsSint16LE(_field4F0);
-	s.syncAsSint16LE(_field4F2);
+	s.syncAsSint16LE(_victimMurdered);
+	s.syncAsSint16LE(_murderThreshold);
 
 	// Events
 	s.syncAsUint16LE(_eventCount);
@@ -103,7 +109,7 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_field437A);
 	s.syncAsSint16LE(_field437C);
 	s.syncAsSint16LE(_field437E);
-	s.syncAsSint16LE(_field4380);
+	s.syncAsSint16LE(_victimNumber);
 	s.syncAsSint16LE(_field4382);
 	s.syncAsSint16LE(_videoEventId);
 
@@ -232,7 +238,7 @@ void SVoy::reviewComputerEvent(int eventIndex) {
 
 bool SVoy::checkForKey() {
 	WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 0);
-	if (_vm->_voy._field4F0)
+	if (_vm->_voy._victimMurdered)
 		return false;
 
 	for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) {
@@ -243,12 +249,12 @@ bool SVoy::checkForKey() {
 		case EVTYPE_VIDEO:
 			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
 			case 1:
-				if (e._audioVideoId == 33 && e._computerOn < 1 && e._computerOff > 40)
+				if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
 					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
 				break;
 
 			case 2:
-				if (e._audioVideoId == 47 && e._computerOn < 1 && e._computerOff > 11)
+				if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
 					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
 				break;
 
@@ -258,7 +264,7 @@ bool SVoy::checkForKey() {
 				break;
 
 			case 4:
-				if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 7)
+				if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
 					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
 				break;
 			
@@ -270,14 +276,14 @@ bool SVoy::checkForKey() {
 		case EVTYPE_AUDIO:
 			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
 			case 1:
-				if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 28)
+				if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
 					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
 				break;
 	
 			case 3:
-				if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 30)
+				if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
 					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
-				if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 20)
+				if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
 					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
 				break;
 
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index c21fcf0..d9c62bc 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -35,7 +35,7 @@ enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
 	EVTYPE_COMPUTER = 4 };
 
 enum EventFlag { EVTFLAG_TIME_DISABLED = 1, EVTFLAG_2 = 2, EVTFLAG_8 = 8, EVTFLAG_RECORDING = 0x10,
-	EVTFLAG_40 = 0x40, EVTFLAG_100 = 0x100 };
+	EVTFLAG_40 = 0x40, EVTFLAG_VICTIM_PRESET = 0x80, EVTFLAG_100 = 0x100 };
 
 struct VoyeurEvent {
 	int _hour;
@@ -133,15 +133,15 @@ public:
 	Common::Rect _rect4E4;
 	int _computerTimeMin;
 	int _computerTimeMax;
-	int _field4F0;
-	int _field4F2;
+	bool _victimMurdered;
+	int _murderThreshold;
 
 	int _field4376;
 	int _field4378;
 	int _field437A;
 	int _field437C;
 	int _field437E;
-	int _field4380;
+	int _victimNumber;
 	int _field4382;
 	int _videoEventId;
 	RectResource *_viewBounds;
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index c0f0eb5..32ffa15 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -111,8 +111,10 @@ void EventsManager::mainVoyeurIntFunc() {
 			// Increase camera discharge
 			++_vm->_voy._RTVNum;
 
-			if (_vm->_voy._RTVNum >= _vm->_voy._field4F2)
-				_vm->_voy._field4F0 = 1;
+			// If the murder threshold has been set, and is passed, then flag the victim
+			// as murdered, which prevents sending the tape from succeeding
+			if (_vm->_voy._RTVNum >= _vm->_voy._murderThreshold)
+				_vm->_voy._victimMurdered = true;
 		}
 	}
 }
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index c77cdd4..b766733 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -367,6 +367,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 2:
+			// Play an audio event
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
@@ -397,6 +398,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 3:
+			// Play a video event
 			v2 = READ_LE_UINT16(dataP);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
@@ -443,6 +445,7 @@ void ThreadResource::parsePlayCommands() {
 
 		case 4:
 		case 22:
+			// Case 22: Endgame news reports
 			_vm->_audioVideoId = READ_LE_UINT16(dataP) - 1;
 			dataP += 2;
 
@@ -462,7 +465,7 @@ void ThreadResource::parsePlayCommands() {
 				_vm->_audioVideoId = -1;
 				parseIndex = 999;
 			} else {
-				int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size();
+				int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size() / 2;
 				_vm->_soundManager.stopVOCPlay();
 				_vm->_eventsManager.getMouseInfo();
 
@@ -492,7 +495,7 @@ void ThreadResource::parsePlayCommands() {
 					_vm->_soundManager.stopVOCPlay();
 
 					if (i == (count - 1))
-						_vm->_eventsManager.delay(480);
+						_vm->_eventsManager.delayClick(480);
 
 					if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked)
 						break;
@@ -594,16 +597,21 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 10:
+			// Pick the person who is to die, during startup
 			if (_vm->_iForceDeath == -1) {
+				// No specific person has been preset to be killed, so pick one randomly. 
+				// The loop below was used because the victim was persisted from the previous 
+				// play-through, so it ensured that a different victim is picked.
 				int randomVal;
 				do {
 					randomVal = _vm->getRandomNumber(3) + 1;
-				} while (randomVal == _vm->_voy._field4380);
+				} while (randomVal == _vm->_voy._victimNumber);
 
-				_vm->_voy._field4380 = randomVal;
+				_vm->_voy._victimNumber = randomVal;
 				WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal);
 			} else {
-				_vm->_voy._field4380 = _vm->_iForceDeath;
+				// Player has seen something that locks in the character to die
+				_vm->_voy._victimNumber = _vm->_iForceDeath;
 				WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath);
 			}
 
@@ -660,11 +668,13 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 18:
+			// Called during the murder (Sunday 10:30PM) time period, to specify the
+			// time expired point at which the murder takes place
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2);
 
 			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2)
-				_vm->_voy._field4F2 = v3;
+				_vm->_voy._murderThreshold = v3;
 			
 			dataP += 4;
 			break;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index b3b920c..ce7da49 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -70,8 +70,11 @@ Common::Error VoyeurEngine::run() {
 
 	_eventsManager.resetMouse();
 	if (doHeadTitle()) {
+		// The original allows the victim to be explicitly specified via the command line.
+		// We don't currently support this in ScummVM, but I'm leaving the code below
+		// in case we ever want to make use of it.
 		if (_iForceDeath >= 1 && _iForceDeath <= 4)
-			_voy._eventFlags |= 0x80;
+			_voy._eventFlags |= EVTFLAG_VICTIM_PRESET;
 
 		playStamp();
 		if (!shouldQuit())
@@ -116,12 +119,6 @@ void VoyeurEngine::globalInitBolt() {
 	assert(_graphicsManager._fontPtr->_curFont);
 
 	// Setup default flags
-	_voy._eventFlags = EVTFLAG_TIME_DISABLED;
-	_voy._field4376 = _voy._field4378 = 127;
-	_voy._field4F2 = 9999;
-	_voy._aptLoadMode = -1;
-	_voy._eventFlags |= EVTFLAG_100;
-	
 	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
 	_eventsManager.addFadeInt();
 }
@@ -240,7 +237,6 @@ bool VoyeurEngine::doLock() {
 	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
 
 	if (_bVoy->getBoltGroup(0x700)) {
-		_voy._field4380 = 0;
 		_voy._viewBounds = _bVoy->boltEntry(0x704)._rectResource;
 
 		Common::String password = "3333";
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 08c0a27..16c2c40 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -177,7 +177,7 @@ public:
 
 	int _audioVideoId;
 	const int *_resolvePtr;
-	int _iForceDeath; // CHECKME: The original initializes it in ESP_init()
+	int _iForceDeath;
 	int _checkTransitionId;
 	int _gameHour;
 	int _gameMinute;
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 826c4d1..3e32397 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -951,7 +951,7 @@ int VoyeurEngine::getChooseButton()  {
 			
 			for (uint idx = 0; idx < hotspots.size(); ++idx) {
 				if (hotspots[idx].contains(pt)) {
-					if (!_voy._field4F0 || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+					if (!_voy._victimMurdered || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
 						selectedIndex = idx;
 						if (selectedIndex != prevIndex) {
 							PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;


Commit: 0c1a0a28c21fba8c165919b9565c2148026217db
    https://github.com/scummvm/scummvm/commit/0c1a0a28c21fba8c165919b9565c2148026217db
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T19:45:52-08:00

Commit Message:
VOYEUR: Re-enabled and completed implementing title sequence

Changed paths:
    engines/voyeur/detection.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp
index 10f9604..9a942b6 100644
--- a/engines/voyeur/detection.cpp
+++ b/engines/voyeur/detection.cpp
@@ -76,7 +76,7 @@ public:
 	}
 
 	virtual const char *getOriginalCopyright() const {
-		return "Voyeur (c)";
+		return "Voyeur (c) Philips P.O.V. Entertainment Group";
 	}
 
 	virtual bool hasFeature(MetaEngineFeature f) const;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index ce7da49..5886867 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -143,7 +143,6 @@ bool VoyeurEngine::doHeadTitle() {
 	_eventsManager.startMainClockInt();
 
 	if (_loadGameSlot == -1) {
-	/*
 		// Show starting screen
 		if (_bVoy->getBoltGroup(0x500)) {
 			showConversionScreen();
@@ -168,14 +167,16 @@ bool VoyeurEngine::doHeadTitle() {
 		// Opening
 		if (!_eventsManager._mouseClicked) {
 			doOpening();
+
+			_eventsManager.getMouseInfo();
 			doTransitionCard("Saturday Afternoon", "Player's Apartment");
 			_eventsManager.delayClick(90);
 		} else {
 			_eventsManager._mouseClicked = false;
 		}
-	*/
-		if (_voy._eventFlags & 0x80) {
-			// Add initial game event set
+
+		if (_voy._eventFlags & EVTFLAG_VICTIM_PRESET) {
+			// Preset victim turned on, so add a default set of incriminating videos
 			if (_voy._eventCount <= 1)
 				_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
 			if (_voy._eventCount <= 2)
@@ -443,15 +444,16 @@ void VoyeurEngine::doOpening() {
 
 	byte *frameTable = _bVoy->memberAddr(0x215);
 	byte *xyTable = _bVoy->memberAddr(0x216);
-	byte *whTable = _bVoy->memberAddr(0x217);
+//	byte *whTable = _bVoy->memberAddr(0x217);
 	int frameIndex = 0;
-	int creditShow = 1;
-	warning("TODO: %x %x %x %d %d", frameTable, xyTable, whTable, creditShow, frameIndex);
+	bool creditShow = true;
+	PictureResource *textPic = nullptr;
+	Common::Point textPos;
 
 	_voy._vocSecondsOffset = 0;
 	_voy._RTVNum = 0;
 	_voy._field468 = _voy._RTVNum;
-	_voy._eventFlags = 16;
+	_voy._eventFlags |= EVTFLAG_RECORDING;
 	_gameHour = 4;
 	_gameMinute  = 0;
 	_audioVideoId = 1;
@@ -467,11 +469,11 @@ void VoyeurEngine::doOpening() {
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort();
 	flipPageAndWait();
-	/*
+	
 	::Video::RL2Decoder decoder;
 	decoder.loadFile("a2300100.rl2");
 	decoder.start();
-	decoder.play(this);
+	
 	while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
 		if (decoder.hasDirtyPalette()) {
 			const byte *palette = decoder.getPalette();
@@ -483,19 +485,40 @@ void VoyeurEngine::doOpening() {
 
 			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
+
+			if (decoder.getCurFrame() >= READ_LE_UINT16(frameTable + frameIndex * 2)) {
+				if (creditShow) {
+					// Show a credit
+					textPic = _bVoy->boltEntry(frameIndex / 2 + 0x202)._picResource;
+					textPos = Common::Point(READ_LE_UINT16(xyTable + frameIndex * 2),
+						READ_LE_UINT16(xyTable + (frameIndex + 1) * 2));
+					
+					creditShow = false;
+				} else {
+					flipPageAndWait();
+
+					creditShow = true;
+				}
+
+				++frameIndex;
+			}
+
+			if (textPic) {
+				_graphicsManager.sDrawPic(textPic, *_graphicsManager._vPort, textPos);
+				flipPageAndWait();
+			}
 		}
 
-		_eventsManager.pollEvents();
-		g_system->delayMillis(10);
+		_eventsManager.getMouseInfo();
+		_eventsManager.delay(5);
 	}
-	*/
 
 	if ((_voy._RTVNum - _voy._field468) < 2)
 		_eventsManager.delay(60);
 
 	_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
 	_voy.addVideoEventEnd();
-	_voy._eventFlags &= EVTFLAG_RECORDING;
+	_voy._eventFlags &= ~EVTFLAG_RECORDING;
 
 	_bVoy->freeBoltGroup(0x200);
 }


Commit: 90b7d10a77cfd0ed43dd792d82d148211c9371c1
    https://github.com/scummvm/scummvm/commit/90b7d10a77cfd0ed43dd792d82d148211c9371c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T20:00:59-08:00

Commit Message:
VOYEUR: Fixes to keep credits on-screen during opening sequence

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 5886867..150d567 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -486,7 +486,7 @@ void VoyeurEngine::doOpening() {
 			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
 
-			if (decoder.getCurFrame() >= READ_LE_UINT16(frameTable + frameIndex * 2)) {
+			if (decoder.getCurFrame() >= READ_LE_UINT32(frameTable + frameIndex * 4)) {
 				if (creditShow) {
 					// Show a credit
 					textPic = _bVoy->boltEntry(frameIndex / 2 + 0x202)._picResource;
@@ -495,7 +495,7 @@ void VoyeurEngine::doOpening() {
 					
 					creditShow = false;
 				} else {
-					flipPageAndWait();
+					textPic = nullptr;
 
 					creditShow = true;
 				}


Commit: d5231aa862538bba94e456fd70fbdeb6a4b0f9ca
    https://github.com/scummvm/scummvm/commit/d5231aa862538bba94e456fd70fbdeb6a4b0f9ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T20:44:50-08:00

Commit Message:
VOYEUR: Moved RL2Decoder into Voyeur namespace, and merged with VoyeurRL2Decoder

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 855536b..57a6494 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -29,7 +29,7 @@
 #include "audio/decoders/raw.h"
 #include "graphics/surface.h"
 
-namespace Video {
+namespace Voyeur {
 
 // Number of audio frames to keep audio track topped up when playing back video
 #define SOUND_FRAMES_READAHEAD 3
@@ -467,13 +467,7 @@ Audio::AudioStream *RL2Decoder::RL2AudioTrack::getAudioStream() const {
 	return _audStream;
 }
 
-} // End of namespace Video
-
-/*------------------------------------------------------------------------*/
-
-namespace Voyeur {
-
-void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset, 
+void RL2Decoder::play(VoyeurEngine *vm, int resourceOffset, 
 		byte *frames, byte *imgPos) {
 	vm->flipPageAndWait();
 	int paletteStart = getPaletteStart();
@@ -513,4 +507,4 @@ void VoyeurRL2Decoder::play(VoyeurEngine *vm, int resourceOffset,
 	}
 }
 
-} // End of namespace Video
+} // End of namespace Voyeur
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index bfa9c8c..30d6082 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -37,17 +37,13 @@ namespace Voyeur {
 
 class VoyeurEngine;
 
-}
-
-namespace Video {
-
 /**
  * Decoder for RL2 videos.
  *
  * Video decoder used in engines:
  *  - voyeur
  */
-class RL2Decoder : public VideoDecoder {
+class RL2Decoder : public Video::VideoDecoder {
 private:
 	class RL2FileHeader {
 	public:
@@ -180,14 +176,7 @@ public:
 	int getPaletteStart() const { return _paletteStart; }
 	int getPaletteCount() const { return _header._colorCount; }
 	const RL2FileHeader &getHeader() { return _header; }
-};
-
-} // End of namespace Video
 
-namespace Voyeur {
-
-class VoyeurRL2Decoder: public Video::RL2Decoder {
-public:
 	/**
 	 * Play back a given Voyeur RL2 video
 	 * @param vm			Engine reference
@@ -198,6 +187,6 @@ public:
 	void play(VoyeurEngine *vm, int resourceOffset = 0, byte *frames = NULL, byte *imgPos = NULL);
 };
 
-}
+} // End of namespace Voyeur
 
 #endif /* VOYEUR_ANIMATION_H */
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 150d567..177ee55 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -470,7 +470,7 @@ void VoyeurEngine::doOpening() {
 	(*_graphicsManager._vPort)->setupViewPort();
 	flipPageAndWait();
 	
-	::Video::RL2Decoder decoder;
+	RL2Decoder decoder;
 	decoder.loadFile("a2300100.rl2");
 	decoder.start();
 	
@@ -486,7 +486,7 @@ void VoyeurEngine::doOpening() {
 			Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
 				(byte *)_graphicsManager._screenSurface.getPixels());
 
-			if (decoder.getCurFrame() >= READ_LE_UINT32(frameTable + frameIndex * 4)) {
+			if (decoder.getCurFrame() >= (int32)READ_LE_UINT32(frameTable + frameIndex * 4)) {
 				if (creditShow) {
 					// Show a credit
 					textPic = _bVoy->boltEntry(frameIndex / 2 + 0x202)._picResource;
@@ -524,7 +524,7 @@ void VoyeurEngine::doOpening() {
 }
 
 void VoyeurEngine::playRL2Video(const Common::String &filename) {
-	::Video::RL2Decoder decoder;
+	RL2Decoder decoder;
 	decoder.loadFile(filename);
 	decoder.start();
 
@@ -562,7 +562,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 		pic = _bVoy->boltEntry(0xE00 + _eventsManager._videoDead)._picResource;
 	}
 
-	::Video::RL2Decoder decoder;
+	RL2Decoder decoder;
 	decoder.loadVideo(videoId);
 
 	decoder.start();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 3e32397..cfd0b60 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -233,7 +233,7 @@ void VoyeurEngine::doTailTitle() {
 	_graphicsManager.screenReset();
 	
 	if (_bVoy->getBoltGroup(0x600)) {
-		VoyeurRL2Decoder decoder;
+		RL2Decoder decoder;
 		decoder.loadFile("a1100200.rl2");
 		decoder.start();
 		decoder.play(this);
@@ -743,7 +743,7 @@ void VoyeurEngine::doGossip() {
 		return;
 
 	// Load the gossip animation
-	VoyeurRL2Decoder decoder;
+	RL2Decoder decoder;
 	decoder.loadFile("a2050100.rl2", false);
 	decoder.start();
 


Commit: 77d8810b1930368ae3d8fe297d496347d49eca59
    https://github.com/scummvm/scummvm/commit/77d8810b1930368ae3d8fe297d496347d49eca59
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T21:05:56-08:00

Commit Message:
VOYEUR: Converted RL2 header getFrameRate to use Common::Rational

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 57a6494..5318da2 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -220,8 +220,9 @@ bool RL2Decoder::RL2FileHeader::isValid() const {
 	return _signature == MKTAG('R','L','V','2') || _signature != MKTAG('R','L','V','3');
 }
 
-double RL2Decoder::RL2FileHeader::getFrameRate() const {
-	return (_soundRate > 0) ? _rate / _defSoundSize : 11025 / 1103;
+Common::Rational RL2Decoder::RL2FileHeader::getFrameRate() const {
+	return (_soundRate > 0) ? Common::Rational(_rate, _defSoundSize) : 
+		Common::Rational(11025, 1103);
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 30d6082..8ebebaa 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -69,7 +69,7 @@ private:
 		~RL2FileHeader();
 		void load(Common::SeekableReadStream *stream);
 		bool isValid() const;
-		double getFrameRate() const;
+		Common::Rational getFrameRate() const;
 	};
 
 	class SoundFrame {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 177ee55..37dd527 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -565,8 +565,9 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	RL2Decoder decoder;
 	decoder.loadVideo(videoId);
 
+	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000, 
+		decoder.getHeader().getFrameRate().toInt()));
 	decoder.start();
-	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000, decoder.getHeader().getFrameRate()));
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 
 	_eventsManager.getMouseInfo();


Commit: bb37927afdd155d78ca5f9f896e8857423da459c
    https://github.com/scummvm/scummvm/commit/bb37927afdd155d78ca5f9f896e8857423da459c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T21:14:48-08:00

Commit Message:
VOYEUR: Cleaner implementation of RL2Decoder seek

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 5318da2..8206707 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -268,8 +268,8 @@ bool RL2Decoder::RL2VideoTrack::endOfTrack() const {
 }
 
 bool RL2Decoder::RL2VideoTrack::seek(const Audio::Timestamp &time) {
-	int frame = time.totalNumberOfFrames();
-
+	int frame = getFrameAtTime(time);
+		
 	if (frame < 0 || frame >= _header._numFrames)
 		return false;
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 37dd527..1142599 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -565,8 +565,7 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
 	RL2Decoder decoder;
 	decoder.loadVideo(videoId);
 
-	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000, 
-		decoder.getHeader().getFrameRate().toInt()));
+	decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000)); 
 	decoder.start();
 	int endFrame = decoder.getCurFrame() + totalFrames; 
 


Commit: 07f57ac65076d5b303e308b154c9fdc0326dacc9
    https://github.com/scummvm/scummvm/commit/07f57ac65076d5b303e308b154c9fdc0326dacc9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-03T21:20:24-08:00

Commit Message:
VOYEUR: Simplified reference to audio and video tracks in the RL2Decoder

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 8206707..ca924d3 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -71,14 +71,15 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 	}
 
 	// Add an audio track if sound is present
-	RL2AudioTrack *audioTrack = NULL;
+	_audioTrack = nullptr;
 	if (_header._soundRate) {
-		audioTrack = new RL2AudioTrack(_header, stream, _soundType);
-		addTrack(audioTrack);
+		_audioTrack = new RL2AudioTrack(_header, stream, _soundType);
+		addTrack(_audioTrack);
 	}
 
 	// Create a video track
-	addTrack(new RL2VideoTrack(_header, audioTrack, stream));
+	_videoTrack = new RL2VideoTrack(_header, _audioTrack, stream);
+	addTrack(_videoTrack);
 
 	// Load the offset/sizes of the video's audio data
 	_soundFrames.reserve(_header._numFrames);
@@ -93,40 +94,20 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
 }
 
 const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const {
-	const Track *track = getTrack(1);
-
-	if (track)
-		return ((const RL2VideoTrack *)track)->getDirtyRects();
+	if (_videoTrack)
+		return _videoTrack->getDirtyRects();
 
 	return 0;
 }
 
 void RL2Decoder::clearDirtyRects() {
-	Track *track = getTrack(1);
-
-	if (track)
-		((RL2VideoTrack *)track)->clearDirtyRects();
+	if (_videoTrack)
+		_videoTrack->clearDirtyRects();
 }
 
 void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
-	Track *track = getTrack(1);
-
-	if (track)
-		((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch);
-}
-
-RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() {
-	Track *track = getTrack(1);
-	assert(track);
-
-	return (RL2VideoTrack *)track;
-}
-
-RL2Decoder::RL2AudioTrack *RL2Decoder::getAudioTrack() {
-	Track *track = getTrack(0);
-	assert(track);
-
-	return (RL2AudioTrack *)track;
+	if (_videoTrack)
+		_videoTrack->copyDirtyRectsToBuffer(dst, pitch);
 }
 
 void RL2Decoder::readNextPacket() {
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 8ebebaa..b8f0c57 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -150,6 +150,8 @@ private:
 	};
 
 private:
+	RL2AudioTrack *_audioTrack;
+	RL2VideoTrack *_videoTrack;
 	Common::SeekableReadStream *_fileStream;
 	Audio::Mixer::SoundType _soundType;
 	RL2FileHeader _header;
@@ -171,8 +173,8 @@ public:
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();
 	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
-	RL2VideoTrack *getVideoTrack();
-	RL2AudioTrack *getAudioTrack();
+	RL2VideoTrack *getVideoTrack() { return _videoTrack; }
+	RL2AudioTrack *getAudioTrack() { return _audioTrack; }
 	int getPaletteStart() const { return _paletteStart; }
 	int getPaletteCount() const { return _header._colorCount; }
 	const RL2FileHeader &getHeader() { return _header; }


Commit: 49e3c9bcd20e12b0872e6e7b11416632c49190a7
    https://github.com/scummvm/scummvm/commit/49e3c9bcd20e12b0872e6e7b11416632c49190a7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-04T17:35:42-08:00

Commit Message:
VOYEUR: Moved RL2Decoder::seek to be seekIntern

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index ca924d3..7dc53b9 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -126,9 +126,9 @@ void RL2Decoder::readNextPacket() {
 	}
 }
 
-bool RL2Decoder::seek(const Audio::Timestamp &where) {
+bool RL2Decoder::seekIntern(const Audio::Timestamp &where) {
 	_soundFrameNumber = -1;
-	return VideoDecoder::seek(where);
+	return VideoDecoder::seekIntern(where);
 }
 
 void RL2Decoder::close() {
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index b8f0c57..43dd6a0 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -168,7 +168,7 @@ public:
 
 	virtual void readNextPacket();
 	virtual void close();
-	virtual bool seek(const Audio::Timestamp &where);
+	virtual bool seekIntern(const Audio::Timestamp &time);
 
 	const Common::List<Common::Rect> *getDirtyRects() const;
 	void clearDirtyRects();


Commit: f075f0336ea4f3315334f77d63836455c6a28e51
    https://github.com/scummvm/scummvm/commit/f075f0336ea4f3315334f77d63836455c6a28e51
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-04T19:23:15-08:00

Commit Message:
VOYEUR: Convert ControlResource::_ptr raw data to a deserialized state object

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index ed308f4..9f528c1 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -237,7 +237,7 @@ void SVoy::reviewComputerEvent(int eventIndex) {
 }
 
 bool SVoy::checkForKey() {
-	WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 0);
+	_vm->_controlPtr->_state->_v2 = 0;
 	if (_vm->_voy._victimMurdered)
 		return false;
 
@@ -247,25 +247,25 @@ bool SVoy::checkForKey() {
 
 		switch (e._type) {
 		case EVTYPE_VIDEO:
-			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			switch (_vm->_controlPtr->_state->_v1) {
 			case 1:
 				if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
+					_vm->_controlPtr->_state->_v2 = 1;
 				break;
 
 			case 2:
 				if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
+					_vm->_controlPtr->_state->_v2 = 2;
 				break;
 
 			case 3:
 				if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+					_vm->_controlPtr->_state->_v2 = 3;
 				break;
 
 			case 4:
 				if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
+					_vm->_controlPtr->_state->_v2 = 4;
 				break;
 			
 			default:
@@ -274,17 +274,17 @@ bool SVoy::checkForKey() {
 			break;
 
 		case EVTYPE_AUDIO:
-			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			switch (_vm->_controlPtr->_state->_v1) {
 			case 1:
 				if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
+					_vm->_controlPtr->_state->_v2 = 1;
 				break;
 	
 			case 3:
 				if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+					_vm->_controlPtr->_state->_v2 = 3;
 				if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+					_vm->_controlPtr->_state->_v2 = 3;
 				break;
 
 			default:
@@ -293,10 +293,10 @@ bool SVoy::checkForKey() {
 			break;
 
 		case EVTYPE_EVID:
-			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			switch (_vm->_controlPtr->_state->_v1) {
 			case 4:
 				if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
+					_vm->_controlPtr->_state->_v2 = 4;
 
 			default:
 				break;
@@ -304,10 +304,10 @@ bool SVoy::checkForKey() {
 			break;
 
 		case EVTYPE_COMPUTER:
-			switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+			switch (_vm->_controlPtr->_state->_v1) {
 			case 2:
 				if (e._computerOn == 13 && e._computerOff > 76)
-					WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
+					_vm->_controlPtr->_state->_v2 = 2;
 				break;
 
 			default:
@@ -316,8 +316,7 @@ bool SVoy::checkForKey() {
 			break;
 		}
 
-		if (READ_LE_UINT32(_vm->_controlPtr->_ptr + 8) == 
-				READ_LE_UINT32(_vm->_controlPtr->_ptr + 4))
+		if (_vm->_controlPtr->_state->_v2 == _vm->_controlPtr->_state->_v1)
 			return true;
 	}
 
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ce2ebc5..e39c161 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -565,6 +565,9 @@ void StampBoltFile::initResource(int resType) {
 	case 0:
 		initThread();
 		break;
+	case 4:
+		initState();
+		break;
 	case 6:
 		initPtr();
 		break;
@@ -591,6 +594,9 @@ void StampBoltFile::initPtr() {
 		_state._curMemberPtr->_data);
 }
 
+	void initControlData();
+
+
 void StampBoltFile::initControl() {
 	initDefault();
 
@@ -602,6 +608,14 @@ void StampBoltFile::initControl() {
 	_state._vm->_controlPtr = res;
 }
 
+void StampBoltFile::initState() {
+	initDefault();
+
+	assert(_state._curMemberPtr->_size == 16);
+	_state._curMemberPtr->_stateResource = new StateResource(_state, 
+		_state._curMemberPtr->_data);
+}
+
 /*------------------------------------------------------------------------*/
 
 BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
@@ -650,7 +664,9 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f, uint16 id): _file(f), _id(id
 	_fontInfoResource = nullptr;
 	_cMapResource = nullptr;
 	_vInitCycleResource = nullptr;
+
 	_ptrResource = nullptr;
+	_stateResource = nullptr;
 	_controlResource = nullptr;
 	_vInitCycleResource = nullptr;
 	_threadResource = nullptr;
@@ -674,9 +690,12 @@ BoltEntry::~BoltEntry() {
 	delete _fontResource;
 	delete _fontInfoResource;
 	delete _cMapResource;
-	delete _vInitCycleResource;
+
 	delete _ptrResource;
 	delete _controlResource;
+	delete _stateResource;
+	delete _vInitCycleResource;
+	delete _threadResource;
 }
 
 void BoltEntry::load() {
@@ -690,7 +709,7 @@ bool BoltEntry::hasResource() const {
 	return _rectResource ||  _picResource || _viewPortResource || _viewPortListResource
 		|| _fontResource || _fontInfoResource || _cMapResource 
 		|| _vInitCycleResource 
-		|| _ptrResource || _controlResource || _threadResource;
+		|| _ptrResource || _controlResource || _stateResource || _threadResource;
 }
 
 /*------------------------------------------------------------------------*/
@@ -1604,9 +1623,10 @@ PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
 /*------------------------------------------------------------------------*/
 
 ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
-	// Get pointer
-	uint32 ptrId = READ_LE_UINT32(&src[0x32]);
-	state._curLibPtr->resolveIt(ptrId, &_ptr);
+	// Get Id for the state data. Since it refers to a following entry in the same
+	// group, for simplicity we set the _state back in the main playStamp method
+	_stateId = READ_LE_UINT32(&src[0x32]);
+	_state = nullptr;
 
 	for (int i = 0; i < 8; ++i)
 		_memberIds[i] = READ_LE_UINT16(src + i * 2);
@@ -1624,4 +1644,15 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 
 /*------------------------------------------------------------------------*/
 
+StateResource::StateResource(BoltFilesState &state, const byte *src):
+		_v0(_vals[0]), _v1(_vals[1]), _v2(_vals[2]), _v3(_vals[3]) {
+	for (int i = 0; i < 4; ++i)
+		_vals[i] = READ_LE_UINT32(src + i * 4);
+}
+
+void StateResource::synchronize(Common::Serializer &s) {
+	for (int i = 0; i < 4; ++i)
+		s.syncAsSint32LE(_vals[i]);
+}
+
 } // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 7cdb61f..a0d6655 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -44,6 +44,7 @@ class CMapResource;
 class VInitCycleResource;
 class PtrResource;
 class ControlResource;
+class StateResource;
 class ThreadResource;
 
 #define DECOMPRESS_SIZE 0x7000
@@ -158,6 +159,7 @@ public:
 class StampBoltFile: public BoltFile {
 private:
 	void initThread();
+	void initState();
 	void initPtr();
 	void initControl();
 protected:
@@ -212,6 +214,7 @@ public:
 	// stampblt.blt resource types
 	PtrResource *_ptrResource;
 	ControlResource *_controlResource;
+	StateResource *_stateResource;
 	ThreadResource *_threadResource;
 public:
 	BoltEntry(Common::SeekableReadStream *f, uint16 id);
@@ -484,12 +487,30 @@ class ControlResource {
 public:
 	int _memberIds[8];
 	byte *_entries[8];
-	byte *_ptr;
+	int _stateId;
+	StateResource *_state;
 
 	ControlResource(BoltFilesState &state, const byte *src);
 	virtual ~ControlResource() {}
 };
 
+class StateResource {
+public:
+	int _vals[4];
+	int &_v0;
+	int &_v1;
+	int &_v2;
+	int &_v3;
+
+	StateResource(BoltFilesState &state, const byte *src);
+	virtual ~StateResource() {}
+
+	/**
+	 * Synchronizes the game data
+	 */
+	void synchronize(Common::Serializer &s);
+};
+
 class ThreadResource {
 public:
 	static int _useCount[8];
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index b766733..57d878f 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -370,7 +370,7 @@ void ThreadResource::parsePlayCommands() {
 			// Play an audio event
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -401,7 +401,7 @@ void ThreadResource::parsePlayCommands() {
 			// Play a video event
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -512,7 +512,7 @@ void ThreadResource::parsePlayCommands() {
 			// Check whether transition to a given time period is allowed, and
 			// if so, load the time information for the new time period
 			v2 = READ_LE_UINT16(dataP);
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				_vm->_voy._field470 = 5;
 				int count = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4);
@@ -547,7 +547,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				int idx = 0;
 				while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -565,7 +565,7 @@ void ThreadResource::parsePlayCommands() {
  			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				int idx = 0;
 				while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -583,7 +583,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				int idx = 0;
 				while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -608,11 +608,11 @@ void ThreadResource::parsePlayCommands() {
 				} while (randomVal == _vm->_voy._victimNumber);
 
 				_vm->_voy._victimNumber = randomVal;
-				WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal);
+				_vm->_controlPtr->_state->_v1 = randomVal;
 			} else {
 				// Player has seen something that locks in the character to die
 				_vm->_voy._victimNumber = _vm->_iForceDeath;
-				WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath);
+				_vm->_controlPtr->_state->_v1 = _vm->_iForceDeath;
 			}
 
 			_vm->saveLastInplay();
@@ -625,7 +625,7 @@ void ThreadResource::parsePlayCommands() {
 		case 12:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				_vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
 				_vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true;
 			}
@@ -636,7 +636,7 @@ void ThreadResource::parsePlayCommands() {
 		case 13:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
 				_vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6);
@@ -673,7 +673,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2);
 
-			if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2)
+			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2)
 				_vm->_voy._murderThreshold = v3;
 			
 			dataP += 4;
@@ -715,9 +715,6 @@ void ThreadResource::parsePlayCommands() {
 }
 
 const byte *ThreadResource::cardPerform(const byte *card) {
-	const byte *p2;
-	byte *pDest;
-
 	uint16 id = *card++;
 	int varD = 5;
 	uint32 v2;
@@ -730,82 +727,87 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 	case 1:
 		v2 = READ_LE_UINT32(card);
 		card += 4;
-		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card << 2), v2);
-		++card;
+		_vm->_controlPtr->_state->_vals[*card++] = v2;
 		break;
 
 	case 2:
-		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)),
-		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		v2 = _vm->_controlPtr->_state->_vals[*card++];
+		_vm->_controlPtr->_state->_vals[*card++] = v2;
 		break;
 
 	case 3:
 		v2 = READ_LE_UINT32(card);
 		card += 4;
-		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		_vm->_controlPtr->_state->_vals[*card++] = v2;
 		break;
 
 	case 4:
-		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
-		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		v2 = _vm->_controlPtr->_state->_vals[*card++];
+		_vm->_controlPtr->_state->_vals[*card++] = v2;
 		break;
 
-	case 5:
+	case 5: {
 		v2 = READ_LE_UINT32(card);
 		card += 4;
-		pDest = _vm->_controlPtr->_ptr + (*card++ << 2);
-		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2);
+		int &v = _vm->_controlPtr->_state->_vals[*card++];
+		v -= v2;
 		break;
+	}
 
-	case 6:
+	case 6: {
 		idx1 = *card++;
 		idx2 = *card++;
 
-		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + idx2);
-		pDest = _vm->_controlPtr->_ptr + idx1;
-		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2);
+		v2 = _vm->_controlPtr->_state->_vals[idx1];
+		int &v = _vm->_controlPtr->_state->_vals[idx2];
+		v -= v2;
 		break;
+	}
 
-	case 7:
+	case 7: {
 		v3 = *card++;
 		v2 = READ_LE_UINT32(card);
 		card += 4;
-		pDest = _vm->_controlPtr->_ptr + (v3 << 2);
-		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * v2);
+		int &v = _vm->_controlPtr->_state->_vals[v3];
+		v *= v2;
 		break;
+	}
 
-	case 8:
+	case 8: {
 		idx1 = *card++;
 		idx2 = *card++;
 
-		pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
-		p2 = _vm->_controlPtr->_ptr + (idx2 << 2);
-		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * READ_LE_UINT32(p2));
+		int &v1 = _vm->_controlPtr->_state->_vals[idx1];
+		int &v2 = _vm->_controlPtr->_state->_vals[idx2];
+		v1 *= v2;
 		break;
+	}
 
-	case 9:
+	case 9: {
 		idx1 = *card++;
 		v2 = READ_LE_UINT32(card);
 		card += 4;
 
-		pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
-		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / v2);
+		int &v = _vm->_controlPtr->_state->_vals[idx1];
+		v /= v2;
 		break;
+	}
 
-	case 10:
+	case 10: {
 		idx1 = *card++;
 		idx2 = *card++;
 
-		pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
-		p2 = _vm->_controlPtr->_ptr + (idx2 << 2);
-		WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / READ_LE_UINT32(p2));
+		int &v1 = _vm->_controlPtr->_state->_vals[idx1];
+		int &v2 = _vm->_controlPtr->_state->_vals[idx2];
+		v1 /= v2;
 		break;
-	
+	}
+
 	case 11:
 		v2 = READ_LE_UINT32(card);
 		card += 4;
 		v2 = _vm->getRandomNumber(v2 - 1) + 1;
-		WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+		_vm->_controlPtr->_state->_vals[*card++] = v2;
 		break;
 
 	case 17:
@@ -815,7 +817,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		break;
 
 	case 18:
-		v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
+		v2 = _vm->_controlPtr->_state->_vals[*card++];
 		_vm->_glGoState = getStateFromID(v2);
 		break;
 
@@ -921,45 +923,45 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 }
 
 bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
-	uint32 vLong, vLong2;
+	int vLong, vLong2;
 
 	switch (cardCmdId) {
 	case 21:
-		vLong = READ_LE_UINT32(pSrc + 1);
-		return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) == vLong;
+		vLong = (int32)READ_LE_UINT32(pSrc + 1);
+		return _vm->_controlPtr->_state->_vals[*pSrc] == vLong;
 
 	case 22:
-		vLong = READ_LE_UINT32(pSrc + 1);
-		return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) != vLong;
+		vLong = (int32)READ_LE_UINT32(pSrc + 1);
+		return _vm->_controlPtr->_state->_vals[*pSrc] != vLong;
 
 	case 23:
-		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
-		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+		vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
 		return vLong == vLong2;
 
 	case 24:
-		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
-		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+		vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
 		return vLong != vLong2;
 
 	case 25:
-		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); 
-		vLong2 = READ_LE_UINT32(pSrc + 1);
+		vLong = _vm->_controlPtr->_state->_vals[*pSrc]; 
+		vLong2 = (int32)READ_LE_UINT32(pSrc + 1);
 		return vLong < vLong2;
 
 	case 26:
-		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)); 
-		vLong2 = READ_LE_UINT32(pSrc + 1);
+		vLong = _vm->_controlPtr->_state->_vals[*pSrc]; 
+		vLong2 = (int32)READ_LE_UINT32(pSrc + 1);
 		return vLong > vLong2;
 
 	case 27:
-		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
-		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+		vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
 		return vLong < vLong2;
 
 	case 28:
-		vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
-		vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+		vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+		vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
 		return vLong > vLong2;
 
 	default:
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1142599..8902297 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -696,8 +696,7 @@ void VoyeurEngine::flipPageAndWaitForFade() {
 
 void VoyeurEngine::showEndingNews() {
 	_playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700;
-	_voy._boltGroupId2 = (READ_LE_UINT16(_controlPtr->_ptr + 4) 
-		- 1) * 256 + 0x7B00;
+	_voy._boltGroupId2 = (_controlPtr->_state->_v1 - 1) * 256 + 0x7B00;
 
 	_bVoy->getBoltGroup(_playStampGroupId);
 	_bVoy->getBoltGroup(_voy._boltGroupId2);
@@ -857,6 +856,7 @@ void VoyeurEngine::synchronize(Common::Serializer &s) {
 	_voy.synchronize(s);
 	_graphicsManager.synchronize(s);
 	_mainThread->synchronize(s);
+	_controlPtr->_state->synchronize(s);
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index cfd0b60..747e0ed 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -31,6 +31,9 @@ void VoyeurEngine::playStamp() {
 	_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
 
 	_stampLibPtr->getBoltGroup(0);
+	_controlPtr->_state = _stampLibPtr->boltEntry(_controlPtr->_stateId >> 16)._stateResource;
+	assert(_controlPtr->_state);
+	
 	_resolvePtr = &RESOLVE_TABLE[0];
 	initStamp();
 
@@ -640,7 +643,7 @@ void VoyeurEngine::reviewTape() {
 			pt = _eventsManager.getMousePos();
 			if (_eventsManager._mouseClicked && _voy._viewBounds->left == pt.x &&
 					(_voy._eventFlags & EVTFLAG_40) && _eventsManager._rightClick) {
-				WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
+				_controlPtr->_state->_v1 = (pt.y / 60) + 1;
 				foundIndex = -1;
 				_eventsManager._rightClick = 0;
 			}
@@ -806,38 +809,38 @@ void VoyeurEngine::doTapePlaying() {
 }
 
 bool VoyeurEngine::checkForMurder() {
-	int v = READ_LE_UINT32(_controlPtr->_ptr + 12);
+	int v = _controlPtr->_state->_v3;
 
 	for (int idx = 0; idx < _voy._eventCount; ++idx) {
 		VoyeurEvent &evt = _voy._events[idx];
 
 		if (evt._type == EVTYPE_VIDEO) {
-			switch (READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+			switch (_controlPtr->_state->_v1) {
 			case 1:
 				if (evt._audioVideoId == 41 && evt._computerOn <= 15 &&
 						(evt._computerOff + evt._computerOn) >= 16) {
-					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 1);
+					_controlPtr->_state->_v3 = 1;
 				}
 				break;
 
 			case 2:
 				if (evt._audioVideoId == 53 && evt._computerOn <= 19 &&
 						(evt._computerOff + evt._computerOn) >= 21) {
-					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 2);
+					_controlPtr->_state->_v3 = 2;
 				}
 				break;
 
 			case 3:
 				if (evt._audioVideoId == 50 && evt._computerOn <= 28 &&
 						(evt._computerOff + evt._computerOn) >= 29) {
-					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 3);
+					_controlPtr->_state->_v3 = 3;
 				}
 				break;
 
 			case 4:
 				if (evt._audioVideoId == 43 && evt._computerOn <= 10 &&
 						(evt._computerOff + evt._computerOn) >= 14) {
-					WRITE_LE_UINT32(_controlPtr->_ptr + 12, 4);
+					_controlPtr->_state->_v3 = 4;
 				}
 				break;
 
@@ -846,13 +849,13 @@ bool VoyeurEngine::checkForMurder() {
 			}
 		}
 
-		if (READ_LE_UINT32(_controlPtr->_ptr + 12) == READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+		if (_controlPtr->_state->_v3 == _controlPtr->_state->_v1) {
 			_voy._videoEventId = idx;
 			return true;
 		}
 	}
 
-	WRITE_LE_UINT32(_controlPtr->_ptr + 12, v);
+	_controlPtr->_state->_v3 = v;
 	_voy._videoEventId = -1;
 	return false;
 }
@@ -891,7 +894,7 @@ bool VoyeurEngine::checkForIncriminate() {
 		}
 
 		if (_voy._field4382) {
-			WRITE_LE_UINT32(_controlPtr->_ptr + 12, 88);
+			_controlPtr->_state->_v3 = 88;
 			_voy._videoEventId = idx;
 			return true;
 		}
@@ -951,7 +954,7 @@ int VoyeurEngine::getChooseButton()  {
 			
 			for (uint idx = 0; idx < hotspots.size(); ++idx) {
 				if (hotspots[idx].contains(pt)) {
-					if (!_voy._victimMurdered || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+					if (!_voy._victimMurdered || ((int)idx + 1) != _controlPtr->_state->_v1) {
 						selectedIndex = idx;
 						if (selectedIndex != prevIndex) {
 							PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;


Commit: eca87a63e9215ee6f37f62d5c9bb2389362512ee
    https://github.com/scummvm/scummvm/commit/eca87a63e9215ee6f37f62d5c9bb2389362512ee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-04T19:38:35-08:00

Commit Message:
VOYEUR: Renamings for the fields of the new StateResource class

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 9f528c1..f0521d2 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -237,35 +237,34 @@ void SVoy::reviewComputerEvent(int eventIndex) {
 }
 
 bool SVoy::checkForKey() {
-	_vm->_controlPtr->_state->_v2 = 0;
+	_vm->_controlPtr->_state->_victimEvidenceIndex = 0;
 	if (_vm->_voy._victimMurdered)
 		return false;
 
 	for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) {
 		VoyeurEvent &e = _events[eventIdx];
-		int v1;
 
 		switch (e._type) {
 		case EVTYPE_VIDEO:
-			switch (_vm->_controlPtr->_state->_v1) {
+			switch (_vm->_controlPtr->_state->_victimIndex) {
 			case 1:
 				if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
-					_vm->_controlPtr->_state->_v2 = 1;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 1;
 				break;
 
 			case 2:
 				if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
-					_vm->_controlPtr->_state->_v2 = 2;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 2;
 				break;
 
 			case 3:
 				if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2)
-					_vm->_controlPtr->_state->_v2 = 3;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 3;
 				break;
 
 			case 4:
 				if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
-					_vm->_controlPtr->_state->_v2 = 4;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 4;
 				break;
 			
 			default:
@@ -274,17 +273,17 @@ bool SVoy::checkForKey() {
 			break;
 
 		case EVTYPE_AUDIO:
-			switch (_vm->_controlPtr->_state->_v1) {
+			switch (_vm->_controlPtr->_state->_victimIndex) {
 			case 1:
 				if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
-					_vm->_controlPtr->_state->_v2 = 1;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 1;
 				break;
 	
 			case 3:
 				if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
-					_vm->_controlPtr->_state->_v2 = 3;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 3;
 				if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
-					_vm->_controlPtr->_state->_v2 = 3;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 3;
 				break;
 
 			default:
@@ -293,10 +292,10 @@ bool SVoy::checkForKey() {
 			break;
 
 		case EVTYPE_EVID:
-			switch (_vm->_controlPtr->_state->_v1) {
+			switch (_vm->_controlPtr->_state->_victimIndex) {
 			case 4:
 				if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17)
-					_vm->_controlPtr->_state->_v2 = 4;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 4;
 
 			default:
 				break;
@@ -304,10 +303,10 @@ bool SVoy::checkForKey() {
 			break;
 
 		case EVTYPE_COMPUTER:
-			switch (_vm->_controlPtr->_state->_v1) {
+			switch (_vm->_controlPtr->_state->_victimIndex) {
 			case 2:
 				if (e._computerOn == 13 && e._computerOff > 76)
-					_vm->_controlPtr->_state->_v2 = 2;
+					_vm->_controlPtr->_state->_victimEvidenceIndex = 2;
 				break;
 
 			default:
@@ -316,7 +315,7 @@ bool SVoy::checkForKey() {
 			break;
 		}
 
-		if (_vm->_controlPtr->_state->_v2 == _vm->_controlPtr->_state->_v1)
+		if (_vm->_controlPtr->_state->_victimEvidenceIndex == _vm->_controlPtr->_state->_victimIndex)
 			return true;
 	}
 
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index e39c161..1f83eb6 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1645,7 +1645,8 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
 /*------------------------------------------------------------------------*/
 
 StateResource::StateResource(BoltFilesState &state, const byte *src):
-		_v0(_vals[0]), _v1(_vals[1]), _v2(_vals[2]), _v3(_vals[3]) {
+		_victimIndex(_vals[1]), _victimEvidenceIndex(_vals[2]), 
+		_victimMurderIndex(_vals[3]) {
 	for (int i = 0; i < 4; ++i)
 		_vals[i] = READ_LE_UINT32(src + i * 4);
 }
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index a0d6655..4760148 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -494,13 +494,15 @@ public:
 	virtual ~ControlResource() {}
 };
 
+/**
+ * Stores data about the intended victim
+ */
 class StateResource {
 public:
 	int _vals[4];
-	int &_v0;
-	int &_v1;
-	int &_v2;
-	int &_v3;
+	int &_victimIndex;
+	int &_victimEvidenceIndex;
+	int &_victimMurderIndex;
 
 	StateResource(BoltFilesState &state, const byte *src);
 	virtual ~StateResource() {}
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 57d878f..ba85ec2 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -370,7 +370,7 @@ void ThreadResource::parsePlayCommands() {
 			// Play an audio event
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -401,7 +401,7 @@ void ThreadResource::parsePlayCommands() {
 			// Play a video event
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
 				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -512,7 +512,7 @@ void ThreadResource::parsePlayCommands() {
 			// Check whether transition to a given time period is allowed, and
 			// if so, load the time information for the new time period
 			v2 = READ_LE_UINT16(dataP);
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_voy._field470 = 5;
 				int count = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4);
@@ -547,7 +547,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				int idx = 0;
 				while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -565,7 +565,7 @@ void ThreadResource::parsePlayCommands() {
  			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				int idx = 0;
 				while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -583,7 +583,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2) - 1;
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				int idx = 0;
 				while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999)
 					++idx;
@@ -608,11 +608,11 @@ void ThreadResource::parsePlayCommands() {
 				} while (randomVal == _vm->_voy._victimNumber);
 
 				_vm->_voy._victimNumber = randomVal;
-				_vm->_controlPtr->_state->_v1 = randomVal;
+				_vm->_controlPtr->_state->_victimIndex = randomVal;
 			} else {
 				// Player has seen something that locks in the character to die
 				_vm->_voy._victimNumber = _vm->_iForceDeath;
-				_vm->_controlPtr->_state->_v1 = _vm->_iForceDeath;
+				_vm->_controlPtr->_state->_victimIndex = _vm->_iForceDeath;
 			}
 
 			_vm->saveLastInplay();
@@ -625,7 +625,7 @@ void ThreadResource::parsePlayCommands() {
 		case 12:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
 				_vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true;
 			}
@@ -636,7 +636,7 @@ void ThreadResource::parsePlayCommands() {
 		case 13:
 			v2 = READ_LE_UINT16(dataP);
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4);
 				_vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6);
@@ -673,7 +673,7 @@ void ThreadResource::parsePlayCommands() {
 			v2 = READ_LE_UINT16(dataP);
 			v3 = READ_LE_UINT16(dataP + 2);
 
-			if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2)
+			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2)
 				_vm->_voy._murderThreshold = v3;
 			
 			dataP += 4;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 8902297..286b97e 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -696,7 +696,7 @@ void VoyeurEngine::flipPageAndWaitForFade() {
 
 void VoyeurEngine::showEndingNews() {
 	_playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700;
-	_voy._boltGroupId2 = (_controlPtr->_state->_v1 - 1) * 256 + 0x7B00;
+	_voy._boltGroupId2 = (_controlPtr->_state->_victimIndex - 1) * 256 + 0x7B00;
 
 	_bVoy->getBoltGroup(_playStampGroupId);
 	_bVoy->getBoltGroup(_voy._boltGroupId2);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 747e0ed..4577fe2 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -643,7 +643,7 @@ void VoyeurEngine::reviewTape() {
 			pt = _eventsManager.getMousePos();
 			if (_eventsManager._mouseClicked && _voy._viewBounds->left == pt.x &&
 					(_voy._eventFlags & EVTFLAG_40) && _eventsManager._rightClick) {
-				_controlPtr->_state->_v1 = (pt.y / 60) + 1;
+				_controlPtr->_state->_victimIndex = (pt.y / 60) + 1;
 				foundIndex = -1;
 				_eventsManager._rightClick = 0;
 			}
@@ -809,38 +809,38 @@ void VoyeurEngine::doTapePlaying() {
 }
 
 bool VoyeurEngine::checkForMurder() {
-	int v = _controlPtr->_state->_v3;
+	int v = _controlPtr->_state->_victimMurderIndex;
 
 	for (int idx = 0; idx < _voy._eventCount; ++idx) {
 		VoyeurEvent &evt = _voy._events[idx];
 
 		if (evt._type == EVTYPE_VIDEO) {
-			switch (_controlPtr->_state->_v1) {
+			switch (_controlPtr->_state->_victimIndex) {
 			case 1:
 				if (evt._audioVideoId == 41 && evt._computerOn <= 15 &&
 						(evt._computerOff + evt._computerOn) >= 16) {
-					_controlPtr->_state->_v3 = 1;
+					_controlPtr->_state->_victimMurderIndex = 1;
 				}
 				break;
 
 			case 2:
 				if (evt._audioVideoId == 53 && evt._computerOn <= 19 &&
 						(evt._computerOff + evt._computerOn) >= 21) {
-					_controlPtr->_state->_v3 = 2;
+					_controlPtr->_state->_victimMurderIndex = 2;
 				}
 				break;
 
 			case 3:
 				if (evt._audioVideoId == 50 && evt._computerOn <= 28 &&
 						(evt._computerOff + evt._computerOn) >= 29) {
-					_controlPtr->_state->_v3 = 3;
+					_controlPtr->_state->_victimMurderIndex = 3;
 				}
 				break;
 
 			case 4:
 				if (evt._audioVideoId == 43 && evt._computerOn <= 10 &&
 						(evt._computerOff + evt._computerOn) >= 14) {
-					_controlPtr->_state->_v3 = 4;
+					_controlPtr->_state->_victimMurderIndex = 4;
 				}
 				break;
 
@@ -849,13 +849,13 @@ bool VoyeurEngine::checkForMurder() {
 			}
 		}
 
-		if (_controlPtr->_state->_v3 == _controlPtr->_state->_v1) {
+		if (_controlPtr->_state->_victimMurderIndex == _controlPtr->_state->_victimIndex) {
 			_voy._videoEventId = idx;
 			return true;
 		}
 	}
 
-	_controlPtr->_state->_v3 = v;
+	_controlPtr->_state->_victimMurderIndex = v;
 	_voy._videoEventId = -1;
 	return false;
 }
@@ -894,7 +894,7 @@ bool VoyeurEngine::checkForIncriminate() {
 		}
 
 		if (_voy._field4382) {
-			_controlPtr->_state->_v3 = 88;
+			_controlPtr->_state->_victimMurderIndex = 88;
 			_voy._videoEventId = idx;
 			return true;
 		}
@@ -954,7 +954,7 @@ int VoyeurEngine::getChooseButton()  {
 			
 			for (uint idx = 0; idx < hotspots.size(); ++idx) {
 				if (hotspots[idx].contains(pt)) {
-					if (!_voy._victimMurdered || ((int)idx + 1) != _controlPtr->_state->_v1) {
+					if (!_voy._victimMurdered || ((int)idx + 1) != _controlPtr->_state->_victimIndex) {
 						selectedIndex = idx;
 						if (selectedIndex != prevIndex) {
 							PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;


Commit: d0ca824a629c0ec921805c7b79e4ce1caaa84fc3
    https://github.com/scummvm/scummvm/commit/d0ca824a629c0ec921805c7b79e4ce1caaa84fc3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-05T05:41:33-08:00

Commit Message:
VOYEUR: Opening sequence video should not be completely skipped

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 286b97e..e709bd7 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -160,20 +160,20 @@ bool VoyeurEngine::doHeadTitle() {
 		}
 
 		// Show the title screen
+		_eventsManager.getMouseInfo();
 		showTitleScreen();
 		if (shouldQuit())
 			return false;
 
 		// Opening
-		if (!_eventsManager._mouseClicked) {
-			doOpening();
+		_eventsManager.getMouseInfo();
+		doOpening();
+		if (shouldQuit())
+			return false;
 
-			_eventsManager.getMouseInfo();
-			doTransitionCard("Saturday Afternoon", "Player's Apartment");
-			_eventsManager.delayClick(90);
-		} else {
-			_eventsManager._mouseClicked = false;
-		}
+		_eventsManager.getMouseInfo();
+		doTransitionCard("Saturday Afternoon", "Player's Apartment");
+		_eventsManager.delayClick(90);
 
 		if (_voy._eventFlags & EVTFLAG_VICTIM_PRESET) {
 			// Preset victim turned on, so add a default set of incriminating videos


Commit: f6c687191834d5208cdcee5266676a8384771845
    https://github.com/scummvm/scummvm/commit/f6c687191834d5208cdcee5266676a8384771845
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-05T06:00:43-08:00

Commit Message:
VOYEUR: Fix preloading incriminating videos if the debug _iForceDeath is set

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index f0521d2..4cbfef5 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -57,6 +57,7 @@ void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int audioVideoId
 		int on, int off, int dead) {
 	VoyeurEvent &e = _events[_eventCount++];
 
+	e._type = type;
 	e._hour = hour;
 	e._minute = minute;
 	e._isAM = hour < 12;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index e709bd7..dae4e41 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -68,14 +68,14 @@ Common::Error VoyeurEngine::run() {
 	ESP_Init();
 	globalInitBolt();
 
+	// The original allows the victim to be explicitly specified via the command line.
+	// We don't currently support this in ScummVM, but I'm leaving the code below
+	// in case we ever want to make use of it.
+	if (_iForceDeath >= 1 && _iForceDeath <= 4)
+		_voy._eventFlags |= EVTFLAG_VICTIM_PRESET;
+
 	_eventsManager.resetMouse();
 	if (doHeadTitle()) {
-		// The original allows the victim to be explicitly specified via the command line.
-		// We don't currently support this in ScummVM, but I'm leaving the code below
-		// in case we ever want to make use of it.
-		if (_iForceDeath >= 1 && _iForceDeath <= 4)
-			_voy._eventFlags |= EVTFLAG_VICTIM_PRESET;
-
 		playStamp();
 		if (!shouldQuit())
 			doTailTitle();
@@ -177,24 +177,15 @@ bool VoyeurEngine::doHeadTitle() {
 
 		if (_voy._eventFlags & EVTFLAG_VICTIM_PRESET) {
 			// Preset victim turned on, so add a default set of incriminating videos
-			if (_voy._eventCount <= 1)
-				_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
-			if (_voy._eventCount <= 2)
-				_voy.addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1);
-			if (_voy._eventCount <= 3)
-				_voy.addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1);
-			if (_voy._eventCount <= 4)
-				_voy.addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1);
-			if (_voy._eventCount <= 5)
-				_voy.addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1);
-			if (_voy._eventCount <= 6)
-				_voy.addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1);
-			if (_voy._eventCount <= 7)
-				_voy.addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1);
-			if (_voy._eventCount <= 8)
-				_voy.addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1);
-			if (_voy._eventCount <= 9)
-				_voy.addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1);
+			_voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
+			_voy.addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1);
+			_voy.addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1);
+			_voy.addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1);
+			_voy.addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1);
+			_voy.addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1);
+			_voy.addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1);
+			_voy.addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1);
+			_voy.addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1);
 		} 
 	}
 


Commit: ab0cdde53998881cd0087e55cbf2fdeeedf1e511
    https://github.com/scummvm/scummvm/commit/ab0cdde53998881cd0087e55cbf2fdeeedf1e511
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-06T19:47:34-08:00

Commit Message:
VOYEUR: Fix sound distortions in the second part of the gossip interview

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 4577fe2..c95281e 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -765,17 +765,20 @@ void VoyeurEngine::doGossip() {
 
 	// Play the initial gossip video
 	decoder.play(this, 0x302, frameNumsP, posP);
+	decoder.close();
 
 	// Reset the palette and clear the screen
 	_graphicsManager.resetPalette();
 	_graphicsManager.screenReset();
 
 	// Play interview video
-	decoder.loadFile("a2110100.rl2", true);
-	decoder.start();
+	RL2Decoder decoder2;
+	decoder2.loadFile("a2110100.rl2", true);
+	decoder2.start();
 
 	_eventsManager.getMouseInfo();
-	decoder.play(this);
+	decoder2.play(this);
+	decoder2.close();
 
 	_bVoy->freeBoltGroup(0x300);
 	_graphicsManager.screenReset();


Commit: f407a292a18aa17c538028fac31be8e7ecd135c1
    https://github.com/scummvm/scummvm/commit/f407a292a18aa17c538028fac31be8e7ecd135c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-07T05:03:49-08:00

Commit Message:
VOYEUR: Fix decoder _curFrame to start at -1

Changed paths:
    engines/voyeur/animation.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 7dc53b9..301c8d1 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -116,7 +116,7 @@ void RL2Decoder::readNextPacket() {
 
 	// Handle queueing sound data
 	if (_soundFrameNumber == -1)
-		_soundFrameNumber = frameNumber;
+		_soundFrameNumber = (frameNumber == -1) ? 0 : frameNumber;
 
 	while (audioTrack->numQueuedStreams() < SOUND_FRAMES_READAHEAD && 
 			(_soundFrameNumber < (int)_soundFrames.size())) {
@@ -225,7 +225,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
 	_videoBase = header._videoBase;
 	_dirtyPalette = header._colorCount > 0;
 
-	_curFrame = 0;
+	_curFrame = -1;
 	_initialFrame = true;
 }
 
@@ -283,7 +283,7 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 	}
 
 	// Move to the next frame data
-	_fileStream->seek(_header._frameOffsets[_curFrame]);
+	_fileStream->seek(_header._frameOffsets[++_curFrame]);
 
 	// If there's any sound data, pass it to the audio track
 	_fileStream->seek(_header._frameSoundSizes[_curFrame], SEEK_CUR);
@@ -296,8 +296,6 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
 		rl2DecodeFrameWithoutTransparency(_videoBase);
 	}
 
-	_curFrame++;
-
 	return _surface;
 }
 


Commit: 9d86715e30a91b405b5df2e2a3646d1f930d4e34
    https://github.com/scummvm/scummvm/commit/9d86715e30a91b405b5df2e2a3646d1f930d4e34
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-07T17:40:04-08:00

Commit Message:
VOYEUR: Renaming SVoy fields

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 4cbfef5..98a7a07 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -81,19 +81,19 @@ void SVoy::synchronize(Common::Serializer &s) {
 		s.syncAsByte(_roomHotspotsEnabled[idx]);
 	}
 
-	s.syncAsSint16LE(_field468);
-	s.syncAsSint16LE(_field46A);
+	s.syncAsSint16LE(_audioVisualStartTime);
+	s.syncAsSint16LE(_audioVisualDuration);
 	s.syncAsSint16LE(_vocSecondsOffset);
 	s.syncAsSint16LE(_abortInterface);
-	s.syncAsSint16LE(_field470);
+	s.syncAsSint16LE(_playStampMode);
 	s.syncAsSint16LE(_aptLoadMode);
 	s.syncAsSint16LE(_transitionId);
 	s.syncAsSint16LE(_RTVLimit);
 	s.syncAsSint16LE(_eventFlags);
 	s.syncAsSint16LE(_boltGroupId2);
 
-	s.syncAsSint16LE(_field4AC);
-	s.syncAsSint16LE(_field4B8);
+	s.syncAsSint16LE(_musicStartTime);
+	s.syncAsSint16LE(_totalPhoneCalls);
 	s.syncAsSint16LE(_computerTextId);
 	s.syncAsSint16LE(_computerTimeMin);
 	s.syncAsSint16LE(_computerTimeMax);
@@ -111,7 +111,7 @@ void SVoy::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_field437C);
 	s.syncAsSint16LE(_field437E);
 	s.syncAsSint16LE(_victimNumber);
-	s.syncAsSint16LE(_field4382);
+	s.syncAsSint16LE(_incriminatedVictimNumber);
 	s.syncAsSint16LE(_videoEventId);
 
 	if (s.isLoading()) {
@@ -134,7 +134,7 @@ void SVoy::addVideoEventStart() {
 
 void SVoy::addVideoEventEnd() {
 	VoyeurEvent &e = _events[_eventCount];
-	e._computerOff = _RTVNum - _field468 - _vocSecondsOffset;
+	e._computerOff = _RTVNum - _audioVisualStartTime - _vocSecondsOffset;
 	if (_eventCount < (TOTAL_EVENTS - 1))
 		++_eventCount;
 }
@@ -152,7 +152,7 @@ void SVoy::addAudioEventStart() {
 
 void SVoy::addAudioEventEnd() {
 	VoyeurEvent &e = _events[_eventCount];
-	e._computerOff = _RTVNum - _field468 - _vocSecondsOffset;
+	e._computerOff = _RTVNum - _audioVisualStartTime - _vocSecondsOffset;
 	if (_eventCount < (TOTAL_EVENTS - 1))
 		++_eventCount;
 }
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index d9c62bc..0b32d9a 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -113,11 +113,11 @@ public:
 	HotspotTimes<3> _evidenceHotspotTimes;
 	bool _roomHotspotsEnabled[20];
 
-	int _field468;
-	int _field46A;
+	int _audioVisualStartTime;
+	int _audioVisualDuration;
 	int _vocSecondsOffset;
 	bool _abortInterface;
-	int _field470;
+	int _playStampMode;
 	int _aptLoadMode;
 	int _transitionId;
 	int _RTVLimit;
@@ -125,9 +125,9 @@ public:
 	int _boltGroupId2;
 	PictureResource *_evPicPtrs[6];
 	CMapResource *_evCmPtrs[6];
-	int _field4AC;
-	int _field4AE[5];
-	int _field4B8;
+	int _musicStartTime;
+	bool _phoneCallsReceived[5];
+	int _totalPhoneCalls;
 
 	int _computerTextId;
 	Common::Rect _rect4E4;
@@ -142,7 +142,7 @@ public:
 	int _field437C;
 	int _field437E;
 	int _victimNumber;
-	int _field4382;
+	int _incriminatedVictimNumber;
 	int _videoEventId;
 	RectResource *_viewBounds;
 	int _curICF0;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index ba85ec2..7635a9d 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -336,9 +336,9 @@ bool ThreadResource::chooseSTAMPButton(int buttonId) {
 }
 
 void ThreadResource::parsePlayCommands() {
-	_vm->_voy._field470 = -1;
-	_vm->_voy._field468 = 0;
-	_vm->_voy._field46A = 0;
+	_vm->_voy._playStampMode = -1;
+	_vm->_voy._audioVisualStartTime = 0;
+	_vm->_voy._audioVisualDuration = 0;
 	_vm->_voy._boltGroupId2 = -1;
 	_vm->_voy._computerTextId = -1;
 	_vm->_voy._eventFlags &= ~EVTFLAG_8;
@@ -372,14 +372,14 @@ void ThreadResource::parsePlayCommands() {
 
 			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
-				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
-				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
+				_vm->_voy._audioVisualStartTime = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._audioVisualDuration = READ_LE_UINT16(dataP + 6);
 
-				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
-						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
+				if (_vm->_voy._RTVNum < _vm->_voy._audioVisualStartTime ||
+						(_vm->_voy._audioVisualStartTime + _vm->_voy._audioVisualDuration)  < _vm->_voy._RTVNum) {
 					_vm->_audioVideoId = -1;
 				} else {
-					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
+					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._audioVisualStartTime;
 					_vm->_voy.addAudioEventStart();
 
 					// Play the audio
@@ -403,14 +403,14 @@ void ThreadResource::parsePlayCommands() {
 
 			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
 				_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
-				_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
-				_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
+				_vm->_voy._audioVisualStartTime = READ_LE_UINT16(dataP + 4);
+				_vm->_voy._audioVisualDuration = READ_LE_UINT16(dataP + 6);
 
-				if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
-						(_vm->_voy._field468 + _vm->_voy._field46A)  < _vm->_voy._RTVNum) {
+				if (_vm->_voy._RTVNum < _vm->_voy._audioVisualStartTime ||
+						(_vm->_voy._audioVisualStartTime + _vm->_voy._audioVisualDuration)  < _vm->_voy._RTVNum) {
 					_vm->_audioVideoId = -1;
 				} else {
-					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
+					_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._audioVisualStartTime;
 					_vm->_voy.addVideoEventStart();
 					_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 					_vm->_voy._eventFlags |= EVTFLAG_RECORDING;
@@ -432,10 +432,10 @@ void ThreadResource::parsePlayCommands() {
 
 					_vm->_eventsManager._videoDead = -1;
 					if (_stateCount == 2 && _vm->_eventsManager._mouseClicked == 0) {
-						_vm->_voy._field470 = 132;
+						_vm->_voy._playStampMode = 132;
 						parseIndex = 999;
 					} else {
-						_vm->_voy._field470 = 129;
+						_vm->_voy._playStampMode = 129;
 					}
 				}
 			}
@@ -456,7 +456,7 @@ void ThreadResource::parsePlayCommands() {
 			}
 
 			_vm->_voy._vocSecondsOffset = 0;
-			_vm->_voy._field468 = _vm->_voy._RTVNum;
+			_vm->_voy._audioVisualStartTime = _vm->_voy._RTVNum;
 			_vm->_voy._eventFlags &= ~(EVTFLAG_TIME_DISABLED | EVTFLAG_RECORDING);
 			_vm->playAVideo(_vm->_audioVideoId);
 			_vm->_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
@@ -513,7 +513,7 @@ void ThreadResource::parsePlayCommands() {
 			// if so, load the time information for the new time period
 			v2 = READ_LE_UINT16(dataP);
 			if (v2 == 0 || _vm->_controlPtr->_state->_victimIndex == v2) {
-				_vm->_voy._field470 = 5;
+				_vm->_voy._playStampMode = 5;
 				int count = READ_LE_UINT16(dataP + 2);
 				_vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4);
 
@@ -536,7 +536,7 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 6:
-			_vm->_voy._field470 = 6;
+			_vm->_voy._playStampMode = 6;
 			v2 = READ_LE_UINT16(dataP);
 			_vm->_playStampGroupId = _vm->_resolvePtr[v2];
 			dataP += 2;
@@ -652,7 +652,7 @@ void ThreadResource::parsePlayCommands() {
 
 		case 14:
 			_vm->_playStampGroupId = 2048;
-			_vm->_voy._field470 = 130;
+			_vm->_voy._playStampMode = 130;
 			break;
 
 		case 15:
@@ -660,11 +660,11 @@ void ThreadResource::parsePlayCommands() {
 			break;
 
 		case 16:
-			_vm->_voy._field470 = 16;
+			_vm->_voy._playStampMode = 16;
 			break;
 
 		case 17:
-			_vm->_voy._field470 = 17;
+			_vm->_voy._playStampMode = 17;
 			break;
 
 		case 18:
@@ -985,7 +985,7 @@ int ThreadResource::doApt() {
 		_vm->_currentVocId = 153;
 	}
 
-	if (_vm->_voy._field470 == 16) {
+	if (_vm->_voy._playStampMode == 16) {
 		hotspots[0].left = 999;
 		hotspots[3].left = 999;
 		_aptPos.x = hotspots[4].left + 28;
@@ -1141,7 +1141,7 @@ void ThreadResource::doRoom() {
 	vm._eventsManager.setMousePos(Common::Point(192, 120));
 	voy._field437E = 0;
 	vm._currentVocId = 146;
-	voy._field4AC = voy._RTVNum;
+	voy._musicStartTime = voy._RTVNum;
 
 	voy._vocSecondsOffset = 0;
 	vm._soundManager.startVOCPlay(vm._currentVocId);
@@ -1156,7 +1156,7 @@ void ThreadResource::doRoom() {
 
 		do {
 			if (vm._currentVocId != -1 && !vm._soundManager.getVOCStatus()) {
-				voy._field4AC = voy._RTVNum;
+				voy._musicStartTime = voy._RTVNum;
 				voy._vocSecondsOffset = 0;
 				vm._soundManager.startVOCPlay(vm._currentVocId);
 			}
@@ -1213,7 +1213,7 @@ void ThreadResource::doRoom() {
 				_vm->flipPageAndWait();
 
 				if (vm._currentVocId != -1) {
-					voy._vocSecondsOffset = voy._RTVNum - voy._field4AC;
+					voy._vocSecondsOffset = voy._RTVNum - voy._musicStartTime;
 					vm._soundManager.stopVOCPlay();
 				}
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index dae4e41..4ce2524 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -443,7 +443,7 @@ void VoyeurEngine::doOpening() {
 
 	_voy._vocSecondsOffset = 0;
 	_voy._RTVNum = 0;
-	_voy._field468 = _voy._RTVNum;
+	_voy._audioVisualStartTime = _voy._RTVNum;
 	_voy._eventFlags |= EVTFLAG_RECORDING;
 	_gameHour = 4;
 	_gameMinute  = 0;
@@ -504,7 +504,7 @@ void VoyeurEngine::doOpening() {
 		_eventsManager.delay(5);
 	}
 
-	if ((_voy._RTVNum - _voy._field468) < 2)
+	if ((_voy._RTVNum - _voy._audioVisualStartTime) < 2)
 		_eventsManager.delay(60);
 
 	_voy._eventFlags |= EVTFLAG_TIME_DISABLED;
@@ -628,7 +628,7 @@ void VoyeurEngine::playAudio(int audioId) {
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 
 	_voy._eventFlags &= ~EVTFLAG_RECORDING;
-	_voy._field470 = 129;
+	_voy._playStampMode = 129;
 }
 
 void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
@@ -686,7 +686,7 @@ void VoyeurEngine::flipPageAndWaitForFade() {
 }
 
 void VoyeurEngine::showEndingNews() {
-	_playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700;
+	_playStampGroupId = (_voy._incriminatedVictimNumber - 1) * 256 + 0x7700;
 	_voy._boltGroupId2 = (_controlPtr->_state->_victimIndex - 1) * 256 + 0x7B00;
 
 	_bVoy->getBoltGroup(_playStampGroupId);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index c95281e..29d1957 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -58,7 +58,7 @@ void VoyeurEngine::playStamp() {
 
 		bool flag = breakFlag = (_voy._eventFlags & EVTFLAG_2) != 0;
 		 
-		switch (_voy._field470) {
+		switch (_voy._playStampMode) {
 		case 5:
 			buttonId = _mainThread->doInterface();
 			
@@ -163,7 +163,7 @@ void VoyeurEngine::playStamp() {
 				flag = true;
 
 				if (buttonId != 4) {
-					_voy._field470 = 131;
+					_voy._playStampMode = 131;
 					_voy.checkForKey();
 					_mainThread->chooseSTAMPButton(buttonId);
 				} else {
@@ -478,7 +478,7 @@ void VoyeurEngine::reviewTape() {
 		bool var1E = true;
 		do {
 			if (_currentVocId != -1 && !_soundManager.getVOCStatus()) {
-				_voy._field4AC = _voy._RTVNum;
+				_voy._musicStartTime = _voy._RTVNum;
 				_soundManager.startVOCPlay(_currentVocId);
 			}
 
@@ -659,7 +659,7 @@ void VoyeurEngine::reviewTape() {
 		(*_graphicsManager._vPort)->setupViewPort(NULL);
 			
 		if (_currentVocId != -1) {
-			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+			_voy._vocSecondsOffset = _voy._RTVNum - _voy._musicStartTime;
 			_soundManager.stopVOCPlay();
 		}
 
@@ -713,7 +713,7 @@ void VoyeurEngine::reviewTape() {
 		case EVTYPE_EVID:
 			_voy.reviewAnEvidEvent(eventIndex);
 			
-			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+			_voy._vocSecondsOffset = _voy._RTVNum - _voy._musicStartTime;
 			_soundManager.stopVOCPlay();
 			_bVoy->getBoltGroup(0x900);
 			break;
@@ -721,7 +721,7 @@ void VoyeurEngine::reviewTape() {
 		case EVTYPE_COMPUTER:
 			_voy.reviewComputerEvent(eventIndex);
 			
-			_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+			_voy._vocSecondsOffset = _voy._RTVNum - _voy._musicStartTime;
 			_soundManager.stopVOCPlay();
 			_bVoy->getBoltGroup(0x900);
 			break;
@@ -864,7 +864,7 @@ bool VoyeurEngine::checkForMurder() {
 }
 
 bool VoyeurEngine::checkForIncriminate() {
-	_voy._field4382 = 0;
+	_voy._incriminatedVictimNumber = 0;
 
 	for (int idx = 0; idx < _voy._eventCount; ++idx) {
 		VoyeurEvent &evt = _voy._events[idx];
@@ -872,31 +872,31 @@ bool VoyeurEngine::checkForIncriminate() {
 		if (evt._type == EVTYPE_VIDEO) {
 			if (evt._audioVideoId == 44 && evt._computerOn <= 40 &&
 					(evt._computerOff + evt._computerOn) >= 70) {
-				_voy._field4382 = 1;
+				_voy._incriminatedVictimNumber = 1;
 			}
 
 			if (evt._audioVideoId == 44 && evt._computerOn <= 79 &&
 					(evt._computerOff + evt._computerOn) >= 129) {
-				_voy._field4382 = 1;
+				_voy._incriminatedVictimNumber = 1;
 			}
 
 			if (evt._audioVideoId == 20 && evt._computerOn <= 28 &&
 					(evt._computerOff + evt._computerOn) >= 45) {
-				_voy._field4382 = 2;
+				_voy._incriminatedVictimNumber = 2;
 			}
 
 			if (evt._audioVideoId == 35 && evt._computerOn <= 17 &&
 					(evt._computerOff + evt._computerOn) >= 36) {
-				_voy._field4382 = 3;
+				_voy._incriminatedVictimNumber = 3;
 			}
 
 			if (evt._audioVideoId == 30 && evt._computerOn <= 80 &&
 					(evt._computerOff + evt._computerOn) >= 139) {
-				_voy._field4382 = 4;
+				_voy._incriminatedVictimNumber = 4;
 			}
 		}
 
-		if (_voy._field4382) {
+		if (_voy._incriminatedVictimNumber) {
 			_controlPtr->_state->_victimMurderIndex = 88;
 			_voy._videoEventId = idx;
 			return true;
@@ -1322,21 +1322,21 @@ void VoyeurEngine::flashTimeBar(){
 }
 
 void VoyeurEngine::checkPhoneCall() {
-	if ((_voy._RTVLimit - _voy._RTVNum) >= 36 && _voy._field4B8 < 5 && 
+	if ((_voy._RTVLimit - _voy._RTVNum) >= 36 && _voy._totalPhoneCalls < 5 && 
 			_currentVocId <= 151 && _currentVocId > 146) {
 		if ((_voy._switchBGNum < _checkPhoneVal || _checkPhoneVal > 180) &&
 				!_soundManager.getVOCStatus()) {
 			int soundIndex;
 			do {
 				soundIndex = getRandomNumber(4);
-			} while (_voy._field4AE[soundIndex]);
+			} while (_voy._phoneCallsReceived[soundIndex]);
 			_currentVocId = 154 + soundIndex;
 
 			_soundManager.stopVOCPlay();
 			_soundManager.startVOCPlay(_currentVocId);
 			_checkPhoneVal = _voy._switchBGNum;
-			++_voy._field4AE[soundIndex];
-			++_voy._field4B8;
+			++_voy._phoneCallsReceived[soundIndex];
+			++_voy._totalPhoneCalls;
 		}
 	}
 }
@@ -1346,7 +1346,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
 	flipPageAndWait();
 
 	if (_currentVocId != -1) {
-		_voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+		_voy._vocSecondsOffset = _voy._RTVNum - _voy._musicStartTime;
 		_soundManager.stopVOCPlay();
 	}
 


Commit: e3b666a27a9fa09705d03b50ba7382c01d305c5b
    https://github.com/scummvm/scummvm/commit/e3b666a27a9fa09705d03b50ba7382c01d305c5b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-07T17:46:02-08:00

Commit Message:
VOYEUR: Standardised delay amount between frame checks in video playback methods

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 4ce2524..6ef4705 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -501,7 +501,7 @@ void VoyeurEngine::doOpening() {
 		}
 
 		_eventsManager.getMouseInfo();
-		_eventsManager.delay(5);
+		g_system->delayMillis(10);
 	}
 
 	if ((_voy._RTVNum - _voy._audioVisualStartTime) < 2)


Commit: 26f5475136143a5ea88b767d4f5206e4931b1e73
    https://github.com/scummvm/scummvm/commit/26f5475136143a5ea88b767d4f5206e4931b1e73
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-07T17:57:49-08:00

Commit Message:
VOYEUR: Remove redundant code from RL2Decoder class

Changed paths:
    engines/voyeur/animation.cpp
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 301c8d1..c7522e6 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -163,7 +163,6 @@ void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
 	_form = stream->readUint32LE();
 	_backSize = stream->readUint32LE();
 	_signature = stream->readUint32LE();
-	_isRLV3 = !strncmp((const char *)&_signature, "RLV3", 4);
 
 	if (!isValid())
 		return;
@@ -244,10 +243,6 @@ void RL2Decoder::RL2VideoTrack::initBackSurface() {
 	_backSurface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 }
 
-bool RL2Decoder::RL2VideoTrack::endOfTrack() const {
-	return getCurFrame() >= getFrameCount();
-}
-
 bool RL2Decoder::RL2VideoTrack::seek(const Audio::Timestamp &time) {
 	int frame = getFrameAtTime(time);
 		
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 43dd6a0..96c2835 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -63,7 +63,6 @@ private:
 
 		uint32 *_frameOffsets;
 		int *_frameSoundSizes;
-		bool _isRLV3;
 	public:
 		RL2FileHeader();
 		~RL2FileHeader();
@@ -106,8 +105,6 @@ private:
 			Common::SeekableReadStream *stream);
 		~RL2VideoTrack();
 
-		bool endOfTrack() const;
-
 		uint16 getWidth() const;
 		uint16 getHeight() const;
 		Graphics::Surface *getSurface() { return _surface; }


Commit: 9608a521625122e1499d5fae60d3c7ecd0456f90
    https://github.com/scummvm/scummvm/commit/9608a521625122e1499d5fae60d3c7ecd0456f90
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-09T22:56:35-08:00

Commit Message:
VOYEUR: Reduce the scope of a couple of variables

Changed paths:
    engines/voyeur/files_threads.cpp
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 7635a9d..ab63902 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -718,7 +718,6 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 	uint16 id = *card++;
 	int varD = 5;
 	uint32 v2;
-	int v3;
 	byte bVal;
 	uint32 idx1, idx2;
 	debugC(DEBUG_BASIC, kDebugScripts, "cardPerform - %d", id);
@@ -765,7 +764,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 	}
 
 	case 7: {
-		v3 = *card++;
+		int v3 = *card++;
 		v2 = READ_LE_UINT32(card);
 		card += 4;
 		int &v = _vm->_controlPtr->_state->_vals[v3];
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 6ef4705..5b93b46 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -223,7 +223,6 @@ void VoyeurEngine::showConversionScreen() {
 
 bool VoyeurEngine::doLock() {
 	bool result = true;
-	bool flag = false;
 	int buttonVocSize, wrongVocSize;
 	byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
 	byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
@@ -273,6 +272,7 @@ bool VoyeurEngine::doLock() {
 
 		bool firstLoop = true;
 		bool breakFlag = false;
+		bool flag = false;
 		while (!breakFlag && !shouldQuit()) {
 			(*_graphicsManager._vPort)->setupViewPort();
 			flipPageAndWait();


Commit: 72d21312639921691336640614f93bb7d3ba1b27
    https://github.com/scummvm/scummvm/commit/72d21312639921691336640614f93bb7d3ba1b27
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-09T22:57:57-08:00

Commit Message:
VOYEUR: Remove a useless variable

Changed paths:
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index ab63902..a5e27eb 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1371,16 +1371,13 @@ int ThreadResource::doInterface() {
 	Common::Rect mansionViewBounds(MANSION_VIEW_X, MANSION_VIEW_Y,
 		MANSION_VIEW_X + MANSION_VIEW_WIDTH, MANSION_VIEW_Y + MANSION_VIEW_HEIGHT);
 
-	int priorRegionIndex = -1;
 	do {
 		_vm->_voyeurArea = AREA_INTERFACE;
 		_vm->doTimeBar(true);
 		_vm->_eventsManager.getMouseInfo();
 
-		if (checkMansionScroll()) {
-			priorRegionIndex = regionIndex;
+		if (checkMansionScroll())
 			_vm->doScroll(_vm->_mansionViewPos);
-		}
 
 		_vm->checkPhoneCall();
 		if (!_vm->_soundManager.getVOCStatus()) {


Commit: e688cb501534e98a024edc136ca5b833e173944d
    https://github.com/scummvm/scummvm/commit/e688cb501534e98a024edc136ca5b833e173944d
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-10T22:51:55-08:00

Commit Message:
VOYEUR: Implement fadeIntFunc()

Changed paths:
    engines/voyeur/events.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 32ffa15..4e6986b 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -505,7 +505,34 @@ void EventsManager::vDoCycleInt() {
 
 
 void EventsManager::fadeIntFunc() {
-	warning("TODO");
+	switch (_vm->_voy._field437E) {
+	case 1:
+		if (_vm->_voy._field4376 < 63)
+			_vm->_voy._field4376 += _vm->_voy._field437A;
+		if (_vm->_voy._field4378 < 63)
+			_vm->_voy._field4378 += _vm->_voy._field437C;
+		if (_vm->_voy._field4376 > 63)
+			_vm->_voy._field4376 = 63;
+		if (_vm->_voy._field4378 > 63)
+			_vm->_voy._field4378 = 63;
+		if ((_vm->_voy._field4376 == 63) && (_vm->_voy._field4378 == 63))
+			_vm->_voy._field437E = 0;
+		break;
+	case 2:
+		if (_vm->_voy._field4376 > 0)
+			_vm->_voy._field4376 -= _vm->_voy._field437A;
+		if (_vm->_voy._field4378 > 0)
+			_vm->_voy._field4378 -= _vm->_voy._field437C;
+		if (_vm->_voy._field4376 < 0)
+			_vm->_voy._field4376 = 0;
+		if (_vm->_voy._field4378 < 0)
+			_vm->_voy._field4378 = 0;
+		if ((_vm->_voy._field4376 == 0) && (_vm->_voy._field4378 == 0))
+			_vm->_voy._field437E = 0;
+		break;
+	default:
+		break;
+	}
 }
 
 void EventsManager::deleteIntNode(IntNode *node) {


Commit: 1ed4ed47afdfeae436391b36a6cb2a3e192f06ae
    https://github.com/scummvm/scummvm/commit/1ed4ed47afdfeae436391b36a6cb2a3e192f06ae
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-10T23:00:15-08:00

Commit Message:
VOYEUR: Rename some fields related to fading

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h
    engines/voyeur/events.cpp
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 98a7a07..ae9474a 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -43,7 +43,7 @@ SVoy::SVoy() {
 	Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0);
 
 	_eventFlags = EVTFLAG_TIME_DISABLED;
-	_field4376 = _field4378 = 127;
+	_fadingAmount1 = _fadingAmount2 = 127;
 	_murderThreshold = 9999;
 	_aptLoadMode = -1;
 	_eventFlags |= EVTFLAG_100;
@@ -105,11 +105,11 @@ void SVoy::synchronize(Common::Serializer &s) {
 	for (int idx = 0; idx < _eventCount; ++idx)
 		_events[idx].synchronize(s);
 
-	s.syncAsSint16LE(_field4376);
-	s.syncAsSint16LE(_field4378);
-	s.syncAsSint16LE(_field437A);
-	s.syncAsSint16LE(_field437C);
-	s.syncAsSint16LE(_field437E);
+	s.syncAsSint16LE(_fadingAmount1);
+	s.syncAsSint16LE(_fadingAmount2);
+	s.syncAsSint16LE(_fadingStep1);
+	s.syncAsSint16LE(_fadingStep2);
+	s.syncAsSint16LE(_fadingType);
 	s.syncAsSint16LE(_victimNumber);
 	s.syncAsSint16LE(_incriminatedVictimNumber);
 	s.syncAsSint16LE(_videoEventId);
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 0b32d9a..899b10c 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -136,11 +136,11 @@ public:
 	bool _victimMurdered;
 	int _murderThreshold;
 
-	int _field4376;
-	int _field4378;
-	int _field437A;
-	int _field437C;
-	int _field437E;
+	int _fadingAmount1;
+	int _fadingAmount2;
+	int _fadingStep1;
+	int _fadingStep2;
+	int _fadingType;
 	int _victimNumber;
 	int _incriminatedVictimNumber;
 	int _videoEventId;
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 4e6986b..4a6beb9 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -505,30 +505,30 @@ void EventsManager::vDoCycleInt() {
 
 
 void EventsManager::fadeIntFunc() {
-	switch (_vm->_voy._field437E) {
+	switch (_vm->_voy._fadingType) {
 	case 1:
-		if (_vm->_voy._field4376 < 63)
-			_vm->_voy._field4376 += _vm->_voy._field437A;
-		if (_vm->_voy._field4378 < 63)
-			_vm->_voy._field4378 += _vm->_voy._field437C;
-		if (_vm->_voy._field4376 > 63)
-			_vm->_voy._field4376 = 63;
-		if (_vm->_voy._field4378 > 63)
-			_vm->_voy._field4378 = 63;
-		if ((_vm->_voy._field4376 == 63) && (_vm->_voy._field4378 == 63))
-			_vm->_voy._field437E = 0;
+		if (_vm->_voy._fadingAmount1 < 63)
+			_vm->_voy._fadingAmount1 += _vm->_voy._fadingStep1;
+		if (_vm->_voy._fadingAmount2 < 63)
+			_vm->_voy._fadingAmount2 += _vm->_voy._fadingStep2;
+		if (_vm->_voy._fadingAmount1 > 63)
+			_vm->_voy._fadingAmount1 = 63;
+		if (_vm->_voy._fadingAmount2 > 63)
+			_vm->_voy._fadingAmount2 = 63;
+		if ((_vm->_voy._fadingAmount1 == 63) && (_vm->_voy._fadingAmount2 == 63))
+			_vm->_voy._fadingType = 0;
 		break;
 	case 2:
-		if (_vm->_voy._field4376 > 0)
-			_vm->_voy._field4376 -= _vm->_voy._field437A;
-		if (_vm->_voy._field4378 > 0)
-			_vm->_voy._field4378 -= _vm->_voy._field437C;
-		if (_vm->_voy._field4376 < 0)
-			_vm->_voy._field4376 = 0;
-		if (_vm->_voy._field4378 < 0)
-			_vm->_voy._field4378 = 0;
-		if ((_vm->_voy._field4376 == 0) && (_vm->_voy._field4378 == 0))
-			_vm->_voy._field437E = 0;
+		if (_vm->_voy._fadingAmount1 > 0)
+			_vm->_voy._fadingAmount1 -= _vm->_voy._fadingStep1;
+		if (_vm->_voy._fadingAmount2 > 0)
+			_vm->_voy._fadingAmount2 -= _vm->_voy._fadingStep2;
+		if (_vm->_voy._fadingAmount1 < 0)
+			_vm->_voy._fadingAmount1 = 0;
+		if (_vm->_voy._fadingAmount2 < 0)
+			_vm->_voy._fadingAmount2 = 0;
+		if ((_vm->_voy._fadingAmount1 == 0) && (_vm->_voy._fadingAmount2 == 0))
+			_vm->_voy._fadingType = 0;
 		break;
 	default:
 		break;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index a5e27eb..2241431 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1112,7 +1112,7 @@ void ThreadResource::doRoom() {
 	SVoy &voy = vm._voy;
 	
 	vm.makeViewFinderP();
-	voy._field437E = 0;
+	voy._fadingType = 0;
 	
 	if (!vm._bVoy->getBoltGroup(vm._playStampGroupId, true))
 		return;
@@ -1122,9 +1122,9 @@ void ThreadResource::doRoom() {
 	(*vm._graphicsManager._vPort)->setupViewPort(vm._graphicsManager._backgroundPage);
 	vm._graphicsManager._backColors->startFade();
 
-	voy._field437A = 2;
-	voy._field437C = 0;
-	voy._field437E = 1;
+	voy._fadingStep1 = 2;
+	voy._fadingStep2 = 0;
+	voy._fadingType = 1;
 	
 	Common::Array<RectEntry> &hotspots = vm._bVoy->boltEntry(vm._playStampGroupId + 4)._rectResource->_entries;
 	int hotspotId = -1;
@@ -1138,7 +1138,7 @@ void ThreadResource::doRoom() {
 
 	vm._eventsManager.getMouseInfo();
 	vm._eventsManager.setMousePos(Common::Point(192, 120));
-	voy._field437E = 0;
+	voy._fadingType = 0;
 	vm._currentVocId = 146;
 	voy._musicStartTime = voy._RTVNum;
 
@@ -1253,17 +1253,17 @@ void ThreadResource::doRoom() {
 				vm._eventsManager.delay(1);
 			vm._eventsManager.hideCursor();
 
-			while (!vm.shouldQuit() && voy._field4378 > 0) {
-				if (voy._field4376 < 63) {
-					voy._field4376 += 4;
-					if (voy._field4376 > 63)
-						voy._field4376 = 63;
+			while (!vm.shouldQuit() && voy._fadingAmount2 > 0) {
+				if (voy._fadingAmount1 < 63) {
+					voy._fadingAmount1 += 4;
+					if (voy._fadingAmount1 > 63)
+						voy._fadingAmount1 = 63;
 				}
 
-				if (voy._field4378 > 0) {
-					voy._field4378 -= 8;
-					if (voy._field4378 < 0)
-						voy._field4378 = 0;
+				if (voy._fadingAmount2 > 0) {
+					voy._fadingAmount2 -= 8;
+					if (voy._fadingAmount2 < 0)
+						voy._fadingAmount2 = 0;
 				}
 
 				vm._eventsManager.delay(1);
@@ -1280,7 +1280,7 @@ void ThreadResource::doRoom() {
 	voy._eventFlags = EVTFLAG_TIME_DISABLED;
 	vm._eventsManager.incrementTime(1);
 	voy._viewBounds = nullptr;
-	voy._field437E = 0;
+	voy._fadingType = 0;
 	vm.makeViewFinderP();
 
 	if (voy._boltGroupId2 != -1) {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 3dee779..0deeaa1 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -1020,45 +1020,45 @@ void GraphicsManager::screenReset() {
 
 void GraphicsManager::fadeDownICF1(int steps) {
 	if (steps > 0) {
-		int stepAmount = _vm->_voy._field4378 / steps;
+		int stepAmount = _vm->_voy._fadingAmount2 / steps;
 
 		for (int idx = 0; idx < steps; ++idx) {
-			_vm->_voy._field4378 -= stepAmount;
+			_vm->_voy._fadingAmount2 -= stepAmount;
 			_vm->_eventsManager.delay(1);
 		}
 	}
 
-	_vm->_voy._field4378 = 0;
+	_vm->_voy._fadingAmount2 = 0;
 }
 
 void GraphicsManager::fadeUpICF1(int steps) {
 	if (steps > 0) {
-		int stepAmount = (63 - _vm->_voy._field4378) / steps;
+		int stepAmount = (63 - _vm->_voy._fadingAmount2) / steps;
 
 		for (int idx = 0; idx < steps; ++idx) {
-			_vm->_voy._field4378 += stepAmount;
+			_vm->_voy._fadingAmount2 += stepAmount;
 			_vm->_eventsManager.delay(1);
 		}
 	}
 
-	_vm->_voy._field4378 = 63;
+	_vm->_voy._fadingAmount2 = 63;
 }
 
 void GraphicsManager::fadeDownICF(int steps) {
 	if (steps > 0) {
 		_vm->_eventsManager.hideCursor();
-		int stepAmount1 = _vm->_voy._field4376 / steps;
-		int stepAmount2 = _vm->_voy._field4378 / steps;
+		int stepAmount1 = _vm->_voy._fadingAmount1 / steps;
+		int stepAmount2 = _vm->_voy._fadingAmount2 / steps;
 
 		for (int idx = 0; idx < steps; ++idx) {
-			_vm->_voy._field4376 -= stepAmount1;
-			_vm->_voy._field4378 -= stepAmount2;
+			_vm->_voy._fadingAmount1 -= stepAmount1;
+			_vm->_voy._fadingAmount2 -= stepAmount2;
 			_vm->_eventsManager.delay(1);
 		}
 	}
 
-	_vm->_voy._field4376 = 0;
-	_vm->_voy._field4378 = 0;
+	_vm->_voy._fadingAmount1 = 0;
+	_vm->_voy._fadingAmount2 = 0;
 }
 
 void GraphicsManager::drawDot() {
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 29d1957..7bb10c2 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -654,7 +654,7 @@ void VoyeurEngine::reviewTape() {
 		} while (!shouldQuit() && (!_eventsManager._mouseClicked || foundIndex == -1));
 
 		newY = _eventsManager.getMousePos().y;
-		_voy._field437E = 0;
+		_voy._fadingType = 0;
 		_voy._viewBounds = nullptr;
 		(*_graphicsManager._vPort)->setupViewPort(NULL);
 			


Commit: 5cc1bd626d7950a9aabfb9bc561d6e7cf6ccde67
    https://github.com/scummvm/scummvm/commit/5cc1bd626d7950a9aabfb9bc561d6e7cf6ccde67
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-10T23:21:07-08:00

Commit Message:
VOYEUR: Remove unused function header

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 4a6beb9..a488d99 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -48,7 +48,6 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 /*------------------------------------------------------------------------*/
 
 IntData::IntData() {
-	_field9 = false;
 	_flipWait = false;
 	_hasPalette = false;
 	field16 = 0;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index a7f9641..7a8611b 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -52,7 +52,6 @@ public:
 
 class IntData {
 public:
-	bool _field9;  // CHECKME: Useless variable
 	bool _flipWait;
 	int field16;   // CHECKME: Useless variable
 	int field1A;
@@ -70,8 +69,6 @@ public:
 	byte *_palette;
 public:
 	IntData();
-
-	void audioInit();
 };
 
 class EventsManager {


Commit: 0d994187913645161b4ff17a8686efa079d4dc5a
    https://github.com/scummvm/scummvm/commit/0d994187913645161b4ff17a8686efa079d4dc5a
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-10T23:24:26-08:00

Commit Message:
VOYEUR: Some more renaming

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index a488d99..198d004 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -58,7 +58,7 @@ IntData::IntData() {
 	field26 = 0;
 	field2A = 0;
 	_palChanged = false;
-	field3B = false;
+	_skipFading = false;
 	field3D = false;
 	_palStartIndex = 0;
 	_palEndIndex = 0;
@@ -204,7 +204,7 @@ void EventsManager::voyeurTimer() {
 		if (_gameData._flipWait) {
 			_gameData._palChanged = true;
 			_gameData._flipWait = false;
-			_gameData.field3B = false;
+			_gameData._skipFading = false;
 		}
 
 		_gameData.field26 >>= 8;
@@ -347,7 +347,7 @@ void EventsManager::startFade(CMapResource *cMap) {
 		}
 
 		if (cMap->_fadeStatus & 2)
-			_intPtr.field3B = true;
+			_intPtr._skipFading = true;
 		_fadeIntNode._flags &= ~1;
 	} else {
 		byte *vgaP = &_vm->_graphicsManager._VGAColors[_fadeFirstCol * 3];
@@ -389,7 +389,7 @@ void EventsManager::addFadeInt() {
 }
 
 void EventsManager::vDoFadeInt() {
-	if (_intPtr.field3B)
+	if (_intPtr._skipFading)
 		return;
 	if (--_fadeCount == 0) {
 		_fadeIntNode._flags |= 1;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 7a8611b..bd62b5c 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -62,7 +62,7 @@ public:
 	int field2A;   // CHECKME: Useless variable
 	bool _hasPalette;
 	bool _palChanged;  // CHECKME: Useless variable
-	bool field3B;  // Skip fading
+	bool _skipFading;
 	bool field3D;  // CHECKME: Useless variable
 	int _palStartIndex;
 	int _palEndIndex;


Commit: 1b7a4cf4a070e8dc88330d818898f2aa0659be5d
    https://github.com/scummvm/scummvm/commit/1b7a4cf4a070e8dc88330d818898f2aa0659be5d
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-11T22:36:37-08:00

Commit Message:
VOYEUR: Initialize properly a couple of Bolt variables

Changed paths:
    engines/voyeur/data.h
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 899b10c..8f926db 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -147,7 +147,7 @@ public:
 	RectResource *_viewBounds;
 	int _curICF0;
 	int _curICF1;
-	int _fadeICF0;
+	bool _fadeICF0; // Useless variable? (always the same value)
 	int _policeEvent;
 	
 	int _eventCount;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 5b93b46..adec4fb 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -119,7 +119,10 @@ void VoyeurEngine::globalInitBolt() {
 	assert(_graphicsManager._fontPtr->_curFont);
 
 	// Setup default flags
+	_voy._fadeICF0 = false;
+	_voy._viewBounds = nullptr;
 	_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90; 
+
 	_eventsManager.addFadeInt();
 }
 


Commit: 82b4768dd76a9962d4781be4353467cd85dc44c3
    https://github.com/scummvm/scummvm/commit/82b4768dd76a9962d4781be4353467cd85dc44c3
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-11T22:48:03-08:00

Commit Message:
VOYEUR: Initialize some more variables

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/data.h



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index ae9474a..8e22fe3 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -47,6 +47,9 @@ SVoy::SVoy() {
 	_murderThreshold = 9999;
 	_aptLoadMode = -1;
 	_eventFlags |= EVTFLAG_100;
+	_totalPhoneCalls = 0;
+	_victimMurdered = false;
+	_computerTimeMin = _computerTimeMax = 0;
 }
 
 void SVoy::setVm(VoyeurEngine *vm) {
diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index 8f926db..cbdb995 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -145,8 +145,8 @@ public:
 	int _incriminatedVictimNumber;
 	int _videoEventId;
 	RectResource *_viewBounds;
-	int _curICF0;
-	int _curICF1;
+	int _curICF0;   // Useless variable
+	int _curICF1;   // Useless variable
 	bool _fadeICF0; // Useless variable? (always the same value)
 	int _policeEvent;
 	


Commit: e7cc3fc4df2580870a6547a0c34e9d6b26063178
    https://github.com/scummvm/scummvm/commit/e7cc3fc4df2580870a6547a0c34e9d6b26063178
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-11T22:54:14-08:00

Commit Message:
VOYEUR: Use American English instead of British English in several places

Changed paths:
    engines/voyeur/data.cpp
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur.h



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 8e22fe3..db59760 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -39,7 +39,7 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {
 /*------------------------------------------------------------------------*/
 
 SVoy::SVoy() {
-	// Initialise all the data fields of SVoy to empty values
+	// Initialize all the data fields of SVoy to empty values
 	Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0);
 
 	_eventFlags = EVTFLAG_TIME_DISABLED;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 1f83eb6..79e81b0 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -429,7 +429,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
 	_state._decompState = 0;
 	_state._historyIndex = 0;
 
-	// Initialise the resource
+	// Initialize the resource
 	assert(_state._curMemberPtr->_initMethod < 25);
 	initResource(_state._curMemberPtr->_initMethod);
 
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4760148..0e5be69 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -587,7 +587,7 @@ public:
 	virtual ~ThreadResource() {}
 
 	/**
-	 * Initialise the thread
+	 * Initialize the thread
 	 */
 	void initThreadStruct(int idx, int id);
 
@@ -607,7 +607,7 @@ public:
 	bool goToState(int stackId, int stateId);
 
 	/**
-	 * Initialises data for the thread based on the current state
+	 * Initializes data for the thread based on the current state
 	 */
 	bool doState();
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index adec4fb..911daa0 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -57,7 +57,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 
 	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
 
-	initialiseManagers();
+	initializeManagers();
 }
 
 VoyeurEngine::~VoyeurEngine() {
@@ -91,7 +91,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
 	return _randomSource.getRandomNumber(maxNumber);
 }
 
-void VoyeurEngine::initialiseManagers() {
+void VoyeurEngine::initializeManagers() {
 	_debugger.setVm(this);
 	_eventsManager.setVm(this);
 	_filesManager.setVm(this);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 16c2c40..4daa8f5 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -80,7 +80,7 @@ private:
 	FontInfoResource _defaultFontInfo;
 
 	void ESP_Init();
-	void initialiseManagers();
+	void initializeManagers();
 	void globalInitBolt();
 	void initBolt();
 	void vInitInterrupts();


Commit: 1949f4511fa1bfc99f6f336dbf10dc0668021fff
    https://github.com/scummvm/scummvm/commit/1949f4511fa1bfc99f6f336dbf10dc0668021fff
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-12T23:14:01-08:00

Commit Message:
VOYEUR: Some renaming in Files

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 79e81b0..9373ecf 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -398,8 +398,8 @@ byte *BoltFile::getBoltMember(uint32 id) {
 
 	// Get the entry
 	_state._curMemberPtr = &_state._curGroupPtr->_entries[id & 0xff];
-	if (_state._curMemberPtr->_field1)
-		initMem(_state._curMemberPtr->_field1);
+	if (_state._curMemberPtr->_initMemRequired)
+		initMem(_state._curMemberPtr->_initMemRequired);
 
 	// Return the data for the entry if it's already been loaded
 	if (_state._curMemberPtr->_data)
@@ -674,7 +674,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f, uint16 id): _file(f), _id(id
 	byte buffer[16];
 	_file->read(&buffer[0], 16);
 	_mode = buffer[0];
-	_field1 = buffer[1];
+	_initMemRequired = buffer[1];
 	_initMethod = buffer[3];
 	_xorMask = buffer[4] & 0xff;
 	_size = READ_LE_UINT32(&buffer[4]) & 0xffffff;
@@ -965,13 +965,13 @@ int DisplayResource::drawText(const Common::String &msg) {
 		if (i != 0) {
 			fontChar._pick = 0;
 			fontChar._onOff = fontInfo._shadowColor;
-		} else if (fontData.field2 == 1 || (fontInfo._fontFlags & 0x10)) {
+		} else if (fontData._fontDepth == 1 || (fontInfo._fontFlags & 0x10)) {
 			fontChar._pick = 0;
 			fontChar._onOff = fontInfo._foreColor;
 		} else {
 			fontChar._pick = fontInfo._picPick;
 			fontChar._onOff = fontInfo._picOnOff;
-			fontChar._depth = fontData.field2;
+			fontChar._depth = fontData._fontDepth;
 		}
 
 		// Loop to draw each character in turn
@@ -1469,7 +1469,7 @@ ViewPortPalEntry::ViewPortPalEntry(const byte *src) {
 FontResource::FontResource(BoltFilesState &state, byte *src) {
 	_minChar = src[0];
 	_maxChar = src[1];
-	field2 = src[2];
+	_fontDepth = src[2];
 	_padding = src[3];
 	_fontHeight = src[5];
 	_topPadding = (int8)src[6];
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 0e5be69..69802d8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -194,7 +194,7 @@ private:
 public:
 	uint16 _id;
 	byte _mode;
-	byte _field1;
+	byte _initMemRequired;
 	byte _initMethod;
 	int _fileOffset;
 	byte _xorMask;
@@ -350,7 +350,7 @@ public:
 	int _pageIndex;
 	int _lastPage;
 	Common::Rect _bounds;
-	int _field18;
+	int _field18;  // Useless variable
 	PictureResource *_currentPic;
 	PictureResource *_activePage;
 	PictureResource *_pages[2];
@@ -403,7 +403,7 @@ public:
 class FontResource {
 public:
 	int _minChar, _maxChar;
-	int field2;
+	int _fontDepth;
 	int _padding;
 	int _fontHeight;
 	int _topPadding;
@@ -569,15 +569,15 @@ public:
 	int _newStateId;
 	int _newStackId;
 	int _flags;
-	int _fieldA[8];
-	int _field2A[8];
+	int _fieldA[8];  // Useless variable
+	int _field2A[8]; // Useless variable
 	int _stateFlags;
 	int _stateCount;
 	int _parseCount;
-	uint32 _field46;
+	uint32 _nextStateId;
 	byte *_threadInfoPtr;
 	byte _buttonFlags[64];
-	const byte *_field8E[64];
+	const byte *_field8E[64]; // Useless variable
 	byte _buttonIds[64];
 	const byte *_buttonUnused[48];
 	byte *_ctlPtr;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 2241431..897bfae 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -117,7 +117,7 @@ bool ThreadResource::getStateInfo() {
 	} else {
 		uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
 		fld += _stateId << 3;
-		_field46 = READ_LE_UINT32(_ctlPtr + fld + 4);
+		_nextStateId = READ_LE_UINT32(_ctlPtr + fld + 4);
 		
 		fld = READ_LE_UINT32(_ctlPtr + fld);
 		byte *baseP = _ctlPtr + fld;
@@ -895,7 +895,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
 		card += 2;
 	
 	case 45:
-		_newStateId = _field46;
+		_newStateId = _nextStateId;
 		_newStackId = _stackId;
 		break;
 


Commit: 013522457ca3fd84d4c9575d9bc20b6a875b09a3
    https://github.com/scummvm/scummvm/commit/013522457ca3fd84d4c9575d9bc20b6a875b09a3
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-12T23:44:06-08:00

Commit Message:
VOYEUR: Remove useless fields in Events, some renaming

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 198d004..3b761e8 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -50,16 +50,10 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
 IntData::IntData() {
 	_flipWait = false;
 	_hasPalette = false;
-	field16 = 0;
-	field1A = 0;
-	field1E = 0;
-	field22 = 0;
-	field24 = 0;
+	_flashTimer = 0;
+	_flashStep = 0;
 	field26 = 0;
-	field2A = 0;
-	_palChanged = false;
 	_skipFading = false;
-	field3D = false;
 	_palStartIndex = 0;
 	_palEndIndex = 0;
 	_palette = NULL;
@@ -193,16 +187,10 @@ void EventsManager::showMousePosition() {
 }
 
 void EventsManager::voyeurTimer() {
-	_gameData.field22 += _gameData.field24;
-	_gameData.field1A += _gameData.field1E;
-	// _gameData.field1C += _gameData._timerFn; *** WHY INC field by a function pointer?!
-
-	_gameData.field16 = 0;
-	_gameData.field3D = true;
+	_gameData._flashTimer += _gameData._flashStep;
 
 	if (--_gameData.field26 <= 0) {
 		if (_gameData._flipWait) {
-			_gameData._palChanged = true;
 			_gameData._flipWait = false;
 			_gameData._skipFading = false;
 		}
@@ -366,8 +354,6 @@ void EventsManager::startFade(CMapResource *cMap) {
 			_intPtr._palEndIndex = _fadeLastCol;
 
 		_intPtr._hasPalette = true;
-		if (!(cMap->_fadeStatus & 2))
-			_intPtr._palChanged = true;
 	}
 
 	if (_cycleStatus & 1)
@@ -417,7 +403,6 @@ void EventsManager::vDoFadeInt() {
 		_intPtr._palEndIndex = _fadeLastCol;
 
 	_intPtr._hasPalette = true;
-	_intPtr._palChanged = true;
 }
 
 void EventsManager::vDoCycleInt() {
@@ -497,7 +482,6 @@ void EventsManager::vDoCycleInt() {
 			}
 
 			_intPtr._hasPalette = true;
-			_intPtr._palChanged = true;
 		}
 	}
 }
@@ -619,7 +603,6 @@ void EventsManager::startCursorBlink() {
 	if (_vm->_voy._eventFlags & EVTFLAG_RECORDING) {
 		_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
 		_vm->_graphicsManager.setColor(128, 220, 20, 20);
-		_intPtr._palChanged = true;
 		_intPtr._hasPalette = true;
 
 		_vm->_graphicsManager.drawDot();
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index bd62b5c..6167a89 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -53,17 +53,11 @@ public:
 class IntData {
 public:
 	bool _flipWait;
-	int field16;   // CHECKME: Useless variable
-	int field1A;
-	int field1E;
-	int field22;   // CHECKME: Useless variable
-	int field24;   // CHECKME: Useless variable
+	int _flashTimer;
+	int _flashStep;
 	int field26;
-	int field2A;   // CHECKME: Useless variable
 	bool _hasPalette;
-	bool _palChanged;  // CHECKME: Useless variable
 	bool _skipFading;
-	bool field3D;  // CHECKME: Useless variable
 	int _palStartIndex;
 	int _palEndIndex;
 	byte *_palette;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 897bfae..5989c92 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1000,7 +1000,6 @@ int ThreadResource::doApt() {
 	_vm->_graphicsManager.setColor(131, 215, 215, 215);
 	_vm->_graphicsManager.setColor(132, 235, 235, 235);
 
-	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 
 	// Main loop to allow users to move the cursor and select hotspots
@@ -1150,7 +1149,6 @@ void ThreadResource::doRoom() {
 	while (!vm.shouldQuit() && !breakFlag) {
 		_vm->_voyeurArea = AREA_ROOM;
 		vm._graphicsManager.setColor(128, 0, 255, 0);
-		vm._eventsManager._intPtr._palChanged = true;
 		vm._eventsManager._intPtr._hasPalette = true;
 
 		do {
@@ -1190,7 +1188,6 @@ void ThreadResource::doRoom() {
 				vm._eventsManager.setCursor(magnifierCursor);
 			}
 
-			vm._eventsManager._intPtr._palChanged = true;
 			vm._eventsManager._intPtr._hasPalette = true;
 			vm._graphicsManager.flipPage();
 			vm._eventsManager.sWaitFlip();
@@ -1314,8 +1311,8 @@ int ThreadResource::doInterface() {
 
 	_vm->_voy._eventFlags &= ~EVTFLAG_100;
 	_vm->_playStampGroupId = -1;
-	_vm->_eventsManager._intPtr.field1E = 1;
-	_vm->_eventsManager._intPtr.field1A = 0;
+	_vm->_eventsManager._intPtr._flashStep = 1;
+	_vm->_eventsManager._intPtr._flashTimer = 0;
 
 	if (_vm->_voy._RTVNum >= _vm->_voy._RTVLimit || _vm->_voy._RTVNum < 0)
 		_vm->_voy._RTVNum = _vm->_voy._RTVLimit - 1;
@@ -1354,7 +1351,6 @@ int ThreadResource::doInterface() {
 	_vm->_eventsManager.getMouseInfo();
 	
 	_vm->_graphicsManager.setColor(240, 220, 220, 220);
-	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 	_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
@@ -1475,8 +1471,8 @@ int ThreadResource::doInterface() {
 				_vm->_eventsManager.getMouseInfo();
 
 				_vm->_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
-				_vm->_eventsManager._intPtr.field1E = 1;
-				_vm->_eventsManager._intPtr.field1A = 0;
+				_vm->_eventsManager._intPtr._flashStep = 1;
+				_vm->_eventsManager._intPtr._flashTimer = 0;
 			}
 		}
 	} while (!_vm->_eventsManager._rightClick && !_vm->shouldQuit() && 
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 0deeaa1..975e070 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -892,10 +892,6 @@ void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
  * Queues the given picture for display
  */
 void GraphicsManager::sDisplayPic(PictureResource *pic) {
-	if (pic->_flags & DISPFLAG_8) {
-		_vm->_eventsManager._intPtr.field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
-	}
-
 	_vm->_eventsManager._intPtr._flipWait = true;
 }
 
@@ -974,7 +970,6 @@ void GraphicsManager::resetPalette() {
 	for (int i = 0; i < 256; ++i)
 		setColor(i, 0, 0, 0);
 
-	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 }
 
@@ -1004,7 +999,6 @@ void GraphicsManager::setColors(int start, int count, const byte *pal) {
 		}
 	}
 
-	_vm->_eventsManager._intPtr._palChanged = true;
 	_vm->_eventsManager._intPtr._hasPalette = true;
 }
 
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 911daa0..f2822b4 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -263,7 +263,6 @@ bool VoyeurEngine::doLock() {
 		_eventsManager.setCursor(cursorPic);
 		_eventsManager.showCursor();
 
-		_eventsManager._intPtr. _palChanged = true;
 		_eventsManager._intPtr._hasPalette = true;
 
 		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
@@ -315,7 +314,6 @@ bool VoyeurEngine::doLock() {
 					}
 
 					_eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
-					_eventsManager._intPtr._palChanged = true;
 					_eventsManager._intPtr._hasPalette = true;
 
 					_eventsManager.delay(1);
@@ -459,7 +457,6 @@ void VoyeurEngine::doOpening() {
 	for (int i = 0; i < 256; ++i)
 		_graphicsManager.setColor(i, 8, 8, 8);
 
-	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort();
 	flipPageAndWait();
@@ -637,7 +634,6 @@ void VoyeurEngine::playAudio(int audioId) {
 void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
 	_graphicsManager.setColor(128, 16, 16, 16);
 	_graphicsManager.setColor(224, 220, 220, 220);
-	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 7bb10c2..c4c52bd 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -286,7 +286,6 @@ void VoyeurEngine::doClosingCredits() {
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	_graphicsManager.setColor(1, 180, 180, 180);
 	_graphicsManager.setColor(2, 200, 200, 200);
-	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 
 	_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x402)._fontResource;
@@ -390,7 +389,6 @@ void VoyeurEngine::doPiracy() {
 	_graphicsManager.screenReset();
 	_graphicsManager.setColor(1, 0, 0, 0);
 	_graphicsManager.setColor(2, 255, 255, 255);
-	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 	(*_graphicsManager._vPort)->fillPic(1);
@@ -460,7 +458,6 @@ void VoyeurEngine::reviewTape() {
 		_graphicsManager.setColor(12, 120, 248, 120);
 		_eventsManager.setCursorColor(128, 1);
 
-		_eventsManager._intPtr._palChanged = true;
 		_eventsManager._intPtr._hasPalette = true;
 		_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
 		_graphicsManager._fontPtr->_fontSaveBack = false;
@@ -591,7 +588,6 @@ void VoyeurEngine::reviewTape() {
 				_eventsManager.setCursorColor(128, (foundIndex == -1) ? 0 : 1);
 			}
 
-			_eventsManager._intPtr._palChanged = true;
 			_eventsManager._intPtr._hasPalette = true;
 
 			if (_eventsManager._mouseClicked || _eventsManager._mouseUnk) {
@@ -688,8 +684,8 @@ void VoyeurEngine::reviewTape() {
 			_graphicsManager._backColors->startFade();
 			flipPageAndWaitForFade();
 
-			_eventsManager._intPtr.field1E = 1;
-			_eventsManager._intPtr.field1A = 0;
+			_eventsManager._intPtr._flashStep = 1;
+			_eventsManager._intPtr._flashTimer = 0;
 			_voy._eventFlags &= ~EVTFLAG_TIME_DISABLED;
 
 			// Play suond for the given duration
@@ -1033,7 +1029,6 @@ void VoyeurEngine::makeViewFinder() {
 	_graphicsManager.setColor(243, 105, 105, 105);
 	_graphicsManager.setColor(palOffset + 241, 219, 235, 235);
 
-	_eventsManager._intPtr._palChanged = true;
 	_eventsManager._intPtr._hasPalette = true;
 }
 
@@ -1293,7 +1288,6 @@ void VoyeurEngine::doTimeBar(bool force) {
 		(*_graphicsManager._vPort)->sFillBox(6, fullHeight - 92);
 		if (height > 0) {
 			_graphicsManager.setColor(215, 238, 238, 238);
-			_eventsManager._intPtr._palChanged = true;
 			_eventsManager._intPtr._hasPalette = true;
 
 			_graphicsManager._drawPtr->_penColor = 215;
@@ -1305,17 +1299,16 @@ void VoyeurEngine::doTimeBar(bool force) {
 
 void VoyeurEngine::flashTimeBar(){
 	if (_voy._RTVNum >= 0 && (_voy._RTVLimit - _voy._RTVNum) < 11 &&
-		(_eventsManager._intPtr.field1A >= (_flashTimeVal + 15) ||
-		_eventsManager._intPtr.field1A < _flashTimeVal)) {
+		(_eventsManager._intPtr._flashTimer >= (_flashTimeVal + 15) ||
+		_eventsManager._intPtr._flashTimer < _flashTimeVal)) {
 		// Within camera low power range
-		_flashTimeVal = _eventsManager._intPtr.field1A;
+		_flashTimeVal = _eventsManager._intPtr._flashTimer;
 
 		if (_flashTimeFlag)
 			_graphicsManager.setColor(240, 220, 20, 20);
 		else
 			_graphicsManager.setColor(240, 220, 220, 220);
 		
-		_eventsManager._intPtr._palChanged = true;
 		_eventsManager._intPtr._hasPalette = true;
 		_flashTimeFlag = !_flashTimeFlag;
 	}


Commit: 2a97f13c0e59f92b080cce21df3756c778eb6a72
    https://github.com/scummvm/scummvm/commit/2a97f13c0e59f92b080cce21df3756c778eb6a72
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-13T16:17:34-08:00

Commit Message:
VOYEUR: Set private some variables and functions

Changed paths:
    engines/voyeur/animation.h



diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 96c2835..35199f6 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -47,28 +47,32 @@ class RL2Decoder : public Video::VideoDecoder {
 private:
 	class RL2FileHeader {
 	public:
-		uint32 _form;
-		uint32 _backSize;
-		uint32 _signature;
-		uint32 _dataSize;
+		RL2FileHeader();
+		~RL2FileHeader();
+
+		int _channels;
+		int _colorCount;
 		int _numFrames;
-		int _method;
-		int _soundRate;
 		int _rate;
-		int _channels;
-		int _defSoundSize;
+		int _soundRate;
 		int _videoBase;
-		int _colorCount;
-		byte _palette[768];
+		int *_frameSoundSizes;
 
+		uint32 _backSize;
+		uint32 _signature;
 		uint32 *_frameOffsets;
-		int *_frameSoundSizes;
-	public:
-		RL2FileHeader();
-		~RL2FileHeader();
+
+		byte _palette[768];
+
 		void load(Common::SeekableReadStream *stream);
-		bool isValid() const;
 		Common::Rational getFrameRate() const;
+		bool isValid() const;
+
+	private:
+		uint32 _form;
+		uint32 _dataSize;
+		int _method;
+		int _defSoundSize;
 	};
 
 	class SoundFrame {
@@ -155,26 +159,25 @@ private:
 	int _paletteStart;
 	Common::Array<SoundFrame> _soundFrames;
 	int _soundFrameNumber;
+	const Common::List<Common::Rect> *getDirtyRects() const;
+
+	void clearDirtyRects();
+	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
+	int getPaletteStart() const { return _paletteStart; }
+	const RL2FileHeader &getHeader() { return _header; }
+	virtual void readNextPacket();
+	virtual bool seekIntern(const Audio::Timestamp &time);
+
 public:
 	RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
 	virtual ~RL2Decoder();
 
+	virtual void close();
+
 	bool loadStream(Common::SeekableReadStream *stream);
 	bool loadFile(const Common::String &file, bool palFlag = false);
 	bool loadVideo(int videoId);
-
-	virtual void readNextPacket();
-	virtual void close();
-	virtual bool seekIntern(const Audio::Timestamp &time);
-
-	const Common::List<Common::Rect> *getDirtyRects() const;
-	void clearDirtyRects();
-	void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
-	RL2VideoTrack *getVideoTrack() { return _videoTrack; }
-	RL2AudioTrack *getAudioTrack() { return _audioTrack; }
-	int getPaletteStart() const { return _paletteStart; }
 	int getPaletteCount() const { return _header._colorCount; }
-	const RL2FileHeader &getHeader() { return _header; }
 
 	/**
 	 * Play back a given Voyeur RL2 video
@@ -184,6 +187,8 @@ public:
 	 * @param imgPos		Position to draw image data
 	 */
 	void play(VoyeurEngine *vm, int resourceOffset = 0, byte *frames = NULL, byte *imgPos = NULL);
+	RL2VideoTrack *getVideoTrack() { return _videoTrack; }
+	RL2AudioTrack *getAudioTrack() { return _audioTrack; }
 };
 
 } // End of namespace Voyeur


Commit: bc8542aa202dd16d6b6fb780dbd029181ba58102
    https://github.com/scummvm/scummvm/commit/bc8542aa202dd16d6b6fb780dbd029181ba58102
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-14T11:48:25-08:00

Commit Message:
VOYEUR: Set private some DATA variables

Changed paths:
    engines/voyeur/data.h



diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h
index cbdb995..8eb11ff 100644
--- a/engines/voyeur/data.h
+++ b/engines/voyeur/data.h
@@ -103,56 +103,54 @@ public:
 class SVoy {
 private:
 	VoyeurEngine *_vm;
+
 public:
+	bool _abortInterface;
+	bool _fadeICF0; // Useless variable? (always the same value)
 	bool _isAM;
-	int _RTANum;
-	int _RTVNum;
-	int _switchBGNum;
-	HotspotTimes<8> _videoHotspotTimes;
-	HotspotTimes<3> _audioHotspotTimes;
-	HotspotTimes<3> _evidenceHotspotTimes;
+	bool _phoneCallsReceived[5];
 	bool _roomHotspotsEnabled[20];
+	bool _victimMurdered;
 
+	int _aptLoadMode;
 	int _audioVisualStartTime;
 	int _audioVisualDuration;
-	int _vocSecondsOffset;
-	bool _abortInterface;
-	int _playStampMode;
-	int _aptLoadMode;
-	int _transitionId;
-	int _RTVLimit;
-	int _eventFlags;
 	int _boltGroupId2;
-	PictureResource *_evPicPtrs[6];
-	CMapResource *_evCmPtrs[6];
-	int _musicStartTime;
-	bool _phoneCallsReceived[5];
-	int _totalPhoneCalls;
-
 	int _computerTextId;
-	Common::Rect _rect4E4;
 	int _computerTimeMin;
 	int _computerTimeMax;
-	bool _victimMurdered;
-	int _murderThreshold;
-
+	int _curICF0;   // Useless variable
+	int _eventCount;
+	int _eventFlags;
 	int _fadingAmount1;
 	int _fadingAmount2;
 	int _fadingStep1;
 	int _fadingStep2;
 	int _fadingType;
-	int _victimNumber;
 	int _incriminatedVictimNumber;
+	int _murderThreshold;
+	int _musicStartTime;
+	int _playStampMode;
+	int _switchBGNum;
+	int _totalPhoneCalls;
+	int _transitionId;
+	int _victimNumber;
 	int _videoEventId;
+	int _vocSecondsOffset;
+	int _RTANum;
+	int _RTVLimit;
+	int _RTVNum;
+
+	HotspotTimes<3> _audioHotspotTimes;
+	HotspotTimes<3> _evidenceHotspotTimes;
+	HotspotTimes<8> _videoHotspotTimes;
+
+	Common::Rect _rect4E4;
 	RectResource *_viewBounds;
-	int _curICF0;   // Useless variable
-	int _curICF1;   // Useless variable
-	bool _fadeICF0; // Useless variable? (always the same value)
-	int _policeEvent;
-	
-	int _eventCount;
+	PictureResource *_evPicPtrs[6];
+	CMapResource *_evCmPtrs[6];
 	VoyeurEvent _events[TOTAL_EVENTS];
-public:
+
 	SVoy();
 	void setVm(VoyeurEngine *vm);
 
@@ -222,6 +220,10 @@ public:
 	 * should take place
 	 */
 	bool checkForKey();
+
+private:
+	int _curICF1;   // Useless variable
+	int _policeEvent;
 };
 
 } // End of namespace Voyeur


Commit: 56a32b365210b3f517952674fbd4b16700ba27ca
    https://github.com/scummvm/scummvm/commit/56a32b365210b3f517952674fbd4b16700ba27ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-16T20:29:19-08:00

Commit Message:
VOYEUR: Fix checking RLV header signature

Changed paths:
    engines/voyeur/animation.cpp



diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index c7522e6..f81573f 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -162,7 +162,7 @@ void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
 
 	_form = stream->readUint32LE();
 	_backSize = stream->readUint32LE();
-	_signature = stream->readUint32LE();
+	_signature = stream->readUint32BE();
 
 	if (!isValid())
 		return;
@@ -197,7 +197,7 @@ void RL2Decoder::RL2FileHeader::load(Common::SeekableReadStream *stream) {
 }
 
 bool RL2Decoder::RL2FileHeader::isValid() const {
-	return _signature == MKTAG('R','L','V','2') || _signature != MKTAG('R','L','V','3');
+	return _signature == MKTAG('R','L','V','2') || _signature == MKTAG('R','L','V','3');
 }
 
 Common::Rational RL2Decoder::RL2FileHeader::getFrameRate() const {


Commit: b2bf4c6b17116a6747a283d6e9dc11c79767cd72
    https://github.com/scummvm/scummvm/commit/b2bf4c6b17116a6747a283d6e9dc11c79767cd72
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-16T20:38:05-08:00

Commit Message:
VOYEUR: Changed SVoy initialisation to individual field values

Changed paths:
    engines/voyeur/data.cpp



diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index db59760..3a7c75f 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -39,8 +39,40 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {
 /*------------------------------------------------------------------------*/
 
 SVoy::SVoy() {
-	// Initialize all the data fields of SVoy to empty values
-	Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0);
+	// Initialize all the data fields
+	_abortInterface = false;
+	_fadeICF0 = false;
+	_isAM = false;
+	Common::fill(&_phoneCallsReceived[0], &_phoneCallsReceived[5], false);
+	Common::fill(&_roomHotspotsEnabled[0], &_roomHotspotsEnabled[20], false);
+	_victimMurdered = false;
+
+	_audioVisualStartTime = 0;
+	_audioVisualDuration = 0;
+	_boltGroupId2 = 0;
+	_computerTextId = 0;
+	_computerTimeMin = _computerTimeMax = 0;
+	_curICF0 = 0;
+	_eventCount = 0;
+	_fadingStep1 = 0;
+	_fadingStep2 = 0;
+	_fadingType = 0;
+	_incriminatedVictimNumber = 0;
+	_musicStartTime = 0;
+	_playStampMode = 0;
+	_switchBGNum = 0;
+	_transitionId = 0;
+	_victimNumber = 0;
+	_videoEventId = 0;
+	_vocSecondsOffset = 0;
+	_RTANum = 0;
+	_RTVLimit = 0;
+	_RTVNum = 0;
+	_viewBounds = nullptr;
+	Common::fill(&_evPicPtrs[0], &_evPicPtrs[6], (PictureResource *)nullptr);
+	Common::fill(&_evCmPtrs[0], &_evCmPtrs[6], (CMapResource *)nullptr);
+	_curICF1 = 0;
+	_policeEvent = 0;
 
 	_eventFlags = EVTFLAG_TIME_DISABLED;
 	_fadingAmount1 = _fadingAmount2 = 127;
@@ -48,8 +80,6 @@ SVoy::SVoy() {
 	_aptLoadMode = -1;
 	_eventFlags |= EVTFLAG_100;
 	_totalPhoneCalls = 0;
-	_victimMurdered = false;
-	_computerTimeMin = _computerTimeMax = 0;
 }
 
 void SVoy::setVm(VoyeurEngine *vm) {


Commit: fe0376dbb0b1b21c6bfc396e55a3e1259514cef8
    https://github.com/scummvm/scummvm/commit/fe0376dbb0b1b21c6bfc396e55a3e1259514cef8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-16T20:43:15-08:00

Commit Message:
VOYEUR: Indent register plugin lines to match standard practice

Changed paths:
    engines/voyeur/detection.cpp



diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp
index 9a942b6..8d3910e 100644
--- a/engines/voyeur/detection.cpp
+++ b/engines/voyeur/detection.cpp
@@ -176,7 +176,7 @@ SaveStateDescriptor VoyeurMetaEngine::querySaveMetaInfos(const char *target, int
 
 
 #if PLUGIN_ENABLED_DYNAMIC(VOYEUR)
-REGISTER_PLUGIN_DYNAMIC(VOYEUR, PLUGIN_TYPE_ENGINE, VoyeurMetaEngine);
+	REGISTER_PLUGIN_DYNAMIC(VOYEUR, PLUGIN_TYPE_ENGINE, VoyeurMetaEngine);
 #else
-REGISTER_PLUGIN_STATIC(VOYEUR, PLUGIN_TYPE_ENGINE, VoyeurMetaEngine);
+	REGISTER_PLUGIN_STATIC(VOYEUR, PLUGIN_TYPE_ENGINE, VoyeurMetaEngine);
 #endif


Commit: 473732d9fb9f1d109088bf2ddcb3f1200ffdcad7
    https://github.com/scummvm/scummvm/commit/473732d9fb9f1d109088bf2ddcb3f1200ffdcad7
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:26:52-08:00

Commit Message:
VOYEUR: Use AD_ENTRY1 for detection

Changed paths:
    engines/voyeur/detection_tables.h



diff --git a/engines/voyeur/detection_tables.h b/engines/voyeur/detection_tables.h
index 789eb4c..af0faf6 100644
--- a/engines/voyeur/detection_tables.h
+++ b/engines/voyeur/detection_tables.h
@@ -28,10 +28,7 @@ static const VoyeurGameDescription gameDescriptions[] = {
 		{
 			"voyeur",
 			0,
-			{
-				{"a1100100.rl2", 0, "b44630677618d034970ca0a13c1c1237", 336361},
-				AD_LISTEND
-			},
+			AD_ENTRY1s("a1100100.rl2", "b44630677618d034970ca0a13c1c1237", 336361),
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,


Commit: 4367ade8c7282c2d6401e8035940f7ce3c646f4b
    https://github.com/scummvm/scummvm/commit/4367ade8c7282c2d6401e8035940f7ce3c646f4b
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:29:15-08:00

Commit Message:
VOYEUR: Fix maximum number of savegames

Changed paths:
    engines/voyeur/detection.cpp



diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp
index 8d3910e..ab3932b 100644
--- a/engines/voyeur/detection.cpp
+++ b/engines/voyeur/detection.cpp
@@ -127,7 +127,7 @@ SaveStateList VoyeurMetaEngine::listSaves(const char *target) const {
 		const char *ext = strrchr(file->c_str(), '.');
 		int slot = ext ? atoi(ext + 1) : -1;
 
-		if (slot >= 0 && slot < MAX_SAVES) {
+		if (slot >= 0 && slot <= MAX_SAVES) {
 			Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
 
 			if (in) {


Commit: ed681f49e3e356700eacc10666cada8369e19e0e
    https://github.com/scummvm/scummvm/commit/ed681f49e3e356700eacc10666cada8369e19e0e
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:37:37-08:00

Commit Message:
VOYEUR: Fix formatting

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9373ecf..750071a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -317,11 +317,12 @@ PictureResource *BoltFile::getPictureResource(uint32 id) {
 }
 
 CMapResource *BoltFile::getCMapResource(uint32 id) {
-		if ((int32)id == -1)
+	if ((int32)id == -1)
 		return NULL;
 
 	if (id & 0xffff)
 		id <<= 16;
+
 	return getBoltEntryFromLong(id)._cMapResource;
 }
 
@@ -370,11 +371,10 @@ void BoltFile::resolveIt(uint32 id, byte **p) {
 }
 
 void BoltFile::resolveFunction(uint32 id, GraphicMethodPtr *fn) {
-	if ((int32)id == -1) {
+	if ((int32)id == -1)
 		*fn = NULL;
-	} else {
+	else
 		error("Function fnTermGro array not supported");
-	}
 }
 
 /**


Commit: d439747147e61ec6adf4f7a87bed176f7b0b945c
    https://github.com/scummvm/scummvm/commit/d439747147e61ec6adf4f7a87bed176f7b0b945c
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:40:27-08:00

Commit Message:
VOYEUR: Fix formatting in GraphicsManager

Changed paths:
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 975e070..7ed0591 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -39,9 +39,7 @@ DrawInfo::DrawInfo(int penColor, const Common::Point &pos, int flags) {
 
 /*------------------------------------------------------------------------*/
 
-GraphicsManager::GraphicsManager():
-		_defaultDrawInfo(1, Common::Point(), 0),
-			_drawPtr(&_defaultDrawInfo) {
+GraphicsManager::GraphicsManager(): _defaultDrawInfo(1, Common::Point(), 0), _drawPtr(&_defaultDrawInfo) {
 	_SVGAPage = 0;
 	_SVGAMode = 0;
 	_SVGAReset = 0;
@@ -63,9 +61,7 @@ GraphicsManager::GraphicsManager():
 
 void GraphicsManager::sInitGraphics() {
 	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false);
-	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT,
-		Graphics::PixelFormat::createFormatCLUT8());
-
+	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
 	clearPalette();
 }
 


Commit: ee9c59b225c11c276c67a2b43d5fba223e347a75
    https://github.com/scummvm/scummvm/commit/ee9c59b225c11c276c67a2b43d5fba223e347a75
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:43:04-08:00

Commit Message:
VOYEUR: Fix tabulation in staticres

Changed paths:
    engines/voyeur/staticres.cpp



diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 078731e..9025426 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -75,7 +75,7 @@ const int COMP_BUT_TABLE[] = {
 };
 
 const char *const SZ_FILENAMES[] = {
-    "A2110100", nullptr, "A2300100", nullptr, "B1220100", nullptr, "C1220100", nullptr, 
+	"A2110100", nullptr, "A2300100", nullptr, "B1220100", nullptr, "C1220100", nullptr, 
 	"C1290100", nullptr, "D1220100", nullptr, "D1270100", nullptr, "E1210100", nullptr, 
 	"E1260100", nullptr, "E1280100", nullptr, "E1325100", nullptr, "F1200100", nullptr,
 	"G1250100", nullptr, "G1260100", nullptr, "H1200100", nullptr, "H1230100", nullptr, 


Commit: f660e3ba11c80133f276b78a9e75c4c119f5302a
    https://github.com/scummvm/scummvm/commit/f660e3ba11c80133f276b78a9e75c4c119f5302a
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:45:49-08:00

Commit Message:
VOYEUR: Fix some function definitions in voyeur_game

Changed paths:
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index c4c52bd..b664074 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -1036,7 +1036,7 @@ void VoyeurEngine::makeViewFinderP() {
 	_graphicsManager.screenReset();
 }
 
-void VoyeurEngine::initIFace(){
+void VoyeurEngine::initIFace() {
 	int playStamp1 = _playStampGroupId;
 	switch (_voy._transitionId) {
 	case 0:
@@ -1119,7 +1119,7 @@ void VoyeurEngine::doScroll(const Common::Point &pt) {
 	(*_graphicsManager._vPort)->setupViewPort(NULL);
 }
 
-void VoyeurEngine::checkTransition(){
+void VoyeurEngine::checkTransition() {
 	Common::String time, day;
 
 	if (_voy._transitionId != _checkTransitionId) {
@@ -1297,7 +1297,7 @@ void VoyeurEngine::doTimeBar(bool force) {
 	}
 }
 
-void VoyeurEngine::flashTimeBar(){
+void VoyeurEngine::flashTimeBar() {
 	if (_voy._RTVNum >= 0 && (_voy._RTVLimit - _voy._RTVNum) < 11 &&
 		(_eventsManager._intPtr._flashTimer >= (_flashTimeVal + 15) ||
 		_eventsManager._intPtr._flashTimer < _flashTimeVal)) {


Commit: 1b46f5f6160a5d3ee8a470a1a64eb7ed8994ca6c
    https://github.com/scummvm/scummvm/commit/1b46f5f6160a5d3ee8a470a1a64eb7ed8994ca6c
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:48:05-08:00

Commit Message:
VOYEUR: Remove a useless keystate variable

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 3b761e8..3b2369c 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -72,7 +72,6 @@ EventsManager::EventsManager(): _intPtr(_gameData),
 	_recordBlinkCounter = 0;
 	_cursorBlinked = false;
 
-	Common::fill(&_keyState[0], &_keyState[256], false);
 	Common::fill(&_cycleTime[0], &_cycleTime[4], 0);
 	Common::fill(&_cycleNext[0], &_cycleNext[4], (byte *)nullptr);
 	_cyclePtr = NULL;
@@ -260,6 +259,7 @@ void EventsManager::pollEvents() {
 		switch (event.type) {
 		case Common::EVENT_QUIT:
 		case Common::EVENT_RTL:
+		case Common::EVENT_KEYUP:
 			return;
 
 		case Common::EVENT_KEYDOWN:
@@ -268,13 +268,8 @@ void EventsManager::pollEvents() {
 				// Attach to the debugger
 				_vm->_debugger.attach();
 				_vm->_debugger.onFrame();
-			} else {
-				_keyState[(byte)toupper(event.kbd.ascii)] = true;
 			}
 			return;
-		case Common::EVENT_KEYUP:
-			_keyState[(byte)toupper(event.kbd.ascii)] = false;
-			return;
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButton = 1;
 			_vm->_eventsManager._newLeftClick = true;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 6167a89..eb6cf6d 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -72,7 +72,6 @@ private:
 	bool _counterFlag;
 	uint32 _gameCounter;
 	uint32 _recordBlinkCounter;	// Original field was called _joe :)
-	bool _keyState[256];
 	int _mouseButton;
 	Common::List<IntNode *> _intNodes;
 	Common::Point _mousePos;


Commit: 2725bc88aa538ea73baccc5f9a2ef3f131bb863a
    https://github.com/scummvm/scummvm/commit/2725bc88aa538ea73baccc5f9a2ef3f131bb863a
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-17T12:49:07-08:00

Commit Message:
VOYEUR: Get rid of a magic value, replaced by DECOMPRESS_SIZE

Changed paths:
    engines/voyeur/files.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 750071a..3f955fd 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -178,7 +178,7 @@ void BoltFilesState::nextBlock() {
 /*------------------------------------------------------------------------*/
 
 FilesManager::FilesManager() {
-	_decompressSize = 0x7000;
+	_decompressSize = DECOMPRESS_SIZE;
 }
 
 bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFile) {


Commit: dc8b58a0f9a89b9a59cdf6db300e61c4ac7264e9
    https://github.com/scummvm/scummvm/commit/dc8b58a0f9a89b9a59cdf6db300e61c4ac7264e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-17T13:16:37-08:00

Commit Message:
VOYEUR: Changed signature check for savegames to use MKTAG

Changed paths:
    engines/voyeur/voyeur.cpp



diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index f2822b4..d7fa92f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -855,8 +855,8 @@ bool VoyeurSavegameHeader::read(Common::InSaveFile *f) {
 	char id[4];
 	_thumbnail = NULL;
 
-	f->read(&id[0], 4);
-	if (strncmp(id, "VOYR", 4)) {
+	uint32 signature = f->readUint32BE();
+	if (signature != MKTAG('V', 'O', 'Y', 'R')) {
 		warning("Invalid savegame");
 		return false;
 	}
@@ -888,7 +888,7 @@ bool VoyeurSavegameHeader::read(Common::InSaveFile *f) {
 
 void VoyeurSavegameHeader::write(Common::OutSaveFile *f, VoyeurEngine *vm, const Common::String &saveName) {
 	// Write ident string
-	f->write("VOYR", 4);
+	f->writeUint32BE(MKTAG('V', 'O', 'Y', 'R'));
 
 	// Write out savegame version
 	f->writeByte(VOYEUR_SAVEGAME_VERSION);


Commit: 7d1cc31e1e8158b2fc0989933c088941602c4193
    https://github.com/scummvm/scummvm/commit/7d1cc31e1e8158b2fc0989933c088941602c4193
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-17T15:32:23-08:00

Commit Message:
Merge pull request #436 from dreammaster/voyeur

New Engine: Voyeur by Phillips Interactive

Changed paths:
  A engines/voyeur/animation.cpp
  A engines/voyeur/animation.h
  A engines/voyeur/configure.engine
  A engines/voyeur/data.cpp
  A engines/voyeur/data.h
  A engines/voyeur/debugger.cpp
  A engines/voyeur/debugger.h
  A engines/voyeur/detection.cpp
  A engines/voyeur/detection_tables.h
  A engines/voyeur/events.cpp
  A engines/voyeur/events.h
  A engines/voyeur/files.cpp
  A engines/voyeur/files.h
  A engines/voyeur/files_threads.cpp
  A engines/voyeur/graphics.cpp
  A engines/voyeur/graphics.h
  A engines/voyeur/module.mk
  A engines/voyeur/sound.cpp
  A engines/voyeur/sound.h
  A engines/voyeur/staticres.cpp
  A engines/voyeur/staticres.h
  A engines/voyeur/voyeur.cpp
  A engines/voyeur/voyeur.h
  A engines/voyeur/voyeur_game.cpp









More information about the Scummvm-git-logs mailing list