[Scummvm-cvs-logs] SF.net SVN: scummvm:[42165] scummvm/branches/gsoc2009-16bit

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Mon Jul 6 08:34:41 CEST 2009


Revision: 42165
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42165&view=rev
Author:   Kirben
Date:     2009-07-06 06:34:40 +0000 (Mon, 06 Jul 2009)

Log Message:
-----------
Merged revisions 42087-42088,42093-42095,42097-42099,42104-42107,42110,42112-42113,42115-42132,42134-42150,42153-42155,42161-42162 via svnmerge from 
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk

........
  r42087 | thebluegr | 2009-07-04 21:24:09 +1000 (Sat, 04 Jul 2009) | 1 line
  
  Newer DoSound() semantics are now detected automatically, by the existence of the "setVol" selector. Removed game flag GF_SCI1_NEWDOSOUND
........
  r42088 | thebluegr | 2009-07-04 21:33:51 +1000 (Sat, 04 Jul 2009) | 1 line
  
  Removed silly FIXME (mixup between debug and engine debug levels)
........
  r42093 | thebluegr | 2009-07-05 01:22:42 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Added a new console command, "selector", which attempts to find a selector by name
........
  r42094 | thebluegr | 2009-07-05 01:39:31 +1000 (Sun, 05 Jul 2009) | 1 line
  
  - Changed some comments to DOxygen style
........
  r42095 | thebluegr | 2009-07-05 01:45:04 +1000 (Sun, 05 Jul 2009) | 3 lines
  
  - Kernel function names are no longer loaded from vocab.999, but are constructed from the hardcoded function table, depending on the SCI version used
  - SCI0 games using older graphics functions are now detected by the presence of the "curAngle" selector
  - SCI0 games using a SCI1 table (like KQ1 demo version and full version) are detected by the presence of the "sightAngle" selector (as no SCI0 game seems to have it)
........
  r42097 | thebluegr | 2009-07-05 02:30:20 +1000 (Sun, 05 Jul 2009) | 3 lines
  
  - Merged the "early" and "late" SCI1 versions - these are functionally equivalent, and the code that does the version check is unreliable (e.g. it sets SQ1 VGA to SCI1 "late" and EcoQuest 1 to SCI1 "early")
  - Cleanup of the vocabulary setting functions
  - Cleanup of the cursor manipulation code
........
  r42098 | thebluegr | 2009-07-05 02:36:56 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Merged SCI1 versions in one more file
........
  r42099 | thebluegr | 2009-07-05 03:39:43 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Cursors without a palette are now initialized correctly (from patch #2816652). Fixes the cursor transparent color in QFG3
........
  r42104 | lordhoto | 2009-07-05 04:54:06 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Add GCC_PRINTF parameter.
........
  r42105 | lordhoto | 2009-07-05 04:54:27 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Fix mismatching format arguments.
........
  r42106 | lordhoto | 2009-07-05 04:54:43 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Kyra1 PC-98 never offered English as language settings, thus remove it. (The CD version *does* supply English files, but those will work as FM-Towns version, so this causes no drawback for the user and is faithful to the original)
........
  r42107 | lordhoto | 2009-07-05 05:04:39 +1000 (Sun, 05 Jul 2009) | 1 line
  
  After discussing with Max, disable -Wmissing-format-attribute again. Also added a comment explaining why it is disabled.
........
  r42110 | athrxx | 2009-07-05 07:18:20 +1000 (Sun, 05 Jul 2009) | 1 line
  
  KYRA: fix minor bug in Screen::drawShape()
........
  r42112 | wjpalenstijn | 2009-07-05 09:52:24 +1000 (Sun, 05 Jul 2009) | 1 line
  
  When morphing a TeeSongIterator, transfer death listeners to remaining child
........
  r42113 | wjpalenstijn | 2009-07-05 11:16:53 +1000 (Sun, 05 Jul 2009) | 1 line
  
  When creating a CleanupSongIterator, transfer death listeners to it
........
  r42115 | dreammaster | 2009-07-05 17:21:17 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Bugfix for word-wrapping of text, which sometimes failed for strings with special characters
........
  r42116 | jvprat | 2009-07-05 19:34:54 +1000 (Sun, 05 Jul 2009) | 3 lines
  
  - Refactorized Groovie::MusicPlayer to make it extensible
  - Added an empty MusicPlayerMac to let the Macintosh version of The 7th Guest start
........
  r42117 | thebluegr | 2009-07-05 20:34:43 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Removed validity check for atoi, which prevented console commands from interacting with resources with id 0
........
  r42118 | thebluegr | 2009-07-05 21:08:53 +1000 (Sun, 05 Jul 2009) | 1 line
  
  SCI1 games with absolute parameters to lofs instructions are automatically detected now. Removed the GF_SCI1_LOFSABSOLUTE game flag
........
  r42119 | drmccoy | 2009-07-05 21:26:23 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Adding an enum MouseButtons
........
  r42120 | drmccoy | 2009-07-05 21:26:42 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Commenting prepareStr a bit and renaming it to cleanupStr
........
  r42121 | drmccoy | 2009-07-05 21:27:11 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Added a Key and ShortKey enum
........
  r42122 | drmccoy | 2009-07-05 21:27:26 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Added a skipBlock() method
........
  r42123 | drmccoy | 2009-07-05 21:27:54 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Moving the "Collision" stuff to Hotspots in hotspots.cpp/.h
........
  r42124 | drmccoy | 2009-07-05 21:28:09 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Wrapping the block end marker checks into Hotspots::Hotspot::isEnd()
........
  r42125 | drmccoy | 2009-07-05 21:28:25 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Removing the now empty Game_Fascination class
........
  r42126 | drmccoy | 2009-07-05 21:28:38 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Fixing indent
........
  r42127 | drmccoy | 2009-07-05 21:28:57 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Merging Game_v1's and Game_v2's prepareStart()
........
  r42128 | drmccoy | 2009-07-05 21:29:13 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Merging Game's and Game_v6's totSub()
........
  r42129 | drmccoy | 2009-07-05 21:29:30 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Merging playTot()
........
  r42130 | drmccoy | 2009-07-05 21:29:54 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Putting the Urban noCD check into Init_v6::initGame()
........
  r42131 | drmccoy | 2009-07-05 21:30:14 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Removing the now unneeded Game_v* classes
........
  r42132 | thebluegr | 2009-07-05 21:49:05 +1000 (Sun, 05 Jul 2009) | 2 lines
  
  - Fixed feature auto-detection for Conquests of Camelot
  - Auto-detected features are now printed in the console (to ease debugging)
........
  r42134 | thebluegr | 2009-07-05 21:58:42 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Updated the MSVC project files of the gob engine
........
  r42135 | drmccoy | 2009-07-05 22:52:14 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Adding a workaround for an invalid expression in Gob1 EGA
........
  r42136 | thebluegr | 2009-07-05 23:07:11 +1000 (Sun, 05 Jul 2009) | 1 line
  
  Merged the two SCI1 versions in one more file
........
  r42137 | lordhoto | 2009-07-06 00:11:54 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Got rid of HACK, which was used to setup new cursor on theme change.
........
  r42138 | lordhoto | 2009-07-06 00:12:04 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Removed pushing of EVENT_SCREEN_CHANGED on theme load. This event should only be pushed by the backend.
........
  r42139 | marcus_c | 2009-07-06 00:57:03 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Refresh the screen if pollEvent() is called without updateScreen() being called for a long time.
........
  r42140 | athrxx | 2009-07-06 00:58:22 +1000 (Mon, 06 Jul 2009) | 1 line
  
  LOL: - reduce code duplication
........
  r42141 | athrxx | 2009-07-06 02:29:17 +1000 (Mon, 06 Jul 2009) | 1 line
  
  LOL: cleanup
........
  r42142 | drmccoy | 2009-07-06 05:56:03 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Encapsulating hotspot state reading
........
  r42143 | drmccoy | 2009-07-06 05:56:23 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Correcting an input related mistake
........
  r42144 | drmccoy | 2009-07-06 05:56:40 +1000 (Mon, 06 Jul 2009) | 1 line
  
  More state-related encapsulation
........
  r42145 | drmccoy | 2009-07-06 05:56:54 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Split off Hotspots::evaluateNew()
........
  r42146 | drmccoy | 2009-07-06 05:57:08 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Ooops, fixing monospaced text input again
........
  r42147 | drmccoy | 2009-07-06 05:57:22 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Split off some drawing related functions
........
  r42148 | drmccoy | 2009-07-06 05:57:37 +1000 (Mon, 06 Jul 2009) | 1 line
  
  More input related split-offs
........
  r42149 | drmccoy | 2009-07-06 05:57:55 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Renaming FontDesc::extraData to charWidths
........
  r42150 | drmccoy | 2009-07-06 05:58:09 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Reordering some methods
........
  r42153 | drmccoy | 2009-07-06 07:39:55 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Renaming the last occurences of "Collision" to "Hotspot"
........
  r42154 | drmccoy | 2009-07-06 07:40:20 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Adding some hotspot debug messages
........
  r42155 | drmccoy | 2009-07-06 07:40:51 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Added an enum for the hotspot states
........
  r42161 | drmccoy | 2009-07-06 11:41:29 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Adding more comments
........
  r42162 | dreammaster | 2009-07-06 12:46:59 +1000 (Mon, 06 Jul 2009) | 1 line
  
  Bugfix for node enabling/disabling, which was previously allowing the player to walk through closed doors and into the walls
........

Modified Paths:
--------------
    scummvm/branches/gsoc2009-16bit/Makefile
    scummvm/branches/gsoc2009-16bit/backends/midi/timidity.cpp
    scummvm/branches/gsoc2009-16bit/backends/platform/dc/dc.h
    scummvm/branches/gsoc2009-16bit/backends/platform/dc/display.cpp
    scummvm/branches/gsoc2009-16bit/backends/platform/dc/input.cpp
    scummvm/branches/gsoc2009-16bit/dists/msvc7/gob.vcproj
    scummvm/branches/gsoc2009-16bit/dists/msvc71/gob.vcproj
    scummvm/branches/gsoc2009-16bit/dists/msvc8/gob.vcproj
    scummvm/branches/gsoc2009-16bit/dists/msvc9/gob.vcproj
    scummvm/branches/gsoc2009-16bit/engines/cruise/ctp.cpp
    scummvm/branches/gsoc2009-16bit/engines/cruise/font.cpp
    scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/demos/demoplayer.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/draw.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/draw_v1.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/draw_v2.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/game.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/game.h
    scummvm/branches/gsoc2009-16bit/engines/gob/global.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/global.h
    scummvm/branches/gsoc2009-16bit/engines/gob/gob.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/gob.h
    scummvm/branches/gsoc2009-16bit/engines/gob/init.h
    scummvm/branches/gsoc2009-16bit/engines/gob/inter.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/inter.h
    scummvm/branches/gsoc2009-16bit/engines/gob/inter_bargon.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/inter_v1.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/inter_v2.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/inter_v6.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/module.mk
    scummvm/branches/gsoc2009-16bit/engines/gob/mult.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/script.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/script.h
    scummvm/branches/gsoc2009-16bit/engines/gob/sound/sound.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/util.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/util.h
    scummvm/branches/gsoc2009-16bit/engines/gob/video.h
    scummvm/branches/gsoc2009-16bit/engines/gob/videoplayer.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/videoplayer.h
    scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
    scummvm/branches/gsoc2009-16bit/engines/groovie/music.cpp
    scummvm/branches/gsoc2009-16bit/engines/groovie/music.h
    scummvm/branches/gsoc2009-16bit/engines/kyra/detection.cpp
    scummvm/branches/gsoc2009-16bit/engines/kyra/lol.cpp
    scummvm/branches/gsoc2009-16bit/engines/kyra/screen.cpp
    scummvm/branches/gsoc2009-16bit/engines/kyra/screen.h
    scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.cpp
    scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.h
    scummvm/branches/gsoc2009-16bit/engines/sci/console.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/console.h
    scummvm/branches/gsoc2009-16bit/engines/sci/detection.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/game.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/kernel.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/kernel.h
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/kgraphics.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/ksound.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/script.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/vm.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/engine/vm.h
    scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_driver.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/resource.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/resource.h
    scummvm/branches/gsoc2009-16bit/engines/sci/sci.cpp
    scummvm/branches/gsoc2009-16bit/engines/sci/sci.h
    scummvm/branches/gsoc2009-16bit/engines/sci/sfx/iterator.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/he/resource_he.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/script.cpp
    scummvm/branches/gsoc2009-16bit/gui/GuiManager.cpp
    scummvm/branches/gsoc2009-16bit/gui/GuiManager.h

Added Paths:
-----------
    scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.h
    scummvm/branches/gsoc2009-16bit/engines/gob/init_v6.cpp

Removed Paths:
-------------
    scummvm/branches/gsoc2009-16bit/engines/gob/game_fascin.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/game_v1.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/game_v2.cpp
    scummvm/branches/gsoc2009-16bit/engines/gob/game_v6.cpp

Property Changed:
----------------
    scummvm/branches/gsoc2009-16bit/


Property changes on: scummvm/branches/gsoc2009-16bit
___________________________________________________________________
Modified: svnmerge-integrated
   - /scummvm/trunk:1-42083 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/branches/gsoc2008-gui:1-31703
   + /scummvm/trunk:1-42162 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/branches/gsoc2008-gui:1-31703

Modified: scummvm/branches/gsoc2009-16bit/Makefile
===================================================================
--- scummvm/branches/gsoc2009-16bit/Makefile	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/Makefile	2009-07-06 06:34:40 UTC (rev 42165)
@@ -26,8 +26,13 @@
 # Enable even more warnings...
 CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align
 CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
-CXXFLAGS+= -Wmissing-format-attribute
 
+# Currently we disable this gcc flag, since it will also warn in cases,
+# where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
+# is not possible, thus it would fail compiliation with -Werror without
+# being helpful.
+#CXXFLAGS+= -Wmissing-format-attribute
+
 # Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
 CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
 

Modified: scummvm/branches/gsoc2009-16bit/backends/midi/timidity.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/midi/timidity.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/backends/midi/timidity.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -99,7 +99,7 @@
 	int	connect_to_server(const char* hostname, unsigned short tcp_port);
 
 	/* send command to the server; printf-like; returns reply string */
-	char	*timidity_ctl_command(const char *fmt, ...);
+	char	*timidity_ctl_command(const char *fmt, ...) GCC_PRINTF(2, 3);
 
 	/* timidity data socket-related stuff */
 	void	timidity_meta_seq(int p1, int p2, int p3);

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/dc/dc.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/dc/dc.h	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/dc/dc.h	2009-07-06 06:34:40 UTC (rev 42165)
@@ -194,7 +194,7 @@
   SoftKeyboard _softkbd;
 
   int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
-  int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll;
+  int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll, _last_screen_refresh;
   int _current_shake_pos, _screen_w, _screen_h;
   int _overlay_x, _overlay_y;
   unsigned char *_ms_buf;
@@ -220,11 +220,15 @@
   uint initSound();
   void checkSound();
 
+  void updateScreenTextures(void);
+  void updateScreenPolygons(void);
+  void maybeRefreshScreen(void);
   void drawMouse(int xdraw, int ydraw, int w, int h,
 		 unsigned char *buf, bool visible);
 
   void setScaling();
 
+
   Common::SaveFileManager *createSavefileManager();
 };
 

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/dc/display.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/dc/display.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/dc/display.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -285,11 +285,8 @@
   _current_shake_pos = shake_pos;
 }
 
