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
........

svn-id: r42165
This commit is contained in:
Travis Howell 2009-07-06 06:34:40 +00:00
commit f63b02b920
77 changed files with 3643 additions and 5769 deletions

View file

@ -26,7 +26,12 @@ CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
# 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

View file

@ -99,7 +99,7 @@ private:
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);

View file

@ -194,7 +194,7 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys
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 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys
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();
};

View file

@ -285,11 +285,8 @@ void OSystem_Dreamcast::setShakePos(int shake_pos)
_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,6 +325,12 @@ void OSystem_Dreamcast::updateScreen(void)
_overlay_dirty = false;
}
}
void OSystem_Dreamcast::updateScreenPolygons(void)
{
struct polygon_list mypoly;
struct packed_colour_vertex_list myvertex;
// *((volatile unsigned int *)(void*)0xa05f8040) = 0x00ff00;
@ -448,6 +451,21 @@ void OSystem_Dreamcast::updateScreen(void)
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,

View file

@ -202,6 +202,8 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)
if (((int)(t-_devpoll))>=0)
_devpoll = t + USEC_TO_TIMER(17000);
maybeRefreshScreen();
int mask = getimask();
setimask(15);
checkSound();

View file

@ -172,24 +172,6 @@
<File
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>
@ -229,24 +211,18 @@
<File
RelativePath="..\..\engines\gob\driver_vga.h">
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp">
</File>
<File
RelativePath="..\..\engines\gob\expression.h">
</File>
<File
RelativePath="..\..\engines\gob\game.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game.h">
</File>
<File
RelativePath="..\..\engines\gob\game_fascin.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game_v1.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game_v2.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\global.cpp">
</File>
@ -280,6 +256,12 @@
<File
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>
@ -295,6 +277,9 @@
<File
RelativePath="..\..\engines\gob\init_v3.cpp">
</File>
<File
RelativePath="..\..\engines\gob\init_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\inter.cpp">
</File>
@ -359,47 +344,17 @@
RelativePath="..\..\engines\gob\palanim.h">
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp">
RelativePath="..\..\engines\gob\resources.cpp">
</File>
<File
RelativePath="..\..\engines\gob\expression.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.h">
RelativePath="..\..\engines\gob\resources.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp">
</File>
@ -412,6 +367,36 @@
<File
RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\scenery.cpp">
</File>
@ -430,6 +415,18 @@
<File
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>

View file

@ -186,24 +186,6 @@
<File
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>
@ -243,24 +225,18 @@
<File
RelativePath="..\..\engines\gob\driver_vga.h">
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp">
</File>
<File
RelativePath="..\..\engines\gob\expression.h">
</File>
<File
RelativePath="..\..\engines\gob\game.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game.h">
</File>
<File
RelativePath="..\..\engines\gob\game_fascin.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game_v1.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game_v2.cpp">
</File>
<File
RelativePath="..\..\engines\gob\game_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\global.cpp">
</File>
@ -294,6 +270,12 @@
<File
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>
@ -309,6 +291,9 @@
<File
RelativePath="..\..\engines\gob\init_v3.cpp">
</File>
<File
RelativePath="..\..\engines\gob\init_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\inter.cpp">
</File>
@ -373,47 +358,17 @@
RelativePath="..\..\engines\gob\palanim.h">
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp">
RelativePath="..\..\engines\gob\resources.cpp">
</File>
<File
RelativePath="..\..\engines\gob\expression.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.h">
RelativePath="..\..\engines\gob\resources.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp">
</File>
@ -426,6 +381,36 @@
<File
RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.h">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.h">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v2.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v3.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v4.cpp">
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v6.cpp">
</File>
<File
RelativePath="..\..\engines\gob\scenery.cpp">
</File>
@ -444,6 +429,18 @@
<File
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>

View file

@ -258,30 +258,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"
>
@ -334,6 +310,14 @@
RelativePath="..\..\engines\gob\driver_vga.h"
>
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\expression.h"
>
</File>
<File
RelativePath="..\..\engines\gob\game.cpp"
>
@ -342,22 +326,6 @@
RelativePath="..\..\engines\gob\game.h"
>
</File>
<File
RelativePath="..\..\engines\gob\game_fascin.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\game_v1.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\game_v2.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\game_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\global.cpp"
>
@ -402,6 +370,14 @@
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"
>
@ -422,6 +398,10 @@
RelativePath="..\..\engines\gob\init_v3.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\init_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\inter.cpp"
>
@ -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
@ -602,6 +582,22 @@
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"
>

View file

@ -259,30 +259,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"
>
@ -335,6 +311,14 @@
RelativePath="..\..\engines\gob\driver_vga.h"
>
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\expression.h"
>
</File>
<File
RelativePath="..\..\engines\gob\game.cpp"
>
@ -343,22 +327,6 @@
RelativePath="..\..\engines\gob\game.h"
>
</File>
<File
RelativePath="..\..\engines\gob\game_fascin.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\game_v1.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\game_v2.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\game_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\global.cpp"
>
@ -403,6 +371,14 @@
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"
>
@ -423,6 +399,10 @@
RelativePath="..\..\engines\gob\init_v3.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\init_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\inter.cpp"
>
@ -508,61 +488,21 @@
>
</File>
<File
RelativePath="..\..\engines\gob\expression.cpp"
RelativePath="..\..\engines\gob\resources.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\expression.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v2.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v3.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v4.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.h"
RelativePath="..\..\engines\gob\resources.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp"
>
@ -579,6 +519,46 @@
RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savefile.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\savehandler.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload.h"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v2.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v3.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v4.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\save\saveload_v6.cpp"
>
</File>
<File
RelativePath="..\..\engines\gob\scenery.cpp"
>
@ -603,6 +583,22 @@
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"
>

View file

