[Scummvm-git-logs] scummvm master -> d4bc98d121b3ec200d694e4e86d829cde5d2a837
rvanlaar
noreply at scummvm.org
Wed Sep 21 10:21:00 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d4bc98d121 DIRECTOR: LINGO: switch to use datum constructor
Commit: d4bc98d121b3ec200d694e4e86d829cde5d2a837
https://github.com/scummvm/scummvm/commit/d4bc98d121b3ec200d694e4e86d829cde5d2a837
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-21T12:14:35+02:00
Commit Message:
DIRECTOR: LINGO: switch to use datum constructor
The datum constructor is overloaded and handles setting the type.
Instead of setting the type by hand we leverage the constructor.
The in this commit are mainly for Datums of type int.
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-bytecode.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-object.cpp
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 9087e68a88c..203f51b75ad 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -687,8 +687,7 @@ void LB::b_findPos(int nargs) {
int index = LC::compareArrays(LC::eqData, list, prop, true).u.i;
if (index > 0) {
- d.type = INT;
- d.u.i = index;
+ d = index;
}
g_lingo->push(d);
@@ -1219,9 +1218,8 @@ void LB::b_showXlib(int nargs) {
}
void LB::b_xFactoryList(int nargs) {
- Datum d = g_lingo->pop();
- d.type = STRING;
- d.u.s = new Common::String();
+ g_lingo->pop();
+ Datum d("");
for (auto it = g_lingo->_openXLibs.begin(); it != g_lingo->_openXLibs.end(); it++)
*d.u.s += it->_key + "\n";
@@ -1863,6 +1861,8 @@ void LB::b_findEmpty(int nargs) {
return;
}
+ Datum res;
+
if (d.u.cast->member > c_end) {
d.type = INT;
g_lingo->push(d);
@@ -1875,16 +1875,14 @@ void LB::b_findEmpty(int nargs) {
for (uint16 i = c_start; i <= c_end; i++) {
if (!(cast->getCastMember(i) && cast->getCastMember(i)->_type != kCastTypeNull)) {
- d.u.i = i;
- d.type = INT;
- g_lingo->push(d);
+ res = i;
+ g_lingo->push(res);
return;
}
}
- d.type = INT;
- d.u.i = (int) c_end + 1;
- g_lingo->push(d);
+ res = (int) c_end + 1;
+ g_lingo->push(res);
}
void LB::b_importFileInto(int nargs) {
@@ -2677,8 +2675,7 @@ void LB::b_intersect(int nargs) {
Common::Rect rect1(r1.u.farr->arr[0].asInt(), r1.u.farr->arr[1].asInt(), r1.u.farr->arr[2].asInt(), r1.u.farr->arr[3].asInt());
Common::Rect rect2(r2.u.farr->arr[0].asInt(), r2.u.farr->arr[1].asInt(), r2.u.farr->arr[2].asInt(), r2.u.farr->arr[3].asInt());
- d.type = INT;
- d.u.i = rect1.intersects(rect2);
+ d = rect1.intersects(rect2);
g_lingo->push(d);
}
@@ -2690,8 +2687,7 @@ void LB::b_inside(int nargs) {
Common::Rect rect2(r2.u.farr->arr[0].asInt(), r2.u.farr->arr[1].asInt(), r2.u.farr->arr[2].asInt(), r2.u.farr->arr[3].asInt());
Common::Point point1(p1.u.farr->arr[0].asInt(), p1.u.farr->arr[1].asInt());
- d.type = INT;
- d.u.i = rect2.contains(point1);
+ d = rect2.contains(point1);
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index e030d353970..7c3710d3e00 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -945,9 +945,7 @@ void LC::cb_v4theentityassign() {
}
void LC::cb_zeropush() {
- Datum d;
- d.u.i = 0;
- d.type = INT;
+ Datum d(0);
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index ecd73c71775..11d002d6adc 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1280,8 +1280,7 @@ Datum LC::compareArrays(Datum (*compareFunc)(Datum, Datum), Datum d1, Datum d2,
}
Datum res;
- res.type = INT;
- res.u.i = location ? -1 : 1;
+ res = location ? -1 : 1;
Datum a = d1;
Datum b = d2;
for (uint i = 0; i < arraySize; i++) {
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index bb09f58e712..4255a155b6c 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -812,8 +812,7 @@ Datum DigitalVideoCastMember::getField(int field) {
case kTheDuration:
// sometimes, we will get duration before we start video.
// _duration is initialized in startVideo, thus we will not get the correct number.
- d.type = INT;
- d.u.i = getDuration();
+ d = (int)getDuration();
break;
case kTheFrameRate:
d = _frameRate;
@@ -904,8 +903,7 @@ Datum BitmapCastMember::getField(int field) {
switch (field) {
case kTheDepth:
- d.type = INT;
- d.u.i = _bitsPerPixel;
+ d = _bitsPerPixel;
break;
case kTheRegPoint:
d.type = POINT;
@@ -1004,13 +1002,13 @@ Datum TextCastMember::getField(int field) {
d.u.s = new Common::String(g_director->_wm->_fontMan->getFontName(_fontId));
break;
case kTheTextHeight:
- d.u.i = getTextHeight();
+ d = getTextHeight();
break;
case kTheTextSize:
- d.u.i = getTextSize();
+ d = getTextSize();
break;
case kTheTextStyle:
- d.u.i = _textSlant;
+ d = (int)_textSlant;
break;
default:
d = CastMember::getField(field);
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 353b7b513e8..937a2023202 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -380,31 +380,25 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d = g_lingo->_actorList;
break;
case kTheBeepOn:
- d.type = INT;
- d.u.i = (int)g_director->getCurrentMovie()->_isBeepOn;
+ d = (int)g_director->getCurrentMovie()->_isBeepOn;
break;
case kTheButtonStyle:
- d.type = INT;
- d.u.i = g_director->_wm->_mode & Graphics::kWMModeButtonDialogStyle;
+ d = (int)(g_director->_wm->_mode & Graphics::kWMModeButtonDialogStyle);
break;
case kTheCast:
d = getTheCast(id, field);
break;
case kTheCastMembers:
- d.type = INT;
- d.u.i = movie->getCast()->getCastSize() + (movie->_sharedCast ? movie->_sharedCast->getCastSize() : 0);
+ d = (int)(movie->getCast()->getCastSize() + (movie->_sharedCast ? movie->_sharedCast->getCastSize() : 0));
break;
case kTheCenterStage:
- d.type = INT;
- d.u.i = g_director->_centerStage;
+ d = g_director->_centerStage;
break;
case kTheCheckBoxAccess:
- d.type = INT;
- d.u.i = g_director->getCurrentMovie()->_checkBoxAccess;
+ d = g_director->getCurrentMovie()->_checkBoxAccess;
break;
case kTheCheckBoxType:
- d.type = INT;
- d.u.i = g_director->getCurrentMovie()->_checkBoxType;
+ d = g_director->getCurrentMovie()->_checkBoxType;
break;
case kTheChunk:
d = getTheChunk(id, field);
@@ -417,82 +411,66 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.type = POINT;
break;
case kTheClickOn:
- d.type = INT;
- d.u.i = movie->_currentClickOnSpriteId;
+ d = (int)movie->_currentClickOnSpriteId;
break;
case kTheColorDepth:
// bpp. 1, 2, 4, 8, 32
- d.type = INT;
- d.u.i = _vm->_colorDepth;
+ d = _vm->_colorDepth;
break;
case kTheColorQD:
- d.type = INT;
- d.u.i = 1;
+ d = 1;
break;
case kTheCommandDown:
- d.type = INT;
- d.u.i = (movie->_keyFlags & Common::KBD_META) ? 1 : 0;
+ d = (movie->_keyFlags & Common::KBD_META) ? 1 : 0;
break;
case kTheControlDown:
- d.type = INT;
- d.u.i = (movie->_keyFlags & Common::KBD_CTRL) ? 1 : 0;
+ d = (movie->_keyFlags & Common::KBD_CTRL) ? 1 : 0;
break;
case kTheDate:
d = getTheDate(field);
break;
case kTheDoubleClick:
- d.type = INT;
// Always measured against the last two clicks.
// 25 ticks seems to be the threshold for a double click.
- d.u.i = (movie->_lastClickTime - movie->_lastClickTime2) <= 25 ? 1 : 0;
+ d = (movie->_lastClickTime - movie->_lastClickTime2) <= 25 ? 1 : 0;
break;
case kTheExitLock:
- d.type = INT;
- d.u.i = g_lingo->_exitLock;
+ d = g_lingo->_exitLock;
break;
case kTheField:
d = getTheField(id, field);
break;
case kTheFixStageSize:
- d.type = INT;
- d.u.i = (int)g_director->_fixStageSize;
+ d = (int)g_director->_fixStageSize;
break;
case kTheFloatPrecision:
- d.type = INT;
- d.u.i = _floatPrecision;
+ d = _floatPrecision;
break;
case kTheFrame:
- d.type = INT;
- d.u.i = score->getCurrentFrame();
+ d = (int)score->getCurrentFrame();
break;
case kTheFrameLabel:
d.type = STRING;
d.u.s = score->getFrameLabel(score->getCurrentFrame());
break;
case kTheFrameScript:
- d.type = INT;
- d.u.i = score->_frames[score->getCurrentFrame()]->_actionId.member;
+ d = score->_frames[score->getCurrentFrame()]->_actionId.member;
break;
case kTheFramePalette:
- d.type = INT;
- d.u.i = score->getCurrentPalette();
+ d = score->getCurrentPalette();
break;
case kTheFrameTempo:
- d.type = INT;
- d.u.i = score->_currentFrameRate;
+ d = score->_currentFrameRate;
break;
case kTheFreeBlock:
case kTheFreeBytes:
- d.type = INT;
- d.u.i = 32 * 1024 * 1024; // Let's have 32 Mbytes
+ d = 32 * 1024 * 1024; // Let's have 32 Mbytes
break;
case kTheFullColorPermit:
- d.type = INT;
- d.u.i = 1; // We always allow it in ScummVM
+ d = 1; // We always allow it in ScummVM
break;
case kTheImageDirect:
- d.type = INT;
- d.u.i = 1; // We always allow it in ScummVM
+ d = 1; // We always allow it in ScummVM
break;
case kTheItemDelimiter:
{
@@ -506,8 +484,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.s = new Common::String(movie->_key);
break;
case kTheKeyCode:
- d.type = INT;
- d.u.i = movie->_keyCode;
+ d = movie->_keyCode;
break;
case kTheKeyDownScript:
d.type = STRING;
@@ -528,24 +505,19 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.s = score->getLabelList();
break;
case kTheLastClick:
- d.type = INT;
- d.u.i = _vm->getMacTicks() - movie->_lastClickTime;
+ d = (int)(_vm->getMacTicks() - movie->_lastClickTime);
break;
case kTheLastEvent:
- d.type = INT;
- d.u.i = _vm->getMacTicks() - movie->_lastEventTime;
+ d = (int)(_vm->getMacTicks() - movie->_lastEventTime);
break;
case kTheLastFrame:
- d.type = INT;
- d.u.i = score->_frames.size() - 1;
+ d = (int)score->_frames.size() - 1;
break;
case kTheLastKey:
- d.type = INT;
- d.u.i = _vm->getMacTicks() - movie->_lastKeyTime;
+ d = (int)(_vm->getMacTicks() - movie->_lastKeyTime);
break;
case kTheLastRoll:
- d.type = INT;
- d.u.i = _vm->getMacTicks() - movie->_lastRollTime;
+ d = (int)(_vm->getMacTicks() - movie->_lastRollTime);
break;
case kTheMachineType:
// These are actually coming from Gestalt machineType
@@ -590,16 +562,13 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
// 73 - Power Macintosh 6100/60 D5
// 76 - Macintosh Quadra 840av D4
// 256 - IBM PC-type machine D3
- d.type = INT;
- d.u.i = _vm->_machineType;
+ d = _vm->_machineType;
break;
case kTheMaxInteger:
- d.type = INT;
- d.u.i = 2147483647; // (2^31)-1 [max 32bit signed integer]
+ d = 2147483647; // (2^31)-1 [max 32bit signed integer]
break;
case kTheMemorySize:
- d.type = INT;
- d.u.i = 32 * 1024 * 1024; // Let's have 32 Mbytes
+ d = 32 * 1024 * 1024; // Let's have 32 Mbytes
break;
case kTheMenu:
d.type = STRING;
@@ -631,12 +600,10 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
switch (field) {
case kTheCheckMark:
- d.type = INT;
- d.u.i = g_director->_wm->getMenuItemCheckMark(menuItem);
+ d = g_director->_wm->getMenuItemCheckMark(menuItem);
break;
case kTheEnabled:
- d.type = INT;
- d.u.i = g_director->_wm->getMenuItemEnabled(menuItem);
+ d = g_director->_wm->getMenuItemEnabled(menuItem);
break;
case kTheName:
d.type = STRING;
@@ -644,8 +611,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
*(d.u.s) = g_director->_wm->getMenuItemName(menuItem);
break;
case kTheScript:
- d.type = INT;
- d.u.i = g_director->_wm->getMenuItemAction(menuItem);
+ d = g_director->_wm->getMenuItemAction(menuItem);
break;
default:
warning("Lingo::getTheEntity(): Unprocessed setting field \"%s\" of entity %s", field2str(field), entity2str(entity));
@@ -653,22 +619,19 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
}
break;
case kTheMenuItems:
- d.type = INT;
- d.u.i = getMenuItemsNum(id);
+ d = getMenuItemsNum(id);
break;
case kTheMenus:
- d.type = INT;
- d.u.i = getMenuNum();
+ d = getMenuNum();
break;
case kTheMouseCast:
{
// TODO: How is this handled with multiple casts in D5?
Common::Point pos = g_director->getCurrentWindow()->getMousePos();
uint16 spriteId = score->getSpriteIDFromPos(pos);
- d.type = INT;
- d.u.i = score->getSpriteById(spriteId)->_castId.member;
+ d = score->getSpriteById(spriteId)->_castId.member;
if (d.u.i == 0)
- d.u.i = -1;
+ d = -1;
}
break;
case kTheMouseChar:
@@ -677,13 +640,11 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
Common::Point pos = g_director->getCurrentWindow()->getMousePos();
uint16 spriteId = score->getSpriteIDFromPos(pos);
Channel *ch = score->getChannelById(spriteId);
- d.u.i = ch->getMouseChar(pos.x, pos.y);
- d.type = INT;
+ d = ch->getMouseChar(pos.x, pos.y);
}
break;
case kTheMouseDown:
- d.type = INT;
- d.u.i = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_LEFT | 1 << Common::MOUSE_BUTTON_RIGHT) ? 1 : 0;
+ d = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_LEFT | 1 << Common::MOUSE_BUTTON_RIGHT) ? 1 : 0;
break;
case kTheMouseDownScript:
d.type = STRING;
@@ -693,16 +654,14 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.s = new Common::String();
break;
case kTheMouseH:
- d.type = INT;
- d.u.i = g_director->getCurrentWindow()->getMousePos().x;
+ d = g_director->getCurrentWindow()->getMousePos().x;
break;
case kTheMouseItem:
{
Common::Point pos = g_director->getCurrentWindow()->getMousePos();
uint16 spriteId = score->getSpriteIDFromPos(pos);
Channel *ch = score->getChannelById(spriteId);
- d.u.i = ch->getMouseItem(pos.x, pos.y);
- d.type = INT;
+ d = ch->getMouseItem(pos.x, pos.y);
}
break;
case kTheMouseLine:
@@ -710,13 +669,11 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
Common::Point pos = g_director->getCurrentWindow()->getMousePos();
uint16 spriteId = score->getSpriteIDFromPos(pos);
Channel *ch = score->getChannelById(spriteId);
- d.u.i = ch->getMouseLine(pos.x, pos.y);
- d.type = INT;
+ d = ch->getMouseLine(pos.x, pos.y);
}
break;
case kTheMouseUp:
- d.type = INT;
- d.u.i = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_LEFT | 1 << Common::MOUSE_BUTTON_RIGHT) ? 0 : 1;
+ d = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_LEFT | 1 << Common::MOUSE_BUTTON_RIGHT) ? 0 : 1;
break;
case kTheMouseUpScript:
d.type = STRING;
@@ -726,8 +683,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.s = new Common::String();
break;
case kTheMouseV:
- d.type = INT;
- d.u.i = g_director->getCurrentWindow()->getMousePos().y;
+ d = g_director->getCurrentWindow()->getMousePos().y;
break;
case kTheMouseWord:
{
@@ -735,8 +691,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
Common::Point pos = g_director->getCurrentWindow()->getMousePos();
uint16 spriteId = score->getSpriteIDFromPos(pos);
Channel *ch = score->getChannelById(spriteId);
- d.u.i = ch->getMouseWord(pos.x, pos.y);
- d.type = INT;
+ d = ch->getMouseWord(pos.x, pos.y);
}
break;
case kTheMovie:
@@ -745,12 +700,10 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.s = new Common::String(movie->getMacName());
break;
case kTheMovieFileFreeSize:
- d.type = INT;
- d.u.i = 0; // Let's pretend the movie is compactified
+ d = 0; // Let's pretend the movie is compactified
break;
case kTheMovieFileSize:
- d.type = INT;
- d.u.i = movie->getArchive()->getFileSize();
+ d = movie->getArchive()->getFileSize();
break;
case kTheMoviePath:
case kThePathName:
@@ -759,64 +712,53 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
break;
case kTheMultiSound:
// We always support multiple sound channels!
- d.type = INT;
- d.u.i = 1;
+ d = 1;
break;
case kTheOptionDown:
- d.type = INT;
- d.u.i = (movie->_keyFlags & Common::KBD_ALT) ? 1 : 0;
+ d = (movie->_keyFlags & Common::KBD_ALT) ? 1 : 0;
break;
case kThePauseState:
- d.type = INT;
- d.u.i = (int) g_director->_playbackPaused;
+ d = (int) g_director->_playbackPaused;
break;
case kThePerFrameHook:
d = _perFrameHook;
break;
case kThePreloadEventAbort:
- d.type = INT;
- d.u.i = g_lingo->_preLoadEventAbort;
+ d = g_lingo->_preLoadEventAbort;
break;
case kThePreLoadRAM:
- d.u.i = 0; // We always have unlimited RAM
+ d = 0; // We always have unlimited RAM
break;
case kThePi:
- d.type = FLOAT;
- d.u.f = M_PI;
+ d = M_PI;
break;
case kTheQuickTimePresent:
// QuickTime is always present for scummvm
- d.type = INT;
- d.u.i = 1;
+ d = 1;
break;
case kTheRandomSeed:
- d.type = INT;
- d.u.i = g_director->_rnd.getSeed();
+ d = (int)g_director->_rnd.getSeed();
break;
case kTheResult:
d = g_lingo->_theResult;
break;
case kTheRightMouseDown:
- d.type = INT;
- d.u.i = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_RIGHT) ? 1 : 0;
+ d = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_RIGHT) ? 1 : 0;
break;
case kTheRightMouseUp:
- d.type = INT;
- d.u.i = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_RIGHT) ? 0 : 1;
+ d = g_system->getEventManager()->getButtonState() & (1 << Common::MOUSE_BUTTON_RIGHT) ? 0 : 1;
break;
case kTheRomanLingo:
- d.type = INT;
- d.u.i = g_lingo->_romanLingo;
+ d = g_lingo->_romanLingo;
warning("BUILDBOT: the romanLingo is get, value is %d", g_lingo->_romanLingo);
break;
case kTheScummvmVersion:
- d.type = INT;
- d.u.i = _vm->getVersion();
+ d = _vm->getVersion();
break;
case kTheSearchCurrentFolder:
//We always allow searching in current folder
warning("BUILDBOT: SearchCurrentFolder is queried");
- d = Datum(1);
+ d = 1;
break;
case kTheSearchPath:
d = g_lingo->_searchPath;
@@ -837,18 +779,15 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
Channel *channel = score->_channels[movie->_currentEditableTextChannel];
if (channel->_widget) {
- d.type = INT;
- d.u.i = ((Graphics::MacText *)channel->_widget)->getSelectionIndex(entity == kTheSelStart);
+ d = (int)((Graphics::MacText *)channel->_widget)->getSelectionIndex(entity == kTheSelStart);
}
}
break;
case kTheShiftDown:
- d.type = INT;
- d.u.i = (movie->_keyFlags & Common::KBD_SHIFT) ? 1 : 0;
+ d = (movie->_keyFlags & Common::KBD_SHIFT) ? 1 : 0;
break;
case kTheSoundEnabled:
- d.type = INT;
- d.u.i = _vm->getCurrentWindow()->getSoundManager()->getSoundEnabled();
+ d = _vm->getCurrentWindow()->getSoundManager()->getSoundEnabled();
break;
case kTheSoundEntity:
{
@@ -857,8 +796,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
{
SoundChannel *chan = _vm->getCurrentWindow()->getSoundManager()->getChannel(id.asInt());
if (chan) {
- d.type = INT;
- d.u.i = (int)chan->volume;
+ d = (int)chan->volume;
}
}
break;
@@ -870,8 +808,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
break;
case kTheSoundLevel:
// getting sound level of channel 1, maybe need to be amended in higher version
- d.type = INT;
- d.u.i = _vm->getCurrentWindow()->getSoundManager()->getSoundLevel(1);
+ d = _vm->getCurrentWindow()->getSoundManager()->getSoundLevel(1);
break;
case kTheSprite:
d = getTheSprite(id, field);
@@ -880,59 +817,47 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d = _vm->getStage();
break;
case kTheStageBottom:
- d.type = INT;
- d.u.i = _vm->getCurrentWindow()->getSurface()->h;
+ d = _vm->getCurrentWindow()->getSurface()->h;
break;
case kTheStageColor:
- d.type = INT;
// TODO: Provide proper reverse transform for non-indexed color
- d.u.i = (int)g_director->transformColor(g_director->getCurrentWindow()->getStageColor());
+ d = (int)g_director->transformColor(g_director->getCurrentWindow()->getStageColor());
break;
case kTheStageLeft:
- d.type = INT;
- d.u.i = 0;
+ d = 0;
break;
case kTheStageRight:
- d.type = INT;
- d.u.i = _vm->getCurrentWindow()->getSurface()->w;
+ d = _vm->getCurrentWindow()->getSurface()->w;
break;
case kTheStageTop:
- d.type = INT;
- d.u.i = 0;
+ d = 0;
break;
case kTheStillDown:
- d.type = INT;
- d.u.i = _vm->_wm->_mouseDown;
+ d = _vm->_wm->_mouseDown;
break;
case kTheSwitchColorDepth:
getTheEntitySTUB(kTheSwitchColorDepth);
break;
case kTheTicks:
- d.type = INT;
- d.u.i = _vm->getMacTicks();
+ d = (int)_vm->getMacTicks();
break;
case kTheTime:
d = getTheTime(field);
break;
case kTheTimeoutKeyDown:
- d.type = INT;
- d.u.i = g_director->getCurrentMovie()->_timeOutKeyDown;
+ d= g_director->getCurrentMovie()->_timeOutKeyDown;
break;
case kTheTimeoutLapsed:
- d.type = INT;
- d.u.i = _vm->getMacTicks() - g_director->getCurrentMovie()->_lastTimeOut;
+ d = (int)(_vm->getMacTicks() - g_director->getCurrentMovie()->_lastTimeOut);
break;
case kTheTimeoutLength:
- d.type = INT;
- d.u.i = g_director->getCurrentMovie()->_timeOutLength;
+ d = (int)g_director->getCurrentMovie()->_timeOutLength;
break;
case kTheTimeoutMouse:
- d.type = INT;
- d.u.i = g_director->getCurrentMovie()->_timeOutMouse;
+ d = g_director->getCurrentMovie()->_timeOutMouse;
break;
case kTheTimeoutPlay:
- d.type = INT;
- d.u.i = g_director->getCurrentMovie()->_timeOutPlay;
+ d = g_director->getCurrentMovie()->_timeOutPlay;
break;
case kTheTimeoutScript:
d.type = STRING;
@@ -942,24 +867,20 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.s = new Common::String();
break;
case kTheTimer:
- d.type = INT;
- d.u.i = _vm->getMacTicks() - movie->_lastTimerReset;
+ d = (int)(_vm->getMacTicks() - movie->_lastTimerReset);
break;
case kTheTrace:
- d.type = INT;
- d.u.i = (int) g_lingo->_trace;
+ d = (int) g_lingo->_trace;
break;
case kTheTraceLoad:
- d.type = INT;
- d.u.i = g_lingo->_traceLoad;
+ d = g_lingo->_traceLoad;
break;
case kTheTraceLogFile:
d.type = STRING;
d.u.s = new Common::String(g_director->_traceLogFile);
break;
case kTheUpdateMovieEnabled:
- d.type = INT;
- d.u.i = g_lingo->_updateMovieEnabled;
+ d = g_lingo->_updateMovieEnabled;
break;
case kTheWindow:
g_lingo->push(id);
@@ -1334,50 +1255,49 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
if (!sprite)
return d;
- d.type = INT;
switch (field) {
case kTheBackColor:
// TODO: Provide proper reverse transform for non-indexed color
- d.u.i = (int)g_director->transformColor(sprite->_backColor);
+ d = (int)g_director->transformColor(sprite->_backColor);
break;
case kTheBlend:
- d.u.i = sprite->_blend;
+ d = sprite->_blend;
break;
case kTheBottom:
- d.u.i = channel->getBbox().bottom;
+ d = channel->getBbox().bottom;
break;
case kTheCastNum:
// TODO: How is this handled with multiple casts in D5?
- d.u.i = sprite->_castId.member;
+ d = sprite->_castId.member;
break;
case kTheConstraint:
- d.u.i = channel->_constraint;
+ d = (int)channel->_constraint;
break;
case kTheCursor:
d = channel->_cursor._cursorResId;
break;
case kTheEditableText:
- d.u.i = sprite->_editable;
+ d = sprite->_editable;
break;
case kTheForeColor:
// TODO: Provide proper reverse transform for non-indexed color
- d.u.i = (int)g_director->transformColor(sprite->_foreColor);
+ d = (int)g_director->transformColor(sprite->_foreColor);
break;
case kTheHeight:
- d.u.i = channel->_height;
+ d = channel->_height;
break;
case kTheImmediate:
- d.u.i = sprite->_immediate;
+ d = sprite->_immediate;
break;
case kTheInk:
- d.u.i = sprite->_ink;
+ d = sprite->_ink;
break;
case kTheLeft:
- d.u.i = channel->getBbox().left;
+ d = channel->getBbox().left;
break;
case kTheLineSize:
- d.u.i = sprite->_thickness & 0x3;
+ d = sprite->_thickness & 0x3;
break;
case kTheLoc:
d.type = POINT;
@@ -1386,28 +1306,27 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
d.u.farr->arr.push_back(channel->_currentPoint.y);
break;
case kTheLocH:
- d.u.i = channel->_currentPoint.x;
+ d = channel->_currentPoint.x;
break;
case kTheLocV:
- d.u.i = channel->_currentPoint.y;
+ d = channel->_currentPoint.y;
break;
case kTheMoveableSprite:
- d.u.i = sprite->_moveable;
+ d = sprite->_moveable;
break;
case kTheMovieRate:
- d.type = FLOAT;
- d.u.f = channel->_movieRate;
+ d = channel->_movieRate;
if (debugChannelSet(-1, kDebugEndVideo))
d.u.f = 0.0;
break;
case kTheMovieTime:
- d.u.i = channel->_movieTime;
+ d = channel->_movieTime;
break;
case kThePattern:
- d.u.i = sprite->getPattern();
+ d = sprite->getPattern();
break;
case kThePuppet:
- d.u.i = sprite->_puppet;
+ d = sprite->_puppet;
break;
case kTheRect:
// let compiler to optimize this
@@ -1419,43 +1338,42 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
d.u.farr->arr.push_back(channel->getBbox().bottom);
break;
case kTheRight:
- d.u.i = channel->getBbox().right;
+ d = channel->getBbox().right;
break;
case kTheScoreColor:
//Check the last 3 bits of the _colorcode byte as value lies in 0 to 5
- d.u.i = (int)(sprite->_colorcode & 0x7);
+ d = (int)(sprite->_colorcode & 0x7);
break;
case kTheScriptNum:
- d.type = INT;
- d.u.i = sprite->_scriptId.member;
+ d = sprite->_scriptId.member;
break;
case kTheStartTime:
- d.u.i = channel->_startTime;
+ d = channel->_startTime;
break;
case kTheStopTime:
- d.u.i = channel->_stopTime;
+ d = channel->_stopTime;
break;
case kTheStretch:
- d.u.i = sprite->_stretch;
+ d = sprite->_stretch;
break;
case kTheTop:
- d.u.i = channel->getBbox().top;
+ d = channel->getBbox().top;
break;
case kTheTrails:
- d.u.i = sprite->_trails;
+ d = sprite->_trails;
break;
case kTheType:
- d.u.i = sprite->_spriteType;
+ d = sprite->_spriteType;
break;
case kTheVisibility:
case kTheVisible:
- d.u.i = (channel->_visible ? 1 : 0);
+ d = (channel->_visible ? 1 : 0);
break;
case kTheVolume:
- d.u.i = sprite->_volume;
+ d = sprite->_volume;
break;
case kTheWidth:
- d.u.i = channel->_width;
+ d = channel->_width;
break;
default:
warning("Lingo::getTheSprite(): Unprocessed getting field \"%s\" of sprite", field2str(field));
More information about the Scummvm-git-logs
mailing list