-void OSystem_Dreamcast::updateScreen(void)
+void OSystem_Dreamcast::updateScreenTextures(void)
 {
-  struct polygon_list mypoly;
-  struct packed_colour_vertex_list myvertex;
-
   if (_screen_dirty) {
 
     _screen_buffer++;
@@ -328,7 +325,13 @@
 
     _overlay_dirty = false;
   }
+}
 
+void OSystem_Dreamcast::updateScreenPolygons(void)
+{
+  struct polygon_list mypoly;
+  struct packed_colour_vertex_list myvertex;
+
   // *((volatile unsigned int *)(void*)0xa05f8040) = 0x00ff00;
 
   mypoly.cmd =
@@ -448,8 +451,23 @@
   ta_commit_frame();
 
   // *((volatile unsigned int *)(void*)0xa05f8040) = 0x0;
+
+  _last_screen_refresh = Timer();
 }
 
+void OSystem_Dreamcast::updateScreen(void)
+{
+  updateScreenTextures();
+  updateScreenPolygons();
+}
+
+void OSystem_Dreamcast::maybeRefreshScreen(void)
+{
+  unsigned int t = Timer();
+  if((int)(t-_last_screen_refresh) > USEC_TO_TIMER(30000))
+    updateScreenPolygons();
+}
+
 void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h,
 				  unsigned char *buf, bool visible)
 {

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/dc/input.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/dc/input.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/dc/input.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -202,6 +202,8 @@
   if (((int)(t-_devpoll))>=0)
     _devpoll = t + USEC_TO_TIMER(17000);
 
+  maybeRefreshScreen();
+
   int mask = getimask();
   setimask(15);
   checkSound();

Modified: scummvm/branches/gsoc2009-16bit/dists/msvc7/gob.vcproj
===================================================================
--- scummvm/branches/gsoc2009-16bit/dists/msvc7/gob.vcproj	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/dists/msvc7/gob.vcproj	2009-07-06 06:34:40 UTC (rev 42165)
@@ -173,24 +173,6 @@
 			RelativePath="..\..\engines\gob\demos\batplayer.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\resources.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\resources.h">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.h">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.h">
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\dataio.cpp">
 		</File>
 		<File
@@ -230,24 +212,18 @@
 			RelativePath="..\..\engines\gob\driver_vga.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.cpp">
+			RelativePath="..\..\engines\gob\expression.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.h">
+			RelativePath="..\..\engines\gob\expression.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_fascin.cpp">
+			RelativePath="..\..\engines\gob\game.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v1.cpp">
+			RelativePath="..\..\engines\gob\game.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v2.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\game_v6.cpp">
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\global.cpp">
 		</File>
 		<File
@@ -281,6 +257,12 @@
 			RelativePath="..\..\engines\gob\helper.h">
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\hotspots.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\hotspots.h">
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\init.cpp">
 		</File>
 		<File
@@ -296,6 +278,9 @@
 			RelativePath="..\..\engines\gob\init_v3.cpp">
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\init_v6.cpp">
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\inter.cpp">
 		</File>
 		<File
@@ -359,58 +344,58 @@
 			RelativePath="..\..\engines\gob\palanim.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.cpp">
+			RelativePath="..\..\engines\gob\resources.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.h">
+			RelativePath="..\..\engines\gob\resources.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savefile.h">
+			RelativePath="..\..\engines\gob\save\saveconverter.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savefile.cpp">
+			RelativePath="..\..\engines\gob\save\saveconverter.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savehandler.h">
+			RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savehandler.cpp">
+			RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload.h">
+			RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload.cpp">
+			RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
+			RelativePath="..\..\engines\gob\save\savefile.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
+			RelativePath="..\..\engines\gob\save\savefile.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
+			RelativePath="..\..\engines\gob\save\savehandler.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
+			RelativePath="..\..\engines\gob\save\savehandler.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter.h">
+			RelativePath="..\..\engines\gob\save\saveload.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter.cpp">
+			RelativePath="..\..\engines\gob\save\saveload.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
 		</File>
 		<File
 			RelativePath="..\..\engines\gob\scenery.cpp">
@@ -431,6 +416,18 @@
 			RelativePath="..\..\engines\gob\demos\scnplayer.h">
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\script.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\script.h">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.h">
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\util.cpp">
 		</File>
 		<File

Modified: scummvm/branches/gsoc2009-16bit/dists/msvc71/gob.vcproj
===================================================================
--- scummvm/branches/gsoc2009-16bit/dists/msvc71/gob.vcproj	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/dists/msvc71/gob.vcproj	2009-07-06 06:34:40 UTC (rev 42165)
@@ -187,24 +187,6 @@
 			RelativePath="..\..\engines\gob\demos\batplayer.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\resources.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\resources.h">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.h">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.h">
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\dataio.cpp">
 		</File>
 		<File
@@ -244,24 +226,18 @@
 			RelativePath="..\..\engines\gob\driver_vga.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.cpp">
+			RelativePath="..\..\engines\gob\expression.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.h">
+			RelativePath="..\..\engines\gob\expression.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_fascin.cpp">
+			RelativePath="..\..\engines\gob\game.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v1.cpp">
+			RelativePath="..\..\engines\gob\game.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v2.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\game_v6.cpp">
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\global.cpp">
 		</File>
 		<File
@@ -295,6 +271,12 @@
 			RelativePath="..\..\engines\gob\helper.h">
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\hotspots.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\hotspots.h">
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\init.cpp">
 		</File>
 		<File
@@ -310,6 +292,9 @@
 			RelativePath="..\..\engines\gob\init_v3.cpp">
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\init_v6.cpp">
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\inter.cpp">
 		</File>
 		<File
@@ -373,58 +358,58 @@
 			RelativePath="..\..\engines\gob\palanim.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.cpp">
+			RelativePath="..\..\engines\gob\resources.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.h">
+			RelativePath="..\..\engines\gob\resources.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savefile.h">
+			RelativePath="..\..\engines\gob\save\saveconverter.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savefile.cpp">
+			RelativePath="..\..\engines\gob\save\saveconverter.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savehandler.h">
+			RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savehandler.cpp">
+			RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload.h">
+			RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload.cpp">
+			RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
+			RelativePath="..\..\engines\gob\save\savefile.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
+			RelativePath="..\..\engines\gob\save\savefile.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
+			RelativePath="..\..\engines\gob\save\savehandler.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
+			RelativePath="..\..\engines\gob\save\savehandler.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter.h">
+			RelativePath="..\..\engines\gob\save\saveload.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter.cpp">
+			RelativePath="..\..\engines\gob\save\saveload.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp">
+			RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
 		</File>
 		<File
 			RelativePath="..\..\engines\gob\scenery.cpp">
@@ -445,6 +430,18 @@
 			RelativePath="..\..\engines\gob\demos\scnplayer.h">
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\script.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\script.h">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.h">
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\util.cpp">
 		</File>
 		<File

Modified: scummvm/branches/gsoc2009-16bit/dists/msvc8/gob.vcproj
===================================================================
--- scummvm/branches/gsoc2009-16bit/dists/msvc8/gob.vcproj	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/dists/msvc8/gob.vcproj	2009-07-06 06:34:40 UTC (rev 42165)
@@ -259,30 +259,6 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\resources.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\resources.h"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.h"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.h"
-			>
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\dataio.cpp"
 			>
 		</File>
@@ -335,30 +311,22 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.cpp"
+			RelativePath="..\..\engines\gob\expression.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.h"
+			RelativePath="..\..\engines\gob\expression.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_fascin.cpp"
+			RelativePath="..\..\engines\gob\game.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v1.cpp"
+			RelativePath="..\..\engines\gob\game.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v2.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\game_v6.cpp"
-			>
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\global.cpp"
 			>
 		</File>
@@ -403,6 +371,14 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\hotspots.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\hotspots.h"
+			>
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\init.cpp"
 			>
 		</File>
@@ -423,6 +399,10 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\init_v6.cpp"
+			>
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\inter.cpp"
 			>
 		</File>
@@ -507,11 +487,11 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.cpp"
+			RelativePath="..\..\engines\gob\resources.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.h"
+			RelativePath="..\..\engines\gob\resources.h"
 			>
 		</File>
 		<File
@@ -603,6 +583,22 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\script.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\script.h"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.h"
+			>
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\util.cpp"
 			>
 		</File>

Modified: scummvm/branches/gsoc2009-16bit/dists/msvc9/gob.vcproj
===================================================================
--- scummvm/branches/gsoc2009-16bit/dists/msvc9/gob.vcproj	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/dists/msvc9/gob.vcproj	2009-07-06 06:34:40 UTC (rev 42165)
@@ -260,30 +260,6 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\resources.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\resources.h"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\totfile.h"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\script.h"
-			>
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\dataio.cpp"
 			>
 		</File>
@@ -336,30 +312,22 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.cpp"
+			RelativePath="..\..\engines\gob\expression.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game.h"
+			RelativePath="..\..\engines\gob\expression.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_fascin.cpp"
+			RelativePath="..\..\engines\gob\game.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v1.cpp"
+			RelativePath="..\..\engines\gob\game.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\game_v2.cpp"
-			>
-		</File>
-		<File
-			RelativePath="..\..\engines\gob\game_v6.cpp"
-			>
-		</File>
-		<File
 			RelativePath="..\..\engines\gob\global.cpp"
 			>
 		</File>
@@ -404,6 +372,14 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\hotspots.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\hotspots.h"
+			>
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\init.cpp"
 			>
 		</File>
@@ -424,6 +400,10 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\init_v6.cpp"
+			>
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\inter.cpp"
 			>
 		</File>
@@ -508,75 +488,75 @@
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.cpp"
+			RelativePath="..\..\engines\gob\resources.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\expression.h"
+			RelativePath="..\..\engines\gob\resources.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savefile.h"
+			RelativePath="..\..\engines\gob\save\saveconverter.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savefile.cpp"
+			RelativePath="..\..\engines\gob\save\saveconverter.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savehandler.h"
+			RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\savehandler.cpp"
+			RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload.h"
+			RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload.cpp"
+			RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v2.cpp"
+			RelativePath="..\..\engines\gob\save\savefile.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v3.cpp"
+			RelativePath="..\..\engines\gob\save\savefile.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v4.cpp"
+			RelativePath="..\..\engines\gob\save\savehandler.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveload_v6.cpp"
+			RelativePath="..\..\engines\gob\save\savehandler.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter.h"
+			RelativePath="..\..\engines\gob\save\saveload.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter.cpp"
+			RelativePath="..\..\engines\gob\save\saveload.h"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp"
+			RelativePath="..\..\engines\gob\save\saveload_v2.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp"
+			RelativePath="..\..\engines\gob\save\saveload_v3.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp"
+			RelativePath="..\..\engines\gob\save\saveload_v4.cpp"
 			>
 		</File>
 		<File
-			RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp"
+			RelativePath="..\..\engines\gob\save\saveload_v6.cpp"
 			>
 		</File>
 		<File
@@ -604,6 +584,22 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\engines\gob\script.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\script.h"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\gob\totfile.h"
+			>
+		</File>
+		<File
 			RelativePath="..\..\engines\gob\util.cpp"
 			>
 		</File>

Modified: scummvm/branches/gsoc2009-16bit/engines/cruise/ctp.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cruise/ctp.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/cruise/ctp.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -209,9 +209,9 @@
 	int oldState = walkboxState[nodeIdx];
 
 	if (nodeState == -1)
-		return
+		return oldState;
 
-		    walkboxState[nodeIdx] = nodeState;
+	walkboxState[nodeIdx] = nodeState;
 
 	return oldState;
 }

