[Scummvm-cvs-logs] CVS: scummvm/scumm input.cpp,NONE,2.1 charset.cpp,2.106,2.107 gfx.cpp,2.315,2.316 module.mk,1.41,1.42 scumm.cpp,1.221,1.222 scumm.h,1.490,1.491 vars.cpp,1.105,1.106
Max Horn
fingolfin at users.sourceforge.net
Mon Sep 20 15:05:03 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17146
Modified Files:
charset.cpp gfx.cpp module.mk scumm.cpp scumm.h vars.cpp
Added Files:
input.cpp
Log Message:
Moved some init code around (hopefully this'll help PalmOS)
--- NEW FILE: input.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2004 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/input.cpp,v 2.1 2004/09/20 22:04:05 fingolfin Exp $
*
*/
#include "stdafx.h"
#include "common/config-manager.h"
#include "scumm/debugger.h"
#include "scumm/imuse.h"
#include "scumm/insane/insane.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"
namespace Scumm {
enum MouseButtonStatus {
msDown = 1,
msClicked = 2
};
void ScummEngine::parseEvents() {
OSystem::Event event;
while (_system->poll_event(&event)) {
switch(event.event_code) {
case OSystem::EVENT_KEYDOWN:
if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9'
&& (event.kbd.flags == OSystem::KBD_ALT ||
event.kbd.flags == OSystem::KBD_CTRL)) {
_saveLoadSlot = event.kbd.keycode - '0';
// don't overwrite autosave (slot 0)
if (_saveLoadSlot == 0)
_saveLoadSlot = 10;
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
_saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
_saveTemporaryState = false;
} else if (event.kbd.flags == OSystem::KBD_CTRL) {
if (event.kbd.keycode == 'f')
_fastMode ^= 1;
else if (event.kbd.keycode == 'g')
_fastMode ^= 2;
else if (event.kbd.keycode == 'd')
_debugger->attach();
else if (event.kbd.keycode == 's')
resourceStats();
else
_keyPressed = event.kbd.ascii; // Normal key press, pass on to the game.
} else if (event.kbd.flags & OSystem::KBD_ALT) {
// The result must be 273 for Alt-W
// because that's what MI2 looks for in
// its "instant win" cheat.
_keyPressed = event.kbd.keycode + 154;
} else if (event.kbd.ascii == 315 && (_gameId == GID_CMI && !(_features & GF_DEMO))) {
// FIXME: support in-game menu screen. For now, this remaps F1 to F5 in COMI
_keyPressed = 319;
} else if (_gameId == GID_INDY4 && event.kbd.ascii >= '0' && event.kbd.ascii <= '9') {
// To support keyboard fighting in FOA, we need to remap the number keys.
// FOA apparently expects PC scancode values (see script 46 if you want
// to know where I got these numbers from).
static const int numpad[10] = {
'0',
335, 336, 337,
331, 332, 333,
327, 328, 329
};
_keyPressed = numpad[event.kbd.ascii - '0'];
} else if (event.kbd.ascii < 273 || event.kbd.ascii > 276 || _version >= 7) {
// don't let game have arrow keys as we currently steal them
// for keyboard cursor control
// this fixes bug with up arrow (273) corresponding to
// "instant win" cheat in MI2 mentioned above
//
// This is not applicable to Full Throttle as it processes keyboard
// cursor control by itself. Also it fixes derby scene
_keyPressed = event.kbd.ascii; // Normal key press, pass on to the game.
}
if (_keyPressed >= 512)
debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed);
else
_keyDownMap[_keyPressed] = true;
break;
case OSystem::EVENT_KEYUP:
// FIXME: for some reason OSystem::KBD_ALT is set sometimes
// possible to a bug in sdl-common.cpp
if (event.kbd.ascii >= 512)
debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
else
_keyDownMap[event.kbd.ascii] = false;
break;
case OSystem::EVENT_MOUSEMOVE:
_mouse.x = event.mouse.x;
_mouse.y = event.mouse.y;
break;
case OSystem::EVENT_LBUTTONDOWN:
_leftBtnPressed |= msClicked|msDown;
#if defined(_WIN32_WCE) || defined(__PALM_OS__)
_mouse.x = event.mouse.x;
_mouse.y = event.mouse.y;
#endif
break;
case OSystem::EVENT_RBUTTONDOWN:
_rightBtnPressed |= msClicked|msDown;
#if defined(_WIN32_WCE) || defined(__PALM_OS__)
_mouse.x = event.mouse.x;
_mouse.y = event.mouse.y;
#endif
break;
case OSystem::EVENT_LBUTTONUP:
_leftBtnPressed &= ~msDown;
break;
case OSystem::EVENT_RBUTTONUP:
_rightBtnPressed &= ~msDown;
break;
// The following two cases enable dialog choices to be
// scrolled through in the SegaCD version of MI
// as nothing else uses the wheel don't bother
// checking the gameid
case OSystem::EVENT_WHEELDOWN:
_keyPressed = 55;
break;
case OSystem::EVENT_WHEELUP:
_keyPressed = 54;
break;
case OSystem::EVENT_QUIT:
if (_confirmExit)
confirmexitDialog();
else
_quit = true;
break;
default:
break;
}
}
}
void ScummEngine::clearClickedStatus() {
_keyPressed = 0;
_mouseButStat = 0;
_leftBtnPressed &= ~msClicked;
_rightBtnPressed &= ~msClicked;
}
void ScummEngine::processKbd(bool smushMode) {
int saveloadkey;
_lastKeyHit = _keyPressed;
_keyPressed = 0;
if (((_version <= 2) || (_features & GF_FMTOWNS && _version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) {
// Convert F-Keys for V1/V2 games (they start at 1 instead of at 315)
_lastKeyHit -= 314;
}
//
// Clip the mouse coordinates, and compute _virtualMouse.x (and clip it, too)
//
if (_mouse.x < 0)
_mouse.x = 0;
if (_mouse.x > _screenWidth-1)
_mouse.x = _screenWidth-1;
if (_mouse.y < 0)
_mouse.y = 0;
if (_mouse.y > _screenHeight-1)
_mouse.y = _screenHeight-1;
_virtualMouse.x = _mouse.x + virtscr[0].xstart;
_virtualMouse.y = _mouse.y - virtscr[0].topline;
if (_features & GF_NEW_CAMERA)
_virtualMouse.y += _screenTop;
if (_virtualMouse.y < 0)
_virtualMouse.y = -1;
if (_virtualMouse.y >= virtscr[0].h)
_virtualMouse.y = -1;
//
// Determine the mouse button state.
//
_mouseButStat = 0;
// Interpret 'return' as left click and 'tab' as right click
if (_lastKeyHit && _cursor.state > 0) {
if (_lastKeyHit == 9) {
_mouseButStat = MBS_RIGHT_CLICK;
_lastKeyHit = 0;
} else if (_lastKeyHit == 13) {
_mouseButStat = MBS_LEFT_CLICK;
_lastKeyHit = 0;
}
}
if (_leftBtnPressed & msClicked && _rightBtnPressed & msClicked && _version > 3) {
// Pressing both mouse buttons is treated as if you pressed
// the cutscene exit key (i.e. ESC in most games). That mimicks
// the behaviour of the original engine where pressing both
// mouse buttons also skips the current cutscene.
_mouseButStat = 0;
_lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY);
} else if (_rightBtnPressed & msClicked && (_version < 4 && _gameId != GID_LOOM)) {
// Pressing right mouse button is treated as if you pressed
// the cutscene exit key (i.e. ESC in most games). That mimicks
// the behaviour of the original engine where pressing right
// mouse button also skips the current cutscene.
_mouseButStat = 0;
_lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY);
} else if (_leftBtnPressed & msClicked) {
_mouseButStat = MBS_LEFT_CLICK;
} else if (_rightBtnPressed & msClicked) {
_mouseButStat = MBS_RIGHT_CLICK;
}
if (_version == 8) {
VAR(VAR_MOUSE_BUTTONS) = 0;
VAR(VAR_MOUSE_HOLD) = 0;
VAR(VAR_RIGHTBTN_HOLD) = 0;
if (_leftBtnPressed & msClicked)
VAR(VAR_MOUSE_BUTTONS) += 1;
if (_rightBtnPressed & msClicked)
VAR(VAR_MOUSE_BUTTONS) += 2;
if (_leftBtnPressed & msDown)
VAR(VAR_MOUSE_HOLD) += 1;
if (_rightBtnPressed & msDown) {
VAR(VAR_RIGHTBTN_HOLD) = 1;
VAR(VAR_MOUSE_HOLD) += 2;
}
} else if (_version >= 6) {
VAR(VAR_LEFTBTN_HOLD) = (_leftBtnPressed & msDown) != 0;
VAR(VAR_RIGHTBTN_HOLD) = (_rightBtnPressed & msDown) != 0;
if (_version == 7) {
VAR(VAR_LEFTBTN_DOWN) = (_leftBtnPressed & msClicked) != 0;
VAR(VAR_RIGHTBTN_DOWN) = (_rightBtnPressed & msClicked) != 0;
}
}
_leftBtnPressed &= ~msClicked;
_rightBtnPressed &= ~msClicked;
if (!_lastKeyHit)
return;
// If a key script was specified (a V8 feature), and it's trigger
// key was pressed, run it.
if (_keyScriptNo && (_keyScriptKey == _lastKeyHit)) {
runScript(_keyScriptNo, 0, 0, 0);
return;
}
#ifdef _WIN32_WCE
if (_lastKeyHit == KEY_ALL_SKIP) {
// Skip cutscene
if (smushMode) {
_lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY);
}
else
if (vm.cutScenePtr[vm.cutSceneStackPointer])
_lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY);
else
// Skip talk
if (_talkDelay > 0)
_lastKeyHit = (uint)VAR(VAR_TALKSTOP_KEY);
else
// Escape
_lastKeyHit = 27;
}
#endif
if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY) ||
(((_version <= 2) || (_features & GF_FMTOWNS && _version == 3)) && _lastKeyHit == 8)) {
confirmrestartDialog();
return;
}
if ((VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) ||
(VAR_PAUSE_KEY == 0xFF && _lastKeyHit == ' ')) {
pauseGame();
return;
}
// COMI version string is hard coded
// Dig/FT version strings are partly hard coded too
if (_version == 7 && _lastKeyHit == VAR(VAR_VERSION_KEY)) {
versionDialog();
return;
}
if ((_version <= 2) || (_features & GF_FMTOWNS && _version == 3))
saveloadkey = 5; // F5
else if ((_version <= 3) || (_gameId == GID_SAMNMAX) || (_gameId == GID_CMI) || (_heversion >= 72))
saveloadkey = 319; // F5
else
saveloadkey = VAR(VAR_MAINMENU_KEY);
if (_lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY) ||
(VAR(VAR_CUTSCENEEXIT_KEY) == 4 && _lastKeyHit == 27)) {
// Skip cutscene (or active SMUSH video). For the V2 games, which
// normally use F4 for this, we add in a hack that makes escape work,
// too (just for convenience).
if (smushMode) {
if (_gameId == GID_FT)
_insane->escapeKeyHandler();
else
_smushVideoShouldFinish = true;
}
if (!smushMode || _smushVideoShouldFinish)
abortCutscene();
if (_version <= 2) {
// Ensure that the input script also sees the key press.
// This is necessary so you can abort the airplane travel
// in Zak.
VAR(VAR_KEYPRESS) = VAR(VAR_CUTSCENEEXIT_KEY);
}
} else if (_lastKeyHit == saveloadkey) {
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
mainMenuDialog(); // Display NewGui
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0);
return;
} else if (VAR_TALKSTOP_KEY != 0xFF && _lastKeyHit == VAR(VAR_TALKSTOP_KEY)) {
_talkDelay = 0;
if (_sound->_sfxMode & 2)
stopTalk();
return;
} else if (_lastKeyHit == '[') { // [ Music volume down
int vol = ConfMan.getInt("music_volume");
if (!(vol & 0xF) && vol)
vol -= 16;
vol = vol & 0xF0;
ConfMan.set("music_volume", vol);
if (_imuse)
_imuse->set_music_volume (vol);
} else if (_lastKeyHit == ']') { // ] Music volume up
int vol = ConfMan.getInt("music_volume");
vol = (vol + 16) & 0xFF0;
if (vol > 255) vol = 255;
ConfMan.set("music_volume", vol);
if (_imuse)
_imuse->set_music_volume (vol);
} else if (_lastKeyHit == '-') { // - text speed down
if (_defaultTalkDelay < 9)
_defaultTalkDelay++;
if (VAR_CHARINC != 0xFF)
VAR(VAR_CHARINC) = _defaultTalkDelay;
} else if (_lastKeyHit == '+') { // + text speed up
if (_defaultTalkDelay > 0)
_defaultTalkDelay--;
if (VAR_CHARINC != 0xFF)
VAR(VAR_CHARINC) = _defaultTalkDelay;
} else if (_lastKeyHit == '~' || _lastKeyHit == '#') { // Debug console
_debugger->attach();
} else if (_version <= 2) {
// Store the input type. So far we can't distinguish
// between 1, 3 and 5.
// 1) Verb 2) Scene 3) Inv. 4) Key
// 5) Sentence Bar
if (_lastKeyHit) { // Key Input
VAR(VAR_KEYPRESS) = _lastKeyHit;
}
}
_mouseButStat = _lastKeyHit;
}
} // End of namespace Scumm
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.106
retrieving revision 2.107
diff -u -d -r2.106 -r2.107
--- charset.cpp 18 Sep 2004 22:42:43 -0000 2.106
+++ charset.cpp 20 Sep 2004 22:03:59 -0000 2.107
@@ -25,6 +25,164 @@
namespace Scumm {
+void ScummEngine::loadCJKFont() {
+ _useCJKMode = false;
+ if ((_gameId == GID_DIG || _gameId == GID_CMI) && (_language == Common::KO_KOR || _language == Common::JA_JPN || _language == Common::ZH_TWN)) {
+ File fp;
+ const char *fontFile = NULL;
+ switch(_language) {
+ case Common::KO_KOR:
+ fontFile = "korean.fnt";
+ break;
+ case Common::JA_JPN:
+ fontFile = (_gameId == GID_DIG) ? "kanji16.fnt" : "japanese.fnt";
+ break;
+ case Common::ZH_TWN:
+ if (_gameId == GID_CMI) {
+ fontFile = "chinese.fnt";
+ }
+ break;
+ default:
+ break;
+ }
+ if (fontFile && fp.open(fontFile)) {
+ debug(2, "Loading CJK Font");
+ _useCJKMode = true;
+ fp.seek(2, SEEK_CUR);
+ _2byteWidth = fp.readByte();
+ _2byteHeight = fp.readByte();
+
+ int numChar = 0;
+ switch(_language) {
+ case Common::KO_KOR:
+ numChar = 2350;
+ break;
+ case Common::JA_JPN:
+ numChar = (_gameId == GID_DIG) ? 1024 : 2048; //FIXME
+ break;
+ case Common::ZH_TWN:
+ numChar = 1; //FIXME
+ break;
+ default:
+ break;
+ }
+ _2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar];
+ fp.read(_2byteFontPtr, ((_2byteWidth + 7) / 8) * _2byteHeight * numChar);
+ fp.close();
+ }
+ } else if (_language == Common::JA_JPN && _version == 5) { //FM Towns Kanji
+ File fp;
+ int numChar = 256 * 32;
+ _2byteWidth = 16;
+ _2byteHeight = 16;
+ //use FM Towns font rom, since game files don't have kanji font resources
+ if (fp.open("fmt_fnt.rom")) {
+ _useCJKMode = true;
+ debug(2, "Loading FM Towns Kanji rom");
+ _2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar];
+ fp.read(_2byteFontPtr, ((_2byteWidth + 7) / 8) * _2byteHeight * numChar);
+ fp.close();
+ }
+ }
+}
+
+static int SJIStoFMTChunk(int f, int s) //convert sjis code to fmt font offset
+{
+ enum {
+ KANA = 0,
+ KANJI = 1,
+ EKANJI = 2
+ };
+ int base = s - (s % 32) - 1;
+ int c = 0, p = 0, chunk_f = 0, chunk = 0, cr, kanjiType = KANA;
+
+ if (f >= 0x81 && f <= 0x84) kanjiType = KANA;
+ if (f >= 0x88 && f <= 0x9f) kanjiType = KANJI;
+ if (f >= 0xe0 && f <= 0xea) kanjiType = EKANJI;
+
+ if ((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) {
+ c = 48; //correction
+ p = -8; //correction
+ }
+
+ if (kanjiType == KANA) {//Kana
+ chunk_f = (f - 0x81) * 2;
+ } else if (kanjiType == KANJI) {//Standard Kanji
+ p += f - 0x88;
+ chunk_f = c + 2 * p;
+ } else if (kanjiType == EKANJI) {//Enhanced Kanji
+ p += f - 0xe0;
+ chunk_f = c + 2 * p;
+ }
+
+ if (base == 0x7f && s == 0x7f)
+ base -= 0x20; //correction
+ if ((base == 0x7f && s == 0x9e) || (base == 0x9f && s == 0xbe) || (base == 0xbf && s == 0xde))
+ base += 0x20; //correction
+
+ switch(base) {
+ case 0x3f:
+ cr = 0; //3f
+ if (kanjiType == KANA) chunk = 1;
+ else if (kanjiType == KANJI) chunk = 31;
+ else if (kanjiType == EKANJI) chunk = 111;
+ break;
+ case 0x5f:
+ cr = 0; //5f
+ if (kanjiType == KANA) chunk = 17;
+ else if (kanjiType == KANJI) chunk = 47;
+ else if (kanjiType == EKANJI) chunk = 127;
+ break;
+ case 0x7f:
+ cr = -1; //80
+ if (kanjiType == KANA) chunk = 9;
+ else if (kanjiType == KANJI) chunk = 63;
+ else if (kanjiType == EKANJI) chunk = 143;
+ break;
+ case 0x9f:
+ cr = 1; //9e
+ if (kanjiType == KANA) chunk = 2;
+ else if (kanjiType == KANJI) chunk = 32;
+ else if (kanjiType == EKANJI) chunk = 112;
+ break;
+ case 0xbf:
+ cr = 1; //be
+ if (kanjiType == KANA) chunk = 18;
+ else if (kanjiType == KANJI) chunk = 48;
+ else if (kanjiType == EKANJI) chunk = 128;
+ break;
+ case 0xdf:
+ cr = 1; //de
+ if (kanjiType == KANA) chunk = 10;
+ else if (kanjiType == KANJI) chunk = 64;
+ else if (kanjiType == EKANJI) chunk = 144;
+ break;
+ default:
+ return 0;
+ }
+
+ return ((chunk_f + chunk) * 32 + (s - base)) + cr;
+}
+
+byte *ScummEngine::get2byteCharPtr(int idx) {
+ switch(_language) {
+ case Common::KO_KOR:
+ idx = ((idx % 256) - 0xb0) * 94 + (idx / 256) - 0xa1;
+ break;
+ case Common::JA_JPN:
+ idx = SJIStoFMTChunk((idx % 256), (idx / 256));
+ break;
+ case Common::ZH_TWN:
+ default:
+ idx = 0;
+ }
+ return _2byteFontPtr + ((_2byteWidth + 7) / 8) * _2byteHeight * idx;
+}
+
+
+#pragma mark -
+
+
CharsetRenderer::CharsetRenderer(ScummEngine *vm) {
_nextLeft = 0;
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.315
retrieving revision 2.316
diff -u -d -r2.315 -r2.316
--- gfx.cpp 20 Sep 2004 19:58:07 -0000 2.315
+++ gfx.cpp 20 Sep 2004 22:04:00 -0000 2.316
@@ -226,6 +226,8 @@
_textSurface.h = _vm->_screenHeight;
_textSurface.pitch = _vm->_screenWidth;
_textSurface.bytesPerPixel = 1;
+
+ _numStrips = _vm->_screenWidth / 8;
}
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- module.mk 6 Sep 2004 00:58:40 -0000 1.41
+++ module.mk 20 Sep 2004 22:04:05 -0000 1.42
@@ -15,6 +15,7 @@
scumm/gfx.o \
scumm/imuse.o \
scumm/imuse_player.o \
+ scumm/input.o \
scumm/instrument.o \
scumm/help.o \
scumm/midiparser_ro.o \
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -d -r1.221 -r1.222
--- scumm.cpp 20 Sep 2004 20:56:10 -0000 1.221
+++ scumm.cpp 20 Sep 2004 22:04:05 -0000 1.222
@@ -42,6 +42,7 @@
#include "scumm/dialogs.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse.h"
+#include "scumm/insane/insane.h"
#include "scumm/intern.h"
#include "scumm/object.h"
#include "scumm/player_v1.h"
@@ -55,8 +56,6 @@
#include "scumm/sound.h"
#include "scumm/verbs.h"
[...984 lines suppressed...]
-}
-
void ScummEngine::errorString(const char *buf1, char *buf2) {
if (_currentScript != 0xFF) {
ScriptSlot *ss = &vm.slot[_currentScript];
@@ -3158,12 +2513,8 @@
void checkRange(int max, int min, int no, const char *str) {
if (no < min || no > max) {
-#ifdef __PALM_OS__
- char buf[256]; // 1024 is too big overflow the stack
-#else
- char buf[1024];
-#endif
- sprintf(buf, str, no);
+ char buf[256];
+ snprintf(buf, sizeof(buf), str, no);
error("Value %d is out of bounds (%d,%d) (%s)", no, min, max, buf);
}
}
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.490
retrieving revision 1.491
diff -u -d -r1.490 -r1.491
--- scumm.h 20 Sep 2004 05:30:26 -0000 1.490
+++ scumm.h 20 Sep 2004 22:04:05 -0000 1.491
@@ -384,14 +384,19 @@
ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]);
virtual ~ScummEngine();
+ /** Startup function: Calls mainInit and then mainRun. */
+ void go();
+
// Init functions
- virtual void scummInit();
- void initScummVars();
+ void mainInit();
+
virtual void setupScummVars();
+ void initScummVars();
- // Startup functions
- void launch();
- void go();
+ virtual void scummInit();
+
+ void loadCJKFont();
+ void setupMusic(int midi);
// Scumm main loop
void mainRun();
@@ -1091,7 +1096,7 @@
byte _haveMsg;
bool _useTalkAnims;
uint16 _defaultTalkDelay;
- int tempMusic;
+ int _tempMusic;
int _saveSound;
bool _native_mt32;
int _midiDriver; // Use the MD_ values from mididrv.h
Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- vars.cpp 20 Sep 2004 18:27:13 -0000 1.105
+++ vars.cpp 20 Sep 2004 22:04:06 -0000 1.106
@@ -22,8 +22,10 @@
#include "stdafx.h"
+#include "common/config-manager.h"
#include "scumm/scumm.h"
#include "scumm/intern.h"
+#include "sound/mididrv.h"
namespace Scumm {
@@ -464,4 +466,130 @@
VAR_CHARINC = 129;
}
+void ScummEngine::initScummVars() {
+
+ // This needs to be at least greater than 40 to get the more
+ // elaborate version of the EGA Zak into. I don't know where
+ // else it makes any difference.
+ if (_gameId == GID_ZAK)
+ VAR(VAR_MACHINE_SPEED) = 0x7FFF;
+
+ if (_version <= 2)
+ return;
+
+ if (_version >= 4 && _version <= 5)
+ VAR(VAR_V5_TALK_STRING_Y) = -0x50;
+
+ if (_version == 8) { // Fixme: How do we deal with non-cd installs?
+ VAR(VAR_CURRENTDISK) = 1;
+ VAR(VAR_LANGUAGE) = _language;
+ } else if (_version >= 7) {
+ VAR(VAR_V6_EMSSPACE) = 10000;
+ VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
+ } else if (_heversion >= 70) {
+ VAR(VAR_NUM_SOUND_CHANNELS) = 3;
+ VAR(VAR_MUSIC_CHANNEL) = 1;
+ VAR(VAR_SOUND_CHANNEL) = 2;
+
+ if (_heversion >= 72) {
+ VAR(VAR_NUM_ROOMS) = _numRooms - 1;
+ VAR(VAR_NUM_SCRIPTS) = _numScripts - 1;
+ VAR(VAR_NUM_SOUNDS) = _numSounds - 1;
+ VAR(VAR_NUM_COSTUMES) = _numCostumes - 1;
+ VAR(VAR_NUM_IMAGES) = _numImages - 1;
+ VAR(VAR_NUM_CHARSETS) = _numCharsets - 1;
+ VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
+ }
+ if (_heversion >= 80)
+ VAR(VAR_WINDOWS_VERSION) = 40;
+ if (_heversion >= 90)
+ VAR(VAR_NUM_SPRITES) = _numSprites - 1;
+ } else {
+ VAR(VAR_CURRENTDRIVE) = 0;
+ switch (_midiDriver) {
+ case MD_NULL: VAR(VAR_SOUNDCARD) = 0; break;
+ case MD_ADLIB: VAR(VAR_SOUNDCARD) = 3; break;
+ case MD_PCSPK:
+ case MD_PCJR: VAR(VAR_SOUNDCARD) = 1; break;
+ default:
+ if ((_gameId == GID_MONKEY_EGA || _gameId == GID_MONKEY_VGA || _gameId == GID_LOOM)
+ && (_features & GF_PC)) {
+ if (_gameId == GID_LOOM) {
+ char buf[50];
+ uint i = 82;
+ File f;
+ while (i < 85) {
+ sprintf(buf, "%d.LFL", i);
+ f.open(buf);
+ if (f.isOpen() == false)
+ error("Native MIDI support requires Roland patch from LucasArts");
+ f.close();
+ i++;
+ }
+ } else if (_gameId == GID_MONKEY_EGA) {
+ File f;
+ f.open("DISK09.LEC");
+ if (f.isOpen() == false)
+ error("Native MIDI support requires Roland patch from LucasArts");
+ }
+ VAR(VAR_SOUNDCARD) = 4;
+ } else
+ VAR(VAR_SOUNDCARD) = 3;
+ }
+ if (_features & GF_FMTOWNS)
+ VAR(VAR_VIDEOMODE) = 42;
+ else if (_gameId == GID_INDY3 && (_features & GF_MACINTOSH))
+ VAR(VAR_VIDEOMODE) = 50;
+ else if (_gameId == GID_MONKEY2 && (_features & GF_AMIGA))
+ VAR(VAR_VIDEOMODE) = 82;
+ else
+ VAR(VAR_VIDEOMODE) = 19;
+ if (_gameId == GID_LOOM && _features & GF_OLD_BUNDLE) {
+ // Set number of sound resources
+ if (!(_features & GF_MACINTOSH))
+ VAR(39) = 80;
+ VAR(VAR_HEAPSPACE) = 1400;
+ } else if (_version >= 4) {
+ VAR(VAR_HEAPSPACE) = 1400;
+ VAR(VAR_FIXEDDISK) = true;
+ if (_features & GF_HUMONGOUS) {
+ VAR(VAR_SOUNDPARAM) = 1; // soundblaster for music
+ VAR(VAR_SOUNDPARAM2) = 1; // soundblaster for sfx
+ } else {
+ VAR(VAR_SOUNDPARAM) = 0;
+ VAR(VAR_SOUNDPARAM2) = 0;
+ }
+ VAR(VAR_SOUNDPARAM3) = 0;
+ }
+ if (_version >= 5)
+ VAR(VAR_MOUSEPRESENT) = true;
+ if (_version == 6)
+ VAR(VAR_V6_EMSSPACE) = 10000;
+ }
+
+ if ((_features & GF_MACINTOSH) && (_version == 3)) {
+ // This is the for the Mac version of Indy3/Loom
+ VAR(39) = 320;
+ }
+
+ if (VAR_CURRENT_LIGHTS != 0xFF) {
+ // Setup light
+ VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
+ }
+
+ if (_gameId == GID_MONKEY || _gameId == GID_MONKEY_SEGA)
+ _scummVars[74] = 1225;
+
+ if (_version >= 7) {
+ VAR(VAR_DEFAULT_TALK_DELAY) = 60;
+ VAR(VAR_VOICE_MODE) = ConfMan.getBool("subtitles");
+ }
+
+ if (VAR_FADE_DELAY != 0xFF)
+ VAR(VAR_FADE_DELAY) = 3;
+
+ VAR(VAR_CHARINC) = 4;
+ setTalkingActor(0);
+}
+
} // End of namespace Scumm
More information about the Scummvm-git-logs
mailing list