@ -209,7 +209,7 @@ int setNodeState(int nodeIdx, int nodeState) {
int oldState = walkboxState[nodeIdx];
if (nodeState == -1)
return
return oldState;
walkboxState[nodeIdx] = nodeState;

View file

@ -242,7 +242,7 @@ int32 prepareWordRender(int32 inRightBorder_X, int16 wordSpacingWidth,
if (character == '|' || !character) {
finish = 1;
} else {
if (charData) {
if (charData >= 0) {
if (pixelCount + wordSpacingWidth +
(int16)fontData[charData].charWidth >= inRightBorder_X) {
finish = 1;

View file

@ -828,7 +828,7 @@ int16 Op_Preload(void) {
}
int16 Op_LoadCt(void) {
return initCt((char*)popPtr());
return initCt((const char *)popPtr());
}
int16 Op_EndAnim(void) {

View file

@ -222,7 +222,7 @@ void DemoPlayer::playVideoDoubled() {
int16 key;
bool end = false;
while (_vm->_util->checkKey(key))
if (key == 0x011B)
if (key == kKeyEscape)
end = true;
if (end)
break;

View file

@ -360,9 +360,9 @@ int Draw::stringLength(const char *str, int16 fontIndex) {
} 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 @@ void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 col
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 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right,
_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;

View file

@ -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 @@ Draw_v1::Draw_v1(GobEngine *vm) : Draw(vm) {
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::blitCursor() {
}
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 @@ void Draw_v1::animateCursor(int16 cursor) {
_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 @@ void Draw_v1::printTotText(int16 id) {
_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)--;

View file

@ -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::blitCursor() {
}
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 @@ void Draw_v2::animateCursor(int16 cursor) {
// .-- _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 @@ void Draw_v2::printTotText(int16 id) {
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 @@ void Draw_v2::printTotText(int16 id) {
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 @@ void Draw_v2::printTotText(int16 id) {
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 @@ void Draw_v2::spriteOperation(int16 operation) {
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 @@ void Draw_v2::spriteOperation(int16 operation) {
_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

View file

@ -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 @@ bool Environments::has(Resources *resources, uint8 startEnv, int16 except) const
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 @@ Game::Game(GobEngine *vm) : _vm(vm) {
_preventScroll = false;
_scrollHandleMouse = false;
_noCd = false;
_tempStr[0] = 0;
_collStr[0] = 0;
_numEnvironments = 0;
_curEnvironment = 0;
@ -212,19 +194,181 @@ Game::Game(GobEngine *vm) : _vm(vm) {
_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) {
@ -349,7 +493,7 @@ void Game::evaluateScroll(int16 x, int16 y) {
}
int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY,
int16 *pButtons, char handleMouse) {
MouseButtons *pButtons, char handleMouse) {
_vm->_util->processInput(true);
@ -373,28 +517,17 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY,
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::start(void) {
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 @@ void Game::totSub(int8 flags, const char *newTotFile) {
_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 @@ void Game::totSub(int8 flags, const char *newTotFile) {
return;
}
pushCollisions(0);
_hotspots->push(0, true);
if (flags & 2)
playTot(-1);
@ -441,7 +578,8 @@ void Game::totSub(int8 flags, const char *newTotFile) {
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 @@ void Game::switchTotSub(int16 index, int16 skipPlay) {
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 @@ void Game::switchTotSub(int16 index, int16 skipPlay) {
_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 @@ void Game::clearUnusedEnvironment() {
delete _resources;
_resources = 0;
}
}
} // End of namespace Gob

View file

@ -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 @@ private:
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;
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 @@ public:
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 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;
void totSub(int8 flags, const char *newTotFile);
void switchTotSub(int16 index, int16 skipPlay);
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 @@ protected:
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

View file

@ -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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -123,6 +123,8 @@ Global::Global(GobEngine *vm) : _vm(vm) {
_inter_mouseY = 0;
_speedFactor = 1;
_noCd = false;
}
Global::~Global() {

View file

@ -141,6 +141,8 @@ public:
// Can be 1, 2 or 3 for normal, double and triple speed, respectively
uint8 _speedFactor;
bool _noCd;
Global(GobEngine *vm);
~Global();

View file

@ -126,7 +126,7 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst) {
Common::addDebugChannel(kDebugSaveLoad, "SaveLoad", "Saving/Loading debug level");
Common::addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
Common::addDebugChannel(kDebugVideo, "Video", "IMD/VMD video debug level");
Common::addDebugChannel(kDebugCollisions, "Collisions", "Collisions debug level");
Common::addDebugChannel(kDebugHotspots, "Hotspots", "Hotspots debug level");
Common::addDebugChannel(kDebugDemo, "Demo", "Demo script debug level");
syst->getEventManager()->registerRandomSource(_rnd, "gob");
@ -331,6 +331,7 @@ bool GobEngine::initGameParts() {
_palAnim = new PalAnim(this);
_vidPlayer = new VideoPlayer(this);
_sound = new Sound(this);
_game = new Game(this);
switch (_gameType) {
case kGameTypeGeisha:
@ -341,7 +342,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v1(this);
_mult = new Mult_v1(this);
_draw = new Draw_v1(this);
_game = new Game_v1(this);
_map = new Map_v1(this);
_goblin = new Goblin_v1(this);
_scenery = new Scenery_v1(this);
@ -353,7 +353,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_Fascination(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_Fascination(this);
_map = new Map_v2(this);
_goblin = new Goblin_v2(this);
_scenery = new Scenery_v2(this);
@ -367,7 +366,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v2(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_v2(this);
_map = new Map_v2(this);
_goblin = new Goblin_v2(this);
_scenery = new Scenery_v2(this);
@ -380,7 +378,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_Bargon(this);
_mult = new Mult_v2(this);
_draw = new Draw_Bargon(this);
_game = new Game_v2(this);
_map = new Map_v2(this);
_goblin = new Goblin_v2(this);
_scenery = new Scenery_v2(this);
@ -394,7 +391,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v3(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_v2(this);
_map = new Map_v2(this);
_goblin = new Goblin_v3(this);
_scenery = new Scenery_v2(this);
@ -407,7 +403,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v3(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_v2(this);
_map = new Map_v2(this);
_goblin = new Goblin_v3(this);
_scenery = new Scenery_v2(this);
@ -420,7 +415,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v4(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_v2(this);
_map = new Map_v4(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
@ -436,7 +430,6 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v5(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_v2(this);
_map = new Map_v4(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
@ -445,12 +438,11 @@ bool GobEngine::initGameParts() {
case kGameTypeAdibou4:
case kGameTypeUrban:
_init = new Init_v3(this);
_init = new Init_v6(this);
_video = new Video_v6(this);
_inter = new Inter_v6(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
_game = new Game_v6(this);
_map = new Map_v4(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);

View file

@ -133,7 +133,7 @@ enum {
kDebugSaveLoad = 1 << 7,
kDebugGraphics = 1 << 8,
kDebugVideo = 1 << 9,
kDebugCollisions = 1 << 10,
kDebugHotspots = 1 << 10,
kDebugDemo = 1 << 11
};

1928
engines/gob/hotspots.cpp Normal file

File diff suppressed because it is too large Load diff

241
engines/gob/hotspots.h Normal file
View file

@ -0,0 +1,241 @@
/* 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$
*
*/
#ifndef GOB_HOTSPOTS_H
#define GOB_HOTSPOTS_H
#include "common/stack.h"
#include "gob/util.h"
namespace Gob {
class Script;
class Hotspots {
public:
static const int kHotspotCount = 250;
enum Type {
kTypeNone = 0,
kTypeMove = 1,
kTypeClick = 2,
kTypeInput1NoLeave = 3,
kTypeInput1Leave = 4,
kTypeInput2NoLeave = 5,
kTypeInput2Leave = 6,
kTypeInput3NoLeave = 7,
kTypeInput3Leave = 8,
kTypeInputFloatNoLeave = 9,
kTypeInputFloatLeave = 10,
kTypeEnable2 = 11,
kTypeEnable1 = 12,
kTypeClickEnter = 21
};
enum State {
kStateFilledDisabled = 0xC,
kStateFilled = 0x8,
kStateDisabled = 0x4,
kStateType2 = 0x2,
kStateType1 = 0x1
};
Hotspots(GobEngine *vm);
~Hotspots();
/** Remove all hotspots. */
void clear();
/** Add a hotspot, returning the new index. */
uint16 add(uint16 id,
uint16 left, uint16 top, uint16 right, uint16 bottom,
uint16 flags, uint16 key,
uint16 funcEnter, uint16 funcLeave, uint16 funcPos);
/** Remove a specific hotspot. */
void remove(uint16 id);
/** Remove all hotspots in this state. */
void removeState(uint8 state);
/** Push the current hotspots onto the stack.
*
* @param all 0: Don't push global ones; 1: Push all; 2: Push only the disabled ones
* @param force Force a push although _shouldPush is false
*/
void push(uint8 all, bool force = false);
/** Pop hotspots from the stack. */
void pop();
/** Check the current hotspot. */
uint16 check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index);
/** Check the current hotspot. */
uint16 check(uint8 handleMouse, int16 delay);
/** Evaluate hotspot changes. */
void evaluate();
/** Return the cursor found in the hotspot to the coordinates. */
int16 findCursor(uint16 x, uint16 y) const;
private:
struct Hotspot {
uint16 id;
uint16 left;
uint16 top;
uint16 right;
uint16 bottom;
uint16 flags;
uint16 key;
uint16 funcEnter;
uint16 funcLeave;
uint16 funcPos;
Script *script;
Hotspot();
Hotspot(uint16 i,
uint16 l, uint16 t, uint16 r, uint16 b, uint16 f, uint16 k,
uint16 enter, uint16 leave, uint16 pos);
void clear();
Type getType() const;
MouseButtons getButton() const;
uint8 getWindow() const;
uint8 getCursor() const;
uint8 getState() const;
/** Is this hotspot the block end marker? */
bool isEnd() const;
bool isInput() const;
bool isActiveInput() const;
bool isFilled() const;
bool isFilledEnabled() const;
bool isFilledNew() const;
bool isDisabled() const;
/** Are the specified coordinates in the hotspot? */
bool isIn(uint16 x, uint16 y) const;
/** Does the specified button trigger the hotspot? */
bool buttonMatch(MouseButtons button) const;
static uint8 getState(uint16 id);
void disable();
void enable();
};
struct StackEntry {
bool shouldPush;
Hotspot *hotspots;
uint32 size;
uint32 key;
uint32 id;
uint32 index;
};
struct InputDesc {
uint16 fontIndex;
uint16 backColor;
uint16 frontColor;
uint16 length;
const char *str;
};
GobEngine *_vm;
Hotspot *_hotspots;
Common::Stack<StackEntry> _stack;
bool _shouldPush;
uint16 _currentKey;
uint16 _currentIndex;
uint16 _currentId;
/** Add a hotspot, returning the new index. */
uint16 add(const Hotspot &hotspot);
/** Recalculate all hotspot parameters
*
* @param force Force recalculation of all hotspots, including global ones.
*/
void recalculate(bool force);
/** Is this a valid hotspot? */
bool isValid(uint16 key, uint16 id, uint16 index) const;
/** Call a hotspot subroutine. */
void call(uint16 offset);
/** Handling hotspot enter events. */
void enter(uint16 index);
/** Handling hotspot leave events. */
void leave(uint16 index);
/** Which hotspot is the mouse cursor currently at? */
uint16 checkMouse(Type type, uint16 &id, uint16 &index) const;
/** Did the current hotspot change in the meantime? */
bool checkHotspotChanged();
/** Update events from a specific input. */
uint16 updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 height,
uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex,
Type type, int16 &duration, uint16 &id, uint16 &index);
/** Handle all inputs we currently manage. */
uint16 handleInputs(int16 time, uint16 inputCount, uint16 &curInput,
InputDesc *inputs, uint16 &id, uint16 &index);
/** Evaluate adding new hotspots script commands. */
void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
uint16 &validId, bool &hasInput, uint16 &inputCount);
/** Find the hotspot index that corresponds to the input index. */
uint16 inputToHotspot(uint16 input) const;
/** Find the input index that corresponds to the hotspot index. */
uint16 hotspotToInput(uint16 hotspot) const;
/** Find the input that was clicked on. */
uint16 findClickedInput(uint16 index) const;
/** Calculate the graphical cursor position. */
void getTextCursorPos(const Video::FontDesc &font, const char *str,
uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height,
uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const;
/** Fill that rectangle with the color. */
void fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const;
/** Print the given text. */
void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const;
/** Go through all inputs we manage and redraw their texts. */
void updateAllTexts(const InputDesc *inputs) const;
};
} // End of namespace Gob
#endif // GOB_HOTSPOTS_H

View file

@ -32,7 +32,7 @@ namespace Gob {
class Init {
public:
void initGame();
virtual void initGame();
virtual void initVideo() = 0;
@ -72,6 +72,14 @@ public:
virtual ~Init_v3() {}
};
class Init_v6 : public Init_v3 {
public:
virtual void initGame();
Init_v6(GobEngine *vm);
virtual ~Init_v6() {}
};
} // End of namespace Gob
#endif // GOB_INIT_H

48
engines/gob/init_v6.cpp Normal file
View file

@ -0,0 +1,48 @@
/* 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 "gob/gob.h"
#include "gob/init.h"
#include "gob/global.h"
namespace Gob {
Init_v6::Init_v6(GobEngine *vm) : Init_v3(vm) {
}
void Init_v6::initGame() {
_vm->_global->_noCd = false;
if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") &&
Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) {
_vm->_global->_noCd = true;
}
Init::initGame();
}
} // End of namespace Gob

View file

@ -35,6 +35,7 @@
#include "gob/game.h"
#include "gob/expression.h"
#include "gob/script.h"
#include "gob/hotspots.h"
#include "gob/scenery.h"
#include "gob/sound/sound.h"
@ -180,7 +181,7 @@ void Inter::storeMouse() {
WRITE_VAR(2, x);
WRITE_VAR(3, y);
WRITE_VAR(4, _vm->_game->_mouseButtons);
WRITE_VAR(4, (uint32) _vm->_game->_mouseButtons);
}
void Inter::storeKey(int16 key) {
@ -189,20 +190,20 @@ void Inter::storeKey(int16 key) {
storeMouse();
WRITE_VAR(1, _vm->_sound->blasterPlayingSound());
if (key == 0x4800)
key = 0x0B;
else if (key == 0x5000)
key = 0x0A;
else if (key == 0x4D00)
key = 0x09;
else if (key == 0x4B00)
key = 0x08;
else if (key == 0x011B)
key = 0x1B;
else if (key == 0x0E08)
key = 0x19;
else if (key == 0x5300)
key = 0x1A;
if (key == kKeyUp)
key = kShortKeyUp;
else if (key == kKeyDown)
key = kShortKeyDown;
else if (key == kKeyRight)
key = kShortKeyRight;
else if (key == kKeyLeft)
key = kShortKeyLeft;
else if (key == kKeyEscape)
key = kShortKeyEscape;
else if (key == kKeyBackspace)
key = kShortKeyBackspace;
else if (key == kKeyDelete)
key = kShortKeyDelete;
else if ((key & 0xFF) != 0)
key &= 0xFF;
@ -334,7 +335,7 @@ void Inter::callSub(int16 retFlag) {
if (block == 1)
funcBlock(retFlag);
else if (block == 2)
_vm->_game->collisionsBlock();
_vm->_game->_hotspots->evaluate();
else
error("Unknown block type %d in Inter::callSub()", block);
}

View file

@ -238,7 +238,7 @@ protected:
bool o1_playComposition(OpFuncParams &params);
bool o1_getFreeMem(OpFuncParams &params);
bool o1_checkData(OpFuncParams &params);
bool o1_prepareStr(OpFuncParams &params);
bool o1_cleanupStr(OpFuncParams &params);
bool o1_insertStr(OpFuncParams &params);
bool o1_cutStr(OpFuncParams &params);
bool o1_strstr(OpFuncParams &params);
@ -380,8 +380,8 @@ protected:
bool o2_assign(OpFuncParams &params);
bool o2_printText(OpFuncParams &params);
bool o2_animPalInit(OpFuncParams &params);
bool o2_addCollision(OpFuncParams &params);
bool o2_freeCollision(OpFuncParams &params);
bool o2_addHotspot(OpFuncParams &params);
bool o2_removeHotspot(OpFuncParams &params);
bool o2_goblinFunc(OpFuncParams &params);
bool o2_stopSound(OpFuncParams &params);
bool o2_loadSound(OpFuncParams &params);
@ -541,7 +541,7 @@ protected:
bool o6_loadCursor(OpFuncParams &params);
bool o6_assign(OpFuncParams &params);
bool o6_palLoad(OpFuncParams &params);
bool o6_freeCollision(OpFuncParams &params);
bool o6_removeHotspot(OpFuncParams &params);
bool o6_fillRect(OpFuncParams &params);
void probe16bitMusic(char *fileName);

View file

@ -89,7 +89,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
int i;
int16 mouseX;
int16 mouseY;
int16 buttons;
MouseButtons buttons;
SurfaceDescPtr surface;
SoundDesc samples[4];
int16 comp[5] = { 0, 1, 2, 3, -1 };
@ -107,13 +107,13 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
for (i = 320; i >= 0; i--) {
_vm->_util->setScrollOffset(i, 0);
_vm->_video->dirtyRectsAll();
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) ||
_vm->shouldQuit()) {
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(*_vm->_draw->_frontSurface);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
WRITE_VAR(4, buttons);
WRITE_VAR(0, 0x11B);
WRITE_VAR(0, kKeyEscape);
WRITE_VAR(57, (uint32) -1);
break;
}
@ -137,7 +137,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
int16 mouseX;
int16 mouseY;
int16 buttons;
MouseButtons buttons;
Video::Color *palBak;
SoundDesc samples[2];
int16 comp[3] = { 0, 1, -1 };
@ -158,14 +158,14 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
_vm->_util->longDelay(_vm->_util->getRandom(200));
}
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) ||
_vm->shouldQuit()) {
_vm->_sound->blasterStop(10);
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(*_vm->_draw->_frontSurface);
memset(_vm->_draw->_vgaPalette, 0, 768);
WRITE_VAR(4, buttons);
WRITE_VAR(0, 0x11B);
WRITE_VAR(0, kKeyEscape);
WRITE_VAR(57, (uint32) -1);
break;
}

View file

@ -37,6 +37,7 @@
#include "gob/expression.h"
#include "gob/script.h"
#include "gob/resources.h"
#include "gob/hotspots.h"
#include "gob/goblin.h"
#include "gob/inter.h"
#include "gob/map.h"
@ -147,7 +148,7 @@ void Inter_v1::setupOpcodesFunc() {
OPCODEFUNC(0x3E, o1_getFreeMem);
OPCODEFUNC(0x3F, o1_checkData);
OPCODEFUNC(0x41, o1_prepareStr);
OPCODEFUNC(0x41, o1_cleanupStr);
OPCODEFUNC(0x42, o1_insertStr);
OPCODEFUNC(0x43, o1_cutStr);
@ -867,6 +868,15 @@ bool Inter_v1::o1_loadSpriteToPos(OpFuncParams &params) {
_vm->_draw->_spriteLeft = _vm->_game->_script->readInt16();
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
// WORKAROUND: The EGA version of Gobliiins 1 has an invalid expression there
if (_vm->isEGA() && (_vm->_game->_script->pos() == 1398) &&
!scumm_stricmp(_vm->_game->_curTotFile, "intro.tot")) {
_vm->_draw->_destSpriteY = 0;
_vm->_game->_script->skip(1);
} else
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
_vm->_draw->_transparency = _vm->_game->_script->peekByte() & 1;
@ -1173,7 +1183,7 @@ bool Inter_v1::o1_keyFunc(OpFuncParams &params) {
case 0:
_vm->_draw->_showCursor &= ~2;
_vm->_util->longDelay(1);
key = _vm->_game->checkCollisions(0, 0, 0, 0);
key = _vm->_game->_hotspots->check(0, 0);
storeKey(key);
_vm->_util->clearKeyBuf();
@ -1601,11 +1611,11 @@ bool Inter_v1::o1_checkData(OpFuncParams &params) {
return false;
}
bool Inter_v1::o1_prepareStr(OpFuncParams &params) {
bool Inter_v1::o1_cleanupStr(OpFuncParams &params) {
int16 strVar;
strVar = _vm->_game->_script->readVarIndex();
_vm->_util->prepareStr(GET_VARO_FSTR(strVar));
_vm->_util->cleanupStr(GET_VARO_FSTR(strVar));
return false;
}

View file

@ -39,6 +39,7 @@
#include "gob/expression.h"
#include "gob/script.h"
#include "gob/resources.h"
#include "gob/hotspots.h"
#include "gob/goblin.h"
#include "gob/map.h"
#include "gob/mult.h"
@ -121,8 +122,8 @@ void Inter_v2::setupOpcodesFunc() {
OPCODEFUNC(0x17, o2_animPalInit);
OPCODEFUNC(0x18, o2_addCollision);
OPCODEFUNC(0x19, o2_freeCollision);
OPCODEFUNC(0x18, o2_addHotspot);
OPCODEFUNC(0x19, o2_removeHotspot);
OPCODEFUNC(0x25, o2_goblinFunc);
@ -1176,28 +1177,19 @@ bool Inter_v2::o2_animPalInit(OpFuncParams &params) {
return false;
}
bool Inter_v2::o2_addCollision(OpFuncParams &params) {
int16 id;
int16 left, top, width, height;
int16 flags;
int16 key;
int16 funcSub;
id = _vm->_game->_script->readValExpr();
funcSub = _vm->_game->_script->pos();
left = _vm->_game->_script->readValExpr();
top = _vm->_game->_script->readValExpr();
width = _vm->_game->_script->readValExpr();
height = _vm->_game->_script->readValExpr();
flags = _vm->_game->_script->readValExpr();
key = _vm->_game->_script->readInt16();
bool Inter_v2::o2_addHotspot(OpFuncParams &params) {
int16 id = _vm->_game->_script->readValExpr();
uint16 funcPos = _vm->_game->_script->pos();
int16 left = _vm->_game->_script->readValExpr();
int16 top = _vm->_game->_script->readValExpr();
uint16 width = _vm->_game->_script->readValExpr();
uint16 height = _vm->_game->_script->readValExpr();
uint16 flags = _vm->_game->_script->readValExpr();
uint16 key = _vm->_game->_script->readInt16();
if (key == 0)
key = ABS(id) + 41960;
_vm->_draw->adjustCoords(0, &left, &top);
_vm->_draw->adjustCoords(2, &width, &height);
if (left < 0) {
width += left;
left = 0;
@ -1210,33 +1202,26 @@ bool Inter_v2::o2_addCollision(OpFuncParams &params) {
int16 index;
if (id < 0)
index = _vm->_game->addNewCollision(0xD000 - id, left & 0xFFFC, top & 0xFFFC,
left + width + 3, top + height + 3, flags, key, 0, 0);
index = _vm->_game->_hotspots->add(0xD000 - id, left & 0xFFFC, top & 0xFFFC,
left + width + 3, top + height + 3, flags, key, 0, 0, funcPos);
else
index = _vm->_game->addNewCollision(0xE000 + id, left, top,
left + width - 1, top + height - 1, flags, key, 0, 0);
_vm->_game->_collisionAreas[index].funcSub = funcSub;
index = _vm->_game->_hotspots->add(0xE000 + id, left, top,
left + width - 1, top + height - 1, flags, key, 0, 0, funcPos);
return false;
}
bool Inter_v2::o2_freeCollision(OpFuncParams &params) {
int16 id;
bool Inter_v2::o2_removeHotspot(OpFuncParams &params) {
int16 id = _vm->_game->_script->readValExpr();
uint8 stateType1 = Hotspots::kStateFilledDisabled | Hotspots::kStateType1;
uint8 stateType2 = Hotspots::kStateFilledDisabled | Hotspots::kStateType2;
id = _vm->_game->_script->readValExpr();
if (id == -2) {
for (int i = 0; i < 150; i++) {
if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xD000)
_vm->_game->_collisionAreas[i].left = 0xFFFF;
}
} else if (id == -1) {
for (int i = 0; i < 150; i++) {
if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xE000)
_vm->_game->_collisionAreas[i].left = 0xFFFF;
}
} else
_vm->_game->freeCollision(0xE000 + id);
if (id == -2)
_vm->_game->_hotspots->removeState(stateType1);
else if (id == -1)
_vm->_game->_hotspots->removeState(stateType2);
else
_vm->_game->_hotspots->remove((stateType2 << 12) + id);
return false;
}

View file

@ -31,10 +31,12 @@
#include "gob/inter.h"
#include "gob/helper.h"
#include "gob/global.h"
#include "gob/dataio.h"
#include "gob/game.h"
#include "gob/expression.h"
#include "gob/script.h"
#include "gob/resources.h"
#include "gob/hotspots.h"
#include "gob/draw.h"
#include "gob/sound/sound.h"
#include "gob/videoplayer.h"
@ -64,7 +66,7 @@ void Inter_v6::setupOpcodesFunc() {
OPCODEFUNC(0x03, o6_loadCursor);
OPCODEFUNC(0x09, o6_assign);
OPCODEFUNC(0x13, o6_palLoad);
OPCODEFUNC(0x19, o6_freeCollision);
OPCODEFUNC(0x19, o6_removeHotspot);
OPCODEFUNC(0x33, o6_fillRect);
}
@ -187,7 +189,7 @@ void Inter_v6::o6_openItk() {
// (it checks CD1.ITK - CD4.ITK and the first that's found determines
// the CD number), while its NO_CD modus wants everything in CD1.ITK.
// So we just open the other ITKs, too.
if (_vm->_game->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) {
if (_vm->_global->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) {
_vm->_dataIO->openDataFile("CD2.ITK", true);
_vm->_dataIO->openDataFile("CD3.ITK", true);
_vm->_dataIO->openDataFile("CD4.ITK", true);
@ -351,36 +353,33 @@ bool Inter_v6::o6_palLoad(OpFuncParams &params) {
return false;
}
bool Inter_v6::o6_freeCollision(OpFuncParams &params) {
bool Inter_v6::o6_removeHotspot(OpFuncParams &params) {
int16 id;
uint8 stateType1 = Hotspots::kStateFilledDisabled | Hotspots::kStateType1;
uint8 stateType2 = Hotspots::kStateFilledDisabled | Hotspots::kStateType2;
uint8 stateDisabled = Hotspots::kStateDisabled;
id = _vm->_game->_script->readValExpr();
switch (id + 5) {
case 0:
_vm->_game->pushCollisions(1);
_vm->_game->_hotspots->push(1);
break;
case 1:
_vm->_game->popCollisions();
_vm->_game->_hotspots->pop();
break;
case 2:
_vm->_game->pushCollisions(2);
_vm->_game->_hotspots->push(2);
break;
case 3:
for (int i = 0; i < 150; i++) {
if (((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xD000) ||
((_vm->_game->_collisionAreas[i].id & 0xF000) == 0x4000))
_vm->_game->_collisionAreas[i].left = 0xFFFF;
}
_vm->_game->_hotspots->removeState(stateType1);
_vm->_game->_hotspots->removeState(stateDisabled);
break;
case 4:
for (int i = 0; i < 150; i++) {
if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xE000)
_vm->_game->_collisionAreas[i].left = 0xFFFF;
}
_vm->_game->_hotspots->removeState(stateType2);
break;
default:
_vm->_game->freeCollision(0xE000 + id);
_vm->_game->_hotspots->remove((stateType2 << 12) + id);
break;
}

View file

@ -11,10 +11,6 @@ MODULE_OBJS := \
driver_vga.o \
expression.o \
game.o \
game_v1.o \
game_v2.o \
game_v6.o \
game_fascin.o \
global.o \
gob.o \
goblin.o \
@ -22,11 +18,12 @@ MODULE_OBJS := \
goblin_v2.o \
goblin_v3.o \
goblin_v4.o \
videoplayer.o \
hotspots.o \
init.o \
init_v1.o \
init_v2.o \
init_v3.o \
init_v6.o \
inter.o \
inter_v1.o \
inter_v2.o \
@ -56,6 +53,7 @@ MODULE_OBJS := \
video_v1.o \
video_v2.o \
video_v6.o \
videoplayer.o \
demos/demoplayer.o \
demos/scnplayer.o \
demos/batplayer.o \

View file

@ -204,7 +204,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape,
stop = false;
_vm->_util->processInput();
if (checkEscape && (_vm->_util->checkKey() == 0x11B))
if (checkEscape && (_vm->_util->checkKey() == kKeyEscape))
stop = true;
_frame++;

View file

@ -127,6 +127,10 @@ bool Script::skip(int32 offset) {
return seek(offset, SEEK_CUR);
}
bool Script::skipBlock() {
return seek(peekUint16(2) + 2, SEEK_CUR);
}
int32 Script::getOffset(byte *ptr) const {
if (!_totData)
return -1;

View file

@ -53,6 +53,7 @@ public:
// Stream seeking
bool seek(int32 offset, int whence = SEEK_SET);
bool skip(int32 offset);
bool skipBlock();
// Reading data
byte readByte ();

View file

@ -506,7 +506,7 @@ void Sound::blasterWaitEndPlay(bool interruptible, bool stopComp) {
_blaster->endComposition();
while (_blaster->isPlaying() && !_vm->shouldQuit()) {
if (interruptible && (_vm->_util->checkKey() == 0x11B)) {
if (interruptible && (_vm->_util->checkKey() == kKeyEscape)) {
WRITE_VAR(57, (uint32) -1);
return;
}

View file

@ -38,7 +38,7 @@
namespace Gob {
Util::Util(GobEngine *vm) : _vm(vm) {
_mouseButtons = 0;
_mouseButtons = kMouseButtonsNone,
_keyBufferHead = 0;
_keyBufferTail = 0;
_fastMode = 0;
@ -85,7 +85,7 @@ void Util::longDelay(uint16 msecs) {
}
void Util::initInput(void) {
_mouseButtons = 0;
_mouseButtons = kMouseButtonsNone;
_keyBufferHead = _keyBufferTail = 0;
}
@ -103,16 +103,16 @@ void Util::processInput(bool scroll) {
y = event.mouse.y;
break;
case Common::EVENT_LBUTTONDOWN:
_mouseButtons |= 1;
_mouseButtons = (MouseButtons) (((uint32) _mouseButtons) | ((uint32) kMouseButtonsLeft));
break;
case Common::EVENT_RBUTTONDOWN:
_mouseButtons |= 2;
_mouseButtons = (MouseButtons) (((uint32) _mouseButtons) | ((uint32) kMouseButtonsRight));
break;
case Common::EVENT_LBUTTONUP:
_mouseButtons &= ~1;
_mouseButtons = (MouseButtons) (((uint32) _mouseButtons) & ~((uint32) kMouseButtonsLeft));
break;
case Common::EVENT_RBUTTONUP:
_mouseButtons &= ~2;
_mouseButtons = (MouseButtons) (((uint32) _mouseButtons) & ~((uint32) kMouseButtonsRight));
break;
case Common::EVENT_KEYDOWN:
if (event.kbd.flags == Common::KBD_CTRL) {
@ -179,26 +179,26 @@ int16 Util::translateKey(const Common::KeyState &key) {
int16 from;
int16 to;
} keys[] = {
{Common::KEYCODE_INVALID, 0x0000},
{Common::KEYCODE_BACKSPACE, 0x0E08},
{Common::KEYCODE_SPACE, 0x3920},
{Common::KEYCODE_RETURN, 0x1C0D},
{Common::KEYCODE_ESCAPE, 0x011B},
{Common::KEYCODE_DELETE, 0x5300},
{Common::KEYCODE_UP, 0x4800},
{Common::KEYCODE_DOWN, 0x5000},
{Common::KEYCODE_RIGHT, 0x4D00},
{Common::KEYCODE_LEFT, 0x4B00},
{Common::KEYCODE_F1, 0x3B00},
{Common::KEYCODE_F2, 0x3C00},
{Common::KEYCODE_F3, 0x3D00},
{Common::KEYCODE_F4, 0x3E00},
{Common::KEYCODE_F5, 0x011B},
{Common::KEYCODE_F6, 0x4000},
{Common::KEYCODE_F7, 0x4100},
{Common::KEYCODE_F8, 0x4200},
{Common::KEYCODE_F9, 0x4300},
{Common::KEYCODE_F10, 0x4400}
{Common::KEYCODE_INVALID, kKeyNone },
{Common::KEYCODE_BACKSPACE, kKeyBackspace},
{Common::KEYCODE_SPACE, kKeySpace },
{Common::KEYCODE_RETURN, kKeyReturn },
{Common::KEYCODE_ESCAPE, kKeyEscape },
{Common::KEYCODE_DELETE, kKeyDelete },
{Common::KEYCODE_UP, kKeyUp },
{Common::KEYCODE_DOWN, kKeyDown },
{Common::KEYCODE_RIGHT, kKeyRight },
{Common::KEYCODE_LEFT, kKeyLeft },
{Common::KEYCODE_F1, kKeyF1 },
{Common::KEYCODE_F2, kKeyF2 },
{Common::KEYCODE_F3, kKeyF3 },
{Common::KEYCODE_F4, kKeyF4 },
{Common::KEYCODE_F5, kKeyEscape },
{Common::KEYCODE_F6, kKeyF6 },
{Common::KEYCODE_F7, kKeyF7 },
{Common::KEYCODE_F8, kKeyF8 },
{Common::KEYCODE_F9, kKeyF9 },
{Common::KEYCODE_F10, kKeyF10 }
};
for (int i = 0; i < ARRAYSIZE(keys); i++)
@ -246,7 +246,7 @@ bool Util::checkKey(int16 &key) {
return true;
}
void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
void Util::getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons) {
Common::Point mouse = g_system->getEventManager()->getMousePos();
*pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX;
*pY = mouse.y + _vm->_video->_scrollOffsetY - _vm->_video->_screenDeltaY;
@ -264,15 +264,15 @@ void Util::setMousePos(int16 x, int16 y) {
void Util::waitMouseUp(void) {
do {
processInput();
if (_mouseButtons != 0)
if (_mouseButtons != kMouseButtonsNone)
delay(10);
} while (_mouseButtons != 0);
} while (_mouseButtons != kMouseButtonsNone);
}
void Util::waitMouseDown(void) {
int16 x;
int16 y;
int16 buttons;
MouseButtons buttons;
do {
processInput();
@ -283,7 +283,7 @@ void Util::waitMouseDown(void) {
}
void Util::waitMouseRelease(char drawMouse) {
int16 buttons;
MouseButtons buttons;
int16 mouseX;
int16 mouseY;
@ -300,8 +300,8 @@ void Util::forceMouseUp(bool onlyWhenSynced) {
if (onlyWhenSynced && (_vm->_game->_mouseButtons != _mouseButtons))
return;
_vm->_game->_mouseButtons = 0;
_mouseButtons = 0;
_vm->_game->_mouseButtons = kMouseButtonsNone;
_mouseButtons = kMouseButtonsNone;
}
void Util::clearPalette(void) {
@ -403,10 +403,10 @@ Video::FontDesc *Util::loadFont(const char *path) {
fontDesc->bitWidth = fontDesc->itemWidth;
if (data[0] & 0x80)
fontDesc->extraData = data + 4 + fontDesc->itemSize *
fontDesc->charWidths = data + 4 + fontDesc->itemSize *
(fontDesc->endItem - fontDesc->startItem + 1);
else
fontDesc->extraData = 0;
fontDesc->charWidths = 0;
return fontDesc;
}
@ -452,7 +452,7 @@ static const char trStr2[] =
" ";
static const char trStr3[] = " ";
void Util::prepareStr(char *str) {
void Util::cleanupStr(char *str) {
char *start, *end;
char buf[300];
@ -460,17 +460,20 @@ void Util::prepareStr(char *str) {
strcat(buf, trStr2);
strcat(buf, trStr3);
// Translating "wrong" characters
for (size_t i = 0; i < strlen(str); i++)
str[i] = buf[str[i] - 32];
str[i] = buf[MIN<int>(str[i] - 32, 32)];
// Trim spaces left
while (str[0] == ' ')
cutFromStr(str, 0, 1);
// Trim spaces right
while ((strlen(str) > 0) && (str[strlen(str) - 1] == ' '))
cutFromStr(str, strlen(str) - 1, 1);
// Merge double spaces
start = strchr(str, ' ');
while (start) {
if (start[1] == ' ') {
cutFromStr(str, start - str, 1);

View file

@ -34,6 +34,47 @@ namespace Gob {
#define KEYBUFSIZE 16
enum MouseButtons {
kMouseButtonsNone = 0,
kMouseButtonsLeft = 1,
kMouseButtonsRight = 2,
kMouseButtonsBoth = 3,
kMouseButtonsAny = 4
};
enum Keys {
kKeyNone = 0x0000,
kKeyBackspace = 0x0E08,
kKeySpace = 0x3920,
kKeyReturn = 0x1C0D,
kKeyEscape = 0x011B,
kKeyDelete = 0x5300,
kKeyUp = 0x4800,
kKeyDown = 0x5000,
kKeyRight = 0x4D00,
kKeyLeft = 0x4B00,
kKeyF1 = 0x3B00,
kKeyF2 = 0x3C00,
kKeyF3 = 0x3D00,
kKeyF4 = 0x3E00,
kKeyF5 = 0x3F00,
kKeyF6 = 0x4000,
kKeyF7 = 0x4100,
kKeyF8 = 0x4200,
kKeyF9 = 0x4300,
kKeyF10 = 0x4400
};
enum ShortKey {
kShortKeyUp = 0x0B,
kShortKeyDown = 0x0A,
kShortKeyRight = 0x09,
kShortKeyLeft = 0x08,
kShortKeyEscape = 0x1B,
kShortKeyBackspace = 0x19,
kShortKeyDelete = 0x1A
};
class Util {
public:
struct ListNode;
@ -66,7 +107,7 @@ public:
int16 checkKey(void);
bool checkKey(int16 &key);
void getMouseState(int16 *pX, int16 *pY, int16 *pButtons);
void getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons);
void setMousePos(int16 x, int16 y);
void waitMouseUp(void);
void waitMouseDown(void);
@ -84,7 +125,7 @@ public:
static void insertStr(const char *str1, char *str2, int16 pos);
static void cutFromStr(char *str, int16 from, int16 cutlen);
static void prepareStr(char *str);
static void cleanupStr(char *str);
static void replaceChar(char *str, char c1, char c2);
static void listInsertFront(List *list, void *data);
@ -95,7 +136,8 @@ public:
Util(GobEngine *vm);
protected:
int16 _mouseButtons;
MouseButtons _mouseButtons;
Common::KeyState _keyBuffer[KEYBUFSIZE];
int16 _keyBufferHead;
int16 _keyBufferTail;

View file

@ -78,7 +78,7 @@ public:
uint8 endItem;
int8 itemSize;
int8 bitWidth;
byte *extraData;
uint8 *charWidths;
FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0),
endItem(0), itemSize(0), bitWidth(0) {}
~FontDesc() {

View file

@ -27,7 +27,6 @@
#include "gob/videoplayer.h"
#include "gob/helper.h"
#include "gob/global.h"
#include "gob/util.h"
#include "gob/dataio.h"
#include "gob/video.h"
#include "gob/draw.h"

View file

@ -31,11 +31,12 @@
#include "graphics/video/coktelvideo/coktelvideo.h"
#include "gob/dataio.h"
#include "gob/util.h"
namespace Gob {
class GobEngine;
class DataStream;
class VideoPlayer {
public:
@ -60,13 +61,14 @@ public:
bool primaryOpen(const char *videoFile, int16 x = -1, int16 y = -1,
int32 flags = kFlagFrontSurface, Type which = kVideoTypeTry);
bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27,
bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1,
int16 breakKey = kShortKeyEscape,
uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,
int16 palFrame = -1, int16 endFrame = -1, bool fade = false,
int16 reverseTo = -1, bool forceSeek = false);
void primaryClose();
void playFrame(int16 frame, int16 breakKey = 27,
void playFrame(int16 frame, int16 breakKey = kShortKeyEscape,
uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,
int16 palFrame = -1 , int16 endFrame = -1);

View file

@ -108,7 +108,11 @@ Common::Error GroovieEngine::run() {
}
// Create the music player
_musicPlayer = new MusicPlayer(this, _gameDescription->version == kGroovieT7G ? "fat" : "sample");
if (_gameDescription->desc.platform == Common::kPlatformMacintosh) {
_musicPlayer = new MusicPlayerMac(this);
} else {
_musicPlayer = new MusicPlayerXMI(this, _gameDescription->version == kGroovieT7G ? "fat" : "sample");
}
// Load volume levels
syncSoundSettings();

View file

@ -31,72 +31,20 @@
namespace Groovie {
MusicPlayer::MusicPlayer(GroovieEngine *vm, const Common::String &gtlName) :
_vm(vm), _midiParser(NULL), _data(NULL), _driver(NULL),
_backgroundFileRef(0), _gameVolume(100), _prevCDtrack(0), _isPlaying(0) {
// Create the parser
_midiParser = MidiParser::createParser_XMIDI();
// MusicPlayer
// Create the driver
int driver = detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
_driver = createMidi(driver);
this->open();
// Initialize the channel volumes and banks
for (int i = 0; i < 0x10; i++) {
_chanVolumes[i] = 0x7F;
_chanBanks[i] = 0;
}
// Load the Global Timbre Library
if (driver == MD_ADLIB) {
// MIDI through AdLib
_musicType = MD_ADLIB;
loadTimbres(gtlName + ".ad");
// Setup the percussion channel
for (unsigned int i = 0; i < _timbres.size(); i++) {
if (_timbres[i].bank == 0x7F)
setTimbreAD(9, _timbres[i]);
}
} else if ((driver == MD_MT32) || ConfMan.getBool("native_mt32")) {
// MT-32
_musicType = MD_MT32;
loadTimbres(gtlName + ".mt");
} else {
// GM
_musicType = 0;
}
// Set the parser's driver
_midiParser->setMidiDriver(this);
// Set the timer rate
_midiParser->setTimerRate(_driver->getBaseTempo());
}
MusicPlayer::~MusicPlayer() {
_driver->setTimerCallback(NULL, NULL);
Common::StackLock lock(_mutex);
// Unload the parser
unload();
delete _midiParser;
// Unload the MIDI Driver
_driver->close();
delete _driver;
// Unload the timbres
clearTimbres();
MusicPlayer::MusicPlayer(GroovieEngine *vm) :
_vm(vm), _isPlaying(false), _backgroundFileRef(0), _gameVolume(100),
_prevCDtrack(0) {
}
void MusicPlayer::playSong(uint32 fileref) {
Common::StackLock lock(_mutex);
// Set the volumes
_fadingEndVolume = 100;
_gameVolume = 100;
// Play the referenced file once
play(fileref, false);
}
@ -146,6 +94,14 @@ void MusicPlayer::playCD(uint8 track) {
AudioCD.play(track - 1, 1, startms * 75 / 1000, 0);
}
void MusicPlayer::startBackground() {
debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: startBackground()");
if (!_isPlaying && _backgroundFileRef) {
debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the background song (0x%4X)", _backgroundFileRef);
play(_backgroundFileRef, true);
}
}
void MusicPlayer::setUserVolume(uint16 volume) {
Common::StackLock lock(_mutex);
@ -154,10 +110,8 @@ void MusicPlayer::setUserVolume(uint16 volume) {
if (_userVolume > 0x100)
_userVolume = 0x100;
// Apply it to all the channels
for (int i = 0; i < 0x10; i++) {
updateChanVolume(i);
}
// Apply it
updateVolume();
}
void MusicPlayer::setGameVolume(uint16 volume, uint16 time) {
@ -176,17 +130,15 @@ void MusicPlayer::setGameVolume(uint16 volume, uint16 time) {
_fadingEndVolume = 100;
}
void MusicPlayer::startBackground() {
debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: startBackground()");
if (!_isPlaying && _backgroundFileRef) {
debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the background song (0x%4X)", _backgroundFileRef);
play(_backgroundFileRef, true);
}
}
void MusicPlayer::endTrack() {
debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: endTrack()");
bool MusicPlayer::play(uint32 fileref, bool loop) {
// Unload the previous song
unload();
// Set the new state
_isPlaying = true;
// Load the new file
return load(fileref, loop);
}
void MusicPlayer::applyFading() {
@ -212,80 +164,61 @@ void MusicPlayer::applyFading() {
}
}
// Apply the new volume to all the channels
for (int i = 0; i < 0x10; i++) {
updateChanVolume(i);
}
// Apply it
updateVolume();
}
void MusicPlayer::updateChanVolume(byte channel) {
// Generate a MIDI Control change message for the volume
uint32 b = 0x7B0;
void MusicPlayer::onTimer(void *refCon) {
debugC(9, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: onTimer()");
MusicPlayer *music = (MusicPlayer *)refCon;
Common::StackLock lock(music->_mutex);
// Specify the channel
b |= (channel & 0xF);
// Scale by the user and game volumes
uint32 val = (_chanVolumes[channel] * _userVolume * _gameVolume) / 0x100 / 100;
val &= 0x7F;
// Send it to the driver
_driver->send(b | (val << 16));
// Apply the game volume fading
if (music->_gameVolume != music->_fadingEndVolume) {
// Apply the next step of the fading
music->applyFading();
}
bool MusicPlayer::play(uint32 fileref, bool loop) {
// Unload the previous song
unload();
// Set the looping option
_midiParser->property(MidiParser::mpAutoLoop, loop);
_isPlaying = true;
// Load the new file
return load(fileref);
}
bool MusicPlayer::load(uint32 fileref) {
debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref);
// Open the song resource
Common::SeekableReadStream *xmidiFile = _vm->_resMan->open(fileref);
if (!xmidiFile) {
error("Groovie::Music: Couldn't find resource 0x%04X", fileref);
return false;
}
// Read the whole file to memory
int length = xmidiFile->size();
_data = new byte[length];
xmidiFile->read(_data, length);
delete xmidiFile;
// Start parsing the data
if (!_midiParser->loadMusic(_data, length)) {
error("Groovie::Music: Invalid XMI file");
return false;
}
// Activate the timer source
_driver->setTimerCallback(this, &onTimer);
return true;
// Handle internal timed events
music->onTimerInternal();
}
void MusicPlayer::unload() {
debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Stopping the playback");
// Set the new state
_isPlaying = false;
// Unload the parser
_midiParser->unloadMusic();
// Unload the xmi file
delete[] _data;
_data = NULL;
}
int MusicPlayer::open() {
// MusicPlayerMidi
MusicPlayerMidi::MusicPlayerMidi(GroovieEngine *vm) :
MusicPlayer(vm), _midiParser(NULL), _data(NULL), _driver(NULL) {
// Initialize the channel volumes
for (int i = 0; i < 0x10; i++) {
_chanVolumes[i] = 0x7F;
}
}
MusicPlayerMidi::~MusicPlayerMidi() {
// Stop the callback
if (_driver)
_driver->setTimerCallback(NULL, NULL);
Common::StackLock lock(_mutex);
// Unload the parser
unload();
delete _midiParser;
// Unload the MIDI Driver
if (_driver)
_driver->close();
delete _driver;
}
int MusicPlayerMidi::open() {
// Don't ever call open without first setting the output driver!
if (!_driver)
return 255;
@ -297,9 +230,187 @@ int MusicPlayer::open() {
return 0;
}
void MusicPlayer::close() {}
void MusicPlayerMidi::close() {}
void MusicPlayer::send(uint32 b) {
void MusicPlayerMidi::send(uint32 b) {
if ((b & 0xFFF0) == 0x07B0) { // Volume change
// Save the specific channel volume
byte chan = b & 0xF;
_chanVolumes[chan] = (b >> 16) & 0x7F;
// Send the updated value
updateChanVolume(chan);
return;
}
if (_driver)
_driver->send(b);
}
void MusicPlayerMidi::metaEvent(byte type, byte *data, uint16 length) {
switch (type) {
case 0x2F:
// End of Track, play the background song
endTrack();
break;
default:
if (_driver)
_driver->metaEvent(type, data, length);
break;
}
}
void MusicPlayerMidi::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
if (_driver)
_driver->setTimerCallback(timer_param, timer_proc);
}
uint32 MusicPlayerMidi::getBaseTempo(void) {
if (_driver)
return _driver->getBaseTempo();
else
return 0;
}
MidiChannel *MusicPlayerMidi::allocateChannel() {
if (_driver)
return _driver->allocateChannel();
else
return 0;
}
MidiChannel *MusicPlayerMidi::getPercussionChannel() {
if (_driver)
return _driver->getPercussionChannel();
else
return 0;
}
void MusicPlayerMidi::updateChanVolume(byte channel) {
// Generate a MIDI Control change message for the volume
uint32 b = 0x7B0;
// Specify the channel
b |= (channel & 0xF);
// Scale by the user and game volumes
uint32 val = (_chanVolumes[channel] * _userVolume * _gameVolume) / 0x100 / 100;
val &= 0x7F;
// Send it to the driver
if (_driver)
_driver->send(b | (val << 16));
}
void MusicPlayerMidi::endTrack() {
debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: endTrack()");
unload();
}
void MusicPlayerMidi::onTimerInternal() {
// TODO: We really only need to call this while music is playing.
if (_midiParser)
_midiParser->onTimer();
}
void MusicPlayerMidi::updateVolume() {
// Apply it to all the channels
for (int i = 0; i < 0x10; i++) {
updateChanVolume(i);
}
}
void MusicPlayerMidi::unload() {
MusicPlayer::unload();
// Unload the parser data
if (_midiParser)
_midiParser->unloadMusic();
// Unload the data
delete[] _data;
_data = NULL;
}
bool MusicPlayerMidi::loadParser(Common::SeekableReadStream *stream, bool loop) {
if (!_midiParser)
return false;
// Read the whole file to memory
int length = stream->size();
_data = new byte[length];
stream->read(_data, length);
delete stream;
// Set the looping option
_midiParser->property(MidiParser::mpAutoLoop, loop);
// Start parsing the data
if (!_midiParser->loadMusic(_data, length)) {
error("Groovie::Music: Couldn't parse the data");
return false;
}
// Activate the timer source
if (_driver)
_driver->setTimerCallback(this, &onTimer);
return true;
}
// MusicPlayerXMI
MusicPlayerXMI::MusicPlayerXMI(GroovieEngine *vm, const Common::String &gtlName) :
MusicPlayerMidi(vm) {
// Create the parser
_midiParser = MidiParser::createParser_XMIDI();
// Create the driver
int driver = detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
_driver = createMidi(driver);
this->open();
// Set the parser's driver
_midiParser->setMidiDriver(this);
// Set the timer rate
_midiParser->setTimerRate(_driver->getBaseTempo());
// Initialize the channel banks
for (int i = 0; i < 0x10; i++) {
_chanBanks[i] = 0;
}
// Load the Global Timbre Library
if (driver == MD_ADLIB) {
// MIDI through AdLib
_musicType = MD_ADLIB;
loadTimbres(gtlName + ".ad");
// Setup the percussion channel
for (unsigned int i = 0; i < _timbres.size(); i++) {
if (_timbres[i].bank == 0x7F)
setTimbreAD(9, _timbres[i]);
}
} else if ((driver == MD_MT32) || ConfMan.getBool("native_mt32")) {
// MT-32
_musicType = MD_MT32;
loadTimbres(gtlName + ".mt");
} else {
// GM
_musicType = 0;
}
}
MusicPlayerXMI::~MusicPlayerXMI() {
//~MusicPlayer();
// Unload the timbres
clearTimbres();
}
void MusicPlayerXMI::send(uint32 b) {
if ((b & 0xFFF0) == 0x72B0) { // XMIDI Patch Bank Select 114
// From AIL2's documentation: XMIDI Patch Bank Select controller (114)
// selects a bank to be used when searching the next patches
@ -337,63 +448,24 @@ void MusicPlayer::send(uint32 b) {
// If we got here we couldn't find the patch, and the
// received message will be sent unchanged.
}
} else if ((b & 0xFFF0) == 0x07B0) { // Volume change
// Save the specific channel volume
byte chan = b & 0xF;
_chanVolumes[chan] = (b >> 16) & 0x7F;
// Send the updated value
updateChanVolume(chan);
return;
}
_driver->send(b);
MusicPlayerMidi::send(b);
}
void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) {
switch (type) {
case 0x2F:
// End of Track, play the background song
endTrack();
break;
default:
_driver->metaEvent(type, data, length);
break;
}
bool MusicPlayerXMI::load(uint32 fileref, bool loop) {
debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref);
// Open the song resource
Common::SeekableReadStream *file = _vm->_resMan->open(fileref);
if (!file) {
error("Groovie::Music: Couldn't find resource 0x%04X", fileref);
return false;
}
void MusicPlayer::onTimer(void *refCon) {
debugC(9, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: onTimer()");
MusicPlayer *music = (MusicPlayer *)refCon;
Common::StackLock lock(music->_mutex);
// Apply the game volume fading
if (music->_gameVolume != music->_fadingEndVolume) {
// Apply the next step of the fading
music->applyFading();
return loadParser(file, loop);
}
// TODO: We really only need to call this while music is playing.
music->_midiParser->onTimer();
}
void MusicPlayer::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
_driver->setTimerCallback(timer_param, timer_proc);
}
uint32 MusicPlayer::getBaseTempo(void) {
return _driver->getBaseTempo();
}
MidiChannel *MusicPlayer::allocateChannel() {
return _driver->allocateChannel();
}
MidiChannel *MusicPlayer::getPercussionChannel() {
return _driver->getPercussionChannel();
}
void MusicPlayer::loadTimbres(const Common::String &filename) {
void MusicPlayerXMI::loadTimbres(const Common::String &filename) {
// Load the Global Timbre Library format as documented in AIL2
debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Loading the GTL file %s", filename.c_str());
@ -451,7 +523,7 @@ void MusicPlayer::loadTimbres(const Common::String &filename) {
delete gtl;
}
void MusicPlayer::clearTimbres() {
void MusicPlayerXMI::clearTimbres() {
// Delete the allocated data
int num = _timbres.size();
for (int i = 0; i < num; i++) {
@ -462,7 +534,7 @@ void MusicPlayer::clearTimbres() {
_timbres.clear();
}
void MusicPlayer::setTimbreAD(byte channel, const Timbre &timbre) {
void MusicPlayerXMI::setTimbreAD(byte channel, const Timbre &timbre) {
// Verify the timbre size
if (timbre.size != 12) {
error("Groovie::Music: Invalid size for an AdLib timbre: %d", timbre.size);
@ -514,7 +586,7 @@ void MusicPlayer::setTimbreAD(byte channel, const Timbre &timbre) {
}
}
void MusicPlayer::setTimbreMT(byte channel, const Timbre &timbre) {
void MusicPlayerXMI::setTimbreMT(byte channel, const Timbre &timbre) {
// Verify the timbre size
if (timbre.size != 0xF6) {
error("Groovie::Music: Invalid size for an MT-32 timbre: %d", timbre.size);
@ -528,4 +600,28 @@ void MusicPlayer::setTimbreMT(byte channel, const Timbre &timbre) {
warning("Groovie::Music: Setting MT32 custom instruments isn't supported yet");
}
// MusicPlayerMac
MusicPlayerMac::MusicPlayerMac(GroovieEngine *vm) :
MusicPlayerMidi(vm) {
}
bool MusicPlayerMac::load(uint32 fileref, bool loop) {
debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref);
debug("Groovie::Music: Starting the playback of song: %04X %d", fileref, fileref);
// Open the song resource
/*
Common::SeekableReadStream *file = _vm->_resMan->open(fileref);
if (!file) {
error("Groovie::Music: Couldn't find resource 0x%04X", fileref);
return false;
}
*/
//return loadParser(file, loop);
return false;
}
} // End of Groovie namespace

View file

@ -34,10 +34,11 @@
namespace Groovie {
class MusicPlayer : public MidiDriver {
class MusicPlayer {
public:
MusicPlayer(GroovieEngine *vm, const Common::String &gtlName);
~MusicPlayer();
MusicPlayer(GroovieEngine *vm);
virtual ~MusicPlayer() {}
void playSong(uint32 fileref);
void setBackgroundSong(uint32 fileref);
void playCD(uint8 track);
@ -48,25 +49,89 @@ public:
void setGameVolume(uint16 volume, uint16 time);
private:
// User volume
uint16 _userVolume;
// Song playback
bool play(uint32 fileref, bool loop);
bool _isPlaying;
uint32 _backgroundFileRef;
uint8 _prevCDtrack;
// Game volume
uint16 _gameVolume;
// Volume fading
uint32 _fadingStartTime;
uint16 _fadingStartVolume;
uint16 _fadingEndVolume;
uint16 _fadingDuration;
void endTrack();
void applyFading();
// Song volumes
protected:
GroovieEngine *_vm;
// Callback
static void onTimer(void *data);
virtual void onTimerInternal() {}
Common::Mutex _mutex;
// User volume
uint16 _userVolume;
// Game volume
uint16 _gameVolume;
// These are specific for each type of music
virtual void updateVolume() = 0;
virtual bool load(uint32 fileref, bool loop) = 0;
virtual void unload();
};
class MusicPlayerMidi : public MusicPlayer, public MidiDriver {
public:
MusicPlayerMidi(GroovieEngine *vm);
~MusicPlayerMidi();
// MidiDriver interface
int open();
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
uint32 getBaseTempo(void);
MidiChannel *allocateChannel();
MidiChannel *getPercussionChannel();
private:
// Channel volumes
byte _chanVolumes[0x10];
void updateChanVolume(byte channel);
void endTrack();
protected:
byte *_data;
MidiParser *_midiParser;
MidiDriver *_driver;
void onTimerInternal();
void updateVolume();
void unload();
bool loadParser(Common::SeekableReadStream *stream, bool loop);
};
class MusicPlayerXMI : public MusicPlayerMidi {
public:
MusicPlayerXMI(GroovieEngine *vm, const Common::String &gtlName);
~MusicPlayerXMI();
void send(uint32 b);
protected:
bool load(uint32 fileref, bool loop);
private:
// Channel banks
byte _chanBanks[0x10];
// Output music type
uint8 _musicType;
// Timbres
class Timbre {
public:
@ -81,35 +146,14 @@ private:
void clearTimbres();
void setTimbreAD(byte channel, const Timbre &timbre);
void setTimbreMT(byte channel, const Timbre &timbre);
};
class MusicPlayerMac : public MusicPlayerMidi {
public:
// MidiDriver interface
int open();
void close();
void send(uint32 b);
void metaEvent(byte type, byte *data, uint16 length);
void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
uint32 getBaseTempo(void);
MidiChannel *allocateChannel();
MidiChannel *getPercussionChannel();
MusicPlayerMac(GroovieEngine *vm);
private:
GroovieEngine *_vm;
Common::Mutex _mutex;
byte *_data;
MidiParser *_midiParser;
MidiDriver *_driver;
uint8 _musicType;
bool _isPlaying;
uint32 _backgroundFileRef;
uint8 _prevCDtrack;
static void onTimer(void *data);
bool play(uint32 fileref, bool loop);
bool load(uint32 fileref);
void unload();
protected:
bool load(uint32 fileref, bool loop);
};
} // End of Groovie namespace

View file

@ -263,26 +263,12 @@ const KYRAGameDescription adGameDescs[] = {
KYRA1_TOWNS_SJIS_FLAGS
},
{ // PC-9821 (CD) version
{
"kyra1",
"CD",
{
{ "EMC.PAK", 0, "a046bb0b422061aab8e4c4689400343a", -1 },
{ "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 },
{ NULL, 0, NULL, 0 }
},
Common::EN_ANY,
Common::kPlatformPC98,
ADGF_CD,
Common::GUIO_NOSPEECH
},
KYRA1_TOWNS_FLAGS
},
// PC-9801 floppy + CD / PC-9821 floppy version are all using the same data files,
// thus we will mark it as non CD game.
{
{
"kyra1",
"CD",
"",
{
{ "JMC.PAK", 0, "9c5707a2a478e8167e44283246612d2c", -1 },
{ "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 },
@ -290,7 +276,7 @@ const KYRAGameDescription adGameDescs[] = {
},
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_CD,
ADGF_NO_FLAGS,
Common::GUIO_NOSPEECH
},
KYRA1_TOWNS_SJIS_FLAGS

View file

@ -2880,7 +2880,7 @@ void LoLEngine::drinkBezelCup(int numUses, int charNum) {
uint16 step = 0;
do {
step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 2]);
step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 1]);
increaseCharacterHitpoints(charNum, step / 256, true);
gui_drawCharPortraitWithStats(charNum);

View file

@ -1529,6 +1529,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
_dsTmpWidth = shapeWidth;
int cnt = _dsOffscreenLeft;
int scaleState = (this->*_dsProcessMargin)(d, src, cnt);
if (_dsTmpWidth) {
cnt += shpWidthScaled1;
if (cnt > 0) {
@ -1584,7 +1585,6 @@ int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt)
while (cnt > 0) {
--cnt;
if (*src++)
continue;
@ -1611,7 +1611,6 @@ int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cn
while (cnt > 0) {
--cnt;
if (*src++)
continue;
@ -1640,10 +1639,11 @@ int Screen::drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
return 0;
do {
--cnt;
if (*src++)
continue;
cnt = cnt + 1 - (*src++);
} while (--cnt > 0);
} while (cnt > 0);
return 0;
}
@ -1656,16 +1656,17 @@ int Screen::drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt)
return 0;
do {
--cnt;
if (*src++)
continue;
found = true;
cnt = cnt + 1 - (*src++);
} while (--cnt > 0);
} while (cnt > 0);
return found ? 0 : _dsOffscreenScaleVal1;
}
void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) {
do {
uint8 c = *src++;
if (c) {
@ -1680,7 +1681,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i
} while (cnt > 0);
}
void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) {
do {
uint8 c = *src++;
if (c) {
@ -1695,7 +1696,7 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src,
} while (cnt > 0);
}
void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) {
int c = 0;
do {
@ -1723,7 +1724,7 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int
cnt = -1;
}
void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) {
int c = 0;
do {

View file

@ -421,10 +421,10 @@ protected:
int drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
int drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);
int drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
void drawShapePlotType0(uint8 *dst, uint8 cmd);
void drawShapePlotType1(uint8 *dst, uint8 cmd);
@ -446,7 +446,7 @@ protected:
void drawShapePlotType52(uint8 *dst, uint8 cmd);
typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt);
typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState);
typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd);
DsMarginSkipFunc _dsProcessMargin;

View file

@ -44,8 +44,6 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system),
_fadeFlag = 2;
_curDimIndex = 0;
_internDimX = _internDimY = _internDimW = _internDimH = _internDimDstX = _internBlockWidth = _internDimDstY = _internBlockHeight = _internDimU5 = _internDimU6 = _internBlockWidth2 = _internDimU8 = 0;
}
Screen_LoL::~Screen_LoL() {
@ -588,44 +586,25 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
va_end(args);
}
// _internDimH: h0
// _internDimW: w0
// _internDimDstX: x1
// _internDimDstY: y1
// _internBlockWidth: w1
// _internBlockHeight: h1
// _internDimU5: x2
// _internDimU6: y2
// _internBlockWidth2: w2
_internDimX = _internDimY = 0;
_internDimW = w1;
_internDimH = h1;
calcBoundariesIntern(x1, y1, w3, h3);
if (_internBlockWidth == -1)
int na = 0, nb = 0, nc = w3;
if (!calcBounds(w1, h1, x1, y1, w3, h3, na, nb, nc))
return;
int iu5_1 = _internDimU5;
int iu6_1 = _internDimU6;
int ibw_1 = _internBlockWidth;
int ibh_1 = _internBlockHeight;
int dx_1 = _internDimDstX;
int dy_1 = _internDimDstY;
int iu5_1 = na;
int iu6_1 = nb;
int ibw_1 = w3;
int dx_1 = x1;
int dy_1 = y1;
_internDimX = _internDimY = 0;
_internDimW = w2;
_internDimH = h2;
calcBoundariesIntern(x2, y2, ibw_1, ibh_1);
if (_internBlockWidth == -1)
if (!calcBounds(w2, h2, x2, y2, w3, h3, na, nb, nc))
return;
int iu5_2 = _internDimU5;
int iu6_2 = _internDimU6;
int ibw_2 = _internBlockWidth;
int ibh_2 = _internBlockHeight;
int dx_2 = _internDimDstX;
int dy_2 = _internDimDstY;
int iu5_2 = na;
int iu6_2 = nb;
int ibw_2 = w3;
int ibh_2 = h3;
int dx_2 = x2;
int dy_2 = y2;
uint8 *src = getPagePtr(page1) + (dy_1 + iu6_2) * w1;
uint8 *dst = getPagePtr(page2) + (dy_2 + iu6_1) * w2;
@ -670,7 +649,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in
}
if (!page2)
addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
addDirtyRect(x2, y2, w2, h2);
}
void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl) {
@ -678,23 +657,23 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2,
return;
const ScreenDim *cdim = getScreenDim(dim);
_internDimX = cdim->sx << 3;
_internDimY = cdim->sy;
_internDimW = cdim->w << 3;
_internDimH = cdim->h;
int ix = cdim->sx << 3;
int iy = cdim->sy;
int iw = cdim->w << 3;
int ih = cdim->h;
calcBoundariesIntern(x2, y2, w, h);
if (_internBlockWidth == -1)
int na = 0, nb = 0, nc = w;
if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc))
return;
uint8 *src = getPagePtr(page1) + y1 * 320 + x1;
uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320;
uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320;
for (int i = 0; i < _internBlockHeight; i++) {
uint8 *s = src + _internDimU5;
uint8 *d = dst + (_internDimDstX + _internDimX);
for (int i = 0; i < h; i++) {
uint8 *s = src + na;
uint8 *d = dst + (x2 + ix);
for (int ii = 0; ii < _internBlockWidth; ii++) {
for (int ii = 0; ii < w; ii++) {
uint8 p = ovl[*s++];
if (p)
*d = p;
@ -706,7 +685,7 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2,
}
if (!page2)
addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
addDirtyRect(x2 + ix, y2 + iy, w, h);
}
void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl) {
@ -714,26 +693,26 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x
return;
const ScreenDim *cdim = getScreenDim(dim);
_internDimX = cdim->sx << 3;
_internDimY = cdim->sy;
_internDimW = cdim->w << 3;
_internDimH = cdim->h;
int ix = cdim->sx << 3;
int iy = cdim->sy;
int iw = cdim->w << 3;
int ih = cdim->h;
calcBoundariesIntern(x2, y2, w, h);
if (_internBlockWidth == -1)
int na = 0, nb = 0, nc = w;
if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc))
return;
uint8 *src = getPagePtr(page1) + y1 * 320 + x1;
uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320;
uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320;
for (int i = 0; i < _internBlockHeight; i++) {
uint8 *s = src + _internDimU5;
uint8 *d = dst + (_internDimDstX + _internDimX);
for (int i = 0; i < h; i++) {
uint8 *s = src + na;
uint8 *d = dst + (x2 + ix);
if (flag)
d += (i >> 1);
for (int ii = 0; ii < _internBlockWidth; ii++) {
for (int ii = 0; ii < w; ii++) {
if (*s++)
*d = ovl[*d];
d++;
@ -744,7 +723,7 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x
}
if (!page2)
addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight);
addDirtyRect(x2 + ix, y2 + iy, w, h);
}
void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const uint8 *ovl) {
@ -778,59 +757,6 @@ void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const u
}
}
void Screen_LoL::calcBoundariesIntern(int dstX, int dstY, int width, int height) {
_internBlockWidth = _internBlockWidth2 = width;
_internBlockHeight = height;
_internDimDstX = dstX;
_internDimDstY = dstY;
_internDimU5 = _internDimU6 = _internDimU8 = 0;
int t = _internDimDstX + _internBlockWidth;
if (t <= 0) {
_internBlockWidth = _internBlockHeight = -1;
return;
}
if (t <= _internDimDstX) {
_internDimU5 = _internBlockWidth - t;
_internBlockWidth = t;
_internDimDstX = 0;
}
t = _internDimW - _internDimDstX;
if (t <= 0) {
_internBlockWidth = _internBlockHeight = -1;
return;
}
if (t <= _internBlockWidth)
_internBlockWidth = t;
_internBlockWidth2 -= _internBlockWidth;
t = _internDimDstY + _internBlockHeight;
if (t <= 0) {
_internBlockWidth = _internBlockHeight = -1;
return;
}
if (t <= _internDimDstY) {
_internDimU6 = _internBlockHeight - t;
_internBlockHeight = t;
_internDimDstY = 0;
}
t = _internDimH - _internDimDstY;
if (t <= 0) {
_internBlockWidth = _internBlockHeight = -1;
return;
}
if (t <= _internBlockHeight)
_internBlockHeight = t;
}
void Screen_LoL::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
Screen::fadeToBlack(delay, upFunc);
_fadeFlag = 2;

View file

@ -112,22 +112,6 @@ private:
static const uint8 _paletteConvTable[256];
void mergeOverlay(int x, int y, int w, int h);
void postProcessCursor(uint8 *data, int width, int height, int pitch);
// magic atlas
void calcBoundariesIntern(int dstX, int dstY, int c, int d);
int _internDimX;
int _internDimY;
int _internDimW;
int _internDimH;
int _internDimDstX;
int _internBlockWidth;
int _internDimDstY;
int _internBlockHeight;
int _internDimU5;
int _internDimU6;
int _internBlockWidth2;
int _internDimU8;
};
} // end of namespace Kyra

View file

@ -67,6 +67,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
// Kernel
// DCmd_Register("classes", WRAP_METHOD(Console, cmdClasses)); // TODO
DCmd_Register("opcodes", WRAP_METHOD(Console, cmdOpcodes));
DCmd_Register("selector", WRAP_METHOD(Console, cmdSelector));
DCmd_Register("selectors", WRAP_METHOD(Console, cmdSelectors));
DCmd_Register("functions", WRAP_METHOD(Console, cmdKernelFunctions));
DCmd_Register("class_table", WRAP_METHOD(Console, cmdClassTable));
@ -239,6 +240,7 @@ bool Console::cmdHelp(int argc, const char **argv) {
DebugPrintf("Kernel:\n");
DebugPrintf(" opcodes - Lists the opcode names\n");
DebugPrintf(" selectors - Lists the selector names\n");
DebugPrintf(" selector - Attempts to find the requested selector by name\n");
DebugPrintf(" functions - Lists the kernel functions\n");
DebugPrintf(" class_table - Shows the available classes\n");
DebugPrintf("\n");
@ -392,6 +394,25 @@ bool Console::cmdOpcodes(int argc, const char **argv) {
return true;
}
bool Console::cmdSelector(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Attempts to find the requested selector by name.\n");
DebugPrintf("Usage: %s <selector name>\n", argv[0]);
return true;
}
for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) {
if (!scumm_stricmp(_vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), argv[1])) {
DebugPrintf("Selector %s found at %03x\n", _vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), seeker);
return true;
}
}
DebugPrintf("Selector %s wasn't found\n", argv[1]);
return true;
}
bool Console::cmdSelectors(int argc, const char **argv) {
DebugPrintf("Selector names in numeric order:\n");
for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) {
@ -546,11 +567,6 @@ bool Console::cmdHexDump(int argc, const char **argv) {
}
int resNum = atoi(argv[2]);
if (resNum == 0) {
DebugPrintf("The resource number specified is not a number");
return true;
}
ResourceType res = parseResourceType(argv[1]);
if (res == kResourceTypeInvalid)
@ -607,11 +623,6 @@ bool Console::cmdResourceSize(int argc, const char **argv) {
}
int resNum = atoi(argv[2]);
if (resNum == 0) {
DebugPrintf("The resource number specified is not a number");
return true;
}
ResourceType res = parseResourceType(argv[1]);
if (res == kResourceTypeInvalid)

View file

@ -52,6 +52,7 @@ private:
// Kernel
// bool cmdClasses(int argc, const char **argv); // TODO
bool cmdOpcodes(int argc, const char **argv);
bool cmdSelector(int argc, const char **argv);
bool cmdSelectors(int argc, const char **argv);
bool cmdKernelFunctions(int argc, const char **argv);
bool cmdClassTable(int argc, const char **argv);

View file

@ -34,10 +34,6 @@ namespace Sci {
#define GF_FOR_SCI0_BEFORE_395 (GF_SCI0_OLD | GF_SCI0_OLDGETTIME)
#define GF_FOR_SCI0_BEFORE_629 GF_SCI0_OLDGETTIME
// SCI1
#define GF_FOR_SCI1_200_OR_LATER GF_SCI1_LOFSABSOLUTE
#define GF_FOR_SCI1_510_OR_LATER (GF_SCI1_LOFSABSOLUTE | GF_SCI1_NEWDOSOUND)
// Titles of the games
static const PlainGameDescriptor SciGameTitles[] = {
{"sci", "Sierra SCI Game"},
@ -147,7 +143,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "d226d7d3b4f77c4a566913fc310487fc", 792380},
{"resource.003", 0, "d226d7d3b4f77c4a566913fc310487fc", 464348},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -162,7 +158,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 826309},
{"resource.003", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 493638},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -188,7 +184,19 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d2f5a1be74ed963fa849a76892be5290", 794832},
{"resource.002", 0, "c0c29c51af66d65cb53f49e785a2d978", 1280907},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
// Castle of Dr. Brain - English DOS Floppy 1.1
{{"castlebrain", "", {
{"resource.map", 0, "f77728304c70017c54793eb6ca648174", 2745},
{"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 347071},
{"resource.001", 0, "13e81e1839cd7b216d2bb5615c1ca160", 796776},
{"resource.002", 0, "930e416bec196b9703a331d81b3d66f2", 1283812},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -200,7 +208,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 1197694},
{"resource.001", 0, "735be4e58957180cfc807d5e18fdffcd", 1433302},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -382,7 +390,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "1c3804e56b114028c5873a35c2f06d13", 653002},
{"resource.006", 0, "f9487732289a4f4966b4e34eea413325", 842817},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -399,7 +407,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1154950},
{"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1042966},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -416,7 +424,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1261462},
{"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284720},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -432,7 +440,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1260237},
{"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284609},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -449,7 +457,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243},
{"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER | GF_SCI1_EGA,
GF_SCI1_EGA,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -477,7 +485,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1176914},
{"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1123585},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -514,7 +522,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "28fe9b4f0567e71feb198bc9f3a2c605", 1241816},
{"resource.003", 0, "f3146df0ad4297f5ce35aa8c4753bf6c", 586832},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -528,7 +536,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "323b3b12f43d53f27d259beb225f0aa7", 1129316},
{"resource.003", 0, "83ac03e4bddb2c1ac2d36d2a587d0536", 1145616},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -542,7 +550,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "02d7d0411f7903aacb3bc8b0f8ca8a9a", 1202581},
{"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1175835},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -557,7 +565,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "2d21a1d2dcbffa551552e3e0725d2284", 1186033},
{"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1174993},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -874,7 +882,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "595b6039ea1356e7f96a52c58eedcf22", 355791},
{"resource.001", 0, "143df8aef214a2db34c2d48190742012", 632273},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -887,7 +895,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0d06cacc87dc21a08cd017e73036f905", 735},
{"resource.001", 0, "24db2bccda0a3c43ac4a7b5edb116c7e", 797678},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -900,7 +908,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 541845},
{"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 845795},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1111,7 +1119,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368},
{"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1482,7 +1490,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "5790ac0505f7ca98d4567132b875eb1e", 681041},
{"resource.003", 0, "4a34c3367c2fe7eb380d741374da1989", 572251},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1495,7 +1503,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "ec20246209d7b19f38989261e5c8f5b8", 1111226},
{"resource.002", 0, "85d6935ef77e6b0e16bc307640a0d913", 1088312},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1508,7 +1516,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d34cadb11e1aefbb497cf91bc1d3baa7", 1114688},
{"resource.002", 0, "85b030bb66d5342b0a068f1208c431a8", 1078443},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1535,7 +1543,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "3fe2a3aec0ed53c7d6db1845a67e3aa2", 1095908},
{"resource.003", 0, "ac175df0ea9a2cba57f0248651856d27", 376556},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1549,7 +1557,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bc8ca10c807515d959cbd91f9ba47735", 1123759},
{"resource.002", 0, "b7409ab32bc3bee2d6cce887cd33f2b6", 1092160},
{NULL, 0, NULL, 0}}, Common::RU_RUS, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1716,7 +1724,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "f8b2d1137bb767e5d232056b99dd69eb", 623621},
{"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 715598},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1735,7 +1743,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 754966},
{"resource.007", 0, "59eba83ad465b08d763b44f86afa86f6", 683135},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1764,7 +1772,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1024810},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 1030656},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1782,7 +1790,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1021774},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 993408},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1801,7 +1809,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 946540},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 958842},
{NULL, 0, NULL, 0}}, Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1820,7 +1828,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1015136},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 987222},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -1831,7 +1839,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a99776df795127f387cb35dae872d4e4", 5919},
{"resource.000", 0, "a8989a5a89e7d4f702b26b378c7a357a", 7001981},
{NULL, 0, NULL, 0}}, Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2157,7 +2165,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5b457cbe5042f557e5b610148171f6c0", 1158},
{"resource.001", 0, "453ea81ef66a50cbe33ce06302afe47f", 229737},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2328,7 +2336,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "630bfa65beb05f743552704ac2899dae", 759891},
{"resource.004", 0, "7b229fbdf30d670d0728cede3e984a7e", 838663},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2345,7 +2353,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "6258d5dd85898d8e218eb8113ebc9059", 722738},
{"resource.005", 0, "6258d5dd85898d8e218eb8113ebc9059", 704485},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2361,7 +2369,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "8791b9eef53edf77c2dac950142221d3", 1159791},
{"resource.004", 0, "1b91e891a3c60a941dac0eecdf83375b", 1143606},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2374,7 +2382,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "277f97771f7a6d89677141f02da313d6", 65150},
{"resource.001", 0, "5c5a551b6c86cce2ee75becb90e0b586", 624411},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2390,7 +2398,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "4836f460f4cfc8de61e2df4c45775504", 1180956},
{"resource.004", 0, "0c3eb84b9755852d9e795e0d5c9373c7", 1171760},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2567,7 +2575,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "ecace1a2771846b1a8aa1afdd44111a0", 6570147},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1,
SCI_VERSION_1_1
},
@ -2578,7 +2586,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "ec6f5cf369054dd3e5392995e9975b9e", 768218},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1,
SCI_VERSION_1_1
},
@ -2854,7 +2862,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b25a1539c71701f7715f738c5037e9a6", 775515},
{"resource.005", 0, "640ffe1a9acde392cc33cc1b1a528328", 806324},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2870,7 +2878,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "c47600e50c6fc591957ae0c5020ee7b8", 1213262},
{"resource.004", 0, "e19ea4ad131472f9238590f2e1d40289", 1203051},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2898,7 +2906,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9b78228ad4f9f335fedf74f1812dcfca", 513325},
{"resource.005", 0, "7d4ebcb745c0bf8fc42e4013f52ecd49", 1101812},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -2928,7 +2936,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 545053},
{"resource.005", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 687507},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER,
0,
SCI_VERSION_0,
SCI_VERSION_0
},
@ -3013,7 +3021,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "3540d1cc84d674cf4b2c898b88a3b563", 790296},
{"resource.006", 0, "ade814bc4d56244c156d9e9bcfebbc11", 664085},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3030,7 +3038,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "10ee1709e6559c724676d058199b75b5", 818745},
{"resource.006", 0, "67fb188b191d88efe8414af6ea297b93", 672675},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3042,7 +3050,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a18088c8aceb06025dbc945f29e02935", 5124},
{"resource.000", 0, "e1f46832cd2458796028e054a0466031", 5502009},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3054,7 +3062,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "71ccf4f82ac4efb588731acfb7bf2603", 5646},
{"resource.000", 0, "e1f46832cd2458796028e054a0466031", 933928},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3071,7 +3079,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "ff9c87da3bc53473fdee8b9d3edbc93c", 1200631},
{"resource.005", 0, "e33019ac19f755ae33fbf49b4fc9066c", 1053294},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3088,7 +3096,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "47ee647b5b12232d27e63cc627c25899", 1156765},
{"resource.006", 0, "dfb023e4e2a1e7a00fa18f9ede72a91b", 924059},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3104,7 +3112,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "4277c61bed40a50dadc4b5a344520af2", 1251000},
{"resource.005", 0, "5f885abd335978e2fd4e5f886d7676c8", 1102880},
{NULL, 0, NULL, 0}}, Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3117,7 +3125,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
{NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER | GF_SCI1_EGA,
GF_SCI1_EGA,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3130,7 +3138,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_510_OR_LATER | GF_SCI1_EGA,
GF_SCI1_EGA,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3158,7 +3166,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "776fba81c110d1908776232cbe190e20", 1253752},
{"resource.005", 0, "55fae26c2a92f16ef72c1e216e827c0f", 1098328},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NONE},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3173,7 +3181,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "74c62fa2146ff3b3b2ea2b3fb95b9af9", 1140801},
{"resource.003", 0, "42a307941edeb1a3be31daeb2e4be90b", 1088408},
{NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3190,7 +3198,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "c06350184a490c10eb4585fff0aa3192", 1254368},
{"resource.005", 0, "b8d6efbd3235329bfe844c794097b2c9", 1098717},
{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
GF_FOR_SCI1_200_OR_LATER,
0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@ -3413,7 +3421,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
FANMADE("The Legend of the Lost Jewel", "ba1bca315e3818c5626eda51bcfbcccf", 636, "9b0736d69924af0cff32a0f78db96855", 300398),
// FIXME: The vga demo does not have a resource.000/001 file.
//FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, GF_FOR_SCI1_510_OR_LATER),
//FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, 0),
{AD_TABLE_END_MARKER, 0, SCI_VERSION_AUTODETECT, SCI_VERSION_0}
};