Modified: scummvm/branches/gsoc2009-16bit/engines/cruise/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cruise/font.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/cruise/font.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -242,7 +242,7 @@
 			if (character == '|' || !character) {
 				finish = 1;
 			} else {
-				if (charData) {
+				if (charData >= 0) {
 					if (pixelCount + wordSpacingWidth +
 							(int16)fontData[charData].charWidth >= inRightBorder_X) {
 						finish = 1;

Modified: scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -828,7 +828,7 @@
 }
 
 int16 Op_LoadCt(void) {
-	return initCt((char*)popPtr());
+	return initCt((const char *)popPtr());
 }
 
 int16 Op_EndAnim(void) {

Modified: scummvm/branches/gsoc2009-16bit/engines/gob/demos/demoplayer.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/demos/demoplayer.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/demos/demoplayer.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -222,7 +222,7 @@
 			int16 key;
 			bool end = false;
 			while (_vm->_util->checkKey(key))
-				if (key == 0x011B)
+				if (key == kKeyEscape)
 					end = true;
 			if (end)
 				break;

Modified: scummvm/branches/gsoc2009-16bit/engines/gob/draw.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/draw.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/draw.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -360,9 +360,9 @@
 
 	} else {
 
-		if (_fonts[fontIndex]->extraData)
+		if (_fonts[fontIndex]->charWidths)
 			while (*str != 0)
-				len += *(_fonts[fontIndex]->extraData + (*str++ - _fonts[fontIndex]->startItem));
+				len += *(_fonts[fontIndex]->charWidths + (*str++ - _fonts[fontIndex]->startItem));
 		else
 			len = (strlen(str) * _fonts[fontIndex]->itemWidth);
 
@@ -376,10 +376,10 @@
 
 	while (*str != '\0') {
 		_vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest);
-		if (!font->extraData)
+		if (!font->charWidths)
 			x += font->itemWidth;
 		else
-			x += *(font->extraData + (*str - font->startItem));
+			x += *(font->charWidths + (*str - font->startItem));
 		str++;
 	}
 }
@@ -415,12 +415,12 @@
 	_fontIndex = fontIndex;
 	_frontColor = color;
 	_textToPrint = str;
-	if (_fonts[fontIndex]->extraData != 0) {
-		byte *data = _fonts[fontIndex]->extraData;
+	if (_fonts[fontIndex]->charWidths != 0) {
+		uint8 *widths = _fonts[fontIndex]->charWidths;
 		int length = strlen(str);
 
 		for (int i = 0; i < length; i++)
-			width += *(data + (str[i] - _fonts[_fontIndex]->startItem));
+			width += *(widths + (str[i] - _fonts[_fontIndex]->startItem));
 	}
 	else
 		width = strlen(str) * _fonts[fontIndex]->itemWidth;

Modified: scummvm/branches/gsoc2009-16bit/engines/gob/draw_v1.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/draw_v1.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/draw_v1.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -33,6 +33,7 @@
 #include "gob/util.h"
 #include "gob/game.h"
 #include "gob/resources.h"
+#include "gob/hotspots.h"
 #include "gob/scenery.h"
 #include "gob/inter.h"
 #include "gob/sound/sound.h"
@@ -44,6 +45,12 @@
 
 void Draw_v1::initScreen() {
 	_backSurface = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, 0);
+	_frontSurface = _vm->_global->_primarySurfDesc;
+
+	_cursorSprites =
+		_vm->_video->initSurfDesc(_vm->_global->_videoMode, 32, 16, 2);
+	_scummvmCursor =
+		_vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR);
 }
 
 void Draw_v1::closeScreen() {
@@ -58,7 +65,6 @@
 }
 
 void Draw_v1::animateCursor(int16 cursor) {
-	Game::Collision *ptr;
 	int16 cursorIndex = cursor;
 	int16 newX = 0, newY = 0;
 	uint16 hotspotX = 0, hotspotY = 0;
@@ -66,29 +72,10 @@
 	_showCursor = 2;
 
 	if (cursorIndex == -1) {
-		cursorIndex = 0;
-		for (ptr = _vm->_game->_collisionAreas; ptr->left != 0xFFFF; ptr++) {
-			if (ptr->flags & 0xFFF0)
-				continue;
+		cursorIndex =
+			_vm->_game->_hotspots->findCursor(_vm->_global->_inter_mouseX,
+			                                  _vm->_global->_inter_mouseY);
 
-			if (ptr->left > _vm->_global->_inter_mouseX)
-				continue;
-
-			if (ptr->right < _vm->_global->_inter_mouseX)
-				continue;
-
-			if (ptr->top > _vm->_global->_inter_mouseY)
-				continue;
-
-			if (ptr->bottom < _vm->_global->_inter_mouseY)
-				continue;
-
-			if ((ptr->flags & 0xF) < 3)
-				cursorIndex = 1;
-			else
-				cursorIndex = 3;
-			break;
-		}
 		if (_cursorAnimLow[cursorIndex] == -1)
 			cursorIndex = 1;
 	}
@@ -317,7 +304,7 @@
 	_renderFlags = savedFlags;
 
 	if (_renderFlags & RENDERFLAG_COLLISIONS)
-		_vm->_game->checkCollisions(0, 0, 0, 0);
+		_vm->_game->_hotspots->check(0, 0);
 
 	if ((_renderFlags & RENDERFLAG_CAPTUREPOP) && *_vm->_scenery->_pCaptureCounter != 0) {
 		(*_vm->_scenery->_pCaptureCounter)--;

Modified: scummvm/branches/gsoc2009-16bit/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/draw_v2.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/draw_v2.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -34,6 +34,7 @@
 #include "gob/game.h"
 #include "gob/script.h"
 #include "gob/resources.h"
+#include "gob/hotspots.h"
 #include "gob/scenery.h"
 #include "gob/inter.h"
 #include "gob/video.h"
@@ -82,7 +83,6 @@
 }
 
 void Draw_v2::animateCursor(int16 cursor) {
-	Game::Collision *ptr;
 	int16 cursorIndex = cursor;
 	int16 newX = 0, newY = 0;
 	uint16 hotspotX = 0, hotspotY = 0;
@@ -91,32 +91,10 @@
 
 	// .-- _draw_animateCursorSUB1 ---
 	if (cursorIndex == -1) {
-		cursorIndex = 0;
-		for (ptr = _vm->_game->_collisionAreas; ptr->left != 0xFFFF; ptr++) {
-			if ((ptr->flags & 0xF00) || (ptr->id & 0x4000))
-				continue;
+		cursorIndex =
+			_vm->_game->_hotspots->findCursor(_vm->_global->_inter_mouseX,
+			                                  _vm->_global->_inter_mouseY);
 
-			if (ptr->left > _vm->_global->_inter_mouseX)
-				continue;
-
-			if (ptr->right < _vm->_global->_inter_mouseX)
-				continue;
-
-			if (ptr->top > _vm->_global->_inter_mouseY)
-				continue;
-
-			if (ptr->bottom < _vm->_global->_inter_mouseY)
-				continue;
-
-			if ((ptr->flags & 0xF000) == 0) {
-				if ((ptr->flags & 0xF) >= 3) {
-					cursorIndex = 3;
-					break;
-				} else if (((ptr->flags & 0xF0) != 0x10) && (cursorIndex == 0))
-					cursorIndex = 1;
-			} else if (cursorIndex == 0)
-				cursorIndex = (ptr->flags >> 12) & 0xF;
-		}
 		if (_cursorAnimLow[cursorIndex] == -1)
 			cursorIndex = 1;
 	}
@@ -407,8 +385,8 @@
 				adjustCoords(2, &rectRight, &rectBottom);
 
 				if (colId != -1)
-					_vm->_game->addNewCollision(colId + 0xD000, rectLeft, rectTop,
-							rectRight, rectBottom, 2, 0, 0, 0);
+					_vm->_game->_hotspots->add(colId + 0xD000, rectLeft, rectTop,
+							rectRight, rectBottom, (uint16) Hotspots::kTypeClick, 0, 0, 0, 0);
 
 				if (_needAdjust != 2)
 					printTextCentered(colCmd & 0x0F, rectLeft + 4, rectTop + 4,
@@ -501,8 +479,8 @@
 				rectBottom = destY + (int16)READ_LE_UINT16(ptr + 6);
 				adjustCoords(2, &rectLeft, &rectTop);
 				adjustCoords(2, &rectRight, &rectBottom);
-				_vm->_game->addNewCollision(colId + 0x0D000, rectLeft, rectTop,
-						rectRight, rectBottom, 2, 0, 0, 0);
+				_vm->_game->_hotspots->add(colId + 0x0D000, rectLeft, rectTop,
+						rectRight, rectBottom, (uint16) Hotspots::kTypeClick, 0, 0, 0, 0);
 				ptr += 8;
 			}
 			break;
@@ -604,7 +582,7 @@
 	if (!(_renderFlags & RENDERFLAG_COLLISIONS))
 		return;
 
-	_vm->_game->checkCollisions(0, 0, 0, 0);
+	_vm->_game->_hotspots->check(0, 0);
 
 	if (*_vm->_scenery->_pCaptureCounter != 0) {
 		(*_vm->_scenery->_pCaptureCounter)--;
@@ -784,7 +762,7 @@
 
 		if ((_fontIndex >= 4) || (_fontToSprite[_fontIndex].sprite == -1)) {
 
-			if (!_fonts[_fontIndex]->extraData) {
+			if (!_fonts[_fontIndex]->charWidths) {
 				if (((int8) _textToPrint[0]) == -1) {
 					_vm->validateLanguage();
 
@@ -807,7 +785,7 @@
 						_vm->_video->drawLetter(_textToPrint[i], _destSpriteX,
 								_destSpriteY, _fonts[_fontIndex], _transparency,
 								_frontColor, _backColor, *_spritesArray[_destSurface]);
-						_destSpriteX += *(_fonts[_fontIndex]->extraData +
+						_destSpriteX += *(_fonts[_fontIndex]->charWidths +
 								(_textToPrint[i] - _fonts[_fontIndex]->startItem));
 					}
 					else

Modified: scummvm/branches/gsoc2009-16bit/engines/gob/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/game.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/game.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -29,14 +29,15 @@
 #include "gob/game.h"
 #include "gob/helper.h"
 #include "gob/global.h"
-#include "gob/util.h"
 #include "gob/dataio.h"
 #include "gob/variables.h"
 #include "gob/script.h"
 #include "gob/resources.h"
+#include "gob/hotspots.h"
 #include "gob/inter.h"
 #include "gob/draw.h"
 #include "gob/mult.h"
+#include "gob/scenery.h"
 #include "gob/videoplayer.h"
 #include "gob/sound/sound.h"
 
@@ -170,30 +171,14 @@
 
 
 Game::Game(GobEngine *vm) : _vm(vm) {
-	_collisionAreas = 0;
-	_shouldPushColls = 0;
-
 	_captureCount = 0;
 
-	_collStackSize = 0;
-
-	for (int i = 0; i < 5; i++) {
-		_collStack[i] = 0;
-		_collStackElemSizes[i] = 0;
-	}
-
 	_curTotFile[0] = 0;
 	_totToLoad[0] = 0;
 
 	_startTimeKey = 0;
-	_mouseButtons = 0;
+	_mouseButtons = kMouseButtonsNone;
 
-	_lastCollKey = 0;
-	_lastCollAreaIndex = 0;
-	_lastCollId = 0;
-
-	_activeCollResId = 0;
-	_activeCollIndex = 0;
 	_handleMouse = 0;
 	_forceHandleMouse = 0;
 	_menuLevel = 0;
@@ -201,10 +186,7 @@
 	_preventScroll = false;
 	_scrollHandleMouse = false;
 
-	_noCd = false;
-
 	_tempStr[0] = 0;
-	_collStr[0] = 0;
 
 	_numEnvironments = 0;
 	_curEnvironment = 0;
@@ -212,21 +194,183 @@
 	_environments = new Environments(_vm);
 	_script       = new Script(_vm);
 	_resources    = new Resources(_vm);
+	_hotspots     = new Hotspots(_vm);
 }
 
 Game::~Game() {
 	delete _environments;
 	delete _script;
 	delete _resources;
+	delete _hotspots;
 }
 
-void Game::freeCollision(int16 id) {
-	for (int i = 0; i < 250; i++) {
-		if (_collisionAreas[i].id == id)
-			_collisionAreas[i].left = 0xFFFF;
+void Game::prepareStart() {
+	_vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2;
+	_vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1;
+	_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
+
+	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+
+	_vm->_draw->initScreen();
+	_vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0,
+			_vm->_video->_surfWidth - 1, _vm->_video->_surfHeight - 1, 1);
+
+	_vm->_util->setMousePos(152, 92);
+	_vm->_draw->_cursorX = _vm->_global->_inter_mouseX = 152;
+	_vm->_draw->_cursorY = _vm->_global->_inter_mouseY = 92;
+
+	_vm->_draw->_invalidatedCount = 0;
+	_vm->_draw->_noInvalidated = true;
+	_vm->_draw->_applyPal = false;
+	_vm->_draw->_paletteCleared = false;
+	_vm->_draw->_cursorWidth = 16;
+	_vm->_draw->_cursorHeight = 16;
+	_vm->_draw->_transparentCursor = 1;
+
+	for (int i = 0; i < 40; i++) {
+		_vm->_draw->_cursorAnimLow[i] = -1;
+		_vm->_draw->_cursorAnimDelays[i] = 0;
+		_vm->_draw->_cursorAnimHigh[i] = 0;
 	}
+
+	_vm->_draw->_renderFlags = 0;
+	_vm->_draw->_backDeltaX = 0;
+	_vm->_draw->_backDeltaY = 0;
+
+	_startTimeKey = _vm->_util->getTimeKey();
 }
 
+void Game::playTot(int16 skipPlay) {
+	char savedTotName[20];
+	int16 *oldCaptureCounter;
+	int16 *oldBreakFrom;
+	int16 *oldNestLevel;
+	int16 _captureCounter;
+	int16 breakFrom;
+	int16 nestLevel;
+
+	oldNestLevel = _vm->_inter->_nestLevel;
+	oldBreakFrom = _vm->_inter->_breakFromLevel;
+	oldCaptureCounter = _vm->_scenery->_pCaptureCounter;
+
+	_script->push();
+
+	_vm->_inter->_nestLevel = &nestLevel;
+	_vm->_inter->_breakFromLevel = &breakFrom;
+	_vm->_scenery->_pCaptureCounter = &_captureCounter;
+	strcpy(savedTotName, _curTotFile);
+
+	if (skipPlay <= 0) {
+		while (!_vm->shouldQuit()) {
+			if (_vm->_inter->_variables)
+				_vm->_draw->animateCursor(4);
+
+			if (skipPlay != -1) {
+				_vm->_inter->initControlVars(1);
+
+				for (int i = 0; i < 4; i++) {
+					_vm->_draw->_fontToSprite[i].sprite = -1;
+					_vm->_draw->_fontToSprite[i].base = -1;
+					_vm->_draw->_fontToSprite[i].width = -1;
+					_vm->_draw->_fontToSprite[i].height = -1;
+				}
+
+				_vm->_mult->initAll();
+				_vm->_mult->zeroMultData();
+
+				_vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface;
+				_vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface;
+				_vm->_draw->_cursorSpritesBack = _vm->_draw->_cursorSprites;
+			} else
+				_vm->_inter->initControlVars(0);
+
+			_vm->_draw->_cursorHotspotXVar = -1;
+			_totToLoad[0] = 0;
+
+			if ((_curTotFile[0] == 0) && (!_script->isLoaded()))
+				break;
+
+			if (skipPlay == -2) {
+				_vm->_vidPlayer->primaryClose();
+				skipPlay = 0;
+			}
+
+			if (!_script->load(_curTotFile)) {
+				_vm->_draw->blitCursor();
+				_vm->_inter->_terminate = 2;
+				break;
+			}
+
+			_resources->load(_curTotFile);
+
+			_vm->_global->_inter_animDataSize = _script->getAnimDataSize();
+			if (!_vm->_inter->_variables)
+				_vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
+
+			_script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart));
+
+			_vm->_inter->renewTimeInVars();
+
+			WRITE_VAR(13, _vm->_global->_useMouse);
+			WRITE_VAR(14, _vm->_global->_soundFlags);
+			WRITE_VAR(15, _vm->_global->_fakeVideoMode);
+			WRITE_VAR(16, _vm->_global->_language);
+
+			_vm->_inter->callSub(2);
+
+			if (_totToLoad[0] != 0)
+				_vm->_inter->_terminate = 0;
+
+			_vm->_draw->blitInvalidated();
+
+			_script->unload();
+
+			_resources->unload();
+
+			for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
+				capturePop(0);
+
+			if (skipPlay != -1) {
+				_vm->_goblin->freeObjects();
+
+				_vm->_sound->blasterStop(0);
+
+				for (int i = 0; i < Sound::kSoundsCount; i++) {
+					SoundDesc *sound = _vm->_sound->sampleGetBySlot(i);
+
+					if (sound &&
+					   ((sound->getType() == SOUND_SND) || (sound->getType() == SOUND_WAV)))
+						_vm->_sound->sampleFree(sound);
+				}
+			}
+
+			if (_totToLoad[0] == 0)
+				break;
+
+			strcpy(_curTotFile, _totToLoad);
+		}
+	} else {
+		_vm->_inter->initControlVars(0);
+		_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
+		_script->seek(_script->getFunctionOffset(skipPlay + 1));
+
+		_menuLevel++;
+		_vm->_inter->callSub(2);
+		_menuLevel--;
+
+		if (_vm->_inter->_terminate != 0)
+			_vm->_inter->_terminate = 2;
+	}
+
+	strcpy(_curTotFile, savedTotName);
+
+	_vm->_inter->_nestLevel = oldNestLevel;
+	_vm->_inter->_breakFromLevel = oldBreakFrom;
+	_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
+
+	_script->pop();
+}
+
 void Game::capturePush(int16 left, int16 top, int16 width, int16 height) {
 	int16 right;
 
@@ -349,7 +493,7 @@
 }
 
 int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY,
-		int16 *pButtons, char handleMouse) {
+		MouseButtons *pButtons, char handleMouse) {
 
 	_vm->_util->processInput(true);
 
@@ -373,28 +517,17 @@
 	if (pMouseX && pMouseY && pButtons) {
 		_vm->_util->getMouseState(pMouseX, pMouseY, pButtons);
 
-		if (*pButtons == 3)
-			*pButtons = 0;
+		if (*pButtons == kMouseButtonsBoth)
+			*pButtons = kMouseButtonsNone;
 	}
 
 	return _vm->_util->checkKey();
 }
 
-int16 Game::adjustKey(int16 key) {
-	if (key <= 0x60 || key >= 0x7B)
-		return key;
-
-	return key - 0x20;
-}
-
-void Game::start(void) {
-	_collisionAreas = new Collision[250];
-	memset(_collisionAreas, 0, 250 * sizeof(Collision));
-
+void Game::start() {
 	prepareStart();
 	playTot(-2);
 
-	delete[] _collisionAreas;
 	_vm->_draw->closeScreen();
 
 	for (int i = 0; i < SPRITES_COUNT; i++)
@@ -406,6 +539,9 @@
 void Game::totSub(int8 flags, const char *newTotFile) {
 	int8 curBackupPos;
 
+	if ((flags == 16) || (flags == 17))
+		warning("Urban Stub: Game::totSub(), flags == %d", flags);
+
 	if (_numEnvironments >= Environments::kEnvironmentCount)
 		return;
 
@@ -417,13 +553,14 @@
 
 	_script = new Script(_vm);
 	_resources = new Resources(_vm);
+
+	if (flags & 0x80)
+		warning("Urban Stub: Game::totSub(), flags & 0x80");
+
 	if (flags & 1)
 		_vm->_inter->_variables = 0;
 
 	strncpy0(_curTotFile, newTotFile, 9);
-//	if (_vm->getGameType() == kGameTypeGeisha)
-//		strcat(_curTotFile, ".0OT");
-//	else
 	strcat(_curTotFile, ".TOT");
 
 	if (_vm->_inter->_terminate != 0) {
@@ -431,7 +568,7 @@
 		return;
 	}
 
-	pushCollisions(0);
+	_hotspots->push(0, true);
 
 	if (flags & 2)
 		playTot(-1);
@@ -441,7 +578,8 @@
 	if (_vm->_inter->_terminate != 2)
 		_vm->_inter->_terminate = 0;
 
-	popCollisions();
+	_hotspots->clear();
+	_hotspots->pop();
 
 	if ((flags & 1) && _vm->_inter->_variables) {
 		_vm->_inter->delocateVars();
@@ -489,13 +627,13 @@
 		return;
 	}
 
-	pushCollisions(0);
+	_hotspots->push(0, true);
 	playTot(skipPlay);
 
 	if (_vm->_inter->_terminate != 2)
 		_vm->_inter->_terminate = 0;
 
-	popCollisions();
+	_hotspots->pop();
 
 	clearUnusedEnvironment();
 
@@ -504,87 +642,6 @@
 	_environments->get(_curEnvironment);
 }
 
-void Game::setCollisions(byte arg_0) {
-	uint16 left;
-	uint16 top;
-	uint16 width;
-	uint16 height;
-	Collision *collArea;
-
-	for (collArea = _collisionAreas; collArea->left != 0xFFFF; collArea++) {
-		if (((collArea->id & 0xC000) != 0x8000) || (collArea->funcSub == 0))
-			continue;
-
-		_script->call(collArea->funcSub);
-
-		left = _script->readValExpr();
-		top = _script->readValExpr();
-		width = _script->readValExpr();
-		height = _script->readValExpr();
-		if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) &&
-				(left != 0xFFFF)) {
-			left += _vm->_draw->_backDeltaX;
-			top += _vm->_draw->_backDeltaY;
-		}
-		if (_vm->_draw->_needAdjust != 2) {
-			_vm->_draw->adjustCoords(0, &left, &top);
-			if ((collArea->flags & 0x0F) < 3)
-				_vm->_draw->adjustCoords(2, &width, &height);
-			else {
-				height &= 0xFFFE;
-				_vm->_draw->adjustCoords(2, 0, &height);
-			}
-		}
-		collArea->left = left;
-		collArea->top = top;
-		collArea->right = left + width - 1;
-		collArea->bottom = top + height - 1;
-
-		_script->pop();
-	}
-}
-
-void Game::collSub(uint16 offset) {
-	int16 collStackSize;
-
-	_script->call(offset);
-
-	_shouldPushColls = 1;
-	collStackSize = _collStackSize;
-
-	_vm->_inter->funcBlock(0);
-
-	if (collStackSize != _collStackSize)
-		popCollisions();
-
-	_shouldPushColls = 0;
-
-	_script->pop();
-
-	setCollisions();
-}
-
-void Game::collAreaSub(int16 index, int8 enter) {
-	uint16 collId;
-
-	collId = _collisionAreas[index].id & 0xF000;
-
-	if ((collId == 0xA000) || (collId == 0x9000)) {
-		if (enter == 0)
-			WRITE_VAR(17, _collisionAreas[index].id & 0x0FFF);
-		else
-			WRITE_VAR(17, -(_collisionAreas[index].id & 0x0FFF));
-	}
-
-	if (enter != 0) {
-		if (_collisionAreas[index].funcEnter != 0)
-			collSub(_collisionAreas[index].funcEnter);
-	} else {
-		if (_collisionAreas[index].funcLeave != 0)
-			collSub(_collisionAreas[index].funcLeave);
-	}
-}
-
 void Game::clearUnusedEnvironment() {
 	if (!_environments->has(_script)) {
 		delete _script;
@@ -594,7 +651,6 @@
 		delete _resources;
 		_resources = 0;
 	}
-
 }
 
 } // End of namespace Gob

Modified: scummvm/branches/gsoc2009-16bit/engines/gob/game.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/game.h	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/game.h	2009-07-06 06:34:40 UTC (rev 42165)
@@ -26,11 +26,14 @@
 #ifndef GOB_GAME_H
 #define GOB_GAME_H
 
+#include "gob/util.h"
+
 namespace Gob {
 
 class Script;
 class Resources;
 class Variables;
+class Hotspots;
 
 class Environments {
 public:
@@ -67,53 +70,30 @@
 
 class Game {
 public:
-
-#include "common/pack-start.h"	// START STRUCT PACKING
-
-	struct Collision {
-		int16 id;
-		uint16 left;
-		uint16 top;
-		uint16 right;
-		uint16 bottom;
-		int16 flags;
-		int16 key;
-		uint16 funcEnter;
-		uint16 funcLeave;
-		uint16 funcSub;
-		Script *script;
-	} PACKED_STRUCT;
-
-	struct InputDesc {
-		int16 fontIndex;
-		int16 backColor;
-		int16 frontColor;
-		byte *ptr;
-	} PACKED_STRUCT;
-
-#include "common/pack-end.h"	// END STRUCT PACKING
-
-	Collision *_collisionAreas;
-	Collision *_collStack[5];
-
-	Script *_script;
+	Script    *_script;
 	Resources *_resources;
+	Hotspots  *_hotspots;
 
 	char _curTotFile[14];
 	char _totToLoad[20];
 
 	int32 _startTimeKey;
-	int16 _mouseButtons;
+	MouseButtons _mouseButtons;
 
 	bool _noScroll;
 	bool _preventScroll;
 	bool _scrollHandleMouse;
 
-	bool _noCd;
+	byte _handleMouse;
+	char _forceHandleMouse;
 
 	Game(GobEngine *vm);
 	virtual ~Game();
 
+	void prepareStart();
+
+	void playTot(int16 skipPlay);
+
 	void capturePush(int16 left, int16 top, int16 width, int16 height);
 	void capturePop(char doDraw);
 
@@ -122,60 +102,21 @@
 	void evaluateScroll(int16 x, int16 y);
 
 	int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0,
-			int16 *pButtons = 0, char handleMouse = 0);
-	void start(void);
+			MouseButtons *pButtons = 0, char handleMouse = 0);
+	void start();
 
-	virtual void totSub(int8 flags, const char *newTotFile);
-	virtual void switchTotSub(int16 index, int16 skipPlay);
+	void totSub(int8 flags, const char *newTotFile);
+	void switchTotSub(int16 index, int16 skipPlay);
 
-	void freeCollision(int16 id);
-
-	virtual void playTot(int16 skipPlay) = 0;
-
-	virtual void clearCollisions(void) = 0;
-	virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
-			uint16 right, uint16 bottom, int16 flags, int16 key,
-			uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0) = 0;
-	virtual void collisionsBlock(void) = 0;
-	virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
-			InputDesc *inpDesc, int16 *collResId,
-			int16 *collIndex, bool mono = true) = 0;
-	virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
-			int16 backColor, int16 frontColor, char *str, int16 fontIndex,
-			char inpType, int16 *pTotTime, int16 *collResId,
-			int16 *collIndex, bool mono = true) = 0;
-	virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
-			int16 *pResId, int16 *pResIndex) = 0;
-
-	virtual void prepareStart(void) = 0;
-
-	virtual void pushCollisions(char all) = 0;
-	virtual void popCollisions(void) = 0;
-
 protected:
-	int16 _lastCollKey;
-	int16 _lastCollAreaIndex;
-	int16 _lastCollId;
-
-	int16 _activeCollResId;
-	int16 _activeCollIndex;
-	byte _handleMouse;
-	char _forceHandleMouse;
 	uint32 _menuLevel;
 
 	char _tempStr[256];
 
-	int16 _collStackSize;
-	int16 _collStackElemSizes[5];
-
-	char _shouldPushColls;
-
 	// Capture
 	Common::Rect _captureStack[20];
 	int16 _captureCount;
 
-	char _collStr[256];
-
 	// For totSub()
 	int8 _curEnvironment;
 	int8 _numEnvironments;
@@ -183,129 +124,9 @@
 
 	GobEngine *_vm;
 
-	virtual int16 adjustKey(int16 key);
-
-	void collAreaSub(int16 index, int8 enter);
-
-	virtual void setCollisions(byte arg_0 = 1);
-	virtual void collSub(uint16 offset);
-
-	virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex) = 0;
-
 	void clearUnusedEnvironment();
 };
 
