fixed various cases of bad var access

svn-id: r7394
This commit is contained in:
Max Horn 2003-05-08 15:58:30 +00:00
parent 98881c3a6a
commit 0461222181
3 changed files with 21 additions and 13 deletions

View File

@ -2145,7 +2145,7 @@ void Scumm::moveCamera() {
camera._cur.x &= 0xFFF8;
if (camera._cur.x < VAR(VAR_CAMERA_MIN_X)) {
if (VAR(VAR_CAMERA_FAST_X))
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))
camera._cur.x = VAR(VAR_CAMERA_MIN_X);
else
camera._cur.x += 8;
@ -2154,7 +2154,7 @@ void Scumm::moveCamera() {
}
if (camera._cur.x > VAR(VAR_CAMERA_MAX_X)) {
if (VAR(VAR_CAMERA_FAST_X))
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))
camera._cur.x = VAR(VAR_CAMERA_MAX_X);
else
camera._cur.x -= 8;
@ -2169,7 +2169,7 @@ void Scumm::moveCamera() {
t = (actorx >> 3) - _screenStartStrip;
if (t < camera._leftTrigger || t > camera._rightTrigger) {
if (VAR(VAR_CAMERA_FAST_X)) {
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X)) {
if (t > 35)
camera._dest.x = actorx + 80;
if (t < 5)
@ -2190,7 +2190,7 @@ void Scumm::moveCamera() {
if (camera._dest.x > VAR(VAR_CAMERA_MAX_X))
camera._dest.x = VAR(VAR_CAMERA_MAX_X);
if (VAR(VAR_CAMERA_FAST_X)) {
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X)) {
camera._cur.x = camera._dest.x;
} else {
if (camera._cur.x < camera._dest.x)

View File

@ -784,12 +784,17 @@ void Scumm::doSentence(int c, int b, int a) {
void Scumm::checkAndRunSentenceScript() {
int i;
ScriptSlot *ss;
int sentenceScript;
if (_features & GF_AFTER_V2)
sentenceScript = 2;
else
sentenceScript = VAR(VAR_SENTENCE_SCRIPT);
memset(_localParamList, 0, sizeof(_localParamList));
if (isScriptInUse(VAR(VAR_SENTENCE_SCRIPT))) {
if (isScriptInUse(sentenceScript)) {
ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
if (ss->number == VAR(VAR_SENTENCE_SCRIPT) && ss->status != ssDead && ss->freezeCount == 0)
if (ss->number == sentenceScript && ss->status != ssDead && ss->freezeCount == 0)
return;
}
@ -806,8 +811,8 @@ void Scumm::checkAndRunSentenceScript() {
_localParamList[1] = _sentence[_sentenceNum].unk4;
_localParamList[2] = _sentence[_sentenceNum].unk3;
_currentScript = 0xFF;
if (VAR(VAR_SENTENCE_SCRIPT))
runScript(VAR(VAR_SENTENCE_SCRIPT), 0, 0, _localParamList);
if (sentenceScript)
runScript(sentenceScript, 0, 0, _localParamList);
}
void Scumm::runInputScript(int a, int cmd, int mode) {

View File

@ -845,10 +845,12 @@ int Scumm::scummLoop(int delta) {
// that it will be in a different state each time you run the program.
_rnd.getRandomNumber(2);
VAR(VAR_TMR_1) += delta;
VAR(VAR_TMR_2) += delta;
VAR(VAR_TMR_3) += delta;
VAR(VAR_TMR_4) += delta;
if (!(_features & GF_AFTER_V2)) {
VAR(VAR_TMR_1) += delta;
VAR(VAR_TMR_2) += delta;
VAR(VAR_TMR_3) += delta;
VAR(VAR_TMR_4) += delta;
}
if (delta > 15)
delta = 15;
@ -1047,7 +1049,8 @@ load_game:
/* show or hide mouse */
_system->show_mouse(_cursor.state > 0);
VAR(VAR_TIMER) = 0;
if (!(_features & GF_AFTER_V2))
VAR(VAR_TIMER) = 0;
return VAR(VAR_TIMER_NEXT);
}