View file

@ -377,7 +377,7 @@ int script_init_engine(EngineState *s) {
s->bp_list = NULL; // No breakpoints defined
s->have_bp = 0;
if ((s->_flags & GF_SCI1_LOFSABSOLUTE) && s->_version < SCI_VERSION_1_1)
if (s->_kernel->hasLofsAbsolute())
s->seg_manager->setExportWidth(1);
else
s->seg_manager->setExportWidth(0);

View file

@ -356,35 +356,54 @@ static const char *argtype_description[] = {
Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) {
memset(&_selectorMap, 0, sizeof(_selectorMap)); // FIXME: Remove this once/if we C++ify selector_map_t
loadKernelNames();
loadSelectorNames(isOldSci0);
mapSelectors(); // Map a few special selectors for later use
loadOpcodes();
loadKernelNames();
mapFunctions(); // Map the kernel functions
if (!loadSelectorNames(isOldSci0)) {
error("Kernel: Could not retrieve selector names");
}
// SCI0 games using old graphics functions (before version 0.000.502) did not have a
// motionCue selector
_oldGfxFunctions = (_selectorMap.motionCue == -1 && _resmgr->_sciVersion == SCI_VERSION_0);
// Map the kernel functions
mapFunctions();
// SCI1 games which use absolute lofs have the egoMoveSpeed selector
_hasLofsAbsolute = (_selectorMap.egoMoveSpeed != -1 && _resmgr->_sciVersion < SCI_VERSION_1_1);
// Map a few special selectors for later use
mapSelectors();
// SCI0 games using old graphics functions (before version 0.000.502) have the TimesSin
// kernel function, whereas newer games have the SinMult kernel function in its place
_oldGfxFunctions = !hasKernelFunction("SinMult");
printAutoDetectedFeatures();
}
Kernel::~Kernel() {
}
bool Kernel::loadSelectorNames(bool isOldSci0) {
void Kernel::printAutoDetectedFeatures() {
if (_oldGfxFunctions)
printf("Kernel auto-detection: game found to be using old graphics functions\n");
else
printf("Kernel auto-detection: game found to be using newer graphics functions\n");
if (_hasLofsAbsolute)
printf("Kernel auto-detection: game found to be using absolute parameters for lofs\n");
else
printf("Kernel auto-detection: game found to be using relative parameters for lofs\n");
if (_selectorMap.setVol != -1)
printf("Kernel auto-detection: using SCI1 sound functions\n");
else if (_selectorMap.nodePtr != -1)
printf("Kernel auto-detection: using SCI01 sound functions\n");
else
printf("Kernel auto-detection: using SCI0 sound functions\n");
if (_resmgr->_sciVersion == SCI_VERSION_0 && _selectorMap.sightAngle != -1)
printf("Kernel auto-detection: found SCI0 game using a SCI1 kernel table\n");
}
void Kernel::loadSelectorNames(bool isOldSci0) {
int count;
Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0);
if (!r) // No such resource?
return false;
error("Kernel: Could not retrieve selector names");
count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off
@ -394,14 +413,13 @@ bool Kernel::loadSelectorNames(bool isOldSci0) {
Common::String tmp((const char *)r->data + offset + 2, len);
_selectorNames.push_back(tmp);
//printf("%s\n", tmp.c_str()); // debug
// Early SCI versions used the LSB in the selector ID as a read/write
// toggle. To compensate for that, we add every selector name twice.
if (isOldSci0)
_selectorNames.push_back(tmp);
}
return true;
}
bool Kernel::loadOpcodes() {
@ -732,46 +750,39 @@ reg_t *kernel_dereference_reg_pointer(EngineState *s, reg_t pointer, int entries
return (reg_t*)_kernel_dereference_pointer(s, pointer, entries, sizeof(reg_t));
}
void setDefaultKernelNames(Common::StringList &names) {
names.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR);
for (int i = 0; i < SCI_KNAMES_DEFAULT_ENTRIES_NR; i++)
names[i] = sci_default_knames[i];
void Kernel::setDefaultKernelNames() {
bool isSci0 = (_resmgr->_sciVersion == SCI_VERSION_0);
int offset = 0;
// Check if we have a SCI01 game which uses a SCI1 kernel table (e.g. the KQ1 demo
// and full version). We do this by checking if the sightAngle selector exists, as no
// SCI0 game seems to have it
if (_selectorMap.sightAngle != -1 && isSci0)
isSci0 = false;
_kernelNames.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR + (isSci0 ? 4 : 0));
for (int i = 0; i < SCI_KNAMES_DEFAULT_ENTRIES_NR; i++) {
// In SCI0, Platform was DoAvoider
if (!strcmp(sci_default_knames[i], "Platform") && isSci0) {
_kernelNames[i + offset] = "DoAvoider";
continue;
}
static void vocab_get_knames0(ResourceManager *resmgr, Common::StringList &names) {
int count, i, index = 2, empty_to_add = 1;
Resource *r = resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES), 0);
_kernelNames[i + offset] = sci_default_knames[i];
if (!r) { // No kernel name table found? Fall back to default table
setDefaultKernelNames(names);
return;
// SCI0 has 4 extra functions between SetCursor (0x28) and Savegame
if (!strcmp(sci_default_knames[i], "SetCursor") && isSci0) {
_kernelNames[i + 1] = "FOpen";
_kernelNames[i + 2] = "FPuts";
_kernelNames[i + 3] = "FGets";
_kernelNames[i + 4] = "FClose";
offset = 4;
}
}
count = READ_LE_UINT16(r->data);
if (count > 1023) {
// Newer kernel name table, found in KQ1. We can use the default table here
setDefaultKernelNames(names);
return;
}
if (count < SCI0_KNAMES_WELL_DEFINED) {
empty_to_add = SCI0_KNAMES_WELL_DEFINED - count;
sciprintf("Less than %d kernel functions; adding %d\n", SCI0_KNAMES_WELL_DEFINED, empty_to_add);
}
names.resize(count + 1 + empty_to_add);
for (i = 0; i < count; i++) {
int offset = READ_LE_UINT16(r->data + index);
int len = READ_LE_UINT16(r->data + offset);
//fprintf(stderr,"Getting name %d of %d...\n", i, count);
index += 2;
names[i] = Common::String((const char *)r->data + offset + 2, len);
}
for (i = 0; i < empty_to_add; i++) {
names[count + i] = SCRIPT_UNKNOWN_FUNCTION_STRING;
if (_resmgr->_sciVersion == SCI_VERSION_1_1) {
// KQ6CD calls unimplemented function 0x26
_kernelNames[0x26] = "Dummy";
}
}
@ -810,16 +821,9 @@ bool Kernel::loadKernelNames() {
case SCI_VERSION_01:
case SCI_VERSION_01_VGA:
case SCI_VERSION_01_VGA_ODD:
vocab_get_knames0(_resmgr, _kernelNames);
break;
case SCI_VERSION_1_EARLY:
case SCI_VERSION_1_LATE:
case SCI_VERSION_1:
case SCI_VERSION_1_1:
setDefaultKernelNames(_kernelNames);
if (_resmgr->_sciVersion == SCI_VERSION_1_1) {
// KQ6CD calls unimplemented function 0x26
_kernelNames[0x26] = "Dummy";
}
setDefaultKernelNames();
break;
#ifdef ENABLE_SCI32
case SCI_VERSION_32:

View file

@ -83,14 +83,22 @@ public:
*/
bool hasKernelFunction(const char *functionName) const;
/* Applies to all versions before 0.000.502
** Old SCI versions used to interpret the third DrawPic() parameter inversely,
** with the opposite default value (obviously).
** Also, they used 15 priority zones from 42 to 200 instead of 14 priority
** zones from 42 to 190.
/**
* Applies to all versions before 0.000.502
* Old SCI versions used to interpret the third DrawPic() parameter inversely,
* with the opposite default value (obviously).
* Also, they used 15 priority zones from 42 to 200 instead of 14 priority
* zones from 42 to 190.
*/
bool usesOldGfxFunctions() const { return _oldGfxFunctions; }
/**
* Applies to all SCI1 versions after 1.000.200
* In late SCI1 versions, the argument of lofs[as] instructions
* is absolute rather than relative.
*/
bool hasLofsAbsolute() const { return _hasLofsAbsolute; }
// Script dissection/dumping functions
void dissectScript(int scriptNumber, Vocabulary *vocab);
void dumpScriptObject(char *data, int seeker, int objsize);
@ -112,10 +120,19 @@ private:
bool loadKernelNames();
/**
* Loads the kernel selector names.
* @return True upon success, false otherwise.
* Sets the default kernel function names, based on the SCI version used
*/
bool loadSelectorNames(bool isOldSci0);
void setDefaultKernelNames();
/**
* Loads the kernel selector names.
*/
void loadSelectorNames(bool isOldSci0);
/**
* Prints auto-detected features from selectors
*/
void printAutoDetectedFeatures();
/**
* Maps special selectors
@ -135,6 +152,7 @@ private:
ResourceManager *_resmgr;
bool _oldGfxFunctions;
bool _hasLofsAbsolute;
// Kernel-related lists
/**

View file

@ -304,7 +304,9 @@ static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int
reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) {
switch (argc) {
case 1 :
if (s->_version < SCI_VERSION_1_1) {
if (s->_version < SCI_VERSION_1) {
GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16()));
} else if (s->_version == SCI_VERSION_1) {
if (argv[0].toSint16() <= 1) {
// Newer (SCI1.1) semantics: show/hide cursor
CursorMan.showMouse(argv[0].toSint16() != 0);
@ -312,13 +314,16 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// Pre-SCI1.1: set cursor according to the first parameter
GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16()));
}
} else {
} else if (s->_version >= SCI_VERSION_1_1) {
// SCI1.1: Show/hide cursor
CursorMan.showMouse(argv[0].toSint16() != 0);
}
break;
case 2 :
if (s->_version < SCI_VERSION_1_1) {
if (s->_version < SCI_VERSION_1) {
GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state,
argv[1].toSint16() == 0 ? GFXOP_NO_POINTER : argv[0].toSint16()));
} else if (s->_version == SCI_VERSION_1) {
// Pre-SCI1.1: set cursor according to the first parameter, and toggle its
// visibility based on the second parameter
// Some late SCI1 games actually use the SCI1.1 version of this call (EcoQuest 1
@ -337,7 +342,7 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) {
GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state,
Common::Point(argv[0].toUint16(), argv[1].toUint16())));
}
} else {
} else if (s->_version >= SCI_VERSION_1_1) {
// SCI1.1 and newer: set pointer position
GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state,
Common::Point(argv[0].toUint16(), argv[1].toUint16())));

View file

@ -964,9 +964,9 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (s->_version >= SCI_VERSION_1_1 || s->_flags & GF_SCI1_NEWDOSOUND)
if (s->_kernel->_selectorMap.setVol != -1)
return kDoSound_SCI1(s, funct_nr, argc, argv);
else if (s->_version >= SCI_VERSION_01)
else if (s->_kernel->_selectorMap.nodePtr != -1)
return kDoSound_SCI01(s, funct_nr, argc, argv);
else
return kDoSound_SCI0(s, funct_nr, argc, argv);

View file

@ -97,8 +97,7 @@ void script_adjust_opcode_formats(int res_version) {
break;
case SCI_VERSION_01_VGA:
case SCI_VERSION_01_VGA_ODD:
case SCI_VERSION_1_EARLY:
case SCI_VERSION_1_LATE:
case SCI_VERSION_1:
case SCI_VERSION_1_1:
g_opcode_formats[op_lofsa][0] = Script_Offset;
g_opcode_formats[op_lofss][0] = Script_Offset;
@ -203,6 +202,10 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(printLang);
FIND_SELECTOR(subtitleLang);
FIND_SELECTOR(parseLang);
FIND_SELECTOR(motionCue);
FIND_SELECTOR(sightAngle);
FIND_SELECTOR(setVol);
FIND_SELECTOR(egoMoveSpeed);
}
void Kernel::dumpScriptObject(char *data, int seeker, int objsize) {

View file

@ -1193,7 +1193,7 @@ void run_vm(EngineState *s, int restoring) {
if (s->_version >= SCI_VERSION_1_1) {
s->r_acc.offset = opparams[0] + local_script->script_size;
} else {
if (s->_flags & GF_SCI1_LOFSABSOLUTE)
if (s->_kernel->hasLofsAbsolute())
s->r_acc.offset = opparams[0];
else
s->r_acc.offset = xs->addr.pc.offset + opparams[0];
@ -1210,7 +1210,7 @@ void run_vm(EngineState *s, int restoring) {
case 0x3a: // lofss
r_temp.segment = xs->addr.pc.segment;
if (s->_flags & GF_SCI1_LOFSABSOLUTE)
if (s->_kernel->hasLofsAbsolute())
r_temp.offset = opparams[0];
else
r_temp.offset = xs->addr.pc.offset + opparams[0];

View file

@ -203,6 +203,10 @@ struct selector_map_t {
Selector printLang; /**< Used for i18n */
Selector subtitleLang;
Selector parseLang;
Selector motionCue; // Used to detect newer graphics functions semantics.
Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table
Selector setVol; // Used to detect newer sound semantics
Selector egoMoveSpeed; // Used to detect SCI1 games which use absolute values in lofs
};
// A reference to an object's variable.

View file

@ -289,15 +289,14 @@ int GfxDriver::setPointer(gfx_pixmap_t *pointer, Common::Point *hotspot) {
} else {
byte *cursorData = createCursor(pointer);
// FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT
// Note that some cursors don't have a palette in SQ5
// FIXME: The palette size check is a workaround for cursors using non-palette color GFX_CURSOR_TRANSPARENT
// Note that some cursors don't have a palette (e.g. in SQ5 and QFG3)
byte color_key = GFX_CURSOR_TRANSPARENT;
if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && (pointer->palette && (unsigned int)pointer->color_key < pointer->palette->size()))
color_key = pointer->palette->getColor(pointer->color_key).parent_index;
// Some cursors in SQ5 don't have a palette. The cursor palette seems to use 64 colors, so setting the color key to 63 works
// TODO: Is this correct?
// Some cursors don't have a palette, so we set the color key directly
if (!pointer->palette)
color_key = 63;
color_key = pointer->color_key;
CursorMan.replaceCursor(cursorData, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key);
CursorMan.showMouse(true);

View file

@ -535,7 +535,7 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1);
else if (_version == SCI_VERSION_01 || !_isVGA)
view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette);
else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1_LATE)
else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1)
view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette, false);
else if (_version >= SCI_VERSION_1_1)
view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, 0, true);