-class Game_v1 : public Game {
-public:
-	virtual void playTot(int16 skipPlay);
-
-	virtual void clearCollisions(void);
-	virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
-			uint16 right, uint16 bottom, int16 flags, int16 key,
-			uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
-	virtual void collisionsBlock(void);
-	virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
-			InputDesc *inpDesc, int16 *collResId,
-			int16 *collIndex, bool mono = true);
-	virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
-			int16 backColor, int16 frontColor, char *str, int16 fontIndex,
-			char inpType, int16 *pTotTime, int16 *collResId,
-			int16 *collIndex, bool mono = true);
-	virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
-			int16 *pResId, int16 *pResIndex);
-
-	virtual void prepareStart(void);
-
-	virtual void pushCollisions(char all);
-	virtual void popCollisions(void);
-
-	Game_v1(GobEngine *vm);
-	virtual ~Game_v1() {}
-
-protected:
-	virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
-};
-
-class Game_v2 : public Game_v1 {
-public:
-	virtual void playTot(int16 skipPlay);
-
-	virtual void clearCollisions(void);
-	virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
-			uint16 right, uint16 bottom, int16 flags, int16 key,
-			uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
-	virtual void collisionsBlock(void);
-	virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
-			InputDesc *inpDesc, int16 *collResId,
-			int16 *collIndex, bool mono = true);
-	virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
-			int16 backColor, int16 frontColor, char *str, int16 fontIndex,
-			char inpType, int16 *pTotTime, int16 *collResId,
-			int16 *collIndex, bool mono = true);
-	virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
-			int16 *pResId, int16 *pResIndex);
-
-	virtual void prepareStart(void);
-
-	virtual void pushCollisions(char all);
-	virtual void popCollisions(void);
-
-	Game_v2(GobEngine *vm);
-	virtual ~Game_v2() {}
-
-protected:
-	struct CollLast {
-		int16 key;
-		int16 id;
-		int16 areaIndex;
-	};
-
-	CollLast _collLasts[5];
-
-	virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
-};
-
-class Game_v6 : public Game_v2 {
-public:
-	virtual void totSub(int8 flags, const char *newTotFile);
-
-	virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
-			uint16 right, uint16 bottom, int16 flags, int16 key,
-			uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
-
-	virtual void prepareStart(void);
-
-	virtual void pushCollisions(char all);
-
-	virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
-			int16 *pResId, int16 *pResIndex);
-	virtual void collisionsBlock(void);
-
-	Game_v6(GobEngine *vm);
-	virtual ~Game_v6() {}
-
-protected:
-	uint32 _someTimeDly;
-
-	virtual void setCollisions(byte arg_0 = 1);
-	virtual void collSub(uint16 offset);
-
-	virtual int16 adjustKey(int16 key);
-
-	virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
-
-	void collSubReenter();
-};
-
-class Game_Fascination : public Game_v2 {
-public:
-	virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
-			int16 *pResId, int16 *pResIndex);
-
-	Game_Fascination(GobEngine *vm);
-	virtual ~Game_Fascination() {}
-};
-
 } // End of namespace Gob
 
 #endif // GOB_GAME_H

