aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.h4
-rw-r--r--engines/agos/script.cpp4
-rw-r--r--engines/agos/script_s2.cpp2
-rw-r--r--engines/agos/vga.cpp53
4 files changed, 22 insertions, 41 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 68c1dcd3ed..7e89396fa3 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -875,8 +875,8 @@ public:
void vc36_setWindowImage();
void vc38_ifVarNotZero();
void vc39_setVar();
- void vc40();
- void vc41();
+ void vc40_scrollRight();
+ void vc41_scrollLeft();
void vc42_delayIfNotEQ();
// Video Script Opcodes, Elvira 1
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index bb7faa91d3..ace0b9d50f 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -753,7 +753,7 @@ void AGOSEngine::o_setAdjNoun() {
void AGOSEngine::o_saveUserGame() {
// 132: save user game
if (getGameId() == GID_SIMON1CD32) {
- // The Amiga CD32 version of Simon the Sorcerer 1uses a single slot
+ // The Amiga CD32 version of Simon the Sorcerer 1 uses a single slot
if (!saveGame(0, "Default Saved Game")) {
vc33_setMouseOn();
fileError(_windowArray[5], true);
@@ -799,7 +799,7 @@ void AGOSEngine::o_freezeZones() {
freezeBottom();
if (!_copyProtection && !(getFeatures() & GF_TALKIE)) {
- if ((getGameType() == GType_SIMON1 && _subroutine == 2924) ||
+ if ((getGameType() == GType_SIMON1 && _subroutine == 2924) ||
(getGameType() == GType_SIMON2 && _subroutine == 1322)) {
_variableArray[134] = 3;
_variableArray[135] = 3;
diff --git a/engines/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index dfc1200d7c..00addce396 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.cpp
@@ -355,7 +355,7 @@ void AGOSEngine_Simon2::os2_screenTextPObj() {
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
- SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
+ SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), kObjectType);
if (getFeatures() & GF_TALKIE) {
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 2b8f6d3a09..38c401a80d 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -70,8 +70,8 @@ void AGOSEngine::setupVideoOpcodes(VgaOpcodeProc *op) {
op[36] = &AGOSEngine::vc36_setWindowImage;
op[38] = &AGOSEngine::vc38_ifVarNotZero;
op[39] = &AGOSEngine::vc39_setVar;
- op[40] = &AGOSEngine::vc40;
- op[41] = &AGOSEngine::vc41;
+ op[40] = &AGOSEngine::vc40_scrollRight;
+ op[41] = &AGOSEngine::vc41_scrollLeft;
op[42] = &AGOSEngine::vc42_delayIfNotEQ;
op[43] = &AGOSEngine::vc43_ifBitSet;
op[44] = &AGOSEngine::vc44_ifBitClear;
@@ -124,8 +124,8 @@ void AGOSEngine_Elvira1::setupVideoOpcodes(VgaOpcodeProc *op) {
op[41] = &AGOSEngine::vc37_pokePalette;
op[51] = &AGOSEngine::vc38_ifVarNotZero;
op[52] = &AGOSEngine::vc39_setVar;
- op[53] = &AGOSEngine::vc40;
- op[54] = &AGOSEngine::vc41;
+ op[53] = &AGOSEngine::vc40_scrollRight;
+ op[54] = &AGOSEngine::vc41_scrollLeft;
op[56] = &AGOSEngine::vc42_delayIfNotEQ;
}
@@ -1257,57 +1257,38 @@ void AGOSEngine::vc39_setVar() {
vcWriteVar(var, value);
}
-void AGOSEngine::vc40() {
+void AGOSEngine::vc40_scrollRight() {
uint16 var = vcReadNextWord();
int16 value = vcReadVar(var) + vcReadNextWord();
if (getGameType() == GType_SIMON2 && var == 15 && !getBitFlag(80)) {
- int16 tmp;
- if (_scrollCount != 0) {
- if (_scrollCount >= 0)
- goto no_scroll;
+ if ((_scrollCount < 0) || (_scrollCount == 0 && _scrollFlag == 0)) {
_scrollCount = 0;
- } else {
- if (_scrollFlag != 0)
- goto no_scroll;
- }
-
- if (value - _scrollX >= 30) {
- _scrollCount = 20;
- tmp = _scrollXMax - _scrollX;
- if (tmp < 20)
- _scrollCount = tmp;
- addVgaEvent(6, SCROLL_EVENT, NULL, 0, 0);
+ if (value - _scrollX >= 30) {
+ _scrollCount = MIN(20, _scrollXMax - _scrollX);
+ addVgaEvent(6, SCROLL_EVENT, NULL, 0, 0);
+ }
}
}
-no_scroll:;
vcWriteVar(var, value);
}
-void AGOSEngine::vc41() {
+void AGOSEngine::vc41_scrollLeft() {
uint16 var = vcReadNextWord();
int16 value = vcReadVar(var) - vcReadNextWord();
if (getGameType() == GType_SIMON2 && var == 15 && !getBitFlag(80)) {
- if (_scrollCount != 0) {
- if (_scrollCount < 0)
- goto no_scroll;
- _scrollCount = 0;
- } else {
- if (_scrollFlag != 0)
- goto no_scroll;
- }
- if ((uint16)(value - _scrollX) < 11) {
- _scrollCount = -20;
- if (_scrollX < 20)
- _scrollCount = -_scrollX;
- addVgaEvent(6, SCROLL_EVENT, NULL, 0, 0);
+ if ((_scrollCount > 0) || (_scrollCount == 0 && _scrollFlag == 0)) {
+ _scrollCount = 0;
+ if ((uint16)(value - _scrollX) < 11) {
+ _scrollCount = -MIN(20, (int)_scrollX);
+ addVgaEvent(6, SCROLL_EVENT, NULL, 0, 0);
+ }
}
}
-no_scroll:;
vcWriteVar(var, value);
}