View file

@ -48,8 +48,7 @@ const char *sci_version_types[] = {
"SCI version 0.xxx w/ 1.000 compression",
"SCI version 1.000 w/ 0.xxx resource.map",
"SCI version 1.000 w/ special resource.map",
"SCI version 1.000 (early)",
"SCI version 1.000 (late)",
"SCI version 1.000",
"SCI version 1.001",
"SCI WIN/32"
};
@ -509,16 +508,9 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
case SCI_VERSION_01_VGA_ODD:
version = _mapVersion;
break;
case SCI_VERSION_1: {
Resource *res = testResource(ResourceId(kResourceTypeScript, 0));
_sciVersion = version = SCI_VERSION_1_EARLY;
loadResource(res);
if (res->status == kResStatusNoMalloc)
version = SCI_VERSION_1_LATE;
case SCI_VERSION_1:
_sciVersion = version = SCI_VERSION_1;
break;
}
case SCI_VERSION_1_1:
// No need to handle SCI 1.1 here - it was done in resource_map.cpp
version = SCI_VERSION_1_1;
@ -542,11 +534,8 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
case SCI_VERSION_01_VGA_ODD:
debug("Resmgr: Detected SCI01VGA - Jones/CD or similar");
break;
case SCI_VERSION_1_EARLY:
debug("Resmgr: Detected SCI1 Early");
break;
case SCI_VERSION_1_LATE:
debug("Resmgr: Detected SCI1 Late");
case SCI_VERSION_1:
debug("Resmgr: Detected SCI1");
break;
case SCI_VERSION_1_1:
debug("Resmgr: Detected SCI1.1");

