[Scummvm-git-logs] scummvm master -> ea4afc283471c37533ea3002c07afbbeaa182fa0
dreammaster
dreammaster at scummvm.org
Wed Jul 7 03:35:56 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0136043f09 COMMON: Revert Change Rect and Point to have int32 fields
ea4afc2834 SAGA2: Fix GetRandomBetween method
Commit: 0136043f094f51312a92b1a6fe5336dca0e1810f
https://github.com/scummvm/scummvm/commit/0136043f094f51312a92b1a6fe5336dca0e1810f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-06T20:35:42-07:00
Commit Message:
COMMON: Revert Change Rect and Point to have int32 fields
This reverts commit 1c3e7fb4e9e761b26840ca7dd785e80dfa639f18.
Changed paths:
common/rect.h
engines/access/bubble_box.cpp
engines/bladerunner/bladerunner.cpp
engines/bladerunner/ui/esper.cpp
engines/cruise/cruise_main.cpp
engines/cruise/cruise_main.h
engines/cruise/function.cpp
engines/cruise/gfxModule.cpp
engines/cruise/mainDraw.cpp
engines/cruise/menu.cpp
engines/glk/selection.cpp
engines/glk/window_text_grid.h
engines/hopkins/graphics.cpp
engines/macventure/gui.cpp
engines/mads/camera.cpp
engines/mads/camera.h
engines/mads/player.cpp
engines/pegasus/types.h
engines/prince/cursor.cpp
engines/prince/prince.cpp
engines/sci/engine/kevent.cpp
engines/sci/graphics/coordadjuster.cpp
engines/sci/graphics/coordadjuster.h
engines/sci/graphics/menu.cpp
engines/sci/graphics/menu.h
engines/sci/graphics/picture.cpp
engines/sci/graphics/screen.cpp
engines/sci/graphics/screen.h
engines/sci/graphics/text16.cpp
engines/sci/graphics/text16.h
engines/sci/graphics/transitions.cpp
engines/sci/graphics/transitions.h
engines/sci/graphics/view.cpp
engines/sci/graphics/view.h
engines/scumm/actor.cpp
engines/scumm/boxes.cpp
engines/scumm/boxes.h
engines/scumm/he/wiz_he.cpp
engines/scumm/verbs.h
engines/sherlock/events.cpp
engines/sherlock/screen.cpp
engines/sherlock/screen.h
engines/touche/saveload.cpp
engines/tsage/blue_force/blueforce_dialogs.cpp
engines/tsage/core.cpp
engines/tsage/ringworld/ringworld_dialogs.cpp
engines/ultima/shared/core/map.cpp
engines/ultima/shared/maps/map_base.cpp
engines/wage/design.cpp
engines/wage/design.h
engines/xeen/sprites.cpp
graphics/macgui/macwindowmanager.cpp
gui/ThemeEngine.cpp
diff --git a/common/rect.h b/common/rect.h
index f7d7a6606c..96437d752f 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -44,15 +44,15 @@ namespace Common {
* Simple class for handling both 2D position and size.
*/
struct Point {
- int32 x; /*!< The horizontal position of the point. */
- int32 y; /*!< The vertical position of the point. */
+ int16 x; /*!< The horizontal position of the point. */
+ int16 y; /*!< The vertical position of the point. */
Point() : x(0), y(0) {}
/**
* Create a point with position defined by @p x1 and @p y1.
*/
- Point(int32 x1, int32 y1) : x(x1), y(y1) {}
+ Point(int16 x1, int16 y1) : x(x1), y(y1) {}
/**
* Determine whether the position of two points is the same.
*/
@@ -143,21 +143,21 @@ static inline Point operator*(double multiplier, const Point &p) { return Point(
* When writing code using our Rect class, always keep this principle in mind!
*/
struct Rect {
- int32 top, left; /*!< The point at the top left of the rectangle (part of the Rect). */
- int32 bottom, right; /*!< The point at the bottom right of the rectangle (not part of the Rect). */
+ int16 top, left; /*!< The point at the top left of the rectangle (part of the Rect). */
+ int16 bottom, right; /*!< The point at the bottom right of the rectangle (not part of the Rect). */
Rect() : top(0), left(0), bottom(0), right(0) {}
/**
* Create a rectangle with the top-left corner at position (0, 0) and the given width @p w and height @p h.
*/
- Rect(int32 w, int32 h) : top(0), left(0), bottom(h), right(w) {}
+ Rect(int16 w, int16 h) : top(0), left(0), bottom(h), right(w) {}
/**
* Create a rectangle with the top-left corner at the given position (x1, y1)
* and the bottom-right corner at the position (x2, y2).
*
* The @p x2 value must be greater or equal @p x1 and @p y2 must be greater or equal @p y1.
*/
- Rect(int32 x1, int32 y1, int32 x2, int32 y2) : top(y1), left(x1), bottom(y2), right(x2) {
+ Rect(int16 x1, int16 y1, int16 x2, int16 y2) : top(y1), left(x1), bottom(y2), right(x2) {
assert(isValidRect());
}
/**
@@ -173,14 +173,14 @@ struct Rect {
*/
bool operator!=(const Rect &rhs) const { return !equals(rhs); }
- int32 width() const { return right - left; } /*!< Return the width of a rectangle. */
- int32 height() const { return bottom - top; } /*!< Return the height of a rectangle. */
+ int16 width() const { return right - left; } /*!< Return the width of a rectangle. */
+ int16 height() const { return bottom - top; } /*!< Return the height of a rectangle. */
- void setWidth(int32 aWidth) { /*!< Set the width to @p aWidth value. */
+ void setWidth(int16 aWidth) { /*!< Set the width to @p aWidth value. */
right = left + aWidth;
}
- void setHeight(int32 aHeight) { /*!< Set the height to @p aHeight value. */
+ void setHeight(int16 aHeight) { /*!< Set the height to @p aHeight value. */
bottom = top + aHeight;
}
@@ -192,7 +192,7 @@ struct Rect {
*
* @return True if the given position is inside this rectangle, false otherwise.
*/
- bool contains(int32 x, int32 y) const {
+ bool contains(int16 x, int16 y) const {
return (left <= x) && (x < right) && (top <= y) && (y < bottom);
}
@@ -272,7 +272,7 @@ struct Rect {
*
* @param offset The size to grow by.
*/
- void grow(int32 offset) {
+ void grow(int16 offset) {
top -= offset;
left -= offset;
bottom += offset;
@@ -302,7 +302,7 @@ struct Rect {
/**
* Reduce the dimensions of this rectangle by setting max width and max heigth.
*/
- void clip(int32 maxw, int32 maxh) {
+ void clip(int16 maxw, int16 maxh) {
clip(Rect(0, 0, maxw, maxh));
}
@@ -326,7 +326,7 @@ struct Rect {
/**
* Move this rectangle to the position defined by @p x, @p y.
*/
- void moveTo(int32 x, int32 y) {
+ void moveTo(int16 x, int16 y) {
bottom += y - top;
right += x - left;
top = y;
@@ -336,7 +336,7 @@ struct Rect {
/**
* Move the rectangle by the given delta x and y values.
*/
- void translate(int32 dx, int32 dy) {
+ void translate(int16 dx, int16 dy) {
left += dx; right += dx;
top += dy; bottom += dy;
}
@@ -359,7 +359,7 @@ struct Rect {
* Create a rectangle around the given center.
* @note The center point is rounded up and left when given an odd width and height.
*/
- static Rect center(int32 cx, int32 cy, int32 w, int32 h) {
+ static Rect center(int16 cx, int16 cy, int16 w, int16 h) {
int x = cx - w / 2, y = cy - h / 2;
return Rect(x, y, x + w, y + h);
}
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 63d318c32a..063062291d 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -67,7 +67,7 @@ void BubbleBox::clearBubbles() {
_vm->_screen->_screenYOff = 0;
Common::Rect r = _bubbles[i];
r.left -= 2;
- r.right = MIN(r.right, (int32)_vm->_screen->w);
+ r.right = MIN(r.right, (int16)_vm->_screen->w);
_vm->_screen->copyBlock(&_vm->_buffer1, r);
}
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 7561883897..6ef98f252a 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -1026,8 +1026,8 @@ bool BladeRunnerEngine::loadSplash() {
Common::Point BladeRunnerEngine::getMousePos() const {
Common::Point p = _eventMan->getMousePos();
- p.x = CLIP(p.x, int32(0), int32(639));
- p.y = CLIP(p.y, int32(0), int32(479));
+ p.x = CLIP(p.x, int16(0), int16(639));
+ p.y = CLIP(p.y, int16(0), int16(479));
return p;
}
diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp
index 569c58ba98..e6f3012030 100644
--- a/engines/bladerunner/ui/esper.cpp
+++ b/engines/bladerunner/ui/esper.cpp
@@ -957,10 +957,10 @@ void ESPER::drawPhotoWithGrid(Graphics::Surface &surface) {
}
void ESPER::drawSelection(Graphics::Surface &surface, bool crosshair, int style) {
- int left = CLIP(_selection.left, _screen.left, (int32)(_screen.right - 1));
- int top = CLIP(_selection.top, _screen.top, (int32)(_screen.bottom - 1));
- int right = CLIP(_selection.right, _screen.left, (int32)(_screen.right - 1));
- int bottom = CLIP(_selection.bottom, _screen.top, (int32)(_screen.bottom - 1));
+ int left = CLIP(_selection.left, _screen.left, (int16)(_screen.right - 1));
+ int top = CLIP(_selection.top, _screen.top, (int16)(_screen.bottom - 1));
+ int right = CLIP(_selection.right, _screen.left, (int16)(_screen.right - 1));
+ int bottom = CLIP(_selection.bottom, _screen.top, (int16)(_screen.bottom - 1));
int color = surface.format.RGBToColor(0, 144, 0);
if (style) {
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 3250c19fde..0857712e0a 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1389,8 +1389,8 @@ bool checkInput(int16 *buttonPtr) {
extern bool manageEvents();
int CruiseEngine::processInput() {
- int32 mouseX = 0;
- int32 mouseY = 0;
+ int16 mouseX = 0;
+ int16 mouseY = 0;
int16 button = 0;
/*if (inputSub1keyboad())
@@ -1746,7 +1746,7 @@ bool manageEvents() {
return false;
}
-void getMouseStatus(int16 *pMouseVar, int32 *pMouseX, int16 *pMouseButton, int32 *pMouseY) {
+void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
*pMouseX = currentMouseX;
*pMouseY = currentMouseY;
*pMouseButton = currentMouseButton;
@@ -1757,7 +1757,7 @@ void CruiseEngine::mainLoop() {
//int32 t_start,t_left;
//uint32 t_end;
//int32 q=0; /* Dummy */
- int32 mouseX, mouseY;
+ int16 mouseX, mouseY;
int16 mouseButton;
int enableUser = 0;
diff --git a/engines/cruise/cruise_main.h b/engines/cruise/cruise_main.h
index ea3bb5fb54..f9d0e2fc78 100644
--- a/engines/cruise/cruise_main.h
+++ b/engines/cruise/cruise_main.h
@@ -101,7 +101,7 @@ void getFileExtention(const char *name, char *buffer);
void *allocAndZero(int size);
void freeStuff2();
void mainLoop();
-void getMouseStatus(int16 *pMouseVar, int32 *pMouseX, int16 *pMouseButton, int32 *pMouseY);
+void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY);
bool testMask(int x, int y, unsigned char* pData, int stride);
menuElementSubStruct *getSelectedEntryInMenu(menuStruct *pMenu);
void closeAllMenu();
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 11a4a6821d..18dcaeeb50 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -164,8 +164,8 @@ int16 Op_Narrator() {
int16 Op_GetMouseX() {
int16 dummy;
- int32 mouseX;
- int32 mouseY;
+ int16 mouseX;
+ int16 mouseY;
int16 mouseButton;
getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY);
@@ -175,8 +175,8 @@ int16 Op_GetMouseX() {
int16 Op_GetMouseY() {
int16 dummy;
- int32 mouseX;
- int32 mouseY;
+ int16 mouseX;
+ int16 mouseY;
int16 mouseButton;
getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY);
@@ -705,8 +705,8 @@ int16 Op_FadeIn() {
int16 Op_GetMouseButton() {
int16 dummy;
- int32 mouseX;
- int32 mouseY;
+ int16 mouseX;
+ int16 mouseY;
int16 mouseButton;
getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY);
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 937574f7e9..9fd94d7ea6 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -230,8 +230,8 @@ void gfxModuleData_flipScreen() {
}
void gfxModuleData_addDirtyRect(const Common::Rect &r) {
- _vm->_dirtyRects.push_back(Common::Rect( MAX(r.left, (int32)0), MAX(r.top, (int32)0),
- MIN(r.right, (int32)320), MIN(r.bottom, (int32)200)));
+ _vm->_dirtyRects.push_back(Common::Rect( MAX(r.left, (int16)0), MAX(r.top, (int16)0),
+ MIN(r.right, (int16)320), MIN(r.bottom, (int16)200)));
}
/**
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index c952a1dc9a..015d0b07e9 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -1561,8 +1561,8 @@ void mainDraw(bool waitFl) {
return;
}
} else if ((linkedRelation) && (linkedMsgList)) {
- int32 mouseX;
- int32 mouseY;
+ int16 mouseX;
+ int16 mouseY;
int16 button;
getMouseStatus(&main10, &mouseX, &button, &mouseY);
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index cc2c5c2ade..295eef4d48 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -152,8 +152,8 @@ void updateMenuMouse(int mouseX, int mouseY, menuStruct *pMenu) {
bool manageEvents();
int processMenu(menuStruct *pMenu) {
- int32 mouseX;
- int32 mouseY;
+ int16 mouseX;
+ int16 mouseY;
int16 mouseButton;
int di;
int si;
diff --git a/engines/glk/selection.cpp b/engines/glk/selection.cpp
index df4b17fcba..63d900b502 100644
--- a/engines/glk/selection.cpp
+++ b/engines/glk/selection.cpp
@@ -147,8 +147,8 @@ void Selection::startSelection(const Point &pos) {
return;
}
- tx = MIN(pos.x, (int32)_hor);
- ty = MIN(pos.y, (int32)_ver);
+ tx = MIN(pos.x, (int16)_hor);
+ ty = MIN(pos.y, (int16)_ver);
_select.left = _select.right = _last.x = tx;
_select.top = _select.bottom = _last.y = ty;
@@ -167,8 +167,8 @@ void Selection::moveSelection(const Point &pos) {
return;
}
- tx = MIN(pos.x, (int32)_hor);
- ty = MIN(pos.y, (int32)_ver);
+ tx = MIN(pos.x, (int16)_hor);
+ ty = MIN(pos.y, (int16)_ver);
_select.right = _last.x = tx;
_select.bottom = _last.y = ty;
diff --git a/engines/glk/window_text_grid.h b/engines/glk/window_text_grid.h
index eb272be3c7..60f74b61f0 100644
--- a/engines/glk/window_text_grid.h
+++ b/engines/glk/window_text_grid.h
@@ -101,8 +101,8 @@ public:
*/
void setSize(const Point &newSize) override {
Window::setSize(newSize);
- _curX = CLIP((int32)_curX, _bbox.left, _bbox.right);
- _curY = CLIP((int32)_curY, _bbox.top, _bbox.bottom);
+ _curX = CLIP((int16)_curX, _bbox.left, _bbox.right);
+ _curY = CLIP((int16)_curY, _bbox.top, _bbox.bottom);
}
/**
@@ -110,8 +110,8 @@ public:
*/
void setPosition(const Point &newPos) override {
_bbox.moveTo(newPos);
- _curX = CLIP((int32)_curX, _bbox.left, _bbox.right);
- _curY = CLIP((int32)_curY, _bbox.top, _bbox.bottom);
+ _curX = CLIP((int16)_curX, _bbox.left, _bbox.right);
+ _curY = CLIP((int16)_curY, _bbox.top, _bbox.bottom);
}
/**
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index ab9ad12da2..86a25c5ea4 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -1227,10 +1227,10 @@ void GraphicsManager::displayDebugRect(Graphics::Surface *surface, const Common:
// Move for scrolling offset and adjust to crop on-screen
r.translate(-_scrollPosX, 0);
- r.left = MAX(r.left, (int32)0);
- r.top = MAX(r.top, (int32)0);
- r.right = MIN(r.right, (int32)SCREEN_WIDTH);
- r.bottom = MIN(r.bottom, (int32)SCREEN_HEIGHT);
+ r.left = MAX(r.left, (int16)0);
+ r.top = MAX(r.top, (int16)0);
+ r.right = MIN(r.right, (int16)SCREEN_WIDTH);
+ r.bottom = MIN(r.bottom, (int16)SCREEN_HEIGHT);
// If there's an on-screen portion, display it
if (r.isValidRect())
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 78cffb7647..65a96b8b12 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -738,8 +738,8 @@ void Gui::drawDraggedObject() {
ImageAsset *asset = _assets[_draggedObj.id];
// In case of overflow from the right/top
- uint w = asset->getWidth() + MIN((int32)0, _draggedObj.pos.x);
- uint h = asset->getHeight() + MIN((int32)0, _draggedObj.pos.y);
+ uint w = asset->getWidth() + MIN((int16)0, _draggedObj.pos.x);
+ uint h = asset->getHeight() + MIN((int16)0, _draggedObj.pos.y);
// In case of overflow from the bottom/left
if (_draggedObj.pos.x > 0 && _draggedObj.pos.x + w > kScreenWidth) {
@@ -766,7 +766,7 @@ void Gui::drawDraggedObject() {
target.x + _draggedSurface.w,
target.y + _draggedSurface.h),
Common::Point(0, 0));
- asset->blitInto(&_draggedSurface, MIN((int32)0, _draggedObj.pos.x), MIN((int32)0, _draggedObj.pos.y), kBlitBIC);
+ asset->blitInto(&_draggedSurface, MIN((int16)0, _draggedObj.pos.x), MIN((int16)0, _draggedObj.pos.y), kBlitBIC);
g_system->copyRectToScreen(
_draggedSurface.getBasePtr(0, 0),
diff --git a/engines/mads/camera.cpp b/engines/mads/camera.cpp
index 75288ea768..eb5942842a 100644
--- a/engines/mads/camera.cpp
+++ b/engines/mads/camera.cpp
@@ -83,7 +83,7 @@ void Camera::camPanTo(int target) {
}
}
-bool Camera::camPan(int32 *picture_view, int32 *player_loc, int display_size, int picture_size) {
+bool Camera::camPan(int16 *picture_view, int16 *player_loc, int display_size, int picture_size) {
bool panningFl = false;
if (_panAllowedFl) {
Scene &scene = _vm->_game->_scene;
diff --git a/engines/mads/camera.h b/engines/mads/camera.h
index ccf4c4cac3..63f1f9f7ff 100644
--- a/engines/mads/camera.h
+++ b/engines/mads/camera.h
@@ -53,7 +53,7 @@ public:
Camera(MADSEngine *vm);
void camPanTo(int target);
- bool camPan(int32 *picture_view, int32 *player_loc, int display_size, int picture_size);
+ bool camPan(int16 *picture_view, int16 *player_loc, int display_size, int picture_size);
void setDefaultPanX();
void setDefaultPanY();
};
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index bcd2f70857..f1fe7eaf59 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -342,7 +342,7 @@ void Player::update() {
scene._spriteSlots[slotIndex]._flags = IMG_ERASE;
int newDepth = 1;
- int yp = MIN(_playerPos.y, (int32)(MADS_SCENE_HEIGHT - 1));
+ int yp = MIN(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1));
for (int idx = 1; idx < DEPTH_BANDS_SIZE; ++idx) {
if (scene._sceneInfo->_depthList[newDepth] >= yp)
diff --git a/engines/pegasus/types.h b/engines/pegasus/types.h
index 5ef7efadb2..3ffbf7ac17 100644
--- a/engines/pegasus/types.h
+++ b/engines/pegasus/types.h
@@ -46,7 +46,7 @@ typedef uint32 NotificationFlags;
// Mac types.
typedef int16 ResIDType;
-typedef int32 CoordType;
+typedef int16 CoordType;
enum SlideDirection {
kSlideLeftMask = 1,
diff --git a/engines/prince/cursor.cpp b/engines/prince/cursor.cpp
index 0bd2eb1f20..a4e58dc4a2 100644
--- a/engines/prince/cursor.cpp
+++ b/engines/prince/cursor.cpp
@@ -80,8 +80,8 @@ void PrinceEngine::changeCursor(uint16 curId) {
case 3:
curSurface = _cursor3->getSurface();
Common::Point mousePos = _system->getEventManager()->getMousePos();
- mousePos.x = CLIP(mousePos.x, (int32) 315, (int32) 639);
- mousePos.y = CLIP(mousePos.y, (int32) 0, (int32) 170);
+ mousePos.x = CLIP(mousePos.x, (int16) 315, (int16) 639);
+ mousePos.y = CLIP(mousePos.y, (int16) 0, (int16) 170);
_system->warpMouse(mousePos.x, mousePos.y);
break;
}
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index ebdf1bc196..81177a4516 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -1016,9 +1016,9 @@ void PrinceEngine::mouseWeirdo() {
default:
break;
}
- mousePos.x = CLIP(mousePos.x, (int32) 315, (int32) 639);
+ mousePos.x = CLIP(mousePos.x, (int16) 315, (int16) 639);
_flags->setFlagValue(Flags::MXFLAG, mousePos.x);
- mousePos.y = CLIP(mousePos.y, (int32) 0, (int32) 170);
+ mousePos.y = CLIP(mousePos.y, (int16) 0, (int16) 170);
_flags->setFlagValue(Flags::MYFLAG, mousePos.y);
_system->warpMouse(mousePos.x, mousePos.y);
}
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index b95f21a8a6..b57b43ac96 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -323,8 +323,8 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
SegManager *segMan = s->_segMan;
if (obj.getSegment()) {
- int32 x = readSelectorValue(segMan, obj, SELECTOR(x));
- int32 y = readSelectorValue(segMan, obj, SELECTOR(y));
+ int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
+ int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
g_sci->_gfxCoordAdjuster->kernelGlobalToLocal(x, y);
@@ -341,8 +341,8 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
SegManager *segMan = s->_segMan;
if (obj.getSegment()) {
- int32 x = readSelectorValue(segMan, obj, SELECTOR(x));
- int32 y = readSelectorValue(segMan, obj, SELECTOR(y));
+ int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
+ int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
g_sci->_gfxCoordAdjuster->kernelLocalToGlobal(x, y);
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 5052567964..2f22d191d0 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -39,13 +39,13 @@ GfxCoordAdjuster16::GfxCoordAdjuster16(GfxPorts *ports)
GfxCoordAdjuster16::~GfxCoordAdjuster16() {
}
-void GfxCoordAdjuster16::kernelGlobalToLocal(int32 &x, int32 &y, reg_t planeObject) {
+void GfxCoordAdjuster16::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) {
Port *curPort = _ports->getPort();
x -= curPort->left;
y -= curPort->top;
}
-void GfxCoordAdjuster16::kernelLocalToGlobal(int32 &x, int32 &y, reg_t planeObject) {
+void GfxCoordAdjuster16::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) {
Port *curPort = _ports->getPort();
x += curPort->left;
y += curPort->top;
diff --git a/engines/sci/graphics/coordadjuster.h b/engines/sci/graphics/coordadjuster.h
index 789f3a6af4..f7ebd3ec75 100644
--- a/engines/sci/graphics/coordadjuster.h
+++ b/engines/sci/graphics/coordadjuster.h
@@ -40,8 +40,8 @@ public:
GfxCoordAdjuster16(GfxPorts *ports);
~GfxCoordAdjuster16();
- void kernelGlobalToLocal(int32 &x, int32 &y, reg_t planeObject = NULL_REG);
- void kernelLocalToGlobal(int32 &x, int32 &y, reg_t planeObject = NULL_REG);
+ void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+ void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
Common::Rect onControl(Common::Rect rect);
void setCursorPos(Common::Point &pos);
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index bde998f9c5..45f0ba3402 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -363,8 +363,8 @@ void GfxMenu::drawBar() {
listIterator = _list.begin();
while (listIterator != listEnd) {
listEntry = *listIterator;
- int32 textWidth;
- int32 textHeight;
+ int16 textWidth;
+ int16 textHeight;
if (g_sci->isLanguageRTL()) {
_text16->StringWidth(listEntry->textSplit.c_str(), _text16->GetFontId(), textWidth, textHeight);
_ports->_curPort->curLeft -= textWidth;
@@ -383,7 +383,7 @@ void GfxMenu::calculateMenuWidth() {
GuiMenuList::iterator menuIterator;
GuiMenuList::iterator menuEnd = _list.end();
GuiMenuEntry *menuEntry;
- int32 dummyHeight;
+ int16 dummyHeight;
menuIterator = _list.begin();
while (menuIterator != menuEnd) {
@@ -400,7 +400,7 @@ void GfxMenu::calculateMenuAndItemWidth() {
GuiMenuItemList::iterator itemIterator;
GuiMenuItemList::iterator itemEnd = _itemList.end();
GuiMenuItemEntry *itemEntry;
- int32 dummyHeight;
+ int16 dummyHeight;
calculateMenuWidth();
@@ -1024,8 +1024,8 @@ void GfxMenu::kernelDrawStatus(const char *text, int16 colorPen, int16 colorBack
if (!g_sci->isLanguageRTL()) {
_ports->moveTo(0, 1);
} else {
- int32 textWidth;
- int32 textHeight;
+ int16 textWidth;
+ int16 textHeight;
_text16->StringWidth(text, _text16->GetFontId(), textWidth, textHeight);
_ports->moveTo(_screen->getWidth() - textWidth, 1);
}
diff --git a/engines/sci/graphics/menu.h b/engines/sci/graphics/menu.h
index 1ad12fbfb1..95fd4f6c20 100644
--- a/engines/sci/graphics/menu.h
+++ b/engines/sci/graphics/menu.h
@@ -43,7 +43,7 @@ struct GuiMenuEntry {
uint16 id;
Common::String text;
Common::String textSplit;
- int32 textWidth;
+ int16 textWidth;
GuiMenuEntry(uint16 curId)
: id(curId), textWidth(0) { }
@@ -62,9 +62,9 @@ struct GuiMenuItemEntry {
Common::String text;
Common::String textSplit;
reg_t textVmPtr;
- int32 textWidth;
+ int16 textWidth;
Common::String textRightAligned;
- int32 textRightAlignedWidth;
+ int16 textRightAlignedWidth;
GuiMenuItemEntry(uint16 curMenuId, uint16 curId)
: menuId(curMenuId), id(curId),
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index f8c30b70e9..86fe891f39 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -82,9 +82,9 @@ void GfxPicture::draw(bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) {
}
void GfxPicture::reset() {
- int32 startY = _ports->getPort()->top;
- int32 startX = 0;
- int32 x, y;
+ int16 startY = _ports->getPort()->top;
+ int16 startX = 0;
+ int16 x, y;
_screen->vectorAdjustCoordinate(&startX, &startY);
for (y = startY; y < _screen->getHeight(); y++) {
for (x = startX; x < _screen->getWidth(); x++) {
@@ -868,11 +868,11 @@ void GfxPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority, by
}
// hard borders for filling
- int32 borderLeft = curPort->rect.left + curPort->left;
- int32 borderTop = curPort->rect.top + curPort->top;
- int32 borderRight = curPort->rect.right + curPort->left - 1;
- int32 borderBottom = curPort->rect.bottom + curPort->top - 1;
- int32 curToLeft, curToRight, a_set, b_set;
+ int16 borderLeft = curPort->rect.left + curPort->left;
+ int16 borderTop = curPort->rect.top + curPort->top;
+ int16 borderRight = curPort->rect.right + curPort->left - 1;
+ int16 borderBottom = curPort->rect.bottom + curPort->top - 1;
+ int16 curToLeft, curToRight, a_set, b_set;
// Translate coordinates, if required (needed for Macintosh 480x300)
_screen->vectorAdjustCoordinate(&borderLeft, &borderTop);
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 486f6530de..24b6569f04 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -980,12 +980,12 @@ struct UpScaledAdjust {
int denominator;
};
-void GfxScreen::adjustToUpscaledCoordinates(int32 &y, int32 &x) {
+void GfxScreen::adjustToUpscaledCoordinates(int16 &y, int16 &x) {
x = _upscaledWidthMapping[x];
y = _upscaledHeightMapping[y];
}
-void GfxScreen::adjustBackUpscaledCoordinates(int32 &y, int32 &x) {
+void GfxScreen::adjustBackUpscaledCoordinates(int16 &y, int16 &x) {
switch (_upscaledHires) {
case GFX_SCREEN_UPSCALED_480x300:
x = (x * 4) / 6;
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index c9d5af0afd..7311232ee9 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -128,8 +128,8 @@ public:
void scale2x(const SciSpan<const byte> &src, SciSpan<byte> &dst, int16 srcWidth, int16 srcHeight, byte bytesPerPixel = 1);
- void adjustToUpscaledCoordinates(int32 &y, int32 &x);
- void adjustBackUpscaledCoordinates(int32 &y, int32 &x);
+ void adjustToUpscaledCoordinates(int16 &y, int16 &x);
+ void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
void dither(bool addToFlag);
@@ -459,7 +459,7 @@ public:
return vectorGetPixel(_controlScreen, x, y);
}
- void vectorAdjustCoordinate(int32 *x, int32 *y) {
+ void vectorAdjustCoordinate(int16 *x, int16 *y) {
switch (_upscaledHires) {
case GFX_SCREEN_UPSCALED_480x300:
*x = (*x * 3) / 2;
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index cf36873eab..f354e6f048 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -367,7 +367,7 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId
return resultCharCount;
}
-void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int32 &textWidth, int32 &textHeight, bool restoreFont) {
+void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight, bool restoreFont) {
uint16 curChar;
GuiResourceId previousFontId = GetFontId();
int16 previousPenColor = _ports->_curPort->penClr;
@@ -412,7 +412,7 @@ void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId org
return;
}
-void GfxText16::StringWidth(const Common::String &str, GuiResourceId orgFontId, int32 &textWidth, int32 &textHeight) {
+void GfxText16::StringWidth(const Common::String &str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) {
Width(str.c_str(), 0, str.size(), orgFontId, textWidth, textHeight, true);
}
@@ -423,12 +423,12 @@ void GfxText16::DrawString(const Common::String &str, GuiResourceId orgFontId, i
Draw(str.c_str(), 0, str.size(), orgFontId, orgPenColor);
}
-int16 GfxText16::Size(Common::Rect &rect, const char *text, uint16 languageSplitter, GuiResourceId fontId, int32 maxWidth) {
+int16 GfxText16::Size(Common::Rect &rect, const char *text, uint16 languageSplitter, GuiResourceId fontId, int16 maxWidth) {
GuiResourceId previousFontId = GetFontId();
int16 previousPenColor = _ports->_curPort->penClr;
int16 charCount;
- int32 maxTextWidth = 0, textWidth;
- int32 totalHeight = 0, textHeight;
+ int16 maxTextWidth = 0, textWidth;
+ int16 totalHeight = 0, textHeight;
if (fontId != -1)
SetFont(fontId);
@@ -538,7 +538,7 @@ void GfxText16::Show(const char *text, int16 from, int16 len, GuiResourceId orgF
// Draws a text in rect.
void GfxText16::Box(const char *text, uint16 languageSplitter, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) {
- int32 textWidth, maxTextWidth, textHeight, charCount;
+ int16 textWidth, maxTextWidth, textHeight, charCount;
int16 offset = 0;
int16 hline = 0;
GuiResourceId previousFontId = GetFontId();
diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h
index 9864731400..1f53c5b4b0 100644
--- a/engines/sci/graphics/text16.h
+++ b/engines/sci/graphics/text16.h
@@ -52,11 +52,11 @@ public:
void ClearChar(int16 chr);
int16 GetLongest(const char *&text, int16 maxWidth, GuiResourceId orgFontId);
- void Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int32 &textWidth, int32 &textHeight, bool restoreFont);
- void StringWidth(const Common::String &str, GuiResourceId orgFontId, int32 &textWidth, int32 &textHeight);
+ void Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight, bool restoreFont);
+ void StringWidth(const Common::String &str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight);
void ShowString(const Common::String &str, GuiResourceId orgFontId, int16 orgPenColor);
void DrawString(const Common::String &str, GuiResourceId orgFontId, int16 orgPenColor);
- int16 Size(Common::Rect &rect, const char *text, uint16 textLanguage, GuiResourceId fontId, int32 maxWidth);
+ int16 Size(Common::Rect &rect, const char *text, uint16 textLanguage, GuiResourceId fontId, int16 maxWidth);
void Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor);
void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor);
void Box(const char *text, uint16 languageSplitter, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId);
diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp
index dc429f4987..96ed3eacb6 100644
--- a/engines/sci/graphics/transitions.cpp
+++ b/engines/sci/graphics/transitions.cpp
@@ -462,7 +462,7 @@ void GfxTransitions::straight(int16 number, bool blackoutFlag) {
}
}
-void GfxTransitions::scrollCopyOldToScreen(Common::Rect screenRect, int32 x, int32 y) {
+void GfxTransitions::scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y) {
if (_screen->getUpscaledHires()) {
_screen->adjustToUpscaledCoordinates(screenRect.top, screenRect.left);
_screen->adjustToUpscaledCoordinates(screenRect.bottom, screenRect.right);
diff --git a/engines/sci/graphics/transitions.h b/engines/sci/graphics/transitions.h
index c7ffcb9d31..d02121e7fa 100644
--- a/engines/sci/graphics/transitions.h
+++ b/engines/sci/graphics/transitions.h
@@ -80,7 +80,7 @@ private:
void pixelation(bool blackoutFlag);
void blocks(bool blackoutFlag);
void straight(int16 number, bool blackoutFlag);
- void scrollCopyOldToScreen(Common::Rect screenRect, int32 x, int32 y);
+ void scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y);
void scroll(int16 number);
void verticalRollFromCenter(bool blackoutFlag);
void verticalRollToCenter(bool blackoutFlag);
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index d362c4bf7d..095804e13c 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -805,8 +805,8 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
const Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
const CelInfo *celInfo = getCelInfo(loopNo, celNo);
const SciSpan<const byte> &bitmap = getBitmap(loopNo, celNo);
- const int32 celHeight = celInfo->height;
- const int32 celWidth = celInfo->width;
+ const int16 celHeight = celInfo->height;
+ const int16 celWidth = celInfo->width;
const byte clearKey = celInfo->clearKey;
const byte drawMask = priority > 15 ? GFX_SCREEN_MASK_VISUAL : GFX_SCREEN_MASK_VISUAL|GFX_SCREEN_MASK_PRIORITY;
@@ -814,8 +814,8 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
// Merge view palette in...
_palette->set(&_viewPalette, false);
- const int32 width = MIN(clipRect.width(), celWidth);
- const int32 height = MIN(clipRect.height(), celHeight);
+ const int16 width = MIN(clipRect.width(), celWidth);
+ const int16 height = MIN(clipRect.height(), celHeight);
if (!width || !height) {
return;
@@ -886,11 +886,11 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect,
createScalingTable(scalingX, celWidth, _screen->getWidth(), scaleX);
createScalingTable(scalingY, celHeight, _screen->getHeight(), scaleY);
- int32 scaledWidth = MIN(clipRect.width(), (int32)scalingX.size());
- int32 scaledHeight = MIN(clipRect.height(), (int32)scalingY.size());
+ int16 scaledWidth = MIN(clipRect.width(), (int16)scalingX.size());
+ int16 scaledHeight = MIN(clipRect.height(), (int16)scalingY.size());
- const int32 offsetY = clipRect.top - rect.top;
- const int32 offsetX = clipRect.left - rect.left;
+ const int16 offsetY = clipRect.top - rect.top;
+ const int16 offsetX = clipRect.left - rect.left;
const byte *bitmapData = bitmap.getUnsafeDataAt(0, celWidth * celHeight);
for (int y = 0; y < scaledHeight; y++) {
@@ -930,11 +930,11 @@ void GfxView::createScalingTable(Common::Array<uint16> &table, int16 celSize, ui
}
}
-void GfxView::adjustToUpscaledCoordinates(int32 &y, int32 &x) {
+void GfxView::adjustToUpscaledCoordinates(int16 &y, int16 &x) {
_screen->adjustToUpscaledCoordinates(y, x);
}
-void GfxView::adjustBackUpscaledCoordinates(int32 &y, int32 &x) {
+void GfxView::adjustBackUpscaledCoordinates(int16 &y, int16 &x) {
_screen->adjustBackUpscaledCoordinates(y, x);
}
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 3d44786f8d..de62b36eb0 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -78,8 +78,8 @@ public:
bool isScaleable();
- void adjustToUpscaledCoordinates(int32 &y, int32 &x);
- void adjustBackUpscaledCoordinates(int32 &y, int32 &x);
+ void adjustToUpscaledCoordinates(int16 &y, int16 &x);
+ void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
private:
void initData(GuiResourceId resourceId);
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index a0e98f47db..364a51092e 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -1806,7 +1806,7 @@ AdjustBoxResult Actor_v2::adjustXYToBeInBox(const int dstX, const int dstY) {
AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY) {
const uint thresholdTable[] = { 30, 80, 0 };
AdjustBoxResult abr;
- int32 tmpX, tmpY;
+ int16 tmpX, tmpY;
int tmpDist, bestDist, threshold, numBoxes;
byte flags, bestBox;
int box;
diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp
index 0410c90f30..0b5f5d6b3d 100644
--- a/engines/scumm/boxes.cpp
+++ b/engines/scumm/boxes.cpp
@@ -643,7 +643,7 @@ BoxCoords ScummEngine::getBoxCoordinates(int boxnum) {
return *box;
}
-int getClosestPtOnBox(const BoxCoords &box, int x, int y, int32 &outX, int32 &outY) {
+int getClosestPtOnBox(const BoxCoords &box, int x, int y, int16& outX, int16& outY) {
const Common::Point p(x, y);
Common::Point tmp;
uint dist;
diff --git a/engines/scumm/boxes.h b/engines/scumm/boxes.h
index 8c409a7df3..4fd1947848 100644
--- a/engines/scumm/boxes.h
+++ b/engines/scumm/boxes.h
@@ -49,7 +49,7 @@ struct BoxCoords { /* Box coordinates */
Common::Point lr;
};
-int getClosestPtOnBox(const BoxCoords &box, int x, int y, int32 & outX, int32 & outY);
+int getClosestPtOnBox(const BoxCoords &box, int x, int y, int16& outX, int16& outY);
} // End of namespace Scumm
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 7778cec67d..f55cc6ea1a 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -2091,7 +2091,7 @@ void Wiz::drawWizPolygonImage(uint8 *dst, const uint8 *src, const uint8 *mask, i
bbox[3].x = 0;
bbox[3].y = wizH - 1;
- int32 xmin_p, xmax_p, ymin_p, ymax_p;
+ int16 xmin_p, xmax_p, ymin_p, ymax_p;
xmin_p = ymin_p = (int16)0x7FFF;
xmax_p = ymax_p = (int16)0x8000;
@@ -2102,7 +2102,7 @@ void Wiz::drawWizPolygonImage(uint8 *dst, const uint8 *src, const uint8 *mask, i
ymax_p = MAX(wp[i].y, ymax_p);
}
- int32 xmin_b, xmax_b, ymin_b, ymax_b;
+ int16 xmin_b, xmax_b, ymin_b, ymax_b;
xmin_b = ymin_b = (int16)0x7FFF;
xmax_b = ymax_b = (int16)0x8000;
diff --git a/engines/scumm/verbs.h b/engines/scumm/verbs.h
index bc03741822..f4aafb7636 100644
--- a/engines/scumm/verbs.h
+++ b/engines/scumm/verbs.h
@@ -56,7 +56,7 @@ struct VerbSlot {
bool center;
uint8 prep;
uint16 imgindex;
- int32 origLeft;
+ int16 origLeft;
};
enum VerbsV0 {
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index 002cd8098b..39208d45fe 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -154,7 +154,7 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
s.SHblitFrom(surface, Common::Point(drawPos.x, drawPos.y));
// Draw the cursor image
- drawPos = Common::Point(MAX(cursorPt.x, (int32)0), MAX(cursorPt.y, (int32)0));
+ drawPos = Common::Point(MAX(cursorPt.x, (int16)0), MAX(cursorPt.y, (int16)0));
s.SHtransBlitFrom(cursorImg, Common::Point(drawPos.x, drawPos.y));
// Set up hotspot position for cursor, adjusting for cursor image's position within the surface
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 71bebfc090..fdc6a02b47 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -204,8 +204,8 @@ void Screen::slamRect(const Common::Rect &r) {
}
}
-void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, int32 *xp, int32 *yp,
- int32 *width_, int32 *height_) {
+void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
+ int16 *width_, int16 *height_) {
Common::Point imgPos = pt + frame->_offset;
Common::Rect newBounds(imgPos.x, imgPos.y, imgPos.x + frame->_frame.w, imgPos.y + frame->_frame.h);
Common::Rect oldBounds(*xp, *yp, *xp + *width_, *yp + *height_);
@@ -232,8 +232,8 @@ void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, int32 *xp, i
*height_ = newBounds.height();
}
-void Screen::flushScaleImage(ImageFrame *frame, const Common::Point &pt, int32 *xp, int32 *yp,
- int32 *width_, int32 *height_, int scaleVal) {
+void Screen::flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
+ int16 *width_, int16 *height_, int scaleVal) {
Common::Point imgPos(pt.x + frame->sDrawXOffset(scaleVal), pt.y + frame->sDrawYOffset(scaleVal));
Common::Rect newBounds(imgPos.x, imgPos.y, imgPos.x + frame->sDrawXSize(scaleVal),
imgPos.y + frame->sDrawYSize(scaleVal));
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index 13625425ec..93df9aeaaa 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -132,15 +132,15 @@ public:
* Copy an image from the back buffer to the screen, taking care of both the
* new area covered by the shape as well as the old area, which must be restored
*/
- void flushImage(ImageFrame *frame, const Common::Point &pt, int32 *xp, int32 *yp,
- int32 *width, int32 *height);
+ void flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
+ int16 *width, int16 *height);
/**
* Similar to flushImage, this method takes in an extra parameter for the scale proporation,
* which affects the calculated bounds accordingly
*/
- void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int32 *xp, int32 *yp,
- int32 *width, int32 *height, int scaleVal);
+ void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
+ int16 *width, int16 *height, int scaleVal);
/**
* Variation of flushImage/flushScaleImage that takes in and updates a rect
diff --git a/engines/touche/saveload.cpp b/engines/touche/saveload.cpp
index 0257f89918..36ffcc1d9c 100644
--- a/engines/touche/saveload.cpp
+++ b/engines/touche/saveload.cpp
@@ -46,18 +46,10 @@ static void saveOrLoad(Common::WriteStream &stream, int16 &i) {
stream.writeSint16LE(i);
}
-static void saveOrLoad(Common::WriteStream &stream, int32 &i) {
- stream.writeSint16LE(i);
-}
-
static void saveOrLoad(Common::ReadStream &stream, int16 &i) {
i = stream.readSint16LE();
}
-static void saveOrLoad(Common::ReadStream &stream, int32 &i) {
- i = stream.readSint16LE();
-}
-
static void saveOrLoadPtr(Common::WriteStream &stream, int16 *&p, int16 *base) {
int32 offset = (int32)(p - base);
stream.writeSint32LE(offset);
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
index 7d61a1947d..e91034a3fa 100644
--- a/engines/tsage/blue_force/blueforce_dialogs.cpp
+++ b/engines/tsage/blue_force/blueforce_dialogs.cpp
@@ -511,7 +511,7 @@ OptionsDialog::OptionsDialog() {
// Set all the buttons to the widest button
GfxButton *btnList[6] = {&_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume};
- int32 btnWidth = 0;
+ int16 btnWidth = 0;
for (int idx = 0; idx < 6; ++idx)
btnWidth = MAX(btnWidth, btnList[idx]->_bounds.width());
for (int idx = 0; idx < 6; ++idx)
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index bd51b9e5ab..dfaf99f2e2 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2841,7 +2841,7 @@ GfxSurface SceneObject::getFrame() {
void SceneObject::reposition() {
if (g_vm->getGameID() == GType_Ringworld2) {
if (!(_flags & OBJFLAG_ZOOMED)) {
- setZoom(g_globals->_sceneManager._scene->_zoomPercents[MIN(_position.y, (int32)255)]);
+ setZoom(g_globals->_sceneManager._scene->_zoomPercents[MIN(_position.y, (int16)255)]);
}
}
diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp
index 7c9af997b1..afb600fd1c 100644
--- a/engines/tsage/ringworld/ringworld_dialogs.cpp
+++ b/engines/tsage/ringworld/ringworld_dialogs.cpp
@@ -282,7 +282,7 @@ OptionsDialog::OptionsDialog() {
// Set all the buttons to the widest button
GfxButton *btnList[6] = {&_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume};
- int32 btnWidth = 0;
+ int16 btnWidth = 0;
for (int idx = 0; idx < 6; ++idx)
btnWidth = MAX(btnWidth, btnList[idx]->_bounds.width());
for (int idx = 0; idx < 6; ++idx)
diff --git a/engines/ultima/shared/core/map.cpp b/engines/ultima/shared/core/map.cpp
index 68272e75f4..807a7007d5 100644
--- a/engines/ultima/shared/core/map.cpp
+++ b/engines/ultima/shared/core/map.cpp
@@ -144,8 +144,8 @@ void Map::MapBase::shiftViewport(const Point &delta) {
topLeft += delta;
// Shift the viewport, but constraining the map to fill up the screen
- topLeft.x = CLIP(topLeft.x, (int32)0, (int32)(width() - _viewportPos._size.x));
- topLeft.y = CLIP(topLeft.y, (int32)0, (int32)(height() - _viewportPos._size.y));
+ topLeft.x = CLIP(topLeft.x, (int16)0, (int16)(width() - _viewportPos._size.x));
+ topLeft.y = CLIP(topLeft.y, (int16)0, (int16)(height() - _viewportPos._size.y));
}
void Map::MapBase::addWidget(MapWidget *widget) {
diff --git a/engines/ultima/shared/maps/map_base.cpp b/engines/ultima/shared/maps/map_base.cpp
index b94f84526f..d51e378929 100644
--- a/engines/ultima/shared/maps/map_base.cpp
+++ b/engines/ultima/shared/maps/map_base.cpp
@@ -156,8 +156,8 @@ void MapBase::shiftViewport(const Point &delta) {
topLeft += delta;
// Shift the viewport, but constraining the map to fill up the screen
- topLeft.x = CLIP(topLeft.x, (int32)0, (int32)(width() - _viewportPos._size.x));
- topLeft.y = CLIP(topLeft.y, (int32)0, (int32)(height() - _viewportPos._size.y));
+ topLeft.x = CLIP(topLeft.x, (int16)0, (int16)(width() - _viewportPos._size.x));
+ topLeft.y = CLIP(topLeft.y, (int16)0, (int16)(height() - _viewportPos._size.y));
}
void MapBase::addWidget(MapWidget *widget) {
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 744da5aa05..7a57501a7c 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -195,7 +195,7 @@ bool Design::isPointOpaque(int x, int y) {
return pixel != kColorGreen;
}
-void Design::adjustBounds(int32 x, int32 y) {
+void Design::adjustBounds(int16 x, int16 y) {
_bounds->right = MAX(x, _bounds->right);
_bounds->bottom = MAX(y, _bounds->bottom);
}
diff --git a/engines/wage/design.h b/engines/wage/design.h
index ec3a69f23a..7ed70ff9de 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -83,7 +83,7 @@ public:
static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
bool isBoundsCalculation() { return _boundsCalculationMode; }
- void adjustBounds(int32 x, int32 y);
+ void adjustBounds(int16 x, int16 y);
private:
byte *_data;
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index ac653e8591..35c9ac1467 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -370,7 +370,7 @@ void SpriteDrawer::draw(XSurface &dest, uint16 offset, const Common::Point &pt,
(flags & SPRFLAG_SCENE_CLIPPED) ? SCENE_CLIP_LEFT : clipRect.left, destPos.y);
_destRight = (byte *)dest.getBasePtr(
(flags & SPRFLAG_SCENE_CLIPPED) ? SCENE_CLIP_RIGHT : clipRect.right, destPos.y);
- int32 xp = destPos.x;
+ int16 xp = destPos.x;
lineP = &tempLine[SCREEN_WIDTH];
for (int xCtr = 0; xCtr < width; ++xCtr, ++lineP) {
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 99783b0a5a..2a5fd4faef 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -765,7 +765,7 @@ void MacWindowManager::draw() {
}
adjustDimensions(clip, innerDims, adjWidth, adjHeight);
- g_system->copyRectToScreen(w->getWindowSurface()->getBasePtr(MAX(clip.left - innerDims.left, 0), MAX(clip.top - innerDims.top, 0)), w->getWindowSurface()->pitch,MAX(innerDims.left, (int32)0), MAX(innerDims.top, (int32)0), adjWidth, adjHeight);
+ g_system->copyRectToScreen(w->getWindowSurface()->getBasePtr(MAX(clip.left - innerDims.left, 0), MAX(clip.top - innerDims.top, 0)), w->getWindowSurface()->pitch,MAX(innerDims.left, (int16)0), MAX(innerDims.top, (int16)0), adjWidth, adjHeight);
dirtyRects.push_back(clip);
}
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index bd939b4b33..e6142f5c69 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1163,7 +1163,7 @@ void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo s
dd = kDDSliderDisabled;
Common::Rect r2 = r;
- r2.setWidth(MIN((int32)width, r.width()));
+ r2.setWidth(MIN((int16)width, r.width()));
// r2.top++; r2.bottom--; r2.left++; r2.right--;
if (rtl) {
Commit: ea4afc283471c37533ea3002c07afbbeaa182fa0
https://github.com/scummvm/scummvm/commit/ea4afc283471c37533ea3002c07afbbeaa182fa0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-06T20:35:43-07:00
Commit Message:
SAGA2: Fix GetRandomBetween method
Changed paths:
engines/saga2/actor.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index cfd4196432..aa0147f1c1 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -3322,7 +3322,7 @@ bool areActorsInitialized(void) {
}
int16 GetRandomBetween(int start, int end) {
- g_vm->_rnd->getRandomNumberRng(start, end);
+ return g_vm->_rnd->getRandomNumberRng(start, end);
}
void updateActorStates(void) {
More information about the Scummvm-git-logs
mailing list