Deleted: scummvm/branches/gsoc2009-16bit/engines/gob/game_fascin.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/game_fascin.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/game_fascin.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -1,203 +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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/endian.h"
-#include "common/stream.h"
-
-#include "gob/gob.h"
-#include "gob/game.h"
-#include "gob/global.h"
-#include "gob/util.h"
-#include "gob/dataio.h"
-#include "gob/draw.h"
-#include "gob/goblin.h"
-#include "gob/inter.h"
-#include "gob/mult.h"
-#include "gob/scenery.h"
-#include "gob/video.h"
-#include "gob/videoplayer.h"
-#include "gob/sound/sound.h"
-
-namespace Gob {
-
-Game_Fascination::Game_Fascination(GobEngine *vm) : Game_v2(vm) {
-}
-
-int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId,
-	    int16 *pResIndex) {
-	int16 resIndex;
-	int16 key;
-	int16 oldIndex;
-	int16 oldId;
-	int16 newkey;
-	uint32 timeKey;
-
-	_scrollHandleMouse = handleMouse != 0;
-
-	if (deltaTime >= -1) {
-		_lastCollKey = 0;
-		_lastCollAreaIndex = 0;
-		_lastCollId = 0;
-	}
-
-	if (pResId != 0)
-		*pResId = 0;
-
-	resIndex = 0;
-
-	if ((_vm->_draw->_cursorIndex == -1) &&
-			(handleMouse != 0) && (_lastCollKey == 0)) {
-		_lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-		if ((_lastCollKey != 0) && (_lastCollId & 0x8000))
-			collAreaSub(_lastCollAreaIndex, 1);
-	}
-
-	if (handleMouse != 0) {
-		if ((handleMouse==1) && (_vm->_draw->_renderFlags & RENDERFLAG_UNKNOWN))
-			warning("checkCollisions : RENDERFLAG_UNKNOWN - Unknown behavior");
-		_vm->_draw->animateCursor(-1);
-	}
-
-	timeKey = _vm->_util->getTimeKey();
-	while (1) {
-		if (_vm->_inter->_terminate || _vm->shouldQuit()) {
-			if (handleMouse)
-				_vm->_draw->blitCursor();
-			return 0;
-		}
-
-		if (!_vm->_draw->_noInvalidated) {
-			if (handleMouse != 0)
-				_vm->_draw->animateCursor(-1);
-			else
-				_vm->_draw->blitInvalidated();
-			_vm->_video->waitRetrace();
-		}
-
-		key = checkKeys(&_vm->_global->_inter_mouseX,
-				&_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse);
-
-		if ((handleMouse == 0) && (_mouseButtons != 0)) {
-			_vm->_util->waitMouseRelease(0);
-			key = 3;
-		}
-
-		if (key != 0) {
-
-			if (handleMouse & 1)
-				_vm->_draw->blitCursor();
-
-			if (pResId != 0)
-				*pResId = 0;
-
-			if (pResIndex != 0)
-				*pResIndex = 0;
-
-			if (_lastCollKey != 0)
-				collAreaSub(_lastCollAreaIndex, 0);
-
-			_lastCollKey = 0;
-			if (key != 0)
-				return key;
-		}
-
-		if (handleMouse != 0) {
-			if (_mouseButtons != 0) {
-				if (deltaTime > 0) {
-					_vm->_draw->animateCursor(2);
-					_vm->_util->delay(deltaTime);
-				} else if (handleMouse & 1)
-					_vm->_util->waitMouseRelease(1);
-				_vm->_draw->animateCursor(-1);
-
-				if (pResId != 0)
-					*pResId = 0;
-
-				key = checkMousePoint(0, pResId, &resIndex);
-				if (pResIndex != 0)
-					*pResIndex = resIndex;
-
-				if ((key != 0) || ((pResId != 0) && (*pResId != 0))) {
-					if ((handleMouse & 1) &&
-							((deltaTime <= 0) || (_mouseButtons == 0)))
-						_vm->_draw->blitCursor();
-
-					if ((_lastCollKey != 0) && (key != _lastCollKey))
-						collAreaSub(_lastCollAreaIndex, 0);
-
-					_lastCollKey = 0;
-					return key;
-				}
-
-				if (handleMouse & 4)
-					return 0;
-
-				if (_lastCollKey != 0)
-					collAreaSub(_lastCollAreaIndex, 0);
-
-				_lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-				if ((_lastCollKey != 0) && (_lastCollId & 0x8000))
-					collAreaSub(_lastCollAreaIndex, 1);
-			} else if ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) ||
-					(_vm->_global->_inter_mouseY != _vm->_draw->_cursorY)) {
-
-				oldIndex = _lastCollAreaIndex;
-				oldId = _lastCollId;
-				newkey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-				if (newkey != _lastCollKey) {
-					if ((_lastCollKey != 0) && (oldId & 0x8000))
-						collAreaSub(oldIndex, 0);
-
-					_lastCollKey = newkey;
-
-					if ((newkey != 0) && (_lastCollId & 0x8000))
-						collAreaSub(_lastCollAreaIndex, 1);
-				}
-			}
-		}
-
-		if ((deltaTime < 0) && (key == 0) && (_mouseButtons == 0)) {
-			uint32 curtime = _vm->_util->getTimeKey();
-			if ((curtime + deltaTime) > timeKey) {
-				if (pResId != 0)
-					*pResId = 0;
-
-				if (pResIndex != 0)
-					*pResIndex = 0;
-
-				return 0;
-			}
-		}
-
-		if (handleMouse != 0)
-			_vm->_draw->animateCursor(-1);
-
-		_vm->_util->delay(10);
-	}
-}
-
-} // End of namespace Gob