View file

@ -66,8 +66,6 @@ enum {
/* the first critical error number */
};
#define SCI_VERSION_1 SCI_VERSION_1_EARLY
#define MAX_OPENED_VOLUMES 5 // Max number of simultaneously opened volumes
enum ResSourceType {

View file

@ -43,14 +43,13 @@ namespace Sci {
class GfxDriver;
const char *versionNames[9] = {
const char *versionNames[8] = {
"Autodetected",
"SCI0",
"SCI01 EGA",
"SCI01 VGA",
"SCI01 VGA ODD",
"SCI1 early",
"SCI1 late",
"SCI1",
"SCI1.1",
"SCI32"
};
@ -154,14 +153,12 @@ Common::Error SciEngine::run() {
_gamestate = new EngineState(_resmgr, version, flags);
// Verify that we haven't got an invalid game detection entry
if (version < SCI_VERSION_1_EARLY) {
if (version < SCI_VERSION_1) {
// SCI0/SCI01
if (flags & GF_SCI1_EGA ||
flags & GF_SCI1_LOFSABSOLUTE ||
flags & GF_SCI1_NEWDOSOUND) {
if (flags & GF_SCI1_EGA) {
error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set");
}
} else if (version >= SCI_VERSION_1_EARLY && version <= SCI_VERSION_1_LATE) {
} else if (version == SCI_VERSION_1) {
// SCI1
if (flags & GF_SCI0_OLD ||
@ -169,9 +166,7 @@ Common::Error SciEngine::run() {
error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set");
}
} else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) {
if (flags & GF_SCI1_EGA ||
flags & GF_SCI1_LOFSABSOLUTE ||
flags & GF_SCI1_NEWDOSOUND) {
if (flags & GF_SCI1_EGA) {
error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI1 flags set");
}

View file

@ -49,16 +49,15 @@ enum kDebugLevels {
kDebugLevelGfxDriver = 1 << 8,
kDebugLevelBaseSetter = 1 << 9,
kDebugLevelParser = 1 << 10,
// FIXME: seems that debug level 11 is special (check debugC in common/debug.cpp)
kDebugLevelMenu = 1 << 12,
kDebugLevelSaid = 1 << 13,
kDebugLevelFile = 1 << 14,
kDebugLevelTime = 1 << 15,
kDebugLevelRoom = 1 << 16,
kDebugLevelAvoidPath = 1 << 17,
kDebugLevelDclInflate = 1 << 18,
kDebugLevelVM = 1 << 19,
kDebugLevelScripts = 1 << 20
kDebugLevelMenu = 1 << 11,
kDebugLevelSaid = 1 << 12,
kDebugLevelFile = 1 << 13,
kDebugLevelTime = 1 << 14,
kDebugLevelRoom = 1 << 15,
kDebugLevelAvoidPath = 1 << 16,
kDebugLevelDclInflate = 1 << 17,
kDebugLevelVM = 1 << 18,
kDebugLevelScripts = 1 << 19
};
struct SciGameDescription {
@ -74,54 +73,38 @@ enum SciGameVersions {
SCI_VERSION_01 = 2,
SCI_VERSION_01_VGA = 3,
SCI_VERSION_01_VGA_ODD = 4,
SCI_VERSION_1_EARLY = 5,
SCI_VERSION_1_LATE = 6,
SCI_VERSION_1 = 5,
SCI_VERSION_1_1 = 7,
SCI_VERSION_32 = 8
};
extern const char *versionNames[9];
extern const char *versionNames[8];
enum SciGameFlags {
/*
** SCI0 flags
*/
// SCI0 flags
/* Applies to all versions before 0.000.395 (i.e. KQ4 old, XMAS 1988 and LSL2)
** Old SCI versions used two word header for script blocks (first word equal
** to 0x82, meaning of the second one unknown). New SCI versions used one
** word header.
** Also, old SCI versions assign 120 degrees to left & right, and 60 to up
** and down. Later versions use an even 90 degree distribution.
* Old SCI versions used two word header for script blocks (first word equal
* to 0x82, meaning of the second one unknown). New SCI versions used one
* word header.
* Also, old SCI versions assign 120 degrees to left & right, and 60 to up
* and down. Later versions use an even 90 degree distribution.
*/
GF_SCI0_OLD = (1 << 0),
/* Applies to all versions before 0.000.629
** Older SCI versions had simpler code for GetTime()
* Older SCI versions had simpler code for GetTime()
*/
GF_SCI0_OLDGETTIME = (1 << 1),
// ----------------------------------------------------------------------------
/*
** SCI1 flags
*/
// SCI1 flags
/*
** Used to distinguish SCI1 EGA games
* Used to distinguish SCI1 EGA games
*/
GF_SCI1_EGA = (1 << 2),
/* Applies to all SCI1 versions after 1.000.200
** In late SCI1 versions, the argument of lofs[as] instructions
** is absolute rather than relative.
*/
GF_SCI1_LOFSABSOLUTE = (1 << 3),
/* Applies to all versions from 1.000.510 onwards
** kDoSound() is different than in earlier SCI1 versions.
*/
GF_SCI1_NEWDOSOUND = (1 << 4)
GF_SCI1_EGA = (1 << 2)
};
class SciEngine : public Engine {

View file

@ -1269,6 +1269,14 @@ static void song_iterator_remove_death_listener(SongIterator *it, TeeSongIterato
}
}
static void song_iterator_transfer_death_listeners(SongIterator *it, SongIterator *it_from) {
for (int i = 0; i < SONGIT_MAX_LISTENERS; ++i) {
if (it_from->_deathListeners[i])
song_iterator_add_death_listener(it, it_from->_deathListeners[i]);
it_from->_deathListeners[i] = 0;
}
}
static void songit_tee_death_notification(TeeSongIterator *self, SongIterator *corpse) {
if (corpse == self->_children[TEE_LEFT].it) {
self->_status &= ~TEE_LEFT_ACTIVE;
@ -1505,12 +1513,16 @@ SongIterator *TeeSongIterator::handleMessage(Message msg) {
delete _children[TEE_LEFT].it;
_children[TEE_LEFT].it = 0;
old_it = _children[TEE_RIGHT].it;
song_iterator_remove_death_listener(old_it, this);
song_iterator_transfer_death_listeners(old_it, this);
delete this;
return old_it;
} else if (!(_status & TEE_RIGHT_ACTIVE)) {
delete _children[TEE_RIGHT].it;
_children[TEE_RIGHT].it = 0;
old_it = _children[TEE_LEFT].it;
song_iterator_remove_death_listener(old_it, this);
song_iterator_transfer_death_listeners(old_it, this);
delete this;
return old_it;
}
@ -1582,9 +1594,11 @@ int songit_next(SongIterator **it, byte *buf, int *result, int mask) {
** cleanup iterator */
int channel_mask = (*it)->channel_mask;
if (mask & IT_READER_MAY_FREE)
delete *it;
SongIterator *old_it = *it;
*it = new CleanupSongIterator(channel_mask);
song_iterator_transfer_death_listeners(*it, old_it);
if (mask & IT_READER_MAY_FREE)
delete old_it;
retval = -9999; /* Continue */
}
} while (!( /* Until one of the following holds */

View file

@ -474,7 +474,7 @@ bool Win32ResExtractor::check_offset(byte *memory, int total_size, const char *n
int need_size = (int)((byte *)offset - memory + size);
debugC(DEBUG_RESOURCE, "check_offset: size=%x vs %x offset=%x size=%x",
need_size, total_size, (byte *)offset - memory, size);
need_size, total_size, (uint)((byte *)offset - memory), size);
if (need_size < 0 || need_size > total_size) {
error("%s: premature end", name);

View file

@ -462,7 +462,7 @@ void ScummEngine::executeScript() {
vm.slot[_currentScript].didexec = true;
debugC(DEBUG_OPCODES, "Script %d, offset 0x%x: [%X] %s()",
vm.slot[_currentScript].number,
_scriptPointer - _scriptOrgPointer,
(uint)(_scriptPointer - _scriptOrgPointer),
_opcode,
getOpcodeDesc(_opcode));
if (_hexdumpScripts == true) {

View file

@ -72,7 +72,6 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled),
error("Failed to load any GUI theme, aborting");
}
}
_themeChange = false;
}
GuiManager::~GuiManager() {
@ -143,12 +142,20 @@ bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx)
// Enable the new theme
//
_theme = newTheme;
_themeChange = true;
_useStdCursor = !_theme->ownCursor();
// If _stateIsSaved is set, we know that a Theme is already initialized,
// thus we initialize the new theme properly
if (_stateIsSaved) {
_theme->enable();
if (_useStdCursor)
setupCursor();
}
// refresh all dialogs
for (int i = 0; i < _dialogStack.size(); ++i) {
for (int i = 0; i < _dialogStack.size(); ++i)
_dialogStack[i]->reflowLayout();
}
// We need to redraw immediately. Otherwise
// some other event may cause a widget to be
@ -157,10 +164,6 @@ bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx)
redraw();
_system->updateScreen();
Common::Event event;
event.type = Common::EVENT_SCREEN_CHANGED;
_system->getEventManager()->pushEvent(event);
return true;
}
@ -233,7 +236,6 @@ void GuiManager::runLoop() {
// _theme->refresh();
_themeChange = false;
_redrawStatus = kRedrawFull;
redraw();
}
@ -285,21 +287,6 @@ void GuiManager::runLoop() {
Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
// HACK to change the cursor to the new themes one
if (_themeChange) {
_theme->enable();
_useStdCursor = !_theme->ownCursor();
if (_useStdCursor)
setupCursor();
// _theme->refresh();
_themeChange = false;
_redrawStatus = kRedrawFull;
redraw();
}
if (lastRedraw + waitTime < _system->getMillis()) {
_theme->updateScreen();
_system->updateScreen();

View file

@ -122,8 +122,6 @@ protected:
int _cursorAnimateTimer;
byte _cursor[2048];
bool _themeChange;
void initKeymap();
void saveState();