[Scummvm-git-logs] scummvm master -> 7f9c06f91acdd75acfcab69eb7665bbb3404c298
Strangerke
Strangerke at scummvm.org
Sun Apr 8 00:05:01 CEST 2018
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
397a94bc62 LILLIPUT: Some more renaming in the sequence manager
6695610756 LILLIPUT: More renaming work
7f9c06f91a LILLIPUT: more renaming, rework setMode
Commit: 397a94bc62e98c5a23c9ed49a0363f8c9f4551c5
https://github.com/scummvm/scummvm/commit/397a94bc62e98c5a23c9ed49a0363f8c9f4551c5
Author: Strangerke (strangerke at scummvm.org)
Date: 2018-04-07T23:58:32+02:00
Commit Message:
LILLIPUT: Some more renaming in the sequence manager
Changed paths:
engines/lilliput/lilliput.cpp
engines/lilliput/lilliput.h
engines/lilliput/script.cpp
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 70b729c..d3148b0 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -197,7 +197,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_characterAboveDist[i] = 0;
_spriteSizeArray[i] = 20;
_characterDirectionArray[i] = 0;
- _rulesBuffer2_10[i] = 0;
+ _characterMobility[i] = 0;
_characterTypes[i] = 0;
_characterBehaviour[i] = 0;
_characterHomePosX[i] = 0;
@@ -714,7 +714,7 @@ void LilliputEngine::displayRefreshScreen() {
restoreMapPoints();
updateCharPosSequence();
- sub12F37();
+ handleCharacterTimers();
sub16CA0();
sub16EBC();
sub171CF();
@@ -725,7 +725,7 @@ void LilliputEngine::displayRefreshScreen() {
prepareGameArea();
displayGameArea();
updateCharPosSequence();
- sub12F37();
+ handleCharacterTimers();
sub16CA0();
sub16EBC();
sub171CF();
@@ -1463,7 +1463,7 @@ void LilliputEngine::sub1693A_chooseDirections(int index) {
_array1692B[i] -= 20;
}
- int tmpVal = ((_rulesBuffer2_10[index] & 7) ^ 7);
+ int tmpVal = ((_characterMobility[index] & 7) ^ 7);
retVal = _rulesChunk9[_bufferIsoMap[mapIndex + mapIndexDiff]];
tmpVal &= retVal;
if (tmpVal == 0)
@@ -1649,14 +1649,14 @@ void LilliputEngine::updateCharPosSequence() {
case 12: // Home in target
result = sequenceCharacterHomeIn(index, var1);
break;
- case 13: // Character
- result = sub16722(index, var1);
+ case 13: // Character mobility
+ result = sequenceSetMobility(index, var1);
break;
- case 14: // ??
- result = sub166F7(index, var1, index2);
+ case 14: // Repeat sequence
+ result = sequenceRepeat(index, var1, index2);
break;
case 15: // End
- result = sub166EA(index);
+ result = sequenceEnd(index);
break;
default:
error("updateCharPosSequence - unexpected value %d", posSeqType);
@@ -1673,16 +1673,16 @@ void LilliputEngine::updateCharPosSequence() {
}
}
-byte LilliputEngine::sub166EA(int index) {
- debugC(2, kDebugEngine, "sub166EA(%d)", index);
+byte LilliputEngine::sequenceEnd(int index) {
+ debugC(2, kDebugEngine, "sequenceEnd(%d)", index);
_scriptHandler->_characterNextSequence[index] = 16;
_scriptHandler->_characterScriptEnabled[index] = 1;
return 1;
}
-byte LilliputEngine::sub166F7(int index, Common::Point var1, int tmpVal) {
- debugC(2, kDebugEngine, "sub166F7(%d, %d - %d, %d)", index, var1.x, var1.y, tmpVal);
+byte LilliputEngine::sequenceRepeat(int index, Common::Point var1, int tmpVal) {
+ debugC(2, kDebugEngine, "sequenceRepeat(%d, %d - %d, %d)", index, var1.x, var1.y, tmpVal);
byte a2 = var1.y;
if (a2 != 0) {
@@ -1709,10 +1709,10 @@ byte LilliputEngine::sequenceSetCharacterDirection(int index, int direction, int
return 0;
}
-byte LilliputEngine::sub16722(int index, Common::Point var1) {
- debugC(2, kDebugEngineTBC, "sub16722(%d, %d - %d)", index, var1.x, var1.y);
+byte LilliputEngine::sequenceSetMobility(int index, Common::Point var1) {
+ debugC(2, kDebugEngine, "sequenceSetMobility(%d, %d)", index, var1.x, var1.y);
- _rulesBuffer2_10[index] = var1.y;
+ _characterMobility[index] = var1.y;
return 2;
}
@@ -1767,11 +1767,10 @@ void LilliputEngine::sub16EBC() {
}
}
-void LilliputEngine::sub12F37() {
- debugC(2, kDebugEngine, "sub12F37()");
+void LilliputEngine::handleCharacterTimers() {
+ debugC(2, kDebugEngine, "handleCharacterTimers()");
int index1 = _animationTick + 2;
- int index2 = 0;
for (byte i = 0; i < _numCharacters; i++) {
byte *varPtr = getCharacterAttributesPtr(index1);
@@ -1781,12 +1780,11 @@ void LilliputEngine::sub12F37() {
} else {
--varPtr[0];
if (varPtr[0] == 1)
- _scriptHandler->_characterScriptEnabled[index2] = 1;
+ _scriptHandler->_characterScriptEnabled[i] = 1;
}
}
index1 += 32;
- ++index2;
}
}
@@ -2179,7 +2177,7 @@ void LilliputEngine::sub16B8F_moveCharacter(int index, Common::Point pos, int di
if ((_bufferIsoMap[mapIndex + 3] & _array16C54[direction]) == 0)
return;
- byte var1 = _rulesBuffer2_10[index];
+ byte var1 = _characterMobility[index];
var1 &= 7;
var1 ^= 7;
@@ -2513,7 +2511,7 @@ void LilliputEngine::loadRules() {
_characterAboveDist[j] = f.readByte();
_spriteSizeArray[j] = f.readByte();
_characterDirectionArray[j] = f.readByte();
- _rulesBuffer2_10[j] = f.readByte();
+ _characterMobility[j] = f.readByte();
_characterTypes[j] = f.readByte();
_characterBehaviour[j] = f.readByte();
_characterHomePosX[j] = f.readByte();
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index b7b2cc5..985e2f9 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -175,7 +175,7 @@ public:
byte _characterAboveDist[40];
byte _spriteSizeArray[40];
byte _characterDirectionArray[40];
- byte _rulesBuffer2_10[40];
+ byte _characterMobility[40];
byte _characterTypes[40];
byte _characterBehaviour[40];
byte _characterHomePosX[40];
@@ -272,8 +272,8 @@ public:
void sub17264(byte index, int var4);
int16 findHotspot(Common::Point pos);
int16 reverseFindHotspot(Common::Point pos);
- byte sub16722(int index, Common::Point var1);
- byte sub166EA(int index);
+ byte sequenceSetMobility(int index, Common::Point var1);
+ byte sequenceEnd(int index);
void sub167EF(int index);
void renderCharacters(byte *buf, Common::Point pos);
@@ -284,7 +284,7 @@ public:
byte getDirection(Common::Point param1, Common::Point param2);
void addCharToBuf(byte character);
void numberToString(int param1);
- void sub12F37();
+ void handleCharacterTimers();
byte sequenceMoveCharacter(int idx, int moveType, int poseType);
void setCharacterPose(int idx, int poseIdx);
void sub16EBC();
@@ -320,7 +320,7 @@ public:
void sub16B8F_moveCharacter(int index, Common::Point pos, int direction);
byte sequenceSeekMovingCharacter(int index, Common::Point var1);
byte sequenceSound(int index, Common::Point var1);
- byte sub166F7(int index, Common::Point var1, int tmpVal);
+ byte sequenceRepeat(int index, Common::Point var1, int tmpVal);
void sub1693A_chooseDirections(int index);
void initGame(const LilliputGameDescription *gd);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 7600028..8411415 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -3032,7 +3032,7 @@ void LilliputScript::OC_setRulesBuffer2Element() {
byte var1 = _currScript->readUint16LE() & 0xFF;
assert((index >= 0) && (index < 40));
- _vm->_rulesBuffer2_10[index] = var1;
+ _vm->_characterMobility[index] = var1;
}
void LilliputScript::OC_setDebugFlag() {
Commit: 6695610756a7ab3bdc849983fbbd65f199528612
https://github.com/scummvm/scummvm/commit/6695610756a7ab3bdc849983fbbd65f199528612
Author: Strangerke (strangerke at scummvm.org)
Date: 2018-04-07T23:58:32+02:00
Commit Message:
LILLIPUT: More renaming work
Changed paths:
engines/lilliput/lilliput.cpp
engines/lilliput/lilliput.h
engines/lilliput/script.cpp
engines/lilliput/script.h
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index d3148b0..4f3311d 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -157,7 +157,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_displayGreenHand = false;
_isCursorGreenHand = false;
_displayStringIndex = 0;
- _word1289D = 0;
+ _signalTimer = 0;
_numCharacters = 0;
_saveFlag = true;
@@ -185,9 +185,9 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_characterMagicPuffFrame[i] = -1;
_characterSubTargetPosX[i] = -1;
_characterSubTargetPosY[i] = -1;
- _stingArray[i] = 0;
+ _specialCubes[i] = 0;
- _array11D49[i] = -1;
+ _characterSignals[i] = -1;
_characterPositionX[i] = -1;
_characterPositionY[i] = -1;
_characterPosAltitude[i] = 0;
@@ -202,7 +202,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_characterBehaviour[i] = 0;
_characterHomePosX[i] = 0;
_characterHomePosY[i] = 0;
- _array1289F[i] = -1;
+ _signalArr[i] = -1;
}
for (int i = 0; i < 30; i++)
@@ -715,9 +715,9 @@ void LilliputEngine::displayRefreshScreen() {
restoreMapPoints();
updateCharPosSequence();
handleCharacterTimers();
- sub16CA0();
- sub16EBC();
- sub171CF();
+ checkInteractions();
+ checkSpecialCubes();
+ handleSignals();
displayCharactersOnMap();
} else {
scrollToViewportCharacterTarget();
@@ -726,9 +726,9 @@ void LilliputEngine::displayRefreshScreen() {
displayGameArea();
updateCharPosSequence();
handleCharacterTimers();
- sub16CA0();
- sub16EBC();
- sub171CF();
+ checkInteractions();
+ checkSpecialCubes();
+ handleSignals();
handleGameMouseClick();
checkInterfaceActivationDelay();
displayHeroismIndicator();
@@ -807,8 +807,8 @@ void LilliputEngine::paletteFadeIn() {
}
}
-int16 LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
- debugC(2, kDebugEngine, "sub16DD5(%d, %d, %d, %d)", x1, y1, x2, y2);
+int16 LilliputEngine::checkObstacle(int x1, int y1, int x2, int y2) {
+ debugC(2, kDebugEngine, "checkObstacle(%d, %d, %d, %d)", x1, y1, x2, y2);
int index = ((y1 * 64) + x1) * 4;
assert((index > 0) && (index <= 16380));
@@ -822,8 +822,8 @@ int16 LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
int16 mapMoveY = 0;
int16 mapMoveX = 0;
- int16 byte16DD4 = 0;
- int16 byte16DD3 = 0;
+ int16 nonDiagdelta = 0;
+ int16 diagDelta = 0;
if (dx < 0) {
dx = -dx;
@@ -850,9 +850,9 @@ int16 LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
mapMoveY = tmpMapMoveY;
}
- byte16DD4 = dy * 2;
- int16 var1 = byte16DD4 - dx;
- byte16DD3 = byte16DD4 - (dx * 2);
+ nonDiagdelta = dy * 2;
+ int16 var1 = nonDiagdelta - dx;
+ diagDelta = nonDiagdelta - (dx * 2);
mapMoveX += mapMoveY;
tmpMapMoveX += tmpMapMoveY;
@@ -862,10 +862,10 @@ int16 LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
while (*isoMap == 0xFF) {
if (var1 >= 0) {
isoMap += tmpMapMoveX;
- var1 += byte16DD3;
+ var1 += diagDelta;
} else {
isoMap += mapMoveX;
- var1 += byte16DD4;
+ var1 += nonDiagdelta;
}
count++;
@@ -929,8 +929,8 @@ void LilliputEngine::checkMapClosing(bool &forceReturnFl) {
forceReturnFl = true;
}
-void LilliputEngine::sub16CA0() {
- debugC(2, kDebugEngine, "sub16CA0()");
+void LilliputEngine::checkInteractions() {
+ debugC(2, kDebugEngine, "checkInteractions()");
for (int index = _numCharacters - 1; index >= 0; index--) {
if (_characterTypes[index] & 1)
@@ -944,7 +944,7 @@ void LilliputEngine::sub16CA0() {
continue;
for (int index2 = _numCharacters - 1; index2 >= 0; index2--) {
- byte byte16C9F = 0;
+ byte _newStatus = 0;
if ((index != index2) &&
(_characterCarried[index] != index2) &&
(_characterCarried[index2] != index) &&
@@ -957,56 +957,56 @@ void LilliputEngine::sub16CA0() {
if ((x > -6) && (x < 6)) {
int y = c2 - d2;
if ((y > -6) && (y < 6)) {
- byte16C9F = 1;
+ _newStatus = 1;
if ((c1 == d1) && (c2 == d2)) {
- byte16C9F = 4;
+ _newStatus = 4;
} else if ((_characterTypes[index] & 4) != 0) {
- byte16C9F = 0;
+ _newStatus = 0;
} else {
switch (_characterDirectionArray[index]) {
case 0:
if (d1 > c1) {
- byte16C9F = 2;
+ _newStatus = 2;
if (d2 == c2)
- byte16C9F = 3;
+ _newStatus = 3;
- if (sub16DD5(c1, c2, d1, d2) != 0)
- byte16C9F = 1;
+ if (checkObstacle(c1, c2, d1, d2) != 0)
+ _newStatus = 1;
}
break;
case 1:
if (d2 < c2) {
- byte16C9F = 2;
+ _newStatus = 2;
if (d1 == c1)
- byte16C9F = 3;
+ _newStatus = 3;
- if (sub16DD5(c1, c2, d1, d2) != 0)
- byte16C9F = 1;
+ if (checkObstacle(c1, c2, d1, d2) != 0)
+ _newStatus = 1;
}
break;
case 2:
if (d2 > c2) {
- byte16C9F = 2;
+ _newStatus = 2;
if (d1 == c1)
- byte16C9F = 3;
+ _newStatus = 3;
- if (sub16DD5(c1, c2, d1, d2) != 0)
- byte16C9F = 1;
+ if (checkObstacle(c1, c2, d1, d2) != 0)
+ _newStatus = 1;
}
break;
default:
if (d1 < c1) {
- byte16C9F = 2;
+ _newStatus = 2;
if (d2 == c2)
- byte16C9F = 3;
+ _newStatus = 3;
- if (sub16DD5(c1, c2, d1, d2) != 0)
- byte16C9F = 1;
+ if (checkObstacle(c1, c2, d1, d2) != 0)
+ _newStatus = 1;
}
break;
}
@@ -1019,9 +1019,9 @@ void LilliputEngine::sub16CA0() {
int8 v2 = _scriptHandler->_interactions[index2 + (index * 40)] & 0xFF;
int8 v1 = v2;
- if (v2 != byte16C9F) {
+ if (v2 != _newStatus) {
_scriptHandler->_characterScriptEnabled[index] = 1;
- v2 = byte16C9F;
+ v2 = _newStatus;
}
_scriptHandler->_interactions[index2 + (index * 40)] = (v1 << 8) + v2;
}
@@ -1745,8 +1745,8 @@ byte LilliputEngine::sequenceSeekMovingCharacter(int index, Common::Point var1)
return sequenceCharacterHomeIn(index, var1);
}
-void LilliputEngine::sub16EBC() {
- debugC(2, kDebugEngine, "sub16EBC()");
+void LilliputEngine::checkSpecialCubes() {
+ debugC(2, kDebugEngine, "checkSpecialCubes()");
for (int index1 = _numCharacters - 1; index1 >= 0; index1--) {
// Hack: The original doesn't check if it's disabled, which looks wrong
@@ -1758,10 +1758,10 @@ void LilliputEngine::sub16EBC() {
assert((mapIndex >= 0) && (mapIndex < 16384));
byte var1 = _bufferIsoMap[mapIndex] & 0x40;
- if (var1 == _stingArray[index1])
+ if (var1 == _specialCubes[index1])
continue;
- _stingArray[index1] = var1;
+ _specialCubes[index1] = var1;
if (var1 != 0)
_scriptHandler->_characterScriptEnabled[index1] = 1;
}
@@ -2188,54 +2188,54 @@ void LilliputEngine::sub16B8F_moveCharacter(int index, Common::Point pos, int di
_characterPositionY[index] = pos.y;
}
-void LilliputEngine::sub17224(byte type, byte index, int var4) {
- debugC(2, kDebugEngine, "sub17224(%d, %d, %d)", type, index, var4);
+void LilliputEngine::signalDispatcher(byte type, byte index, int var4) {
+ debugC(2, kDebugEngine, "signalDispatcher(%d, %d, %d)", type, index, var4);
- if (type == 0) {
- sub17264(index, var4);
+ if (type == 0) { // Message sent to one target character
+ sendMessageToCharacter(index, var4);
return;
}
- if (type == 3) {
+ if (type == 3) { // Broadcast - Sent to all characters
for (int i = _numCharacters - 1; i >= 0; i--)
- sub17264(i, var4);
+ sendMessageToCharacter(i, var4);
return;
}
int index2 = var4 & 0xFF;
for (byte i = 0; i < _numCharacters; i++) {
if ((_scriptHandler->_interactions[index2] & 0xFF) >= type)
- sub17264(i, var4);
+ sendMessageToCharacter(i, var4);
index2 += 40;
}
}
-void LilliputEngine::sub17264(byte index, int var4) {
+void LilliputEngine::sendMessageToCharacter(byte index, int var4) {
debugC(2, kDebugEngine, "sub17264(%d, %d)", index, var4);
- if (_array11D49[index] != -1) {
- _array1289F[index] = var4;
+ if (_characterSignals[index] != -1) {
+ _signalArr[index] = var4;
} else {
_scriptHandler->_characterScriptEnabled[index] = 1;
- _array11D49[index] = var4;
+ _characterSignals[index] = var4;
}
}
-void LilliputEngine::sub171CF() {
- debugC(2, kDebugEngine, "sub171CF()");
+void LilliputEngine::handleSignals() {
+ debugC(2, kDebugEngine, "handleSignals()");
for (byte i = 0; i < _numCharacters; i++) {
- if (_array1289F[i] != -1) {
- _array11D49[i] = _array1289F[i];
- _array1289F[i] = -1;
+ if (_signalArr[i] != -1) {
+ _characterSignals[i] = _signalArr[i];
+ _signalArr[i] = -1;
_scriptHandler->_characterScriptEnabled[i] = 1;
}
}
- ++_word1289D;
+ ++_signalTimer;
for (int i = 0; i < 10; i++) {
- if ((_signalArray[(3 * i) + 1] != -1) && (_signalArray[3 * i] == _word1289D)) {
+ if ((_signalArray[(3 * i) + 1] != -1) && (_signalArray[3 * i] == _signalTimer)) {
int16 var1 = _signalArray[(3 * i) + 1];
int var4 = _signalArray[(3 * i) + 2];
_signalArray[(3 * i) + 1] = -1;
@@ -2243,7 +2243,7 @@ void LilliputEngine::sub171CF() {
byte type = var1 >> 8;
byte index = var1 & 0xFF;
- sub17224(type, index, var4);
+ signalDispatcher(type, index, var4);
}
}
}
@@ -2735,9 +2735,9 @@ void LilliputEngine::handleGameScripts() {
_scriptHandler->_characterScriptEnabled[index] = 0;
setCurrentCharacter(index);
- _waitingSignal = _array11D49[index] >> 8;
- _waitingSignalCharacterId = _array11D49[index] & 0xFF;
- _array11D49[index] = -1;
+ _waitingSignal = _characterSignals[index] >> 8;
+ _waitingSignalCharacterId = _characterSignals[index] & 0xFF;
+ _characterSignals[index] = -1;
_word1817B = 0;
int tmpVal = _characterBehaviour[index];
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 985e2f9..e58f7c4 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -155,13 +155,13 @@ public:
bool _isCursorGreenHand;
int _currentDisplayCharacter;
int _displayStringIndex;
- int _word1289D;
+ int _signalTimer;
Common::Point _word16937Pos;
int16 _mapSavedPixelIndex[40];
byte _mapSavedPixel[40];
- int16 _array11D49[40];
- int16 _array1289F[40];
+ int16 _characterSignals[40];
+ int16 _signalArr[40];
int16 _signalArray[30];
byte *_rulesChunk1;
@@ -218,7 +218,7 @@ public:
int8 _characterMagicPuffFrame[40];
int16 _characterSubTargetPosX[40];
int16 _characterSubTargetPosY[40];
- byte _stingArray[40];
+ byte _specialCubes[40];
byte _array16C54[4];
byte _array16C58[4];
byte _savedSurfaceGameArea1[176 * 256]; // 45056
@@ -268,8 +268,8 @@ public:
void updateCharPosSequence();
void sub16A08(int index);
byte sub16A76(int indexb, int indexs);
- void sub17224(byte type, byte index, int var4);
- void sub17264(byte index, int var4);
+ void signalDispatcher(byte type, byte index, int var4);
+ void sendMessageToCharacter(byte index, int var4);
int16 findHotspot(Common::Point pos);
int16 reverseFindHotspot(Common::Point pos);
byte sequenceSetMobility(int index, Common::Point var1);
@@ -287,12 +287,12 @@ public:
void handleCharacterTimers();
byte sequenceMoveCharacter(int idx, int moveType, int poseType);
void setCharacterPose(int idx, int poseIdx);
- void sub16EBC();
- void sub16CA0();
+ void checkSpecialCubes();
+ void checkInteractions();
byte sequenceSetCharacterDirection(int index, int direction, int poseType);
- void sub171CF();
+ void handleSignals();
void checkInterfaceActivationDelay();
- int16 sub16DD5(int x1, int y1, int x2, int y2);
+ int16 checkObstacle(int x1, int y1, int x2, int y2);
void displayCharactersOnMap();
void restoreMapPoints();
void displayHeroismIndicator();
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 8411415..4471461 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -205,7 +205,7 @@ byte LilliputScript::handleOpcodeType1(int curWord) {
return OC_CheckCurrentCharacterAttr1();
break;
case 0x28:
- return OC_isCurrentCharacterStung();
+ return OC_isCurrentCharacterSpecial();
break;
case 0x29:
return OC_CurrentCharacterAttr3Equals1();
@@ -1966,13 +1966,13 @@ byte LilliputScript::OC_CheckCurrentCharacterAttr1() {
return 0;
}
-byte LilliputScript::OC_isCurrentCharacterStung() {
- debugC(1, kDebugScript, "OC_isCurrentCharacterStung()");
+byte LilliputScript::OC_isCurrentCharacterSpecial() {
+ debugC(1, kDebugScript, "OC_isCurrentCharacterSpecial()");
if (_vm->_currentScriptCharacterPos == Common::Point(-1, -1))
return 0;
- if (_vm->_stingArray[_vm->_currentScriptCharacter] == 0)
+ if (_vm->_specialCubes[_vm->_currentScriptCharacter] == 0)
return 0;
return 1;
@@ -2478,7 +2478,7 @@ void LilliputScript::sendSignal(int16 var1, byte var2h, byte characterId, int16
if (_vm->_signalArray[index + 1] == -1) {
_vm->_signalArray[index + 1] = var1;
_vm->_signalArray[index + 2] = (var2h << 8) + characterId;
- _vm->_signalArray[index + 0] = _vm->_word1289D + var4;
+ _vm->_signalArray[index + 0] = _vm->_signalTimer + var4;
return;
}
index += 3;
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 2199f51..bd75e34 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -191,7 +191,7 @@ private:
byte OC_IsCurrentCharacterAttr0LessEqualThan();
byte OC_isCarried();
byte OC_CheckCurrentCharacterAttr1();
- byte OC_isCurrentCharacterStung();
+ byte OC_isCurrentCharacterSpecial();
byte OC_CurrentCharacterAttr3Equals1();
byte OC_checkCharacterDirection();
byte OC_checkLastInterfaceHotspotIndex();
Commit: 7f9c06f91acdd75acfcab69eb7665bbb3404c298
https://github.com/scummvm/scummvm/commit/7f9c06f91acdd75acfcab69eb7665bbb3404c298
Author: Strangerke (strangerke at scummvm.org)
Date: 2018-04-08T00:02:22+02:00
Commit Message:
LILLIPUT: more renaming, rework setMode
Changed paths:
engines/lilliput/lilliput.cpp
engines/lilliput/lilliput.h
engines/lilliput/script.cpp
engines/lilliput/script.h
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 4f3311d..c641945 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -152,7 +152,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_nextCharacterIndex = 0;
_waitingSignal = -1;
_waitingSignalCharacterId = -1;
- _word1817B = 0;
+ _newModesEvaluatedNumber = 0;
_savedSurfaceUnderMousePos = Common::Point(0, 0);
_displayGreenHand = false;
_isCursorGreenHand = false;
@@ -2738,7 +2738,7 @@ void LilliputEngine::handleGameScripts() {
_waitingSignal = _characterSignals[index] >> 8;
_waitingSignalCharacterId = _characterSignals[index] & 0xFF;
_characterSignals[index] = -1;
- _word1817B = 0;
+ _newModesEvaluatedNumber = 0;
int tmpVal = _characterBehaviour[index];
if (tmpVal == 0xFF)
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index e58f7c4..cbef154 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -149,7 +149,7 @@ public:
int _nextCharacterIndex;
int8 _waitingSignal;
int8 _waitingSignalCharacterId;
- uint16 _word1817B;
+ uint16 _newModesEvaluatedNumber;
Common::Point _savedSurfaceUnderMousePos;
bool _displayGreenHand;
bool _isCursorGreenHand;
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 4471461..b49ee08 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -33,22 +33,21 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
_cubeSet = 0;
_lastRandomValue = 0;
_scriptForVal = 0;
- _byte1881A = 0;
- _byte18823 = 0;
+ _textVarNumber = 0;
_speechDisplaySpeed = 3;
_speechTimer = 0;
_word16F00_characterId = -1;
- _word129A3 = 0;
+ _monitoredCharacter = 0;
_viewportCharacterTarget = -1;
_heroismBarX = 0;
_heroismBarBottomY = 0;
_viewportPos.x = 0;
_viewportPos.y = 0;
_currentSpeechId = 0;
- _array129A5[0] = 0;
- _array129A5[1] = 1;
- _array129A5[2] = 2;
- _array129A5[3] = 3;
+ _monitoredAttr[0] = 0;
+ _monitoredAttr[1] = 1;
+ _monitoredAttr[2] = 2;
+ _monitoredAttr[3] = 3;
_savedBuffer215Ptr = NULL;
_word1825E = Common::Point(0, 0);
@@ -57,8 +56,10 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
_interfaceButtonActivationDelay[i] = 0;
}
- for (int i = 0; i < 32; i++)
- _array1813BPos[i] = Common::Point(0, 0);
+ for (int i = 0; i < 32; i++) {
+ _newEvaluatedModes[i]._mode = 0;
+ _newEvaluatedModes[i]._priority = 0;
+ }
for (int i = 0; i < 40; i++) {
_characterScriptEnabled[i] = 1;
@@ -271,7 +272,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_ComputeCharacterVariable();
break;
case 0x9:
- OC_getRandom_type2();
+ OC_setAttributeToRandom();
break;
case 0xA:
OC_setCharacterPosition();
@@ -301,7 +302,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_computeChararacterAttr();
break;
case 0x13:
- OC_setByte18823();
+ OC_setTextVarNumber();
break;
case 0x14:
OC_callScript();
@@ -406,7 +407,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_setCharacterProperties();
break;
case 0x36:
- OC_sub1805D();
+ OC_setMonitoredCharacter();
break;
case 0x37:
OC_setNewPose();
@@ -427,7 +428,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_setCurrentCharacterAltitude();
break;
case 0x3D:
- OC_sub1817F();
+ OC_setModePriority();
break;
case 0x3E:
OC_sub181BB();
@@ -619,7 +620,7 @@ static const OpCode opCodes2[] = {
/* 0x06 */ { "OC_getComputedVariantSpeechIfMute", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, // pb
/* 0x07 */ { "OC_startSpeechIfSilent", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
/* 0x08 */ { "OC_computeCharacterVariable", 4, kGetValue1, kImmediateValue, kComputeOperation, kImmediateValue, kNone },
-/* 0x09 */ { "OC_getRandom_type2", 3, kGetValue1, kImmediateValue, kImmediateValue, kNone, kNone },
+/* 0x09 */ { "OC_setAttributeToRandom", 3, kGetValue1, kImmediateValue, kImmediateValue, kNone, kNone },
/* 0x0a */ { "OC_setCharacterPosition", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone },
/* 0x0b */ { "OC_disableCharacter", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x0c */ { "OC_saveAndQuit", 0, kNone, kNone, kNone, kNone, kNone },
@@ -629,7 +630,7 @@ static const OpCode opCodes2[] = {
/* 0x10 */ { "OC_deleteSavegameAndQuit", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x11 */ { "OC_incScriptForVal", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x12 */ { "OC_ComputeChararacterAttr", 5, kGetValue1, kImmediateValue,kComputeOperation, kGetValue1, kImmediateValue },
-/* 0x13 */ { "OC_setByte18823", 2, kGetValue1, kImmediateValue, kNone, kNone, kNone },
+/* 0x13 */ { "OC_setTextVarNumber", 2, kGetValue1, kImmediateValue, kNone, kNone, kNone },
/* 0x14 */ { "OC_callScript", 2, kImmediateValue, kGetValue1, kNone, kNone, kNone }, // run script
/* 0x15 */ { "OC_callScriptAndReturn", 2, kImmediateValue, kGetValue1, kNone, kNone, kNone }, // run script then stop
/* 0x16 */ { "OC_setCurrentScriptCharacterPos", 1, kgetPosFromScript, kNone, kNone, kNone, kNone },
@@ -664,14 +665,14 @@ static const OpCode opCodes2[] = {
/* 0x33 */ { "OC_setCurrentCharacterAttr2", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x34 */ { "OC_ClearCurrentCharacterAttr2", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x35 */ { "OC_setCharacterProperties", 5, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue },
-/* 0x36 */ { "OC_sub1805D", 5, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue },
+/* 0x36 */ { "OC_setMonitoredCharacter", 5, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue },
/* 0x37 */ { "OC_setNewPose", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
/* 0x38 */ { "OC_setCurrentCharacterDirection", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x39 */ { "OC_setInterfaceHotspot", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
/* 0x3a */ { "OC_scrollViewPort", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x3b */ { "OC_setViewPortPos", 1, kgetPosFromScript, kNone, kNone, kNone, kNone },
/* 0x3c */ { "OC_setCurrentCharacterAltitude", 1, kImmediateValue, kNone, kNone, kNone, kNone },
-/* 0x3d */ { "OC_sub1817F", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
+/* 0x3d */ { "OC_setModePriority", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
/* 0x3e */ { "OC_sub181BB", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
/* 0x3f */ { "OC_sub18213", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x40 */ { "OC_magicPuffEntrance", 1, kGetValue1, kNone, kNone, kNone, kNone },
@@ -1117,8 +1118,8 @@ void LilliputScript::formatSpeechString() {
}
}
-void LilliputScript::sub189B8() {
- debugC(2, kDebugScript, "sub189B8()");
+void LilliputScript::showSpeech() {
+ debugC(2, kDebugScript, "showSpeech()");
formatSpeechString();
int index = 0;
@@ -1149,7 +1150,6 @@ void LilliputScript::decodePackedText(char *buf) {
"'s |'t |re|gg|tt|pp|nn|ay|ar|wh|";
_vm->_displayStringIndex = 0;
- _byte1881A = 0;
int index = 0;
byte var1 = 0;
for (;;) {
@@ -1163,7 +1163,7 @@ void LilliputScript::decodePackedText(char *buf) {
var1 = buf[index];
++index;
if (var1 == '#') {
- _vm->numberToString(_byte18823);
+ _vm->numberToString(_textVarNumber);
}
} else {
_vm->addCharToBuf(var1);
@@ -1195,7 +1195,7 @@ void LilliputScript::decodePackedText(char *buf) {
}
}
- sub189B8();
+ showSpeech();
}
int LilliputScript::getPackedStringStartRelativeIndex(int index) {
@@ -2254,8 +2254,8 @@ void LilliputScript::OC_ComputeCharacterVariable() {
computeOperation(bufPtr, oper, var3);
}
-void LilliputScript::OC_getRandom_type2() {
- debugC(1, kDebugScript, "OC_getRandom_type2()");
+void LilliputScript::OC_setAttributeToRandom() {
+ debugC(1, kDebugScript, "OC_setAttributeToRandom()");
byte *bufPtr = getCharacterAttributesPtr();
int maxVal = _currScript->readUint16LE();
@@ -2342,11 +2342,11 @@ void LilliputScript::OC_computeChararacterAttr() {
computeOperation(tmpArr, oper, var3);
}
-void LilliputScript::OC_setByte18823() {
- debugC(1, kDebugScriptTBC, "OC_setByte18823()");
+void LilliputScript::OC_setTextVarNumber() {
+ debugC(1, kDebugScriptTBC, "OC_setTextVarNumber()");
byte *tmpArr = getCharacterAttributesPtr();
- _byte18823 = *tmpArr;
+ _textVarNumber = *tmpArr;
}
void LilliputScript::OC_callScript() {
@@ -2749,12 +2749,12 @@ void LilliputScript::OC_setCharacterProperties() {
_vm->_characterDirectionArray[index] = _currScript->readUint16LE() & 0xFF;
}
-void LilliputScript::OC_sub1805D() {
- debugC(1, kDebugScriptTBC, "OC_sub1805D()");
+void LilliputScript::OC_setMonitoredCharacter() {
+ debugC(1, kDebugScriptTBC, "OC_setMonitoredCharacter()");
- _word129A3 = getValue1();
+ _monitoredCharacter = getValue1();
for (int i = 0; i < 4; i++)
- _array129A5[i] = _currScript->readUint16LE() & 0xFF;
+ _monitoredAttr[i] = _currScript->readUint16LE() & 0xFF;
}
void LilliputScript::OC_setNewPose() {
@@ -2786,7 +2786,7 @@ void LilliputScript::OC_setInterfaceHotspot() {
}
void LilliputScript::OC_scrollViewPort() {
- debugC(1, kDebugScriptTBC, "OC_scrollViewPort()");
+ debugC(1, kDebugScript, "OC_scrollViewPort()");
_viewportCharacterTarget = -1;
@@ -2822,45 +2822,45 @@ void LilliputScript::OC_setCurrentCharacterAltitude() {
_vm->_characterPosAltitude[_vm->_currentScriptCharacter] = (_currScript->readUint16LE() & 0xFF);
}
-void LilliputScript::OC_sub1817F() {
- debugC(1, kDebugScript, "OC_sub1817F()");
+void LilliputScript::OC_setModePriority() {
+ debugC(1, kDebugScript, "OC_setModePriority()");
+
+ EvaluatedMode newMode;
- int8 x = (int8)(_currScript->readUint16LE() & 0xFF);
- int8 y = (int8)(_currScript->readUint16LE() & 0xFF);
+ newMode._mode = _currScript->readUint16LE() & 0xFF;
+ newMode._priority = _currScript->readUint16LE() & 0xFF;
- sub1818B(Common::Point(x, y));
+ setMode(newMode);
}
-void LilliputScript::sub1818B(Common::Point point) {
- debugC(2, kDebugScript, "sub1818B(%d - %d)", point.x, point.y);
+void LilliputScript::setMode(EvaluatedMode newMode) {
+ debugC(2, kDebugScript, "setMode(%d - %d)", newMode._mode, newMode._priority);
- Common::Point pos = point;
- for (int i = 0; i < _vm->_word1817B; i++) {
- if (_array1813BPos[i].x == pos.x) {
- pos.y += _array1813BPos[i].y;
- if (pos.y > 0xFF)
- pos.y = 0xFF;
+ for (int i = 0; i < _vm->_newModesEvaluatedNumber; i++) {
+ if (_newEvaluatedModes[i]._mode == newMode._mode) {
+ int newPriority = newMode._priority + _newEvaluatedModes[i]._priority;
+ newPriority = CLIP(newPriority, 0, 255);
- _array1813BPos[i] = pos;
+ _newEvaluatedModes[i]._priority = newPriority;
return;
}
}
- _array1813BPos[_vm->_word1817B] = pos;
- ++_vm->_word1817B;
+ _newEvaluatedModes[_vm->_newModesEvaluatedNumber] = newMode;
+ ++_vm->_newModesEvaluatedNumber;
}
void LilliputScript::OC_sub181BB() {
debugC(1, kDebugScript, "OC_sub181BB()");
- int8 x = (int8)(_currScript->readUint16LE() & 0xFF);
+ int8 mode = (int8)(_currScript->readUint16LE() & 0xFF);
byte oper = _currScript->readUint16LE() & 0xFF;
uint16 index = _currScript->readUint16LE();
int16 c = _vm->_currentCharacterAttributes[index];
switch (oper) {
case '-':
- c = - 1 - c;
+ c = -1 - c;
break;
case '>':
c -= 128;
@@ -2883,9 +2883,14 @@ void LilliputScript::OC_sub181BB() {
if (c > 0xFF)
warning("OC_sub181BB- Abnormal value c = %d, should put back c &= 0xFF;", c);
- int y = (_currScript->readSint16LE() * c) + c;
- y >>= 8;
- sub1818B(Common::Point(x, y));
+ int priority = (_currScript->readSint16LE() * c) + c;
+ priority >>= 8;
+
+ EvaluatedMode newMode;
+ newMode._mode = mode;
+ newMode._priority = priority;
+
+ setMode(newMode);
}
void LilliputScript::OC_sub18213() {
@@ -2896,10 +2901,10 @@ void LilliputScript::OC_sub18213() {
int maxValue = 0;
int maxItem = var1 & 0xFF;
- for (int i = 0; i < _vm->_word1817B; i++) {
- if (_array1813BPos[i].y > maxValue) {
- maxValue = _array1813BPos[i].y;
- maxItem = _array1813BPos[i].x;
+ for (int i = 0; i < _vm->_newModesEvaluatedNumber; i++) {
+ if (_newEvaluatedModes[i]._priority > maxValue) {
+ maxValue = _newEvaluatedModes[i]._priority;
+ maxItem = _newEvaluatedModes[i]._mode;
}
}
enableCharacterScript(_vm->_currentScriptCharacter, maxItem, _vm->_currentCharacterAttributes);
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index bd75e34..ab94fd0 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -53,7 +53,6 @@ enum kValueType {
kgetPosFromScript
};
-
struct OpCode {
const char* _opName;
int _numArgs;
@@ -64,6 +63,11 @@ struct OpCode {
kValueType _arg5;
};
+struct EvaluatedMode {
+ int _mode;
+ int _priority;
+};
+
class LilliputScript {
public:
byte _heroismLevel;
@@ -90,7 +94,7 @@ public:
Common::Point _sequenceArr[640];
byte _characterMapPixelColor[40];
int8 _characterLastSequence[40];
- Common::Point _array1813BPos[32];
+ EvaluatedMode _newEvaluatedModes[32];
LilliputScript(LilliputEngine *vm);
~LilliputScript();
@@ -110,17 +114,16 @@ private:
byte _cubeSet;
byte _lastRandomValue;
byte _scriptForVal;
- byte _byte1881A;
- byte _byte18823;
+ byte _textVarNumber;
byte _speechDisplaySpeed;
int16 _word16F00_characterId;
int _currentSpeechId;
int _word18821;
- int _word129A3;
+ int _monitoredCharacter;
Common::Point _word1825E;
- char _array129A5[4];
+ char _monitoredAttr[4];
int handleOpcode(ScriptStream *script);
byte handleOpcodeType1(int curWord);
@@ -138,7 +141,7 @@ private:
byte *getCurrentCharacterVarFromScript();
void sendSignal(int16 var1, byte var2h, byte characterId, int16 var4);
void getSpeechVariant(int speechIndex, int speechVariant);
- void sub189B8();
+ void showSpeech();
void formatSpeechString();
Common::Point getCharacterTilePos(int index);
int getPackedStringStartRelativeIndex(int index);
@@ -212,7 +215,7 @@ private:
void OC_getComputedVariantSpeechIfMute();
void OC_startSpeechIfSilent();
void OC_ComputeCharacterVariable();
- void OC_getRandom_type2();
+ void OC_setAttributeToRandom();
void OC_setCharacterPosition();
void OC_DisableCharacter();
void OC_saveAndQuit();
@@ -222,7 +225,7 @@ private:
void OC_deleteSavegameAndQuit();
void OC_incScriptForVal();
void OC_computeChararacterAttr();
- void OC_setByte18823();
+ void OC_setTextVarNumber();
void OC_callScript();
void OC_callScriptAndReturn();
void OC_setCurrentScriptCharacterPos();
@@ -257,15 +260,15 @@ private:
void OC_setCurrentCharacterAttr2();
void OC_clearCurrentCharacterAttr2();
void OC_setCharacterProperties();
- void OC_sub1805D();
+ void OC_setMonitoredCharacter();
void OC_setNewPose();
void OC_setCurrentCharacterDirection();
void OC_setInterfaceHotspot();
void OC_scrollViewPort();
void OC_setViewPortPos();
void OC_setCurrentCharacterAltitude();
- void OC_sub1817F();
- void sub1818B(Common::Point point);
+ void OC_setModePriority();
+ void setMode(EvaluatedMode newMode);
void OC_sub181BB();
void OC_sub18213();
void OC_magicPuffEntrance();
More information about the Scummvm-git-logs
mailing list