Deleted: scummvm/branches/gsoc2009-16bit/engines/gob/game_v1.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/game_v1.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/game_v1.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -1,1426 +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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/endian.h"
-#include "common/stream.h"
-
-#include "gob/gob.h"
-#include "gob/game.h"
-#include "gob/helper.h"
-#include "gob/global.h"
-#include "gob/util.h"
-#include "gob/dataio.h"
-#include "gob/script.h"
-#include "gob/resources.h"
-#include "gob/draw.h"
-#include "gob/inter.h"
-#include "gob/mult.h"
-#include "gob/video.h"
-#include "gob/scenery.h"
-#include "gob/sound/sound.h"
-
-namespace Gob {
-
-Game_v1::Game_v1(GobEngine *vm) : Game(vm) {
-}
-
-void Game_v1::playTot(int16 skipPlay) {
-	int16 _captureCounter;
-	int16 breakFrom;
-	int16 nestLevel;
-
-	int16 *oldNestLevel = _vm->_inter->_nestLevel;
-	int16 *oldBreakFrom = _vm->_inter->_breakFromLevel;
-	int16 *oldCaptureCounter = _vm->_scenery->_pCaptureCounter;
-
-	_script->push();
-
-	_vm->_inter->_nestLevel = &nestLevel;
-	_vm->_inter->_breakFromLevel = &breakFrom;
-	_vm->_scenery->_pCaptureCounter = &_captureCounter;
-
-	char savedTotName[20];
-	strcpy(savedTotName, _curTotFile);
-
-	if (skipPlay <= 0) {
-		while (!_vm->shouldQuit()) {
-			for (int i = 0; i < 4; i++) {
-				_vm->_draw->_fontToSprite[i].sprite = -1;
-				_vm->_draw->_fontToSprite[i].base = -1;
-				_vm->_draw->_fontToSprite[i].width = -1;
-				_vm->_draw->_fontToSprite[i].height = -1;
-			}
-
-			if ((_vm->getPlatform() == Common::kPlatformMacintosh)||
-				  (_vm->getPlatform() == Common::kPlatformWindows))
-				_vm->_sound->adlibStop();
-			else
-				_vm->_sound->cdStop();
-
-			_vm->_draw->animateCursor(4);
-			_vm->_inter->initControlVars(1);
-			_vm->_mult->initAll();
-			_vm->_mult->zeroMultData();
-
-			for (int i = 0; i < SPRITES_COUNT; i++)
-				_vm->_draw->freeSprite(i);
-
-			_vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface;
-			_vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface;
-			_vm->_draw->_spritesArray[23] = _vm->_draw->_cursorSprites;
-
-			for (int i = 0; i < 20; i++)
-				freeSoundSlot(i);
-
-			_totToLoad[0] = 0;
-
-			if ((_curTotFile[0] == 0) && !_script->isLoaded())
-				break;
-
-			if (!_script->load(_curTotFile)) {
-				_vm->_draw->blitCursor();
-				break;
-			}
-
-			_resources->load(_curTotFile);
-
-			_vm->_global->_inter_animDataSize = _script->getAnimDataSize();
-			if (!_vm->_inter->_variables)
-				_vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
-
-			_script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart));
-
-			_vm->_inter->renewTimeInVars();
-
-			WRITE_VAR(13, _vm->_global->_useMouse);
-			WRITE_VAR(14, _vm->_global->_soundFlags);
-			WRITE_VAR(15, _vm->_global->_videoMode);
-			WRITE_VAR(16, _vm->_global->_language);
-
-			_vm->_inter->callSub(2);
-			_script->setFinished(false);
-
-			if (_totToLoad[0] != 0)
-				_vm->_inter->_terminate = 0;
-
-			_vm->_draw->blitInvalidated();
-
-			_script->unload();
-
-			_resources->unload();
-
-			for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
-				capturePop(0);
-
-			_vm->_mult->checkFreeMult();
-			_vm->_mult->freeAll();
-
-			for (int i = 0; i < SPRITES_COUNT; i++)
-				_vm->_draw->freeSprite(i);
-			_vm->_sound->blasterStop(0);
-
-			for (int i = 0; i < 20; i++)
-				freeSoundSlot(i);
-
-			if (_totToLoad[0] == 0)
-				break;
-
-			strcpy(_curTotFile, _totToLoad);
-		}
-	}
-
-	strcpy(_curTotFile, savedTotName);
-
-	_vm->_inter->_nestLevel = oldNestLevel;
-	_vm->_inter->_breakFromLevel = oldBreakFrom;
-	_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
-
-	_script->pop();
-}
-
-void Game_v1::clearCollisions() {
-	for (int i = 0; i < 250; i++) {
-		_collisionAreas[i].id = 0;
-		_collisionAreas[i].left = 0xFFFF;
-	}
-}
-
-int16 Game_v1::addNewCollision(int16 id, uint16 left, uint16 top,
-		uint16 right, uint16 bottom, int16 flags, int16 key,
-		uint16 funcEnter, uint16 funcLeave, uint16 funcSub) {
-	Collision *ptr;
-
-	debugC(5, kDebugCollisions, "addNewCollision");
-	debugC(5, kDebugCollisions, "id = %X", id);
-	debugC(5, kDebugCollisions, "left = %d, top = %d, right = %d, bottom = %d",
-			left, top, right, bottom);
-	debugC(5, kDebugCollisions, "flags = %X, key = %X", flags, key);
-	debugC(5, kDebugCollisions, "funcEnter = %d, funcLeave = %d",
-			funcEnter, funcLeave);
-
-	for (int i = 0; i < 250; i++) {
-		if (_collisionAreas[i].left != 0xFFFF)
-			continue;
-
-		ptr = &_collisionAreas[i];
-		ptr->id = id;
-		ptr->left = left;
-		ptr->top = top;
-		ptr->right = right;
-		ptr->bottom = bottom;
-		ptr->flags = flags;
-		ptr->key = key;
-		ptr->funcEnter = funcEnter;
-		ptr->funcLeave = funcLeave;
-		ptr->funcSub = funcSub;
-		ptr->script = 0;
-
-		return i;
-	}
-	error("Game_v1::addNewCollision(): Collision array full");
-	return 0;
-}
-
-void Game_v1::pushCollisions(char all) {
-	Collision *srcPtr;
-	Collision *destPtr;
-	int16 size;
-
-	debugC(1, kDebugCollisions, "pushCollisions");
-	for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) {
-		if (all || (srcPtr->id & 0x8000))
-			size++;
-	}
-
-	destPtr = new Collision[size];
-	_collStack[_collStackSize] = destPtr;
-	_collStackElemSizes[_collStackSize] = size;
-	_collStackSize++;
-
-	for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) {
-		if (all || (srcPtr->id & 0x8000)) {
-			memcpy(destPtr, srcPtr, sizeof(Collision));
-			srcPtr->left = 0xFFFF;
-			destPtr++;
-		}
-	}
-}
-
-void Game_v1::popCollisions(void) {
-	Collision *destPtr;
-	Collision *srcPtr;
-
-	debugC(1, kDebugCollisions, "popCollision");
-
-	_collStackSize--;
-	for (destPtr = _collisionAreas; destPtr->left != 0xFFFF; destPtr++)
-		;
-
-	srcPtr = _collStack[_collStackSize];
-	memcpy(destPtr, srcPtr,
-			_collStackElemSizes[_collStackSize] * sizeof(Collision));
-
-	delete[] _collStack[_collStackSize];
-}
-
-int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime,
-		int16 *pResId, int16 *pResIndex) {
-	int16 resIndex;
-	int16 key;
-	int16 oldIndex;
-	int16 oldId;
-	uint32 timeKey;
-	bool firstIteration = true;
-
-	if (deltaTime >= -1) {
-		_lastCollKey = 0;
-		_lastCollAreaIndex = 0;
-		_lastCollId = 0;
-	}
-
-	if (pResId != 0)
-		*pResId = 0;
-
-	resIndex = 0;
-
-	timeKey = _vm->_util->getTimeKey();
-
-	if ((_vm->_draw->_cursorIndex == -1) && (handleMouse != 0) &&
-			(_lastCollKey == 0)) {
-		_lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-		if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) {
-			_script->call(_collisionAreas[_lastCollAreaIndex].funcEnter);
-			_vm->_inter->funcBlock(0);
-			_script->pop();
-		}
-	}
-
-	if (handleMouse != 0)
-		_vm->_draw->animateCursor(-1);
-
-	while (1) {
-		if (_vm->_inter->_terminate) {
-			if (handleMouse)
-				_vm->_draw->blitCursor();
-			return 0;
-		}
-
-		if (!_vm->_draw->_noInvalidated) {
-			if (handleMouse)
-				_vm->_draw->animateCursor(-1);
-			else
-				_vm->_draw->blitInvalidated();
-		}
-
-		// NOTE: the original asm does the below checkKeys call
-		// _before_ this check. However, that can cause keypresses to get lost
-		// since there's a return statement in this check.
-		// Additionally, I added a 'deltaTime == -1' check there, since
-		// when this function is called with deltaTime == -1 in inputArea,
-		// and the return value is then discarded.
-		if (deltaTime < 0) {
-			uint32 curtime = _vm->_util->getTimeKey();
-			if ((deltaTime == -1) || (((curtime + deltaTime) > timeKey) && !firstIteration)) {
-				if (pResId != 0)
-					*pResId = 0;
-
-				if (pResIndex != 0)
-					*pResIndex = 0;
-
-				return 0;
-			}
-		}
-
-		key = checkKeys(&_vm->_global->_inter_mouseX,
-				&_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse);
-
-		if ((handleMouse == 0) && (_mouseButtons != 0)) {
-			_vm->_util->waitMouseRelease(0);
-			key = 3;
-		}
-
-		if (key != 0) {
-
-			if (handleMouse == 1)
-				_vm->_draw->blitCursor();
-
-			if (pResId != 0)
-				*pResId = 0;
-
-			if (pResIndex != 0)
-				*pResIndex = 0;
-
-			if ((_lastCollKey != 0) &&
-			    (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) {
-
-				_script->call(_collisionAreas[_lastCollAreaIndex].funcLeave);
-				_vm->_inter->funcBlock(0);
-				_script->pop();
-			}
-
-			_lastCollKey = 0;
-			if (key != 0)
-				return key;
-		}
-
-		if (handleMouse != 0) {
-			if (_mouseButtons != 0) {
-				oldIndex = 0;
-
-				_vm->_draw->animateCursor(2);
-				if (deltaTime <= 0) {
-					if (handleMouse == 1)
-						_vm->_util->waitMouseRelease(1);
-				} else if (deltaTime > 0)
-					_vm->_util->delay(deltaTime);
-
-				_vm->_draw->animateCursor(-1);
-				if (pResId != 0)
-					*pResId = 0;
-
-				key = checkMousePoint(0, pResId, &resIndex);
-
-				if (pResIndex != 0)
-					*pResIndex = resIndex;
-
-				if ((key != 0) || ((pResId != 0) && (*pResId != 0))) {
-					if ((handleMouse == 1) &&
-							((deltaTime <= 0) || (_mouseButtons == 0)))
-						_vm->_draw->blitCursor();
-
-					if ((_lastCollKey != 0) &&
-						(_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) {
-
-						_script->call(_collisionAreas[_lastCollAreaIndex].funcLeave);
-						_vm->_inter->funcBlock(0);
-						_script->pop();
-
-					}
-					_lastCollKey = 0;
-					return key;
-				}
-
-				if ((_lastCollKey != 0) &&
-				    (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) {
-
-					_script->call(_collisionAreas[_lastCollAreaIndex].funcLeave);
-					_vm->_inter->funcBlock(0);
-					_script->pop();
-
-				}
-
-				_lastCollKey =
-					checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-				if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) {
-
-					_script->call(_collisionAreas[_lastCollAreaIndex].funcEnter);
-					_vm->_inter->funcBlock(0);
-					_script->pop();
-
-				}
-			} else {
-
-				if ((handleMouse != 0) &&
-				    ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) ||
-						(_vm->_global->_inter_mouseY != _vm->_draw->_cursorY))) {
-					oldIndex = _lastCollAreaIndex;
-					oldId = _lastCollId;
-
-					key = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-					if (key != _lastCollKey) {
-						if ((_lastCollKey != 0) && ((oldId & 0x8000) != 0)) {
-
-							_script->call(_collisionAreas[oldIndex].funcLeave);
-							_vm->_inter->funcBlock(0);
-							_script->pop();
-
-						}
-
-						_lastCollKey = key;
-						if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) {
-
-							_script->call(_collisionAreas[_lastCollAreaIndex].funcEnter);
-							_vm->_inter->funcBlock(0);
-							_script->pop();
-
-						}
-
-					}
-				}
-			}
-		}
-
-		if (handleMouse != 0)
-			_vm->_draw->animateCursor(-1);
-
-		if (deltaTime < -10)
-      _vm->_util->delay(10);
-
-		firstIteration = false;
-	}
-}
-
-void Game_v1::prepareStart(void) {
-	clearCollisions();
-
-	_vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2;
-	_vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1;
-	_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
-
-	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
-
-	_vm->_draw->initScreen();
-	_vm->_video->fillRect(*_vm->_draw->_backSurface, 0, 0, 319, 199, 1);
-	_vm->_draw->_frontSurface = _vm->_global->_primarySurfDesc;
-	_vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0, 319, 199, 1);
-
-	_vm->_util->setMousePos(152, 92);
-	_vm->_draw->_cursorX = _vm->_global->_inter_mouseX = 152;
-	_vm->_draw->_cursorY = _vm->_global->_inter_mouseY = 92;
-
-	_vm->_draw->_invalidatedCount = 0;
-	_vm->_draw->_noInvalidated = true;
-	_vm->_draw->_applyPal = false;
-	_vm->_draw->_paletteCleared = false;
-	_vm->_draw->_cursorWidth = 16;
-	_vm->_draw->_cursorHeight = 16;
-	_vm->_draw->_transparentCursor = 1;
-
-	for (int i = 0; i < 40; i++) {
-		_vm->_draw->_cursorAnimLow[i] = -1;
-		_vm->_draw->_cursorAnimDelays[i] = 0;
-		_vm->_draw->_cursorAnimHigh[i] = 0;
-	}
-
-	_vm->_draw->_cursorAnimLow[1] = 0;
-	_vm->_draw->_cursorSprites =
-		_vm->_video->initSurfDesc(_vm->_global->_videoMode, 32, 16, 2);
-	_vm->_draw->_scummvmCursor =
-		_vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR);
-	_vm->_draw->_renderFlags = 0;
-	_vm->_draw->_backDeltaX = 0;
-	_vm->_draw->_backDeltaY = 0;
-
-	_startTimeKey = _vm->_util->getTimeKey();
-}
-
-void Game_v1::collisionsBlock(void) {
-	InputDesc descArray[20];
-	int16 array[250];
-	byte count;
-	int16 collResId;
-	int16 curCmd;
-	int16 cmd;
-	int16 cmdHigh;
-	int16 key;
-	int16 flags;
-	uint16 left;
-	uint16 top;
-	uint16 width;
-	uint16 height;
-	int16 var_22;
-	int16 index;
-	int16 curEditIndex;
-	int16 deltaTime;
-	int16 descIndex2;
-	int16 stackPos2;
-	int16 descIndex;
-	int16 timeVal;
-	char *str;
-	int16 savedCollStackSize;
-	int16 i;
-	int16 counter;
-	int16 var_24;
-	int16 var_26;
-	int16 collStackPos;
-	Collision *collPtr;
-	uint32 timeKey;
-
-	if (_shouldPushColls)
-		pushCollisions(1);
-
-	collResId = -1;
-	_script->skip(1);
-	count = _script->readByte();
-	_handleMouse = _script->readByte();
-	deltaTime = 1000 * _script->readByte();
-	descIndex2 = _script->readByte();
-	stackPos2 = _script->readByte();
-	descIndex = _script->readByte();
-
-	if ((stackPos2 != 0) || (descIndex != 0))
-		deltaTime /= 100;
-
-	timeVal = deltaTime;
-	_script->skip(1);
-
-	uint32 startPos = _script->pos();
-
-	WRITE_VAR(16, 0);
-	var_22 = 0;
-	index = 0;
-	curEditIndex = 0;
-
-	for (curCmd = 0; curCmd < count; curCmd++) {
-		array[curCmd] = 0;
-		cmd = _script->readByte();
-
-		if ((cmd & 0x40) != 0) {
-			cmd -= 0x40;
-			cmdHigh = _script->readByte();
-			cmdHigh <<= 8;
-		} else
-			cmdHigh = 0;
-
-		if ((cmd & 0x80) != 0) {
-			left = _script->readValExpr();
-			top = _script->readValExpr();
-			width = _script->readValExpr();
-			height = _script->readValExpr();
-		} else {
-			left = _script->readUint16();
-			top = _script->readUint16();
-			width = _script->readUint16();
-			height = _script->readUint16();
-		}
-		cmd &= 0x7F;
-
-		debugC(1, kDebugCollisions, "collisionsBlock(%d)", cmd);
-
-		switch (cmd) {
-		case 3:
-		case 4:
-		case 5:
-		case 6:
-		case 7:
-		case 8:
-		case 9:
-		case 10:
-
-			_vm->_util->clearKeyBuf();
-			var_22 = 1;
-			key = _script->readVarIndex();
-			descArray[index].fontIndex = _script->readInt16();
-			descArray[index].backColor = _script->readByte();
-			descArray[index].frontColor = _script->readByte();
-
-			if ((cmd < 5) || (cmd > 8)) {
-				descArray[index].ptr = 0;
-			} else {
-				descArray[index].ptr = _script->getData() + _script->pos() + 2;
-				_script->skip(_script->readInt16());
-			}
-
-			if (left == 0xFFFF)
-				break;
-
-			if ((cmd & 1) == 0) {
-				addNewCollision(curCmd + 0x8000, left, top, left + width *
-						_vm->_draw->_fonts[descArray[index].fontIndex]->itemWidth - 1,
-						top + height - 1, cmd, key, 0, _script->pos());
-
-				_script->skip(_script->peekUint16(2) + 2);
-			} else {
-				addNewCollision(curCmd + 0x8000, left, top, left + width *
-						_vm->_draw->_fonts[descArray[index].fontIndex]->itemWidth - 1,
-						top + height - 1, cmd, key, 0, 0);
-			}
-			index++;
-			break;
-
-		case 21:
-			key = _script->readInt16();
-			array[curCmd] = _script->readInt16();
-			flags = _script->readInt16() & 3;
-
-			addNewCollision(curCmd + 0x8000, left, top,
-			    left + width - 1, top + height - 1,
-			    (flags << 4) + cmdHigh + 2, key, _script->pos(), 0);
-
-			_script->skip(_script->peekUint16(2) + 2);
-			break;
-
-		case 20:
-			collResId = curCmd;
-			// Fall through to case 2
-
-		case 2:
-			key = _script->readInt16();
-			array[curCmd] = _script->readInt16();
-			flags = _script->readInt16() & 3;
-
-			addNewCollision(curCmd + 0x8000, left, top,
-			    left + width - 1,
-			    top + height - 1,
-			    (flags << 4) + cmdHigh + 2, key, 0, _script->pos());
-
-			_script->skip(_script->peekUint16(2) + 2);
-			break;
-
-		case 0:
-			_script->skip(6);
-			startPos = _script->pos();
-			_script->skip(_script->peekUint16(2) + 2);
-			key = curCmd + 0xA000;
-
-			addNewCollision(curCmd + 0x8000, left, top,
-			    left + width - 1, top + height - 1,
-			    cmd + cmdHigh, key,
-			    startPos, _script->pos());
-
-			_script->skip(_script->peekUint16(2) + 2);
-			break;
-
-		case 1:
-			key = _script->readInt16();
-			array[curCmd] = _script->readInt16();
-			flags = _script->readInt16() & 3;
-
-			startPos = _script->pos();
-			_script->skip(_script->peekUint16(2) + 2);
-			if (key == 0)
-				key = curCmd + 0xA000;
-
-			addNewCollision(curCmd + 0x8000, left, top,
-			    left + width - 1, top + height - 1,
-			    (flags << 4) + cmd + cmdHigh, key,
-			    startPos, _script->pos());
-
-			_script->skip(_script->peekUint16(2) + 2);
-			break;
-		}
-	}
-
-	_forceHandleMouse = 0;
-	_vm->_util->clearKeyBuf();
-
-	do {
-		if (var_22 != 0) {
-			key = multiEdit(deltaTime, index, &curEditIndex,
-					descArray, &_activeCollResId, &_activeCollIndex);
-
-			if (key == 0x1C0D) {
-				for (i = 0; i < 250; i++) {
-					if (_collisionAreas[i].left == 0xFFFF)
-						continue;
-
-					if ((_collisionAreas[i].id & 0x8000) == 0)
-						continue;
-
-					if ((_collisionAreas[i].flags & 1) != 0)
-						continue;
-
-					if ((_collisionAreas[i].flags & 0x0F) <= 2)
-						continue;
-
-					collResId = _collisionAreas[i].id;
-					_activeCollResId = collResId;
-					collResId &= 0x7FFF;
-					_activeCollIndex = i;
-					break;
-				}
-				break;
-			}
-		} else
-			key = checkCollisions(_handleMouse, -deltaTime,
-			    &_activeCollResId, &_activeCollIndex);
-
-		if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) &&
-		    ((key >> 8) > 1) && ((key >> 8) < 12))
-			key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00);
-
-		if (_activeCollResId == 0) {
-			if (key != 0) {
-				for (i = 0; i < 250; i++) {
-					if (_collisionAreas[i].left == 0xFFFF)
-						continue;
-
-					if ((_collisionAreas[i].id & 0x8000) == 0)
-						continue;
-
-					if ((_collisionAreas[i].key == key) ||
-							(_collisionAreas[i].key == 0x7FFF)) {
-
-						_activeCollResId = _collisionAreas[i].id;
-						_activeCollIndex = i;
-						break;
-					}
-				}
-
-				if (_activeCollResId == 0) {
-					for (i = 0; i < 250; i++) {
-						if (_collisionAreas[i].left == 0xFFFF)
-							continue;
-
-						if ((_collisionAreas[i].id & 0x8000) == 0)
-							continue;
-
-						if ((_collisionAreas[i].key & 0xFF00) != 0)
-							continue;
-
-						if (_collisionAreas[i].key == 0)
-							continue;
-
-						if ((adjustKey(key & 0xFF) == adjustKey(_collisionAreas[i].key)) ||
-								(_collisionAreas[i].key == 0x7FFF)) {
-							_activeCollResId = _collisionAreas[i].id;
-							_activeCollIndex = i;
-							break;
-						}
-					}
-				}
-			} else {
-
-				if ((deltaTime != 0) && (VAR(16) == 0)) {
-					if (stackPos2 != 0) {
-						collStackPos = 0;
-						collPtr = _collisionAreas;
-
-						for (i = 0, collPtr = _collisionAreas;
-								collPtr->left != 0xFFFF; i++, collPtr++) {
-
-							if ((collPtr->id & 0x8000) == 0)
-								continue;
-
-							collStackPos++;
-							if (collStackPos != stackPos2)
-								continue;
-
-							_activeCollResId = collPtr->id;
-							_activeCollIndex = i;
-							WRITE_VAR(2, _vm->_global->_inter_mouseX);
-							WRITE_VAR(3, _vm->_global->_inter_mouseY);
-							WRITE_VAR(4, _mouseButtons);
-							WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]);
-
-							if (collPtr->funcLeave != 0) {
-								timeKey = _vm->_util->getTimeKey();
-
-								uint32 savedPos = _script->pos();
-
-								_script->seek(collPtr->funcLeave);
-
-								_shouldPushColls = 1;
-								savedCollStackSize = _collStackSize;
-								_vm->_inter->funcBlock(0);
-
-								if (savedCollStackSize != _collStackSize)
-									popCollisions();
-
-								_shouldPushColls = 0;
-
-								_script->seek(savedPos);
-
-								deltaTime = timeVal -
-									(_vm->_util->getTimeKey() - timeKey);
-
-								if (deltaTime < 2)
-									deltaTime = 2;
-							}
-
-							if (VAR(16) == 0)
-								_activeCollResId = 0;
-							break;
-						}
-					} else {
-						if (descIndex != 0) {
-							counter = 0;
-							for (i = 0; i < 250; i++) {
-								if (_collisionAreas[i].left == 0xFFFF)
-									continue;
-
-								if ((_collisionAreas[i].id & 0x8000) == 0)
-									continue;
-
-								counter++;
-								if (counter != descIndex)
-									continue;
-
-								_activeCollResId = _collisionAreas[i].id;
-								_activeCollIndex = i;
-								break;
-							}
-						} else {
-							for (i = 0; i < 250; i++) {
-								if (_collisionAreas[i].left == 0xFFFF)
-									continue;
-
-								if ((_collisionAreas[i].id & 0x8000) == 0)
-									continue;
-
-								_activeCollResId = _collisionAreas[i].id;
-								_activeCollIndex = i;
-								break;
-							}
-						}
-					}
-				} else {
-					if (descIndex2 != 0) {
-						counter = 0;
-						for (i = 0; i < 250; i++) {
-							if (_collisionAreas[i].left == 0xFFFF)
-								continue;
-
-							if ((_collisionAreas[i].id & 0x8000) == 0)
-								continue;
-
-							counter++;
-							if (counter != descIndex2)
-								continue;
-
-							_activeCollResId = _collisionAreas[i].id;
-							_activeCollIndex = i;
-							break;
-						}
-					}
-				}
-			}
-		}
-
-		if (_activeCollResId == 0)
-			continue;
-
-		if (_collisionAreas[_activeCollIndex].funcLeave != 0)
-			continue;
-
-		WRITE_VAR(2, _vm->_global->_inter_mouseX);
-		WRITE_VAR(3, _vm->_global->_inter_mouseY);
-		WRITE_VAR(4, _mouseButtons);
-		WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]);
-
-		if (_collisionAreas[_activeCollIndex].funcEnter != 0) {
-			uint32 savedPos = _script->pos();
-
-			_script->seek(_collisionAreas[_activeCollIndex].funcEnter);
-
-			_shouldPushColls = 1;
-
-			collStackPos = _collStackSize;
-			_vm->_inter->funcBlock(0);
-			if (collStackPos != _collStackSize)
-				popCollisions();
-			_shouldPushColls = 0;
-
-			_script->seek(savedPos);
-		}
-
-		WRITE_VAR(16, 0);
-		_activeCollResId = 0;
-	}
-	while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit());
-
-	if (((uint16) _activeCollResId & ~0x8000) == collResId) {
-		collStackPos = 0;
-		var_24 = 0;
-		var_26 = 1;
-		for (i = 0; i < 250; i++) {
-			if (_collisionAreas[i].left == 0xFFFF)
-				continue;
-
-			if ((_collisionAreas[i].id & 0x8000) == 0)
-				continue;
-
-			if ((_collisionAreas[i].flags & 0x0F) < 3)
-				continue;
-
-			if ((_collisionAreas[i].flags & 0x0F) > 10)
-				continue;
-
-			if ((_collisionAreas[i].flags & 0x0F) > 8) {
-				char *ptr;
-				strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255);
-				while ((ptr = strchr(_tempStr, ' ')) != 0) {
-					_vm->_util->cutFromStr(_tempStr, (ptr - _tempStr), 1);
-					ptr = strchr(_tempStr, ' ');
-				}
-				WRITE_VARO_STR(_collisionAreas[i].key, _tempStr);
-			}
-
-			if (((_collisionAreas[i].flags & 0x0F) >= 5) &&
-			    ((_collisionAreas[i].flags & 0x0F) <= 8)) {
-				str = (char *) descArray[var_24].ptr;
-
-				strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255);
-
-				if ((_collisionAreas[i].flags & 0x0F) < 7)
-					_vm->_util->prepareStr(_tempStr);
-
-				int16 pos = 0;
-				do {
-					strncpy0(_collStr, str, 255);
-					pos += strlen(str) + 1;
-
-					str += strlen(str) + 1;
-
-					if ((_collisionAreas[i].flags & 0x0F) < 7)
-						_vm->_util->prepareStr(_collStr);
-
-					if (strcmp(_tempStr, _collStr) == 0) {
-						WRITE_VAR(17, VAR(17) + 1);
-						WRITE_VAR(17 + var_26, 1);
-						break;
-					}
-				} while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos);
-				collStackPos++;
-			} else {
-				WRITE_VAR(17 + var_26, 2);
-			}
-			var_24++;
-			var_26++;
-		}
-
-		if (collStackPos != (int16) VAR(17))
-			WRITE_VAR(17, 0);
-		else
-			WRITE_VAR(17, 1);
-	}
-
-	if (!_vm->_inter->_terminate) {
-		_script->seek(_collisionAreas[_activeCollIndex].funcLeave);
-
-		WRITE_VAR(2, _vm->_global->_inter_mouseX);
-		WRITE_VAR(3, _vm->_global->_inter_mouseY);
-		WRITE_VAR(4, _mouseButtons);
-
-		if (VAR(16) == 0)
-			WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]);
-	} else
-		_script->setFinished(true);
-
-	for (curCmd = 0; curCmd < count; curCmd++)
-		freeCollision(curCmd + 0x8000);
-}
-
-int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos,
-		InputDesc * inpDesc, int16 *collResId, int16 *collIndex, bool mono) {
-	Collision *collArea;
-	int16 descInd;
-	int16 key;
-	int16 found = -1;
-	int16 i;
-
-	descInd = 0;
-	for (i = 0; i < 250; i++) {
-		collArea = &_collisionAreas[i];
-
-		if (collArea->left == 0xFFFF)
-			continue;
-
-		if ((collArea->id & 0x8000) == 0)
-			continue;
-
-		if ((collArea->flags & 0x0F) < 3)
-			continue;
-
-		if ((collArea->flags & 0x0F) > 10)
-			continue;
-
-		strncpy0(_tempStr, GET_VARO_STR(collArea->key), 255);
-
-		_vm->_draw->_destSpriteX = collArea->left;
-		_vm->_draw->_destSpriteY = collArea->top;
-		_vm->_draw->_spriteRight = collArea->right - collArea->left + 1;
-		_vm->_draw->_spriteBottom = collArea->bottom - collArea->top + 1;
-
-		_vm->_draw->_destSurface = 21;
-
-		_vm->_draw->_backColor = inpDesc[descInd].backColor;
-		_vm->_draw->_frontColor = inpDesc[descInd].frontColor;
-		_vm->_draw->_textToPrint = _tempStr;
-		_vm->_draw->_transparency = 1;
-		_vm->_draw->_fontIndex = inpDesc[descInd].fontIndex;
-		_vm->_draw->spriteOperation(DRAW_FILLRECT);
-		_vm->_draw->_destSpriteY +=
-		    ((collArea->bottom - collArea->top + 1) - 8) / 2;
-
-		_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
-		descInd++;
-	}
-
-	for (i = 0; i < 40; i++)
-		WRITE_VAR_OFFSET(i * 4 + 0x44, 0);
-
-	while (1) {
-		descInd = 0;
-
-		for (i = 0; i < 250; i++) {
-			collArea = &_collisionAreas[i];
-
-			if (collArea->left == 0xFFFF)
-				continue;
-
-			if ((collArea->id & 0x8000) == 0)
-				continue;
-
-			if ((collArea->flags & 0x0F) < 3)
-				continue;
-
-			if ((collArea->flags & 0x0F) > 10)
-				continue;
-
-			if (descInd == *pCurPos) {
-				found = i;
-				break;
-			}
-
-			descInd++;
-		}
-
-		assert(found != -1);
-
-		collArea = &_collisionAreas[found];
-
-		key = inputArea(collArea->left, collArea->top,
-		    collArea->right - collArea->left + 1,
-		    collArea->bottom - collArea->top + 1,
-		    inpDesc[*pCurPos].backColor, inpDesc[*pCurPos].frontColor,
-				GET_VARO_STR(collArea->key), inpDesc[*pCurPos].fontIndex,
-				collArea->flags, &time, collResId, collIndex);
-
-		if (_vm->_inter->_terminate)
-			return 0;
-
-		switch (key) {
-		case 0:
-			if (*collResId == 0)
-				return 0;
-
-			if ((_collisionAreas[*collIndex].flags & 0x0F) < 3)
-				return 0;
-
-			if ((_collisionAreas[*collIndex].flags & 0x0F) > 10)
-				return 0;
-
-			*pCurPos = 0;
-			for (i = 0; i < 250; i++) {
-				collArea = &_collisionAreas[i];
-
-				if (collArea->left == 0xFFFF)
-					continue;
-
-				if ((collArea->id & 0x8000) == 0)
-					continue;
-
-				if ((collArea->flags & 0x0F) < 3)
-					continue;
-
-				if ((collArea->flags & 0x0F) > 10)
-					continue;
-
-				if (i == *collIndex)
-					break;
-
-				pCurPos[0]++;
-			}
-			break;
-
-		case 0x3B00:
-		case 0x3C00:
-		case 0x3D00:
-		case 0x3E00:
-		case 0x3F00:
-		case 0x4000:
-		case 0x4100:
-		case 0x4200:
-		case 0x4300:
-		case 0x4400:
-			return key;
-
-		case 0x1C0D:
-
-			if (index == 1)
-				return key;
-
-			if (*pCurPos == index - 1) {
-				*pCurPos = 0;
-				break;
-			}
-
-			pCurPos[0]++;
-			break;
-
-		case 0x5000:
-			if (index - 1 > *pCurPos)
-				pCurPos[0]++;
-			break;
-
-		case 0x4800:
-			if (*pCurPos > 0)
-				pCurPos[0]--;
-			break;
-		}
-	}
-}
-
-int16 Game_v1::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
-		int16 backColor, int16 frontColor, char *str, int16 fontIndex,
-		char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex, bool mono) {
-	int16 handleMouse;
-	uint32 editSize;
-	Video::FontDesc *pFont;
-	char curSym;
-	int16 key;
-	const char *str1;
-	const char *str2;
-	int16 i;
-	uint32 pos;
-	int16 flag;
-	int16 savedKey;
-
-	if ((_handleMouse != 0) &&
-	    ((_vm->_global->_useMouse != 0) || (_forceHandleMouse != 0)))
-		handleMouse = 1;
-	else
-		handleMouse = 0;
-
-	pos = strlen(str);
-	pFont = _vm->_draw->_fonts[fontIndex];
-	editSize = width / pFont->itemWidth;
-
-	while (1) {
-		strncpy0(_tempStr, str, 254);
-		strcat(_tempStr, " ");
-		if (strlen(_tempStr) > editSize)
-			strncpy0(_tempStr, str, 255);
-
-		_vm->_draw->_destSpriteX = xPos;
-		_vm->_draw->_destSpriteY = yPos;
-		_vm->_draw->_spriteRight = editSize * pFont->itemWidth;
-		_vm->_draw->_spriteBottom = height;
-
-		_vm->_draw->_destSurface = 21;
-		_vm->_draw->_backColor = backColor;
-		_vm->_draw->_frontColor = frontColor;
-		_vm->_draw->_textToPrint = _tempStr;
-		_vm->_draw->_transparency = 1;
-		_vm->_draw->_fontIndex = fontIndex;
-		_vm->_draw->spriteOperation(DRAW_FILLRECT);
-
-		_vm->_draw->_destSpriteY = yPos + (height - 8) / 2;
-
-		_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
-		if (pos == editSize)
-			pos--;
-
-		curSym = _tempStr[pos];
-
-		flag = 1;
-
-		while (1) {
-			_tempStr[0] = curSym;
-			_tempStr[1] = 0;
-
-			_vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos;
-			_vm->_draw->_destSpriteY = yPos + height - 1;
-			_vm->_draw->_spriteRight = pFont->itemWidth;
-			_vm->_draw->_spriteBottom = 1;
-			_vm->_draw->_destSurface = 21;
-			_vm->_draw->_backColor = frontColor;
-			_vm->_draw->spriteOperation(DRAW_FILLRECT);
-
-			if (flag != 0)
-				key = checkCollisions(handleMouse, -1, collResId, collIndex);
-			flag = 0;
-
-			key = checkCollisions(handleMouse, -300, collResId, collIndex);
-
-			if (*pTotTime > 0) {
-				*pTotTime -= 300;
-				if (*pTotTime <= 1) {
-					key = 0;
-					*collResId = 0;
-					break;
-				}
-			}
-
-			_tempStr[0] = curSym;
-			_tempStr[1] = 0;
-			_vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos;
-			_vm->_draw->_destSpriteY = yPos + height - 1;
-			_vm->_draw->_spriteRight = pFont->itemWidth;
-			_vm->_draw->_spriteBottom = 1;
-			_vm->_draw->_destSurface = 21;
-			_vm->_draw->_backColor = backColor;
-			_vm->_draw->_frontColor = frontColor;
-			_vm->_draw->_textToPrint = _tempStr;
-			_vm->_draw->_transparency = 1;
-			_vm->_draw->spriteOperation(DRAW_FILLRECT);
-
-			_vm->_draw->_destSpriteY = yPos + (height - 8) / 2;
-			_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
-
-			if ((key != 0) || (*collResId != 0))
-				break;
-
-			key = checkCollisions(handleMouse, -300, collResId, collIndex);
-
-			if (*pTotTime > 0) {
-				*pTotTime -= 300;
-				if (*pTotTime <= 1) {
-					key = 0;
-					*collResId = 0;
-					break;
-				}
-			}
-
-			if ((key != 0) || (*collResId != 0))
-				break;
-
-			if (_vm->_inter->_terminate)
-				return 0;
-		}
-
-		if ((key == 0) || (*collResId != 0) || _vm->_inter->_terminate)
-			return 0;
-
-		switch (key) {
-		case 0x4D00: // Right Arrow
-			if ((pos < strlen(str)) && (pos < (editSize - 1))) {
-				pos++;
-				continue;
-			}
-			return 0x5000;
-
-		case 0x4B00: // Left Arrow
-			if (pos > 0) {
-				pos--;
-				continue;
-			}
-			return 0x4800;
-
-		case 0xE08: // Backspace
-			if (pos > 0) {
-				_vm->_util->cutFromStr(str, pos - 1, 1);
-				pos--;
-				continue;
-			}
-
-		case 0x5300: // Del
-
-			if (pos >= strlen(str))
-				continue;
-
-			_vm->_util->cutFromStr(str, pos, 1);
-			continue;
-
-		case 0x1C0D: // Enter
-		case 0x3B00: // F1
-		case 0x3C00: // F2
-		case 0x3D00: // F3
-		case 0x3E00: // F4
-		case 0x3F00: // F5
-		case 0x4000: // F6
-		case 0x4100: // F7
-		case 0x4200: // F8
-		case 0x4300: // F9
-		case 0x4400: // F10
-		case 0x4800: // Up arrow
-		case 0x5000: // Down arrow
-			return key;
-
-		case 0x11B: // Escape
-			if (_vm->_global->_useMouse != 0)
-				continue;
-
-			_forceHandleMouse = !_forceHandleMouse;
-
-			if ((_handleMouse != 0) &&
-			    ((_vm->_global->_useMouse != 0) || (_forceHandleMouse != 0)))
-				handleMouse = 1;
-			else
-				handleMouse = 0;
-
-			if (_vm->_global->_pressedKeys[1] == 0)
-				continue;
-
-			while (_vm->_global->_pressedKeys[1] != 0)
-				;
-			continue;
-
-		default:
-
-			savedKey = key;
-			key &= 0xFF;
-
-			if (((inpType == 9) || (inpType == 10)) &&
-					(key >= ' ') && (key <= 0xFF)) {
-				str1 = "0123456789-.,+ ";
-				str2 = "0123456789-,,+ ";
-
-				if (((savedKey >> 8) > 1) && ((savedKey >> 8) < 12))
-					key = ((savedKey >> 8) - 1) % 10 + '0';
-
-				for (i = 0; str1[i] != 0; i++) {
-					if (key == str1[i]) {
-						key = str2[i];
-						break;
-					}
-				}
-
-				if (i == (int16) strlen(str1))
-					key = 0;
-			}
-
-			if ((key >= ' ') && (key <= 0xFF)) {
-				if (editSize == strlen(str))
-					_vm->_util->cutFromStr(str, strlen(str) - 1, 1);
-
-				if ((key >= 'a') && (key <= 'z'))
-					key += ('A' - 'a');
-
-				pos++;
-				_tempStr[0] = key;
-				_tempStr[1] = 0;
-
-				_vm->_util->insertStr(_tempStr, str, pos - 1);
-			}
-
-		}
-	}
-}
-
-int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) {
-	Collision *ptr;
-	int16 i;
-
-	if (resId != 0)
-		*resId = 0;
-
-	*resIndex = 0;
-
-	ptr = _collisionAreas;
-	for (i = 0; ptr->left != 0xFFFF; ptr++, i++) {
-		if (all) {
-			if ((ptr->flags & 0xF) > 1)
-				continue;
-
-			if ((ptr->flags & 0xFF00) != 0)
-				continue;
-
-			if ((_vm->_global->_inter_mouseX < ptr->left) ||
-			    (_vm->_global->_inter_mouseX > ptr->right) ||
-			    (_vm->_global->_inter_mouseY < ptr->top) ||
-			    (_vm->_global->_inter_mouseY > ptr->bottom))
-				continue;
-
-			if (resId != 0)
-				*resId = ptr->id;
-
-			*resIndex = i;
-			return ptr->key;
-		} else {
-			if ((ptr->flags & 0xFF00) != 0)
-				continue;
-
-			if (((ptr->flags & 0xF) != 1) && ((ptr->flags & 0xF) != 2))
-				continue;
-
-			if ((((ptr->flags & 0xF0) >> 4) != (_mouseButtons - 1))
-					&& (((ptr->flags & 0xF0) >> 4) != 2))
-				continue;
-
-			if ((_vm->_global->_inter_mouseX < ptr->left) ||
-			    (_vm->_global->_inter_mouseX > ptr->right) ||
-			    (_vm->_global->_inter_mouseY < ptr->top) ||
-			    (_vm->_global->_inter_mouseY > ptr->bottom))
-				continue;
-
-			if (resId != 0)
-				*resId = ptr->id;
-			*resIndex = i;
-			return ptr->key;
-		}
-	}
-
-	if ((_mouseButtons != 1) && (all == 0))
-		return 0x11B;
-
-	return 0;
-}
-
-} // End of namespace Gob

Deleted: scummvm/branches/gsoc2009-16bit/engines/gob/game_v2.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/game_v2.cpp	2009-07-06 06:24:04 UTC (rev 42164)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/game_v2.cpp	2009-07-06 06:34:40 UTC (rev 42165)
@@ -1,1563 +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.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/endian.h"
-#include "common/stream.h"
-
-#include "gob/gob.h"
-#include "gob/game.h"
-#include "gob/helper.h"
-#include "gob/global.h"
-#include "gob/util.h"
-#include "gob/dataio.h"
-#include "gob/script.h"
-#include "gob/resources.h"
-#include "gob/draw.h"
-#include "gob/goblin.h"
-#include "gob/inter.h"
-#include "gob/mult.h"
-#include "gob/scenery.h"
-#include "gob/video.h"
-#include "gob/videoplayer.h"
-#include "gob/sound/sound.h"
-
-namespace Gob {
-
-Game_v2::Game_v2(GobEngine *vm) : Game_v1(vm) {
-}
-
-void Game_v2::playTot(int16 skipPlay) {
-	char savedTotName[20];
-	int16 *oldCaptureCounter;
-	int16 *oldBreakFrom;
-	int16 *oldNestLevel;
-	int16 _captureCounter;
-	int16 breakFrom;
-	int16 nestLevel;
-
-	oldNestLevel = _vm->_inter->_nestLevel;
-	oldBreakFrom = _vm->_inter->_breakFromLevel;
-	oldCaptureCounter = _vm->_scenery->_pCaptureCounter;
-
-	_script->push();
-
-	_vm->_inter->_nestLevel = &nestLevel;
-	_vm->_inter->_breakFromLevel = &breakFrom;
-	_vm->_scenery->_pCaptureCounter = &_captureCounter;
-	strcpy(savedTotName, _curTotFile);
-
-	if (skipPlay <= 0) {
-		while (!_vm->shouldQuit()) {
-			if (_vm->_inter->_variables)
-				_vm->_draw->animateCursor(4);
-
-			if (skipPlay != -1) {
-				_vm->_inter->initControlVars(1);
-
-				for (int i = 0; i < 4; i++) {
-					_vm->_draw->_fontToSprite[i].sprite = -1;
-					_vm->_draw->_fontToSprite[i].base = -1;
-					_vm->_draw->_fontToSprite[i].width = -1;
-					_vm->_draw->_fontToSprite[i].height = -1;
-				}
-
-				_vm->_mult->initAll();
-				_vm->_mult->zeroMultData();
-
-				_vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface;
-				_vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface;
-				_vm->_draw->_cursorSpritesBack = _vm->_draw->_cursorSprites;
-			} else
-				_vm->_inter->initControlVars(0);
-
-			_vm->_draw->_cursorHotspotXVar = -1;
-			_totToLoad[0] = 0;
-
-			if ((_curTotFile[0] == 0) && (!_script->isLoaded()))
-				break;
-
-			if (skipPlay == -2) {
-				_vm->_vidPlayer->primaryClose();
-				skipPlay = 0;
-			}
-
-			if (!_script->load(_curTotFile)) {
-				_vm->_draw->blitCursor();
-				_vm->_inter->_terminate = 2;
-				break;
-			}
-
-			_resources->load(_curTotFile);
-
-			_vm->_global->_inter_animDataSize = _script->getAnimDataSize();
-			if (!_vm->_inter->_variables)
-				_vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
-
-			_script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart));
-
-			_vm->_inter->renewTimeInVars();
-
-			WRITE_VAR(13, _vm->_global->_useMouse);
-			WRITE_VAR(14, _vm->_global->_soundFlags);
-			WRITE_VAR(15, _vm->_global->_fakeVideoMode);
-			WRITE_VAR(16, _vm->_global->_language);
-
-			_vm->_inter->callSub(2);
-
-			if (_totToLoad[0] != 0)
-				_vm->_inter->_terminate = 0;
-
-			_vm->_draw->blitInvalidated();
-
-			_script->unload();
-
-			_resources->unload();
-
-			for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
-				capturePop(0);
-
-			if (skipPlay != -1) {
-				_vm->_goblin->freeObjects();
-
-				_vm->_sound->blasterStop(0);
-
-				for (int i = 0; i < Sound::kSoundsCount; i++) {
-					SoundDesc *sound = _vm->_sound->sampleGetBySlot(i);
-
-					if (sound &&
-					   ((sound->getType() == SOUND_SND) || (sound->getType() == SOUND_WAV)))
-						_vm->_sound->sampleFree(sound);
-				}
-			}
-
-			if (_totToLoad[0] == 0)
-				break;
-
-			strcpy(_curTotFile, _totToLoad);
-		}
-	} else {
-		_vm->_inter->initControlVars(0);
-		_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
-		_script->seek(_script->getFunctionOffset(skipPlay + 1));
-
-		_menuLevel++;
-		_vm->_inter->callSub(2);
-		_menuLevel--;
-
-		if (_vm->_inter->_terminate != 0)
-			_vm->_inter->_terminate = 2;
-	}
-
-	strcpy(_curTotFile, savedTotName);
-
-	_vm->_inter->_nestLevel = oldNestLevel;
-	_vm->_inter->_breakFromLevel = oldBreakFrom;
-	_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
-
-	_script->pop();
-}
-
-void Game_v2::clearCollisions() {
-	_lastCollKey = 0;
-
-	for (int i = 0; i < 150; i++)
-		_collisionAreas[i].left = 0xFFFF;
-}
-
-int16 Game_v2::addNewCollision(int16 id, uint16 left, uint16 top,
-		uint16 right, uint16 bottom, int16 flags, int16 key,
-		uint16 funcEnter, uint16 funcLeave, uint16 funcSub) {
-	Collision *ptr;
-
-	debugC(5, kDebugCollisions, "addNewCollision");
-	debugC(5, kDebugCollisions, "id = %X", id);
-	debugC(5, kDebugCollisions, "left = %d, top = %d, right = %d, bottom = %d",
-			left, top, right, bottom);
-	debugC(5, kDebugCollisions, "flags = %X, key = %X", flags, key);
-	debugC(5, kDebugCollisions, "funcEnter = %d, funcLeave = %d",
-			funcEnter, funcLeave);
-
-	for (int i = 0; i < 150; i++) {
-		if ((_collisionAreas[i].left != 0xFFFF) && (_collisionAreas[i].id != id))
-			continue;
-
-		ptr = &_collisionAreas[i];
-		ptr->id = id;
-		ptr->left = left;
-		ptr->top = top;
-		ptr->right = right;
-		ptr->bottom = bottom;
-		ptr->flags = flags;
-		ptr->key = key;
-		ptr->funcEnter = funcEnter;
-		ptr->funcLeave = funcLeave;
-		ptr->funcSub = funcSub;
-		ptr->script = 0;
-
-		return i;
-	}
-	error("Game_v2::addNewCollision(): Collision array full");
-	return 0;
-}
-
-void Game_v2::pushCollisions(char all) {
-	Collision *srcPtr;
-	Collision *destPtr;
-	int16 size;
-
-	debugC(1, kDebugCollisions, "pushCollisions");
-	for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++)
-		if (all || (((uint16) srcPtr->id) >= 20))
-			size++;
-
-	destPtr = new Collision[size];
-	_collStack[_collStackSize] = destPtr;
-
-	if (_vm->_inter->_terminate)
-		return;
-
-	_collStackElemSizes[_collStackSize] = size;
-
-	if (_shouldPushColls != 0)
-		_collStackElemSizes[_collStackSize] |= 0x8000;
-
-	_shouldPushColls = 0;
-	_collLasts[_collStackSize].key = _lastCollKey;
-	_collLasts[_collStackSize].id = _lastCollId;
-	_collLasts[_collStackSize].areaIndex = _lastCollAreaIndex;
-	_lastCollKey = 0;
-	_lastCollId = 0;
-	_lastCollAreaIndex = 0;
-	_collStackSize++;
-
-	for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) {
-		if (all || (((uint16) srcPtr->id) >= 20)) {
-			memcpy(destPtr, srcPtr, sizeof(Collision));
-			srcPtr->left = 0xFFFF;
-			destPtr++;
-		}
-	}
-}
-
-void Game_v2::popCollisions(void) {
-	Collision *destPtr;
-	Collision *srcPtr;
-
-	debugC(1, kDebugCollisions, "popCollision");
-
-	_collStackSize--;
-
-	_shouldPushColls = _collStackElemSizes[_collStackSize] & 0x8000 ? 1 : 0;
-	_collStackElemSizes[_collStackSize] &= 0x7FFF;
-
-	_lastCollKey = _collLasts[_collStackSize].key;
-	_lastCollId = _collLasts[_collStackSize].id;
-	_lastCollAreaIndex = _collLasts[_collStackSize].areaIndex;
-
-	for (destPtr = _collisionAreas; destPtr->left != 0xFFFF; destPtr++)
-		;
-
-	srcPtr = _collStack[_collStackSize];
-	memcpy(destPtr, srcPtr,
-			_collStackElemSizes[_collStackSize] * sizeof(Collision));
-
-	delete[] _collStack[_collStackSize];
-}
-
-int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId,
-	    int16 *pResIndex) {
-	int16 resIndex;
-	int16 key;
-	int16 oldIndex;
-	int16 oldId;
-	int16 newkey;
-	uint32 timeKey;
-
-	_scrollHandleMouse = handleMouse != 0;
-
-	if (deltaTime >= -1) {
-		_lastCollKey = 0;
-		_lastCollAreaIndex = 0;
-		_lastCollId = 0;
-	}
-
-	if (pResId != 0)
-		*pResId = 0;
-
-	resIndex = 0;
-
-	if ((_vm->_draw->_cursorIndex == -1) &&
-			(handleMouse != 0) && (_lastCollKey == 0)) {
-		_lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-		if ((_lastCollKey != 0) && (_lastCollId & 0x8000))
-			collAreaSub(_lastCollAreaIndex, 1);
-	}
-
-	if (handleMouse != 0)
-		_vm->_draw->animateCursor(-1);
-
-	timeKey = _vm->_util->getTimeKey();
-	while (1) {
-		if (_vm->_inter->_terminate || _vm->shouldQuit()) {
-			if (handleMouse)
-				_vm->_draw->blitCursor();
-			return 0;
-		}
-
-		if (!_vm->_draw->_noInvalidated) {
-			if (handleMouse != 0)
-				_vm->_draw->animateCursor(-1);
-			else
-				_vm->_draw->blitInvalidated();
-			_vm->_video->waitRetrace();
-		}
-
-		key = checkKeys(&_vm->_global->_inter_mouseX,
-				&_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse);
-
-		if ((handleMouse == 0) && (_mouseButtons != 0)) {
-			_vm->_util->waitMouseRelease(0);
-			key = 3;
-		}
-
-		if (key != 0) {
-
-			if (handleMouse & 1)
-				_vm->_draw->blitCursor();
-
-			if (pResId != 0)
-				*pResId = 0;
-
-			if (pResIndex != 0)
-				*pResIndex = 0;
-
-			if (_lastCollKey != 0)
-				collAreaSub(_lastCollAreaIndex, 0);
-
-			_lastCollKey = 0;
-			if (key != 0)
-				return key;
-		}
-
-		if (handleMouse != 0) {
-			if (_mouseButtons != 0) {
-				if (deltaTime > 0) {
-					_vm->_draw->animateCursor(2);
-					_vm->_util->delay(deltaTime);
-				} else if (handleMouse & 1)
-					_vm->_util->waitMouseRelease(1);
-				_vm->_draw->animateCursor(-1);
-
-				if (pResId != 0)
-					*pResId = 0;
-
-				key = checkMousePoint(0, pResId, &resIndex);
-				if (pResIndex != 0)
-					*pResIndex = resIndex;
-
-				if ((key != 0) || ((pResId != 0) && (*pResId != 0))) {
-					if ((handleMouse & 1) &&
-							((deltaTime <= 0) || (_mouseButtons == 0)))
-						_vm->_draw->blitCursor();
-
-					if ((_lastCollKey != 0) && (key != _lastCollKey))
-						collAreaSub(_lastCollAreaIndex, 0);
-
-					_lastCollKey = 0;
-					return key;
-				}
-
-				if (handleMouse & 4)
-					return 0;
-
-				if (_lastCollKey != 0)
-					collAreaSub(_lastCollAreaIndex, 0);
-
-				_lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-				if ((_lastCollKey != 0) && (_lastCollId & 0x8000))
-					collAreaSub(_lastCollAreaIndex, 1);
-			} else if ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) ||
-					(_vm->_global->_inter_mouseY != _vm->_draw->_cursorY)) {
-
-				oldIndex = _lastCollAreaIndex;
-				oldId = _lastCollId;
-				newkey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
-
-				if (newkey != _lastCollKey) {
-					if ((_lastCollKey != 0) && (oldId & 0x8000))
-						collAreaSub(oldIndex, 0);
-
-					_lastCollKey = newkey;
-
-					if ((newkey != 0) && (_lastCollId & 0x8000))
-						collAreaSub(_lastCollAreaIndex, 1);
-				}
-			}
-		}
-
-		if ((deltaTime < 0) && (key == 0) && (_mouseButtons == 0)) {
-			uint32 curtime = _vm->_util->getTimeKey();
-			if ((curtime + deltaTime) > timeKey) {
-				if (pResId != 0)
-					*pResId = 0;
-
-				if (pResIndex != 0)
-					*pResIndex = 0;
-
-				return 0;
-			}
-		}
-
-		if (handleMouse != 0)
-			_vm->_draw->animateCursor(-1);
-
-		_vm->_util->delay(10);
-	}
-}
-
-void Game_v2::prepareStart(void) {
-	clearCollisions();
-
-	_vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2;
-	_vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1;
-	_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
-
-	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
-
-	_vm->_draw->initScreen();
-	_vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0,

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list